@hellcoder/companion 0.113.1-preview.20260728143649.6f08bbd → 0.113.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgentsPage-BBi5x0sS.js → AgentsPage-DoMIvK5c.js} +1 -1
- package/dist/assets/{CronManager-B1s3pGHK.js → CronManager-DA1peJy7.js} +1 -1
- package/dist/assets/{DashboardPage-DFgvPALP.js → DashboardPage-C4B7XxBJ.js} +1 -1
- package/dist/assets/{IntegrationsPage-ClHcXTNR.js → IntegrationsPage-D4FtQBUj.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-aKHb8Kgv.js → LinearOAuthSettingsPage-BSfT0Ulr.js} +1 -1
- package/dist/assets/{LinearSettingsPage-DZbV5ES0.js → LinearSettingsPage-g23UlNTx.js} +1 -1
- package/dist/assets/{Playground-Z8gfp_Pg.js → Playground-By14cDox.js} +1 -1
- package/dist/assets/{PromptsPage-BF5QRCM7.js → PromptsPage-9YIF_Pkw.js} +1 -1
- package/dist/assets/{RunsPage-Bn7SIAEx.js → RunsPage-CeuQAzD-.js} +1 -1
- package/dist/assets/{SandboxManager-BNIPWLHz.js → SandboxManager-CoHOUMFN.js} +1 -1
- package/dist/assets/{SettingsPage-CFe6_dW9.js → SettingsPage-B6pfdIlj.js} +1 -1
- package/dist/assets/{TailscalePage-DPJGhCUO.js → TailscalePage-B6WlB5tj.js} +1 -1
- package/dist/assets/{index-B6xqr-v6.js → index-By5tzX2N.js} +8 -8
- package/dist/assets/{sw-register-A0FMc-CY.js → sw-register-E2OIBgNb.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/claude-adapter.test.ts +50 -0
- package/server/claude-adapter.ts +15 -0
- package/server/ws-bridge-types.ts +16 -0
- package/server/ws-bridge.test.ts +107 -0
- package/server/ws-bridge.ts +37 -0
|
@@ -45,8 +45,8 @@ var Tj=Object.defineProperty;var Aj=(e,t,n)=>t in e?Tj(e,t,{enumerable:!0,config
|
|
|
45
45
|
`);for(m=d=0;d<U.length&&!U[d].includes("DetermineComponentFrameRoot");)d++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(d===U.length||m===te.length)for(d=U.length-1,m=te.length-1;1<=d&&0<=m&&U[d]!==te[m];)m--;for(;1<=d&&0<=m;d--,m--)if(U[d]!==te[m]){if(d!==1||m!==1)do if(d--,m--,0>m||U[d]!==te[m]){var oe=`
|
|
46
46
|
`+U[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{yt=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?pt(c):""}function ge(r,s){switch(r.tag){case 26:case 27:case 5:return pt(r.type);case 16:return pt("Lazy");case 13:return r.child!==s&&s!==null?pt("Suspense Fallback"):pt("Suspense");case 19:return pt("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 pt("Activity");default:return""}}function Fe(r){try{var s="",c=null;do s+=ge(r,c),c=r,r=r.return;while(r);return s}catch(d){return`
|
|
47
47
|
Error generating stack: `+d.message+`
|
|
48
|
-
`+d.stack}}var ct=Object.prototype.hasOwnProperty,mn=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,ze=e.unstable_shouldYield,mt=e.unstable_requestPaint,Ee=e.unstable_now,Br=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,he=e.unstable_LowPriority,Me=e.unstable_IdlePriority,Qe=e.log,nt=e.unstable_setDisableYieldValue,rt=null,wt=null;function gn(r){if(typeof Qe=="function"&&nt(r),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(rt,r)}catch{}}var et=Math.clz32?Math.clz32:Xr,rr=Math.log,En=Math.LN2;function Xr(r){return r>>>=0,r===0?32:31-(rr(r)/En|0)|0}var Pr=256,$r=262144,ne=4194304;function pe(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 ve(r,s,c){var d=r.pendingLanes;if(d===0)return 0;var m=0,v=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var E=d&134217727;return E!==0?(d=E&~v,d!==0?m=pe(d):(w&=E,w!==0?m=pe(w):c||(c=E&~r,c!==0&&(m=pe(c))))):(E=d&~v,E!==0?m=pe(E):w!==0?m=pe(w):c||(c=d&~r,c!==0&&(m=pe(c)))),m===0?0:s!==0&&s!==m&&(s&v)===0&&(v=m&-m,c=s&-s,v>=c||v===32&&(c&4194048)!==0)?s:m}function Xe(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Bt(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 ln(){var r=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),r}function Tn(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function Pt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function zn(r,s,c,d,m,v){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var E=r.entanglements,U=r.expirationTimes,te=r.hiddenUpdates;for(c=w&~c;0<c;){var oe=31-et(c),ue=1<<oe;E[oe]=0,U[oe]=-1;var re=te[oe];if(re!==null)for(te[oe]=null,oe=0;oe<re.length;oe++){var se=re[oe];se!==null&&(se.lane&=-536870913)}c&=~ue}d!==0&&xr(r,d,0),v!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=v&~(w&~s))}function xr(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-et(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function Sa(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var d=31-et(c),m=1<<d;m&s|r[d]&s&&(r[d]|=s),c&=~m}}function Bl(r,s){var c=s&-s;return c=(c&42)!==0?1:On(c),(c&(r.suspendedLanes|s))!==0?0:c}function On(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 Ls(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Pl(){var r=F.p;return r!==0?r:(r=window.event,r===void 0?32:K1(r.type))}function $l(r,s){var c=F.p;try{return F.p=r,s()}finally{F.p=c}}var vr=Math.random().toString(36).slice(2),Gt="__reactFiber$"+vr,_n="__reactProps$"+vr,ir="__reactContainer$"+vr,Fl="__reactEvents$"+vr,yf="__reactListeners$"+vr,Ds="__reactHandles$"+vr,zs="__reactResources$"+vr,Kr="__reactMarker$"+vr;function Gi(r){delete r[Gt],delete r[_n],delete r[Fl],delete r[yf],delete r[Ds]}function hi(r){var s=r[Gt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[ir]||c[Gt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=z1(r);r!==null;){if(c=r[Gt])return c;r=z1(r)}return s}r=c,c=r.parentNode}return null}function Vn(r){if(r=r[Gt]||r[ir]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Os(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Zr(r){var s=r[zs];return s||(s=r[zs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Kt(r){r[Kr]=!0}var Gn=new Set,ka={};function Fr(r,s){Jr(r,s),Jr(r+"Capture",s)}function Jr(r,s){for(ka[r]=s,r=0;r<s.length;r++)Gn.add(s[r])}var Ul=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]*$"),Hl={},Zt={};function _f(r){return ct.call(Zt,r)?!0:ct.call(Hl,r)?!1:Ul.test(r)?Zt[r]=!0:(Hl[r]=!0,!1)}function Bs(r,s,c){if(_f(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){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,""+c)}}function ja(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function Ur(r,s,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+d)}}function Yn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Oc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Il(r,s,c){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,v=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){c=""+w,v.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Na(r){if(!r._valueTracker){var s=Oc(r)?"checked":"value";r._valueTracker=Il(r,s,""+r[s])}}function ei(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),d="";return r&&(d=Oc(r)?r.checked?"true":"false":r.value),r=d,r!==c?(s.setValue(r),!0):!1}function Yi(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 br=/[\n"\\]/g;function nn(r){return r.replace(br,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ps(r,s,c,d,m,v,w,E){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=""+Yn(s)):r.value!==""+Yn(s)&&(r.value=""+Yn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?Ca(r,w,Yn(s)):c!=null?Ca(r,w,Yn(c)):d!=null&&r.removeAttribute("value"),m==null&&v!=null&&(r.defaultChecked=!!v),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.name=""+Yn(E):r.removeAttribute("name")}function Bc(r,s,c,d,m,v,w,E){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),s!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Na(r);return}c=c!=null?""+Yn(c):"",s=s!=null?""+Yn(s):c,E||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=E?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Na(r)}function Ca(r,s,c){s==="number"&&Yi(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Wi(r,s,c,d){if(r=r.options,s){s={};for(var m=0;m<c.length;m++)s["$"+c[m]]=!0;for(c=0;c<r.length;c++)m=s.hasOwnProperty("$"+r[c].value),r[c].selected!==m&&(r[c].selected=m),m&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Yn(c),s=null,m=0;m<r.length;m++){if(r[m].value===c){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function Ea(r,s,c){if(s!=null&&(s=""+Yn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+Yn(c):""}function ql(r,s,c,d){if(s==null){if(d!=null){if(c!=null)throw Error(i(92));if(W(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),s=c}c=Yn(s),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Na(r)}function Qi(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var wf=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 Pc(r,s,c){var d=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,c):typeof c!="number"||c===0||wf.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function $c(r,s,c){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.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)&&c[m]!==d&&Pc(r,m,d)}else for(var v in s)s.hasOwnProperty(v)&&Pc(r,v,s[v])}function Ta(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 Fc=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"]]),Sf=/^[\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 Aa(r){return Sf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function yr(){}var Xi=null;function Ma(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ki=null,Zi=null;function Uc(r){var s=Vn(r);if(s&&(r=s.stateNode)){var c=r[_n]||null;e:switch(r=s.stateNode,s.type){case"input":if(Ps(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+nn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var d=c[s];if(d!==r&&d.form===r.form){var m=d[_n]||null;if(!m)throw Error(i(90));Ps(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<c.length;s++)d=c[s],d.form===r.form&&ei(d)}break e;case"textarea":Ea(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Wi(r,!!c.multiple,s,!1)}}}var Vl=!1;function Hc(r,s,c){if(Vl)return r(s,c);Vl=!0;try{var d=r(s);return d}finally{if(Vl=!1,(Ki!==null||Zi!==null)&&(Au(),Ki&&(s=Ki,r=Zi,Zi=Ki=null,Uc(s),r)))for(s=0;s<r.length;s++)Uc(r[s])}}function $s(r,s){var c=r.stateNode;if(c===null)return null;var d=c[_n]||null;if(d===null)return null;c=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(c&&typeof c!="function")throw Error(i(231,s,typeof c));return c}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ra=!1;if(_r)try{var Ji={};Object.defineProperty(Ji,"passive",{get:function(){Ra=!0}}),window.addEventListener("test",Ji,Ji),window.removeEventListener("test",Ji,Ji)}catch{Ra=!1}var H=null,fe=null,Ke=null;function gt(){if(Ke)return Ke;var r,s=fe,c=s.length,d,m="value"in H?H.value:H.textContent,v=m.length;for(r=0;r<c&&s[r]===m[r];r++);var w=c-r;for(d=1;d<=w&&s[c-d]===m[v-d];d++);return Ke=m.slice(r,1<d?1-d:void 0)}function st(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 Ie(){return!0}function Bn(){return!1}function xn(r){function s(c,d,m,v,w){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var E in r)r.hasOwnProperty(E)&&(c=r[E],this[E]=c?c(v):v[E]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ie:Bn,this.isPropagationStopped=Bn,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ie)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ie)},persist:function(){},isPersistent:Ie}),s}var wr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pi=xn(wr),vn=x({},wr,{view:0,detail:0}),Ic=xn(vn),Gl,Yl,Fs,Us=x({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jf,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!==Fs&&(Fs&&r.type==="mousemove"?(Gl=r.screenX-Fs.screenX,Yl=r.screenY-Fs.screenY):Yl=Gl=0,Fs=r),Gl)},movementY:function(r){return"movementY"in r?r.movementY:Yl}}),kf=xn(Us),qc=x({},Us,{dataTransfer:0}),Vc=xn(qc),Gc=x({},vn,{relatedTarget:0}),ti=xn(Gc),Yc=x({},wr,{animationName:0,elapsedTime:0,pseudoElement:0}),Wc=xn(Yc),La=x({},wr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),DS=xn(La),zS=x({},wr,{data:0}),Mx=xn(zS),OS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BS={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"},PS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $S(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=PS[r])?!!s[r]:!1}function jf(){return $S}var FS=x({},vn,{key:function(r){if(r.key){var s=OS[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=st(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?BS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jf,charCode:function(r){return r.type==="keypress"?st(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?st(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),US=xn(FS),HS=x({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rx=xn(HS),IS=x({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jf}),qS=xn(IS),VS=x({},wr,{propertyName:0,elapsedTime:0,pseudoElement:0}),GS=xn(VS),YS=x({},Us,{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}),WS=xn(YS),QS=x({},wr,{newState:0,oldState:0}),XS=xn(QS),KS=[9,13,27,32],Nf=_r&&"CompositionEvent"in window,Wl=null;_r&&"documentMode"in document&&(Wl=document.documentMode);var ZS=_r&&"TextEvent"in window&&!Wl,Lx=_r&&(!Nf||Wl&&8<Wl&&11>=Wl),Dx=" ",zx=!1;function Ox(r,s){switch(r){case"keyup":return KS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Da=!1;function JS(r,s){switch(r){case"compositionend":return Bx(s);case"keypress":return s.which!==32?null:(zx=!0,Dx);case"textInput":return r=s.data,r===Dx&&zx?null:r;default:return null}}function ek(r,s){if(Da)return r==="compositionend"||!Nf&&Ox(r,s)?(r=gt(),Ke=fe=H=null,Da=!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 Lx&&s.locale!=="ko"?null:s.data;default:return null}}var tk={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 Px(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!tk[r.type]:s==="textarea"}function $x(r,s,c,d){Ki?Zi?Zi.push(d):Zi=[d]:Ki=d,s=Bu(s,"onChange"),0<s.length&&(c=new pi("onChange","change",null,c,d),r.push({event:c,listeners:s}))}var Ql=null,Xl=null;function nk(r){_1(r,0)}function Qc(r){var s=Os(r);if(ei(s))return r}function Fx(r,s){if(r==="change")return s}var Ux=!1;if(_r){var Cf;if(_r){var Ef="oninput"in document;if(!Ef){var Hx=document.createElement("div");Hx.setAttribute("oninput","return;"),Ef=typeof Hx.oninput=="function"}Cf=Ef}else Cf=!1;Ux=Cf&&(!document.documentMode||9<document.documentMode)}function Ix(){Ql&&(Ql.detachEvent("onpropertychange",qx),Xl=Ql=null)}function qx(r){if(r.propertyName==="value"&&Qc(Xl)){var s=[];$x(s,Xl,r,Ma(r)),Hc(nk,s)}}function rk(r,s,c){r==="focusin"?(Ix(),Ql=s,Xl=c,Ql.attachEvent("onpropertychange",qx)):r==="focusout"&&Ix()}function ik(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Qc(Xl)}function sk(r,s){if(r==="click")return Qc(s)}function ak(r,s){if(r==="input"||r==="change")return Qc(s)}function lk(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var sr=typeof Object.is=="function"?Object.is:lk;function Kl(r,s){if(sr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),d=Object.keys(s);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!ct.call(s,m)||!sr(r[m],s[m]))return!1}return!0}function Vx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Gx(r,s){var c=Vx(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=s&&d>=s)return{node:c,offset:s-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Vx(c)}}function Yx(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yx(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Wx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Yi(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Yi(r.document)}return s}function Tf(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 ok=_r&&"documentMode"in document&&11>=document.documentMode,za=null,Af=null,Zl=null,Mf=!1;function Qx(r,s,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Mf||za==null||za!==Yi(d)||(d=za,"selectionStart"in d&&Tf(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}),Zl&&Kl(Zl,d)||(Zl=d,d=Bu(Af,"onSelect"),0<d.length&&(s=new pi("onSelect","select",null,s,c),r.push({event:s,listeners:d}),s.target=za)))}function Hs(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var Oa={animationend:Hs("Animation","AnimationEnd"),animationiteration:Hs("Animation","AnimationIteration"),animationstart:Hs("Animation","AnimationStart"),transitionrun:Hs("Transition","TransitionRun"),transitionstart:Hs("Transition","TransitionStart"),transitioncancel:Hs("Transition","TransitionCancel"),transitionend:Hs("Transition","TransitionEnd")},Rf={},Xx={};_r&&(Xx=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function Is(r){if(Rf[r])return Rf[r];if(!Oa[r])return r;var s=Oa[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in Xx)return Rf[r]=s[c];return r}var Kx=Is("animationend"),Zx=Is("animationiteration"),Jx=Is("animationstart"),ck=Is("transitionrun"),uk=Is("transitionstart"),dk=Is("transitioncancel"),e0=Is("transitionend"),t0=new Map,Lf="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(" ");Lf.push("scrollEnd");function Hr(r,s){t0.set(r,s),Fr(s,[r])}var Xc=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)},Sr=[],Ba=0,Df=0;function Kc(){for(var r=Ba,s=Df=Ba=0;s<r;){var c=Sr[s];Sr[s++]=null;var d=Sr[s];Sr[s++]=null;var m=Sr[s];Sr[s++]=null;var v=Sr[s];if(Sr[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}v!==0&&n0(c,m,v)}}function Zc(r,s,c,d){Sr[Ba++]=r,Sr[Ba++]=s,Sr[Ba++]=c,Sr[Ba++]=d,Df|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function zf(r,s,c,d){return Zc(r,s,c,d),Jc(r)}function qs(r,s){return Zc(r,null,null,s),Jc(r)}function n0(r,s,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var m=!1,v=r.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(m=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,m&&s!==null&&(m=31-et(c),r=v.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=c|536870912),v):null}function Jc(r){if(50<_o)throw _o=0,qh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Pa={};function fk(r,s,c,d){this.tag=r,this.key=c,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 ar(r,s,c,d){return new fk(r,s,c,d)}function Of(r){return r=r.prototype,!(!r||!r.isReactComponent)}function mi(r,s){var c=r.alternate;return c===null?(c=ar(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function r0(r,s){r.flags&=65011714;var c=r.alternate;return c===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=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function eu(r,s,c,d,m,v){var w=0;if(d=r,typeof r=="function")Of(r)&&(w=1);else if(typeof r=="string")w=xj(r,c,de.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case G:return r=ar(31,c,s,m),r.elementType=G,r.lanes=v,r;case j:return Vs(c.children,m,v,s);case N:w=8,m|=24;break;case k:return r=ar(12,c,s,m|2),r.elementType=k,r.lanes=v,r;case D:return r=ar(13,c,s,m),r.elementType=D,r.lanes=v,r;case z:return r=ar(19,c,s,m),r.elementType=z,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case A:w=9;break e;case L:w=11;break e;case q:w=14;break e;case $:w=16,d=null;break e}w=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=ar(w,c,s,m),s.elementType=r,s.type=d,s.lanes=v,s}function Vs(r,s,c,d){return r=ar(7,r,d,s),r.lanes=c,r}function Bf(r,s,c){return r=ar(6,r,null,s),r.lanes=c,r}function i0(r){var s=ar(18,null,null,0);return s.stateNode=r,s}function Pf(r,s,c){return s=ar(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var s0=new WeakMap;function kr(r,s){if(typeof r=="object"&&r!==null){var c=s0.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Fe(s)},s0.set(r,s),s)}return{value:r,source:s,stack:Fe(s)}}var $a=[],Fa=0,tu=null,Jl=0,jr=[],Nr=0,es=null,ni=1,ri="";function gi(r,s){$a[Fa++]=Jl,$a[Fa++]=tu,tu=r,Jl=s}function a0(r,s,c){jr[Nr++]=ni,jr[Nr++]=ri,jr[Nr++]=es,es=r;var d=ni;r=ri;var m=32-et(d)-1;d&=~(1<<m),c+=1;var v=32-et(s)+m;if(30<v){var w=m-m%5;v=(d&(1<<w)-1).toString(32),d>>=w,m-=w,ni=1<<32-et(s)+m|c<<m|d,ri=v+r}else ni=1<<v|c<<m|d,ri=r}function $f(r){r.return!==null&&(gi(r,1),a0(r,1,0))}function Ff(r){for(;r===tu;)tu=$a[--Fa],$a[Fa]=null,Jl=$a[--Fa],$a[Fa]=null;for(;r===es;)es=jr[--Nr],jr[Nr]=null,ri=jr[--Nr],jr[Nr]=null,ni=jr[--Nr],jr[Nr]=null}function l0(r,s){jr[Nr++]=ni,jr[Nr++]=ri,jr[Nr++]=es,ni=s.id,ri=s.overflow,es=r}var wn=null,Ft=null,ft=!1,ts=null,Cr=!1,Uf=Error(i(519));function ns(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eo(kr(s,r)),Uf}function o0(r){var s=r.stateNode,c=r.type,d=r.memoizedProps;switch(s[Gt]=r,s[_n]=d,c){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(c=0;c<So.length;c++)lt(So[c],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":lt("invalid",s),Bc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",s);break;case"textarea":lt("invalid",s),ql(s,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||d.suppressHydrationWarning===!0||j1(s.textContent,c)?(d.popover!=null&&(lt("beforetoggle",s),lt("toggle",s)),d.onScroll!=null&<("scroll",s),d.onScrollEnd!=null&<("scrollend",s),d.onClick!=null&&(s.onclick=yr),s=!0):s=!1,s||ns(r,!0)}function c0(r){for(wn=r.return;wn;)switch(wn.tag){case 5:case 31:case 13:Cr=!1;return;case 27:case 3:Cr=!0;return;default:wn=wn.return}}function Ua(r){if(r!==wn)return!1;if(!ft)return c0(r),ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||sp(r.type,r.memoizedProps)),c=!c),c&&Ft&&ns(r),c0(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ft=D1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ft=D1(r)}else s===27?(s=Ft,gs(r.type)?(r=up,up=null,Ft=r):Ft=s):Ft=wn?Tr(r.stateNode.nextSibling):null;return!0}function Gs(){Ft=wn=null,ft=!1}function Hf(){var r=ts;return r!==null&&(Kn===null?Kn=r:Kn.push.apply(Kn,r),ts=null),r}function eo(r){ts===null?ts=[r]:ts.push(r)}var If=P(null),Ys=null,xi=null;function rs(r,s,c){M(If,s._currentValue),s._currentValue=c}function vi(r){r._currentValue=If.current,Z(If)}function qf(r,s,c){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===c)break;r=r.return}}function Vf(r,s,c,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var v=m.dependencies;if(v!==null){var w=m.child;v=v.firstContext;e:for(;v!==null;){var E=v;v=m;for(var U=0;U<s.length;U++)if(E.context===s[U]){v.lanes|=c,E=v.alternate,E!==null&&(E.lanes|=c),qf(v.return,c,r),d||(w=null);break e}v=E.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=c,v=w.alternate,v!==null&&(v.lanes|=c),qf(w,c,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 Ha(r,s,c,d){r=null;for(var m=s,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!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 E=m.type;sr(m.pendingProps.value,w.value)||(r!==null?r.push(E):r=[E])}}else if(m===Re.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(Eo):r=[Eo])}m=m.return}r!==null&&Vf(s,r,c,d),s.flags|=262144}function nu(r){for(r=r.firstContext;r!==null;){if(!sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Ws(r){Ys=r,xi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Sn(r){return u0(Ys,r)}function ru(r,s){return Ys===null&&Ws(r),u0(r,s)}function u0(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},xi===null){if(r===null)throw Error(i(308));xi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else xi=xi.next=s;return c}var hk=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},pk=e.unstable_scheduleCallback,mk=e.unstable_NormalPriority,on={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Gf(){return{controller:new hk,data:new Map,refCount:0}}function to(r){r.refCount--,r.refCount===0&&pk(mk,function(){r.controller.abort()})}var no=null,Yf=0,Ia=0,qa=null;function gk(r,s){if(no===null){var c=no=[];Yf=0,Ia=Xh(),qa={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Yf++,s.then(d0,d0),s}function d0(){if(--Yf===0&&no!==null){qa!==null&&(qa.status="fulfilled");var r=no;no=null,Ia=0,qa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function xk(r,s){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<c.length;m++)(0,c[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var f0=B.S;B.S=function(r,s){Qv=Ee(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&gk(r,s),f0!==null&&f0(r,s)};var Qs=P(null);function Wf(){var r=Qs.current;return r!==null?r:Lt.pooledCache}function iu(r,s){s===null?M(Qs,Qs.current):M(Qs,s.pool)}function h0(){var r=Wf();return r===null?null:{parent:on._currentValue,pool:r}}var Va=Error(i(460)),Qf=Error(i(474)),su=Error(i(542)),au={then:function(){}};function p0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function m0(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(yr,yr),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,x0(r),r;default:if(typeof s.status=="string")s.then(yr,yr);else{if(r=Lt,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,x0(r),r}throw Ks=s,Va}}function Xs(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ks=c,Va):c}}var Ks=null;function g0(){if(Ks===null)throw Error(i(459));var r=Ks;return Ks=null,r}function x0(r){if(r===Va||r===su)throw Error(i(483))}var Ga=null,ro=0;function lu(r){var s=ro;return ro+=1,Ga===null&&(Ga=[]),m0(Ga,r,s)}function io(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function ou(r,s){throw s.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function v0(r){function s(K,V){if(r){var ee=K.deletions;ee===null?(K.deletions=[V],K.flags|=16):ee.push(V)}}function c(K,V){if(!r)return null;for(;V!==null;)s(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function m(K,V){return K=mi(K,V),K.index=0,K.sibling=null,K}function v(K,V,ee){return K.index=ee,r?(ee=K.alternate,ee!==null?(ee=ee.index,ee<V?(K.flags|=67108866,V):ee):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function E(K,V,ee,ce){return V===null||V.tag!==6?(V=Bf(ee,K.mode,ce),V.return=K,V):(V=m(V,ee),V.return=K,V)}function U(K,V,ee,ce){var Pe=ee.type;return Pe===j?oe(K,V,ee.props.children,ce,ee.key):V!==null&&(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===$&&Xs(Pe)===V.type)?(V=m(V,ee.props),io(V,ee),V.return=K,V):(V=eu(ee.type,ee.key,ee.props,null,K.mode,ce),io(V,ee),V.return=K,V)}function te(K,V,ee,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==ee.containerInfo||V.stateNode.implementation!==ee.implementation?(V=Pf(ee,K.mode,ce),V.return=K,V):(V=m(V,ee.children||[]),V.return=K,V)}function oe(K,V,ee,ce,Pe){return V===null||V.tag!==7?(V=Vs(ee,K.mode,ce,Pe),V.return=K,V):(V=m(V,ee),V.return=K,V)}function ue(K,V,ee){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Bf(""+V,K.mode,ee),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return ee=eu(V.type,V.key,V.props,null,K.mode,ee),io(ee,V),ee.return=K,ee;case _:return V=Pf(V,K.mode,ee),V.return=K,V;case $:return V=Xs(V),ue(K,V,ee)}if(W(V)||T(V))return V=Vs(V,K.mode,ee,null),V.return=K,V;if(typeof V.then=="function")return ue(K,lu(V),ee);if(V.$$typeof===C)return ue(K,ru(K,V),ee);ou(K,V)}return null}function re(K,V,ee,ce){var Pe=V!==null?V.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Pe!==null?null:E(K,V,""+ee,ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ee.key===Pe?U(K,V,ee,ce):null;case _:return ee.key===Pe?te(K,V,ee,ce):null;case $:return ee=Xs(ee),re(K,V,ee,ce)}if(W(ee)||T(ee))return Pe!==null?null:oe(K,V,ee,ce,null);if(typeof ee.then=="function")return re(K,V,lu(ee),ce);if(ee.$$typeof===C)return re(K,V,ru(K,ee),ce);ou(K,ee)}return null}function se(K,V,ee,ce,Pe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(ee)||null,E(V,K,""+ce,Pe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return K=K.get(ce.key===null?ee:ce.key)||null,U(V,K,ce,Pe);case _:return K=K.get(ce.key===null?ee:ce.key)||null,te(V,K,ce,Pe);case $:return ce=Xs(ce),se(K,V,ee,ce,Pe)}if(W(ce)||T(ce))return K=K.get(ee)||null,oe(V,K,ce,Pe,null);if(typeof ce.then=="function")return se(K,V,ee,lu(ce),Pe);if(ce.$$typeof===C)return se(K,V,ee,ru(V,ce),Pe);ou(V,ce)}return null}function Te(K,V,ee,ce){for(var Pe=null,vt=null,De=V,tt=V=0,dt=null;De!==null&&tt<ee.length;tt++){De.index>tt?(dt=De,De=null):dt=De.sibling;var bt=re(K,De,ee[tt],ce);if(bt===null){De===null&&(De=dt);break}r&&De&&bt.alternate===null&&s(K,De),V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt,De=dt}if(tt===ee.length)return c(K,De),ft&&gi(K,tt),Pe;if(De===null){for(;tt<ee.length;tt++)De=ue(K,ee[tt],ce),De!==null&&(V=v(De,V,tt),vt===null?Pe=De:vt.sibling=De,vt=De);return ft&&gi(K,tt),Pe}for(De=d(De);tt<ee.length;tt++)dt=se(De,K,tt,ee[tt],ce),dt!==null&&(r&&dt.alternate!==null&&De.delete(dt.key===null?tt:dt.key),V=v(dt,V,tt),vt===null?Pe=dt:vt.sibling=dt,vt=dt);return r&&De.forEach(function(_s){return s(K,_s)}),ft&&gi(K,tt),Pe}function Ue(K,V,ee,ce){if(ee==null)throw Error(i(151));for(var Pe=null,vt=null,De=V,tt=V=0,dt=null,bt=ee.next();De!==null&&!bt.done;tt++,bt=ee.next()){De.index>tt?(dt=De,De=null):dt=De.sibling;var _s=re(K,De,bt.value,ce);if(_s===null){De===null&&(De=dt);break}r&&De&&_s.alternate===null&&s(K,De),V=v(_s,V,tt),vt===null?Pe=_s:vt.sibling=_s,vt=_s,De=dt}if(bt.done)return c(K,De),ft&&gi(K,tt),Pe;if(De===null){for(;!bt.done;tt++,bt=ee.next())bt=ue(K,bt.value,ce),bt!==null&&(V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt);return ft&&gi(K,tt),Pe}for(De=d(De);!bt.done;tt++,bt=ee.next())bt=se(De,K,tt,bt.value,ce),bt!==null&&(r&&bt.alternate!==null&&De.delete(bt.key===null?tt:bt.key),V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt);return r&&De.forEach(function(Ej){return s(K,Ej)}),ft&&gi(K,tt),Pe}function At(K,V,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:e:{for(var Pe=ee.key;V!==null;){if(V.key===Pe){if(Pe=ee.type,Pe===j){if(V.tag===7){c(K,V.sibling),ce=m(V,ee.props.children),ce.return=K,K=ce;break e}}else if(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===$&&Xs(Pe)===V.type){c(K,V.sibling),ce=m(V,ee.props),io(ce,ee),ce.return=K,K=ce;break e}c(K,V);break}else s(K,V);V=V.sibling}ee.type===j?(ce=Vs(ee.props.children,K.mode,ce,ee.key),ce.return=K,K=ce):(ce=eu(ee.type,ee.key,ee.props,null,K.mode,ce),io(ce,ee),ce.return=K,K=ce)}return w(K);case _:e:{for(Pe=ee.key;V!==null;){if(V.key===Pe)if(V.tag===4&&V.stateNode.containerInfo===ee.containerInfo&&V.stateNode.implementation===ee.implementation){c(K,V.sibling),ce=m(V,ee.children||[]),ce.return=K,K=ce;break e}else{c(K,V);break}else s(K,V);V=V.sibling}ce=Pf(ee,K.mode,ce),ce.return=K,K=ce}return w(K);case $:return ee=Xs(ee),At(K,V,ee,ce)}if(W(ee))return Te(K,V,ee,ce);if(T(ee)){if(Pe=T(ee),typeof Pe!="function")throw Error(i(150));return ee=Pe.call(ee),Ue(K,V,ee,ce)}if(typeof ee.then=="function")return At(K,V,lu(ee),ce);if(ee.$$typeof===C)return At(K,V,ru(K,ee),ce);ou(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,V!==null&&V.tag===6?(c(K,V.sibling),ce=m(V,ee),ce.return=K,K=ce):(c(K,V),ce=Bf(ee,K.mode,ce),ce.return=K,K=ce),w(K)):c(K,V)}return function(K,V,ee,ce){try{ro=0;var Pe=At(K,V,ee,ce);return Ga=null,Pe}catch(De){if(De===Va||De===su)throw De;var vt=ar(29,De,null,K.mode);return vt.lanes=ce,vt.return=K,vt}finally{}}}var Zs=v0(!0),b0=v0(!1),is=!1;function Xf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kf(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 ss(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function as(r,s,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(_t&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=Jc(r),n0(r,null,c),s}return Zc(r,d,s,c),Jc(r)}function so(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Sa(r,c)}}function Zf(r,s){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?m=v=w:v=v.next=w,c=c.next}while(c!==null);v===null?m=v=s:v=v.next=s}else m=v=s;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var Jf=!1;function ao(){if(Jf){var r=qa;if(r!==null)throw r}}function lo(r,s,c,d){Jf=!1;var m=r.updateQueue;is=!1;var v=m.firstBaseUpdate,w=m.lastBaseUpdate,E=m.shared.pending;if(E!==null){m.shared.pending=null;var U=E,te=U.next;U.next=null,w===null?v=te:w.next=te,w=U;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,E=oe.lastBaseUpdate,E!==w&&(E===null?oe.firstBaseUpdate=te:E.next=te,oe.lastBaseUpdate=U))}if(v!==null){var ue=m.baseState;w=0,oe=te=U=null,E=v;do{var re=E.lane&-536870913,se=re!==E.lane;if(se?(ut&re)===re:(d&re)===re){re!==0&&re===Ia&&(Jf=!0),oe!==null&&(oe=oe.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Te=r,Ue=E;re=s;var At=c;switch(Ue.tag){case 1:if(Te=Ue.payload,typeof Te=="function"){ue=Te.call(At,ue,re);break e}ue=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ue.payload,re=typeof Te=="function"?Te.call(At,ue,re):Te,re==null)break e;ue=x({},ue,re);break e;case 2:is=!0}}re=E.callback,re!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[re]:se.push(re))}else se={lane:re,tag:E.tag,payload:E.payload,callback:E.callback,next:null},oe===null?(te=oe=se,U=ue):oe=oe.next=se,w|=re;if(E=E.next,E===null){if(E=m.shared.pending,E===null)break;se=E,E=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);oe===null&&(U=ue),m.baseState=U,m.firstBaseUpdate=te,m.lastBaseUpdate=oe,v===null&&(m.shared.lanes=0),ds|=w,r.lanes=w,r.memoizedState=ue}}function y0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function _0(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)y0(c[r],s)}var Ya=P(null),cu=P(0);function w0(r,s){r=Ci,M(cu,r),M(Ya,s),Ci=r|s.baseLanes}function eh(){M(cu,Ci),M(Ya,Ya.current)}function th(){Ci=cu.current,Z(Ya),Z(cu)}var lr=P(null),Er=null;function ls(r){var s=r.alternate;M(rn,rn.current&1),M(lr,r),Er===null&&(s===null||Ya.current!==null||s.memoizedState!==null)&&(Er=r)}function nh(r){M(rn,rn.current),M(lr,r),Er===null&&(Er=r)}function S0(r){r.tag===22?(M(rn,rn.current),M(lr,r),Er===null&&(Er=r)):os()}function os(){M(rn,rn.current),M(lr,lr.current)}function or(r){Z(lr),Er===r&&(Er=null),Z(rn)}var rn=P(0);function uu(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||op(c)||cp(c)))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 bi=0,Ze=null,Et=null,cn=null,du=!1,Wa=!1,Js=!1,fu=0,oo=0,Qa=null,vk=0;function Jt(){throw Error(i(321))}function rh(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!sr(r[c],s[c]))return!1;return!0}function ih(r,s,c,d,m,v){return bi=v,Ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=r===null||r.memoizedState===null?av:bh,Js=!1,v=c(d,m),Js=!1,Wa&&(v=j0(s,c,d,m)),k0(r),v}function k0(r){B.H=fo;var s=Et!==null&&Et.next!==null;if(bi=0,cn=Et=Ze=null,du=!1,oo=0,Qa=null,s)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&nu(r)&&(un=!0))}function j0(r,s,c,d){Ze=r;var m=0;do{if(Wa&&(Qa=null),oo=0,Wa=!1,25<=m)throw Error(i(301));if(m+=1,cn=Et=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}B.H=lv,v=s(c,d)}while(Wa);return v}function bk(){var r=B.H,s=r.useState()[0];return s=typeof s.then=="function"?co(s):s,r=r.useState()[0],(Et!==null?Et.memoizedState:null)!==r&&(Ze.flags|=1024),s}function sh(){var r=fu!==0;return fu=0,r}function ah(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function lh(r){if(du){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}du=!1}bi=0,cn=Et=Ze=null,Wa=!1,oo=fu=0,Qa=null}function Pn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Ze.memoizedState=cn=r:cn=cn.next=r,cn}function sn(){if(Et===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=Et.next;var s=cn===null?Ze.memoizedState:cn.next;if(s!==null)cn=s,Et=r;else{if(r===null)throw Ze.alternate===null?Error(i(467)):Error(i(310));Et=r,r={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},cn===null?Ze.memoizedState=cn=r:cn=cn.next=r}return cn}function hu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function co(r){var s=oo;return oo+=1,Qa===null&&(Qa=[]),r=m0(Qa,r,s),s=Ze,(cn===null?s.memoizedState:cn.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?av:bh),r}function pu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return co(r);if(r.$$typeof===C)return Sn(r)}throw Error(i(438,String(r)))}function oh(r){var s=null,c=Ze.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var d=Ze.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}),c===null&&(c=hu(),Ze.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),d=0;d<r;d++)c[d]=O;return s.index++,c}function yi(r,s){return typeof s=="function"?s(r):s}function mu(r){var s=sn();return ch(s,Et,r)}function ch(r,s,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=r.baseQueue,v=d.pending;if(v!==null){if(m!==null){var w=m.next;m.next=v.next,v.next=w}s.baseQueue=m=v,d.pending=null}if(v=r.baseState,m===null)r.memoizedState=v;else{s=m.next;var E=w=null,U=null,te=s,oe=!1;do{var ue=te.lane&-536870913;if(ue!==te.lane?(ut&ue)===ue:(bi&ue)===ue){var re=te.revertLane;if(re===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ue===Ia&&(oe=!0);else if((bi&re)===re){te=te.next,re===Ia&&(oe=!0);continue}else ue={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(E=U=ue,w=v):U=U.next=ue,Ze.lanes|=re,ds|=re;ue=te.action,Js&&c(v,ue),v=te.hasEagerState?te.eagerState:c(v,ue)}else re={lane:ue,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(E=U=re,w=v):U=U.next=re,Ze.lanes|=ue,ds|=ue;te=te.next}while(te!==null&&te!==s);if(U===null?w=v:U.next=E,!sr(v,r.memoizedState)&&(un=!0,oe&&(c=qa,c!==null)))throw c;r.memoizedState=v,r.baseState=w,r.baseQueue=U,d.lastRenderedState=v}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function uh(r){var s=sn(),c=s.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,m=c.pending,v=s.memoizedState;if(m!==null){c.pending=null;var w=m=m.next;do v=r(v,w.action),w=w.next;while(w!==m);sr(v,s.memoizedState)||(un=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),c.lastRenderedState=v}return[v,d]}function N0(r,s,c){var d=Ze,m=sn(),v=ft;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=s();var w=!sr((Et||m).memoizedState,c);if(w&&(m.memoizedState=c,un=!0),m=m.queue,hh(T0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||cn!==null&&cn.memoizedState.tag&1){if(d.flags|=2048,Xa(9,{destroy:void 0},E0.bind(null,d,m,c,s),null),Lt===null)throw Error(i(349));v||(bi&127)!==0||C0(d,s,c)}return c}function C0(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=Ze.updateQueue,s===null?(s=hu(),Ze.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function E0(r,s,c,d){s.value=c,s.getSnapshot=d,A0(s)&&M0(r)}function T0(r,s,c){return c(function(){A0(s)&&M0(r)})}function A0(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!sr(r,c)}catch{return!0}}function M0(r){var s=qs(r,2);s!==null&&Zn(s,r,2)}function dh(r){var s=Pn();if(typeof r=="function"){var c=r;if(r=c(),Js){gn(!0);try{c()}finally{gn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:r},s}function R0(r,s,c,d){return r.baseState=c,ch(r,Et,typeof d=="function"?d:yi)}function yk(r,s,c,d,m){if(vu(r))throw Error(i(485));if(r=s.action,r!==null){var v={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};B.T!==null?c(!0):v.isTransition=!1,d(v),c=s.pending,c===null?(v.next=s.pending=v,L0(s,v)):(v.next=c.next,s.pending=c.next=v)}}function L0(r,s){var c=s.action,d=s.payload,m=r.state;if(s.isTransition){var v=B.T,w={};B.T=w;try{var E=c(m,d),U=B.S;U!==null&&U(w,E),D0(r,s,E)}catch(te){fh(r,s,te)}finally{v!==null&&w.types!==null&&(v.types=w.types),B.T=v}}else try{v=c(m,d),D0(r,s,v)}catch(te){fh(r,s,te)}}function D0(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){z0(r,s,d)},function(d){return fh(r,s,d)}):z0(r,s,c)}function z0(r,s,c){s.status="fulfilled",s.value=c,O0(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,L0(r,c)))}function fh(r,s,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=c,O0(s),s=s.next;while(s!==d)}r.action=null}function O0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function B0(r,s){return s}function P0(r,s){if(ft){var c=Lt.formState;if(c!==null){e:{var d=Ze;if(ft){if(Ft){t:{for(var m=Ft,v=Cr;m.nodeType!==8;){if(!v){m=null;break t}if(m=Tr(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){Ft=Tr(m.nextSibling),d=m.data==="F!";break e}}ns(d)}d=!1}d&&(s=c[0])}}return c=Pn(),c.memoizedState=c.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B0,lastRenderedState:s},c.queue=d,c=rv.bind(null,Ze,d),d.dispatch=c,d=dh(!1),v=vh.bind(null,Ze,!1,d.queue),d=Pn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,c=yk.bind(null,Ze,m,v,c),m.dispatch=c,d.memoizedState=r,[s,c,!1]}function $0(r){var s=sn();return F0(s,Et,r)}function F0(r,s,c){if(s=ch(r,s,B0)[0],r=mu(yi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=co(s)}catch(w){throw w===Va?su:w}else d=s;s=sn();var m=s.queue,v=m.dispatch;return c!==s.memoizedState&&(Ze.flags|=2048,Xa(9,{destroy:void 0},_k.bind(null,m,c),null)),[d,v,r]}function _k(r,s){r.action=s}function U0(r){var s=sn(),c=Et;if(c!==null)return F0(s,c,r);sn(),s=s.memoizedState,c=sn();var d=c.queue.dispatch;return c.memoizedState=r,[s,d,!1]}function Xa(r,s,c,d){return r={tag:r,create:c,deps:d,inst:s,next:null},s=Ze.updateQueue,s===null&&(s=hu(),Ze.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,s.lastEffect=r),r}function H0(){return sn().memoizedState}function gu(r,s,c,d){var m=Pn();Ze.flags|=r,m.memoizedState=Xa(1|s,{destroy:void 0},c,d===void 0?null:d)}function xu(r,s,c,d){var m=sn();d=d===void 0?null:d;var v=m.memoizedState.inst;Et!==null&&d!==null&&rh(d,Et.memoizedState.deps)?m.memoizedState=Xa(s,v,c,d):(Ze.flags|=r,m.memoizedState=Xa(1|s,v,c,d))}function I0(r,s){gu(8390656,8,r,s)}function hh(r,s){xu(2048,8,r,s)}function wk(r){Ze.flags|=4;var s=Ze.updateQueue;if(s===null)s=hu(),Ze.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function q0(r){var s=sn().memoizedState;return wk({ref:s,nextImpl:r}),function(){if((_t&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function V0(r,s){return xu(4,2,r,s)}function G0(r,s){return xu(4,4,r,s)}function Y0(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function W0(r,s,c){c=c!=null?c.concat([r]):null,xu(4,4,Y0.bind(null,s,r),c)}function ph(){}function Q0(r,s){var c=sn();s=s===void 0?null:s;var d=c.memoizedState;return s!==null&&rh(s,d[1])?d[0]:(c.memoizedState=[r,s],r)}function X0(r,s){var c=sn();s=s===void 0?null:s;var d=c.memoizedState;if(s!==null&&rh(s,d[1]))return d[0];if(d=r(),Js){gn(!0);try{r()}finally{gn(!1)}}return c.memoizedState=[d,s],d}function mh(r,s,c){return c===void 0||(bi&1073741824)!==0&&(ut&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=Kv(),Ze.lanes|=r,ds|=r,c)}function K0(r,s,c,d){return sr(c,s)?c:Ya.current!==null?(r=mh(r,c,d),sr(r,s)||(un=!0),r):(bi&42)===0||(bi&1073741824)!==0&&(ut&261930)===0?(un=!0,r.memoizedState=c):(r=Kv(),Ze.lanes|=r,ds|=r,s)}function Z0(r,s,c,d,m){var v=F.p;F.p=v!==0&&8>v?v:8;var w=B.T,E={};B.T=E,vh(r,!1,s,c);try{var U=m(),te=B.S;if(te!==null&&te(E,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var oe=xk(U,d);uo(r,s,oe,dr(r))}else uo(r,s,d,dr(r))}catch(ue){uo(r,s,{then:function(){},status:"rejected",reason:ue},dr())}finally{F.p=v,w!==null&&E.types!==null&&(w.types=E.types),B.T=w}}function Sk(){}function gh(r,s,c,d){if(r.tag!==5)throw Error(i(476));var m=J0(r).queue;Z0(r,m,s,Y,c===null?Sk:function(){return ev(r),c(d)})}function J0(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:Y},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function ev(r){var s=J0(r);s.next===null&&(s=r.alternate.memoizedState),uo(r,s.next.queue,{},dr())}function xh(){return Sn(Eo)}function tv(){return sn().memoizedState}function nv(){return sn().memoizedState}function kk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=dr();r=ss(c);var d=as(s,r,c);d!==null&&(Zn(d,s,c),so(d,s,c)),s={cache:Gf()},r.payload=s;return}s=s.return}}function jk(r,s,c){var d=dr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},vu(r)?iv(s,c):(c=zf(r,s,c,d),c!==null&&(Zn(c,r,d),sv(c,s,d)))}function rv(r,s,c){var d=dr();uo(r,s,c,d)}function uo(r,s,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(vu(r))iv(s,m);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var w=s.lastRenderedState,E=v(w,c);if(m.hasEagerState=!0,m.eagerState=E,sr(E,w))return Zc(r,s,m,0),Lt===null&&Kc(),!1}catch{}finally{}if(c=zf(r,s,m,d),c!==null)return Zn(c,r,d),sv(c,s,d),!0}return!1}function vh(r,s,c,d){if(d={lane:2,revertLane:Xh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},vu(r)){if(s)throw Error(i(479))}else s=zf(r,c,d,2),s!==null&&Zn(s,r,2)}function vu(r){var s=r.alternate;return r===Ze||s!==null&&s===Ze}function iv(r,s){Wa=du=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function sv(r,s,c){if((c&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Sa(r,c)}}var fo={readContext:Sn,use:pu,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};fo.useEffectEvent=Jt;var av={readContext:Sn,use:pu,useCallback:function(r,s){return Pn().memoizedState=[r,s===void 0?null:s],r},useContext:Sn,useEffect:I0,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,gu(4194308,4,Y0.bind(null,s,r),c)},useLayoutEffect:function(r,s){return gu(4194308,4,r,s)},useInsertionEffect:function(r,s){gu(4,2,r,s)},useMemo:function(r,s){var c=Pn();s=s===void 0?null:s;var d=r();if(Js){gn(!0);try{r()}finally{gn(!1)}}return c.memoizedState=[d,s],d},useReducer:function(r,s,c){var d=Pn();if(c!==void 0){var m=c(s);if(Js){gn(!0);try{c(s)}finally{gn(!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=jk.bind(null,Ze,r),[d.memoizedState,r]},useRef:function(r){var s=Pn();return r={current:r},s.memoizedState=r},useState:function(r){r=dh(r);var s=r.queue,c=rv.bind(null,Ze,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:ph,useDeferredValue:function(r,s){var c=Pn();return mh(c,r,s)},useTransition:function(){var r=dh(!1);return r=Z0.bind(null,Ze,r.queue,!0,!1),Pn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var d=Ze,m=Pn();if(ft){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Lt===null)throw Error(i(349));(ut&127)!==0||C0(d,s,c)}m.memoizedState=c;var v={value:c,getSnapshot:s};return m.queue=v,I0(T0.bind(null,d,v,r),[r]),d.flags|=2048,Xa(9,{destroy:void 0},E0.bind(null,d,v,c,s),null),c},useId:function(){var r=Pn(),s=Lt.identifierPrefix;if(ft){var c=ri,d=ni;c=(d&~(1<<32-et(d)-1)).toString(32)+c,s="_"+s+"R_"+c,c=fu++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=vk++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:xh,useFormState:P0,useActionState:P0,useOptimistic:function(r){var s=Pn();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=vh.bind(null,Ze,!0,c),c.dispatch=s,[r,s]},useMemoCache:oh,useCacheRefresh:function(){return Pn().memoizedState=kk.bind(null,Ze)},useEffectEvent:function(r){var s=Pn(),c={impl:r};return s.memoizedState=c,function(){if((_t&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},bh={readContext:Sn,use:pu,useCallback:Q0,useContext:Sn,useEffect:hh,useImperativeHandle:W0,useInsertionEffect:V0,useLayoutEffect:G0,useMemo:X0,useReducer:mu,useRef:H0,useState:function(){return mu(yi)},useDebugValue:ph,useDeferredValue:function(r,s){var c=sn();return K0(c,Et.memoizedState,r,s)},useTransition:function(){var r=mu(yi)[0],s=sn().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:N0,useId:tv,useHostTransitionStatus:xh,useFormState:$0,useActionState:$0,useOptimistic:function(r,s){var c=sn();return R0(c,Et,r,s)},useMemoCache:oh,useCacheRefresh:nv};bh.useEffectEvent=q0;var lv={readContext:Sn,use:pu,useCallback:Q0,useContext:Sn,useEffect:hh,useImperativeHandle:W0,useInsertionEffect:V0,useLayoutEffect:G0,useMemo:X0,useReducer:uh,useRef:H0,useState:function(){return uh(yi)},useDebugValue:ph,useDeferredValue:function(r,s){var c=sn();return Et===null?mh(c,r,s):K0(c,Et.memoizedState,r,s)},useTransition:function(){var r=uh(yi)[0],s=sn().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:N0,useId:tv,useHostTransitionStatus:xh,useFormState:U0,useActionState:U0,useOptimistic:function(r,s){var c=sn();return Et!==null?R0(c,Et,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:oh,useCacheRefresh:nv};lv.useEffectEvent=q0;function yh(r,s,c,d){s=r.memoizedState,c=c(d,s),c=c==null?s:x({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var _h={enqueueSetState:function(r,s,c){r=r._reactInternals;var d=dr(),m=ss(d);m.payload=s,c!=null&&(m.callback=c),s=as(r,m,d),s!==null&&(Zn(s,r,d),so(s,r,d))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var d=dr(),m=ss(d);m.tag=1,m.payload=s,c!=null&&(m.callback=c),s=as(r,m,d),s!==null&&(Zn(s,r,d),so(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=dr(),d=ss(c);d.tag=2,s!=null&&(d.callback=s),s=as(r,d,c),s!==null&&(Zn(s,r,c),so(s,r,c))}};function ov(r,s,c,d,m,v,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,w):s.prototype&&s.prototype.isPureReactComponent?!Kl(c,d)||!Kl(m,v):!0}function cv(r,s,c,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,d),s.state!==r&&_h.enqueueReplaceState(s,s.state,null)}function ea(r,s){var c=s;if("ref"in s){c={};for(var d in s)d!=="ref"&&(c[d]=s[d])}if(r=r.defaultProps){c===s&&(c=x({},c));for(var m in r)c[m]===void 0&&(c[m]=r[m])}return c}function uv(r){Xc(r)}function dv(r){console.error(r)}function fv(r){Xc(r)}function bu(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function hv(r,s,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function wh(r,s,c){return c=ss(c),c.tag=3,c.payload={element:null},c.callback=function(){bu(r,s)},c}function pv(r){return r=ss(r),r.tag=3,r}function mv(r,s,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var v=d.value;r.payload=function(){return m(v)},r.callback=function(){hv(s,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){hv(s,c,d),typeof m!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var E=d.stack;this.componentDidCatch(d.value,{componentStack:E!==null?E:""})})}function Nk(r,s,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=c.alternate,s!==null&&Ha(s,c,m,!0),c=lr.current,c!==null){switch(c.tag){case 31:case 13:return Er===null?Mu():c.alternate===null&&en===0&&(en=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===au?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([d]):s.add(d),Yh(r,d,m)),!1;case 22:return c.flags|=65536,d===au?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([d]):c.add(d)),Yh(r,d,m)),!1}throw Error(i(435,c.tag))}return Yh(r,d,m),Mu(),!1}if(ft)return s=lr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==Uf&&(r=Error(i(422),{cause:d}),eo(kr(r,c)))):(d!==Uf&&(s=Error(i(423),{cause:d}),eo(kr(s,c))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=kr(d,c),m=wh(r.stateNode,d,m),Zf(r,m),en!==4&&(en=2)),!1;var v=Error(i(520),{cause:d});if(v=kr(v,c),yo===null?yo=[v]:yo.push(v),en!==4&&(en=2),s===null)return!0;d=kr(d,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=m&-m,c.lanes|=r,r=wh(c.stateNode,d,r),Zf(c,r),!1;case 1:if(s=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(fs===null||!fs.has(v))))return c.flags|=65536,m&=-m,c.lanes|=m,m=pv(m),mv(m,r,c,d),Zf(c,m),!1}c=c.return}while(c!==null);return!1}var Sh=Error(i(461)),un=!1;function kn(r,s,c,d){s.child=r===null?b0(s,null,c,d):Zs(s,r.child,c,d)}function gv(r,s,c,d,m){c=c.render;var v=s.ref;if("ref"in d){var w={};for(var E in d)E!=="ref"&&(w[E]=d[E])}else w=d;return Ws(s),d=ih(r,s,c,w,v,m),E=sh(),r!==null&&!un?(ah(r,s,m),_i(r,s,m)):(ft&&E&&$f(s),s.flags|=1,kn(r,s,d,m),s.child)}function xv(r,s,c,d,m){if(r===null){var v=c.type;return typeof v=="function"&&!Of(v)&&v.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=v,vv(r,s,v,d,m)):(r=eu(c.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(v=r.child,!Mh(r,m)){var w=v.memoizedProps;if(c=c.compare,c=c!==null?c:Kl,c(w,d)&&r.ref===s.ref)return _i(r,s,m)}return s.flags|=1,r=mi(v,d),r.ref=s.ref,r.return=s,s.child=r}function vv(r,s,c,d,m){if(r!==null){var v=r.memoizedProps;if(Kl(v,d)&&r.ref===s.ref)if(un=!1,s.pendingProps=d=v,Mh(r,m))(r.flags&131072)!==0&&(un=!0);else return s.lanes=r.lanes,_i(r,s,m)}return kh(r,s,c,d,m)}function bv(r,s,c,d){var m=d.children,v=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(v=v!==null?v.baseLanes|c:c,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~v}else d=0,s.child=null;return yv(r,s,v,c,d)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&iu(s,v!==null?v.cachePool:null),v!==null?w0(s,v):eh(),S0(s);else return d=s.lanes=536870912,yv(r,s,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(iu(s,v.cachePool),w0(s,v),os(),s.memoizedState=null):(r!==null&&iu(s,null),eh(),os());return kn(r,s,m,c),s.child}function ho(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function yv(r,s,c,d,m){var v=Wf();return v=v===null?null:{parent:on._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},r!==null&&iu(s,null),eh(),S0(s),r!==null&&Ha(r,s,d,!0),s.childLanes=m,null}function yu(r,s){return s=wu({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function _v(r,s,c){return Zs(s,r.child,null,c),r=yu(s,s.pendingProps),r.flags|=2,or(s),s.memoizedState=null,r}function Ck(r,s,c){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ft){if(d.mode==="hidden")return r=yu(s,d),s.lanes=536870912,ho(null,r);if(nh(s),(r=Ft)?(r=L1(r,Cr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:es!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=i0(r),c.return=s,s.child=c,wn=s,Ft=null)):r=null,r===null)throw ns(s);return s.lanes=536870912,null}return yu(s,d)}var v=r.memoizedState;if(v!==null){var w=v.dehydrated;if(nh(s),m)if(s.flags&256)s.flags&=-257,s=_v(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(un||Ha(r,s,c,!1),m=(c&r.childLanes)!==0,un||m){if(d=Lt,d!==null&&(w=Bl(d,c),w!==0&&w!==v.retryLane))throw v.retryLane=w,qs(r,w),Zn(d,r,w),Sh;Mu(),s=_v(r,s,c)}else r=v.treeContext,Ft=Tr(w.nextSibling),wn=s,ft=!0,ts=null,Cr=!1,r!==null&&l0(s,r),s=yu(s,d),s.flags|=4096;return s}return r=mi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function _u(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function kh(r,s,c,d,m){return Ws(s),c=ih(r,s,c,d,void 0,m),d=sh(),r!==null&&!un?(ah(r,s,m),_i(r,s,m)):(ft&&d&&$f(s),s.flags|=1,kn(r,s,c,m),s.child)}function wv(r,s,c,d,m,v){return Ws(s),s.updateQueue=null,c=j0(s,d,c,m),k0(r),d=sh(),r!==null&&!un?(ah(r,s,v),_i(r,s,v)):(ft&&d&&$f(s),s.flags|=1,kn(r,s,c,v),s.child)}function Sv(r,s,c,d,m){if(Ws(s),s.stateNode===null){var v=Pa,w=c.contextType;typeof w=="object"&&w!==null&&(v=Sn(w)),v=new c(d,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=_h,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=d,v.state=s.memoizedState,v.refs={},Xf(s),w=c.contextType,v.context=typeof w=="object"&&w!==null?Sn(w):Pa,v.state=s.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(yh(s,c,w,d),v.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&_h.enqueueReplaceState(v,v.state,null),lo(s,d,v,m),ao(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){v=s.stateNode;var E=s.memoizedProps,U=ea(c,E);v.props=U;var te=v.context,oe=c.contextType;w=Pa,typeof oe=="object"&&oe!==null&&(w=Sn(oe));var ue=c.getDerivedStateFromProps;oe=typeof ue=="function"||typeof v.getSnapshotBeforeUpdate=="function",E=s.pendingProps!==E,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E||te!==w)&&cv(s,v,d,w),is=!1;var re=s.memoizedState;v.state=re,lo(s,d,v,m),ao(),te=s.memoizedState,E||re!==te||is?(typeof ue=="function"&&(yh(s,c,ue,d),te=s.memoizedState),(U=is||ov(s,c,U,d,re,te,w))?(oe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=te),v.props=d,v.state=te,v.context=w,d=U):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{v=s.stateNode,Kf(r,s),w=s.memoizedProps,oe=ea(c,w),v.props=oe,ue=s.pendingProps,re=v.context,te=c.contextType,U=Pa,typeof te=="object"&&te!==null&&(U=Sn(te)),E=c.getDerivedStateFromProps,(te=typeof E=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==ue||re!==U)&&cv(s,v,d,U),is=!1,re=s.memoizedState,v.state=re,lo(s,d,v,m),ao();var se=s.memoizedState;w!==ue||re!==se||is||r!==null&&r.dependencies!==null&&nu(r.dependencies)?(typeof E=="function"&&(yh(s,c,E,d),se=s.memoizedState),(oe=is||ov(s,c,oe,d,re,se,U)||r!==null&&r.dependencies!==null&&nu(r.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,se,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,se,U)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),v.props=d,v.state=se,v.context=U,d=oe):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),d=!1)}return v=d,_u(r,s),d=(s.flags&128)!==0,v||d?(v=s.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,r!==null&&d?(s.child=Zs(s,r.child,null,m),s.child=Zs(s,null,c,m)):kn(r,s,c,m),s.memoizedState=v.state,r=s.child):r=_i(r,s,m),r}function kv(r,s,c,d){return Gs(),s.flags|=256,kn(r,s,c,d),s.child}var jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nh(r){return{baseLanes:r,cachePool:h0()}}function Ch(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=ur),r}function jv(r,s,c){var d=s.pendingProps,m=!1,v=(s.flags&128)!==0,w;if((w=v)||(w=r!==null&&r.memoizedState===null?!1:(rn.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ft){if(m?ls(s):os(),(r=Ft)?(r=L1(r,Cr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:es!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=i0(r),c.return=s,s.child=c,wn=s,Ft=null)):r=null,r===null)throw ns(s);return cp(r)?s.lanes=32:s.lanes=536870912,null}var E=d.children;return d=d.fallback,m?(os(),m=s.mode,E=wu({mode:"hidden",children:E},m),d=Vs(d,m,c,null),E.return=s,d.return=s,E.sibling=d,s.child=E,d=s.child,d.memoizedState=Nh(c),d.childLanes=Ch(r,w,c),s.memoizedState=jh,ho(null,d)):(ls(s),Eh(s,E))}var U=r.memoizedState;if(U!==null&&(E=U.dehydrated,E!==null)){if(v)s.flags&256?(ls(s),s.flags&=-257,s=Th(r,s,c)):s.memoizedState!==null?(os(),s.child=r.child,s.flags|=128,s=null):(os(),E=d.fallback,m=s.mode,d=wu({mode:"visible",children:d.children},m),E=Vs(E,m,c,null),E.flags|=2,d.return=s,E.return=s,d.sibling=E,s.child=d,Zs(s,r.child,null,c),d=s.child,d.memoizedState=Nh(c),d.childLanes=Ch(r,w,c),s.memoizedState=jh,s=ho(null,d));else if(ls(s),cp(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var te=w.dgst;w=te,d=Error(i(419)),d.stack="",d.digest=w,eo({value:d,source:null,stack:null}),s=Th(r,s,c)}else if(un||Ha(r,s,c,!1),w=(c&r.childLanes)!==0,un||w){if(w=Lt,w!==null&&(d=Bl(w,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,qs(r,d),Zn(w,r,d),Sh;op(E)||Mu(),s=Th(r,s,c)}else op(E)?(s.flags|=192,s.child=r.child,s=null):(r=U.treeContext,Ft=Tr(E.nextSibling),wn=s,ft=!0,ts=null,Cr=!1,r!==null&&l0(s,r),s=Eh(s,d.children),s.flags|=4096);return s}return m?(os(),E=d.fallback,m=s.mode,U=r.child,te=U.sibling,d=mi(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,te!==null?E=mi(te,E):(E=Vs(E,m,c,null),E.flags|=2),E.return=s,d.return=s,d.sibling=E,s.child=d,ho(null,d),d=s.child,E=r.child.memoizedState,E===null?E=Nh(c):(m=E.cachePool,m!==null?(U=on._currentValue,m=m.parent!==U?{parent:U,pool:U}:m):m=h0(),E={baseLanes:E.baseLanes|c,cachePool:m}),d.memoizedState=E,d.childLanes=Ch(r,w,c),s.memoizedState=jh,ho(r.child,d)):(ls(s),c=r.child,r=c.sibling,c=mi(c,{mode:"visible",children:d.children}),c.return=s,c.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=c,s.memoizedState=null,c)}function Eh(r,s){return s=wu({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function wu(r,s){return r=ar(22,r,null,s),r.lanes=0,r}function Th(r,s,c){return Zs(s,r.child,null,c),r=Eh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function Nv(r,s,c){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),qf(r.return,s,c)}function Ah(r,s,c,d,m,v){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:v}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=m,w.treeForkCount=v)}function Cv(r,s,c){var d=s.pendingProps,m=d.revealOrder,v=d.tail;d=d.children;var w=rn.current,E=(w&2)!==0;if(E?(w=w&1|2,s.flags|=128):w&=1,M(rn,w),kn(r,s,d,c),d=ft?Jl:0,!E&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Nv(r,c,s);else if(r.tag===19)Nv(r,c,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(c=s.child,m=null;c!==null;)r=c.alternate,r!==null&&uu(r)===null&&(m=c),c=c.sibling;c=m,c===null?(m=s.child,s.child=null):(m=c.sibling,c.sibling=null),Ah(s,!1,m,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&uu(r)===null){s.child=m;break}r=m.sibling,m.sibling=c,c=m,m=r}Ah(s,!0,c,null,v,d);break;case"together":Ah(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function _i(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),ds|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(Ha(r,s,c,!1),(c&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,c=mi(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=mi(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function Mh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&nu(r)))}function Ek(r,s,c){switch(s.tag){case 3:Le(s,s.stateNode.containerInfo),rs(s,on,r.memoizedState.cache),Gs();break;case 27:case 5:Je(s);break;case 4:Le(s,s.stateNode.containerInfo);break;case 10:rs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,nh(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(ls(s),s.flags|=128,null):(c&s.child.childLanes)!==0?jv(r,s,c):(ls(s),r=_i(r,s,c),r!==null?r.sibling:null);ls(s);break;case 19:var m=(r.flags&128)!==0;if(d=(c&s.childLanes)!==0,d||(Ha(r,s,c,!1),d=(c&s.childLanes)!==0),m){if(d)return Cv(r,s,c);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(rn,rn.current),d)break;return null;case 22:return s.lanes=0,bv(r,s,c,s.pendingProps);case 24:rs(s,on,r.memoizedState.cache)}return _i(r,s,c)}function Ev(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)un=!0;else{if(!Mh(r,c)&&(s.flags&128)===0)return un=!1,Ek(r,s,c);un=(r.flags&131072)!==0}else un=!1,ft&&(s.flags&1048576)!==0&&a0(s,Jl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Xs(s.elementType),s.type=r,typeof r=="function")Of(r)?(d=ea(r,d),s.tag=1,s=Sv(null,s,r,d,c)):(s.tag=0,s=kh(null,s,r,d,c));else{if(r!=null){var m=r.$$typeof;if(m===L){s.tag=11,s=gv(null,s,r,d,c);break e}else if(m===q){s.tag=14,s=xv(null,s,r,d,c);break e}}throw s=J(r)||r,Error(i(306,s,""))}}return s;case 0:return kh(r,s,s.type,s.pendingProps,c);case 1:return d=s.type,m=ea(d,s.pendingProps),Sv(r,s,d,m,c);case 3:e:{if(Le(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var v=s.memoizedState;m=v.element,Kf(r,s),lo(s,d,null,c);var w=s.memoizedState;if(d=w.cache,rs(s,on,d),d!==v.cache&&Vf(s,[on],c,!0),ao(),d=w.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=kv(r,s,d,c);break e}else if(d!==m){m=kr(Error(i(424)),s),eo(m),s=kv(r,s,d,c);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(Ft=Tr(r.firstChild),wn=s,ft=!0,ts=null,Cr=!0,c=b0(s,null,d,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Gs(),d===m){s=_i(r,s,c);break e}kn(r,s,d,c)}s=s.child}return s;case 26:return _u(r,s),r===null?(c=$1(s.type,null,s.pendingProps,null))?s.memoizedState=c:ft||(c=s.type,r=s.pendingProps,d=Pu(je.current).createElement(c),d[Gt]=s,d[_n]=r,jn(d,c,r),Kt(d),s.stateNode=d):s.memoizedState=$1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Je(s),r===null&&ft&&(d=s.stateNode=O1(s.type,s.pendingProps,je.current),wn=s,Cr=!0,m=Ft,gs(s.type)?(up=m,Ft=Tr(d.firstChild)):Ft=m),kn(r,s,s.pendingProps.children,c),_u(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ft&&((m=d=Ft)&&(d=ij(d,s.type,s.pendingProps,Cr),d!==null?(s.stateNode=d,wn=s,Ft=Tr(d.firstChild),Cr=!1,m=!0):m=!1),m||ns(s)),Je(s),m=s.type,v=s.pendingProps,w=r!==null?r.memoizedProps:null,d=v.children,sp(m,v)?d=null:w!==null&&sp(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=ih(r,s,bk,null,null,c),Eo._currentValue=m),_u(r,s),kn(r,s,d,c),s.child;case 6:return r===null&&ft&&((r=c=Ft)&&(c=sj(c,s.pendingProps,Cr),c!==null?(s.stateNode=c,wn=s,Ft=null,r=!0):r=!1),r||ns(s)),null;case 13:return jv(r,s,c);case 4:return Le(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Zs(s,null,d,c):kn(r,s,d,c),s.child;case 11:return gv(r,s,s.type,s.pendingProps,c);case 7:return kn(r,s,s.pendingProps,c),s.child;case 8:return kn(r,s,s.pendingProps.children,c),s.child;case 12:return kn(r,s,s.pendingProps.children,c),s.child;case 10:return d=s.pendingProps,rs(s,s.type,d.value),kn(r,s,d.children,c),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Ws(s),m=Sn(m),d=d(m),s.flags|=1,kn(r,s,d,c),s.child;case 14:return xv(r,s,s.type,s.pendingProps,c);case 15:return vv(r,s,s.type,s.pendingProps,c);case 19:return Cv(r,s,c);case 31:return Ck(r,s,c);case 22:return bv(r,s,c,s.pendingProps);case 24:return Ws(s),d=Sn(on),r===null?(m=Wf(),m===null&&(m=Lt,v=Gf(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=c),m=v),s.memoizedState={parent:d,cache:m},Xf(s),rs(s,on,m)):((r.lanes&c)!==0&&(Kf(r,s),lo(s,null,null,c),ao()),m=r.memoizedState,v=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),rs(s,on,d)):(d=v.cache,rs(s,on,d),d!==m.cache&&Vf(s,[on],c,!0))),kn(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function wi(r){r.flags|=4}function Rh(r,s,c,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(t1())r.flags|=8192;else throw Ks=au,Qf}else r.flags&=-16777217}function Tv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!q1(s))if(t1())r.flags|=8192;else throw Ks=au,Qf}function Su(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?ln():536870912,r.lanes|=s,el|=s)}function po(r,s){if(!ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ut(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(s)for(var m=r.child;m!==null;)c|=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;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=c,s}function Tk(r,s,c){var d=s.pendingProps;switch(Ff(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(s),null;case 1:return Ut(s),null;case 3:return c=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),vi(on),Be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Ua(s)?wi(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Hf())),Ut(s),null;case 26:var m=s.type,v=s.memoizedState;return r===null?(wi(s),v!==null?(Ut(s),Tv(s,v)):(Ut(s),Rh(s,m,null,d,c))):v?v!==r.memoizedState?(wi(s),Ut(s),Tv(s,v)):(Ut(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&wi(s),Ut(s),Rh(s,m,r,d,c)),null;case 27:if(it(s),c=je.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ut(s),null}r=de.current,Ua(s)?o0(s):(r=O1(m,d,c),s.stateNode=r,wi(s))}return Ut(s),null;case 5:if(it(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ut(s),null}if(v=de.current,Ua(s))o0(s);else{var w=Pu(je.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}v[Gt]=s,v[_n]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)v.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=v;e:switch(jn(v,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&&wi(s)}}return Ut(s),Rh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=je.current,Ua(s)){if(r=s.stateNode,c=s.memoizedProps,d=null,m=wn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Gt]=s,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||j1(r.nodeValue,c)),r||ns(s,!0)}else r=Pu(r).createTextNode(d),r[Gt]=s,s.stateNode=r}return Ut(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(d=Ua(s),c!==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 Gs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ut(s),r=!1}else c=Hf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(or(s),s):(or(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Ut(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ua(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 Gs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ut(s),m=!1}else m=Hf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(or(s),s):(or(s),null)}return or(s),(s.flags&128)!==0?(s.lanes=c,s):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==m&&(d.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),Su(s,s.updateQueue),Ut(s),null);case 4:return Be(),r===null&&ep(s.stateNode.containerInfo),Ut(s),null;case 10:return vi(s.type),Ut(s),null;case 19:if(Z(rn),d=s.memoizedState,d===null)return Ut(s),null;if(m=(s.flags&128)!==0,v=d.rendering,v===null)if(m)po(d,!1);else{if(en!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(v=uu(r),v!==null){for(s.flags|=128,po(d,!1),r=v.updateQueue,s.updateQueue=r,Su(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)r0(c,r),c=c.sibling;return M(rn,rn.current&1|2),ft&&gi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Ee()>Eu&&(s.flags|=128,m=!0,po(d,!1),s.lanes=4194304)}else{if(!m)if(r=uu(v),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,Su(s,r),po(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ft)return Ut(s),null}else 2*Ee()-d.renderingStartTime>Eu&&c!==536870912&&(s.flags|=128,m=!0,po(d,!1),s.lanes=4194304);d.isBackwards?(v.sibling=s.child,s.child=v):(r=d.last,r!==null?r.sibling=v:s.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Ee(),r.sibling=null,c=rn.current,M(rn,m?c&1|2:c&1),ft&&gi(s,d.treeForkCount),r):(Ut(s),null);case 22:case 23:return or(s),th(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(c&536870912)!==0&&(s.flags&128)===0&&(Ut(s),s.subtreeFlags&6&&(s.flags|=8192)):Ut(s),c=s.updateQueue,c!==null&&Su(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048),r!==null&&Z(Qs),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),vi(on),Ut(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Ak(r,s){switch(Ff(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return vi(on),Be(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return it(s),null;case 31:if(s.memoizedState!==null){if(or(s),s.alternate===null)throw Error(i(340));Gs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(or(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Gs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(rn),null;case 4:return Be(),null;case 10:return vi(s.type),null;case 22:case 23:return or(s),th(),r!==null&&Z(Qs),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return vi(on),null;case 25:return null;default:return null}}function Av(r,s){switch(Ff(s),s.tag){case 3:vi(on),Be();break;case 26:case 27:case 5:it(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&or(s);break;case 13:or(s);break;case 19:Z(rn);break;case 10:vi(s.type);break;case 22:case 23:or(s),th(),r!==null&&Z(Qs);break;case 24:vi(on)}}function mo(r,s){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&r)===r){d=void 0;var v=c.create,w=c.inst;d=v(),w.destroy=d}c=c.next}while(c!==m)}}catch(E){Nt(s,s.return,E)}}function cs(r,s,c){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var v=m.next;d=v;do{if((d.tag&r)===r){var w=d.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,m=s;var U=c,te=E;try{te()}catch(oe){Nt(m,U,oe)}}}d=d.next}while(d!==v)}}catch(oe){Nt(s,s.return,oe)}}function Mv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{_0(s,c)}catch(d){Nt(r,r.return,d)}}}function Rv(r,s,c){c.props=ea(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Nt(r,s,d)}}function go(r,s){try{var c=r.ref;if(c!==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 c=="function"?r.refCleanup=c(d):c.current=d}}catch(m){Nt(r,s,m)}}function ii(r,s){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Nt(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Nt(r,s,m)}else c.current=null}function Lv(r){var s=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Nt(r,r.return,m)}}function Lh(r,s,c){try{var d=r.stateNode;Zk(d,r.type,c,s),d[_n]=s}catch(m){Nt(r,r.return,m)}}function Dv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&gs(r.type)||r.tag===4}function Dh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Dv(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&&gs(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 zh(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=yr));else if(d!==4&&(d===27&&gs(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(zh(r,s,c),r=r.sibling;r!==null;)zh(r,s,c),r=r.sibling}function ku(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(d!==4&&(d===27&&gs(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(ku(r,s,c),r=r.sibling;r!==null;)ku(r,s,c),r=r.sibling}function zv(r){var s=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);jn(s,d,c),s[Gt]=r,s[_n]=c}catch(v){Nt(r,r.return,v)}}var Si=!1,dn=!1,Oh=!1,Ov=typeof WeakSet=="function"?WeakSet:Set,yn=null;function Mk(r,s){if(r=r.containerInfo,rp=Vu,r=Wx(r),Tf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var m=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var w=0,E=-1,U=-1,te=0,oe=0,ue=r,re=null;t:for(;;){for(var se;ue!==c||m!==0&&ue.nodeType!==3||(E=w+m),ue!==v||d!==0&&ue.nodeType!==3||(U=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(se=ue.firstChild)!==null;)re=ue,ue=se;for(;;){if(ue===r)break t;if(re===c&&++te===m&&(E=w),re===v&&++oe===d&&(U=w),(se=ue.nextSibling)!==null)break;ue=re,re=ue.parentNode}ue=se}c=E===-1||U===-1?null:{start:E,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(ip={focusedElem:r,selectionRange:c},Vu=!1,yn=s;yn!==null;)if(s=yn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,yn=r;else for(;yn!==null;){switch(s=yn,v=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(c=0;c<r.length;c++)m=r[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=s,m=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Te=ea(c.type,m);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){Nt(c,c.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)lp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":lp(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,yn=r;break}yn=s.return}}function Bv(r,s,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ji(r,c),d&4&&mo(5,c);break;case 1:if(ji(r,c),d&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(w){Nt(c,c.return,w)}else{var m=ea(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){Nt(c,c.return,w)}}d&64&&Mv(c),d&512&&go(c,c.return);break;case 3:if(ji(r,c),d&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{_0(r,s)}catch(w){Nt(c,c.return,w)}}break;case 27:s===null&&d&4&&zv(c);case 26:case 5:ji(r,c),s===null&&d&4&&Lv(c),d&512&&go(c,c.return);break;case 12:ji(r,c);break;case 31:ji(r,c),d&4&&Fv(r,c);break;case 13:ji(r,c),d&4&&Uv(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=Fk.bind(null,c),aj(r,c))));break;case 22:if(d=c.memoizedState!==null||Si,!d){s=s!==null&&s.memoizedState!==null||dn,m=Si;var v=dn;Si=d,(dn=s)&&!v?Ni(r,c,(c.subtreeFlags&8772)!==0):ji(r,c),Si=m,dn=v}break;case 30:break;default:ji(r,c)}}function Pv(r){var s=r.alternate;s!==null&&(r.alternate=null,Pv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Gi(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 Yt=null,Wn=!1;function ki(r,s,c){for(c=c.child;c!==null;)$v(r,s,c),c=c.sibling}function $v(r,s,c){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(rt,c)}catch{}switch(c.tag){case 26:dn||ii(c,s),ki(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:dn||ii(c,s);var d=Yt,m=Wn;gs(c.type)&&(Yt=c.stateNode,Wn=!1),ki(r,s,c),jo(c.stateNode),Yt=d,Wn=m;break;case 5:dn||ii(c,s);case 6:if(d=Yt,m=Wn,Yt=null,ki(r,s,c),Yt=d,Wn=m,Yt!==null)if(Wn)try{(Yt.nodeType===9?Yt.body:Yt.nodeName==="HTML"?Yt.ownerDocument.body:Yt).removeChild(c.stateNode)}catch(v){Nt(c,s,v)}else try{Yt.removeChild(c.stateNode)}catch(v){Nt(c,s,v)}break;case 18:Yt!==null&&(Wn?(r=Yt,M1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),ol(r)):M1(Yt,c.stateNode));break;case 4:d=Yt,m=Wn,Yt=c.stateNode.containerInfo,Wn=!0,ki(r,s,c),Yt=d,Wn=m;break;case 0:case 11:case 14:case 15:cs(2,c,s),dn||cs(4,c,s),ki(r,s,c);break;case 1:dn||(ii(c,s),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Rv(c,s,d)),ki(r,s,c);break;case 21:ki(r,s,c);break;case 22:dn=(d=dn)||c.memoizedState!==null,ki(r,s,c),dn=d;break;default:ki(r,s,c)}}function Fv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ol(r)}catch(c){Nt(s,s.return,c)}}}function Uv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ol(r)}catch(c){Nt(s,s.return,c)}}function Rk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Ov),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Ov),s;default:throw Error(i(435,r.tag))}}function ju(r,s){var c=Rk(r);s.forEach(function(d){if(!c.has(d)){c.add(d);var m=Uk.bind(null,r,d);d.then(m,m)}})}function Qn(r,s){var c=s.deletions;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d],v=r,w=s,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(gs(E.type)){Yt=E.stateNode,Wn=!1;break e}break;case 5:Yt=E.stateNode,Wn=!1;break e;case 3:case 4:Yt=E.stateNode.containerInfo,Wn=!0;break e}E=E.return}if(Yt===null)throw Error(i(160));$v(v,w,m),Yt=null,Wn=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Hv(s,r),s=s.sibling}var Ir=null;function Hv(r,s){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Qn(s,r),Xn(r),d&4&&(cs(3,r,r.return),mo(3,r),cs(5,r,r.return));break;case 1:Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),d&64&&Si&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var m=Ir;if(Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":v=m.getElementsByTagName("title")[0],(!v||v[Kr]||v[Gt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(d),m.head.insertBefore(v,m.querySelector("head > title"))),jn(v,d,c),v[Gt]=r,Kt(v),d=v;break e;case"link":var w=H1("link","href",m).get(d+(c.href||""));if(w){for(var E=0;E<w.length;E++)if(v=w[E],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){w.splice(E,1);break t}}v=m.createElement(d),jn(v,d,c),m.head.appendChild(v);break;case"meta":if(w=H1("meta","content",m).get(d+(c.content||""))){for(E=0;E<w.length;E++)if(v=w[E],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){w.splice(E,1);break t}}v=m.createElement(d),jn(v,d,c),m.head.appendChild(v);break;default:throw Error(i(468,d))}v[Gt]=r,Kt(v),d=v}r.stateNode=d}else I1(m,r.type,r.stateNode);else r.stateNode=U1(m,d,r.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?I1(m,r.type,r.stateNode):U1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Lh(r,r.memoizedProps,c.memoizedProps)}break;case 27:Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),c!==null&&d&4&&Lh(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),r.flags&32){m=r.stateNode;try{Qi(m,"")}catch(Te){Nt(r,r.return,Te)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Lh(r,m,c!==null?c.memoizedProps:m)),d&1024&&(Oh=!0);break;case 6:if(Qn(s,r),Xn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(Te){Nt(r,r.return,Te)}}break;case 3:if(Uu=null,m=Ir,Ir=$u(s.containerInfo),Qn(s,r),Ir=m,Xn(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{ol(s.containerInfo)}catch(Te){Nt(r,r.return,Te)}Oh&&(Oh=!1,Iv(r));break;case 4:d=Ir,Ir=$u(r.stateNode.containerInfo),Qn(s,r),Xn(r),Ir=d;break;case 12:Qn(s,r),Xn(r);break;case 31:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 13:Qn(s,r),Xn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Cu=Ee()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 22:m=r.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,te=Si,oe=dn;if(Si=te||m,dn=oe||U,Qn(s,r),dn=oe,Si=te,Xn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(c===null||U||Si||dn||ta(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(v=U.stateNode,m)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=U.stateNode;var ue=U.memoizedProps.style,re=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;E.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Te){Nt(U,U.return,Te)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=m?"":U.memoizedProps}catch(Te){Nt(U,U.return,Te)}}}else if(s.tag===18){if(c===null){U=s;try{var se=U.stateNode;m?R1(se,!0):R1(U.stateNode,!1)}catch(Te){Nt(U,U.return,Te)}}}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;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,ju(r,c))));break;case 19:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 30:break;case 21:break;default:Qn(s,r),Xn(r)}}function Xn(r){var s=r.flags;if(s&2){try{for(var c,d=r.return;d!==null;){if(Dv(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,v=Dh(r);ku(r,v,m);break;case 5:var w=c.stateNode;c.flags&32&&(Qi(w,""),c.flags&=-33);var E=Dh(r);ku(r,E,w);break;case 3:case 4:var U=c.stateNode.containerInfo,te=Dh(r);zh(r,te,U);break;default:throw Error(i(161))}}catch(oe){Nt(r,r.return,oe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Iv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Iv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function ji(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Bv(r,s.alternate,s),s=s.sibling}function ta(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:cs(4,s,s.return),ta(s);break;case 1:ii(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&Rv(s,s.return,c),ta(s);break;case 27:jo(s.stateNode);case 26:case 5:ii(s,s.return),ta(s);break;case 22:s.memoizedState===null&&ta(s);break;case 30:ta(s);break;default:ta(s)}r=r.sibling}}function Ni(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,v=s,w=v.flags;switch(v.tag){case 0:case 11:case 15:Ni(m,v,c),mo(4,v);break;case 1:if(Ni(m,v,c),d=v,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){Nt(d,d.return,te)}if(d=v,m=d.updateQueue,m!==null){var E=d.stateNode;try{var U=m.shared.hiddenCallbacks;if(U!==null)for(m.shared.hiddenCallbacks=null,m=0;m<U.length;m++)y0(U[m],E)}catch(te){Nt(d,d.return,te)}}c&&w&64&&Mv(v),go(v,v.return);break;case 27:zv(v);case 26:case 5:Ni(m,v,c),c&&d===null&&w&4&&Lv(v),go(v,v.return);break;case 12:Ni(m,v,c);break;case 31:Ni(m,v,c),c&&w&4&&Fv(m,v);break;case 13:Ni(m,v,c),c&&w&4&&Uv(m,v);break;case 22:v.memoizedState===null&&Ni(m,v,c),go(v,v.return);break;case 30:break;default:Ni(m,v,c)}s=s.sibling}}function Bh(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&to(c))}function Ph(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r))}function qr(r,s,c,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)qv(r,s,c,d),s=s.sibling}function qv(r,s,c,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:qr(r,s,c,d),m&2048&&mo(9,s);break;case 1:qr(r,s,c,d);break;case 3:qr(r,s,c,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r)));break;case 12:if(m&2048){qr(r,s,c,d),r=s.stateNode;try{var v=s.memoizedProps,w=v.id,E=v.onPostCommit;typeof E=="function"&&E(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(U){Nt(s,s.return,U)}}else qr(r,s,c,d);break;case 31:qr(r,s,c,d);break;case 13:qr(r,s,c,d);break;case 23:break;case 22:v=s.stateNode,w=s.alternate,s.memoizedState!==null?v._visibility&2?qr(r,s,c,d):xo(r,s):v._visibility&2?qr(r,s,c,d):(v._visibility|=2,Ka(r,s,c,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&Bh(w,s);break;case 24:qr(r,s,c,d),m&2048&&Ph(s.alternate,s);break;default:qr(r,s,c,d)}}function Ka(r,s,c,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=r,w=s,E=c,U=d,te=w.flags;switch(w.tag){case 0:case 11:case 15:Ka(v,w,E,U,m),mo(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Ka(v,w,E,U,m):xo(v,w):(oe._visibility|=2,Ka(v,w,E,U,m)),m&&te&2048&&Bh(w.alternate,w);break;case 24:Ka(v,w,E,U,m),m&&te&2048&&Ph(w.alternate,w);break;default:Ka(v,w,E,U,m)}s=s.sibling}}function xo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,d=s,m=d.flags;switch(d.tag){case 22:xo(c,d),m&2048&&Bh(d.alternate,d);break;case 24:xo(c,d),m&2048&&Ph(d.alternate,d);break;default:xo(c,d)}s=s.sibling}}var vo=8192;function Za(r,s,c){if(r.subtreeFlags&vo)for(r=r.child;r!==null;)Vv(r,s,c),r=r.sibling}function Vv(r,s,c){switch(r.tag){case 26:Za(r,s,c),r.flags&vo&&r.memoizedState!==null&&vj(c,Ir,r.memoizedState,r.memoizedProps);break;case 5:Za(r,s,c);break;case 3:case 4:var d=Ir;Ir=$u(r.stateNode.containerInfo),Za(r,s,c),Ir=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vo,vo=16777216,Za(r,s,c),vo=d):Za(r,s,c));break;default:Za(r,s,c)}}function Gv(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 bo(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];yn=d,Wv(d,r)}Gv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Yv(r),r=r.sibling}function Yv(r){switch(r.tag){case 0:case 11:case 15:bo(r),r.flags&2048&&cs(9,r,r.return);break;case 3:bo(r);break;case 12:bo(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,Nu(r)):bo(r);break;default:bo(r)}}function Nu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];yn=d,Wv(d,r)}Gv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:cs(8,s,s.return),Nu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Nu(s));break;default:Nu(s)}r=r.sibling}}function Wv(r,s){for(;yn!==null;){var c=yn;switch(c.tag){case 0:case 11:case 15:cs(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:to(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,yn=d;else e:for(c=r;yn!==null;){d=yn;var m=d.sibling,v=d.return;if(Pv(d),d===c){yn=null;break e}if(m!==null){m.return=v,yn=m;break e}yn=v}}}var Lk={getCacheForType:function(r){var s=Sn(on),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return Sn(on).controller.signal}},Dk=typeof WeakMap=="function"?WeakMap:Map,_t=0,Lt=null,at=null,ut=0,jt=0,cr=null,us=!1,Ja=!1,$h=!1,Ci=0,en=0,ds=0,na=0,Fh=0,ur=0,el=0,yo=null,Kn=null,Uh=!1,Cu=0,Qv=0,Eu=1/0,Tu=null,fs=null,bn=0,hs=null,tl=null,Ei=0,Hh=0,Ih=null,Xv=null,_o=0,qh=null;function dr(){return(_t&2)!==0&&ut!==0?ut&-ut:B.T!==null?Xh():Pl()}function Kv(){if(ur===0)if((ut&536870912)===0||ft){var r=$r;$r<<=1,($r&3932160)===0&&($r=262144),ur=r}else ur=536870912;return r=lr.current,r!==null&&(r.flags|=32),ur}function Zn(r,s,c){(r===Lt&&(jt===2||jt===9)||r.cancelPendingCommit!==null)&&(nl(r,0),ps(r,ut,ur,!1)),Pt(r,c),((_t&2)===0||r!==Lt)&&(r===Lt&&((_t&2)===0&&(na|=c),en===4&&ps(r,ut,ur,!1)),si(r))}function Zv(r,s,c){if((_t&6)!==0)throw Error(i(327));var d=!c&&(s&127)===0&&(s&r.expiredLanes)===0||Xe(r,s),m=d?Bk(r,s):Gh(r,s,!0),v=d;do{if(m===0){Ja&&!d&&ps(r,s,0,!1);break}else{if(c=r.current.alternate,v&&!zk(c)){m=Gh(r,s,!1),v=!1;continue}if(m===2){if(v=s,r.errorRecoveryDisabledLanes&v)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var E=r;m=yo;var U=E.current.memoizedState.isDehydrated;if(U&&(nl(E,w).flags|=256),w=Gh(E,w,!1),w!==2){if($h&&!U){E.errorRecoveryDisabledLanes|=v,na|=v,m=4;break e}v=Kn,Kn=m,v!==null&&(Kn===null?Kn=v:Kn.push.apply(Kn,v))}m=w}if(v=!1,m!==2)continue}}if(m===1){nl(r,0),ps(r,s,0,!0);break}e:{switch(d=r,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ps(d,s,ur,!us);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=Cu+300-Ee(),10<m)){if(ps(d,s,ur,!us),ve(d,0,!0)!==0)break e;Ei=s,d.timeoutHandle=T1(Jv.bind(null,d,c,Kn,Tu,Uh,s,ur,na,el,us,v,"Throttled",-0,0),m);break e}Jv(d,c,Kn,Tu,Uh,s,ur,na,el,us,v,null,-0,0)}}break}while(!0);si(r)}function Jv(r,s,c,d,m,v,w,E,U,te,oe,ue,re,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:yr},Vv(s,v,ue);var Te=(v&62914560)===v?Cu-Ee():(v&4194048)===v?Qv-Ee():0;if(Te=bj(ue,Te),Te!==null){Ei=v,r.cancelPendingCommit=Te(l1.bind(null,r,s,v,c,d,m,w,E,U,oe,ue,null,re,se)),ps(r,v,w,!te);return}}l1(r,s,v,c,d,m,w,E,U)}function zk(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],v=m.getSnapshot;m=m.value;try{if(!sr(v(),m))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;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 ps(r,s,c,d){s&=~Fh,s&=~na,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var v=31-et(m),w=1<<v;d[v]=-1,m&=~w}c!==0&&xr(r,c,s)}function Au(){return(_t&6)===0?(wo(0),!1):!0}function Vh(){if(at!==null){if(jt===0)var r=at.return;else r=at,xi=Ys=null,lh(r),Ga=null,ro=0,r=at;for(;r!==null;)Av(r.alternate,r),r=r.return;at=null}}function nl(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,tj(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Ei=0,Vh(),Lt=r,at=c=mi(r.current,null),ut=s,jt=0,cr=null,us=!1,Ja=Xe(r,s),$h=!1,el=ur=Fh=na=ds=en=0,Kn=yo=null,Uh=!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-et(d),v=1<<m;s|=r[m],d&=~v}return Ci=s,Kc(),c}function e1(r,s){Ze=null,B.H=fo,s===Va||s===su?(s=g0(),jt=3):s===Qf?(s=g0(),jt=4):jt=s===Sh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,cr=s,at===null&&(en=1,bu(r,kr(s,r.current)))}function t1(){var r=lr.current;return r===null?!0:(ut&4194048)===ut?Er===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Er:!1}function n1(){var r=B.H;return B.H=fo,r===null?fo:r}function r1(){var r=B.A;return B.A=Lk,r}function Mu(){en=4,us||(ut&4194048)!==ut&&lr.current!==null||(Ja=!0),(ds&134217727)===0&&(na&134217727)===0||Lt===null||ps(Lt,ut,ur,!1)}function Gh(r,s,c){var d=_t;_t|=2;var m=n1(),v=r1();(Lt!==r||ut!==s)&&(Tu=null,nl(r,s)),s=!1;var w=en;e:do try{if(jt!==0&&at!==null){var E=at,U=cr;switch(jt){case 8:Vh(),w=6;break e;case 3:case 2:case 9:case 6:lr.current===null&&(s=!0);var te=jt;if(jt=0,cr=null,rl(r,E,U,te),c&&Ja){w=0;break e}break;default:te=jt,jt=0,cr=null,rl(r,E,U,te)}}Ok(),w=en;break}catch(oe){e1(r,oe)}while(!0);return s&&r.shellSuspendCounter++,xi=Ys=null,_t=d,B.H=m,B.A=v,at===null&&(Lt=null,ut=0,Kc()),w}function Ok(){for(;at!==null;)i1(at)}function Bk(r,s){var c=_t;_t|=2;var d=n1(),m=r1();Lt!==r||ut!==s?(Tu=null,Eu=Ee()+500,nl(r,s)):Ja=Xe(r,s);e:do try{if(jt!==0&&at!==null){s=at;var v=cr;t:switch(jt){case 1:jt=0,cr=null,rl(r,s,v,1);break;case 2:case 9:if(p0(v)){jt=0,cr=null,s1(s);break}s=function(){jt!==2&&jt!==9||Lt!==r||(jt=7),si(r)},v.then(s,s);break e;case 3:jt=7;break e;case 4:jt=5;break e;case 7:p0(v)?(jt=0,cr=null,s1(s)):(jt=0,cr=null,rl(r,s,v,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var E=at;if(w?q1(w):E.stateNode.complete){jt=0,cr=null;var U=E.sibling;if(U!==null)at=U;else{var te=E.return;te!==null?(at=te,Ru(te)):at=null}break t}}jt=0,cr=null,rl(r,s,v,5);break;case 6:jt=0,cr=null,rl(r,s,v,6);break;case 8:Vh(),en=6;break e;default:throw Error(i(462))}}Pk();break}catch(oe){e1(r,oe)}while(!0);return xi=Ys=null,B.H=d,B.A=m,_t=c,at!==null?0:(Lt=null,ut=0,Kc(),en)}function Pk(){for(;at!==null&&!ze();)i1(at)}function i1(r){var s=Ev(r.alternate,r,Ci);r.memoizedProps=r.pendingProps,s===null?Ru(r):at=s}function s1(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=wv(c,s,s.pendingProps,s.type,void 0,ut);break;case 11:s=wv(c,s,s.pendingProps,s.type.render,s.ref,ut);break;case 5:lh(s);default:Av(c,s),s=at=r0(s,Ci),s=Ev(c,s,Ci)}r.memoizedProps=r.pendingProps,s===null?Ru(r):at=s}function rl(r,s,c,d){xi=Ys=null,lh(s),Ga=null,ro=0;var m=s.return;try{if(Nk(r,m,s,c,ut)){en=1,bu(r,kr(c,r.current)),at=null;return}}catch(v){if(m!==null)throw at=m,v;en=1,bu(r,kr(c,r.current)),at=null;return}s.flags&32768?(ft||d===1?r=!0:Ja||(ut&536870912)!==0?r=!1:(us=r=!0,(d===2||d===9||d===3||d===6)&&(d=lr.current,d!==null&&d.tag===13&&(d.flags|=16384))),a1(s,r)):Ru(s)}function Ru(r){var s=r;do{if((s.flags&32768)!==0){a1(s,us);return}r=s.return;var c=Tk(s.alternate,s,Ci);if(c!==null){at=c;return}if(s=s.sibling,s!==null){at=s;return}at=s=r}while(s!==null);en===0&&(en=5)}function a1(r,s){do{var c=Ak(r.alternate,r);if(c!==null){c.flags&=32767,at=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){at=r;return}at=r=c}while(r!==null);en=6,at=null}function l1(r,s,c,d,m,v,w,E,U){r.cancelPendingCommit=null;do Lu();while(bn!==0);if((_t&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(v=s.lanes|s.childLanes,v|=Df,zn(r,c,v,w,E,U),r===Lt&&(at=Lt=null,ut=0),tl=s,hs=r,Ei=c,Hh=v,Ih=m,Xv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Hk(Q,function(){return f1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=B.T,B.T=null,m=F.p,F.p=2,w=_t,_t|=4;try{Mk(r,s,c)}finally{_t=w,F.p=m,B.T=d}}bn=1,o1(),c1(),u1()}}function o1(){if(bn===1){bn=0;var r=hs,s=tl,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var d=F.p;F.p=2;var m=_t;_t|=4;try{Hv(s,r);var v=ip,w=Wx(r.containerInfo),E=v.focusedElem,U=v.selectionRange;if(w!==E&&E&&E.ownerDocument&&Yx(E.ownerDocument.documentElement,E)){if(U!==null&&Tf(E)){var te=U.start,oe=U.end;if(oe===void 0&&(oe=te),"selectionStart"in E)E.selectionStart=te,E.selectionEnd=Math.min(oe,E.value.length);else{var ue=E.ownerDocument||document,re=ue&&ue.defaultView||window;if(re.getSelection){var se=re.getSelection(),Te=E.textContent.length,Ue=Math.min(U.start,Te),At=U.end===void 0?Ue:Math.min(U.end,Te);!se.extend&&Ue>At&&(w=At,At=Ue,Ue=w);var K=Gx(E,Ue),V=Gx(E,At);if(K&&V&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==V.node||se.focusOffset!==V.offset)){var ee=ue.createRange();ee.setStart(K.node,K.offset),se.removeAllRanges(),Ue>At?(se.addRange(ee),se.extend(V.node,V.offset)):(ee.setEnd(V.node,V.offset),se.addRange(ee))}}}}for(ue=[],se=E;se=se.parentNode;)se.nodeType===1&&ue.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ue.length;E++){var ce=ue[E];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Vu=!!rp,ip=rp=null}finally{_t=m,F.p=d,B.T=c}}r.current=s,bn=2}}function c1(){if(bn===2){bn=0;var r=hs,s=tl,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var d=F.p;F.p=2;var m=_t;_t|=4;try{Bv(r,s.alternate,s)}finally{_t=m,F.p=d,B.T=c}}bn=3}}function u1(){if(bn===4||bn===3){bn=0,mt();var r=hs,s=tl,c=Ei,d=Xv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?bn=5:(bn=0,tl=hs=null,d1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(fs=null),Ls(c),s=s.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(rt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=B.T,m=F.p,F.p=2,B.T=null;try{for(var v=r.onRecoverableError,w=0;w<d.length;w++){var E=d[w];v(E.value,{componentStack:E.stack})}}finally{B.T=s,F.p=m}}(Ei&3)!==0&&Lu(),si(r),m=r.pendingLanes,(c&261930)!==0&&(m&42)!==0?r===qh?_o++:(_o=0,qh=r):_o=0,wo(0)}}function d1(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,to(s)))}function Lu(){return o1(),c1(),u1(),f1()}function f1(){if(bn!==5)return!1;var r=hs,s=Hh;Hh=0;var c=Ls(Ei),d=B.T,m=F.p;try{F.p=32>c?32:c,B.T=null,c=Ih,Ih=null;var v=hs,w=Ei;if(bn=0,tl=hs=null,Ei=0,(_t&6)!==0)throw Error(i(331));var E=_t;if(_t|=4,Yv(v.current),qv(v,v.current,w,c),_t=E,wo(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(rt,v)}catch{}return!0}finally{F.p=m,B.T=d,d1(r,s)}}function h1(r,s,c){s=kr(c,s),s=wh(r.stateNode,s,2),r=as(r,s,2),r!==null&&(Pt(r,2),si(r))}function Nt(r,s,c){if(r.tag===3)h1(r,r,c);else for(;s!==null;){if(s.tag===3){h1(s,r,c);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(fs===null||!fs.has(d))){r=kr(c,r),c=pv(2),d=as(s,c,2),d!==null&&(mv(c,d,s,r),Pt(d,2),si(d));break}}s=s.return}}function Yh(r,s,c){var d=r.pingCache;if(d===null){d=r.pingCache=new Dk;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(c)||($h=!0,m.add(c),r=$k.bind(null,r,s,c),s.then(r,r))}function $k(r,s,c){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Lt===r&&(ut&c)===c&&(en===4||en===3&&(ut&62914560)===ut&&300>Ee()-Cu?(_t&2)===0&&nl(r,0):Fh|=c,el===ut&&(el=0)),si(r)}function p1(r,s){s===0&&(s=ln()),r=qs(r,s),r!==null&&(Pt(r,s),si(r))}function Fk(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),p1(r,c)}function Uk(r,s){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(c=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),p1(r,c)}function Hk(r,s){return mn(r,s)}var Du=null,il=null,Wh=!1,zu=!1,Qh=!1,ms=0;function si(r){r!==il&&r.next===null&&(il===null?Du=il=r:il=il.next=r),zu=!0,Wh||(Wh=!0,qk())}function wo(r,s){if(!Qh&&zu){Qh=!0;do for(var c=!1,d=Du;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var v=0;else{var w=d.suspendedLanes,E=d.pingedLanes;v=(1<<31-et(42|r)+1)-1,v&=m&~(w&~E),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,v1(d,v))}else v=ut,v=ve(d,d===Lt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,v1(d,v));d=d.next}while(c);Qh=!1}}function Ik(){m1()}function m1(){zu=Wh=!1;var r=0;ms!==0&&ej()&&(r=ms);for(var s=Ee(),c=null,d=Du;d!==null;){var m=d.next,v=g1(d,s);v===0?(d.next=null,c===null?Du=m:c.next=m,m===null&&(il=c)):(c=d,(r!==0||(v&3)!==0)&&(zu=!0)),d=m}bn!==0&&bn!==5||wo(r),ms!==0&&(ms=0)}function g1(r,s){for(var c=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var w=31-et(v),E=1<<w,U=m[w];U===-1?((E&c)===0||(E&d)!==0)&&(m[w]=Bt(E,s)):U<=s&&(r.expiredLanes|=E),v&=~E}if(s=Lt,c=ut,c=ve(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===s&&(jt===2||jt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ke(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Xe(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(d!==null&&ke(d),Ls(c)){case 2:case 8:c=ye;break;case 32:c=Q;break;case 268435456:c=Me;break;default:c=Q}return d=x1.bind(null,r),c=mn(c,d),r.callbackPriority=s,r.callbackNode=c,s}return d!==null&&d!==null&&ke(d),r.callbackPriority=2,r.callbackNode=null,2}function x1(r,s){if(bn!==0&&bn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Lu()&&r.callbackNode!==c)return null;var d=ut;return d=ve(r,r===Lt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Zv(r,d,s),g1(r,Ee()),r.callbackNode!=null&&r.callbackNode===c?x1.bind(null,r):null)}function v1(r,s){if(Lu())return null;Zv(r,s,!0)}function qk(){nj(function(){(_t&6)!==0?mn(le,Ik):m1()})}function Xh(){if(ms===0){var r=Ia;r===0&&(r=Pr,Pr<<=1,(Pr&261888)===0&&(Pr=256)),ms=r}return ms}function b1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Aa(""+r)}function y1(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function Vk(r,s,c,d,m){if(s==="submit"&&c&&c.stateNode===m){var v=b1((m[_n]||null).action),w=d.submitter;w&&(s=(s=w[_n]||null)?b1(s.formAction):w.getAttribute("formAction"),s!==null&&(v=s,w=null));var E=new pi("action","action",null,d,m);r.push({event:E,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ms!==0){var U=w?y1(m,w):new FormData(m);gh(c,{pending:!0,data:U,method:m.method,action:v},null,U)}}else typeof v=="function"&&(E.preventDefault(),U=w?y1(m,w):new FormData(m),gh(c,{pending:!0,data:U,method:m.method,action:v},v,U))},currentTarget:m}]})}}for(var Kh=0;Kh<Lf.length;Kh++){var Zh=Lf[Kh],Gk=Zh.toLowerCase(),Yk=Zh[0].toUpperCase()+Zh.slice(1);Hr(Gk,"on"+Yk)}Hr(Kx,"onAnimationEnd"),Hr(Zx,"onAnimationIteration"),Hr(Jx,"onAnimationStart"),Hr("dblclick","onDoubleClick"),Hr("focusin","onFocus"),Hr("focusout","onBlur"),Hr(ck,"onTransitionRun"),Hr(uk,"onTransitionStart"),Hr(dk,"onTransitionCancel"),Hr(e0,"onTransitionEnd"),Jr("onMouseEnter",["mouseout","mouseover"]),Jr("onMouseLeave",["mouseout","mouseover"]),Jr("onPointerEnter",["pointerout","pointerover"]),Jr("onPointerLeave",["pointerout","pointerover"]),Fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var So="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(" "),Wk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(So));function _1(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],m=d.event;d=d.listeners;e:{var v=void 0;if(s)for(var w=d.length-1;0<=w;w--){var E=d[w],U=E.instance,te=E.currentTarget;if(E=E.listener,U!==v&&m.isPropagationStopped())break e;v=E,m.currentTarget=te;try{v(m)}catch(oe){Xc(oe)}m.currentTarget=null,v=U}else for(w=0;w<d.length;w++){if(E=d[w],U=E.instance,te=E.currentTarget,E=E.listener,U!==v&&m.isPropagationStopped())break e;v=E,m.currentTarget=te;try{v(m)}catch(oe){Xc(oe)}m.currentTarget=null,v=U}}}}function lt(r,s){var c=s[Fl];c===void 0&&(c=s[Fl]=new Set);var d=r+"__bubble";c.has(d)||(w1(s,r,2,!1),c.add(d))}function Jh(r,s,c){var d=0;s&&(d|=4),w1(c,r,d,s)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function ep(r){if(!r[Ou]){r[Ou]=!0,Gn.forEach(function(c){c!=="selectionchange"&&(Wk.has(c)||Jh(c,!1,r),Jh(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Ou]||(s[Ou]=!0,Jh("selectionchange",!1,s))}}function w1(r,s,c,d){switch(K1(s)){case 2:var m=wj;break;case 8:m=Sj;break;default:m=mp}c=m.bind(null,s,c,r),m=void 0,!Ra||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,c,{capture:!0,passive:m}):r.addEventListener(s,c,!0):m!==void 0?r.addEventListener(s,c,{passive:m}):r.addEventListener(s,c,!1)}function tp(r,s,c,d,m){var v=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 E=d.stateNode.containerInfo;if(E===m)break;if(w===4)for(w=d.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;E!==null;){if(w=hi(E),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){d=v=w;continue e}E=E.parentNode}}d=d.return}Hc(function(){var te=v,oe=Ma(c),ue=[];e:{var re=t0.get(r);if(re!==void 0){var se=pi,Te=r;switch(r){case"keypress":if(st(c)===0)break e;case"keydown":case"keyup":se=US;break;case"focusin":Te="focus",se=ti;break;case"focusout":Te="blur",se=ti;break;case"beforeblur":case"afterblur":se=ti;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=kf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Vc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=qS;break;case Kx:case Zx:case Jx:se=Wc;break;case e0:se=GS;break;case"scroll":case"scrollend":se=Ic;break;case"wheel":se=WS;break;case"copy":case"cut":case"paste":se=DS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=Rx;break;case"toggle":case"beforetoggle":se=XS}var Ue=(s&4)!==0,At=!Ue&&(r==="scroll"||r==="scrollend"),K=Ue?re!==null?re+"Capture":null:re;Ue=[];for(var V=te,ee;V!==null;){var ce=V;if(ee=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ee===null||K===null||(ce=$s(V,K),ce!=null&&Ue.push(ko(V,ce,ee))),At)break;V=V.return}0<Ue.length&&(re=new se(re,Te,null,c,oe),ue.push({event:re,listeners:Ue}))}}if((s&7)===0){e:{if(re=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",re&&c!==Xi&&(Te=c.relatedTarget||c.fromElement)&&(hi(Te)||Te[ir]))break e;if((se||re)&&(re=oe.window===oe?oe:(re=oe.ownerDocument)?re.defaultView||re.parentWindow:window,se?(Te=c.relatedTarget||c.toElement,se=te,Te=Te?hi(Te):null,Te!==null&&(At=o(Te),Ue=Te.tag,Te!==At||Ue!==5&&Ue!==27&&Ue!==6)&&(Te=null)):(se=null,Te=te),se!==Te)){if(Ue=kf,ce="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=Rx,ce="onPointerLeave",K="onPointerEnter",V="pointer"),At=se==null?re:Os(se),ee=Te==null?re:Os(Te),re=new Ue(ce,V+"leave",se,c,oe),re.target=At,re.relatedTarget=ee,ce=null,hi(oe)===te&&(Ue=new Ue(K,V+"enter",Te,c,oe),Ue.target=ee,Ue.relatedTarget=At,ce=Ue),At=ce,se&&Te)t:{for(Ue=Qk,K=se,V=Te,ee=0,ce=K;ce;ce=Ue(ce))ee++;ce=0;for(var Pe=V;Pe;Pe=Ue(Pe))ce++;for(;0<ee-ce;)K=Ue(K),ee--;for(;0<ce-ee;)V=Ue(V),ce--;for(;ee--;){if(K===V||V!==null&&K===V.alternate){Ue=K;break t}K=Ue(K),V=Ue(V)}Ue=null}else Ue=null;se!==null&&S1(ue,re,se,Ue,!1),Te!==null&&At!==null&&S1(ue,At,Te,Ue,!0)}}e:{if(re=te?Os(te):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var vt=Fx;else if(Px(re))if(Ux)vt=ak;else{vt=ik;var De=rk}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Ta(te.elementType)&&(vt=Fx):vt=sk;if(vt&&(vt=vt(r,te))){$x(ue,vt,c,oe);break e}De&&De(r,re,te),r==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Ca(re,"number",re.value)}switch(De=te?Os(te):window,r){case"focusin":(Px(De)||De.contentEditable==="true")&&(za=De,Af=te,Zl=null);break;case"focusout":Zl=Af=za=null;break;case"mousedown":Mf=!0;break;case"contextmenu":case"mouseup":case"dragend":Mf=!1,Qx(ue,c,oe);break;case"selectionchange":if(ok)break;case"keydown":case"keyup":Qx(ue,c,oe)}var tt;if(Nf)e:{switch(r){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Da?Ox(r,c)&&(dt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(dt="onCompositionStart");dt&&(Lx&&c.locale!=="ko"&&(Da||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Da&&(tt=gt()):(H=oe,fe="value"in H?H.value:H.textContent,Da=!0)),De=Bu(te,dt),0<De.length&&(dt=new Mx(dt,r,null,c,oe),ue.push({event:dt,listeners:De}),tt?dt.data=tt:(tt=Bx(c),tt!==null&&(dt.data=tt)))),(tt=ZS?JS(r,c):ek(r,c))&&(dt=Bu(te,"onBeforeInput"),0<dt.length&&(De=new Mx("onBeforeInput","beforeinput",null,c,oe),ue.push({event:De,listeners:dt}),De.data=tt)),Vk(ue,r,te,c,oe)}_1(ue,s)})}function ko(r,s,c){return{instance:r,listener:s,currentTarget:c}}function Bu(r,s){for(var c=s+"Capture",d=[];r!==null;){var m=r,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=$s(r,c),m!=null&&d.unshift(ko(r,m,v)),m=$s(r,s),m!=null&&d.push(ko(r,m,v))),r.tag===3)return d;r=r.return}return[]}function Qk(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function S1(r,s,c,d,m){for(var v=s._reactName,w=[];c!==null&&c!==d;){var E=c,U=E.alternate,te=E.stateNode;if(E=E.tag,U!==null&&U===d)break;E!==5&&E!==26&&E!==27||te===null||(U=te,m?(te=$s(c,v),te!=null&&w.unshift(ko(c,te,U))):m||(te=$s(c,v),te!=null&&w.push(ko(c,te,U)))),c=c.return}w.length!==0&&r.push({event:s,listeners:w})}var Xk=/\r\n?/g,Kk=/\u0000|\uFFFD/g;function k1(r){return(typeof r=="string"?r:""+r).replace(Xk,`
|
|
49
|
-
`).replace(Kk,"")}function j1(r,s){return s=k1(s),k1(r)===s}function Tt(r,s,c,d,m,v){switch(c){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Qi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Qi(r,""+d);break;case"className":ja(r,"class",d);break;case"tabIndex":ja(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ja(r,c,d);break;case"style":$c(r,d,v);break;case"data":if(s!=="object"){ja(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Aa(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"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 v=="function"&&(c==="formAction"?(s!=="input"&&Tt(r,s,"name",m.name,m,null),Tt(r,s,"formEncType",m.formEncType,m,null),Tt(r,s,"formMethod",m.formMethod,m,null),Tt(r,s,"formTarget",m.formTarget,m,null)):(Tt(r,s,"encType",m.encType,m,null),Tt(r,s,"method",m.method,m,null),Tt(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Aa(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=yr);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}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}c=Aa(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);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(c,""+d):r.removeAttribute(c);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(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Bs(r,"popover",d);break;case"xlinkActuate":Ur(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ur(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ur(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ur(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ur(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ur(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Bs(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Fc.get(c)||c,Bs(r,c,d))}}function np(r,s,c,d,m,v){switch(c){case"style":$c(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof d=="string"?Qi(r,d):(typeof d=="number"||typeof d=="bigint")&&Qi(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ka.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),s=c.slice(2,m?c.length-7:void 0),v=r[_n]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(s,v,m),typeof d=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,d,m);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):Bs(r,c,d)}}}function jn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,m=!1,v;for(v in c)if(c.hasOwnProperty(v)){var w=c[v];if(w!=null)switch(v){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Tt(r,s,v,w,c,null)}}m&&Tt(r,s,"srcSet",c.srcSet,c,null),d&&Tt(r,s,"src",c.src,c,null);return;case"input":lt("invalid",r);var E=v=w=m=null,U=null,te=null;for(d in c)if(c.hasOwnProperty(d)){var oe=c[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":U=oe;break;case"defaultChecked":te=oe;break;case"value":v=oe;break;case"defaultValue":E=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,s));break;default:Tt(r,s,d,oe,c,null)}}Bc(r,v,E,U,te,w,m,!1);return;case"select":lt("invalid",r),d=w=v=null;for(m in c)if(c.hasOwnProperty(m)&&(E=c[m],E!=null))switch(m){case"value":v=E;break;case"defaultValue":w=E;break;case"multiple":d=E;default:Tt(r,s,m,E,c,null)}s=v,c=w,r.multiple=!!d,s!=null?Wi(r,!!d,s,!1):c!=null&&Wi(r,!!d,c,!0);return;case"textarea":lt("invalid",r),v=m=d=null;for(w in c)if(c.hasOwnProperty(w)&&(E=c[w],E!=null))switch(w){case"value":d=E;break;case"defaultValue":m=E;break;case"children":v=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Tt(r,s,w,E,c,null)}ql(r,d,m,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Tt(r,s,U,d,c,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<So.length;d++)lt(So[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("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(te in c)if(c.hasOwnProperty(te)&&(d=c[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Tt(r,s,te,d,c,null)}return;default:if(Ta(s)){for(oe in c)c.hasOwnProperty(oe)&&(d=c[oe],d!==void 0&&np(r,s,oe,d,c,void 0));return}}for(E in c)c.hasOwnProperty(E)&&(d=c[E],d!=null&&Tt(r,s,E,d,c,null))}function Zk(r,s,c,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,v=null,w=null,E=null,U=null,te=null,oe=null;for(se in c){var ue=c[se];if(c.hasOwnProperty(se)&&ue!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":U=ue;default:d.hasOwnProperty(se)||Tt(r,s,se,null,d,ue)}}for(var re in d){var se=d[re];if(ue=c[re],d.hasOwnProperty(re)&&(se!=null||ue!=null))switch(re){case"type":v=se;break;case"name":m=se;break;case"checked":te=se;break;case"defaultChecked":oe=se;break;case"value":w=se;break;case"defaultValue":E=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==ue&&Tt(r,s,re,se,d,ue)}}Ps(r,w,E,U,te,oe,v,m);return;case"select":se=w=E=re=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":se=U;default:d.hasOwnProperty(v)||Tt(r,s,v,null,d,U)}for(m in d)if(v=d[m],U=c[m],d.hasOwnProperty(m)&&(v!=null||U!=null))switch(m){case"value":re=v;break;case"defaultValue":E=v;break;case"multiple":w=v;default:v!==U&&Tt(r,s,m,v,d,U)}s=E,c=w,d=se,re!=null?Wi(r,!!c,re,!1):!!d!=!!c&&(s!=null?Wi(r,!!c,s,!0):Wi(r,!!c,c?[]:"",!1));return;case"textarea":se=re=null;for(E in c)if(m=c[E],c.hasOwnProperty(E)&&m!=null&&!d.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Tt(r,s,E,null,d,m)}for(w in d)if(m=d[w],v=c[w],d.hasOwnProperty(w)&&(m!=null||v!=null))switch(w){case"value":re=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&Tt(r,s,w,m,d,v)}Ea(r,re,se);return;case"option":for(var Te in c)if(re=c[Te],c.hasOwnProperty(Te)&&re!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Tt(r,s,Te,null,d,re)}for(U in d)if(re=d[U],se=c[U],d.hasOwnProperty(U)&&re!==se&&(re!=null||se!=null))switch(U){case"selected":r.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:Tt(r,s,U,re,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 c)re=c[Ue],c.hasOwnProperty(Ue)&&re!=null&&!d.hasOwnProperty(Ue)&&Tt(r,s,Ue,null,d,re);for(te in d)if(re=d[te],se=c[te],d.hasOwnProperty(te)&&re!==se&&(re!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,s));break;default:Tt(r,s,te,re,d,se)}return;default:if(Ta(s)){for(var At in c)re=c[At],c.hasOwnProperty(At)&&re!==void 0&&!d.hasOwnProperty(At)&&np(r,s,At,void 0,d,re);for(oe in d)re=d[oe],se=c[oe],!d.hasOwnProperty(oe)||re===se||re===void 0&&se===void 0||np(r,s,oe,re,d,se);return}}for(var K in c)re=c[K],c.hasOwnProperty(K)&&re!=null&&!d.hasOwnProperty(K)&&Tt(r,s,K,null,d,re);for(ue in d)re=d[ue],se=c[ue],!d.hasOwnProperty(ue)||re===se||re==null&&se==null||Tt(r,s,ue,re,d,se)}function N1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],v=m.transferSize,w=m.initiatorType,E=m.duration;if(v&&E&&N1(w)){for(w=0,E=m.responseEnd,d+=1;d<c.length;d++){var U=c[d],te=U.startTime;if(te>E)break;var oe=U.transferSize,ue=U.initiatorType;oe&&N1(ue)&&(U=U.responseEnd,w+=oe*(U<E?1:(E-te)/(U-te)))}if(--d,s+=8*(v+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 rp=null,ip=null;function Pu(r){return r.nodeType===9?r:r.ownerDocument}function C1(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 E1(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 sp(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 ap=null;function ej(){var r=window.event;return r&&r.type==="popstate"?r===ap?!1:(ap=r,!0):(ap=null,!1)}var T1=typeof setTimeout=="function"?setTimeout:void 0,tj=typeof clearTimeout=="function"?clearTimeout:void 0,A1=typeof Promise=="function"?Promise:void 0,nj=typeof queueMicrotask=="function"?queueMicrotask:typeof A1<"u"?function(r){return A1.resolve(null).then(r).catch(rj)}:T1;function rj(r){setTimeout(function(){throw r})}function gs(r){return r==="head"}function M1(r,s){var c=s,d=0;do{var m=c.nextSibling;if(r.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(m),ol(s);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")jo(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,jo(c);for(var v=c.firstChild;v;){var w=v.nextSibling,E=v.nodeName;v[Kr]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=w}}else c==="body"&&jo(r.ownerDocument.body);c=m}while(c);ol(s)}function R1(r,s){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function lp(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":lp(c),Gi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function ij(r,s,c,d){for(;r.nodeType===1;){var m=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Kr])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==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(v=r.getAttribute("src"),(v!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Tr(r.nextSibling),r===null)break}return null}function sj(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Tr(r.nextSibling),r===null))return null;return r}function L1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Tr(r.nextSibling),r===null))return null;return r}function op(r){return r.data==="$?"||r.data==="$~"}function cp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function aj(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var d=function(){s(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Tr(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 up=null;function D1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return Tr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function z1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function O1(r,s,c){switch(s=Pu(c),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 jo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Gi(r)}var Ar=new Map,B1=new Set;function $u(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ti=F.d;F.d={f:lj,r:oj,D:cj,C:uj,L:dj,m:fj,X:pj,S:hj,M:mj};function lj(){var r=Ti.f(),s=Au();return r||s}function oj(r){var s=Vn(r);s!==null&&s.tag===5&&s.type==="form"?ev(s):Ti.r(r)}var sl=typeof document>"u"?null:document;function P1(r,s,c){var d=sl;if(d&&typeof s=="string"&&s){var m=nn(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),B1.has(m)||(B1.add(m),r={rel:r,crossOrigin:c,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),jn(s,"link",r),Kt(s),d.head.appendChild(s)))}}function cj(r){Ti.D(r),P1("dns-prefetch",r,null)}function uj(r,s){Ti.C(r,s),P1("preconnect",r,s)}function dj(r,s,c){Ti.L(r,s,c);var d=sl;if(d&&r&&s){var m='link[rel="preload"][as="'+nn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+nn(c.imageSizes)+'"]')):m+='[href="'+nn(r)+'"]';var v=m;switch(s){case"style":v=al(r);break;case"script":v=ll(r)}Ar.has(v)||(r=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Ar.set(v,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(No(v))||s==="script"&&d.querySelector(Co(v))||(s=d.createElement("link"),jn(s,"link",r),Kt(s),d.head.appendChild(s)))}}function fj(r,s){Ti.m(r,s);var c=sl;if(c&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+nn(d)+'"][href="'+nn(r)+'"]',v=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ll(r)}if(!Ar.has(v)&&(r=x({rel:"modulepreload",href:r},s),Ar.set(v,r),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Co(v)))return}d=c.createElement("link"),jn(d,"link",r),Kt(d),c.head.appendChild(d)}}}function hj(r,s,c){Ti.S(r,s,c);var d=sl;if(d&&r){var m=Zr(d).hoistableStyles,v=al(r);s=s||"default";var w=m.get(v);if(!w){var E={loading:0,preload:null};if(w=d.querySelector(No(v)))E.loading=5;else{r=x({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Ar.get(v))&&dp(r,c);var U=w=d.createElement("link");Kt(U),jn(U,"link",r),U._p=new Promise(function(te,oe){U.onload=te,U.onerror=oe}),U.addEventListener("load",function(){E.loading|=1}),U.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Fu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:E},m.set(v,w)}}}function pj(r,s){Ti.X(r,s);var c=sl;if(c&&r){var d=Zr(c).hoistableScripts,m=ll(r),v=d.get(m);v||(v=c.querySelector(Co(m)),v||(r=x({src:r,async:!0},s),(s=Ar.get(m))&&fp(r,s),v=c.createElement("script"),Kt(v),jn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function mj(r,s){Ti.M(r,s);var c=sl;if(c&&r){var d=Zr(c).hoistableScripts,m=ll(r),v=d.get(m);v||(v=c.querySelector(Co(m)),v||(r=x({src:r,async:!0,type:"module"},s),(s=Ar.get(m))&&fp(r,s),v=c.createElement("script"),Kt(v),jn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function $1(r,s,c,d){var m=(m=je.current)?$u(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=al(c.href),c=Zr(m).hoistableStyles,d=c.get(s),d||(d={type:"style",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=al(c.href);var v=Zr(m).hoistableStyles,w=v.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,w),(v=m.querySelector(No(r)))&&!v._p&&(w.instance=v,w.state.loading=5),Ar.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ar.set(r,c),v||gj(m,r,c,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=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ll(c),c=Zr(m).hoistableScripts,d=c.get(s),d||(d={type:"script",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function al(r){return'href="'+nn(r)+'"'}function No(r){return'link[rel="stylesheet"]['+r+"]"}function F1(r){return x({},r,{"data-precedence":r.precedence,precedence:null})}function gj(r,s,c,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}),jn(s,"link",c),Kt(s),r.head.appendChild(s))}function ll(r){return'[src="'+nn(r)+'"]'}function Co(r){return"script[async]"+r}function U1(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+nn(c.href)+'"]');if(d)return s.instance=d,Kt(d),d;var m=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Kt(d),jn(d,"style",m),Fu(d,c.precedence,r),s.instance=d;case"stylesheet":m=al(c.href);var v=r.querySelector(No(m));if(v)return s.state.loading|=4,s.instance=v,Kt(v),v;d=F1(c),(m=Ar.get(m))&&dp(d,m),v=(r.ownerDocument||r).createElement("link"),Kt(v);var w=v;return w._p=new Promise(function(E,U){w.onload=E,w.onerror=U}),jn(v,"link",d),s.state.loading|=4,Fu(v,c.precedence,r),s.instance=v;case"script":return v=ll(c.src),(m=r.querySelector(Co(v)))?(s.instance=m,Kt(m),m):(d=c,(m=Ar.get(v))&&(d=x({},c),fp(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Kt(m),jn(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,Fu(d,c.precedence,r));return s.instance}function Fu(r,s,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,v=m,w=0;w<d.length;w++){var E=d[w];if(E.dataset.precedence===s)v=E;else if(v!==m)break}v?v.parentNode.insertBefore(r,v.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function dp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function fp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Uu=null;function H1(r,s,c){if(Uu===null){var d=new Map,m=Uu=new Map;m.set(c,d)}else m=Uu,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),m=0;m<c.length;m++){var v=c[m];if(!(v[Kr]||v[Gt]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(s)||"";w=r+w;var E=d.get(w);E?E.push(v):d.set(w,[v])}}return d}function I1(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function xj(r,s,c){if(c===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 q1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function vj(r,s,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=al(d.href),v=s.querySelector(No(m));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Hu.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=v,Kt(v);return}v=s.ownerDocument||s,d=F1(d),(m=Ar.get(m))&&dp(d,m),v=v.createElement("link"),Kt(v);var w=v;w._p=new Promise(function(E,U){w.onload=E,w.onerror=U}),jn(v,"link",d),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Hu.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var hp=0;function bj(r,s){return r.stylesheets&&r.count===0&&qu(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&qu(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+s);0<r.imgBytes&&hp===0&&(hp=62500*Jk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&qu(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>hp?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Iu=null;function qu(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Iu=new Map,s.forEach(yj,r),Iu=null,Hu.call(r))}function yj(r,s){if(!(s.state.loading&4)){var c=Iu.get(r);if(c)var d=c.get(null);else{c=new Map,Iu.set(r,c);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var w=m[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),v=c.get(w)||d,v===d&&c.set(null,m),c.set(w,m),this.count++,d=Hu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),v?v.parentNode.insertBefore(m,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var Eo={$$typeof:C,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function _j(r,s,c,d,m,v,w,E,U){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=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function V1(r,s,c,d,m,v,w,E,U,te,oe,ue){return r=new _j(r,s,c,w,U,te,oe,ue,E),s=1,v===!0&&(s|=24),v=ar(3,null,null,s),r.current=v,v.stateNode=r,s=Gf(),s.refCount++,r.pooledCache=s,s.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:s},Xf(v),r}function G1(r){return r?(r=Pa,r):Pa}function Y1(r,s,c,d,m,v){m=G1(m),d.context===null?d.context=m:d.pendingContext=m,d=ss(s),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=as(r,d,s),c!==null&&(Zn(c,r,s),so(c,r,s))}function W1(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function pp(r,s){W1(r,s),(r=r.alternate)&&W1(r,s)}function Q1(r){if(r.tag===13||r.tag===31){var s=qs(r,67108864);s!==null&&Zn(s,r,67108864),pp(r,67108864)}}function X1(r){if(r.tag===13||r.tag===31){var s=dr();s=On(s);var c=qs(r,s);c!==null&&Zn(c,r,s),pp(r,s)}}var Vu=!0;function wj(r,s,c,d){var m=B.T;B.T=null;var v=F.p;try{F.p=2,mp(r,s,c,d)}finally{F.p=v,B.T=m}}function Sj(r,s,c,d){var m=B.T;B.T=null;var v=F.p;try{F.p=8,mp(r,s,c,d)}finally{F.p=v,B.T=m}}function mp(r,s,c,d){if(Vu){var m=gp(d);if(m===null)tp(r,s,d,Gu,c),Z1(r,d);else if(jj(m,r,s,c,d))d.stopPropagation();else if(Z1(r,d),s&4&&-1<kj.indexOf(r)){for(;m!==null;){var v=Vn(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=pe(v.pendingLanes);if(w!==0){var E=v;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var U=1<<31-et(w);E.entanglements[1]|=U,w&=~U}si(v),(_t&6)===0&&(Eu=Ee()+500,wo(0))}}break;case 31:case 13:E=qs(v,2),E!==null&&Zn(E,v,2),Au(),pp(v,2)}if(v=gp(d),v===null&&tp(r,s,d,Gu,c),v===m)break;m=v}m!==null&&d.stopPropagation()}else tp(r,s,d,null,c)}}function gp(r){return r=Ma(r),xp(r)}var Gu=null;function xp(r){if(Gu=null,r=hi(r),r!==null){var s=o(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=f(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Gu=r,null}function K1(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(Br()){case le:return 2;case ye:return 8;case Q:case he:return 32;case Me:return 268435456;default:return 32}default:return 32}}var vp=!1,xs=null,vs=null,bs=null,To=new Map,Ao=new Map,ys=[],kj="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 Z1(r,s){switch(r){case"focusin":case"focusout":xs=null;break;case"dragenter":case"dragleave":vs=null;break;case"mouseover":case"mouseout":bs=null;break;case"pointerover":case"pointerout":To.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ao.delete(s.pointerId)}}function Mo(r,s,c,d,m,v){return r===null||r.nativeEvent!==v?(r={blockedOn:s,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[m]},s!==null&&(s=Vn(s),s!==null&&Q1(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function jj(r,s,c,d,m){switch(s){case"focusin":return xs=Mo(xs,r,s,c,d,m),!0;case"dragenter":return vs=Mo(vs,r,s,c,d,m),!0;case"mouseover":return bs=Mo(bs,r,s,c,d,m),!0;case"pointerover":var v=m.pointerId;return To.set(v,Mo(To.get(v)||null,r,s,c,d,m)),!0;case"gotpointercapture":return v=m.pointerId,Ao.set(v,Mo(Ao.get(v)||null,r,s,c,d,m)),!0}return!1}function J1(r){var s=hi(r.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,$l(r.priority,function(){X1(c)});return}}else if(s===31){if(s=f(c),s!==null){r.blockedOn=s,$l(r.priority,function(){X1(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Yu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=gp(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);Xi=d,c.target.dispatchEvent(d),Xi=null}else return s=Vn(c),s!==null&&Q1(s),r.blockedOn=c,!1;s.shift()}return!0}function eb(r,s,c){Yu(r)&&c.delete(s)}function Nj(){vp=!1,xs!==null&&Yu(xs)&&(xs=null),vs!==null&&Yu(vs)&&(vs=null),bs!==null&&Yu(bs)&&(bs=null),To.forEach(eb),Ao.forEach(eb)}function Wu(r,s){r.blockedOn===s&&(r.blockedOn=null,vp||(vp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Nj)))}var Qu=null;function tb(r){Qu!==r&&(Qu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Qu===r&&(Qu=null);for(var s=0;s<r.length;s+=3){var c=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(xp(d||c)===null)continue;break}var v=Vn(c);v!==null&&(r.splice(s,3),s-=3,gh(v,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function ol(r){function s(U){return Wu(U,r)}xs!==null&&Wu(xs,r),vs!==null&&Wu(vs,r),bs!==null&&Wu(bs,r),To.forEach(s),Ao.forEach(s);for(var c=0;c<ys.length;c++){var d=ys[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<ys.length&&(c=ys[0],c.blockedOn===null);)J1(c),c.blockedOn===null&&ys.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],v=c[d+1],w=m[_n]||null;if(typeof v=="function")w||tb(c);else if(w){var E=null;if(v&&v.hasAttribute("formAction")){if(m=v,w=v[_n]||null)E=w.formAction;else if(xp(m)!==null)continue}else E=w.action;typeof E=="function"?c[d+1]=E:(c.splice(d,3),d-=3),tb(c)}}}function nb(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.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(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function bp(r){this._internalRoot=r}Xu.prototype.render=bp.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var c=s.current,d=dr();Y1(c,d,r,s,null,null)},Xu.prototype.unmount=bp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Y1(r.current,2,null,r,null,null),Au(),s[ir]=null}};function Xu(r){this._internalRoot=r}Xu.prototype.unstable_scheduleHydration=function(r){if(r){var s=Pl();r={blockedOn:null,target:r,priority:s};for(var c=0;c<ys.length&&s!==0&&s<ys[c].priority;c++);ys.splice(c,0,r),c===0&&J1(r)}};var rb=t.version;if(rb!=="19.2.8")throw Error(i(527,rb,"19.2.8"));F.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 Cj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ku.isDisabled&&Ku.supportsFiber)try{rt=Ku.inject(Cj),wt=Ku}catch{}}return Lo.createRoot=function(r,s){if(!a(r))throw Error(i(299));var c=!1,d="",m=uv,v=dv,w=fv;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=V1(r,1,!1,null,null,c,d,null,m,v,w,nb),r[ir]=s.current,ep(r),new bp(s)},Lo.hydrateRoot=function(r,s,c){if(!a(r))throw Error(i(299));var d=!1,m="",v=uv,w=dv,E=fv,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(E=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=V1(r,1,!0,s,c??null,d,m,U,v,w,E,nb),s.context=G1(null),c=s.current,d=dr(),d=On(d),m=ss(d),m.callback=null,as(c,m,d),c=d,s.current.lanes=c,Pt(s,c),si(s),r[ir]=s.current,ep(r),new Xu(s)},Lo.version="19.2.8",Lo}var mb;function Fj(){if(mb)return wp.exports;mb=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(),wp.exports=$j(),wp.exports}var Uj=Fj();const gb=e=>{let t;const n=new Set,i=(p,g)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=g??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,f={setState:i,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,a,f);return f},Hj=(e=>e?gb(e):gb),Ij=e=>e;function qj(e,t=Ij){const n=Zu.useSyncExternalStore(e.subscribe,Zu.useCallback(()=>t(e.getState()),[e,t]),Zu.useCallback(()=>t(e.getInitialState()),[e,t]));return Zu.useDebugValue(n),n}const xb=e=>{const t=Hj(e),n=i=>qj(t,i);return Object.assign(n,t),n},Vj=(e=>e?xb(e):xb),Cm="companion_auth_token";function vb(){return typeof window>"u"?null:localStorage.getItem(Cm)||null}const Gj=e=>({authToken:vb(),isAuthenticated:vb()!==null,setAuthToken:t=>{localStorage.setItem(Cm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Cm),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 Yj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function Wj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function Qj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function Xj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const Kj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:Qj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:Wj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:Xj(),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 a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),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:Yj(n.recentlyRenamed,t),mcpServers:Ht(n.mcpServers,t),rateLimit:Ht(n.rateLimit,t),prStatus:Ht(n.prStatus,t),linkedLinearIssues:Ht(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.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 a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),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 a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),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 a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}})}),Zj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),Jj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),eN=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 a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:o}}),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 a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=o[u];o[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:o}})}),qi=[{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"]}],tN=qi.map(e=>e.id),i5="cc-task-panel-config";function Em(){return{order:[...tN],enabled:Object.fromEntries(qi.map(e=>[e.id,!0]))}}function nN(){if(typeof window>"u")return Em();try{const e=localStorage.getItem(i5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of qi)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(qi.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return Em()}function Ju(e){try{localStorage.setItem(i5,JSON.stringify(e))}catch{}}function rN(){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 iN(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function sN(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function s5(){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 aN=e=>({darkMode:rN(),notificationSound:iN(),notificationDesktop:sN(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:nN(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:s5(),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 Ju(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return Ju(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return Ju(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=Em();Ju(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),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function a5(){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 lN=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:a5(),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",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,f=i?o+1:o,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,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 o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,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 oN(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const cN=e=>({updateInfo:null,updateDismissedVersion:oN(),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||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}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})}),X=Vj((...e)=>({...Gj(...e),...Kj(...e),...Zj(...e),...Jj(...e),...eN(...e),...aN(...e),...lN(...e),...cN(...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:s5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:a5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),uN=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),dN="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",fN=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function hN(e){return fN.test(e)}function pN(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:hN(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const bb=["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"],yb=["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 _b(){const e=bb[Math.floor(Math.random()*bb.length)],t=yb[Math.floor(Math.random()*yb.length)];return`${e} ${t}`}function l5(e){for(let t=0;t<100;t++){const n=_b();if(!e.has(n))return n}return _b()}let Np=null;function mN(){return Np||(Np=new AudioContext),Np}function gN(){try{const e=mN();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 a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class o5{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(o,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=A=>{if(A=this.postProcess(A,i),a){setTimeout(function(){a(A)},0);return}else return A},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const x=(o=i.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const k=()=>{for(let A=Math.max(j,-p);A<=Math.min(N,p);A+=2){let C;const L=y[A-1],D=y[A+1];L&&(y[A-1]=void 0);let z=!1;if(D){const $=D.oldPos-A;z=D&&0<=$&&$<f}const q=L&&L.oldPos+1<h;if(!z&&!q){y[A]=void 0;continue}if(!q||z&&L.oldPos<D.oldPos?C=this.addToPath(D,!0,!1,0,i):C=this.addToPath(L,!1,!0,1,i),_=this.extractCommon(C,n,t,A,i),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;y[A]=C,C.oldPos+1>=h&&(N=Math.min(N,A-1)),_+1>=f&&(j=Math.max(j,A+1))}p++};if(a)(function A(){setTimeout(function(){if(p>g||Date.now()>b)return a(void 0);k()||A()},0)})();else for(;p<=g&&Date.now()<=b;){const A=k();if(A)return A}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,f=i.length;let h=t.oldPos,p=h-a,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],o);)p++,h++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.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 a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const g=a[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let x=n.slice(h,h+g.count);x=x.map(function(b,y){const _=i[p+y];return _.length>b.length?_:b}),g.value=this.join(x)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return a}}function wb(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 Sb(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 Tm(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 Am(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 Do(e,t){return Tm(e,t,"")}function ed(e,t){return Am(e,t,"")}function kb(e,t){return t.slice(0,xN(e,t))}function xN(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 a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function c5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Mm(e,t){if(t)return ic(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function gl(e,t){if(t)return ic(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function ic(e,t){if(!t)return[gl(e),Mm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=c5(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const jb="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}",vN=new RegExp(`[${jb}]+|\\s+|[^${jb}]`,"ug");class bN extends o5{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=c5(t,u)}else i=t.match(vN)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}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,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&Nb(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&Nb(i,o,a,null,n.intlSegmenter),t}}const yN=new bN;function _N(e,t,n){return yN.diff(e,t,n)}function Nb(e,t,n,i,a){if(t&&n){const[o,u]=ic(t.value,a),[f,h]=ic(n.value,a);if(e){const p=wb(o,f);e.value=Am(e.value,f,p),t.value=Do(t.value,p),n.value=Do(n.value,p)}if(i){const p=Sb(u,h);i.value=Tm(i.value,h,p),t.value=ed(t.value,p),n.value=ed(n.value,p)}}else if(n){if(e){const o=gl(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=gl(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=gl(i.value,a),[u,f]=ic(t.value,a),h=wb(o,u);t.value=Do(t.value,h);const p=Sb(Do(o,h),f);t.value=ed(t.value,p),i.value=Tm(i.value,o,p),e.value=Am(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=gl(i.value,a),u=Mm(t.value,a),f=kb(u,o);t.value=ed(t.value,f)}else if(e){const o=Mm(e.value,a),u=gl(t.value,a),f=kb(o,u);t.value=Do(t.value,f)}}class wN extends o5{constructor(){super(...arguments),this.tokenize=kN}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
|
|
48
|
+
`+d.stack}}var ct=Object.prototype.hasOwnProperty,mn=e.unstable_scheduleCallback,ke=e.unstable_cancelCallback,ze=e.unstable_shouldYield,mt=e.unstable_requestPaint,Ee=e.unstable_now,Br=e.unstable_getCurrentPriorityLevel,le=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Q=e.unstable_NormalPriority,he=e.unstable_LowPriority,Me=e.unstable_IdlePriority,Qe=e.log,nt=e.unstable_setDisableYieldValue,rt=null,wt=null;function gn(r){if(typeof Qe=="function"&&nt(r),wt&&typeof wt.setStrictMode=="function")try{wt.setStrictMode(rt,r)}catch{}}var et=Math.clz32?Math.clz32:Xr,rr=Math.log,En=Math.LN2;function Xr(r){return r>>>=0,r===0?32:31-(rr(r)/En|0)|0}var Pr=256,$r=262144,ne=4194304;function me(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 ve(r,s,c){var d=r.pendingLanes;if(d===0)return 0;var m=0,v=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var E=d&134217727;return E!==0?(d=E&~v,d!==0?m=me(d):(w&=E,w!==0?m=me(w):c||(c=E&~r,c!==0&&(m=me(c))))):(E=d&~v,E!==0?m=me(E):w!==0?m=me(w):c||(c=d&~r,c!==0&&(m=me(c)))),m===0?0:s!==0&&s!==m&&(s&v)===0&&(v=m&-m,c=s&-s,v>=c||v===32&&(c&4194048)!==0)?s:m}function Xe(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function Bt(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 ln(){var r=ne;return ne<<=1,(ne&62914560)===0&&(ne=4194304),r}function Tn(r){for(var s=[],c=0;31>c;c++)s.push(r);return s}function Pt(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function zn(r,s,c,d,m,v){var w=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var E=r.entanglements,U=r.expirationTimes,te=r.hiddenUpdates;for(c=w&~c;0<c;){var oe=31-et(c),ue=1<<oe;E[oe]=0,U[oe]=-1;var re=te[oe];if(re!==null)for(te[oe]=null,oe=0;oe<re.length;oe++){var se=re[oe];se!==null&&(se.lane&=-536870913)}c&=~ue}d!==0&&xr(r,d,0),v!==0&&m===0&&r.tag!==0&&(r.suspendedLanes|=v&~(w&~s))}function xr(r,s,c){r.pendingLanes|=s,r.suspendedLanes&=~s;var d=31-et(s);r.entangledLanes|=s,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function Sa(r,s){var c=r.entangledLanes|=s;for(r=r.entanglements;c;){var d=31-et(c),m=1<<d;m&s|r[d]&s&&(r[d]|=s),c&=~m}}function Bl(r,s){var c=s&-s;return c=(c&42)!==0?1:On(c),(c&(r.suspendedLanes|s))!==0?0:c}function On(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 Ls(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Pl(){var r=F.p;return r!==0?r:(r=window.event,r===void 0?32:K1(r.type))}function $l(r,s){var c=F.p;try{return F.p=r,s()}finally{F.p=c}}var vr=Math.random().toString(36).slice(2),Gt="__reactFiber$"+vr,_n="__reactProps$"+vr,ir="__reactContainer$"+vr,Fl="__reactEvents$"+vr,yf="__reactListeners$"+vr,Ds="__reactHandles$"+vr,zs="__reactResources$"+vr,Kr="__reactMarker$"+vr;function Gi(r){delete r[Gt],delete r[_n],delete r[Fl],delete r[yf],delete r[Ds]}function hi(r){var s=r[Gt];if(s)return s;for(var c=r.parentNode;c;){if(s=c[ir]||c[Gt]){if(c=s.alternate,s.child!==null||c!==null&&c.child!==null)for(r=z1(r);r!==null;){if(c=r[Gt])return c;r=z1(r)}return s}r=c,c=r.parentNode}return null}function Vn(r){if(r=r[Gt]||r[ir]){var s=r.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return r}return null}function Os(r){var s=r.tag;if(s===5||s===26||s===27||s===6)return r.stateNode;throw Error(i(33))}function Zr(r){var s=r[zs];return s||(s=r[zs]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Kt(r){r[Kr]=!0}var Gn=new Set,ka={};function Fr(r,s){Jr(r,s),Jr(r+"Capture",s)}function Jr(r,s){for(ka[r]=s,r=0;r<s.length;r++)Gn.add(s[r])}var Ul=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]*$"),Hl={},Zt={};function _f(r){return ct.call(Zt,r)?!0:ct.call(Hl,r)?!1:Ul.test(r)?Zt[r]=!0:(Hl[r]=!0,!1)}function Bs(r,s,c){if(_f(s))if(c===null)r.removeAttribute(s);else{switch(typeof c){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,""+c)}}function ja(r,s,c){if(c===null)r.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(s);return}r.setAttribute(s,""+c)}}function Ur(r,s,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(s,c,""+d)}}function Yn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Oc(r){var s=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function Il(r,s,c){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,v=d.set;return Object.defineProperty(r,s,{configurable:!0,get:function(){return m.call(this)},set:function(w){c=""+w,v.call(this,w)}}),Object.defineProperty(r,s,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(w){c=""+w},stopTracking:function(){r._valueTracker=null,delete r[s]}}}}function Na(r){if(!r._valueTracker){var s=Oc(r)?"checked":"value";r._valueTracker=Il(r,s,""+r[s])}}function ei(r){if(!r)return!1;var s=r._valueTracker;if(!s)return!0;var c=s.getValue(),d="";return r&&(d=Oc(r)?r.checked?"true":"false":r.value),r=d,r!==c?(s.setValue(r),!0):!1}function Yi(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 br=/[\n"\\]/g;function nn(r){return r.replace(br,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Ps(r,s,c,d,m,v,w,E){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=""+Yn(s)):r.value!==""+Yn(s)&&(r.value=""+Yn(s)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),s!=null?Ca(r,w,Yn(s)):c!=null?Ca(r,w,Yn(c)):d!=null&&r.removeAttribute("value"),m==null&&v!=null&&(r.defaultChecked=!!v),m!=null&&(r.checked=m&&typeof m!="function"&&typeof m!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.name=""+Yn(E):r.removeAttribute("name")}function Bc(r,s,c,d,m,v,w,E){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),s!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||s!=null)){Na(r);return}c=c!=null?""+Yn(c):"",s=s!=null?""+Yn(s):c,E||s===r.value||(r.value=s),r.defaultValue=s}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=E?r.checked:!!d,r.defaultChecked=!!d,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),Na(r)}function Ca(r,s,c){s==="number"&&Yi(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function Wi(r,s,c,d){if(r=r.options,s){s={};for(var m=0;m<c.length;m++)s["$"+c[m]]=!0;for(c=0;c<r.length;c++)m=s.hasOwnProperty("$"+r[c].value),r[c].selected!==m&&(r[c].selected=m),m&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Yn(c),s=null,m=0;m<r.length;m++){if(r[m].value===c){r[m].selected=!0,d&&(r[m].defaultSelected=!0);return}s!==null||r[m].disabled||(s=r[m])}s!==null&&(s.selected=!0)}}function Ea(r,s,c){if(s!=null&&(s=""+Yn(s),s!==r.value&&(r.value=s),c==null)){r.defaultValue!==s&&(r.defaultValue=s);return}r.defaultValue=c!=null?""+Yn(c):""}function ql(r,s,c,d){if(s==null){if(d!=null){if(c!=null)throw Error(i(92));if(W(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),s=c}c=Yn(s),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Na(r)}function Qi(r,s){if(s){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=s;return}}r.textContent=s}var wf=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 Pc(r,s,c){var d=s.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(s,""):s==="float"?r.cssFloat="":r[s]="":d?r.setProperty(s,c):typeof c!="number"||c===0||wf.has(s)?s==="float"?r.cssFloat=c:r[s]=(""+c).trim():r[s]=c+"px"}function $c(r,s,c){if(s!=null&&typeof s!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.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)&&c[m]!==d&&Pc(r,m,d)}else for(var v in s)s.hasOwnProperty(v)&&Pc(r,v,s[v])}function Ta(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 Fc=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"]]),Sf=/^[\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 Aa(r){return Sf.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function yr(){}var Xi=null;function Ma(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ki=null,Zi=null;function Uc(r){var s=Vn(r);if(s&&(r=s.stateNode)){var c=r[_n]||null;e:switch(r=s.stateNode,s.type){case"input":if(Ps(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),s=c.name,c.type==="radio"&&s!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+nn(""+s)+'"][type="radio"]'),s=0;s<c.length;s++){var d=c[s];if(d!==r&&d.form===r.form){var m=d[_n]||null;if(!m)throw Error(i(90));Ps(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(s=0;s<c.length;s++)d=c[s],d.form===r.form&&ei(d)}break e;case"textarea":Ea(r,c.value,c.defaultValue);break e;case"select":s=c.value,s!=null&&Wi(r,!!c.multiple,s,!1)}}}var Vl=!1;function Hc(r,s,c){if(Vl)return r(s,c);Vl=!0;try{var d=r(s);return d}finally{if(Vl=!1,(Ki!==null||Zi!==null)&&(Au(),Ki&&(s=Ki,r=Zi,Zi=Ki=null,Uc(s),r)))for(s=0;s<r.length;s++)Uc(r[s])}}function $s(r,s){var c=r.stateNode;if(c===null)return null;var d=c[_n]||null;if(d===null)return null;c=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(c&&typeof c!="function")throw Error(i(231,s,typeof c));return c}var _r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ra=!1;if(_r)try{var Ji={};Object.defineProperty(Ji,"passive",{get:function(){Ra=!0}}),window.addEventListener("test",Ji,Ji),window.removeEventListener("test",Ji,Ji)}catch{Ra=!1}var H=null,fe=null,Ke=null;function gt(){if(Ke)return Ke;var r,s=fe,c=s.length,d,m="value"in H?H.value:H.textContent,v=m.length;for(r=0;r<c&&s[r]===m[r];r++);var w=c-r;for(d=1;d<=w&&s[c-d]===m[v-d];d++);return Ke=m.slice(r,1<d?1-d:void 0)}function st(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 Ie(){return!0}function Bn(){return!1}function xn(r){function s(c,d,m,v,w){this._reactName=c,this._targetInst=m,this.type=d,this.nativeEvent=v,this.target=w,this.currentTarget=null;for(var E in r)r.hasOwnProperty(E)&&(c=r[E],this[E]=c?c(v):v[E]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Ie:Bn,this.isPropagationStopped=Bn,this}return x(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Ie)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Ie)},persist:function(){},isPersistent:Ie}),s}var wr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},pi=xn(wr),vn=x({},wr,{view:0,detail:0}),Ic=xn(vn),Gl,Yl,Fs,Us=x({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jf,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!==Fs&&(Fs&&r.type==="mousemove"?(Gl=r.screenX-Fs.screenX,Yl=r.screenY-Fs.screenY):Yl=Gl=0,Fs=r),Gl)},movementY:function(r){return"movementY"in r?r.movementY:Yl}}),kf=xn(Us),qc=x({},Us,{dataTransfer:0}),Vc=xn(qc),Gc=x({},vn,{relatedTarget:0}),ti=xn(Gc),Yc=x({},wr,{animationName:0,elapsedTime:0,pseudoElement:0}),Wc=xn(Yc),La=x({},wr,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),DS=xn(La),zS=x({},wr,{data:0}),Mx=xn(zS),OS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},BS={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"},PS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $S(r){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(r):(r=PS[r])?!!s[r]:!1}function jf(){return $S}var FS=x({},vn,{key:function(r){if(r.key){var s=OS[r.key]||r.key;if(s!=="Unidentified")return s}return r.type==="keypress"?(r=st(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?BS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jf,charCode:function(r){return r.type==="keypress"?st(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?st(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),US=xn(FS),HS=x({},Us,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rx=xn(HS),IS=x({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jf}),qS=xn(IS),VS=x({},wr,{propertyName:0,elapsedTime:0,pseudoElement:0}),GS=xn(VS),YS=x({},Us,{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}),WS=xn(YS),QS=x({},wr,{newState:0,oldState:0}),XS=xn(QS),KS=[9,13,27,32],Nf=_r&&"CompositionEvent"in window,Wl=null;_r&&"documentMode"in document&&(Wl=document.documentMode);var ZS=_r&&"TextEvent"in window&&!Wl,Lx=_r&&(!Nf||Wl&&8<Wl&&11>=Wl),Dx=" ",zx=!1;function Ox(r,s){switch(r){case"keyup":return KS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Da=!1;function JS(r,s){switch(r){case"compositionend":return Bx(s);case"keypress":return s.which!==32?null:(zx=!0,Dx);case"textInput":return r=s.data,r===Dx&&zx?null:r;default:return null}}function ek(r,s){if(Da)return r==="compositionend"||!Nf&&Ox(r,s)?(r=gt(),Ke=fe=H=null,Da=!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 Lx&&s.locale!=="ko"?null:s.data;default:return null}}var tk={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 Px(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s==="input"?!!tk[r.type]:s==="textarea"}function $x(r,s,c,d){Ki?Zi?Zi.push(d):Zi=[d]:Ki=d,s=Bu(s,"onChange"),0<s.length&&(c=new pi("onChange","change",null,c,d),r.push({event:c,listeners:s}))}var Ql=null,Xl=null;function nk(r){_1(r,0)}function Qc(r){var s=Os(r);if(ei(s))return r}function Fx(r,s){if(r==="change")return s}var Ux=!1;if(_r){var Cf;if(_r){var Ef="oninput"in document;if(!Ef){var Hx=document.createElement("div");Hx.setAttribute("oninput","return;"),Ef=typeof Hx.oninput=="function"}Cf=Ef}else Cf=!1;Ux=Cf&&(!document.documentMode||9<document.documentMode)}function Ix(){Ql&&(Ql.detachEvent("onpropertychange",qx),Xl=Ql=null)}function qx(r){if(r.propertyName==="value"&&Qc(Xl)){var s=[];$x(s,Xl,r,Ma(r)),Hc(nk,s)}}function rk(r,s,c){r==="focusin"?(Ix(),Ql=s,Xl=c,Ql.attachEvent("onpropertychange",qx)):r==="focusout"&&Ix()}function ik(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Qc(Xl)}function sk(r,s){if(r==="click")return Qc(s)}function ak(r,s){if(r==="input"||r==="change")return Qc(s)}function lk(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var sr=typeof Object.is=="function"?Object.is:lk;function Kl(r,s){if(sr(r,s))return!0;if(typeof r!="object"||r===null||typeof s!="object"||s===null)return!1;var c=Object.keys(r),d=Object.keys(s);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var m=c[d];if(!ct.call(s,m)||!sr(r[m],s[m]))return!1}return!0}function Vx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Gx(r,s){var c=Vx(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=s&&d>=s)return{node:c,offset:s-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Vx(c)}}function Yx(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Yx(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Wx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Yi(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Yi(r.document)}return s}function Tf(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 ok=_r&&"documentMode"in document&&11>=document.documentMode,za=null,Af=null,Zl=null,Mf=!1;function Qx(r,s,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Mf||za==null||za!==Yi(d)||(d=za,"selectionStart"in d&&Tf(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}),Zl&&Kl(Zl,d)||(Zl=d,d=Bu(Af,"onSelect"),0<d.length&&(s=new pi("onSelect","select",null,s,c),r.push({event:s,listeners:d}),s.target=za)))}function Hs(r,s){var c={};return c[r.toLowerCase()]=s.toLowerCase(),c["Webkit"+r]="webkit"+s,c["Moz"+r]="moz"+s,c}var Oa={animationend:Hs("Animation","AnimationEnd"),animationiteration:Hs("Animation","AnimationIteration"),animationstart:Hs("Animation","AnimationStart"),transitionrun:Hs("Transition","TransitionRun"),transitionstart:Hs("Transition","TransitionStart"),transitioncancel:Hs("Transition","TransitionCancel"),transitionend:Hs("Transition","TransitionEnd")},Rf={},Xx={};_r&&(Xx=document.createElement("div").style,"AnimationEvent"in window||(delete Oa.animationend.animation,delete Oa.animationiteration.animation,delete Oa.animationstart.animation),"TransitionEvent"in window||delete Oa.transitionend.transition);function Is(r){if(Rf[r])return Rf[r];if(!Oa[r])return r;var s=Oa[r],c;for(c in s)if(s.hasOwnProperty(c)&&c in Xx)return Rf[r]=s[c];return r}var Kx=Is("animationend"),Zx=Is("animationiteration"),Jx=Is("animationstart"),ck=Is("transitionrun"),uk=Is("transitionstart"),dk=Is("transitioncancel"),e0=Is("transitionend"),t0=new Map,Lf="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(" ");Lf.push("scrollEnd");function Hr(r,s){t0.set(r,s),Fr(s,[r])}var Xc=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)},Sr=[],Ba=0,Df=0;function Kc(){for(var r=Ba,s=Df=Ba=0;s<r;){var c=Sr[s];Sr[s++]=null;var d=Sr[s];Sr[s++]=null;var m=Sr[s];Sr[s++]=null;var v=Sr[s];if(Sr[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}v!==0&&n0(c,m,v)}}function Zc(r,s,c,d){Sr[Ba++]=r,Sr[Ba++]=s,Sr[Ba++]=c,Sr[Ba++]=d,Df|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function zf(r,s,c,d){return Zc(r,s,c,d),Jc(r)}function qs(r,s){return Zc(r,null,null,s),Jc(r)}function n0(r,s,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var m=!1,v=r.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(m=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,m&&s!==null&&(m=31-et(c),r=v.hiddenUpdates,d=r[m],d===null?r[m]=[s]:d.push(s),s.lane=c|536870912),v):null}function Jc(r){if(50<_o)throw _o=0,qh=null,Error(i(185));for(var s=r.return;s!==null;)r=s,s=r.return;return r.tag===3?r.stateNode:null}var Pa={};function fk(r,s,c,d){this.tag=r,this.key=c,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 ar(r,s,c,d){return new fk(r,s,c,d)}function Of(r){return r=r.prototype,!(!r||!r.isReactComponent)}function mi(r,s){var c=r.alternate;return c===null?(c=ar(r.tag,s,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=s,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,s=r.dependencies,c.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function r0(r,s){r.flags&=65011714;var c=r.alternate;return c===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=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,s=c.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),r}function eu(r,s,c,d,m,v){var w=0;if(d=r,typeof r=="function")Of(r)&&(w=1);else if(typeof r=="string")w=xj(r,c,de.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case G:return r=ar(31,c,s,m),r.elementType=G,r.lanes=v,r;case j:return Vs(c.children,m,v,s);case N:w=8,m|=24;break;case k:return r=ar(12,c,s,m|2),r.elementType=k,r.lanes=v,r;case D:return r=ar(13,c,s,m),r.elementType=D,r.lanes=v,r;case z:return r=ar(19,c,s,m),r.elementType=z,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case C:w=10;break e;case A:w=9;break e;case L:w=11;break e;case q:w=14;break e;case $:w=16,d=null;break e}w=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return s=ar(w,c,s,m),s.elementType=r,s.type=d,s.lanes=v,s}function Vs(r,s,c,d){return r=ar(7,r,d,s),r.lanes=c,r}function Bf(r,s,c){return r=ar(6,r,null,s),r.lanes=c,r}function i0(r){var s=ar(18,null,null,0);return s.stateNode=r,s}function Pf(r,s,c){return s=ar(4,r.children!==null?r.children:[],r.key,s),s.lanes=c,s.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},s}var s0=new WeakMap;function kr(r,s){if(typeof r=="object"&&r!==null){var c=s0.get(r);return c!==void 0?c:(s={value:r,source:s,stack:Fe(s)},s0.set(r,s),s)}return{value:r,source:s,stack:Fe(s)}}var $a=[],Fa=0,tu=null,Jl=0,jr=[],Nr=0,es=null,ni=1,ri="";function gi(r,s){$a[Fa++]=Jl,$a[Fa++]=tu,tu=r,Jl=s}function a0(r,s,c){jr[Nr++]=ni,jr[Nr++]=ri,jr[Nr++]=es,es=r;var d=ni;r=ri;var m=32-et(d)-1;d&=~(1<<m),c+=1;var v=32-et(s)+m;if(30<v){var w=m-m%5;v=(d&(1<<w)-1).toString(32),d>>=w,m-=w,ni=1<<32-et(s)+m|c<<m|d,ri=v+r}else ni=1<<v|c<<m|d,ri=r}function $f(r){r.return!==null&&(gi(r,1),a0(r,1,0))}function Ff(r){for(;r===tu;)tu=$a[--Fa],$a[Fa]=null,Jl=$a[--Fa],$a[Fa]=null;for(;r===es;)es=jr[--Nr],jr[Nr]=null,ri=jr[--Nr],jr[Nr]=null,ni=jr[--Nr],jr[Nr]=null}function l0(r,s){jr[Nr++]=ni,jr[Nr++]=ri,jr[Nr++]=es,ni=s.id,ri=s.overflow,es=r}var wn=null,Ft=null,ft=!1,ts=null,Cr=!1,Uf=Error(i(519));function ns(r){var s=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eo(kr(s,r)),Uf}function o0(r){var s=r.stateNode,c=r.type,d=r.memoizedProps;switch(s[Gt]=r,s[_n]=d,c){case"dialog":lt("cancel",s),lt("close",s);break;case"iframe":case"object":case"embed":lt("load",s);break;case"video":case"audio":for(c=0;c<So.length;c++)lt(So[c],s);break;case"source":lt("error",s);break;case"img":case"image":case"link":lt("error",s),lt("load",s);break;case"details":lt("toggle",s);break;case"input":lt("invalid",s),Bc(s,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":lt("invalid",s);break;case"textarea":lt("invalid",s),ql(s,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||s.textContent===""+c||d.suppressHydrationWarning===!0||j1(s.textContent,c)?(d.popover!=null&&(lt("beforetoggle",s),lt("toggle",s)),d.onScroll!=null&<("scroll",s),d.onScrollEnd!=null&<("scrollend",s),d.onClick!=null&&(s.onclick=yr),s=!0):s=!1,s||ns(r,!0)}function c0(r){for(wn=r.return;wn;)switch(wn.tag){case 5:case 31:case 13:Cr=!1;return;case 27:case 3:Cr=!0;return;default:wn=wn.return}}function Ua(r){if(r!==wn)return!1;if(!ft)return c0(r),ft=!0,!1;var s=r.tag,c;if((c=s!==3&&s!==27)&&((c=s===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||sp(r.type,r.memoizedProps)),c=!c),c&&Ft&&ns(r),c0(r),s===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ft=D1(r)}else if(s===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));Ft=D1(r)}else s===27?(s=Ft,gs(r.type)?(r=up,up=null,Ft=r):Ft=s):Ft=wn?Tr(r.stateNode.nextSibling):null;return!0}function Gs(){Ft=wn=null,ft=!1}function Hf(){var r=ts;return r!==null&&(Kn===null?Kn=r:Kn.push.apply(Kn,r),ts=null),r}function eo(r){ts===null?ts=[r]:ts.push(r)}var If=P(null),Ys=null,xi=null;function rs(r,s,c){M(If,s._currentValue),s._currentValue=c}function vi(r){r._currentValue=If.current,Z(If)}function qf(r,s,c){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===c)break;r=r.return}}function Vf(r,s,c,d){var m=r.child;for(m!==null&&(m.return=r);m!==null;){var v=m.dependencies;if(v!==null){var w=m.child;v=v.firstContext;e:for(;v!==null;){var E=v;v=m;for(var U=0;U<s.length;U++)if(E.context===s[U]){v.lanes|=c,E=v.alternate,E!==null&&(E.lanes|=c),qf(v.return,c,r),d||(w=null);break e}v=E.next}}else if(m.tag===18){if(w=m.return,w===null)throw Error(i(341));w.lanes|=c,v=w.alternate,v!==null&&(v.lanes|=c),qf(w,c,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 Ha(r,s,c,d){r=null;for(var m=s,v=!1;m!==null;){if(!v){if((m.flags&524288)!==0)v=!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 E=m.type;sr(m.pendingProps.value,w.value)||(r!==null?r.push(E):r=[E])}}else if(m===Re.current){if(w=m.alternate,w===null)throw Error(i(387));w.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(r!==null?r.push(Eo):r=[Eo])}m=m.return}r!==null&&Vf(s,r,c,d),s.flags|=262144}function nu(r){for(r=r.firstContext;r!==null;){if(!sr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Ws(r){Ys=r,xi=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Sn(r){return u0(Ys,r)}function ru(r,s){return Ys===null&&Ws(r),u0(r,s)}function u0(r,s){var c=s._currentValue;if(s={context:s,memoizedValue:c,next:null},xi===null){if(r===null)throw Error(i(308));xi=s,r.dependencies={lanes:0,firstContext:s},r.flags|=524288}else xi=xi.next=s;return c}var hk=typeof AbortController<"u"?AbortController:function(){var r=[],s=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){s.aborted=!0,r.forEach(function(c){return c()})}},pk=e.unstable_scheduleCallback,mk=e.unstable_NormalPriority,on={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Gf(){return{controller:new hk,data:new Map,refCount:0}}function to(r){r.refCount--,r.refCount===0&&pk(mk,function(){r.controller.abort()})}var no=null,Yf=0,Ia=0,qa=null;function gk(r,s){if(no===null){var c=no=[];Yf=0,Ia=Xh(),qa={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Yf++,s.then(d0,d0),s}function d0(){if(--Yf===0&&no!==null){qa!==null&&(qa.status="fulfilled");var r=no;no=null,Ia=0,qa=null;for(var s=0;s<r.length;s++)(0,r[s])()}}function xk(r,s){var c=[],d={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return r.then(function(){d.status="fulfilled",d.value=s;for(var m=0;m<c.length;m++)(0,c[m])(s)},function(m){for(d.status="rejected",d.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),d}var f0=B.S;B.S=function(r,s){Qv=Ee(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&gk(r,s),f0!==null&&f0(r,s)};var Qs=P(null);function Wf(){var r=Qs.current;return r!==null?r:Lt.pooledCache}function iu(r,s){s===null?M(Qs,Qs.current):M(Qs,s.pool)}function h0(){var r=Wf();return r===null?null:{parent:on._currentValue,pool:r}}var Va=Error(i(460)),Qf=Error(i(474)),su=Error(i(542)),au={then:function(){}};function p0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function m0(r,s,c){switch(c=r[c],c===void 0?r.push(s):c!==s&&(s.then(yr,yr),s=c),s.status){case"fulfilled":return s.value;case"rejected":throw r=s.reason,x0(r),r;default:if(typeof s.status=="string")s.then(yr,yr);else{if(r=Lt,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,x0(r),r}throw Ks=s,Va}}function Xs(r){try{var s=r._init;return s(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ks=c,Va):c}}var Ks=null;function g0(){if(Ks===null)throw Error(i(459));var r=Ks;return Ks=null,r}function x0(r){if(r===Va||r===su)throw Error(i(483))}var Ga=null,ro=0;function lu(r){var s=ro;return ro+=1,Ga===null&&(Ga=[]),m0(Ga,r,s)}function io(r,s){s=s.props.ref,r.ref=s!==void 0?s:null}function ou(r,s){throw s.$$typeof===b?Error(i(525)):(r=Object.prototype.toString.call(s),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":r)))}function v0(r){function s(K,V){if(r){var ee=K.deletions;ee===null?(K.deletions=[V],K.flags|=16):ee.push(V)}}function c(K,V){if(!r)return null;for(;V!==null;)s(K,V),V=V.sibling;return null}function d(K){for(var V=new Map;K!==null;)K.key!==null?V.set(K.key,K):V.set(K.index,K),K=K.sibling;return V}function m(K,V){return K=mi(K,V),K.index=0,K.sibling=null,K}function v(K,V,ee){return K.index=ee,r?(ee=K.alternate,ee!==null?(ee=ee.index,ee<V?(K.flags|=67108866,V):ee):(K.flags|=67108866,V)):(K.flags|=1048576,V)}function w(K){return r&&K.alternate===null&&(K.flags|=67108866),K}function E(K,V,ee,ce){return V===null||V.tag!==6?(V=Bf(ee,K.mode,ce),V.return=K,V):(V=m(V,ee),V.return=K,V)}function U(K,V,ee,ce){var Pe=ee.type;return Pe===j?oe(K,V,ee.props.children,ce,ee.key):V!==null&&(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===$&&Xs(Pe)===V.type)?(V=m(V,ee.props),io(V,ee),V.return=K,V):(V=eu(ee.type,ee.key,ee.props,null,K.mode,ce),io(V,ee),V.return=K,V)}function te(K,V,ee,ce){return V===null||V.tag!==4||V.stateNode.containerInfo!==ee.containerInfo||V.stateNode.implementation!==ee.implementation?(V=Pf(ee,K.mode,ce),V.return=K,V):(V=m(V,ee.children||[]),V.return=K,V)}function oe(K,V,ee,ce,Pe){return V===null||V.tag!==7?(V=Vs(ee,K.mode,ce,Pe),V.return=K,V):(V=m(V,ee),V.return=K,V)}function ue(K,V,ee){if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return V=Bf(""+V,K.mode,ee),V.return=K,V;if(typeof V=="object"&&V!==null){switch(V.$$typeof){case y:return ee=eu(V.type,V.key,V.props,null,K.mode,ee),io(ee,V),ee.return=K,ee;case _:return V=Pf(V,K.mode,ee),V.return=K,V;case $:return V=Xs(V),ue(K,V,ee)}if(W(V)||T(V))return V=Vs(V,K.mode,ee,null),V.return=K,V;if(typeof V.then=="function")return ue(K,lu(V),ee);if(V.$$typeof===C)return ue(K,ru(K,V),ee);ou(K,V)}return null}function re(K,V,ee,ce){var Pe=V!==null?V.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Pe!==null?null:E(K,V,""+ee,ce);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:return ee.key===Pe?U(K,V,ee,ce):null;case _:return ee.key===Pe?te(K,V,ee,ce):null;case $:return ee=Xs(ee),re(K,V,ee,ce)}if(W(ee)||T(ee))return Pe!==null?null:oe(K,V,ee,ce,null);if(typeof ee.then=="function")return re(K,V,lu(ee),ce);if(ee.$$typeof===C)return re(K,V,ru(K,ee),ce);ou(K,ee)}return null}function se(K,V,ee,ce,Pe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return K=K.get(ee)||null,E(V,K,""+ce,Pe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case y:return K=K.get(ce.key===null?ee:ce.key)||null,U(V,K,ce,Pe);case _:return K=K.get(ce.key===null?ee:ce.key)||null,te(V,K,ce,Pe);case $:return ce=Xs(ce),se(K,V,ee,ce,Pe)}if(W(ce)||T(ce))return K=K.get(ee)||null,oe(V,K,ce,Pe,null);if(typeof ce.then=="function")return se(K,V,ee,lu(ce),Pe);if(ce.$$typeof===C)return se(K,V,ee,ru(V,ce),Pe);ou(V,ce)}return null}function Te(K,V,ee,ce){for(var Pe=null,vt=null,De=V,tt=V=0,dt=null;De!==null&&tt<ee.length;tt++){De.index>tt?(dt=De,De=null):dt=De.sibling;var bt=re(K,De,ee[tt],ce);if(bt===null){De===null&&(De=dt);break}r&&De&&bt.alternate===null&&s(K,De),V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt,De=dt}if(tt===ee.length)return c(K,De),ft&&gi(K,tt),Pe;if(De===null){for(;tt<ee.length;tt++)De=ue(K,ee[tt],ce),De!==null&&(V=v(De,V,tt),vt===null?Pe=De:vt.sibling=De,vt=De);return ft&&gi(K,tt),Pe}for(De=d(De);tt<ee.length;tt++)dt=se(De,K,tt,ee[tt],ce),dt!==null&&(r&&dt.alternate!==null&&De.delete(dt.key===null?tt:dt.key),V=v(dt,V,tt),vt===null?Pe=dt:vt.sibling=dt,vt=dt);return r&&De.forEach(function(_s){return s(K,_s)}),ft&&gi(K,tt),Pe}function Ue(K,V,ee,ce){if(ee==null)throw Error(i(151));for(var Pe=null,vt=null,De=V,tt=V=0,dt=null,bt=ee.next();De!==null&&!bt.done;tt++,bt=ee.next()){De.index>tt?(dt=De,De=null):dt=De.sibling;var _s=re(K,De,bt.value,ce);if(_s===null){De===null&&(De=dt);break}r&&De&&_s.alternate===null&&s(K,De),V=v(_s,V,tt),vt===null?Pe=_s:vt.sibling=_s,vt=_s,De=dt}if(bt.done)return c(K,De),ft&&gi(K,tt),Pe;if(De===null){for(;!bt.done;tt++,bt=ee.next())bt=ue(K,bt.value,ce),bt!==null&&(V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt);return ft&&gi(K,tt),Pe}for(De=d(De);!bt.done;tt++,bt=ee.next())bt=se(De,K,tt,bt.value,ce),bt!==null&&(r&&bt.alternate!==null&&De.delete(bt.key===null?tt:bt.key),V=v(bt,V,tt),vt===null?Pe=bt:vt.sibling=bt,vt=bt);return r&&De.forEach(function(Ej){return s(K,Ej)}),ft&&gi(K,tt),Pe}function At(K,V,ee,ce){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case y:e:{for(var Pe=ee.key;V!==null;){if(V.key===Pe){if(Pe=ee.type,Pe===j){if(V.tag===7){c(K,V.sibling),ce=m(V,ee.props.children),ce.return=K,K=ce;break e}}else if(V.elementType===Pe||typeof Pe=="object"&&Pe!==null&&Pe.$$typeof===$&&Xs(Pe)===V.type){c(K,V.sibling),ce=m(V,ee.props),io(ce,ee),ce.return=K,K=ce;break e}c(K,V);break}else s(K,V);V=V.sibling}ee.type===j?(ce=Vs(ee.props.children,K.mode,ce,ee.key),ce.return=K,K=ce):(ce=eu(ee.type,ee.key,ee.props,null,K.mode,ce),io(ce,ee),ce.return=K,K=ce)}return w(K);case _:e:{for(Pe=ee.key;V!==null;){if(V.key===Pe)if(V.tag===4&&V.stateNode.containerInfo===ee.containerInfo&&V.stateNode.implementation===ee.implementation){c(K,V.sibling),ce=m(V,ee.children||[]),ce.return=K,K=ce;break e}else{c(K,V);break}else s(K,V);V=V.sibling}ce=Pf(ee,K.mode,ce),ce.return=K,K=ce}return w(K);case $:return ee=Xs(ee),At(K,V,ee,ce)}if(W(ee))return Te(K,V,ee,ce);if(T(ee)){if(Pe=T(ee),typeof Pe!="function")throw Error(i(150));return ee=Pe.call(ee),Ue(K,V,ee,ce)}if(typeof ee.then=="function")return At(K,V,lu(ee),ce);if(ee.$$typeof===C)return At(K,V,ru(K,ee),ce);ou(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,V!==null&&V.tag===6?(c(K,V.sibling),ce=m(V,ee),ce.return=K,K=ce):(c(K,V),ce=Bf(ee,K.mode,ce),ce.return=K,K=ce),w(K)):c(K,V)}return function(K,V,ee,ce){try{ro=0;var Pe=At(K,V,ee,ce);return Ga=null,Pe}catch(De){if(De===Va||De===su)throw De;var vt=ar(29,De,null,K.mode);return vt.lanes=ce,vt.return=K,vt}finally{}}}var Zs=v0(!0),b0=v0(!1),is=!1;function Xf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Kf(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 ss(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function as(r,s,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(_t&2)!==0){var m=d.pending;return m===null?s.next=s:(s.next=m.next,m.next=s),d.pending=s,s=Jc(r),n0(r,null,c),s}return Zc(r,d,s,c),Jc(r)}function so(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Sa(r,c)}}function Zf(r,s){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var m=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var w={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?m=v=w:v=v.next=w,c=c.next}while(c!==null);v===null?m=v=s:v=v.next=s}else m=v=s;c={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var Jf=!1;function ao(){if(Jf){var r=qa;if(r!==null)throw r}}function lo(r,s,c,d){Jf=!1;var m=r.updateQueue;is=!1;var v=m.firstBaseUpdate,w=m.lastBaseUpdate,E=m.shared.pending;if(E!==null){m.shared.pending=null;var U=E,te=U.next;U.next=null,w===null?v=te:w.next=te,w=U;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,E=oe.lastBaseUpdate,E!==w&&(E===null?oe.firstBaseUpdate=te:E.next=te,oe.lastBaseUpdate=U))}if(v!==null){var ue=m.baseState;w=0,oe=te=U=null,E=v;do{var re=E.lane&-536870913,se=re!==E.lane;if(se?(ut&re)===re:(d&re)===re){re!==0&&re===Ia&&(Jf=!0),oe!==null&&(oe=oe.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var Te=r,Ue=E;re=s;var At=c;switch(Ue.tag){case 1:if(Te=Ue.payload,typeof Te=="function"){ue=Te.call(At,ue,re);break e}ue=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ue.payload,re=typeof Te=="function"?Te.call(At,ue,re):Te,re==null)break e;ue=x({},ue,re);break e;case 2:is=!0}}re=E.callback,re!==null&&(r.flags|=64,se&&(r.flags|=8192),se=m.callbacks,se===null?m.callbacks=[re]:se.push(re))}else se={lane:re,tag:E.tag,payload:E.payload,callback:E.callback,next:null},oe===null?(te=oe=se,U=ue):oe=oe.next=se,w|=re;if(E=E.next,E===null){if(E=m.shared.pending,E===null)break;se=E,E=se.next,se.next=null,m.lastBaseUpdate=se,m.shared.pending=null}}while(!0);oe===null&&(U=ue),m.baseState=U,m.firstBaseUpdate=te,m.lastBaseUpdate=oe,v===null&&(m.shared.lanes=0),ds|=w,r.lanes=w,r.memoizedState=ue}}function y0(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function _0(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)y0(c[r],s)}var Ya=P(null),cu=P(0);function w0(r,s){r=Ci,M(cu,r),M(Ya,s),Ci=r|s.baseLanes}function eh(){M(cu,Ci),M(Ya,Ya.current)}function th(){Ci=cu.current,Z(Ya),Z(cu)}var lr=P(null),Er=null;function ls(r){var s=r.alternate;M(rn,rn.current&1),M(lr,r),Er===null&&(s===null||Ya.current!==null||s.memoizedState!==null)&&(Er=r)}function nh(r){M(rn,rn.current),M(lr,r),Er===null&&(Er=r)}function S0(r){r.tag===22?(M(rn,rn.current),M(lr,r),Er===null&&(Er=r)):os()}function os(){M(rn,rn.current),M(lr,lr.current)}function or(r){Z(lr),Er===r&&(Er=null),Z(rn)}var rn=P(0);function uu(r){for(var s=r;s!==null;){if(s.tag===13){var c=s.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||op(c)||cp(c)))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 bi=0,Ze=null,Et=null,cn=null,du=!1,Wa=!1,Js=!1,fu=0,oo=0,Qa=null,vk=0;function Jt(){throw Error(i(321))}function rh(r,s){if(s===null)return!1;for(var c=0;c<s.length&&c<r.length;c++)if(!sr(r[c],s[c]))return!1;return!0}function ih(r,s,c,d,m,v){return bi=v,Ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=r===null||r.memoizedState===null?av:bh,Js=!1,v=c(d,m),Js=!1,Wa&&(v=j0(s,c,d,m)),k0(r),v}function k0(r){B.H=fo;var s=Et!==null&&Et.next!==null;if(bi=0,cn=Et=Ze=null,du=!1,oo=0,Qa=null,s)throw Error(i(300));r===null||un||(r=r.dependencies,r!==null&&nu(r)&&(un=!0))}function j0(r,s,c,d){Ze=r;var m=0;do{if(Wa&&(Qa=null),oo=0,Wa=!1,25<=m)throw Error(i(301));if(m+=1,cn=Et=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}B.H=lv,v=s(c,d)}while(Wa);return v}function bk(){var r=B.H,s=r.useState()[0];return s=typeof s.then=="function"?co(s):s,r=r.useState()[0],(Et!==null?Et.memoizedState:null)!==r&&(Ze.flags|=1024),s}function sh(){var r=fu!==0;return fu=0,r}function ah(r,s,c){s.updateQueue=r.updateQueue,s.flags&=-2053,r.lanes&=~c}function lh(r){if(du){for(r=r.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}du=!1}bi=0,cn=Et=Ze=null,Wa=!1,oo=fu=0,Qa=null}function Pn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cn===null?Ze.memoizedState=cn=r:cn=cn.next=r,cn}function sn(){if(Et===null){var r=Ze.alternate;r=r!==null?r.memoizedState:null}else r=Et.next;var s=cn===null?Ze.memoizedState:cn.next;if(s!==null)cn=s,Et=r;else{if(r===null)throw Ze.alternate===null?Error(i(467)):Error(i(310));Et=r,r={memoizedState:Et.memoizedState,baseState:Et.baseState,baseQueue:Et.baseQueue,queue:Et.queue,next:null},cn===null?Ze.memoizedState=cn=r:cn=cn.next=r}return cn}function hu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function co(r){var s=oo;return oo+=1,Qa===null&&(Qa=[]),r=m0(Qa,r,s),s=Ze,(cn===null?s.memoizedState:cn.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?av:bh),r}function pu(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return co(r);if(r.$$typeof===C)return Sn(r)}throw Error(i(438,String(r)))}function oh(r){var s=null,c=Ze.updateQueue;if(c!==null&&(s=c.memoCache),s==null){var d=Ze.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}),c===null&&(c=hu(),Ze.updateQueue=c),c.memoCache=s,c=s.data[s.index],c===void 0)for(c=s.data[s.index]=Array(r),d=0;d<r;d++)c[d]=O;return s.index++,c}function yi(r,s){return typeof s=="function"?s(r):s}function mu(r){var s=sn();return ch(s,Et,r)}function ch(r,s,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var m=r.baseQueue,v=d.pending;if(v!==null){if(m!==null){var w=m.next;m.next=v.next,v.next=w}s.baseQueue=m=v,d.pending=null}if(v=r.baseState,m===null)r.memoizedState=v;else{s=m.next;var E=w=null,U=null,te=s,oe=!1;do{var ue=te.lane&-536870913;if(ue!==te.lane?(ut&ue)===ue:(bi&ue)===ue){var re=te.revertLane;if(re===0)U!==null&&(U=U.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ue===Ia&&(oe=!0);else if((bi&re)===re){te=te.next,re===Ia&&(oe=!0);continue}else ue={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(E=U=ue,w=v):U=U.next=ue,Ze.lanes|=re,ds|=re;ue=te.action,Js&&c(v,ue),v=te.hasEagerState?te.eagerState:c(v,ue)}else re={lane:ue,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},U===null?(E=U=re,w=v):U=U.next=re,Ze.lanes|=ue,ds|=ue;te=te.next}while(te!==null&&te!==s);if(U===null?w=v:U.next=E,!sr(v,r.memoizedState)&&(un=!0,oe&&(c=qa,c!==null)))throw c;r.memoizedState=v,r.baseState=w,r.baseQueue=U,d.lastRenderedState=v}return m===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function uh(r){var s=sn(),c=s.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,m=c.pending,v=s.memoizedState;if(m!==null){c.pending=null;var w=m=m.next;do v=r(v,w.action),w=w.next;while(w!==m);sr(v,s.memoizedState)||(un=!0),s.memoizedState=v,s.baseQueue===null&&(s.baseState=v),c.lastRenderedState=v}return[v,d]}function N0(r,s,c){var d=Ze,m=sn(),v=ft;if(v){if(c===void 0)throw Error(i(407));c=c()}else c=s();var w=!sr((Et||m).memoizedState,c);if(w&&(m.memoizedState=c,un=!0),m=m.queue,hh(T0.bind(null,d,m,r),[r]),m.getSnapshot!==s||w||cn!==null&&cn.memoizedState.tag&1){if(d.flags|=2048,Xa(9,{destroy:void 0},E0.bind(null,d,m,c,s),null),Lt===null)throw Error(i(349));v||(bi&127)!==0||C0(d,s,c)}return c}function C0(r,s,c){r.flags|=16384,r={getSnapshot:s,value:c},s=Ze.updateQueue,s===null?(s=hu(),Ze.updateQueue=s,s.stores=[r]):(c=s.stores,c===null?s.stores=[r]:c.push(r))}function E0(r,s,c,d){s.value=c,s.getSnapshot=d,A0(s)&&M0(r)}function T0(r,s,c){return c(function(){A0(s)&&M0(r)})}function A0(r){var s=r.getSnapshot;r=r.value;try{var c=s();return!sr(r,c)}catch{return!0}}function M0(r){var s=qs(r,2);s!==null&&Zn(s,r,2)}function dh(r){var s=Pn();if(typeof r=="function"){var c=r;if(r=c(),Js){gn(!0);try{c()}finally{gn(!1)}}}return s.memoizedState=s.baseState=r,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:r},s}function R0(r,s,c,d){return r.baseState=c,ch(r,Et,typeof d=="function"?d:yi)}function yk(r,s,c,d,m){if(vu(r))throw Error(i(485));if(r=s.action,r!==null){var v={payload:m,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(w){v.listeners.push(w)}};B.T!==null?c(!0):v.isTransition=!1,d(v),c=s.pending,c===null?(v.next=s.pending=v,L0(s,v)):(v.next=c.next,s.pending=c.next=v)}}function L0(r,s){var c=s.action,d=s.payload,m=r.state;if(s.isTransition){var v=B.T,w={};B.T=w;try{var E=c(m,d),U=B.S;U!==null&&U(w,E),D0(r,s,E)}catch(te){fh(r,s,te)}finally{v!==null&&w.types!==null&&(v.types=w.types),B.T=v}}else try{v=c(m,d),D0(r,s,v)}catch(te){fh(r,s,te)}}function D0(r,s,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){z0(r,s,d)},function(d){return fh(r,s,d)}):z0(r,s,c)}function z0(r,s,c){s.status="fulfilled",s.value=c,O0(s),r.state=c,s=r.pending,s!==null&&(c=s.next,c===s?r.pending=null:(c=c.next,s.next=c,L0(r,c)))}function fh(r,s,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do s.status="rejected",s.reason=c,O0(s),s=s.next;while(s!==d)}r.action=null}function O0(r){r=r.listeners;for(var s=0;s<r.length;s++)(0,r[s])()}function B0(r,s){return s}function P0(r,s){if(ft){var c=Lt.formState;if(c!==null){e:{var d=Ze;if(ft){if(Ft){t:{for(var m=Ft,v=Cr;m.nodeType!==8;){if(!v){m=null;break t}if(m=Tr(m.nextSibling),m===null){m=null;break t}}v=m.data,m=v==="F!"||v==="F"?m:null}if(m){Ft=Tr(m.nextSibling),d=m.data==="F!";break e}}ns(d)}d=!1}d&&(s=c[0])}}return c=Pn(),c.memoizedState=c.baseState=s,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:B0,lastRenderedState:s},c.queue=d,c=rv.bind(null,Ze,d),d.dispatch=c,d=dh(!1),v=vh.bind(null,Ze,!1,d.queue),d=Pn(),m={state:s,dispatch:null,action:r,pending:null},d.queue=m,c=yk.bind(null,Ze,m,v,c),m.dispatch=c,d.memoizedState=r,[s,c,!1]}function $0(r){var s=sn();return F0(s,Et,r)}function F0(r,s,c){if(s=ch(r,s,B0)[0],r=mu(yi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var d=co(s)}catch(w){throw w===Va?su:w}else d=s;s=sn();var m=s.queue,v=m.dispatch;return c!==s.memoizedState&&(Ze.flags|=2048,Xa(9,{destroy:void 0},_k.bind(null,m,c),null)),[d,v,r]}function _k(r,s){r.action=s}function U0(r){var s=sn(),c=Et;if(c!==null)return F0(s,c,r);sn(),s=s.memoizedState,c=sn();var d=c.queue.dispatch;return c.memoizedState=r,[s,d,!1]}function Xa(r,s,c,d){return r={tag:r,create:c,deps:d,inst:s,next:null},s=Ze.updateQueue,s===null&&(s=hu(),Ze.updateQueue=s),c=s.lastEffect,c===null?s.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,s.lastEffect=r),r}function H0(){return sn().memoizedState}function gu(r,s,c,d){var m=Pn();Ze.flags|=r,m.memoizedState=Xa(1|s,{destroy:void 0},c,d===void 0?null:d)}function xu(r,s,c,d){var m=sn();d=d===void 0?null:d;var v=m.memoizedState.inst;Et!==null&&d!==null&&rh(d,Et.memoizedState.deps)?m.memoizedState=Xa(s,v,c,d):(Ze.flags|=r,m.memoizedState=Xa(1|s,v,c,d))}function I0(r,s){gu(8390656,8,r,s)}function hh(r,s){xu(2048,8,r,s)}function wk(r){Ze.flags|=4;var s=Ze.updateQueue;if(s===null)s=hu(),Ze.updateQueue=s,s.events=[r];else{var c=s.events;c===null?s.events=[r]:c.push(r)}}function q0(r){var s=sn().memoizedState;return wk({ref:s,nextImpl:r}),function(){if((_t&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}function V0(r,s){return xu(4,2,r,s)}function G0(r,s){return xu(4,4,r,s)}function Y0(r,s){if(typeof s=="function"){r=r();var c=s(r);return function(){typeof c=="function"?c():s(null)}}if(s!=null)return r=r(),s.current=r,function(){s.current=null}}function W0(r,s,c){c=c!=null?c.concat([r]):null,xu(4,4,Y0.bind(null,s,r),c)}function ph(){}function Q0(r,s){var c=sn();s=s===void 0?null:s;var d=c.memoizedState;return s!==null&&rh(s,d[1])?d[0]:(c.memoizedState=[r,s],r)}function X0(r,s){var c=sn();s=s===void 0?null:s;var d=c.memoizedState;if(s!==null&&rh(s,d[1]))return d[0];if(d=r(),Js){gn(!0);try{r()}finally{gn(!1)}}return c.memoizedState=[d,s],d}function mh(r,s,c){return c===void 0||(bi&1073741824)!==0&&(ut&261930)===0?r.memoizedState=s:(r.memoizedState=c,r=Kv(),Ze.lanes|=r,ds|=r,c)}function K0(r,s,c,d){return sr(c,s)?c:Ya.current!==null?(r=mh(r,c,d),sr(r,s)||(un=!0),r):(bi&42)===0||(bi&1073741824)!==0&&(ut&261930)===0?(un=!0,r.memoizedState=c):(r=Kv(),Ze.lanes|=r,ds|=r,s)}function Z0(r,s,c,d,m){var v=F.p;F.p=v!==0&&8>v?v:8;var w=B.T,E={};B.T=E,vh(r,!1,s,c);try{var U=m(),te=B.S;if(te!==null&&te(E,U),U!==null&&typeof U=="object"&&typeof U.then=="function"){var oe=xk(U,d);uo(r,s,oe,dr(r))}else uo(r,s,d,dr(r))}catch(ue){uo(r,s,{then:function(){},status:"rejected",reason:ue},dr())}finally{F.p=v,w!==null&&E.types!==null&&(w.types=E.types),B.T=w}}function Sk(){}function gh(r,s,c,d){if(r.tag!==5)throw Error(i(476));var m=J0(r).queue;Z0(r,m,s,Y,c===null?Sk:function(){return ev(r),c(d)})}function J0(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:Y},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yi,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function ev(r){var s=J0(r);s.next===null&&(s=r.alternate.memoizedState),uo(r,s.next.queue,{},dr())}function xh(){return Sn(Eo)}function tv(){return sn().memoizedState}function nv(){return sn().memoizedState}function kk(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=dr();r=ss(c);var d=as(s,r,c);d!==null&&(Zn(d,s,c),so(d,s,c)),s={cache:Gf()},r.payload=s;return}s=s.return}}function jk(r,s,c){var d=dr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},vu(r)?iv(s,c):(c=zf(r,s,c,d),c!==null&&(Zn(c,r,d),sv(c,s,d)))}function rv(r,s,c){var d=dr();uo(r,s,c,d)}function uo(r,s,c,d){var m={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(vu(r))iv(s,m);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=s.lastRenderedReducer,v!==null))try{var w=s.lastRenderedState,E=v(w,c);if(m.hasEagerState=!0,m.eagerState=E,sr(E,w))return Zc(r,s,m,0),Lt===null&&Kc(),!1}catch{}finally{}if(c=zf(r,s,m,d),c!==null)return Zn(c,r,d),sv(c,s,d),!0}return!1}function vh(r,s,c,d){if(d={lane:2,revertLane:Xh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},vu(r)){if(s)throw Error(i(479))}else s=zf(r,c,d,2),s!==null&&Zn(s,r,2)}function vu(r){var s=r.alternate;return r===Ze||s!==null&&s===Ze}function iv(r,s){Wa=du=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function sv(r,s,c){if((c&4194048)!==0){var d=s.lanes;d&=r.pendingLanes,c|=d,s.lanes=c,Sa(r,c)}}var fo={readContext:Sn,use:pu,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};fo.useEffectEvent=Jt;var av={readContext:Sn,use:pu,useCallback:function(r,s){return Pn().memoizedState=[r,s===void 0?null:s],r},useContext:Sn,useEffect:I0,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,gu(4194308,4,Y0.bind(null,s,r),c)},useLayoutEffect:function(r,s){return gu(4194308,4,r,s)},useInsertionEffect:function(r,s){gu(4,2,r,s)},useMemo:function(r,s){var c=Pn();s=s===void 0?null:s;var d=r();if(Js){gn(!0);try{r()}finally{gn(!1)}}return c.memoizedState=[d,s],d},useReducer:function(r,s,c){var d=Pn();if(c!==void 0){var m=c(s);if(Js){gn(!0);try{c(s)}finally{gn(!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=jk.bind(null,Ze,r),[d.memoizedState,r]},useRef:function(r){var s=Pn();return r={current:r},s.memoizedState=r},useState:function(r){r=dh(r);var s=r.queue,c=rv.bind(null,Ze,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:ph,useDeferredValue:function(r,s){var c=Pn();return mh(c,r,s)},useTransition:function(){var r=dh(!1);return r=Z0.bind(null,Ze,r.queue,!0,!1),Pn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var d=Ze,m=Pn();if(ft){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Lt===null)throw Error(i(349));(ut&127)!==0||C0(d,s,c)}m.memoizedState=c;var v={value:c,getSnapshot:s};return m.queue=v,I0(T0.bind(null,d,v,r),[r]),d.flags|=2048,Xa(9,{destroy:void 0},E0.bind(null,d,v,c,s),null),c},useId:function(){var r=Pn(),s=Lt.identifierPrefix;if(ft){var c=ri,d=ni;c=(d&~(1<<32-et(d)-1)).toString(32)+c,s="_"+s+"R_"+c,c=fu++,0<c&&(s+="H"+c.toString(32)),s+="_"}else c=vk++,s="_"+s+"r_"+c.toString(32)+"_";return r.memoizedState=s},useHostTransitionStatus:xh,useFormState:P0,useActionState:P0,useOptimistic:function(r){var s=Pn();s.memoizedState=s.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=c,s=vh.bind(null,Ze,!0,c),c.dispatch=s,[r,s]},useMemoCache:oh,useCacheRefresh:function(){return Pn().memoizedState=kk.bind(null,Ze)},useEffectEvent:function(r){var s=Pn(),c={impl:r};return s.memoizedState=c,function(){if((_t&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},bh={readContext:Sn,use:pu,useCallback:Q0,useContext:Sn,useEffect:hh,useImperativeHandle:W0,useInsertionEffect:V0,useLayoutEffect:G0,useMemo:X0,useReducer:mu,useRef:H0,useState:function(){return mu(yi)},useDebugValue:ph,useDeferredValue:function(r,s){var c=sn();return K0(c,Et.memoizedState,r,s)},useTransition:function(){var r=mu(yi)[0],s=sn().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:N0,useId:tv,useHostTransitionStatus:xh,useFormState:$0,useActionState:$0,useOptimistic:function(r,s){var c=sn();return R0(c,Et,r,s)},useMemoCache:oh,useCacheRefresh:nv};bh.useEffectEvent=q0;var lv={readContext:Sn,use:pu,useCallback:Q0,useContext:Sn,useEffect:hh,useImperativeHandle:W0,useInsertionEffect:V0,useLayoutEffect:G0,useMemo:X0,useReducer:uh,useRef:H0,useState:function(){return uh(yi)},useDebugValue:ph,useDeferredValue:function(r,s){var c=sn();return Et===null?mh(c,r,s):K0(c,Et.memoizedState,r,s)},useTransition:function(){var r=uh(yi)[0],s=sn().memoizedState;return[typeof r=="boolean"?r:co(r),s]},useSyncExternalStore:N0,useId:tv,useHostTransitionStatus:xh,useFormState:U0,useActionState:U0,useOptimistic:function(r,s){var c=sn();return Et!==null?R0(c,Et,r,s):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:oh,useCacheRefresh:nv};lv.useEffectEvent=q0;function yh(r,s,c,d){s=r.memoizedState,c=c(d,s),c=c==null?s:x({},s,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var _h={enqueueSetState:function(r,s,c){r=r._reactInternals;var d=dr(),m=ss(d);m.payload=s,c!=null&&(m.callback=c),s=as(r,m,d),s!==null&&(Zn(s,r,d),so(s,r,d))},enqueueReplaceState:function(r,s,c){r=r._reactInternals;var d=dr(),m=ss(d);m.tag=1,m.payload=s,c!=null&&(m.callback=c),s=as(r,m,d),s!==null&&(Zn(s,r,d),so(s,r,d))},enqueueForceUpdate:function(r,s){r=r._reactInternals;var c=dr(),d=ss(c);d.tag=2,s!=null&&(d.callback=s),s=as(r,d,c),s!==null&&(Zn(s,r,c),so(s,r,c))}};function ov(r,s,c,d,m,v,w){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,w):s.prototype&&s.prototype.isPureReactComponent?!Kl(c,d)||!Kl(m,v):!0}function cv(r,s,c,d){r=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(c,d),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(c,d),s.state!==r&&_h.enqueueReplaceState(s,s.state,null)}function ea(r,s){var c=s;if("ref"in s){c={};for(var d in s)d!=="ref"&&(c[d]=s[d])}if(r=r.defaultProps){c===s&&(c=x({},c));for(var m in r)c[m]===void 0&&(c[m]=r[m])}return c}function uv(r){Xc(r)}function dv(r){console.error(r)}function fv(r){Xc(r)}function bu(r,s){try{var c=r.onUncaughtError;c(s.value,{componentStack:s.stack})}catch(d){setTimeout(function(){throw d})}}function hv(r,s,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function wh(r,s,c){return c=ss(c),c.tag=3,c.payload={element:null},c.callback=function(){bu(r,s)},c}function pv(r){return r=ss(r),r.tag=3,r}function mv(r,s,c,d){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var v=d.value;r.payload=function(){return m(v)},r.callback=function(){hv(s,c,d)}}var w=c.stateNode;w!==null&&typeof w.componentDidCatch=="function"&&(r.callback=function(){hv(s,c,d),typeof m!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var E=d.stack;this.componentDidCatch(d.value,{componentStack:E!==null?E:""})})}function Nk(r,s,c,d,m){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(s=c.alternate,s!==null&&Ha(s,c,m,!0),c=lr.current,c!==null){switch(c.tag){case 31:case 13:return Er===null?Mu():c.alternate===null&&en===0&&(en=3),c.flags&=-257,c.flags|=65536,c.lanes=m,d===au?c.flags|=16384:(s=c.updateQueue,s===null?c.updateQueue=new Set([d]):s.add(d),Yh(r,d,m)),!1;case 22:return c.flags|=65536,d===au?c.flags|=16384:(s=c.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=s):(c=s.retryQueue,c===null?s.retryQueue=new Set([d]):c.add(d)),Yh(r,d,m)),!1}throw Error(i(435,c.tag))}return Yh(r,d,m),Mu(),!1}if(ft)return s=lr.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=m,d!==Uf&&(r=Error(i(422),{cause:d}),eo(kr(r,c)))):(d!==Uf&&(s=Error(i(423),{cause:d}),eo(kr(s,c))),r=r.current.alternate,r.flags|=65536,m&=-m,r.lanes|=m,d=kr(d,c),m=wh(r.stateNode,d,m),Zf(r,m),en!==4&&(en=2)),!1;var v=Error(i(520),{cause:d});if(v=kr(v,c),yo===null?yo=[v]:yo.push(v),en!==4&&(en=2),s===null)return!0;d=kr(d,c),c=s;do{switch(c.tag){case 3:return c.flags|=65536,r=m&-m,c.lanes|=r,r=wh(c.stateNode,d,r),Zf(c,r),!1;case 1:if(s=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(fs===null||!fs.has(v))))return c.flags|=65536,m&=-m,c.lanes|=m,m=pv(m),mv(m,r,c,d),Zf(c,m),!1}c=c.return}while(c!==null);return!1}var Sh=Error(i(461)),un=!1;function kn(r,s,c,d){s.child=r===null?b0(s,null,c,d):Zs(s,r.child,c,d)}function gv(r,s,c,d,m){c=c.render;var v=s.ref;if("ref"in d){var w={};for(var E in d)E!=="ref"&&(w[E]=d[E])}else w=d;return Ws(s),d=ih(r,s,c,w,v,m),E=sh(),r!==null&&!un?(ah(r,s,m),_i(r,s,m)):(ft&&E&&$f(s),s.flags|=1,kn(r,s,d,m),s.child)}function xv(r,s,c,d,m){if(r===null){var v=c.type;return typeof v=="function"&&!Of(v)&&v.defaultProps===void 0&&c.compare===null?(s.tag=15,s.type=v,vv(r,s,v,d,m)):(r=eu(c.type,null,d,s,s.mode,m),r.ref=s.ref,r.return=s,s.child=r)}if(v=r.child,!Mh(r,m)){var w=v.memoizedProps;if(c=c.compare,c=c!==null?c:Kl,c(w,d)&&r.ref===s.ref)return _i(r,s,m)}return s.flags|=1,r=mi(v,d),r.ref=s.ref,r.return=s,s.child=r}function vv(r,s,c,d,m){if(r!==null){var v=r.memoizedProps;if(Kl(v,d)&&r.ref===s.ref)if(un=!1,s.pendingProps=d=v,Mh(r,m))(r.flags&131072)!==0&&(un=!0);else return s.lanes=r.lanes,_i(r,s,m)}return kh(r,s,c,d,m)}function bv(r,s,c,d){var m=d.children,v=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(v=v!==null?v.baseLanes|c:c,r!==null){for(d=s.child=r.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~v}else d=0,s.child=null;return yv(r,s,v,c,d)}if((c&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},r!==null&&iu(s,v!==null?v.cachePool:null),v!==null?w0(s,v):eh(),S0(s);else return d=s.lanes=536870912,yv(r,s,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(iu(s,v.cachePool),w0(s,v),os(),s.memoizedState=null):(r!==null&&iu(s,null),eh(),os());return kn(r,s,m,c),s.child}function ho(r,s){return r!==null&&r.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function yv(r,s,c,d,m){var v=Wf();return v=v===null?null:{parent:on._currentValue,pool:v},s.memoizedState={baseLanes:c,cachePool:v},r!==null&&iu(s,null),eh(),S0(s),r!==null&&Ha(r,s,d,!0),s.childLanes=m,null}function yu(r,s){return s=wu({mode:s.mode,children:s.children},r.mode),s.ref=r.ref,r.child=s,s.return=r,s}function _v(r,s,c){return Zs(s,r.child,null,c),r=yu(s,s.pendingProps),r.flags|=2,or(s),s.memoizedState=null,r}function Ck(r,s,c){var d=s.pendingProps,m=(s.flags&128)!==0;if(s.flags&=-129,r===null){if(ft){if(d.mode==="hidden")return r=yu(s,d),s.lanes=536870912,ho(null,r);if(nh(s),(r=Ft)?(r=L1(r,Cr),r=r!==null&&r.data==="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:es!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=i0(r),c.return=s,s.child=c,wn=s,Ft=null)):r=null,r===null)throw ns(s);return s.lanes=536870912,null}return yu(s,d)}var v=r.memoizedState;if(v!==null){var w=v.dehydrated;if(nh(s),m)if(s.flags&256)s.flags&=-257,s=_v(r,s,c);else if(s.memoizedState!==null)s.child=r.child,s.flags|=128,s=null;else throw Error(i(558));else if(un||Ha(r,s,c,!1),m=(c&r.childLanes)!==0,un||m){if(d=Lt,d!==null&&(w=Bl(d,c),w!==0&&w!==v.retryLane))throw v.retryLane=w,qs(r,w),Zn(d,r,w),Sh;Mu(),s=_v(r,s,c)}else r=v.treeContext,Ft=Tr(w.nextSibling),wn=s,ft=!0,ts=null,Cr=!1,r!==null&&l0(s,r),s=yu(s,d),s.flags|=4096;return s}return r=mi(r.child,{mode:d.mode,children:d.children}),r.ref=s.ref,s.child=r,r.return=s,r}function _u(r,s){var c=s.ref;if(c===null)r!==null&&r.ref!==null&&(s.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(s.flags|=4194816)}}function kh(r,s,c,d,m){return Ws(s),c=ih(r,s,c,d,void 0,m),d=sh(),r!==null&&!un?(ah(r,s,m),_i(r,s,m)):(ft&&d&&$f(s),s.flags|=1,kn(r,s,c,m),s.child)}function wv(r,s,c,d,m,v){return Ws(s),s.updateQueue=null,c=j0(s,d,c,m),k0(r),d=sh(),r!==null&&!un?(ah(r,s,v),_i(r,s,v)):(ft&&d&&$f(s),s.flags|=1,kn(r,s,c,v),s.child)}function Sv(r,s,c,d,m){if(Ws(s),s.stateNode===null){var v=Pa,w=c.contextType;typeof w=="object"&&w!==null&&(v=Sn(w)),v=new c(d,v),s.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=_h,s.stateNode=v,v._reactInternals=s,v=s.stateNode,v.props=d,v.state=s.memoizedState,v.refs={},Xf(s),w=c.contextType,v.context=typeof w=="object"&&w!==null?Sn(w):Pa,v.state=s.memoizedState,w=c.getDerivedStateFromProps,typeof w=="function"&&(yh(s,c,w,d),v.state=s.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(w=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),w!==v.state&&_h.enqueueReplaceState(v,v.state,null),lo(s,d,v,m),ao(),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!0}else if(r===null){v=s.stateNode;var E=s.memoizedProps,U=ea(c,E);v.props=U;var te=v.context,oe=c.contextType;w=Pa,typeof oe=="object"&&oe!==null&&(w=Sn(oe));var ue=c.getDerivedStateFromProps;oe=typeof ue=="function"||typeof v.getSnapshotBeforeUpdate=="function",E=s.pendingProps!==E,oe||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(E||te!==w)&&cv(s,v,d,w),is=!1;var re=s.memoizedState;v.state=re,lo(s,d,v,m),ao(),te=s.memoizedState,E||re!==te||is?(typeof ue=="function"&&(yh(s,c,ue,d),te=s.memoizedState),(U=is||ov(s,c,U,d,re,te,w))?(oe||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(s.flags|=4194308)):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=d,s.memoizedState=te),v.props=d,v.state=te,v.context=w,d=U):(typeof v.componentDidMount=="function"&&(s.flags|=4194308),d=!1)}else{v=s.stateNode,Kf(r,s),w=s.memoizedProps,oe=ea(c,w),v.props=oe,ue=s.pendingProps,re=v.context,te=c.contextType,U=Pa,typeof te=="object"&&te!==null&&(U=Sn(te)),E=c.getDerivedStateFromProps,(te=typeof E=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(w!==ue||re!==U)&&cv(s,v,d,U),is=!1,re=s.memoizedState,v.state=re,lo(s,d,v,m),ao();var se=s.memoizedState;w!==ue||re!==se||is||r!==null&&r.dependencies!==null&&nu(r.dependencies)?(typeof E=="function"&&(yh(s,c,E,d),se=s.memoizedState),(oe=is||ov(s,c,oe,d,re,se,U)||r!==null&&r.dependencies!==null&&nu(r.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,se,U),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,se,U)),typeof v.componentDidUpdate=="function"&&(s.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),s.memoizedProps=d,s.memoizedState=se),v.props=d,v.state=se,v.context=U,d=oe):(typeof v.componentDidUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||w===r.memoizedProps&&re===r.memoizedState||(s.flags|=1024),d=!1)}return v=d,_u(r,s),d=(s.flags&128)!==0,v||d?(v=s.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),s.flags|=1,r!==null&&d?(s.child=Zs(s,r.child,null,m),s.child=Zs(s,null,c,m)):kn(r,s,c,m),s.memoizedState=v.state,r=s.child):r=_i(r,s,m),r}function kv(r,s,c,d){return Gs(),s.flags|=256,kn(r,s,c,d),s.child}var jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nh(r){return{baseLanes:r,cachePool:h0()}}function Ch(r,s,c){return r=r!==null?r.childLanes&~c:0,s&&(r|=ur),r}function jv(r,s,c){var d=s.pendingProps,m=!1,v=(s.flags&128)!==0,w;if((w=v)||(w=r!==null&&r.memoizedState===null?!1:(rn.current&2)!==0),w&&(m=!0,s.flags&=-129),w=(s.flags&32)!==0,s.flags&=-33,r===null){if(ft){if(m?ls(s):os(),(r=Ft)?(r=L1(r,Cr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(s.memoizedState={dehydrated:r,treeContext:es!==null?{id:ni,overflow:ri}:null,retryLane:536870912,hydrationErrors:null},c=i0(r),c.return=s,s.child=c,wn=s,Ft=null)):r=null,r===null)throw ns(s);return cp(r)?s.lanes=32:s.lanes=536870912,null}var E=d.children;return d=d.fallback,m?(os(),m=s.mode,E=wu({mode:"hidden",children:E},m),d=Vs(d,m,c,null),E.return=s,d.return=s,E.sibling=d,s.child=E,d=s.child,d.memoizedState=Nh(c),d.childLanes=Ch(r,w,c),s.memoizedState=jh,ho(null,d)):(ls(s),Eh(s,E))}var U=r.memoizedState;if(U!==null&&(E=U.dehydrated,E!==null)){if(v)s.flags&256?(ls(s),s.flags&=-257,s=Th(r,s,c)):s.memoizedState!==null?(os(),s.child=r.child,s.flags|=128,s=null):(os(),E=d.fallback,m=s.mode,d=wu({mode:"visible",children:d.children},m),E=Vs(E,m,c,null),E.flags|=2,d.return=s,E.return=s,d.sibling=E,s.child=d,Zs(s,r.child,null,c),d=s.child,d.memoizedState=Nh(c),d.childLanes=Ch(r,w,c),s.memoizedState=jh,s=ho(null,d));else if(ls(s),cp(E)){if(w=E.nextSibling&&E.nextSibling.dataset,w)var te=w.dgst;w=te,d=Error(i(419)),d.stack="",d.digest=w,eo({value:d,source:null,stack:null}),s=Th(r,s,c)}else if(un||Ha(r,s,c,!1),w=(c&r.childLanes)!==0,un||w){if(w=Lt,w!==null&&(d=Bl(w,c),d!==0&&d!==U.retryLane))throw U.retryLane=d,qs(r,d),Zn(w,r,d),Sh;op(E)||Mu(),s=Th(r,s,c)}else op(E)?(s.flags|=192,s.child=r.child,s=null):(r=U.treeContext,Ft=Tr(E.nextSibling),wn=s,ft=!0,ts=null,Cr=!1,r!==null&&l0(s,r),s=Eh(s,d.children),s.flags|=4096);return s}return m?(os(),E=d.fallback,m=s.mode,U=r.child,te=U.sibling,d=mi(U,{mode:"hidden",children:d.children}),d.subtreeFlags=U.subtreeFlags&65011712,te!==null?E=mi(te,E):(E=Vs(E,m,c,null),E.flags|=2),E.return=s,d.return=s,d.sibling=E,s.child=d,ho(null,d),d=s.child,E=r.child.memoizedState,E===null?E=Nh(c):(m=E.cachePool,m!==null?(U=on._currentValue,m=m.parent!==U?{parent:U,pool:U}:m):m=h0(),E={baseLanes:E.baseLanes|c,cachePool:m}),d.memoizedState=E,d.childLanes=Ch(r,w,c),s.memoizedState=jh,ho(r.child,d)):(ls(s),c=r.child,r=c.sibling,c=mi(c,{mode:"visible",children:d.children}),c.return=s,c.sibling=null,r!==null&&(w=s.deletions,w===null?(s.deletions=[r],s.flags|=16):w.push(r)),s.child=c,s.memoizedState=null,c)}function Eh(r,s){return s=wu({mode:"visible",children:s},r.mode),s.return=r,r.child=s}function wu(r,s){return r=ar(22,r,null,s),r.lanes=0,r}function Th(r,s,c){return Zs(s,r.child,null,c),r=Eh(s,s.pendingProps.children),r.flags|=2,s.memoizedState=null,r}function Nv(r,s,c){r.lanes|=s;var d=r.alternate;d!==null&&(d.lanes|=s),qf(r.return,s,c)}function Ah(r,s,c,d,m,v){var w=r.memoizedState;w===null?r.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:m,treeForkCount:v}:(w.isBackwards=s,w.rendering=null,w.renderingStartTime=0,w.last=d,w.tail=c,w.tailMode=m,w.treeForkCount=v)}function Cv(r,s,c){var d=s.pendingProps,m=d.revealOrder,v=d.tail;d=d.children;var w=rn.current,E=(w&2)!==0;if(E?(w=w&1|2,s.flags|=128):w&=1,M(rn,w),kn(r,s,d,c),d=ft?Jl:0,!E&&r!==null&&(r.flags&128)!==0)e:for(r=s.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Nv(r,c,s);else if(r.tag===19)Nv(r,c,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(c=s.child,m=null;c!==null;)r=c.alternate,r!==null&&uu(r)===null&&(m=c),c=c.sibling;c=m,c===null?(m=s.child,s.child=null):(m=c.sibling,c.sibling=null),Ah(s,!1,m,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=s.child,s.child=null;m!==null;){if(r=m.alternate,r!==null&&uu(r)===null){s.child=m;break}r=m.sibling,m.sibling=c,c=m,m=r}Ah(s,!0,c,null,v,d);break;case"together":Ah(s,!1,null,null,void 0,d);break;default:s.memoizedState=null}return s.child}function _i(r,s,c){if(r!==null&&(s.dependencies=r.dependencies),ds|=s.lanes,(c&s.childLanes)===0)if(r!==null){if(Ha(r,s,c,!1),(c&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,c=mi(r,r.pendingProps),s.child=c,c.return=s;r.sibling!==null;)r=r.sibling,c=c.sibling=mi(r,r.pendingProps),c.return=s;c.sibling=null}return s.child}function Mh(r,s){return(r.lanes&s)!==0?!0:(r=r.dependencies,!!(r!==null&&nu(r)))}function Ek(r,s,c){switch(s.tag){case 3:Le(s,s.stateNode.containerInfo),rs(s,on,r.memoizedState.cache),Gs();break;case 27:case 5:Je(s);break;case 4:Le(s,s.stateNode.containerInfo);break;case 10:rs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,nh(s),null;break;case 13:var d=s.memoizedState;if(d!==null)return d.dehydrated!==null?(ls(s),s.flags|=128,null):(c&s.child.childLanes)!==0?jv(r,s,c):(ls(s),r=_i(r,s,c),r!==null?r.sibling:null);ls(s);break;case 19:var m=(r.flags&128)!==0;if(d=(c&s.childLanes)!==0,d||(Ha(r,s,c,!1),d=(c&s.childLanes)!==0),m){if(d)return Cv(r,s,c);s.flags|=128}if(m=s.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),M(rn,rn.current),d)break;return null;case 22:return s.lanes=0,bv(r,s,c,s.pendingProps);case 24:rs(s,on,r.memoizedState.cache)}return _i(r,s,c)}function Ev(r,s,c){if(r!==null)if(r.memoizedProps!==s.pendingProps)un=!0;else{if(!Mh(r,c)&&(s.flags&128)===0)return un=!1,Ek(r,s,c);un=(r.flags&131072)!==0}else un=!1,ft&&(s.flags&1048576)!==0&&a0(s,Jl,s.index);switch(s.lanes=0,s.tag){case 16:e:{var d=s.pendingProps;if(r=Xs(s.elementType),s.type=r,typeof r=="function")Of(r)?(d=ea(r,d),s.tag=1,s=Sv(null,s,r,d,c)):(s.tag=0,s=kh(null,s,r,d,c));else{if(r!=null){var m=r.$$typeof;if(m===L){s.tag=11,s=gv(null,s,r,d,c);break e}else if(m===q){s.tag=14,s=xv(null,s,r,d,c);break e}}throw s=J(r)||r,Error(i(306,s,""))}}return s;case 0:return kh(r,s,s.type,s.pendingProps,c);case 1:return d=s.type,m=ea(d,s.pendingProps),Sv(r,s,d,m,c);case 3:e:{if(Le(s,s.stateNode.containerInfo),r===null)throw Error(i(387));d=s.pendingProps;var v=s.memoizedState;m=v.element,Kf(r,s),lo(s,d,null,c);var w=s.memoizedState;if(d=w.cache,rs(s,on,d),d!==v.cache&&Vf(s,[on],c,!0),ao(),d=w.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:w.cache},s.updateQueue.baseState=v,s.memoizedState=v,s.flags&256){s=kv(r,s,d,c);break e}else if(d!==m){m=kr(Error(i(424)),s),eo(m),s=kv(r,s,d,c);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(Ft=Tr(r.firstChild),wn=s,ft=!0,ts=null,Cr=!0,c=b0(s,null,d,c),s.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(Gs(),d===m){s=_i(r,s,c);break e}kn(r,s,d,c)}s=s.child}return s;case 26:return _u(r,s),r===null?(c=$1(s.type,null,s.pendingProps,null))?s.memoizedState=c:ft||(c=s.type,r=s.pendingProps,d=Pu(je.current).createElement(c),d[Gt]=s,d[_n]=r,jn(d,c,r),Kt(d),s.stateNode=d):s.memoizedState=$1(s.type,r.memoizedProps,s.pendingProps,r.memoizedState),null;case 27:return Je(s),r===null&&ft&&(d=s.stateNode=O1(s.type,s.pendingProps,je.current),wn=s,Cr=!0,m=Ft,gs(s.type)?(up=m,Ft=Tr(d.firstChild)):Ft=m),kn(r,s,s.pendingProps.children,c),_u(r,s),r===null&&(s.flags|=4194304),s.child;case 5:return r===null&&ft&&((m=d=Ft)&&(d=ij(d,s.type,s.pendingProps,Cr),d!==null?(s.stateNode=d,wn=s,Ft=Tr(d.firstChild),Cr=!1,m=!0):m=!1),m||ns(s)),Je(s),m=s.type,v=s.pendingProps,w=r!==null?r.memoizedProps:null,d=v.children,sp(m,v)?d=null:w!==null&&sp(m,w)&&(s.flags|=32),s.memoizedState!==null&&(m=ih(r,s,bk,null,null,c),Eo._currentValue=m),_u(r,s),kn(r,s,d,c),s.child;case 6:return r===null&&ft&&((r=c=Ft)&&(c=sj(c,s.pendingProps,Cr),c!==null?(s.stateNode=c,wn=s,Ft=null,r=!0):r=!1),r||ns(s)),null;case 13:return jv(r,s,c);case 4:return Le(s,s.stateNode.containerInfo),d=s.pendingProps,r===null?s.child=Zs(s,null,d,c):kn(r,s,d,c),s.child;case 11:return gv(r,s,s.type,s.pendingProps,c);case 7:return kn(r,s,s.pendingProps,c),s.child;case 8:return kn(r,s,s.pendingProps.children,c),s.child;case 12:return kn(r,s,s.pendingProps.children,c),s.child;case 10:return d=s.pendingProps,rs(s,s.type,d.value),kn(r,s,d.children,c),s.child;case 9:return m=s.type._context,d=s.pendingProps.children,Ws(s),m=Sn(m),d=d(m),s.flags|=1,kn(r,s,d,c),s.child;case 14:return xv(r,s,s.type,s.pendingProps,c);case 15:return vv(r,s,s.type,s.pendingProps,c);case 19:return Cv(r,s,c);case 31:return Ck(r,s,c);case 22:return bv(r,s,c,s.pendingProps);case 24:return Ws(s),d=Sn(on),r===null?(m=Wf(),m===null&&(m=Lt,v=Gf(),m.pooledCache=v,v.refCount++,v!==null&&(m.pooledCacheLanes|=c),m=v),s.memoizedState={parent:d,cache:m},Xf(s),rs(s,on,m)):((r.lanes&c)!==0&&(Kf(r,s),lo(s,null,null,c),ao()),m=r.memoizedState,v=s.memoizedState,m.parent!==d?(m={parent:d,cache:d},s.memoizedState=m,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=m),rs(s,on,d)):(d=v.cache,rs(s,on,d),d!==m.cache&&Vf(s,[on],c,!0))),kn(r,s,s.pendingProps.children,c),s.child;case 29:throw s.pendingProps}throw Error(i(156,s.tag))}function wi(r){r.flags|=4}function Rh(r,s,c,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(t1())r.flags|=8192;else throw Ks=au,Qf}else r.flags&=-16777217}function Tv(r,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!q1(s))if(t1())r.flags|=8192;else throw Ks=au,Qf}function Su(r,s){s!==null&&(r.flags|=4),r.flags&16384&&(s=r.tag!==22?ln():536870912,r.lanes|=s,el|=s)}function po(r,s){if(!ft)switch(r.tailMode){case"hidden":s=r.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?s||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Ut(r){var s=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(s)for(var m=r.child;m!==null;)c|=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;)c|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=r,m=m.sibling;return r.subtreeFlags|=d,r.childLanes=c,s}function Tk(r,s,c){var d=s.pendingProps;switch(Ff(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ut(s),null;case 1:return Ut(s),null;case 3:return c=s.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),s.memoizedState.cache!==d&&(s.flags|=2048),vi(on),Be(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Ua(s)?wi(s):r===null||r.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,Hf())),Ut(s),null;case 26:var m=s.type,v=s.memoizedState;return r===null?(wi(s),v!==null?(Ut(s),Tv(s,v)):(Ut(s),Rh(s,m,null,d,c))):v?v!==r.memoizedState?(wi(s),Ut(s),Tv(s,v)):(Ut(s),s.flags&=-16777217):(r=r.memoizedProps,r!==d&&wi(s),Ut(s),Rh(s,m,r,d,c)),null;case 27:if(it(s),c=je.current,m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ut(s),null}r=de.current,Ua(s)?o0(s):(r=O1(m,d,c),s.stateNode=r,wi(s))}return Ut(s),null;case 5:if(it(s),m=s.type,r!==null&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(!d){if(s.stateNode===null)throw Error(i(166));return Ut(s),null}if(v=de.current,Ua(s))o0(s);else{var w=Pu(je.current);switch(v){case 1:v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":v=w.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":v=w.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":v=w.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?w.createElement("select",{is:d.is}):w.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?w.createElement(m,{is:d.is}):w.createElement(m)}}v[Gt]=s,v[_n]=d;e:for(w=s.child;w!==null;){if(w.tag===5||w.tag===6)v.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=v;e:switch(jn(v,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&&wi(s)}}return Ut(s),Rh(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==d&&wi(s);else{if(typeof d!="string"&&s.stateNode===null)throw Error(i(166));if(r=je.current,Ua(s)){if(r=s.stateNode,c=s.memoizedProps,d=null,m=wn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}r[Gt]=s,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||j1(r.nodeValue,c)),r||ns(s,!0)}else r=Pu(r).createTextNode(d),r[Gt]=s,s.stateNode=r}return Ut(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(d=Ua(s),c!==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 Gs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ut(s),r=!1}else c=Hf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(or(s),s):(or(s),null);if((s.flags&128)!==0)throw Error(i(558))}return Ut(s),null;case 13:if(d=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(m=Ua(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 Gs(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Ut(s),m=!1}else m=Hf(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=m),m=!0;if(!m)return s.flags&256?(or(s),s):(or(s),null)}return or(s),(s.flags&128)!==0?(s.lanes=c,s):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=s.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==m&&(d.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),Su(s,s.updateQueue),Ut(s),null);case 4:return Be(),r===null&&ep(s.stateNode.containerInfo),Ut(s),null;case 10:return vi(s.type),Ut(s),null;case 19:if(Z(rn),d=s.memoizedState,d===null)return Ut(s),null;if(m=(s.flags&128)!==0,v=d.rendering,v===null)if(m)po(d,!1);else{if(en!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(v=uu(r),v!==null){for(s.flags|=128,po(d,!1),r=v.updateQueue,s.updateQueue=r,Su(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)r0(c,r),c=c.sibling;return M(rn,rn.current&1|2),ft&&gi(s,d.treeForkCount),s.child}r=r.sibling}d.tail!==null&&Ee()>Eu&&(s.flags|=128,m=!0,po(d,!1),s.lanes=4194304)}else{if(!m)if(r=uu(v),r!==null){if(s.flags|=128,m=!0,r=r.updateQueue,s.updateQueue=r,Su(s,r),po(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!ft)return Ut(s),null}else 2*Ee()-d.renderingStartTime>Eu&&c!==536870912&&(s.flags|=128,m=!0,po(d,!1),s.lanes=4194304);d.isBackwards?(v.sibling=s.child,s.child=v):(r=d.last,r!==null?r.sibling=v:s.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=Ee(),r.sibling=null,c=rn.current,M(rn,m?c&1|2:c&1),ft&&gi(s,d.treeForkCount),r):(Ut(s),null);case 22:case 23:return or(s),th(),d=s.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(s.flags|=8192):d&&(s.flags|=8192),d?(c&536870912)!==0&&(s.flags&128)===0&&(Ut(s),s.subtreeFlags&6&&(s.flags|=8192)):Ut(s),c=s.updateQueue,c!==null&&Su(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(d=s.memoizedState.cachePool.pool),d!==c&&(s.flags|=2048),r!==null&&Z(Qs),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),vi(on),Ut(s),null;case 25:return null;case 30:return null}throw Error(i(156,s.tag))}function Ak(r,s){switch(Ff(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return vi(on),Be(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return it(s),null;case 31:if(s.memoizedState!==null){if(or(s),s.alternate===null)throw Error(i(340));Gs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(or(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Gs()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return Z(rn),null;case 4:return Be(),null;case 10:return vi(s.type),null;case 22:case 23:return or(s),th(),r!==null&&Z(Qs),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return vi(on),null;case 25:return null;default:return null}}function Av(r,s){switch(Ff(s),s.tag){case 3:vi(on),Be();break;case 26:case 27:case 5:it(s);break;case 4:Be();break;case 31:s.memoizedState!==null&&or(s);break;case 13:or(s);break;case 19:Z(rn);break;case 10:vi(s.type);break;case 22:case 23:or(s),th(),r!==null&&Z(Qs);break;case 24:vi(on)}}function mo(r,s){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&r)===r){d=void 0;var v=c.create,w=c.inst;d=v(),w.destroy=d}c=c.next}while(c!==m)}}catch(E){Nt(s,s.return,E)}}function cs(r,s,c){try{var d=s.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var v=m.next;d=v;do{if((d.tag&r)===r){var w=d.inst,E=w.destroy;if(E!==void 0){w.destroy=void 0,m=s;var U=c,te=E;try{te()}catch(oe){Nt(m,U,oe)}}}d=d.next}while(d!==v)}}catch(oe){Nt(s,s.return,oe)}}function Mv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{_0(s,c)}catch(d){Nt(r,r.return,d)}}}function Rv(r,s,c){c.props=ea(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Nt(r,s,d)}}function go(r,s){try{var c=r.ref;if(c!==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 c=="function"?r.refCleanup=c(d):c.current=d}}catch(m){Nt(r,s,m)}}function ii(r,s){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(m){Nt(r,s,m)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){Nt(r,s,m)}else c.current=null}function Lv(r){var s=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(m){Nt(r,r.return,m)}}function Lh(r,s,c){try{var d=r.stateNode;Zk(d,r.type,c,s),d[_n]=s}catch(m){Nt(r,r.return,m)}}function Dv(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&gs(r.type)||r.tag===4}function Dh(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Dv(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&&gs(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 zh(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,s):(s=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,s.appendChild(r),c=c._reactRootContainer,c!=null||s.onclick!==null||(s.onclick=yr));else if(d!==4&&(d===27&&gs(r.type)&&(c=r.stateNode,s=null),r=r.child,r!==null))for(zh(r,s,c),r=r.sibling;r!==null;)zh(r,s,c),r=r.sibling}function ku(r,s,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,s?c.insertBefore(r,s):c.appendChild(r);else if(d!==4&&(d===27&&gs(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(ku(r,s,c),r=r.sibling;r!==null;)ku(r,s,c),r=r.sibling}function zv(r){var s=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,m=s.attributes;m.length;)s.removeAttributeNode(m[0]);jn(s,d,c),s[Gt]=r,s[_n]=c}catch(v){Nt(r,r.return,v)}}var Si=!1,dn=!1,Oh=!1,Ov=typeof WeakSet=="function"?WeakSet:Set,yn=null;function Mk(r,s){if(r=r.containerInfo,rp=Vu,r=Wx(r),Tf(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var m=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var w=0,E=-1,U=-1,te=0,oe=0,ue=r,re=null;t:for(;;){for(var se;ue!==c||m!==0&&ue.nodeType!==3||(E=w+m),ue!==v||d!==0&&ue.nodeType!==3||(U=w+d),ue.nodeType===3&&(w+=ue.nodeValue.length),(se=ue.firstChild)!==null;)re=ue,ue=se;for(;;){if(ue===r)break t;if(re===c&&++te===m&&(E=w),re===v&&++oe===d&&(U=w),(se=ue.nextSibling)!==null)break;ue=re,re=ue.parentNode}ue=se}c=E===-1||U===-1?null:{start:E,end:U}}else c=null}c=c||{start:0,end:0}}else c=null;for(ip={focusedElem:r,selectionRange:c},Vu=!1,yn=s;yn!==null;)if(s=yn,r=s.child,(s.subtreeFlags&1028)!==0&&r!==null)r.return=s,yn=r;else for(;yn!==null;){switch(s=yn,v=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(c=0;c<r.length;c++)m=r[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=s,m=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Te=ea(c.type,m);r=d.getSnapshotBeforeUpdate(Te,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ue){Nt(c,c.return,Ue)}}break;case 3:if((r&1024)!==0){if(r=s.stateNode.containerInfo,c=r.nodeType,c===9)lp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":lp(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,yn=r;break}yn=s.return}}function Bv(r,s,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ji(r,c),d&4&&mo(5,c);break;case 1:if(ji(r,c),d&4)if(r=c.stateNode,s===null)try{r.componentDidMount()}catch(w){Nt(c,c.return,w)}else{var m=ea(c.type,s.memoizedProps);s=s.memoizedState;try{r.componentDidUpdate(m,s,r.__reactInternalSnapshotBeforeUpdate)}catch(w){Nt(c,c.return,w)}}d&64&&Mv(c),d&512&&go(c,c.return);break;case 3:if(ji(r,c),d&64&&(r=c.updateQueue,r!==null)){if(s=null,c.child!==null)switch(c.child.tag){case 27:case 5:s=c.child.stateNode;break;case 1:s=c.child.stateNode}try{_0(r,s)}catch(w){Nt(c,c.return,w)}}break;case 27:s===null&&d&4&&zv(c);case 26:case 5:ji(r,c),s===null&&d&4&&Lv(c),d&512&&go(c,c.return);break;case 12:ji(r,c);break;case 31:ji(r,c),d&4&&Fv(r,c);break;case 13:ji(r,c),d&4&&Uv(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=Fk.bind(null,c),aj(r,c))));break;case 22:if(d=c.memoizedState!==null||Si,!d){s=s!==null&&s.memoizedState!==null||dn,m=Si;var v=dn;Si=d,(dn=s)&&!v?Ni(r,c,(c.subtreeFlags&8772)!==0):ji(r,c),Si=m,dn=v}break;case 30:break;default:ji(r,c)}}function Pv(r){var s=r.alternate;s!==null&&(r.alternate=null,Pv(s)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(s=r.stateNode,s!==null&&Gi(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 Yt=null,Wn=!1;function ki(r,s,c){for(c=c.child;c!==null;)$v(r,s,c),c=c.sibling}function $v(r,s,c){if(wt&&typeof wt.onCommitFiberUnmount=="function")try{wt.onCommitFiberUnmount(rt,c)}catch{}switch(c.tag){case 26:dn||ii(c,s),ki(r,s,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:dn||ii(c,s);var d=Yt,m=Wn;gs(c.type)&&(Yt=c.stateNode,Wn=!1),ki(r,s,c),jo(c.stateNode),Yt=d,Wn=m;break;case 5:dn||ii(c,s);case 6:if(d=Yt,m=Wn,Yt=null,ki(r,s,c),Yt=d,Wn=m,Yt!==null)if(Wn)try{(Yt.nodeType===9?Yt.body:Yt.nodeName==="HTML"?Yt.ownerDocument.body:Yt).removeChild(c.stateNode)}catch(v){Nt(c,s,v)}else try{Yt.removeChild(c.stateNode)}catch(v){Nt(c,s,v)}break;case 18:Yt!==null&&(Wn?(r=Yt,M1(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),ol(r)):M1(Yt,c.stateNode));break;case 4:d=Yt,m=Wn,Yt=c.stateNode.containerInfo,Wn=!0,ki(r,s,c),Yt=d,Wn=m;break;case 0:case 11:case 14:case 15:cs(2,c,s),dn||cs(4,c,s),ki(r,s,c);break;case 1:dn||(ii(c,s),d=c.stateNode,typeof d.componentWillUnmount=="function"&&Rv(c,s,d)),ki(r,s,c);break;case 21:ki(r,s,c);break;case 22:dn=(d=dn)||c.memoizedState!==null,ki(r,s,c),dn=d;break;default:ki(r,s,c)}}function Fv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{ol(r)}catch(c){Nt(s,s.return,c)}}}function Uv(r,s){if(s.memoizedState===null&&(r=s.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{ol(r)}catch(c){Nt(s,s.return,c)}}function Rk(r){switch(r.tag){case 31:case 13:case 19:var s=r.stateNode;return s===null&&(s=r.stateNode=new Ov),s;case 22:return r=r.stateNode,s=r._retryCache,s===null&&(s=r._retryCache=new Ov),s;default:throw Error(i(435,r.tag))}}function ju(r,s){var c=Rk(r);s.forEach(function(d){if(!c.has(d)){c.add(d);var m=Uk.bind(null,r,d);d.then(m,m)}})}function Qn(r,s){var c=s.deletions;if(c!==null)for(var d=0;d<c.length;d++){var m=c[d],v=r,w=s,E=w;e:for(;E!==null;){switch(E.tag){case 27:if(gs(E.type)){Yt=E.stateNode,Wn=!1;break e}break;case 5:Yt=E.stateNode,Wn=!1;break e;case 3:case 4:Yt=E.stateNode.containerInfo,Wn=!0;break e}E=E.return}if(Yt===null)throw Error(i(160));$v(v,w,m),Yt=null,Wn=!1,v=m.alternate,v!==null&&(v.return=null),m.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)Hv(s,r),s=s.sibling}var Ir=null;function Hv(r,s){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:Qn(s,r),Xn(r),d&4&&(cs(3,r,r.return),mo(3,r),cs(5,r,r.return));break;case 1:Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),d&64&&Si&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var m=Ir;if(Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":v=m.getElementsByTagName("title")[0],(!v||v[Kr]||v[Gt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=m.createElement(d),m.head.insertBefore(v,m.querySelector("head > title"))),jn(v,d,c),v[Gt]=r,Kt(v),d=v;break e;case"link":var w=H1("link","href",m).get(d+(c.href||""));if(w){for(var E=0;E<w.length;E++)if(v=w[E],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){w.splice(E,1);break t}}v=m.createElement(d),jn(v,d,c),m.head.appendChild(v);break;case"meta":if(w=H1("meta","content",m).get(d+(c.content||""))){for(E=0;E<w.length;E++)if(v=w[E],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){w.splice(E,1);break t}}v=m.createElement(d),jn(v,d,c),m.head.appendChild(v);break;default:throw Error(i(468,d))}v[Gt]=r,Kt(v),d=v}r.stateNode=d}else I1(m,r.type,r.stateNode);else r.stateNode=U1(m,d,r.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?I1(m,r.type,r.stateNode):U1(m,d,r.memoizedProps)):d===null&&r.stateNode!==null&&Lh(r,r.memoizedProps,c.memoizedProps)}break;case 27:Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),c!==null&&d&4&&Lh(r,r.memoizedProps,c.memoizedProps);break;case 5:if(Qn(s,r),Xn(r),d&512&&(dn||c===null||ii(c,c.return)),r.flags&32){m=r.stateNode;try{Qi(m,"")}catch(Te){Nt(r,r.return,Te)}}d&4&&r.stateNode!=null&&(m=r.memoizedProps,Lh(r,m,c!==null?c.memoizedProps:m)),d&1024&&(Oh=!0);break;case 6:if(Qn(s,r),Xn(r),d&4){if(r.stateNode===null)throw Error(i(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(Te){Nt(r,r.return,Te)}}break;case 3:if(Uu=null,m=Ir,Ir=$u(s.containerInfo),Qn(s,r),Ir=m,Xn(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{ol(s.containerInfo)}catch(Te){Nt(r,r.return,Te)}Oh&&(Oh=!1,Iv(r));break;case 4:d=Ir,Ir=$u(r.stateNode.containerInfo),Qn(s,r),Xn(r),Ir=d;break;case 12:Qn(s,r),Xn(r);break;case 31:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 13:Qn(s,r),Xn(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Cu=Ee()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 22:m=r.memoizedState!==null;var U=c!==null&&c.memoizedState!==null,te=Si,oe=dn;if(Si=te||m,dn=oe||U,Qn(s,r),dn=oe,Si=te,Xn(r),d&8192)e:for(s=r.stateNode,s._visibility=m?s._visibility&-2:s._visibility|1,m&&(c===null||U||Si||dn||ta(r)),c=null,s=r;;){if(s.tag===5||s.tag===26){if(c===null){U=c=s;try{if(v=U.stateNode,m)w=v.style,typeof w.setProperty=="function"?w.setProperty("display","none","important"):w.display="none";else{E=U.stateNode;var ue=U.memoizedProps.style,re=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;E.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Te){Nt(U,U.return,Te)}}}else if(s.tag===6){if(c===null){U=s;try{U.stateNode.nodeValue=m?"":U.memoizedProps}catch(Te){Nt(U,U.return,Te)}}}else if(s.tag===18){if(c===null){U=s;try{var se=U.stateNode;m?R1(se,!0):R1(U.stateNode,!1)}catch(Te){Nt(U,U.return,Te)}}}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;c===s&&(c=null),s=s.return}c===s&&(c=null),s.sibling.return=s.return,s=s.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,ju(r,c))));break;case 19:Qn(s,r),Xn(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,ju(r,d)));break;case 30:break;case 21:break;default:Qn(s,r),Xn(r)}}function Xn(r){var s=r.flags;if(s&2){try{for(var c,d=r.return;d!==null;){if(Dv(d)){c=d;break}d=d.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,v=Dh(r);ku(r,v,m);break;case 5:var w=c.stateNode;c.flags&32&&(Qi(w,""),c.flags&=-33);var E=Dh(r);ku(r,E,w);break;case 3:case 4:var U=c.stateNode.containerInfo,te=Dh(r);zh(r,te,U);break;default:throw Error(i(161))}}catch(oe){Nt(r,r.return,oe)}r.flags&=-3}s&4096&&(r.flags&=-4097)}function Iv(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var s=r;Iv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),r=r.sibling}}function ji(r,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Bv(r,s.alternate,s),s=s.sibling}function ta(r){for(r=r.child;r!==null;){var s=r;switch(s.tag){case 0:case 11:case 14:case 15:cs(4,s,s.return),ta(s);break;case 1:ii(s,s.return);var c=s.stateNode;typeof c.componentWillUnmount=="function"&&Rv(s,s.return,c),ta(s);break;case 27:jo(s.stateNode);case 26:case 5:ii(s,s.return),ta(s);break;case 22:s.memoizedState===null&&ta(s);break;case 30:ta(s);break;default:ta(s)}r=r.sibling}}function Ni(r,s,c){for(c=c&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var d=s.alternate,m=r,v=s,w=v.flags;switch(v.tag){case 0:case 11:case 15:Ni(m,v,c),mo(4,v);break;case 1:if(Ni(m,v,c),d=v,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){Nt(d,d.return,te)}if(d=v,m=d.updateQueue,m!==null){var E=d.stateNode;try{var U=m.shared.hiddenCallbacks;if(U!==null)for(m.shared.hiddenCallbacks=null,m=0;m<U.length;m++)y0(U[m],E)}catch(te){Nt(d,d.return,te)}}c&&w&64&&Mv(v),go(v,v.return);break;case 27:zv(v);case 26:case 5:Ni(m,v,c),c&&d===null&&w&4&&Lv(v),go(v,v.return);break;case 12:Ni(m,v,c);break;case 31:Ni(m,v,c),c&&w&4&&Fv(m,v);break;case 13:Ni(m,v,c),c&&w&4&&Uv(m,v);break;case 22:v.memoizedState===null&&Ni(m,v,c),go(v,v.return);break;case 30:break;default:Ni(m,v,c)}s=s.sibling}}function Bh(r,s){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(r=s.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&to(c))}function Ph(r,s){r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r))}function qr(r,s,c,d){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)qv(r,s,c,d),s=s.sibling}function qv(r,s,c,d){var m=s.flags;switch(s.tag){case 0:case 11:case 15:qr(r,s,c,d),m&2048&&mo(9,s);break;case 1:qr(r,s,c,d);break;case 3:qr(r,s,c,d),m&2048&&(r=null,s.alternate!==null&&(r=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==r&&(s.refCount++,r!=null&&to(r)));break;case 12:if(m&2048){qr(r,s,c,d),r=s.stateNode;try{var v=s.memoizedProps,w=v.id,E=v.onPostCommit;typeof E=="function"&&E(w,s.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(U){Nt(s,s.return,U)}}else qr(r,s,c,d);break;case 31:qr(r,s,c,d);break;case 13:qr(r,s,c,d);break;case 23:break;case 22:v=s.stateNode,w=s.alternate,s.memoizedState!==null?v._visibility&2?qr(r,s,c,d):xo(r,s):v._visibility&2?qr(r,s,c,d):(v._visibility|=2,Ka(r,s,c,d,(s.subtreeFlags&10256)!==0||!1)),m&2048&&Bh(w,s);break;case 24:qr(r,s,c,d),m&2048&&Ph(s.alternate,s);break;default:qr(r,s,c,d)}}function Ka(r,s,c,d,m){for(m=m&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var v=r,w=s,E=c,U=d,te=w.flags;switch(w.tag){case 0:case 11:case 15:Ka(v,w,E,U,m),mo(8,w);break;case 23:break;case 22:var oe=w.stateNode;w.memoizedState!==null?oe._visibility&2?Ka(v,w,E,U,m):xo(v,w):(oe._visibility|=2,Ka(v,w,E,U,m)),m&&te&2048&&Bh(w.alternate,w);break;case 24:Ka(v,w,E,U,m),m&&te&2048&&Ph(w.alternate,w);break;default:Ka(v,w,E,U,m)}s=s.sibling}}function xo(r,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var c=r,d=s,m=d.flags;switch(d.tag){case 22:xo(c,d),m&2048&&Bh(d.alternate,d);break;case 24:xo(c,d),m&2048&&Ph(d.alternate,d);break;default:xo(c,d)}s=s.sibling}}var vo=8192;function Za(r,s,c){if(r.subtreeFlags&vo)for(r=r.child;r!==null;)Vv(r,s,c),r=r.sibling}function Vv(r,s,c){switch(r.tag){case 26:Za(r,s,c),r.flags&vo&&r.memoizedState!==null&&vj(c,Ir,r.memoizedState,r.memoizedProps);break;case 5:Za(r,s,c);break;case 3:case 4:var d=Ir;Ir=$u(r.stateNode.containerInfo),Za(r,s,c),Ir=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vo,vo=16777216,Za(r,s,c),vo=d):Za(r,s,c));break;default:Za(r,s,c)}}function Gv(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 bo(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];yn=d,Wv(d,r)}Gv(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)Yv(r),r=r.sibling}function Yv(r){switch(r.tag){case 0:case 11:case 15:bo(r),r.flags&2048&&cs(9,r,r.return);break;case 3:bo(r);break;case 12:bo(r);break;case 22:var s=r.stateNode;r.memoizedState!==null&&s._visibility&2&&(r.return===null||r.return.tag!==13)?(s._visibility&=-3,Nu(r)):bo(r);break;default:bo(r)}}function Nu(r){var s=r.deletions;if((r.flags&16)!==0){if(s!==null)for(var c=0;c<s.length;c++){var d=s[c];yn=d,Wv(d,r)}Gv(r)}for(r=r.child;r!==null;){switch(s=r,s.tag){case 0:case 11:case 15:cs(8,s,s.return),Nu(s);break;case 22:c=s.stateNode,c._visibility&2&&(c._visibility&=-3,Nu(s));break;default:Nu(s)}r=r.sibling}}function Wv(r,s){for(;yn!==null;){var c=yn;switch(c.tag){case 0:case 11:case 15:cs(8,c,s);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:to(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,yn=d;else e:for(c=r;yn!==null;){d=yn;var m=d.sibling,v=d.return;if(Pv(d),d===c){yn=null;break e}if(m!==null){m.return=v,yn=m;break e}yn=v}}}var Lk={getCacheForType:function(r){var s=Sn(on),c=s.data.get(r);return c===void 0&&(c=r(),s.data.set(r,c)),c},cacheSignal:function(){return Sn(on).controller.signal}},Dk=typeof WeakMap=="function"?WeakMap:Map,_t=0,Lt=null,at=null,ut=0,jt=0,cr=null,us=!1,Ja=!1,$h=!1,Ci=0,en=0,ds=0,na=0,Fh=0,ur=0,el=0,yo=null,Kn=null,Uh=!1,Cu=0,Qv=0,Eu=1/0,Tu=null,fs=null,bn=0,hs=null,tl=null,Ei=0,Hh=0,Ih=null,Xv=null,_o=0,qh=null;function dr(){return(_t&2)!==0&&ut!==0?ut&-ut:B.T!==null?Xh():Pl()}function Kv(){if(ur===0)if((ut&536870912)===0||ft){var r=$r;$r<<=1,($r&3932160)===0&&($r=262144),ur=r}else ur=536870912;return r=lr.current,r!==null&&(r.flags|=32),ur}function Zn(r,s,c){(r===Lt&&(jt===2||jt===9)||r.cancelPendingCommit!==null)&&(nl(r,0),ps(r,ut,ur,!1)),Pt(r,c),((_t&2)===0||r!==Lt)&&(r===Lt&&((_t&2)===0&&(na|=c),en===4&&ps(r,ut,ur,!1)),si(r))}function Zv(r,s,c){if((_t&6)!==0)throw Error(i(327));var d=!c&&(s&127)===0&&(s&r.expiredLanes)===0||Xe(r,s),m=d?Bk(r,s):Gh(r,s,!0),v=d;do{if(m===0){Ja&&!d&&ps(r,s,0,!1);break}else{if(c=r.current.alternate,v&&!zk(c)){m=Gh(r,s,!1),v=!1;continue}if(m===2){if(v=s,r.errorRecoveryDisabledLanes&v)var w=0;else w=r.pendingLanes&-536870913,w=w!==0?w:w&536870912?536870912:0;if(w!==0){s=w;e:{var E=r;m=yo;var U=E.current.memoizedState.isDehydrated;if(U&&(nl(E,w).flags|=256),w=Gh(E,w,!1),w!==2){if($h&&!U){E.errorRecoveryDisabledLanes|=v,na|=v,m=4;break e}v=Kn,Kn=m,v!==null&&(Kn===null?Kn=v:Kn.push.apply(Kn,v))}m=w}if(v=!1,m!==2)continue}}if(m===1){nl(r,0),ps(r,s,0,!0);break}e:{switch(d=r,v=m,v){case 0:case 1:throw Error(i(345));case 4:if((s&4194048)!==s)break;case 6:ps(d,s,ur,!us);break e;case 2:Kn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((s&62914560)===s&&(m=Cu+300-Ee(),10<m)){if(ps(d,s,ur,!us),ve(d,0,!0)!==0)break e;Ei=s,d.timeoutHandle=T1(Jv.bind(null,d,c,Kn,Tu,Uh,s,ur,na,el,us,v,"Throttled",-0,0),m);break e}Jv(d,c,Kn,Tu,Uh,s,ur,na,el,us,v,null,-0,0)}}break}while(!0);si(r)}function Jv(r,s,c,d,m,v,w,E,U,te,oe,ue,re,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:yr},Vv(s,v,ue);var Te=(v&62914560)===v?Cu-Ee():(v&4194048)===v?Qv-Ee():0;if(Te=bj(ue,Te),Te!==null){Ei=v,r.cancelPendingCommit=Te(l1.bind(null,r,s,v,c,d,m,w,E,U,oe,ue,null,re,se)),ps(r,v,w,!te);return}}l1(r,s,v,c,d,m,w,E,U)}function zk(r){for(var s=r;;){var c=s.tag;if((c===0||c===11||c===15)&&s.flags&16384&&(c=s.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var m=c[d],v=m.getSnapshot;m=m.value;try{if(!sr(v(),m))return!1}catch{return!1}}if(c=s.child,s.subtreeFlags&16384&&c!==null)c.return=s,s=c;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 ps(r,s,c,d){s&=~Fh,s&=~na,r.suspendedLanes|=s,r.pingedLanes&=~s,d&&(r.warmLanes|=s),d=r.expirationTimes;for(var m=s;0<m;){var v=31-et(m),w=1<<v;d[v]=-1,m&=~w}c!==0&&xr(r,c,s)}function Au(){return(_t&6)===0?(wo(0),!1):!0}function Vh(){if(at!==null){if(jt===0)var r=at.return;else r=at,xi=Ys=null,lh(r),Ga=null,ro=0,r=at;for(;r!==null;)Av(r.alternate,r),r=r.return;at=null}}function nl(r,s){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,tj(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),Ei=0,Vh(),Lt=r,at=c=mi(r.current,null),ut=s,jt=0,cr=null,us=!1,Ja=Xe(r,s),$h=!1,el=ur=Fh=na=ds=en=0,Kn=yo=null,Uh=!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-et(d),v=1<<m;s|=r[m],d&=~v}return Ci=s,Kc(),c}function e1(r,s){Ze=null,B.H=fo,s===Va||s===su?(s=g0(),jt=3):s===Qf?(s=g0(),jt=4):jt=s===Sh?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,cr=s,at===null&&(en=1,bu(r,kr(s,r.current)))}function t1(){var r=lr.current;return r===null?!0:(ut&4194048)===ut?Er===null:(ut&62914560)===ut||(ut&536870912)!==0?r===Er:!1}function n1(){var r=B.H;return B.H=fo,r===null?fo:r}function r1(){var r=B.A;return B.A=Lk,r}function Mu(){en=4,us||(ut&4194048)!==ut&&lr.current!==null||(Ja=!0),(ds&134217727)===0&&(na&134217727)===0||Lt===null||ps(Lt,ut,ur,!1)}function Gh(r,s,c){var d=_t;_t|=2;var m=n1(),v=r1();(Lt!==r||ut!==s)&&(Tu=null,nl(r,s)),s=!1;var w=en;e:do try{if(jt!==0&&at!==null){var E=at,U=cr;switch(jt){case 8:Vh(),w=6;break e;case 3:case 2:case 9:case 6:lr.current===null&&(s=!0);var te=jt;if(jt=0,cr=null,rl(r,E,U,te),c&&Ja){w=0;break e}break;default:te=jt,jt=0,cr=null,rl(r,E,U,te)}}Ok(),w=en;break}catch(oe){e1(r,oe)}while(!0);return s&&r.shellSuspendCounter++,xi=Ys=null,_t=d,B.H=m,B.A=v,at===null&&(Lt=null,ut=0,Kc()),w}function Ok(){for(;at!==null;)i1(at)}function Bk(r,s){var c=_t;_t|=2;var d=n1(),m=r1();Lt!==r||ut!==s?(Tu=null,Eu=Ee()+500,nl(r,s)):Ja=Xe(r,s);e:do try{if(jt!==0&&at!==null){s=at;var v=cr;t:switch(jt){case 1:jt=0,cr=null,rl(r,s,v,1);break;case 2:case 9:if(p0(v)){jt=0,cr=null,s1(s);break}s=function(){jt!==2&&jt!==9||Lt!==r||(jt=7),si(r)},v.then(s,s);break e;case 3:jt=7;break e;case 4:jt=5;break e;case 7:p0(v)?(jt=0,cr=null,s1(s)):(jt=0,cr=null,rl(r,s,v,7));break;case 5:var w=null;switch(at.tag){case 26:w=at.memoizedState;case 5:case 27:var E=at;if(w?q1(w):E.stateNode.complete){jt=0,cr=null;var U=E.sibling;if(U!==null)at=U;else{var te=E.return;te!==null?(at=te,Ru(te)):at=null}break t}}jt=0,cr=null,rl(r,s,v,5);break;case 6:jt=0,cr=null,rl(r,s,v,6);break;case 8:Vh(),en=6;break e;default:throw Error(i(462))}}Pk();break}catch(oe){e1(r,oe)}while(!0);return xi=Ys=null,B.H=d,B.A=m,_t=c,at!==null?0:(Lt=null,ut=0,Kc(),en)}function Pk(){for(;at!==null&&!ze();)i1(at)}function i1(r){var s=Ev(r.alternate,r,Ci);r.memoizedProps=r.pendingProps,s===null?Ru(r):at=s}function s1(r){var s=r,c=s.alternate;switch(s.tag){case 15:case 0:s=wv(c,s,s.pendingProps,s.type,void 0,ut);break;case 11:s=wv(c,s,s.pendingProps,s.type.render,s.ref,ut);break;case 5:lh(s);default:Av(c,s),s=at=r0(s,Ci),s=Ev(c,s,Ci)}r.memoizedProps=r.pendingProps,s===null?Ru(r):at=s}function rl(r,s,c,d){xi=Ys=null,lh(s),Ga=null,ro=0;var m=s.return;try{if(Nk(r,m,s,c,ut)){en=1,bu(r,kr(c,r.current)),at=null;return}}catch(v){if(m!==null)throw at=m,v;en=1,bu(r,kr(c,r.current)),at=null;return}s.flags&32768?(ft||d===1?r=!0:Ja||(ut&536870912)!==0?r=!1:(us=r=!0,(d===2||d===9||d===3||d===6)&&(d=lr.current,d!==null&&d.tag===13&&(d.flags|=16384))),a1(s,r)):Ru(s)}function Ru(r){var s=r;do{if((s.flags&32768)!==0){a1(s,us);return}r=s.return;var c=Tk(s.alternate,s,Ci);if(c!==null){at=c;return}if(s=s.sibling,s!==null){at=s;return}at=s=r}while(s!==null);en===0&&(en=5)}function a1(r,s){do{var c=Ak(r.alternate,r);if(c!==null){c.flags&=32767,at=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!s&&(r=r.sibling,r!==null)){at=r;return}at=r=c}while(r!==null);en=6,at=null}function l1(r,s,c,d,m,v,w,E,U){r.cancelPendingCommit=null;do Lu();while(bn!==0);if((_t&6)!==0)throw Error(i(327));if(s!==null){if(s===r.current)throw Error(i(177));if(v=s.lanes|s.childLanes,v|=Df,zn(r,c,v,w,E,U),r===Lt&&(at=Lt=null,ut=0),tl=s,hs=r,Ei=c,Hh=v,Ih=m,Xv=d,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,Hk(Q,function(){return f1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||d){d=B.T,B.T=null,m=F.p,F.p=2,w=_t,_t|=4;try{Mk(r,s,c)}finally{_t=w,F.p=m,B.T=d}}bn=1,o1(),c1(),u1()}}function o1(){if(bn===1){bn=0;var r=hs,s=tl,c=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||c){c=B.T,B.T=null;var d=F.p;F.p=2;var m=_t;_t|=4;try{Hv(s,r);var v=ip,w=Wx(r.containerInfo),E=v.focusedElem,U=v.selectionRange;if(w!==E&&E&&E.ownerDocument&&Yx(E.ownerDocument.documentElement,E)){if(U!==null&&Tf(E)){var te=U.start,oe=U.end;if(oe===void 0&&(oe=te),"selectionStart"in E)E.selectionStart=te,E.selectionEnd=Math.min(oe,E.value.length);else{var ue=E.ownerDocument||document,re=ue&&ue.defaultView||window;if(re.getSelection){var se=re.getSelection(),Te=E.textContent.length,Ue=Math.min(U.start,Te),At=U.end===void 0?Ue:Math.min(U.end,Te);!se.extend&&Ue>At&&(w=At,At=Ue,Ue=w);var K=Gx(E,Ue),V=Gx(E,At);if(K&&V&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==V.node||se.focusOffset!==V.offset)){var ee=ue.createRange();ee.setStart(K.node,K.offset),se.removeAllRanges(),Ue>At?(se.addRange(ee),se.extend(V.node,V.offset)):(ee.setEnd(V.node,V.offset),se.addRange(ee))}}}}for(ue=[],se=E;se=se.parentNode;)se.nodeType===1&&ue.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ue.length;E++){var ce=ue[E];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}Vu=!!rp,ip=rp=null}finally{_t=m,F.p=d,B.T=c}}r.current=s,bn=2}}function c1(){if(bn===2){bn=0;var r=hs,s=tl,c=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||c){c=B.T,B.T=null;var d=F.p;F.p=2;var m=_t;_t|=4;try{Bv(r,s.alternate,s)}finally{_t=m,F.p=d,B.T=c}}bn=3}}function u1(){if(bn===4||bn===3){bn=0,mt();var r=hs,s=tl,c=Ei,d=Xv;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?bn=5:(bn=0,tl=hs=null,d1(r,r.pendingLanes));var m=r.pendingLanes;if(m===0&&(fs=null),Ls(c),s=s.stateNode,wt&&typeof wt.onCommitFiberRoot=="function")try{wt.onCommitFiberRoot(rt,s,void 0,(s.current.flags&128)===128)}catch{}if(d!==null){s=B.T,m=F.p,F.p=2,B.T=null;try{for(var v=r.onRecoverableError,w=0;w<d.length;w++){var E=d[w];v(E.value,{componentStack:E.stack})}}finally{B.T=s,F.p=m}}(Ei&3)!==0&&Lu(),si(r),m=r.pendingLanes,(c&261930)!==0&&(m&42)!==0?r===qh?_o++:(_o=0,qh=r):_o=0,wo(0)}}function d1(r,s){(r.pooledCacheLanes&=s)===0&&(s=r.pooledCache,s!=null&&(r.pooledCache=null,to(s)))}function Lu(){return o1(),c1(),u1(),f1()}function f1(){if(bn!==5)return!1;var r=hs,s=Hh;Hh=0;var c=Ls(Ei),d=B.T,m=F.p;try{F.p=32>c?32:c,B.T=null,c=Ih,Ih=null;var v=hs,w=Ei;if(bn=0,tl=hs=null,Ei=0,(_t&6)!==0)throw Error(i(331));var E=_t;if(_t|=4,Yv(v.current),qv(v,v.current,w,c),_t=E,wo(0,!1),wt&&typeof wt.onPostCommitFiberRoot=="function")try{wt.onPostCommitFiberRoot(rt,v)}catch{}return!0}finally{F.p=m,B.T=d,d1(r,s)}}function h1(r,s,c){s=kr(c,s),s=wh(r.stateNode,s,2),r=as(r,s,2),r!==null&&(Pt(r,2),si(r))}function Nt(r,s,c){if(r.tag===3)h1(r,r,c);else for(;s!==null;){if(s.tag===3){h1(s,r,c);break}else if(s.tag===1){var d=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(fs===null||!fs.has(d))){r=kr(c,r),c=pv(2),d=as(s,c,2),d!==null&&(mv(c,d,s,r),Pt(d,2),si(d));break}}s=s.return}}function Yh(r,s,c){var d=r.pingCache;if(d===null){d=r.pingCache=new Dk;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(c)||($h=!0,m.add(c),r=$k.bind(null,r,s,c),s.then(r,r))}function $k(r,s,c){var d=r.pingCache;d!==null&&d.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Lt===r&&(ut&c)===c&&(en===4||en===3&&(ut&62914560)===ut&&300>Ee()-Cu?(_t&2)===0&&nl(r,0):Fh|=c,el===ut&&(el=0)),si(r)}function p1(r,s){s===0&&(s=ln()),r=qs(r,s),r!==null&&(Pt(r,s),si(r))}function Fk(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),p1(r,c)}function Uk(r,s){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,m=r.memoizedState;m!==null&&(c=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),p1(r,c)}function Hk(r,s){return mn(r,s)}var Du=null,il=null,Wh=!1,zu=!1,Qh=!1,ms=0;function si(r){r!==il&&r.next===null&&(il===null?Du=il=r:il=il.next=r),zu=!0,Wh||(Wh=!0,qk())}function wo(r,s){if(!Qh&&zu){Qh=!0;do for(var c=!1,d=Du;d!==null;){if(r!==0){var m=d.pendingLanes;if(m===0)var v=0;else{var w=d.suspendedLanes,E=d.pingedLanes;v=(1<<31-et(42|r)+1)-1,v&=m&~(w&~E),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,v1(d,v))}else v=ut,v=ve(d,d===Lt?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||Xe(d,v)||(c=!0,v1(d,v));d=d.next}while(c);Qh=!1}}function Ik(){m1()}function m1(){zu=Wh=!1;var r=0;ms!==0&&ej()&&(r=ms);for(var s=Ee(),c=null,d=Du;d!==null;){var m=d.next,v=g1(d,s);v===0?(d.next=null,c===null?Du=m:c.next=m,m===null&&(il=c)):(c=d,(r!==0||(v&3)!==0)&&(zu=!0)),d=m}bn!==0&&bn!==5||wo(r),ms!==0&&(ms=0)}function g1(r,s){for(var c=r.suspendedLanes,d=r.pingedLanes,m=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var w=31-et(v),E=1<<w,U=m[w];U===-1?((E&c)===0||(E&d)!==0)&&(m[w]=Bt(E,s)):U<=s&&(r.expiredLanes|=E),v&=~E}if(s=Lt,c=ut,c=ve(r,r===s?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===s&&(jt===2||jt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ke(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||Xe(r,c)){if(s=c&-c,s===r.callbackPriority)return s;switch(d!==null&&ke(d),Ls(c)){case 2:case 8:c=ye;break;case 32:c=Q;break;case 268435456:c=Me;break;default:c=Q}return d=x1.bind(null,r),c=mn(c,d),r.callbackPriority=s,r.callbackNode=c,s}return d!==null&&d!==null&&ke(d),r.callbackPriority=2,r.callbackNode=null,2}function x1(r,s){if(bn!==0&&bn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Lu()&&r.callbackNode!==c)return null;var d=ut;return d=ve(r,r===Lt?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Zv(r,d,s),g1(r,Ee()),r.callbackNode!=null&&r.callbackNode===c?x1.bind(null,r):null)}function v1(r,s){if(Lu())return null;Zv(r,s,!0)}function qk(){nj(function(){(_t&6)!==0?mn(le,Ik):m1()})}function Xh(){if(ms===0){var r=Ia;r===0&&(r=Pr,Pr<<=1,(Pr&261888)===0&&(Pr=256)),ms=r}return ms}function b1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Aa(""+r)}function y1(r,s){var c=s.ownerDocument.createElement("input");return c.name=s.name,c.value=s.value,r.id&&c.setAttribute("form",r.id),s.parentNode.insertBefore(c,s),r=new FormData(r),c.parentNode.removeChild(c),r}function Vk(r,s,c,d,m){if(s==="submit"&&c&&c.stateNode===m){var v=b1((m[_n]||null).action),w=d.submitter;w&&(s=(s=w[_n]||null)?b1(s.formAction):w.getAttribute("formAction"),s!==null&&(v=s,w=null));var E=new pi("action","action",null,d,m);r.push({event:E,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ms!==0){var U=w?y1(m,w):new FormData(m);gh(c,{pending:!0,data:U,method:m.method,action:v},null,U)}}else typeof v=="function"&&(E.preventDefault(),U=w?y1(m,w):new FormData(m),gh(c,{pending:!0,data:U,method:m.method,action:v},v,U))},currentTarget:m}]})}}for(var Kh=0;Kh<Lf.length;Kh++){var Zh=Lf[Kh],Gk=Zh.toLowerCase(),Yk=Zh[0].toUpperCase()+Zh.slice(1);Hr(Gk,"on"+Yk)}Hr(Kx,"onAnimationEnd"),Hr(Zx,"onAnimationIteration"),Hr(Jx,"onAnimationStart"),Hr("dblclick","onDoubleClick"),Hr("focusin","onFocus"),Hr("focusout","onBlur"),Hr(ck,"onTransitionRun"),Hr(uk,"onTransitionStart"),Hr(dk,"onTransitionCancel"),Hr(e0,"onTransitionEnd"),Jr("onMouseEnter",["mouseout","mouseover"]),Jr("onMouseLeave",["mouseout","mouseover"]),Jr("onPointerEnter",["pointerout","pointerover"]),Jr("onPointerLeave",["pointerout","pointerover"]),Fr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Fr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Fr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Fr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Fr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var So="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(" "),Wk=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(So));function _1(r,s){s=(s&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],m=d.event;d=d.listeners;e:{var v=void 0;if(s)for(var w=d.length-1;0<=w;w--){var E=d[w],U=E.instance,te=E.currentTarget;if(E=E.listener,U!==v&&m.isPropagationStopped())break e;v=E,m.currentTarget=te;try{v(m)}catch(oe){Xc(oe)}m.currentTarget=null,v=U}else for(w=0;w<d.length;w++){if(E=d[w],U=E.instance,te=E.currentTarget,E=E.listener,U!==v&&m.isPropagationStopped())break e;v=E,m.currentTarget=te;try{v(m)}catch(oe){Xc(oe)}m.currentTarget=null,v=U}}}}function lt(r,s){var c=s[Fl];c===void 0&&(c=s[Fl]=new Set);var d=r+"__bubble";c.has(d)||(w1(s,r,2,!1),c.add(d))}function Jh(r,s,c){var d=0;s&&(d|=4),w1(c,r,d,s)}var Ou="_reactListening"+Math.random().toString(36).slice(2);function ep(r){if(!r[Ou]){r[Ou]=!0,Gn.forEach(function(c){c!=="selectionchange"&&(Wk.has(c)||Jh(c,!1,r),Jh(c,!0,r))});var s=r.nodeType===9?r:r.ownerDocument;s===null||s[Ou]||(s[Ou]=!0,Jh("selectionchange",!1,s))}}function w1(r,s,c,d){switch(K1(s)){case 2:var m=wj;break;case 8:m=Sj;break;default:m=mp}c=m.bind(null,s,c,r),m=void 0,!Ra||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(m=!0),d?m!==void 0?r.addEventListener(s,c,{capture:!0,passive:m}):r.addEventListener(s,c,!0):m!==void 0?r.addEventListener(s,c,{passive:m}):r.addEventListener(s,c,!1)}function tp(r,s,c,d,m){var v=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 E=d.stateNode.containerInfo;if(E===m)break;if(w===4)for(w=d.return;w!==null;){var U=w.tag;if((U===3||U===4)&&w.stateNode.containerInfo===m)return;w=w.return}for(;E!==null;){if(w=hi(E),w===null)return;if(U=w.tag,U===5||U===6||U===26||U===27){d=v=w;continue e}E=E.parentNode}}d=d.return}Hc(function(){var te=v,oe=Ma(c),ue=[];e:{var re=t0.get(r);if(re!==void 0){var se=pi,Te=r;switch(r){case"keypress":if(st(c)===0)break e;case"keydown":case"keyup":se=US;break;case"focusin":Te="focus",se=ti;break;case"focusout":Te="blur",se=ti;break;case"beforeblur":case"afterblur":se=ti;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=kf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Vc;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=qS;break;case Kx:case Zx:case Jx:se=Wc;break;case e0:se=GS;break;case"scroll":case"scrollend":se=Ic;break;case"wheel":se=WS;break;case"copy":case"cut":case"paste":se=DS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=Rx;break;case"toggle":case"beforetoggle":se=XS}var Ue=(s&4)!==0,At=!Ue&&(r==="scroll"||r==="scrollend"),K=Ue?re!==null?re+"Capture":null:re;Ue=[];for(var V=te,ee;V!==null;){var ce=V;if(ee=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ee===null||K===null||(ce=$s(V,K),ce!=null&&Ue.push(ko(V,ce,ee))),At)break;V=V.return}0<Ue.length&&(re=new se(re,Te,null,c,oe),ue.push({event:re,listeners:Ue}))}}if((s&7)===0){e:{if(re=r==="mouseover"||r==="pointerover",se=r==="mouseout"||r==="pointerout",re&&c!==Xi&&(Te=c.relatedTarget||c.fromElement)&&(hi(Te)||Te[ir]))break e;if((se||re)&&(re=oe.window===oe?oe:(re=oe.ownerDocument)?re.defaultView||re.parentWindow:window,se?(Te=c.relatedTarget||c.toElement,se=te,Te=Te?hi(Te):null,Te!==null&&(At=o(Te),Ue=Te.tag,Te!==At||Ue!==5&&Ue!==27&&Ue!==6)&&(Te=null)):(se=null,Te=te),se!==Te)){if(Ue=kf,ce="onMouseLeave",K="onMouseEnter",V="mouse",(r==="pointerout"||r==="pointerover")&&(Ue=Rx,ce="onPointerLeave",K="onPointerEnter",V="pointer"),At=se==null?re:Os(se),ee=Te==null?re:Os(Te),re=new Ue(ce,V+"leave",se,c,oe),re.target=At,re.relatedTarget=ee,ce=null,hi(oe)===te&&(Ue=new Ue(K,V+"enter",Te,c,oe),Ue.target=ee,Ue.relatedTarget=At,ce=Ue),At=ce,se&&Te)t:{for(Ue=Qk,K=se,V=Te,ee=0,ce=K;ce;ce=Ue(ce))ee++;ce=0;for(var Pe=V;Pe;Pe=Ue(Pe))ce++;for(;0<ee-ce;)K=Ue(K),ee--;for(;0<ce-ee;)V=Ue(V),ce--;for(;ee--;){if(K===V||V!==null&&K===V.alternate){Ue=K;break t}K=Ue(K),V=Ue(V)}Ue=null}else Ue=null;se!==null&&S1(ue,re,se,Ue,!1),Te!==null&&At!==null&&S1(ue,At,Te,Ue,!0)}}e:{if(re=te?Os(te):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var vt=Fx;else if(Px(re))if(Ux)vt=ak;else{vt=ik;var De=rk}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Ta(te.elementType)&&(vt=Fx):vt=sk;if(vt&&(vt=vt(r,te))){$x(ue,vt,c,oe);break e}De&&De(r,re,te),r==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Ca(re,"number",re.value)}switch(De=te?Os(te):window,r){case"focusin":(Px(De)||De.contentEditable==="true")&&(za=De,Af=te,Zl=null);break;case"focusout":Zl=Af=za=null;break;case"mousedown":Mf=!0;break;case"contextmenu":case"mouseup":case"dragend":Mf=!1,Qx(ue,c,oe);break;case"selectionchange":if(ok)break;case"keydown":case"keyup":Qx(ue,c,oe)}var tt;if(Nf)e:{switch(r){case"compositionstart":var dt="onCompositionStart";break e;case"compositionend":dt="onCompositionEnd";break e;case"compositionupdate":dt="onCompositionUpdate";break e}dt=void 0}else Da?Ox(r,c)&&(dt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(dt="onCompositionStart");dt&&(Lx&&c.locale!=="ko"&&(Da||dt!=="onCompositionStart"?dt==="onCompositionEnd"&&Da&&(tt=gt()):(H=oe,fe="value"in H?H.value:H.textContent,Da=!0)),De=Bu(te,dt),0<De.length&&(dt=new Mx(dt,r,null,c,oe),ue.push({event:dt,listeners:De}),tt?dt.data=tt:(tt=Bx(c),tt!==null&&(dt.data=tt)))),(tt=ZS?JS(r,c):ek(r,c))&&(dt=Bu(te,"onBeforeInput"),0<dt.length&&(De=new Mx("onBeforeInput","beforeinput",null,c,oe),ue.push({event:De,listeners:dt}),De.data=tt)),Vk(ue,r,te,c,oe)}_1(ue,s)})}function ko(r,s,c){return{instance:r,listener:s,currentTarget:c}}function Bu(r,s){for(var c=s+"Capture",d=[];r!==null;){var m=r,v=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||v===null||(m=$s(r,c),m!=null&&d.unshift(ko(r,m,v)),m=$s(r,s),m!=null&&d.push(ko(r,m,v))),r.tag===3)return d;r=r.return}return[]}function Qk(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function S1(r,s,c,d,m){for(var v=s._reactName,w=[];c!==null&&c!==d;){var E=c,U=E.alternate,te=E.stateNode;if(E=E.tag,U!==null&&U===d)break;E!==5&&E!==26&&E!==27||te===null||(U=te,m?(te=$s(c,v),te!=null&&w.unshift(ko(c,te,U))):m||(te=$s(c,v),te!=null&&w.push(ko(c,te,U)))),c=c.return}w.length!==0&&r.push({event:s,listeners:w})}var Xk=/\r\n?/g,Kk=/\u0000|\uFFFD/g;function k1(r){return(typeof r=="string"?r:""+r).replace(Xk,`
|
|
49
|
+
`).replace(Kk,"")}function j1(r,s){return s=k1(s),k1(r)===s}function Tt(r,s,c,d,m,v){switch(c){case"children":typeof d=="string"?s==="body"||s==="textarea"&&d===""||Qi(r,d):(typeof d=="number"||typeof d=="bigint")&&s!=="body"&&Qi(r,""+d);break;case"className":ja(r,"class",d);break;case"tabIndex":ja(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":ja(r,c,d);break;case"style":$c(r,d,v);break;case"data":if(s!=="object"){ja(r,"data",d);break}case"src":case"href":if(d===""&&(s!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Aa(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"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 v=="function"&&(c==="formAction"?(s!=="input"&&Tt(r,s,"name",m.name,m,null),Tt(r,s,"formEncType",m.formEncType,m,null),Tt(r,s,"formMethod",m.formMethod,m,null),Tt(r,s,"formTarget",m.formTarget,m,null)):(Tt(r,s,"encType",m.encType,m,null),Tt(r,s,"method",m.method,m,null),Tt(r,s,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=Aa(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=yr);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}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}c=Aa(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);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(c,""+d):r.removeAttribute(c);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(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":lt("beforetoggle",r),lt("toggle",r),Bs(r,"popover",d);break;case"xlinkActuate":Ur(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ur(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ur(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ur(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ur(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ur(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ur(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Bs(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=Fc.get(c)||c,Bs(r,c,d))}}function np(r,s,c,d,m,v){switch(c){case"style":$c(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(m.children!=null)throw Error(i(60));r.innerHTML=c}}break;case"children":typeof d=="string"?Qi(r,d):(typeof d=="number"||typeof d=="bigint")&&Qi(r,""+d);break;case"onScroll":d!=null&<("scroll",r);break;case"onScrollEnd":d!=null&<("scrollend",r);break;case"onClick":d!=null&&(r.onclick=yr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ka.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),s=c.slice(2,m?c.length-7:void 0),v=r[_n]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(s,v,m),typeof d=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(s,d,m);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):Bs(r,c,d)}}}function jn(r,s,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":lt("error",r),lt("load",r);var d=!1,m=!1,v;for(v in c)if(c.hasOwnProperty(v)){var w=c[v];if(w!=null)switch(v){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Tt(r,s,v,w,c,null)}}m&&Tt(r,s,"srcSet",c.srcSet,c,null),d&&Tt(r,s,"src",c.src,c,null);return;case"input":lt("invalid",r);var E=v=w=m=null,U=null,te=null;for(d in c)if(c.hasOwnProperty(d)){var oe=c[d];if(oe!=null)switch(d){case"name":m=oe;break;case"type":w=oe;break;case"checked":U=oe;break;case"defaultChecked":te=oe;break;case"value":v=oe;break;case"defaultValue":E=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,s));break;default:Tt(r,s,d,oe,c,null)}}Bc(r,v,E,U,te,w,m,!1);return;case"select":lt("invalid",r),d=w=v=null;for(m in c)if(c.hasOwnProperty(m)&&(E=c[m],E!=null))switch(m){case"value":v=E;break;case"defaultValue":w=E;break;case"multiple":d=E;default:Tt(r,s,m,E,c,null)}s=v,c=w,r.multiple=!!d,s!=null?Wi(r,!!d,s,!1):c!=null&&Wi(r,!!d,c,!0);return;case"textarea":lt("invalid",r),v=m=d=null;for(w in c)if(c.hasOwnProperty(w)&&(E=c[w],E!=null))switch(w){case"value":d=E;break;case"defaultValue":m=E;break;case"children":v=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(i(91));break;default:Tt(r,s,w,E,c,null)}ql(r,d,m,v);return;case"option":for(U in c)if(c.hasOwnProperty(U)&&(d=c[U],d!=null))switch(U){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Tt(r,s,U,d,c,null)}return;case"dialog":lt("beforetoggle",r),lt("toggle",r),lt("cancel",r),lt("close",r);break;case"iframe":case"object":lt("load",r);break;case"video":case"audio":for(d=0;d<So.length;d++)lt(So[d],r);break;case"image":lt("error",r),lt("load",r);break;case"details":lt("toggle",r);break;case"embed":case"source":case"link":lt("error",r),lt("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(te in c)if(c.hasOwnProperty(te)&&(d=c[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,s));default:Tt(r,s,te,d,c,null)}return;default:if(Ta(s)){for(oe in c)c.hasOwnProperty(oe)&&(d=c[oe],d!==void 0&&np(r,s,oe,d,c,void 0));return}}for(E in c)c.hasOwnProperty(E)&&(d=c[E],d!=null&&Tt(r,s,E,d,c,null))}function Zk(r,s,c,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,v=null,w=null,E=null,U=null,te=null,oe=null;for(se in c){var ue=c[se];if(c.hasOwnProperty(se)&&ue!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":U=ue;default:d.hasOwnProperty(se)||Tt(r,s,se,null,d,ue)}}for(var re in d){var se=d[re];if(ue=c[re],d.hasOwnProperty(re)&&(se!=null||ue!=null))switch(re){case"type":v=se;break;case"name":m=se;break;case"checked":te=se;break;case"defaultChecked":oe=se;break;case"value":w=se;break;case"defaultValue":E=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,s));break;default:se!==ue&&Tt(r,s,re,se,d,ue)}}Ps(r,w,E,U,te,oe,v,m);return;case"select":se=w=E=re=null;for(v in c)if(U=c[v],c.hasOwnProperty(v)&&U!=null)switch(v){case"value":break;case"multiple":se=U;default:d.hasOwnProperty(v)||Tt(r,s,v,null,d,U)}for(m in d)if(v=d[m],U=c[m],d.hasOwnProperty(m)&&(v!=null||U!=null))switch(m){case"value":re=v;break;case"defaultValue":E=v;break;case"multiple":w=v;default:v!==U&&Tt(r,s,m,v,d,U)}s=E,c=w,d=se,re!=null?Wi(r,!!c,re,!1):!!d!=!!c&&(s!=null?Wi(r,!!c,s,!0):Wi(r,!!c,c?[]:"",!1));return;case"textarea":se=re=null;for(E in c)if(m=c[E],c.hasOwnProperty(E)&&m!=null&&!d.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Tt(r,s,E,null,d,m)}for(w in d)if(m=d[w],v=c[w],d.hasOwnProperty(w)&&(m!=null||v!=null))switch(w){case"value":re=m;break;case"defaultValue":se=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==v&&Tt(r,s,w,m,d,v)}Ea(r,re,se);return;case"option":for(var Te in c)if(re=c[Te],c.hasOwnProperty(Te)&&re!=null&&!d.hasOwnProperty(Te))switch(Te){case"selected":r.selected=!1;break;default:Tt(r,s,Te,null,d,re)}for(U in d)if(re=d[U],se=c[U],d.hasOwnProperty(U)&&re!==se&&(re!=null||se!=null))switch(U){case"selected":r.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:Tt(r,s,U,re,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 c)re=c[Ue],c.hasOwnProperty(Ue)&&re!=null&&!d.hasOwnProperty(Ue)&&Tt(r,s,Ue,null,d,re);for(te in d)if(re=d[te],se=c[te],d.hasOwnProperty(te)&&re!==se&&(re!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,s));break;default:Tt(r,s,te,re,d,se)}return;default:if(Ta(s)){for(var At in c)re=c[At],c.hasOwnProperty(At)&&re!==void 0&&!d.hasOwnProperty(At)&&np(r,s,At,void 0,d,re);for(oe in d)re=d[oe],se=c[oe],!d.hasOwnProperty(oe)||re===se||re===void 0&&se===void 0||np(r,s,oe,re,d,se);return}}for(var K in c)re=c[K],c.hasOwnProperty(K)&&re!=null&&!d.hasOwnProperty(K)&&Tt(r,s,K,null,d,re);for(ue in d)re=d[ue],se=c[ue],!d.hasOwnProperty(ue)||re===se||re==null&&se==null||Tt(r,s,ue,re,d,se)}function N1(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Jk(){if(typeof performance.getEntriesByType=="function"){for(var r=0,s=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var m=c[d],v=m.transferSize,w=m.initiatorType,E=m.duration;if(v&&E&&N1(w)){for(w=0,E=m.responseEnd,d+=1;d<c.length;d++){var U=c[d],te=U.startTime;if(te>E)break;var oe=U.transferSize,ue=U.initiatorType;oe&&N1(ue)&&(U=U.responseEnd,w+=oe*(U<E?1:(E-te)/(U-te)))}if(--d,s+=8*(v+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 rp=null,ip=null;function Pu(r){return r.nodeType===9?r:r.ownerDocument}function C1(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 E1(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 sp(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 ap=null;function ej(){var r=window.event;return r&&r.type==="popstate"?r===ap?!1:(ap=r,!0):(ap=null,!1)}var T1=typeof setTimeout=="function"?setTimeout:void 0,tj=typeof clearTimeout=="function"?clearTimeout:void 0,A1=typeof Promise=="function"?Promise:void 0,nj=typeof queueMicrotask=="function"?queueMicrotask:typeof A1<"u"?function(r){return A1.resolve(null).then(r).catch(rj)}:T1;function rj(r){setTimeout(function(){throw r})}function gs(r){return r==="head"}function M1(r,s){var c=s,d=0;do{var m=c.nextSibling;if(r.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(m),ol(s);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")jo(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,jo(c);for(var v=c.firstChild;v;){var w=v.nextSibling,E=v.nodeName;v[Kr]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=w}}else c==="body"&&jo(r.ownerDocument.body);c=m}while(c);ol(s)}function R1(r,s){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?s?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(s?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function lp(r){var s=r.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var c=s;switch(s=s.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":lp(c),Gi(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function ij(r,s,c,d){for(;r.nodeType===1;){var m=c;if(r.nodeName.toLowerCase()!==s.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Kr])switch(s){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==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(v=r.getAttribute("src"),(v!==(m.src==null?null:m.src)||r.getAttribute("type")!==(m.type==null?null:m.type)||r.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(s==="input"&&r.type==="hidden"){var v=m.name==null?null:""+m.name;if(m.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=Tr(r.nextSibling),r===null)break}return null}function sj(r,s,c){if(s==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=Tr(r.nextSibling),r===null))return null;return r}function L1(r,s){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!s||(r=Tr(r.nextSibling),r===null))return null;return r}function op(r){return r.data==="$?"||r.data==="$~"}function cp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function aj(r,s){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=s;else if(r.data!=="$?"||c.readyState!=="loading")s();else{var d=function(){s(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function Tr(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 up=null;function D1(r){r=r.nextSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(s===0)return Tr(r.nextSibling);s--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||s++}r=r.nextSibling}return null}function z1(r){r=r.previousSibling;for(var s=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(s===0)return r;s--}else c!=="/$"&&c!=="/&"||s++}r=r.previousSibling}return null}function O1(r,s,c){switch(s=Pu(c),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 jo(r){for(var s=r.attributes;s.length;)r.removeAttributeNode(s[0]);Gi(r)}var Ar=new Map,B1=new Set;function $u(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Ti=F.d;F.d={f:lj,r:oj,D:cj,C:uj,L:dj,m:fj,X:pj,S:hj,M:mj};function lj(){var r=Ti.f(),s=Au();return r||s}function oj(r){var s=Vn(r);s!==null&&s.tag===5&&s.type==="form"?ev(s):Ti.r(r)}var sl=typeof document>"u"?null:document;function P1(r,s,c){var d=sl;if(d&&typeof s=="string"&&s){var m=nn(s);m='link[rel="'+r+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),B1.has(m)||(B1.add(m),r={rel:r,crossOrigin:c,href:s},d.querySelector(m)===null&&(s=d.createElement("link"),jn(s,"link",r),Kt(s),d.head.appendChild(s)))}}function cj(r){Ti.D(r),P1("dns-prefetch",r,null)}function uj(r,s){Ti.C(r,s),P1("preconnect",r,s)}function dj(r,s,c){Ti.L(r,s,c);var d=sl;if(d&&r&&s){var m='link[rel="preload"][as="'+nn(s)+'"]';s==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+nn(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+nn(c.imageSizes)+'"]')):m+='[href="'+nn(r)+'"]';var v=m;switch(s){case"style":v=al(r);break;case"script":v=ll(r)}Ar.has(v)||(r=x({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Ar.set(v,r),d.querySelector(m)!==null||s==="style"&&d.querySelector(No(v))||s==="script"&&d.querySelector(Co(v))||(s=d.createElement("link"),jn(s,"link",r),Kt(s),d.head.appendChild(s)))}}function fj(r,s){Ti.m(r,s);var c=sl;if(c&&r){var d=s&&typeof s.as=="string"?s.as:"script",m='link[rel="modulepreload"][as="'+nn(d)+'"][href="'+nn(r)+'"]',v=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=ll(r)}if(!Ar.has(v)&&(r=x({rel:"modulepreload",href:r},s),Ar.set(v,r),c.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Co(v)))return}d=c.createElement("link"),jn(d,"link",r),Kt(d),c.head.appendChild(d)}}}function hj(r,s,c){Ti.S(r,s,c);var d=sl;if(d&&r){var m=Zr(d).hoistableStyles,v=al(r);s=s||"default";var w=m.get(v);if(!w){var E={loading:0,preload:null};if(w=d.querySelector(No(v)))E.loading=5;else{r=x({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Ar.get(v))&&dp(r,c);var U=w=d.createElement("link");Kt(U),jn(U,"link",r),U._p=new Promise(function(te,oe){U.onload=te,U.onerror=oe}),U.addEventListener("load",function(){E.loading|=1}),U.addEventListener("error",function(){E.loading|=2}),E.loading|=4,Fu(w,s,d)}w={type:"stylesheet",instance:w,count:1,state:E},m.set(v,w)}}}function pj(r,s){Ti.X(r,s);var c=sl;if(c&&r){var d=Zr(c).hoistableScripts,m=ll(r),v=d.get(m);v||(v=c.querySelector(Co(m)),v||(r=x({src:r,async:!0},s),(s=Ar.get(m))&&fp(r,s),v=c.createElement("script"),Kt(v),jn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function mj(r,s){Ti.M(r,s);var c=sl;if(c&&r){var d=Zr(c).hoistableScripts,m=ll(r),v=d.get(m);v||(v=c.querySelector(Co(m)),v||(r=x({src:r,async:!0,type:"module"},s),(s=Ar.get(m))&&fp(r,s),v=c.createElement("script"),Kt(v),jn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(m,v))}}function $1(r,s,c,d){var m=(m=je.current)?$u(m):null;if(!m)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(s=al(c.href),c=Zr(m).hoistableStyles,d=c.get(s),d||(d={type:"style",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=al(c.href);var v=Zr(m).hoistableStyles,w=v.get(r);if(w||(m=m.ownerDocument||m,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,w),(v=m.querySelector(No(r)))&&!v._p&&(w.instance=v,w.state.loading=5),Ar.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ar.set(r,c),v||gj(m,r,c,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=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=ll(c),c=Zr(m).hoistableScripts,d=c.get(s),d||(d={type:"script",instance:null,count:0,state:null},c.set(s,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function al(r){return'href="'+nn(r)+'"'}function No(r){return'link[rel="stylesheet"]['+r+"]"}function F1(r){return x({},r,{"data-precedence":r.precedence,precedence:null})}function gj(r,s,c,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}),jn(s,"link",c),Kt(s),r.head.appendChild(s))}function ll(r){return'[src="'+nn(r)+'"]'}function Co(r){return"script[async]"+r}function U1(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var d=r.querySelector('style[data-href~="'+nn(c.href)+'"]');if(d)return s.instance=d,Kt(d),d;var m=x({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),Kt(d),jn(d,"style",m),Fu(d,c.precedence,r),s.instance=d;case"stylesheet":m=al(c.href);var v=r.querySelector(No(m));if(v)return s.state.loading|=4,s.instance=v,Kt(v),v;d=F1(c),(m=Ar.get(m))&&dp(d,m),v=(r.ownerDocument||r).createElement("link"),Kt(v);var w=v;return w._p=new Promise(function(E,U){w.onload=E,w.onerror=U}),jn(v,"link",d),s.state.loading|=4,Fu(v,c.precedence,r),s.instance=v;case"script":return v=ll(c.src),(m=r.querySelector(Co(v)))?(s.instance=m,Kt(m),m):(d=c,(m=Ar.get(v))&&(d=x({},c),fp(d,m)),r=r.ownerDocument||r,m=r.createElement("script"),Kt(m),jn(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,Fu(d,c.precedence,r));return s.instance}function Fu(r,s,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,v=m,w=0;w<d.length;w++){var E=d[w];if(E.dataset.precedence===s)v=E;else if(v!==m)break}v?v.parentNode.insertBefore(r,v.nextSibling):(s=c.nodeType===9?c.head:c,s.insertBefore(r,s.firstChild))}function dp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.title==null&&(r.title=s.title)}function fp(r,s){r.crossOrigin==null&&(r.crossOrigin=s.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=s.referrerPolicy),r.integrity==null&&(r.integrity=s.integrity)}var Uu=null;function H1(r,s,c){if(Uu===null){var d=new Map,m=Uu=new Map;m.set(c,d)}else m=Uu,d=m.get(c),d||(d=new Map,m.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),m=0;m<c.length;m++){var v=c[m];if(!(v[Kr]||v[Gt]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var w=v.getAttribute(s)||"";w=r+w;var E=d.get(w);E?E.push(v):d.set(w,[v])}}return d}function I1(r,s,c){r=r.ownerDocument||r,r.head.insertBefore(c,s==="title"?r.querySelector("head > title"):null)}function xj(r,s,c){if(c===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 q1(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function vj(r,s,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=al(d.href),v=s.querySelector(No(m));if(v){s=v._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Hu.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=v,Kt(v);return}v=s.ownerDocument||s,d=F1(d),(m=Ar.get(m))&&dp(d,m),v=v.createElement("link"),Kt(v);var w=v;w._p=new Promise(function(E,U){w.onload=E,w.onerror=U}),jn(v,"link",d),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Hu.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var hp=0;function bj(r,s){return r.stylesheets&&r.count===0&&qu(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&qu(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+s);0<r.imgBytes&&hp===0&&(hp=62500*Jk());var m=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&qu(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>hp?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function Hu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qu(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Iu=null;function qu(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Iu=new Map,s.forEach(yj,r),Iu=null,Hu.call(r))}function yj(r,s){if(!(s.state.loading&4)){var c=Iu.get(r);if(c)var d=c.get(null);else{c=new Map,Iu.set(r,c);for(var m=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<m.length;v++){var w=m[v];(w.nodeName==="LINK"||w.getAttribute("media")!=="not all")&&(c.set(w.dataset.precedence,w),d=w)}d&&c.set(null,d)}m=s.instance,w=m.getAttribute("data-precedence"),v=c.get(w)||d,v===d&&c.set(null,m),c.set(w,m),this.count++,d=Hu.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),v?v.parentNode.insertBefore(m,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(m,r.firstChild)),s.state.loading|=4}}var Eo={$$typeof:C,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function _j(r,s,c,d,m,v,w,E,U){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=Tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tn(0),this.hiddenUpdates=Tn(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=v,this.onRecoverableError=w,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=U,this.incompleteTransitions=new Map}function V1(r,s,c,d,m,v,w,E,U,te,oe,ue){return r=new _j(r,s,c,w,U,te,oe,ue,E),s=1,v===!0&&(s|=24),v=ar(3,null,null,s),r.current=v,v.stateNode=r,s=Gf(),s.refCount++,r.pooledCache=s,s.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:s},Xf(v),r}function G1(r){return r?(r=Pa,r):Pa}function Y1(r,s,c,d,m,v){m=G1(m),d.context===null?d.context=m:d.pendingContext=m,d=ss(s),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=as(r,d,s),c!==null&&(Zn(c,r,s),so(c,r,s))}function W1(r,s){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<s?c:s}}function pp(r,s){W1(r,s),(r=r.alternate)&&W1(r,s)}function Q1(r){if(r.tag===13||r.tag===31){var s=qs(r,67108864);s!==null&&Zn(s,r,67108864),pp(r,67108864)}}function X1(r){if(r.tag===13||r.tag===31){var s=dr();s=On(s);var c=qs(r,s);c!==null&&Zn(c,r,s),pp(r,s)}}var Vu=!0;function wj(r,s,c,d){var m=B.T;B.T=null;var v=F.p;try{F.p=2,mp(r,s,c,d)}finally{F.p=v,B.T=m}}function Sj(r,s,c,d){var m=B.T;B.T=null;var v=F.p;try{F.p=8,mp(r,s,c,d)}finally{F.p=v,B.T=m}}function mp(r,s,c,d){if(Vu){var m=gp(d);if(m===null)tp(r,s,d,Gu,c),Z1(r,d);else if(jj(m,r,s,c,d))d.stopPropagation();else if(Z1(r,d),s&4&&-1<kj.indexOf(r)){for(;m!==null;){var v=Vn(m);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var w=me(v.pendingLanes);if(w!==0){var E=v;for(E.pendingLanes|=2,E.entangledLanes|=2;w;){var U=1<<31-et(w);E.entanglements[1]|=U,w&=~U}si(v),(_t&6)===0&&(Eu=Ee()+500,wo(0))}}break;case 31:case 13:E=qs(v,2),E!==null&&Zn(E,v,2),Au(),pp(v,2)}if(v=gp(d),v===null&&tp(r,s,d,Gu,c),v===m)break;m=v}m!==null&&d.stopPropagation()}else tp(r,s,d,null,c)}}function gp(r){return r=Ma(r),xp(r)}var Gu=null;function xp(r){if(Gu=null,r=hi(r),r!==null){var s=o(r);if(s===null)r=null;else{var c=s.tag;if(c===13){if(r=u(s),r!==null)return r;r=null}else if(c===31){if(r=f(s),r!==null)return r;r=null}else if(c===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;r=null}else s!==r&&(r=null)}}return Gu=r,null}function K1(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(Br()){case le:return 2;case ye:return 8;case Q:case he:return 32;case Me:return 268435456;default:return 32}default:return 32}}var vp=!1,xs=null,vs=null,bs=null,To=new Map,Ao=new Map,ys=[],kj="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 Z1(r,s){switch(r){case"focusin":case"focusout":xs=null;break;case"dragenter":case"dragleave":vs=null;break;case"mouseover":case"mouseout":bs=null;break;case"pointerover":case"pointerout":To.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ao.delete(s.pointerId)}}function Mo(r,s,c,d,m,v){return r===null||r.nativeEvent!==v?(r={blockedOn:s,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[m]},s!==null&&(s=Vn(s),s!==null&&Q1(s)),r):(r.eventSystemFlags|=d,s=r.targetContainers,m!==null&&s.indexOf(m)===-1&&s.push(m),r)}function jj(r,s,c,d,m){switch(s){case"focusin":return xs=Mo(xs,r,s,c,d,m),!0;case"dragenter":return vs=Mo(vs,r,s,c,d,m),!0;case"mouseover":return bs=Mo(bs,r,s,c,d,m),!0;case"pointerover":var v=m.pointerId;return To.set(v,Mo(To.get(v)||null,r,s,c,d,m)),!0;case"gotpointercapture":return v=m.pointerId,Ao.set(v,Mo(Ao.get(v)||null,r,s,c,d,m)),!0}return!1}function J1(r){var s=hi(r.target);if(s!==null){var c=o(s);if(c!==null){if(s=c.tag,s===13){if(s=u(c),s!==null){r.blockedOn=s,$l(r.priority,function(){X1(c)});return}}else if(s===31){if(s=f(c),s!==null){r.blockedOn=s,$l(r.priority,function(){X1(c)});return}}else if(s===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Yu(r){if(r.blockedOn!==null)return!1;for(var s=r.targetContainers;0<s.length;){var c=gp(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);Xi=d,c.target.dispatchEvent(d),Xi=null}else return s=Vn(c),s!==null&&Q1(s),r.blockedOn=c,!1;s.shift()}return!0}function eb(r,s,c){Yu(r)&&c.delete(s)}function Nj(){vp=!1,xs!==null&&Yu(xs)&&(xs=null),vs!==null&&Yu(vs)&&(vs=null),bs!==null&&Yu(bs)&&(bs=null),To.forEach(eb),Ao.forEach(eb)}function Wu(r,s){r.blockedOn===s&&(r.blockedOn=null,vp||(vp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Nj)))}var Qu=null;function tb(r){Qu!==r&&(Qu=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Qu===r&&(Qu=null);for(var s=0;s<r.length;s+=3){var c=r[s],d=r[s+1],m=r[s+2];if(typeof d!="function"){if(xp(d||c)===null)continue;break}var v=Vn(c);v!==null&&(r.splice(s,3),s-=3,gh(v,{pending:!0,data:m,method:c.method,action:d},d,m))}}))}function ol(r){function s(U){return Wu(U,r)}xs!==null&&Wu(xs,r),vs!==null&&Wu(vs,r),bs!==null&&Wu(bs,r),To.forEach(s),Ao.forEach(s);for(var c=0;c<ys.length;c++){var d=ys[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<ys.length&&(c=ys[0],c.blockedOn===null);)J1(c),c.blockedOn===null&&ys.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var m=c[d],v=c[d+1],w=m[_n]||null;if(typeof v=="function")w||tb(c);else if(w){var E=null;if(v&&v.hasAttribute("formAction")){if(m=v,w=v[_n]||null)E=w.formAction;else if(xp(m)!==null)continue}else E=w.action;typeof E=="function"?c[d+1]=E:(c.splice(d,3),d-=3),tb(c)}}}function nb(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(w){return m=w})},focusReset:"manual",scroll:"manual"})}function s(){m!==null&&(m(),m=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.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(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),m!==null&&(m(),m=null)}}}function bp(r){this._internalRoot=r}Xu.prototype.render=bp.prototype.render=function(r){var s=this._internalRoot;if(s===null)throw Error(i(409));var c=s.current,d=dr();Y1(c,d,r,s,null,null)},Xu.prototype.unmount=bp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var s=r.containerInfo;Y1(r.current,2,null,r,null,null),Au(),s[ir]=null}};function Xu(r){this._internalRoot=r}Xu.prototype.unstable_scheduleHydration=function(r){if(r){var s=Pl();r={blockedOn:null,target:r,priority:s};for(var c=0;c<ys.length&&s!==0&&s<ys[c].priority;c++);ys.splice(c,0,r),c===0&&J1(r)}};var rb=t.version;if(rb!=="19.2.8")throw Error(i(527,rb,"19.2.8"));F.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 Cj={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ku.isDisabled&&Ku.supportsFiber)try{rt=Ku.inject(Cj),wt=Ku}catch{}}return Lo.createRoot=function(r,s){if(!a(r))throw Error(i(299));var c=!1,d="",m=uv,v=dv,w=fv;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(d=s.identifierPrefix),s.onUncaughtError!==void 0&&(m=s.onUncaughtError),s.onCaughtError!==void 0&&(v=s.onCaughtError),s.onRecoverableError!==void 0&&(w=s.onRecoverableError)),s=V1(r,1,!1,null,null,c,d,null,m,v,w,nb),r[ir]=s.current,ep(r),new bp(s)},Lo.hydrateRoot=function(r,s,c){if(!a(r))throw Error(i(299));var d=!1,m="",v=uv,w=dv,E=fv,U=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(w=c.onCaughtError),c.onRecoverableError!==void 0&&(E=c.onRecoverableError),c.formState!==void 0&&(U=c.formState)),s=V1(r,1,!0,s,c??null,d,m,U,v,w,E,nb),s.context=G1(null),c=s.current,d=dr(),d=On(d),m=ss(d),m.callback=null,as(c,m,d),c=d,s.current.lanes=c,Pt(s,c),si(s),r[ir]=s.current,ep(r),new Xu(s)},Lo.version="19.2.8",Lo}var mb;function Fj(){if(mb)return wp.exports;mb=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(),wp.exports=$j(),wp.exports}var Uj=Fj();const gb=e=>{let t;const n=new Set,i=(p,g)=>{const x=typeof p=="function"?p(t):p;if(!Object.is(x,t)){const b=t;t=g??(typeof x!="object"||x===null)?x:Object.assign({},t,x),n.forEach(y=>y(t,b))}},a=()=>t,f={setState:i,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(i,a,f);return f},Hj=(e=>e?gb(e):gb),Ij=e=>e;function qj(e,t=Ij){const n=Zu.useSyncExternalStore(e.subscribe,Zu.useCallback(()=>t(e.getState()),[e,t]),Zu.useCallback(()=>t(e.getInitialState()),[e,t]));return Zu.useDebugValue(n),n}const xb=e=>{const t=Hj(e),n=i=>qj(t,i);return Object.assign(n,t),n},Vj=(e=>e?xb(e):xb),Cm="companion_auth_token";function vb(){return typeof window>"u"?null:localStorage.getItem(Cm)||null}const Gj=e=>({authToken:vb(),isAuthenticated:vb()!==null,setAuthToken:t=>{localStorage.setItem(Cm,t),e({authToken:t,isAuthenticated:!0})},logout:()=>{localStorage.removeItem(Cm),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 Yj(e,t){if(!e.has(t))return e;const n=new Set(e);return n.delete(t),n}function Wj(){if(typeof window>"u")return new Map;try{return new Map(JSON.parse(localStorage.getItem("cc-session-names")||"[]"))}catch{return new Map}}function Qj(){return typeof window>"u"?null:localStorage.getItem("cc-current-session")||null}function Xj(){if(typeof window>"u")return new Set;try{return new Set(JSON.parse(localStorage.getItem("cc-collapsed-projects")||"[]"))}catch{return new Set}}const Kj=e=>({sessions:new Map,sdkSessions:[],currentSessionId:Qj(),connectionStatus:new Map,cliConnected:new Map,cliReconnecting:new Map,sessionStatus:new Map,previousPermissionMode:new Map,sessionNames:Wj(),recentlyRenamed:new Set,prStatus:new Map,linkedLinearIssues:new Map,mcpServers:new Map,rateLimit:new Map,collapsedProjects:Xj(),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 a=new Map(n.messages);return a.has(t.session_id)||a.set(t.session_id,[]),{sessions:i,messages:a}}),updateSession:(t,n)=>e(i=>{const a=new Map(i.sessions),o=a.get(t);return o&&a.set(t,{...o,...n}),{sessions:a}}),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:Yj(n.recentlyRenamed,t),mcpServers:Ht(n.mcpServers,t),rateLimit:Ht(n.rateLimit,t),prStatus:Ht(n.prStatus,t),linkedLinearIssues:Ht(n.linkedLinearIssues,t),sdkSessions:n.sdkSessions.filter(a=>a.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 a=new Map(i.connectionStatus);return a.set(t,n),{connectionStatus:a}}),setCliConnected:(t,n)=>e(i=>{const a=new Map(i.cliConnected);return a.set(t,n),{cliConnected:a}}),setCliReconnecting:(t,n)=>e(i=>{const a=new Map(i.cliReconnecting);return n?a.set(t,!0):a.delete(t),{cliReconnecting:a}}),setSessionStatus:(t,n)=>e(i=>{const a=new Map(i.sessionStatus);return a.set(t,n),{sessionStatus:a}}),setPreviousPermissionMode:(t,n)=>e(i=>{const a=new Map(i.previousPermissionMode);return a.set(t,n),{previousPermissionMode:a}}),setSessionName:(t,n)=>e(i=>{const a=new Map(i.sessionNames);return a.set(t,n),localStorage.setItem("cc-session-names",JSON.stringify(Array.from(a.entries()))),{sessionNames:a}}),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 a=new Map(i.prStatus);return a.set(t,n),{prStatus:a}}),setLinkedLinearIssue:(t,n)=>e(i=>{const a=new Map(i.linkedLinearIssues);return n?a.set(t,n):a.delete(t),{linkedLinearIssues:a}}),setMcpServers:(t,n)=>e(i=>{const a=new Map(i.mcpServers);return a.set(t,n),{mcpServers:a}}),setRateLimit:(t,n)=>e(i=>{const a=new Map(i.rateLimit);return a.set(t,n),{rateLimit:a}}),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 a=new Map(i.sessions),o=a.get(t);return o?(a.set(t,{...o,...n}),{sessions:a}):{}})}),Zj=e=>({messages:new Map,streaming:new Map,streamingStartedAt:new Map,streamingOutputTokens:new Map,lastActivityAt:new Map,appendMessage:(t,n)=>e(i=>{const a=i.messages.get(t)||[];if(n.id&&a.some(u=>u.id===n.id))return i;const o=new Map(i.messages);return o.set(t,[...a,n]),{messages:o}}),setMessages:(t,n)=>e(i=>{const a=new Map(i.messages);return a.set(t,n),{messages:a}}),updateLastAssistantMessage:(t,n)=>e(i=>{const a=new Map(i.messages),o=[...a.get(t)||[]];for(let u=o.length-1;u>=0;u--)if(o[u].role==="assistant"){o[u]=n(o[u]);break}return a.set(t,o),{messages:a}}),setStreaming:(t,n)=>e(i=>{const a=new Map(i.streaming);return n===null?a.delete(t):a.set(t,n),{streaming:a}}),setStreamingStats:(t,n)=>e(i=>{const a=new Map(i.streamingStartedAt),o=new Map(i.streamingOutputTokens);return n===null?(a.delete(t),o.delete(t)):(n.startedAt!==void 0&&a.set(t,n.startedAt),n.outputTokens!==void 0&&o.set(t,n.outputTokens)),{streamingStartedAt:a,streamingOutputTokens:o}}),setLastActivity:(t,n)=>e(i=>{const a=new Map(i.lastActivityAt);return a.set(t,n),{lastActivityAt:a}}),promptSuggestions:new Map,setPromptSuggestions:(t,n)=>e(i=>{const a=new Map(i.promptSuggestions);return a.set(t,n),{promptSuggestions:a}}),clearPromptSuggestions:t=>e(n=>{const i=new Map(n.promptSuggestions);return i.delete(t),{promptSuggestions:i}})}),Jj=e=>({pendingPermissions:new Map,aiResolvedPermissions:new Map,addPermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=new Map(a.get(t)||[]);return o.set(n.request_id,n),a.set(t,o),{pendingPermissions:a}}),removePermission:(t,n)=>e(i=>{const a=new Map(i.pendingPermissions),o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}return{pendingPermissions:a}}),addAiResolvedPermission:(t,n)=>e(i=>{const a=new Map(i.aiResolvedPermissions),o=[...a.get(t)||[],n];return o.length>50&&o.splice(0,o.length-50),a.set(t,o),{aiResolvedPermissions:a}}),clearAiResolvedPermissions:t=>e(n=>{const i=new Map(n.aiResolvedPermissions);return i.delete(t),{aiResolvedPermissions:i}})}),eN=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 a=new Map(i.sessionTasks),o=[...a.get(t)||[],n];return a.set(t,o),{sessionTasks:a}}),setTasks:(t,n)=>e(i=>{const a=new Map(i.sessionTasks);return a.set(t,n),{sessionTasks:a}}),updateTask:(t,n,i)=>e(a=>{const o=new Map(a.sessionTasks),u=o.get(t);return u&&o.set(t,u.map(f=>f.id===n?{...f,...i}:f)),{sessionTasks:o}}),addProcess:(t,n)=>e(i=>{const a=new Map(i.sessionProcesses),o=[...a.get(t)||[],n];return a.set(t,o),{sessionProcesses:a}}),updateProcess:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.taskId===n?{...f,...i}:f)),{sessionProcesses:o}}),updateProcessByToolUseId:(t,n,i)=>e(a=>{const o=new Map(a.sessionProcesses),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionProcesses:o}}),addBackgroundAgent:(t,n)=>e(i=>{const a=new Map(i.sessionBackgroundAgents),o=[...a.get(t)||[],n];return a.set(t,o),{sessionBackgroundAgents:a}}),updateBackgroundAgent:(t,n,i)=>e(a=>{const o=new Map(a.sessionBackgroundAgents),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{sessionBackgroundAgents:o}}),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 a=new Map(i.gitChangedFilesCount);return a.set(t,n),{gitChangedFilesCount:a}}),setToolProgress:(t,n,i)=>e(a=>{const o=new Map(a.toolProgress),u=new Map(o.get(t)||[]);return u.set(n,i),o.set(t,u),{toolProgress:o}}),clearToolProgress:(t,n)=>e(i=>{const a=new Map(i.toolProgress);if(n){const o=a.get(t);if(o){const u=new Map(o);u.delete(n),a.set(t,u)}}else a.delete(t);return{toolProgress:a}}),setToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity);return n.length===0?a.delete(t):a.set(t,n),{toolActivity:a}}),addToolActivity:(t,n)=>e(i=>{const a=new Map(i.toolActivity),o=[...a.get(t)||[]],u=o.findIndex(f=>f.toolUseId===n.toolUseId);if(u>=0){const f=o[u];o[u]={...f,...n,startedAt:f.startedAt,completedAt:n.completedAt??f.completedAt,elapsedSeconds:Math.max(f.elapsedSeconds,n.elapsedSeconds),isError:f.isError||n.isError}}else o.push(n);return a.set(t,o),{toolActivity:a}}),updateToolActivity:(t,n,i)=>e(a=>{const o=new Map(a.toolActivity),u=o.get(t);return u&&o.set(t,u.map(f=>f.toolUseId===n?{...f,...i}:f)),{toolActivity:o}})}),qi=[{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"]}],tN=qi.map(e=>e.id),i5="cc-task-panel-config";function Em(){return{order:[...tN],enabled:Object.fromEntries(qi.map(e=>[e.id,!0]))}}function nN(){if(typeof window>"u")return Em();try{const e=localStorage.getItem(i5);if(e){const t=JSON.parse(e),n=new Set(t.order);for(const a of qi)n.has(a.id)||(t.order.push(a.id),t.enabled[a.id]=!0);const i=new Set(qi.map(a=>a.id));return t.order=t.order.filter(a=>i.has(a)),t}}catch{}return Em()}function Ju(e){try{localStorage.setItem(i5,JSON.stringify(e))}catch{}}function rN(){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 iN(){if(typeof window>"u")return!0;const e=localStorage.getItem("cc-notification-sound");return e!==null?e==="true":!0}function sN(){if(typeof window>"u")return!1;const e=localStorage.getItem("cc-notification-desktop");return e!==null?e==="true":!1}function s5(){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 aN=e=>({darkMode:rN(),notificationSound:iN(),notificationDesktop:sN(),sidebarOpen:typeof window<"u"?window.innerWidth>=768:!0,taskPanelOpen:typeof window<"u"?window.innerWidth>=1024:!0,taskPanelConfig:nN(),taskPanelConfigMode:!1,homeResetKey:0,publicUrl:"",activeTab:"chat",chatTabReentryTickBySession:new Map,diffPanelSelectedFile:new Map,diffBase:s5(),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 Ju(i),{taskPanelConfig:i}}),moveSectionUp:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<=0)return n;[i[a-1],i[a]]=[i[a],i[a-1]];const o={...n.taskPanelConfig,order:i};return Ju(o),{taskPanelConfig:o}}),moveSectionDown:t=>e(n=>{const i=[...n.taskPanelConfig.order],a=i.indexOf(t);if(a<0||a>=i.length-1)return n;[i[a],i[a+1]]=[i[a+1],i[a]];const o={...n.taskPanelConfig,order:i};return Ju(o),{taskPanelConfig:o}}),resetTaskPanelConfig:()=>{const t=Em();Ju(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),a=(i.get(t)??0)+1;return i.set(t,a),{chatTabReentryTickBySession:i}}),setDiffPanelSelectedFile:(t,n)=>e(i=>{const a=new Map(i.diffPanelSelectedFile);return n?a.set(t,n):a.delete(t),{diffPanelSelectedFile:a}}),setDiffBase:t=>{typeof window<"u"&&localStorage.setItem("cc-diff-base",t),e({diffBase:t})}});function a5(){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 lN=e=>({quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:a5(),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",a=n.quickTerminalNextHostIndex,o=n.quickTerminalNextDockerIndex,u=i?a:a+1,f=i?o+1:o,h={id:`${t.target}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,label:i?`Docker ${o}`:a===1?"Terminal":`Terminal ${a}`,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 o;const i=n.quickTerminalTabs.filter(u=>u.id!==t),a=n.activeQuickTerminalTabId===t?((o=i[0])==null?void 0:o.id)||null:n.activeQuickTerminalTabId;return{quickTerminalTabs:i,activeQuickTerminalTabId:a,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 oN(){return typeof window>"u"?null:localStorage.getItem("cc-update-dismissed")||null}const cN=e=>({updateInfo:null,updateDismissedVersion:oN(),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||[],a=i.findIndex(o=>o.step===t.step);if(a>=0){const o=[...i];return o[a]=t,{creationProgress:o}}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})}),X=Vj((...e)=>({...Gj(...e),...Kj(...e),...Zj(...e),...Jj(...e),...eN(...e),...aN(...e),...lN(...e),...cN(...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:s5(),quickTerminalOpen:!1,quickTerminalTabs:[],activeQuickTerminalTabId:null,quickTerminalPlacement:a5(),quickTerminalNextHostIndex:1,quickTerminalNextDockerIndex:1,terminalOpen:!1,terminalCwd:null,terminalId:null})}})),uN=Object.freeze(Object.defineProperty({__proto__:null,useStore:X},Symbol.toStringTag,{value:"Module"})),dN="Your Claude login has expired or is invalid — re-authenticate (run `claude login` in a terminal), then use Reconnect to resume this session.",fN=/invalid authentication credentials|authentication_failed|\b40[13]\s+(?:unauthorized|forbidden)\b|(?:unauthorized|forbidden)[^\n]{0,12}\b40[13]\b|please run\s+`?\/?login|claude login|credentials?\s+(?:expired|invalid|revoked)|oauth token|token\s+(?:expired|revoked)/i;function hN(e){return fN.test(e)}function pN(e){return e.is_error?e.api_error_status===401||e.api_error_status===403?!0:hN(`${e.result??""} ${(e.errors??[]).join(" ")}`):!1}const bb=["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"],yb=["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 _b(){const e=bb[Math.floor(Math.random()*bb.length)],t=yb[Math.floor(Math.random()*yb.length)];return`${e} ${t}`}function l5(e){for(let t=0;t<100;t++){const n=_b();if(!e.has(n))return n}return _b()}let Np=null;function mN(){return Np||(Np=new AudioContext),Np}function gN(){try{const e=mN();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 a=e.createOscillator(),o=e.createGain();a.type="sine",a.frequency.setValueAtTime(783.99,t+.15),o.gain.setValueAtTime(.001,t),o.gain.setValueAtTime(.3,t+.15),o.gain.exponentialRampToValueAtTime(.001,t+.5),a.connect(o),o.connect(e.destination),a.start(t+.15),a.stop(t+.5)}catch{}}class o5{diff(t,n,i={}){let a;typeof i=="function"?(a=i,i={}):"callback"in i&&(a=i.callback);const o=this.castInput(t,i),u=this.castInput(n,i),f=this.removeEmpty(this.tokenize(o,i)),h=this.removeEmpty(this.tokenize(u,i));return this.diffWithOptionsObj(f,h,i,a)}diffWithOptionsObj(t,n,i,a){var o;const u=A=>{if(A=this.postProcess(A,i),a){setTimeout(function(){a(A)},0);return}else return A},f=n.length,h=t.length;let p=1,g=f+h;i.maxEditLength!=null&&(g=Math.min(g,i.maxEditLength));const x=(o=i.timeout)!==null&&o!==void 0?o:1/0,b=Date.now()+x,y=[{oldPos:-1,lastComponent:void 0}];let _=this.extractCommon(y[0],n,t,0,i);if(y[0].oldPos+1>=h&&_+1>=f)return u(this.buildValues(y[0].lastComponent,n,t));let j=-1/0,N=1/0;const k=()=>{for(let A=Math.max(j,-p);A<=Math.min(N,p);A+=2){let C;const L=y[A-1],D=y[A+1];L&&(y[A-1]=void 0);let z=!1;if(D){const $=D.oldPos-A;z=D&&0<=$&&$<f}const q=L&&L.oldPos+1<h;if(!z&&!q){y[A]=void 0;continue}if(!q||z&&L.oldPos<D.oldPos?C=this.addToPath(D,!0,!1,0,i):C=this.addToPath(L,!1,!0,1,i),_=this.extractCommon(C,n,t,A,i),C.oldPos+1>=h&&_+1>=f)return u(this.buildValues(C.lastComponent,n,t))||!0;y[A]=C,C.oldPos+1>=h&&(N=Math.min(N,A-1)),_+1>=f&&(j=Math.max(j,A+1))}p++};if(a)(function A(){setTimeout(function(){if(p>g||Date.now()>b)return a(void 0);k()||A()},0)})();else for(;p<=g&&Date.now()<=b;){const A=k();if(A)return A}}addToPath(t,n,i,a,o){const u=t.lastComponent;return u&&!o.oneChangePerToken&&u.added===n&&u.removed===i?{oldPos:t.oldPos+a,lastComponent:{count:u.count+1,added:n,removed:i,previousComponent:u.previousComponent}}:{oldPos:t.oldPos+a,lastComponent:{count:1,added:n,removed:i,previousComponent:u}}}extractCommon(t,n,i,a,o){const u=n.length,f=i.length;let h=t.oldPos,p=h-a,g=0;for(;p+1<u&&h+1<f&&this.equals(i[h+1],n[p+1],o);)p++,h++,g++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return g&&!o.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 a=[];let o;for(;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();const u=a.length;let f=0,h=0,p=0;for(;f<u;f++){const g=a[f];if(g.removed)g.value=this.join(i.slice(p,p+g.count)),p+=g.count;else{if(!g.added&&this.useLongestToken){let x=n.slice(h,h+g.count);x=x.map(function(b,y){const _=i[p+y];return _.length>b.length?_:b}),g.value=this.join(x)}else g.value=this.join(n.slice(h,h+g.count));h+=g.count,g.added||(p+=g.count)}}return a}}function wb(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 Sb(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 Tm(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 Am(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 Do(e,t){return Tm(e,t,"")}function ed(e,t){return Am(e,t,"")}function kb(e,t){return t.slice(0,xN(e,t))}function xN(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 a=Array(i);let o=0;a[0]=0;for(let u=1;u<i;u++){for(t[u]==t[o]?a[u]=a[o]:a[u]=o;o>0&&t[u]!=t[o];)o=a[o];t[u]==t[o]&&o++}o=0;for(let u=n;u<e.length;u++){for(;o>0&&e[u]!=t[o];)o=a[o];e[u]==t[o]&&o++}return o}function c5(e,t){const n=[];for(const i of Array.from(t.segment(e))){const a=i.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(a)?n[n.length-1]+=a:n.push(a)}return n}function Mm(e,t){if(t)return ic(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function gl(e,t){if(t)return ic(e,t)[0];const n=e.match(/^\s*/);return n?n[0]:""}function ic(e,t){if(!t)return[gl(e),Mm(e)];if(t.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');const n=c5(e,t),i=n[0],a=n[n.length-1],o=/\s/.test(i)?i:"",u=/\s/.test(a)?a:"";return[o,u]}const jb="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}",vN=new RegExp(`[${jb}]+|\\s+|[^${jb}]`,"ug");class bN extends o5{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=c5(t,u)}else i=t.match(vN)||[];const a=[];let o=null;return i.forEach(u=>{/\s/.test(u)?o==null?a.push(u):a.push(a.pop()+u):o!=null&&/\s/.test(o)?a[a.length-1]==o?a.push(a.pop()+u):a.push(o+u):a.push(u),o=u}),a}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,a=null,o=null;return t.forEach(u=>{u.added?a=u:u.removed?o=u:((a||o)&&Nb(i,o,a,u,n.intlSegmenter),i=u,a=null,o=null)}),(a||o)&&Nb(i,o,a,null,n.intlSegmenter),t}}const yN=new bN;function _N(e,t,n){return yN.diff(e,t,n)}function Nb(e,t,n,i,a){if(t&&n){const[o,u]=ic(t.value,a),[f,h]=ic(n.value,a);if(e){const p=wb(o,f);e.value=Am(e.value,f,p),t.value=Do(t.value,p),n.value=Do(n.value,p)}if(i){const p=Sb(u,h);i.value=Tm(i.value,h,p),t.value=ed(t.value,p),n.value=ed(n.value,p)}}else if(n){if(e){const o=gl(n.value,a);n.value=n.value.substring(o.length)}if(i){const o=gl(i.value,a);i.value=i.value.substring(o.length)}}else if(e&&i){const o=gl(i.value,a),[u,f]=ic(t.value,a),h=wb(o,u);t.value=Do(t.value,h);const p=Sb(Do(o,h),f);t.value=ed(t.value,p),i.value=Tm(i.value,o,p),e.value=Am(e.value,o,o.slice(0,o.length-p.length))}else if(i){const o=gl(i.value,a),u=Mm(t.value,a),f=kb(u,o);t.value=ed(t.value,f)}else if(e){const o=Mm(e.value,a),u=gl(t.value,a),f=kb(o,u);t.value=Do(t.value,f)}}class wN extends o5{constructor(){super(...arguments),this.tokenize=kN}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(`
|
|
@@ -60,11 +60,11 @@ Error generating stack: `+d.message+`
|
|
|
60
60
|
`).length,y=b>15;return l.jsxs("div",{"data-tool-use-id":t,children:[l.jsxs("div",{className:"flex items-center gap-1.5 py-0.5",children:[l.jsx("span",{className:"text-[11px] font-medium text-emerald-600/70 dark:text-emerald-400/70",children:"Edit"}),i&&l.jsx("span",{className:"text-[11px] font-mono-code text-cc-fg/70",children:i}),f&&l.jsx("span",{className:"text-[9px] uppercase tracking-wider font-semibold text-amber-600/70 dark:text-amber-400/70",children:"all"})]}),u?l.jsxs("div",{className:"relative mt-1",children:[l.jsx("div",{className:`overflow-hidden ${y&&!h?"max-h-[240px]":""}`,children:l.jsx(Ll,{oldText:a,newText:o,mode:"compact"})}),y&&!h&&l.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-10 bg-gradient-to-t from-cc-bg to-transparent pointer-events-none"}),y&&l.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 ${b} lines`})]}):x.length>0?l.jsx("div",{className:"mt-1 space-y-1",children:x.map((_,j)=>{const N=_.path.split("/").pop()||_.path;return l.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[l.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}),l.jsx("span",{className:"font-mono-code text-cc-fg/60 truncate",children:N})]},`${_.path}-${j}`)})}):l.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 DN({input:e,toolUseId:t}){const n=typeof e.command=="string"?e.command:"",i=typeof e.description=="string"?e.description:"";return l.jsxs("div",{"data-tool-use-id":t,children:[i&&l.jsx("div",{className:"text-[11px] text-cc-muted/50 mb-1 italic",children:i}),l.jsx("div",{className:"rounded-lg bg-cc-code-bg px-3 py-2 overflow-x-auto",children:l.jsxs("pre",{className:"text-[12px] font-mono-code text-cc-code-fg leading-relaxed whitespace-pre-wrap break-words",children:[l.jsx("span",{className:"text-cc-muted/40 select-none",children:"$ "}),n]})})]})}function zN({name:e,input:t}){switch(e){case"Bash":return l.jsx(ON,{input:t});case"Edit":return l.jsx(BN,{input:t});case"Write":return l.jsx(PN,{input:t});case"Read":return l.jsx($N,{input:t});case"Glob":return l.jsx(FN,{input:t});case"Grep":return l.jsx(UN,{input:t});case"WebSearch":case"web_search":return l.jsx(HN,{input:t});case"WebFetch":return l.jsx(IN,{input:t});case"Task":return l.jsx(qN,{input:t});case"TodoWrite":return l.jsx(VN,{input:t});case"NotebookEdit":return l.jsx(GN,{input:t});case"SendMessage":return l.jsx(YN,{input:t});default:return l.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 ON({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-[11px] text-cc-muted italic",children:String(e.description)}),l.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:[l.jsx("span",{className:"text-cc-muted select-none",children:"$ "}),String(e.command||"")]}),!!e.timeout&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["timeout: ",String(e.timeout),"ms"]})]})}function BN({input:e}){const t=String(e.file_path||""),n=String(e.old_string||""),i=String(e.new_string||""),o=(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 l.jsxs("div",{className:"space-y-1.5",children:[!!e.replace_all&&l.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?l.jsx(Ll,{oldText:n,newText:i,fileName:t,mode:"compact"}):o.length>0?l.jsxs("div",{className:"space-y-1.5",children:[!!t&&l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),o.map((u,f)=>l.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-cc-fg",children:[l.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}),l.jsx("span",{className:"font-mono-code truncate",children:u.path})]},`${u.path}-${f}`))]}):l.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 PN({input:e}){const t=String(e.file_path||""),n=String(e.content||"");return l.jsx(Ll,{newText:n,fileName:t,mode:"compact"})}function $N({input:e}){const t=String(e.file_path||e.path||""),n=e.offset,i=e.limit;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-muted font-mono-code",children:t}),(n!=null||i!=null)&&l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n!=null&&l.jsxs("span",{children:["offset: ",n]}),i!=null&&l.jsxs("span",{children:["limit: ",i]})]})]})}function FN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-code-fg",children:String(e.pattern||"")}),!!e.path&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["in: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]})]})}function UN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.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||"")}),l.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-0.5 text-[10px] text-cc-muted",children:[!!e.path&&l.jsxs("span",{children:["path: ",l.jsx("span",{className:"font-mono-code",children:String(e.path)})]}),!!e.glob&&l.jsxs("span",{children:["glob: ",l.jsx("span",{className:"font-mono-code",children:String(e.glob)})]}),!!e.output_mode&&l.jsxs("span",{children:["mode: ",String(e.output_mode)]}),!!e.context&&l.jsxs("span",{children:["context: ",String(e.context)]}),!!e.head_limit&&l.jsxs("span",{children:["limit: ",String(e.head_limit)]})]})]})}function HN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.query||"")}),Array.isArray(e.allowed_domains)&&e.allowed_domains.length>0&&l.jsxs("div",{className:"text-[10px] text-cc-muted",children:["domains: ",e.allowed_domains.join(", ")]})]})}function IN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.url&&l.jsx("div",{className:"text-xs font-mono-code text-cc-primary truncate",children:String(e.url)}),!!e.prompt&&l.jsx("div",{className:"text-[11px] text-cc-muted italic line-clamp-2",children:String(e.prompt)})]})}function qN({input:e}){return l.jsxs("div",{className:"space-y-1.5",children:[!!e.description&&l.jsx("div",{className:"text-xs text-cc-fg font-medium",children:String(e.description)}),!!e.subagent_type&&l.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&&l.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 VN({input:e}){const t=e.todos;return Array.isArray(t)?l.jsx("div",{className:"space-y-0.5",children:t.map((n,i)=>{const a=n.status||"pending";return l.jsxs("div",{className:"flex items-start gap-2 py-0.5",children:[l.jsx("span",{className:"shrink-0 mt-0.5",children:a==="completed"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.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==="in_progress"?l.jsx("svg",{className:"w-3.5 h-3.5 text-cc-primary animate-spin",viewBox:"0 0 16 16",fill:"none",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"28",strokeDashoffset:"8",strokeLinecap:"round"})}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-muted",children:l.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"})})}),l.jsx("span",{className:`text-[11px] leading-snug ${a==="completed"?"text-cc-muted line-through":"text-cc-fg"}`,children:n.content||"Task"})]},i)})}):l.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 GN({input:e}){const t=String(e.notebook_path||""),n=e.cell_type,i=e.edit_mode;return l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-xs font-mono-code text-cc-muted",children:t}),l.jsxs("div",{className:"flex gap-2 text-[10px] text-cc-muted",children:[n&&l.jsxs("span",{children:["type: ",n]}),i&&l.jsxs("span",{children:["mode: ",i]}),e.cell_number!=null&&l.jsxs("span",{children:["cell: ",String(e.cell_number)]})]}),!!e.new_source&&l.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 YN({input:e}){return l.jsxs("div",{className:"space-y-1",children:[!!e.recipient&&l.jsxs("div",{className:"text-[11px] text-cc-muted",children:["to: ",l.jsx("span",{className:"font-medium text-cc-fg",children:String(e.recipient)})]}),!!e.content&&l.jsx("div",{className:"text-xs text-cc-fg whitespace-pre-wrap",children:String(e.content)})]})}function gc(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("/")}`:"",a=n+i;return a.length>60?a.slice(0,60)+"...":a}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 jl({type:e}){const t="w-3.5 h-3.5 text-cc-primary shrink-0";return e==="terminal"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("polyline",{points:"3 11 6 8 3 5"}),l.jsx("line",{x1:"8",y1:"11",x2:"13",y2:"11"})]}):e==="file"||e==="file-plus"||e==="file-edit"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M9 1H4a1 1 0 00-1 1v12a1 1 0 001 1h8a1 1 0 001-1V5L9 1z"}),l.jsx("polyline",{points:"9 1 9 5 13 5"})]}):e==="search"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"7",cy:"7",r:"4"}),l.jsx("path",{d:"M13 13l-3-3"})]}):e==="globe"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"8",r:"6"}),l.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"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M14 10a1 1 0 01-1 1H5l-3 3V3a1 1 0 011-1h10a1 1 0 011 1v7z"})}):e==="list"?l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M3 4h10M3 8h10M3 12h6"})}):e==="agent"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("circle",{cx:"8",cy:"5",r:"3"}),l.jsx("path",{d:"M3 14c0-2.8 2.2-5 5-5s5 2.2 5 5",strokeLinecap:"round"})]}):e==="checklist"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("path",{d:"M3 4l1.5 1.5L7 3M3 8l1.5 1.5L7 7M3 12l1.5 1.5L7 11",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M9 4h4M9 8h4M9 12h4"})]}):e==="notebook"?l.jsxs("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:[l.jsx("rect",{x:"3",y:"1",width:"10",height:"14",rx:"1"}),l.jsx("path",{d:"M6 1v14M3 5h3M3 9h3M3 13h3"})]}):l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:t,children:l.jsx("path",{d:"M10.5 2.5l3 3-8 8H2.5v-3l8-8z"})})}const WN=2e3,QN=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"]),Yr=new Map,Ii=new Map,Md=new Map,bd=new Map,ks=new Map,sc=new Map,xc=new Map,Rd=new Map;function f5(e){return!!e&&(e.readyState===WebSocket.OPEN||e.readyState===WebSocket.CONNECTING)}function h5(e){const t=X.getState(),n=t.sdkSessions.find(i=>i.sessionId===e);return n?!n.archived:t.currentSessionId===e}function XN(){const e=X.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 vc=typeof document<"u"?document.hidden:!1;typeof document<"u"&&document.addEventListener("visibilitychange",()=>{if(document.hidden){vc=!0;for(const[e,t]of Ii)clearTimeout(t),Ii.delete(e)}else{vc=!1;for(const e of XN()){if(!h5(e))continue;const t=Yr.get(e);if(!f5(t)){if(t){try{t.close()}catch{}Yr.delete(e)}Ac(e)}}}});function yd(e){const t=e.startsWith("/"),n=e.split("/"),i=[];for(const a of n)if(!(!a||a===".")){if(a===".."){i.length>0&&i.pop();continue}i.push(a)}return`${t?"/":""}${i.join("/")}`}function KN(e,t){return e.startsWith("/")||!t?yd(e):yd(`${t}/${e}`)}function ZN(e,t){if(!t)return!0;const n=yd(t);return e===n||e.startsWith(`${n}/`)}function JN(e){let t=Rd.get(e);return t||(t=new Set,Rd.set(e,t)),t}function Cp(e,t){const n=X.getState(),i=JN(e);for(const a of t){if(a.type!=="tool_use")continue;const{name:o,input:u,id:f}=a;if(f){if(i.has(f))continue;i.add(f)}if(o==="TodoWrite"){const h=u.todos;if(Array.isArray(h)){const p=h.map((g,x)=>({id:String(x+1),subject:g.content||"Task",description:"",activeForm:g.activeForm,status:g.status||"pending"}));n.setTasks(e,p),bd.set(e,p.length)}continue}if(o==="TaskCreate"){const h=(bd.get(e)||0)+1;bd.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(o==="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 Ep(e,t){var o,u;const n=X.getState(),i=((o=n.sessions.get(e))==null?void 0:o.cwd)||((u=n.sdkSessions.find(f=>f.sessionId===e))==null?void 0:u.cwd);let a=!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=KN(p.file_path,i);ZN(g,i)&&(a=!0)}}a&&n.bumpChangedFilesTick(e)}const Ko=new Map,e3=/Command running in background with ID:\s*(\S+)\.\s*Output is being written to:\s*(\S+)/;function Tp(e,t){const n=X.getState();for(const i of t){if(i.type==="tool_use"&&i.name==="Bash"){const a=i.input;if(a.run_in_background===!0){let o=Ko.get(e);o||(o=new Map,Ko.set(e,o)),o.set(i.id,{command:a.command||"",description:a.description||"",startedAt:Date.now()})}}if(i.type==="tool_result"){const a=i.tool_use_id,o=Ko.get(e),u=o==null?void 0:o.get(a);if(o&&u){const h=(typeof i.content=="string"?i.content:Array.isArray(i.content)?i.content.map(p=>"text"in p?p.text:"").join(""):"").match(e3);if(h){const p={taskId:h[1],toolUseId:a,command:u.command,description:u.description,outputFile:h[2],status:"running",startedAt:u.startedAt};n.addProcess(e,p)}o.delete(a),o.size===0&&Ko.delete(e)}}}}const td=new Map,Ld=new Map;function Ap(e,t){const n=X.getState();let i=Ld.get(e);i||(i=new Set,Ld.set(e,i));for(const a of t){if(a.type==="tool_use"&&a.name==="Agent"){if(a.id&&i.has(a.id))continue;const o=a.input;if(o.run_in_background===!0){a.id&&i.add(a.id);let u=td.get(e);u||(u=new Map,td.set(e,u));const f={toolUseId:a.id,name:o.name||o.description||"Background agent",description:o.description||"",agentType:o.subagent_type||"general-purpose",status:"running",startedAt:Date.now()};u.set(a.id,{name:f.name,description:f.description,agentType:f.agentType,startedAt:f.startedAt}),n.addBackgroundAgent(e,f)}}if(a.type==="tool_result"){const o=a.tool_use_id,u=td.get(e),f=u==null?void 0:u.get(o);if(u&&f){const h=typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.map(g=>"text"in g?g.text:"").join(""):"",p=a.is_error===!0;n.updateBackgroundAgent(e,o,{status:p?"failed":"completed",completedAt:Date.now(),summary:h.length>200?h.slice(0,200)+"...":h}),u.delete(o),u.size===0&&td.delete(e)}}}}function Eb(e,t,n){typeof Notification>"u"||Notification.permission==="granted"&&new Notification(e,{body:t,tag:n})}function Tb(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 t3=0,n3=0;function li(){return`msg-${Date.now()}-${++t3}`}function Ab(e){var n;const t=(n=e.errors)!=null&&n.length?e.errors.join(", "):e.result||(e.api_error_status?`API error ${e.api_error_status}`:"The turn ended with an error but no details were provided.");return pN(e)?`${dN}
|
|
61
61
|
|
|
62
62
|
Details: ${t}`:`Error: ${t}`}function r3(e,t){const n=xc.get(e)||[];n.push(t),xc.set(e,n)}function i3(e,t){const n=xc.get(e);if(!(!(n!=null&&n.length)||t.readyState!==WebSocket.OPEN)){xc.delete(e);for(const i of n)t.send(JSON.stringify(i))}}const Di=new Map;function Mb(e,t,n){const i=X.getState(),a=i.messages.get(e)||[],o=sc.get(e);let u=a.filter(h=>!h.isStreaming||h.id===o),f=-1;if(o&&(f=u.findIndex(h=>h.id===o),f===-1&&sc.delete(e)),f===-1){const h=`stream-${e}-${li()}`;sc.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 ws(e){sc.delete(e);const t=X.getState(),n=t.messages.get(e)||[],i=n.filter(a=>!a.isStreaming);return i.length!==n.length?(t.setMessages(e,i),!0):!1}const Rb=new Map,s3=8e3;function cl(e,t,n={}){if(console.warn(`[companion:session-event] ${t}`,{sessionId:e,...n.detail??{}}),!n.userText)return;const i=Date.now(),a=Rb.get(e);a&&a.code===t&&i-a.at<s3||(Rb.set(e,{code:t,at:i}),X.getState().appendMessage(e,{id:`companion-notice-${t}-${i}`,role:"system",content:n.userText,timestamp:i,meta:!0,metaCode:t}))}function p5(){return`cmsg-${Date.now()}-${++n3}`}function Rm(){return p5()}const a3=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 l3(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 m5(e){return`companion:last-seq:${e}`}function Lm(e){const t=Md.get(e);if(typeof t=="number")return t;try{const n=localStorage.getItem(m5(e)),i=n?Number(n):0,a=Number.isFinite(i)?Math.max(0,Math.floor(i)):0;return Md.set(e,a),a}catch{return 0}}function Lb(e,t){const n=Math.max(0,Math.floor(t));Md.set(e,n);try{localStorage.setItem(m5(e),String(n))}catch{}}function Db(e,t){Fn(e,{type:"session_ack",last_seq:t})}function _d(e){return e.map(t=>t.type==="text"?t.text:t.type==="thinking"?t.thinking:"").filter(Boolean).join(`
|
|
63
|
-
`)}function Mp(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 o3(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const f of i)a.set(Mp(f),f);const o=[],u=new Set;for(const f of n){const h=Mp(f);u.has(h)||(u.add(h),o.push(a.get(h)||f))}for(const f of i){const h=Mp(f);u.has(h)||(u.add(h),o.push(f))}return o}function zb(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:gc(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Dm(e,t){const n=o3(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?_d(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function c3(e,t){const n=X.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=Dm(o[a],t),n.setMessages(e,o)}function u3(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=X.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),g5(e,n)}function g5(e,t,n={}){var u,f,h,p,g,x;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=X.getState();if(i&&typeof t.seq=="number"){const b=Lm(e);if(t.seq<=b)return;Lb(e,t.seq),a&&Db(e,t.seq)}switch(QN.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=l5(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){ws(e),o.setStreaming(e,null),cl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:_d(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=_d(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(ws(e),c3(e,_),o.setStreaming(e,null),ks.delete(e),Di.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,zb(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=b.content)!=null&&h.length&&(Cp(e,b.content),Ep(e,b.content),Tp(e,b.content),Ap(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(ks.delete(e),Di.delete(e),ws(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=Di.get(e)||{thinking:"",text:""};ks.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Di.set(e,_),ks.set(e,"text"),o.setStreaming(e,_.text),Mb(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Di.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Di.set(e,_),ks.set(e,"thinking"),o.setStreaming(e,_.thinking),Mb(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Rd.delete(e),Ld.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),ws(e),o.setStreaming(e,null),ks.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&gN(),!document.hasFocus()&&o.notificationDesktop&&Eb("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:li(),role:"system",content:Ab(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;Eb("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];Cp(e,y),Ep(e,y),Tp(e,y),Ap(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:li(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||li(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=Tb(t.event);if(!b)break;o.appendMessage(e,{id:li(),role:"system",content:b,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:li(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:li(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)?cl(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."}):cl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)&&cl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)?cl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):cl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||li(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const k=N.message,A=_d(k.content),C={id:k.id,role:"assistant",content:A,contentBlocks:k.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},L=b.findIndex(D=>D.role==="assistant"&&D.id===C.id);if(L===-1?b.push(C):b[L]=Dm(b[L],C),(x=k.content)!=null&&x.length){Cp(e,k.content),Ep(e,k.content),Tp(e,k.content),Ap(e,k.content);const D=N.timestamp||Date.now();for(const z of k.content){if(z.type==="tool_use"){const q=z.input||{},$=y.get(z.id);y.set(z.id,$??zb(z.id,z.name,q,D,N.parent_tool_use_id))}if(z.type==="tool_result"){const q=y.get(z.tool_use_id);q&&y.set(z.tool_use_id,{...q,completedAt:D,isError:q.isError||!!z.is_error,elapsedSeconds:Math.max(q.elapsedSeconds,q.completedAt?q.elapsedSeconds:Math.max(0,(D-q.startedAt)/1e3))})}}}}else if(N.type==="result"){const k=N.data;k.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:Ab(k),timestamp:Date.now()});const A={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(A.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(A.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const L=C,D=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);A.context_used_percent=Math.max(0,Math.min(D,100))}}o.updateSession(e,A)}else if(N.type==="system_event"){const k=Tb(N.event);if(!k)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:N.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const k of b){const A=N.findIndex(L=>L.id===k.id);if(A===-1){N.push(k);continue}const C=N[A];C.role==="assistant"&&k.role==="assistant"?N[A]=Dm(C,k):N[A]=k}N.sort((k,A)=>(k.timestamp??0)-(A.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(ws(e),o.setStreaming(e,null),ks.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=Lm(e);y.seq<=_||(Lb(e,y.seq),b=y.seq,g5(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Db(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:li(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:li(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Ac(e){const t=Yr.get(e);if(f5(t))return;if(t){try{t.close()}catch{}Yr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(l3(e));Yr.set(e,i),i.onopen=()=>{const a=Lm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),i3(e,i);const o=Ii.get(e);o&&(clearTimeout(o),Ii.delete(e))},i.onmessage=a=>u3(e,a),i.onclose=()=>{Yr.get(e)===i&&(Yr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),d3(e))},i.onerror=()=>{i.close()}}function d3(e){if(Ii.has(e)||vc)return;const t=setTimeout(()=>{Ii.delete(e),!vc&&h5(e)&&Ac(e)},WN);Ii.set(e,t)}function zm(e){const t=Ii.get(e);t&&(clearTimeout(t),Ii.delete(e));const n=Yr.get(e);n&&(n.close(),Yr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Rd.delete(e),Ld.delete(e),Ko.delete(e),bd.delete(e),ks.delete(e),sc.delete(e),Di.delete(e),Md.delete(e),xc.delete(e)}function f3(e){if(!vc)for(const t of e)t.archived||Ac(t.sessionId)}function h3(e){return new Promise((t,n)=>{const i=setInterval(()=>{const o=Yr.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Fn(e,t){const n=Yr.get(e);let i=t;const a=a3.has(t.type);if(a)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:p5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&r3(e,i)}function Ob(e){Fn(e,{type:"mcp_get_status"})}function p3(e,t,n){Fn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function m3(e,t){Fn(e,{type:"mcp_reconnect",serverName:t})}function g3(e,t){Fn(e,{type:"mcp_set_servers",servers:t})}function x3(e,t){Fn(e,{type:"set_ai_validation",...t})}var ie=typeof window<"u"?window:void 0,Rn=typeof globalThis<"u"?globalThis:ie,Hn=Rn==null?void 0:Rn.navigator,Ce=Rn==null?void 0:Rn.document,an=Rn==null?void 0:Rn.location,Pg=Rn==null?void 0:Rn.fetch,Om=Rn!=null&&Rn.XMLHttpRequest&&"withCredentials"in new Rn.XMLHttpRequest?Rn.XMLHttpRequest:void 0,Bb=Rn==null?void 0:Rn.AbortController,v3=Rn==null?void 0:Rn.CompressionStream,er=Hn==null?void 0:Hn.userAgent;function x5(){return!(!ie||ie.navigator.onLine===!1)}var zo=typeof globalThis<"u"?globalThis:ie;zo&&typeof self>"u"&&(zo.self=zo),zo&&typeof File>"u"&&(zo.File=function(){});var Oe=ie??{},St={DEBUG:!1,LIB_VERSION:"0.2.2",LIB_NAME:"browser-common"};function Pb(e,t,n,i,a,o,u){try{var f=e[o](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,a)}function tn(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function u(h){Pb(o,i,a,u,f,"next",h)}function f(h){Pb(o,i,a,u,f,"throw",h)}u(void 0)}))}}function me(){return me=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},me.apply(null,arguments)}function v5(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 $b=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Fb(e){return typeof e=="string"||e}function Ub(e){return typeof e=="string"?e:void 0}var Oo,b3=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Bi=(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.AiQueue="ai_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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",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})({}),Hb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),y3=["$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"],_3=["token"],b5="NativeGzipValidationError",Bm=e=>e.length>=2&&e[0]===31&&e[1]===139,Ib=(e,t)=>e===Hb.GZipJS||t===Hb.GZipJS||t==="gzip",qb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",nd=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=b5,t},w3=(function(){var e=tn((function*(t,n){18>t.size&&nd("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Bm(i)&&i[2]===8||nd("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Oo)return Oo;Oo=[];for(var g=0;256>g;g++){for(var x=g,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;Oo[g]=x>>>0}return Oo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&nd("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&nd("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Pm(){return Pm=tn((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(i).then((()=>o.close())).catch((function(){var p=tn((function*(g){try{yield o.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),h=(yield Promise.all([f,u]))[0];return yield w3(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Pm.apply(this,arguments)}var S3=["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"],Vb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return S3.concat(t).some((i=>{var a=i.toLowerCase();return n.indexOf(a)!==-1}))};function qe(e,t){return e.indexOf(t)!==-1}var ff=function(e){return e.trim()},$m=function(e){return e.replace(/^\$/,"")};function y5(e){var t,n=[];return(t=JSON.stringify(e,(function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var _5=Object.prototype,w5=_5.hasOwnProperty,hf=_5.toString,Ge=Array.isArray||function(e){return hf.call(e)==="[object Array]"},Gr=e=>typeof e=="function",It=e=>e===Object(e)&&!Ge(e),js=e=>{if(It(e)){for(var t in e)if(w5.call(e,t))return!1;return!0}return!1},_e=e=>e===void 0,Mt=e=>hf.call(e)=="[object String]",Fm=e=>Mt(e)&&e.trim().length===0,In=e=>e===null,We=e=>_e(e)||In(e),Cn=e=>hf.call(e)=="[object Number]"&&e==e,zi=e=>Cn(e)&&e>0,Wr=e=>hf.call(e)==="[object Boolean]",k3=e=>e instanceof FormData,j3=e=>qe(y3,e),N3=e=>qe(_3,e);function S5(e){return e===null||typeof e!="object"}function Dd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function $g(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var C3=[!0,"true",1,"1","yes"],Rp=e=>qe(C3,e),E3=[!1,"false",0,"0","no"];function ci(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),Cn(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: "+a),ci(a||n,t,n,i))}class T3{constructor(t){this.$e={},this.ze=t.ze,this.Ze=ci(t.bucketSize,0,100,t.Ge),this.Qe=ci(t.refillRate,0,this.Ze,t.Ge),this.Je=ci(t.refillInterval,0,864e5,t.Ge)}Ke(t,n){var i=Math.floor((n-t.lastAccess)/this.Je);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qe,this.Ze),t.lastAccess=t.lastAccess+i*this.Je)}consumeRateLimit(t){var n,i=Date.now(),a=String(t),o=this.$e[a];return o?this.Ke(o,i):this.$e[a]=o={tokens:this.Ze,lastAccess:i},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.ze)==null||n.call(this,t)),o.tokens===0)}stop(){this.$e={}}}var mr="Mobile",zd="iOS",Hi="Android",Nl="Tablet",k5=Hi+" "+Nl,j5="iPad",N5="Apple",C5=N5+" Watch",ac="Safari",Cl="BlackBerry",E5="Samsung",T5=E5+"Browser",A5=E5+" Internet",ga="Chrome",A3=ga+" OS",M5=ga+" "+zd,Fg="Internet Explorer",R5=Fg+" "+mr,Ug="Opera",M3=Ug+" Mini",Hg="Edge",L5="Microsoft "+Hg,Sl="Firefox",D5=Sl+" "+zd,bc="Nintendo",yc="PlayStation",kl="Xbox",z5=Hi+" "+mr,O5=mr+" "+ac,Zo="Windows",Um=Zo+" Phone",Gb="Nokia",Hm="Ouya",B5="Generic",R3=B5+" "+mr.toLowerCase(),P5=B5+" "+Nl.toLowerCase(),Im="Konqueror",$5="Oculus Browser",Od="Vivaldi",F5="Yandex",Bd="Whale",qm="DuckDuckGo",U5="Pale Moon",Pd="Waterfox",lc="Brave",H5="Google Search App",Wt="(\\d+(\\.\\d+)?)",Lp=new RegExp("Version/"+Wt),L3=new RegExp(kl,"i"),D3=new RegExp(yc+" \\w+","i"),z3=new RegExp(bc+" \\w+","i"),Ig=new RegExp(Cl+"|PlayBook|BB10","i"),O3={"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"},I5=function(e,t,n,i){t=t||"";var a=(function(o){return o!=null&&o.brave?lc:null})(n);return a||(i!=null&&i.detectGoogleSearchApp&&qe(e,"GSA/")?H5:qe(e," OPR/")&&qe(e,"Mini")?M3:qe(e," OPR/")?Ug:Ig.test(e)?Cl:qe(e,"IE"+mr)||qe(e,"WPDesktop")?R5:qe(e,"OculusBrowser")?$5:qe(e,T5)?A5:qe(e,Hg)||qe(e,"Edg/")?L5:qe(e,Od+"/")?Od:qe(e,"YaBrowser/")?F5:qe(e,Bd+"/")?Bd:qe(e,qm+"/")||qe(e,"Ddg/")?qm:qe(e,"FBIOS")?"Facebook "+mr:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?M5:qe(e,"CrMo")||qe(e,ga)?ga:qe(e,Hi)&&qe(e,ac)?z5:qe(e,"FxiOS")?D5:qe(e.toLowerCase(),Im.toLowerCase())?Im:qe(e,lc+"/")?lc:((o,u)=>u&&qe(u,N5)||(function(f){return qe(f,ac)&&!qe(f,ga)&&!qe(f,Hi)})(o))(e,t)?qe(e,mr)?O5:ac:qe(e,"PaleMoon/")?U5:qe(e,Pd+"/")?Pd:qe(e,Sl)?Sl:qe(e,"MSIE")||qe(e,"Trident/")?Fg:qe(e,"Gecko")?Sl:"")},B3={[R5]:[new RegExp("rv:"+Wt)],[L5]:[new RegExp(Hg+"?\\/"+Wt)],[ga]:[new RegExp("("+ga+"|CrMo)\\/"+Wt)],[M5]:[new RegExp("CriOS\\/"+Wt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Wt)],[ac]:[Lp],[O5]:[Lp],[Ug]:[new RegExp("(Opera|OPR)\\/"+Wt)],[Sl]:[new RegExp(Sl+"\\/"+Wt)],[D5]:[new RegExp("FxiOS\\/"+Wt)],[Im]:[new RegExp("Konqueror[:/]?"+Wt,"i")],[Cl]:[new RegExp(Cl+" "+Wt),Lp],[z5]:[new RegExp("android\\s"+Wt,"i")],[A5]:[new RegExp(T5+"\\/"+Wt)],[$5]:[new RegExp("OculusBrowser\\/"+Wt)],[Od]:[new RegExp(Od+"\\/"+Wt)],[F5]:[new RegExp("YaBrowser\\/"+Wt)],[Bd]:[new RegExp(Bd+"\\/"+Wt)],[lc]:[new RegExp(lc+"\\/"+Wt)],[qm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Wt)],[U5]:[new RegExp("PaleMoon\\/"+Wt)],[Pd]:[new RegExp(Pd+"\\/"+Wt)],[H5]:[new RegExp("GSA\\/"+Wt)],[Fg]:[new RegExp("(rv:|MSIE )"+Wt)],Mozilla:[new RegExp("rv:"+Wt)]},P3=function(e,t,n,i){var a=I5(e,t,n,i),o=B3[a];if(_e(o))return null;for(var u=0;o.length>u;u++){var f=e.match(o[u]);if(f)return parseFloat(f[f.length-2])}return null},Yb=[[new RegExp(kl+"; "+kl+" (.*?)[);]","i"),e=>[kl,e&&e[1]||""]],[new RegExp(bc,"i"),[bc,""]],[new RegExp(yc,"i"),[yc,""]],[Ig,[Cl,""]],[new RegExp(Zo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Um,""];if(new RegExp(mr).test(t)&&!/IEMobile\b/.test(t))return[Zo+" "+mr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=O3[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Zo,i]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[zd,[e[3],e[4],e[5]||"0"].join(".")]:[zd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=_e(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/,[A3,""]],[/Linux|debian/i,["Linux",""]]],Wb=function(e){return z3.test(e)?bc:D3.test(e)?yc:L3.test(e)?kl:new RegExp(Hm,"i").test(e)?Hm:new RegExp("("+Um+"|WPDesktop)","i").test(e)?Um:/iPad/.test(e)?j5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?C5:Ig.test(e)?Cl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Gb,"i").test(e)?Gb:/(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(mr).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:k5:new RegExp("(pda|"+mr+")","i").test(e)?R3:new RegExp(Nl,"i").test(e)&&!new RegExp(Nl+" pc","i").test(e)?P5:""},$3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qb(e,t){return typeof(n=e)=="string"&&$3.test(n)?e:t();var n}function Es(e){return e&&e.split("#")[0]}function wd(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var F3=e=>e instanceof Error,q5={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}},U3=q5.info;function V5(e){if(Wr(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(Ge(e))return{arrayValue:{values:e.map((t=>V5(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function $d(e){var t=[];for(var n in e){var i=e[n];In(i)||_e(i)||t.push({key:n,value:V5(i)})}return t}function H3(e,t){var n=q5[e.level||"info"]||U3,i=n.text,a=n.number,o=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),We(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),We(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),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=me({},u,e.attributes||{}),h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:e.body},attributes:$d(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),_e(e.trace_flags)||(h.flags=e.trace_flags),h}function G5(e,t,n){return me({},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 Y5(e,t,n,i){return{resourceLogs:[{resource:{attributes:$d(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let I3=class{constructor(e,t,n,i,a,o,u){var f;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.Te=t,this.Ge=n,this.Ye=i,this.Xe=a,this.et=o,this.tt=u,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=t.maxBufferSize,this.dt=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.ct=t.flushIntervalMs,this.vt=t.maxBatchRecordsPerPost,this.ft=t.rateCapWindowMs,this.yt=t.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.wt(e);if(t!==null)if(t.body){if(this.xt()){var n={record:H3(t,this.Ye())};this.Xe((()=>this.kt(n)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var n=Ge(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.Ge.info("Log was rejected in beforeSend function"),null;i=o}catch(u){return this.Ge.error("Error in beforeSend function for log:",u),null}return i}xt(){if(this.yt===void 0)return!0;var e=Date.now(),t=e-this.st;return this.ft>t&&t>=0||(this.st=e,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var e=this;return tn((function*(){if(!e._instance.isDisabled)return e.rt||(e.rt=e.St().finally((()=>{e.rt=null}))),e.rt}))()}St(){var e=this;return tn((function*(){var t;e.bt();var n=(t=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,a=0;n.length>0&&i>a;){var o,u;e.it=0;var f=Math.min(n.length,e.vt),h=n.slice(0,f),p=Y5(h.map((x=>x.record)),e.Ct(),(o=e.tt)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.Tt(p);if(g.kind==="too-large"&&h.length>1)e.vt=Math.max(1,Math.floor(h.length/2)),e.Ge.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.vt);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.Ge.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."):g.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.vt&&(e.vt=Math.min(e.Te.maxBatchRecordsPerPost,e.vt+1)),yield e.It(h.length),n=(u=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,g.kind==="fatal"))throw g.error}}))()}It(e){var t=this;return tn((function*(){var n,i=Math.max(0,e-t.it),a=(n=t._instance.getPersistedProperty(Bi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bi.LogsQueue,a.slice(i)),yield t.et()}))()}Ct(){return G5(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];this.dt>n.length||(n.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bi.LogsQueue,n),this.ht>n.length?this.Mt():this._t()}}Mt(e){e===void 0&&(e=this.ct),this.Et||(this.Et=wd((()=>{this.Et=void 0,this._t()}),e))}Rt(){var e=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,e)}Pt(){var e=this._instance.getPersistedProperty(Bi.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return tn((function*(){t.bt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((i=>wd(i,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return tn((function*(){var n=!1,i=t.flush(),a=new Promise((o=>wd((()=>{n=!0,o()}),e)));try{yield Promise.race([i,a])}finally{n&&i.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(e=>{this.nt++,this.Ge.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}};var Dp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Xb(e){return String(e)+"000000"}function Kb(e,t,n,i){var a="";return i&&(a=Object.keys(i).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(i[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let q3=class{constructor(e,t,n){this._instance=e,this.Te=t,this.Ge=n,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(e,t,n){t===void 0&&(t=1),this.Nt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Nt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Nt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.rt,n=(function(){var a=tn((function*(){t&&(yield t.catch((()=>{}))),yield e.Dt()}));return function(){return a.apply(this,arguments)}})(),i=n().finally((()=>{this.rt===i&&(this.rt=null)}));return this.rt=i,i}drainWindow(){if(this.Ot.size===0)return null;var e=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(e)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.wt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.Ge.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,i;try{n=t.attributes?me({},t.attributes):void 0,i=Kb(t.type,t.name,t.unit,n)}catch(u){return void this.Ge.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.Ot.get(i);if(!a){if(!this.jt())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Ot.set(i,a)}var o=this.Lt.get(t.name);o===void 0?this.Lt.set(t.name,t.type):o===t.type||this.$t.has(t.name)||(this.$t.add(t.name),this.Ge.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(a,t.value),this.Mt()}else this.Ge.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Dp.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,Dp)]+=1}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var n=Ge(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.Ge.info("Metric was rejected in beforeSend function"),null;i=o}catch(u){return this.Ge.error("Error in beforeSend function for metric:",u),null}return i}Mt(){this.Et||(this.Et=wd((()=>{this.Et=void 0,this.flush().catch((e=>{this.Ge.error("Metrics flush failed:",e)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var e=this;return tn((function*(){if(e.Ot.size!==0){var t=e.Ot;e.Ot=new Map,e.Ft=!1,e.Lt=new Map,e.$t=new Set;var n=e.At,i=yield e._instance.Bt(e.qt(t));if(n===e.At)switch(i.kind){case"ok":return;case"retry-later":return e.Ut(t),void e.Mt();case"too-large":return void e.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.Ge.error("Failed to send metrics batch:",i.error)}}}))()}qt(e){return t=this.zt(e),n=(function(o,u,f){return me({},o.resourceAttributes,{"service.name":o.serviceName||"unknown_service"},o.environment&&{"deployment.environment":o.environment},o.serviceVersion&&{"service.version":o.serviceVersion},{"telemetry.sdk.name":u,"telemetry.sdk.version":f})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$d(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}zt(e){var t=Xb(Date.now()),n=new Map;for(var i of e.values()){var a,o=Kb(i.type,i.name,i.unit,void 0),u=n.get(o);u||(u=me({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var f=$d((a=i.attributes)!==null&&a!==void 0?a:{}),h=Xb(i.windowStartMs);if(i.type==="count"){var p,g={attributes:f,startTimeUnixNano:h,timeUnixNano:t,asDouble:(p=i.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(g)}else if(i.type==="gauge"){var x,b={attributes:f,timeUnixNano:t,asDouble:(x=i.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else i.hist&&u.histogram.dataPoints.push({attributes:f,startTimeUnixNano:h,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Dp})}return Array.from(n.values())}Ut(e){var t,n;for(var i of e){var a=i[0],o=i[1],u=this.Ot.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var f=0;u.hist.bucketCounts.length>f;f++)u.hist.bucketCounts[f]+=o.hist.bucketCounts[f]}else u.hist=o.hist}else this.jt()&&this.Ot.set(a,o)}}};var rd,Zb,zp;function V3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return zp&&n.length===Zb||(Zb=n.length,zp=n.reduce(((i,a)=>{rd||(rd={});var o=rd[a];if(o)i[o[0]]=o[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[a];if(p&&g){i[p]=g,rd[a]=[p,g];break}}return i}),{})),zp}}class G3{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"},a=this.buildCoercingContext(i,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return tn((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ge(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,a;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),me({},t,{cause:i,stack:a})}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 tn((function*(){var i=t;for(var a of n.modifiers)i=yield a(i);return i}))()}convertToExceptionList(t,n){var i,a,o,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,me({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:V3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var a=(o,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,f)}};return me({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,i),next:o=>a(o,i+1)})}}var El="?";function Vm(e,t,n,i,a){var o={platform:e,filename:t,function:n==="<anonymous>"?El:n,in_app:!0};return _e(i)||(o.lineno=i),_e(a)||(o.colno=a),o}var W5=(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]:El,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Y3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,W3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Q3=/\((\S*)(?::(\d+))(?::(\d+))\)/,X3=(e,t)=>{var n=Y3.exec(e);if(n)return Vm(t,n[1],El,+n[2],+n[3]);var i=W3.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Q3.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var o=W5(i[1]||El,i[2]);return Vm(t,o[1],o[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},K3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Z3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,J3=(e,t)=>{var n=K3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=Z3.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var a=n[3],o=n[1]||El,u=W5(o,a);return Vm(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Jb=/\(error: (.*)\)/;class eC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=Mt(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 Dd(t,"DOMException")}isDOMError(t){return Dd(t,"DOMError")}}class tC{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 nC{constructor(){}match(t){return Dd(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 rC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class iC{match(t){return typeof t=="string"}coerce(t,n){var i,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,a=t.match(rC);return a&&(n=a[1],i=a[2]),[n,i]}}var sC=["fatal","error","warning","log","info","debug"];function Q5(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 a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class aC{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,a=this.getErrorPropertyFromObject(t);return a?n.apply(a):{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 $g(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: "+Q5(t)}isSeverityLevel(t){return Mt(t)&&!Fm(t)&&sC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(F3(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class lC{match(t){return $g(t)}coerce(t,n){var i,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+Q5(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class oC{match(t){return S5(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 cC{match(t){return Dd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!$g(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,a=this.getUnhandledRejectionReason(t);return S5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(a)}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 Fd="$message",Ud="$timestamp",uC=new Set([Fd,Ud]),Op={enabled:!0,max_bytes:32768};function Hd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Op.enabled,max_bytes:fC(e.max_bytes,Op.max_bytes)}:me({},Op)}class dC{constructor(t){this.Vt=[],this.Wt=0,this.Te=Hd(t)}setConfig(t){this.Te=Hd(t),this.Zt()}add(t){var n=(function(a){var o;try{o=y5(a)}catch{return}try{var u=JSON.parse(o);if(!It(u))return;var f=u,h=f[Fd],p=f[Ud];return!Mt(h)||h.trim().length===0||!Mt(p)&&!Cn(p)?void 0:{step:f,json:o}}catch{return}})(t);if(n){var i=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,f=0;o.length>f;f++)o[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.Te.max_bytes||(this.Vt.push({step:n.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((t=>t.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var t=this.Vt.shift();t&&(this.Wt-=t.bytes)}}}function fC(e,t){if(!Cn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var X5=function(e,t){var n=(t===void 0?{}:t).debugEnabled,i={k(a){if(ie&&(St.DEBUG||ie.POSTHOG_DEBUG||n)&&!_e(ie.console)&&ie.console){for(var o=("__rrweb_original__"in ie.console[a])?ie.console[a].__rrweb_original__:ie.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];o(e,...f)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){i.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>X5(e+" "+a,o)};return i},Se=X5("[PostHog.js]"),Vt=Se.createLogger,hC=Vt("[ExternalScriptsLoader]"),Bp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return hC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ce==null?void 0:Ce.querySelectorAll("script");if(i){for(var a,o=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(a=o())return a.v}var f=()=>{if(!Ce)return n("document not found");var h=Ce.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=x=>{h.__posthog_loading_callback_fired=!0,n(void 0,x)},h.onerror=x=>n(x),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")Ce.head.appendChild(h);else{var p,g=Ce.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ce.body.appendChild(h)}};Ce!=null&&Ce.body?f():Ce==null||Ce.addEventListener("DOMContentLoaded",f)};Oe.__PosthogExtensions__=Oe.__PosthogExtensions__||{},Oe.__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 a="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var o=3e5;a=a+"&t="+Math.floor(Date.now()/o)*o}i=e.requestRouter.endpointFor("assets",a)}Bp(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Bp(e,u,n)}},Oe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);Bp(e,i,n)};St.DEBUG=!1,St.LIB_VERSION="1.407.3",St.LIB_NAME="web";var K5="$people_distinct_id",Id="$device_id",Pp="$device_model",Jo="__alias",ec="__timers",Gm="$autocapture_disabled_server_side",Ym="$heatmaps_enabled_server_side",Wm="$exception_capture_enabled_server_side",Qm="$error_tracking_suppression_rules",Xm="$error_tracking_capture_extension_exceptions",Km="$web_vitals_enabled_server_side",qg="$dead_clicks_enabled_server_side",Vg="$product_tours_enabled_server_side",Zm="$web_vitals_allowed_metrics",ma="$session_recording_remote_config",Z5="$replay_sample_rate",J5="$replay_override_sampling",ew="$replay_override_linked_flag",tw="$replay_override_url_trigger",nw="$replay_override_event_trigger",_l="$sesid",Gg="$session_is_sampled",pa="$enabled_feature_flags",Sd="$active_feature_flags",tc="$early_access_features",Jm="$feature_flag_details",kd="$feature_flag_payloads",eg="$feature_flag_request_id",qd="$minimal_flag_called_events",Oi="$override_feature_flags",xl="$override_feature_flag_payloads",ua="$stored_person_properties",da="$stored_group_properties",tg="$surveys",Vd="$surveys_loaded_at",ng="$surveys_activated",jd="$surveys_activated_session",nc="ph_product_tours",oc="$flag_call_reported",rg="$flag_call_reported_session_id",ig="$feature_flag_errors",_c="$feature_flag_evaluated_at",Vr="$user_state",sg="$client_session_props",ag="$capture_rate_limit",lg="$initial_campaign_params",og="$initial_referrer_info",Gd="$initial_person_info",Yd="$epp",id="$posthog_cookieless",rw="$cookieless_mode",iw="$sdk_debug_extensions_init_method",sw="$sdk_debug_extensions_init_time_ms",aw="$sdk_debug_recording_script_not_loaded",Yg="PostHog loadExternalDependency extension not found.",fa="on_reject",$i="always",ul="anonymous",dl="identified",cg="identified_only",Wd="visibilitychange",Qd="beforeunload",vl="$pageview",$p="$pageleave",Fp="$identify",ey="$groupidentify";function sd(e,t){Ge(e)&&e.forEach(t)}function Rt(e,t){if(!We(e))if(Ge(e))e.forEach(t);else if(k3(e))e.forEach(((i,a)=>t(i,a)));else for(var n in e)w5.call(e,n)&&t(e[n],n)}var $t=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 a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function Nd(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 ty=function(e){try{return e()}catch{return}},pC=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(a){Se.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Se.critical(a)}}},Wg=function(e){var t={};return Rt(e,(function(n,i){(Mt(n)&&n.length>0||Cn(n))&&(t[i]=n)})),t},mC=["herokuapp.com","vercel.app","netlify.app"];function gC(e){var t=e==null?void 0:e.hostname;if(!Mt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of mC)if(n===i)return!1;return!0}function Qt(e,t,n,i){var a=i??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function lw(e){return e.name==="ph_toolbar_internal"}var ow=e=>{if(Ce){try{for(var t=e+"=",n=Ce.cookie.split(";").filter((o=>o.length)),i=0;n.length>i;i++){for(var a=n[i];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Cn(e)&&isFinite(e)&&Math.floor(e)===e});class Xd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Xd(o)}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 Xd(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 xC{generate(){var t=this.generateOrAbort();if(!_e(t))return t;this.S=0;var n=this.generateOrAbort();if(_e(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Xd.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new vC}}var ny,cw=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};ie&&!_e(ie.crypto)&&crypto.getRandomValues&&(cw=e=>crypto.getRandomValues(e));class vC{nextUint32(){return this.R.length>this.O||(cw(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Pi=()=>bC().toString(),bC=()=>(ny||(ny=new xC)).generate(),Bo="",yC=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fi={N:()=>!!Ce,D(e){Se.error("cookieStore error: "+e)},A:ow,F(e){var t;try{t=JSON.parse(Fi.A(e))||{}}catch{}return t},q(e,t,n,i,a){if(!Ce)return!1;try{var o="",u="",f=(function(g,x){if(x){var b=(function(_,j){if(j===void 0&&(j=Ce),Bo)return Bo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),k=Math.min(N.length,8),A="dmn_chk_"+Pi();!Bo&&k--;){var C=N.slice(k).join("."),L=A+"=1;domain=."+C+";path=/";j.cookie=L+";max-age=3",j.cookie.includes(A)&&(j.cookie=L+";max-age=0",Bo=C)}return Bo})(g);if(!b){var y=(_=>{var j=_.match(yC);return j?j[0]:""})(g);y!==b&&Se.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(Ce.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),o="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&Se.warn("cookieStore warning: large cookie, len="+p.length),Ce.cookie=p,!0}catch{return!1}},P(e,t){if(Ce!=null&&Ce.cookie)try{Fi.q(e,"",-1,t)}catch{return}}},Up=null,zt={N(){if(!In(Up))return Up;var e=!0;if(_e(ie))e=!1;else try{var t="__mplssupport__";zt.q(t,"xyz"),zt.A(t)!=='"xyz"'&&(e=!1),zt.P(t)}catch{e=!1}return e||Se.error("localStorage unsupported; falling back to cookie store"),Up=e,e},D(e){Se.error("localStorage error: "+e)},A(e){try{return ie==null?void 0:ie.localStorage.getItem(e)}catch(t){zt.D(t)}return null},F(e){try{return JSON.parse(zt.A(e))||{}}catch{}return null},q(e,t){try{return ie==null||ie.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){zt.D(n)}return!1},P(e){try{ie==null||ie.localStorage.removeItem(e)}catch(t){zt.D(t)}}},_C=[Id,"distinct_id",_l,Gg,Yd,Gd,Vr],ad={},wC={N:()=>!0,D(e){Se.error("memoryStorage error: "+e)},A:e=>ad[e]||null,F:e=>ad[e]||null,q:(e,t)=>(ad[e]=t,!0),P(e){delete ad[e]}},ra=null,Nn={N(){if(!In(ra))return ra;if(ra=!0,_e(ie))ra=!1;else try{var e="__support__";Nn.q(e,"xyz"),Nn.A(e)!=='"xyz"'&&(ra=!1),Nn.P(e)}catch{ra=!1}return ra},D(e){Se.error("sessionStorage error: ",e)},A(e){try{return ie==null?void 0:ie.sessionStorage.getItem(e)}catch(t){Nn.D(t)}return null},F(e){try{return JSON.parse(Nn.A(e))||null}catch{}return null},q(e,t){try{return ie==null||ie.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Nn.D(n)}return!1},P(e){try{ie==null||ie.sessionStorage.removeItem(e)}catch(t){Nn.D(t)}}};class SC{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===$i||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===fa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Jt.q(this.Kt,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var t=this._instance.config,n=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+n:"__ph_opt_in_out_"+n)}get Qt(){var t=this.Jt.A(this.Kt);return Rp(t)?1:qe(E3,t)?0:-1}get Jt(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?zt:Fi;if(!this.Yt||this.Yt!==n){this.Yt=n;var i=t==="localStorage"?Fi:zt;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Rp(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[Hn==null?void 0:Hn.doNotTrack,Hn==null?void 0:Hn.msDoNotTrack,Oe.doNotTrack].some((t=>Rp(t)))}}function uw(e,t){var n,i=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Gr(i))return t;try{var a=i(t);return Mt(a)&&a?a:t}catch(o){return Se.error("Error in get_current_url, falling back to window.location.href",o),t}}var dw="__POSTHOG_TOOLBAR__",kC=1,jC=3,NC=11;function ry(e){return e instanceof Element&&(e.id===dw||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ts(e){return!!e&&e.nodeType===kC}function pr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function fw(e){return!!e&&e.nodeType===jC}function hw(e){return!!e&&e.nodeType===NC&&Ts(e.host)}var pw=1e3;function Qg(e){return e?ff(e).split(/\s+/):[]}function iy(e,t){var n=(function(i){var a,o=ie==null||(a=ie.location)==null?void 0:a.href;return _e(o)?void 0:uw(i,o)})(t);return!!(n&&e&&e.some((i=>n.match(i))))}function Kd(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 Qg(t)}function mw(e){return We(e)?null:ff(e).split(/(\s+)/).filter((t=>cc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function wc(e){var t="";return dg(e)&&!bw(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;fw(n)&&n.textContent&&(t+=(i=mw(n.textContent))!==null&&i!==void 0?i:"")})),ff(t)}function Hp(e){var t;return _e(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Xg=["a","button","form","input","select","textarea","label"];function ug(e,t){if(_e(t))return!0;var n,i=function(o){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}})(o,u))))return{v:!0}};for(var a of e)if(n=i(a))return n.v;return!1}function gw(e){var t=e.parentNode;return!(!t||!Ts(t))&&t}var CC=[".ph-no-autocapture","[data-ph-no-autocapture]"],xw=["next","previous","prev",">","<"],EC=[...xw,"+","-","−","–"],sy=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ay=[".ph-no-rageclick",".ph-no-capture"],TC=["","text","search","email","password","url","tel","number"];function ly(e,t){if(!ie||Kg(e))return!1;var n,i,a,o,u;if(Wr(t)?(n=!!t&&ay,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:ay,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Ts(h))&&(!!pr(h,"textarea")||(pr(h,"input")?qe(TC,(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 f=vw(e,!1).targetElementList;return!(function(h,p){if(h===!1||_e(h))return!1;var g;if(h===!0)g=xw;else{if(!Ge(h))return!1;if(h.length>10)return Se.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return g.some((_=>sy(b,_)||sy(y,_)))}))})(i,f.map((h=>{var p;return{safeText:wc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!ug(f,n)}var Kg=e=>!e||pr(e,"html")||!Ts(e),vw=(e,t)=>{if(!ie||Kg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],a=e;a.parentNode&&!pr(a,"body");)if(hw(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=gw(a);if(!o)break;if(t||Xg.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=ie.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function dg(e){for(var t=new Set,n=0,i=e;i.parentNode&&!pr(i,"body");i=i.parentNode){if(n++>=pw||t.has(i))return!1;t.add(i);var a=Kd(i);if(qe(a,"ph-sensitive")||qe(a,"ph-no-capture"))return!1}if(qe(Kd(e),"ph-include"))return!0;var o=e.type||"";if(Mt(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!Mt(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function bw(e){return!!(pr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||pr(e,"select")||pr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var yw="(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})",AC=new RegExp("^(?:"+yw+")$"),MC=new RegExp(yw),_w="\\d{3}-?\\d{2}-?\\d{4}",RC=new RegExp("^("+_w+")$"),LC=new RegExp("("+_w+")");function cc(e,t){return t===void 0&&(t=!0),!(We(e)||Mt(e)&&(e=ff(e),(t?AC:MC).test((e||"").replace(/[- ]/g,""))||(t?RC:LC).test(e)))}function oy(e){var t=wc(e);return cc(t=(t+" "+ww(e)).trim())?t:""}function ww(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 a=wc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+ww(n)).trim())}catch(o){Se.error("[AutoCapture]",o)}})),t}function cy(e){return e.replace(/"|\\"/g,'\\"')}function DC(e){var t=e.attr__class;if(t)return Ge(t)?t:Qg(t)}var ld=Vt("[Dead Clicks]"),zC=()=>!0,OC=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(qg)),i=e.instance.config.capture_dead_clicks;return Wr(i)?i:!!It(i)||n};class uy{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[qg]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?ld.error("failed to load script",a):t()}))}tr(){var t;if(Ce){if(!this.Xt&&(t=Oe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=It(this.instance.config.capture_dead_clicks)?me({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xt=Oe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xt.start(Ce),ld.info("starting...")}}else ld.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,ld.info("stopping..."))}}var Ip=Vt("[SegmentIntegration]"),Sw="posthog-js";function kw(e,t){var n=t===void 0?{}:t,i=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,f=u===void 0?["error"]:u,h=n.sendExceptionsToPostHog,p=h===void 0||h;return g=>{var x,b,y,_,j;if(f!=="*"&&!f.includes(g.level)||!e.__loaded)return g;g.tags||(g.tags={});var N=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());g.tags["PostHog Person URL"]=N,e.sessionRecordingStarted()&&(g.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var k,A=((x=g.exception)==null?void 0:x.values)||[],C=A.map((D=>me({},D,{stacktrace:D.stacktrace?me({},D.stacktrace,{type:"raw",frames:(D.stacktrace.frames||[]).map((z=>me({},z,{platform:"web:javascript"})))}):void 0}))),L={$exception_message:((b=A[0])==null?void 0:b.value)||g.message,$exception_type:(y=A[0])==null?void 0:y.type,$exception_level:g.level,$exception_list:C,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:((_=A[0])==null?void 0:_.value)||g.message,$sentry_exception_type:(j=A[0])==null?void 0:j.type,$sentry_tags:g.tags};return i&&a&&(L.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+a+"&query="+g.event_id),p&&((k=e.exceptions)==null||k.sendExceptionEvent(L)),g}}class BC{constructor(t,n,i,a,o,u){this.name=Sw,this.setupOnce=function(f){f(kw(t,{organization:n,projectId:i,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class dy{constructor(t){this.rr=(n,i,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(Se.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var i,a=this.ar(t,n);return this.ir={pathname:(i=ie==null?void 0:ie.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var i=this.ir;if(!i)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:i.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,f=o.lastScrollY,h=o.maxScrollY,p=o.maxContentHeight,g=o.lastContentY,x=o.maxContentY;if(!(_e(u)||_e(f)||_e(h)||_e(p)||_e(g)||_e(x))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),x=Math.ceil(x);var b=u>1?ci(f/u,0,1,Se):1,y=u>1?ci(h/u,0,1,Se):1,_=p>1?ci(g/p,0,1,Se):1,j=p>1?ci(x/p,0,1,Se):1;a=$t(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return i.pathname&&(a.$prev_pageview_pathname=i.pathname),i.timestamp&&(a.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),a}}var qp=["flags","surveys"],PC={[K5]:{exposure:"hidden"},[Jo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ec]:{exposure:"hidden"},[Gm]:{exposure:"event"},[Ym]:{exposure:"hidden"},[Wm]:{exposure:"event"},[Qm]:{exposure:"hidden"},[Xm]:{exposure:"event"},[Km]:{exposure:"event"},[qg]:{exposure:"event"},[Vg]:{exposure:"hidden"},[Zm]:{exposure:"event"},[ma]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[_l]:{exposure:"hidden"},[Gg]:{exposure:"event"},[Z5]:{exposure:"event",shouldSkipFromEventProperties:e=>In(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"},[pa]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!It(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[Sd]:{exposure:"event",storageGroup:"flags"},[tc]:{exposure:"hidden"},[Jm]:{exposure:"hidden",storageGroup:"flags"},[kd]:{exposure:"event",storageGroup:"flags"},[eg]:{exposure:"event",storageGroup:"flags",volatile:!0},[qd]:{exposure:"hidden",storageGroup:"flags"},[Oi]:{exposure:"event"},[xl]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[da]:{exposure:"hidden"},[tg]:{exposure:"hidden",storageGroup:"surveys"},[Vd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ng]:{exposure:"event"},[jd]:{exposure:"hidden"},[nc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[oc]:{exposure:"hidden"},[rg]:{exposure:"hidden"},[ig]:{exposure:"hidden"},[_c]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Vr]:{exposure:"hidden"},[sg]:{exposure:"hidden"},[ag]:{exposure:"hidden"},[lg]:{exposure:"hidden"},[og]:{exposure:"hidden"},[Gd]:{exposure:"hidden"},[Yd]:{exposure:"hidden"},[J5]:{exposure:"event"},[ew]:{exposure:"event"},[tw]:{exposure:"event"},[nw]:{exposure:"event"},[iw]:{exposure:"event"},[sw]:{exposure:"event"},[aw]:{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"}},$C=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ia=e=>{var t=PC[e];if(t)return t;for(var n of $C){var i=n[1];if(e.indexOf(n[0])===0)return i}},wl=(e,t)=>{try{return JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t)}catch{return y5(e)}},Zd=e=>{var t=Ce==null?void 0:Ce.createElement("a");return _e(t)?null:(t.href=e,t)},Tl=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;i.length>a;a++){var o=i[a].split("=");if(o[0]===t){n=o;break}}if(!Ge(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{Se.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Sc=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],f=o[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var x=h[g].split("=");Ge(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(h[g]))}var b=f;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},Jd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},jw=(e,t)=>e>=t&&x5(),Nw=(e,t,n,i)=>{if(e===0){if(x5()){var a=t+1;return a===n&&i(),a}return t}return 0},od="https?://(.*)",Al=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FC=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Al],kc="<masked>",UC=["li_fat_id"];function Cw(e,t,n){if(!Ce)return{};var i,a=t?[...Al,...n||[]]:[],o=Ew(Sc(Ce.URL,a,kc),e),u=(i={},Rt(UC,(function(f){var h=ow(f);i[f]=h||null})),i);return $t(u,o)}function Ew(e,t){var n=FC.concat(t||[]),i={};return Rt(n,(function(a){var o=Tl(e,a);i[a]=o||null})),i}function Tw(e){var t=(function(o){return o?o.search(od+"google.([^/?]*)")===0?"google":o.search(od+"bing.com")===0?"bing":o.search(od+"yahoo.com")===0?"yahoo":o.search(od+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!In(t)){i.$search_engine=t;var a=Ce?Tl(Ce.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function fy(){return navigator.language||navigator.userLanguage}var ef="$direct";function Aw(){return(Ce==null?void 0:Ce.referrer)||ef}function Mw(e,t,n){n===void 0&&(n=!1);var i=e?[...Al,...t||[]]:[],a=n?Es(an==null?void 0:an.href):an==null?void 0:an.href,o=a==null?void 0:a.substring(0,1e3);return{r:Aw().substring(0,1e3),u:o?Sc(o,i,kc):void 0}}function Rw(e,t){var n;t===void 0&&(t=!1);var i=e.r,a=e.u,o=t?Es(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==ef?ef:(n=Zd(i))==null?void 0:n.host};if(o){u.$current_url=o;var f=Zd(o);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=Ew(o);$t(u,h)}if(i){var p=Tw(i);$t(u,p)}return u}function Lw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function HC(){try{return new Date().getTimezoneOffset()}catch{return}}var IC={flags:_c,surveys:Vd},qC=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],fl="main";class Vp{constructor(t,n,i){if(i===void 0&&(i=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=i,this.props={},this.cr=!1,this.vr=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.Jt=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Se.info("Persistence loaded",t.persistence,me({},this.props)),this.update_config(t,t,n),this.save(),ie){var a=()=>this.flush();Qt(ie,"beforeunload",a,{capture:!1}),Qt(ie,"pagehide",a,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Cn(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){qC.indexOf(t.persistence.toLowerCase())===-1&&(Se.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=[..._C,...u];return me({},zt,{F(p){try{var g={};try{g=Fi.F(p)||{}}catch{}var x,b=JSON.parse(zt.A(p)||"{}");if(f){var y={};for(var _ in g){var j=g[_];In(j)||j===""||(y[_]=j)}x=$t(b,y)}else x=$t(g,b);return zt.q(p,x),x}catch{}return null},q(p,g,x,b,y,_){var j=zt.q(p,g,void 0,void 0,_);try{var N={};h.forEach((k=>{g[k]&&(N[k]=g[k])})),Object.keys(N).length&&Fi.q(p,N,x,b,y,_)}catch(k){zt.D(k)}return j},P(p,g){try{ie==null||ie.localStorage.removeItem(p),Fi.P(p,g)}catch(x){zt.D(x)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&zt.N()?(n=zt,a=!0):o==="localstorage+cookie"&&i.N()?(n=i,a=!0):o==="sessionstorage"&&Nn.N()?n=Nn:o==="memory"?n=wC:o==="cookie"?n=Fi:i.N()?(n=i,a=!0):n=Fi,this.ur=a,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[_c];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Rt(this.props,((n,i)=>{var a=ia(i);if((a==null?void 0:a.exposure)==="derived"){if(a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,i===pa?()=>this._r():()=>!1))return;a.transformToEventProperties&&$t(t,a.transformToEventProperties(n))}else if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,(()=>!1)))return;t[i]=n}})),t}load(){if(!this.yr){var t=this.Jt.F(this.vr);t&&(this.props=$t({},t)),this.hr&&this.wr()}}wr(){for(var t of qp){var n=zt.F(this.br(t));if(n&&!js(n)){var i=this.kr(t);i.persisted=!0,this.Sr(t)||(i.fingerprint=this.Cr(n,t)),this.Tr(t,n)||$t(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var i;return((i=ia(n))==null?void 0:i.storageGroup)===t}))}Tr(t,n){var i=IC[t];if(!i)return!1;var a=n[i],o=this.props[i];return Cn(a)&&Cn(o)&&o>a}refreshKey(t){var n;if(!this.yr){var i=this.hr?(n=ia(t))==null?void 0:n.storageGroup:void 0,a=i?zt.F(this.br(i)):this.Jt.F(this.vr);if(a&&t in a)this.Ir(t,a[t]);else{if(i){var o=this.Jt.F(this.vr);if(o&&t in o)return void this.Ir(t,o[t])}this.Mr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?_e(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){_e(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,fl))}Pr(){var t=this.Fr(),n=t.main,i=t.groups;for(var a of(this.Or(this.Jt,this.vr,n,fl),qp)){var o,u=i[a];(!js(u)||(o=this.lr[a])!=null&&o.persisted)&&this.Or(zt,this.br(a),u,a)}}Fr(){var t={},n={flags:{},surveys:{}};return Rt(this.props,((i,a)=>{var o,u=(o=ia(a))==null?void 0:o.storageGroup;u?n[u][a]=i:t[a]=i})),{main:t,groups:n}}Cr(t,n){if(n===fl)return JSON.stringify(t)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return Rt(t,((a,o)=>{var u;i[o]=(u=ia(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(i)}Or(t,n,i,a){var o=this.kr(a);if(a===fl||o.dirty||_e(o.fingerprint)){var u;try{if((u=this.Cr(i,a))===o.fingerprint)return void(o.dirty=!1)}catch{u=void 0}t.q(n,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(o.dirty=!1,a!==fl&&(o.persisted=!0),_e(u)||(o.fingerprint=u)):this.Te.debug&&Se.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,i=n!==void 0&&n;if(_e(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var a of qp)zt.P(this.br(a));i?delete this.lr[fl]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(It(t)){_e(n)&&(n="None"),this.Lr=_e(i)?this.Nr:i;var a=!1;if(Rt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Ir(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(It(t)){this.Lr=_e(n)?this.Nr:n;var i=!1;if(Rt(t,((a,o)=>{t.hasOwnProperty(o)&&this.props[o]!==a&&(this.Ir(o,a),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Mr(t),this.save())}update_campaign_params(){if(!this.cr){var t=Cw(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);js(Wg(t))||this.register(t),this.cr=!0}}update_search_keyword(){var t;this.register((t=Ce==null?void 0:Ce.referrer)?Tw(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Aw(),$referring_domain:Ce!=null&&Ce.referrer&&((t=Zd(Ce.referrer))==null?void 0:t.host)||ef},void 0)}set_initial_person_info(){this.props[lg]||this.props[og]||this.register_once({[Gd]:Mw(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Rt([og,lg],(a=>{var o=this.props[a];o&&Rt(o,(function(u,f){t["$initial_"+$m(f)]=u}))}));var n=this.props[Gd];if(n){var i=(function(a,o){o===void 0&&(o=!1);var u=Rw(a,o),f={};return Rt(u,(function(h,p){f["$initial_"+$m(p)]=h})),f})(n,this.Te.disable_capture_url_hashes);$t(t,i)}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.Nr=this.Lr=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 a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),x=[...p].sort();return g.every(((b,y)=>b===x[y]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=a?this.pr(t):this.Jt,u=this.gr(t);if(a||u!==this.hr){var f=this.props;this.clear(),this.Jt=o,this.hr=u,this.props=f,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ar&&(this.Ar=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[ec]||{};i[t]=n,this.Ir(ec,i),this.save()}remove_event_timer(t){var n=this.props[ec]||{},i=n[t];return _e(i)||(delete n[t],this.Ir(ec,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var i;this.props[t]=n,(i=ia(t))!=null&&i.volatile||this.Dr(t)}Mr(t){delete this.props[t],this.Dr(t)}Dr(t){var n,i=(n=ia(t))==null?void 0:n.storageGroup;i&&(this.kr(i).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}var $n={GZipJS:"gzip-js",Base64:"base64"},Po={Activation:"events",Cancellation:"cancelEvents"},Gp={Popover:"popover",API:"api",Widget:"widget"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Yp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},fg={Popover:"popover",Inline:"inline"},VC={SHOWN:"product tour shown"},hy={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},py=Vt("[RateLimiter]");class GC{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((a=>{py.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void py.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.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,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(ag))!==null&&n!==void 0?n:{tokens:o,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>o&&(h.tokens=o);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 "+o+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(ag,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $o=Vt("[RemoteConfig]");class Dw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Oe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(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 $o.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void $o.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return $o.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((n=>{this.Hr(n),this.Br()}));this.Hr(t),this.Br()}))}catch(t){$o.error("Error loading remote config",t)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Ce&&Ce.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var t;if(!this.zr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.zr=setInterval((()=>{this.refresh()}),n))}}Hr(t){var n;t||$o.error("Failed to fetch remote config from PostHog."),this._instance.Hr(t?{ok:!0,config:t}:{ok:!1}),(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 Or=Uint8Array,tr=Uint16Array,Ml=Uint32Array,Zg=new Or([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]),Jg=new Or([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]),my=new Or([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zw=function(e,t){for(var n=new tr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new Ml(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},Ow=zw(Zg,2),hg=Ow[1];Ow[0][28]=258,hg[258]=28;for(var gy=zw(Jg,0)[1],Bw=new tr(32768),qt=0;32768>qt;++qt){var hl=(43690&qt)>>>1|(21845&qt)<<1;Bw[qt]=((65280&(hl=(61680&(hl=(52428&hl)>>>2|(13107&hl)<<2))>>>4|(3855&hl)<<4))>>>8|(255&hl)<<8)>>>1}var uc=function(e,t,n){for(var i=e.length,a=0,o=new tr(t);i>a;++a)++o[e[a]-1];var u,f=new tr(t);for(a=0;t>a;++a)f[a]=f[a-1]+o[a-1]<<1;for(u=new tr(i),a=0;i>a;++a)u[a]=Bw[f[e[a]-1]++]>>>15-e[a];return u},va=new Or(288);for(qt=0;144>qt;++qt)va[qt]=8;for(qt=144;256>qt;++qt)va[qt]=9;for(qt=256;280>qt;++qt)va[qt]=7;for(qt=280;288>qt;++qt)va[qt]=8;var tf=new Or(32);for(qt=0;32>qt;++qt)tf[qt]=5;var YC=uc(va,9),WC=uc(tf,5),Pw=function(e){return(e/8>>0)+(7&e&&1)},$w=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof tr?tr:e instanceof Ml?Ml:Or)(n-t);return i.set(e.subarray(t,n)),i},Ai=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Fo=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Wp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new Or(0),0];if(a==1){var u=new Or(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(D,z){return D.f-z.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=a-1;)f=n[n[x].f>n[p].f?p++:x++],h=n[p!=g&&n[x].f>n[p].f?p++:x++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new tr(b+1),_=pg(n[g-1],y,0);if(_>t){i=0;var j=0,N=_-t,k=1<<N;for(o.sort((function(D,z){return y[z.s]-y[D.s]||D.f-z.f}));a>i;++i){var A=o[i].s;if(t>=y[A])break;j+=k-(1<<_-y[A]),y[A]=t}for(j>>>=N;j>0;){var C=o[i].s;t>y[C]?j-=1<<t-y[C]++-1:++i}for(;i>=0&&j;--i){var L=o[i].s;y[L]==t&&(--y[L],++j)}_=t}return[new Or(y),_]},pg=function(e,t,n){return e.s==-1?Math.max(pg(e.l,t,n+1),pg(e.r,t,n+1)):t[e.s]=n},xy=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tr(++t),i=0,a=e[0],o=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[f]}return[n.subarray(0,i),t]},Uo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},mg=function(e,t,n){var i=n.length,a=Pw(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},vy=function(e,t,n,i,a,o,u,f,h,p,g){Ai(t,g++,n),++a[256];for(var x=Wp(a,15),b=x[0],y=x[1],_=Wp(o,15),j=_[0],N=_[1],k=xy(b),A=k[0],C=k[1],L=xy(j),D=L[0],z=L[1],q=new tr(19),$=0;A.length>$;++$)q[31&A[$]]++;for($=0;D.length>$;++$)q[31&D[$]]++;for(var G=Wp(q,7),O=G[0],I=G[1],T=19;T>4&&!O[my[T-1]];--T);var ae,J,W,B,F=p+5<<3,Y=Uo(a,va)+Uo(o,tf)+u,xe=Uo(a,b)+Uo(o,j)+u+14+3*T+Uo(q,O)+(2*q[16]+3*q[17]+7*q[18]);if(Y>=F&&xe>=F)return mg(t,g,e.subarray(h,h+p));if(Ai(t,g,1+(Y>xe)),g+=2,Y>xe){ae=uc(b,y),J=b,W=uc(j,N),B=j;var R=uc(O,I);for(Ai(t,g,C-257),Ai(t,g+5,z-1),Ai(t,g+10,T-4),g+=14,$=0;T>$;++$)Ai(t,g+3*$,O[my[$]]);g+=3*T;for(var P=[A,D],Z=0;2>Z;++Z){var M=P[Z];for($=0;M.length>$;++$)Ai(t,g,R[de=31&M[$]]),g+=O[de],de>15&&(Ai(t,g,M[$]>>>5&127),g+=M[$]>>>12)}}else ae=YC,J=va,W=WC,B=tf;for($=0;f>$;++$)if(i[$]>255){var de;Fo(t,g,ae[257+(de=i[$]>>>18&31)]),g+=J[de+257],de>7&&(Ai(t,g,i[$]>>>23&31),g+=Zg[de]);var be=31&i[$];Fo(t,g,W[be]),g+=B[be],be>3&&(Fo(t,g,i[$]>>>5&8191),g+=Jg[be])}else Fo(t,g,ae[i[$]]),g+=J[i[$]];return Fo(t,g,ae[256]),g+J[256]},QC=new Ml([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),XC=(function(){for(var e=new Ml(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Qp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function KC(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=XC[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),i=e.length;n.p(e);var a,o,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,N){var k=x.length,A=new Or(_+k+5*(1+Math.floor(k/7e3))+j),C=A.subarray(_,A.length-j),L=0;if(!b||8>k)for(var D=0;k>=D;D+=65535){var z=D+65535;k>z?L=mg(C,L,x.subarray(D,z)):(C[D]=!0,L=mg(C,L,x.subarray(D,k)))}else{for(var q=QC[b-1],$=q>>>13,G=8191&q,O=(1<<y)-1,I=new tr(32768),T=new tr(O+1),ae=Math.ceil(y/3),J=2*ae,W=function(mt){return(x[mt]^x[mt+1]<<ae^x[mt+2]<<J)&O},B=new Ml(25e3),F=new tr(288),Y=new tr(32),xe=0,R=0,P=(D=0,0),Z=0,M=0;k>D;++D){var de=W(D),be=32767&D,je=T[de];if(I[be]=je,T[de]=be,D>=Z){var Re=k-D;if((xe>7e3||P>24576)&&Re>423){L=vy(x,C,0,B,F,Y,R,P,M,D-M,L),P=xe=R=0,M=D;for(var Le=0;286>Le;++Le)F[Le]=0;for(Le=0;30>Le;++Le)Y[Le]=0}var Be=2,Je=0,it=G,ht=be-je&32767;if(Re>2&&de==W(D-ht))for(var Xt=Math.min($,Re)-1,pt=Math.min(32767,D),yt=Math.min(258,Re);pt>=ht&&--it&&be!=je;){if(x[D+Be]==x[D+Be-ht]){for(var kt=0;yt>kt&&x[D+kt]==x[D+kt-ht];++kt);if(kt>Be){if(Be=kt,Je=ht,kt>Xt)break;var ge=Math.min(ht,kt-2),Fe=0;for(Le=0;ge>Le;++Le){var ct=D-ht+Le+32768&32767,mn=ct-I[ct]+32768&32767;mn>Fe&&(Fe=mn,je=ct)}}}ht+=(be=je)-(je=I[be])+32768&32767}if(Je){B[P++]=268435456|hg[Be]<<18|gy[Je];var ke=31&hg[Be],ze=31&gy[Je];R+=Zg[ke]+Jg[ze],++F[257+ke],++Y[ze],Z=D+Be,++xe}else B[P++]=x[D],++F[x[D]]}}L=vy(x,C,!0,B,F,Y,R,P,M,D-M,L)}return $w(A,0,_+Pw(L)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,f,h)),g=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&Qp(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),Qp(p,g-8,n.d()),Qp(p,g-4,i),p}var ZC=!!Om||!!Pg,Fw="text/plain",Cd=!1,Uw=(e,t)=>{var n=e.split("#"),i=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var f=u.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return o+(f?"?"+f:"")+(i?"#"+i:"")},ex=function(e,t,n){var i;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],f=me({},t),h=(i=u==null?void 0:u.split("&").map((g=>{var x,b=g.split("="),y=b[0],_=n&&(x=f[y])!==null&&x!==void 0?x:b[1];return delete f[y],y+"="+_})))!==null&&i!==void 0?i:[],p=(function(g,x){var b,y;x===void 0&&(x="&");var _=[];return Rt(g,(function(j,N){_e(j)||_e(N)||N==="undefined"||(b=encodeURIComponent((k=>k instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(f);return p&&h.push(p),h.length>0?o+"?"+h.join("&"):o},Xp=e=>{if(e.Vr)return e.Vr;var t=e.data,n=e.compression;if(t){if(n===$n.GZipJS){var i=KC((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Or(f.length+(f.length>>>1)),x=0,b=function(N){g[x++]=N},y=0;p>y;++y){if(x+5>g.length){var _=new Or(x+8+(p-y<<1));_.set(g),g=_}var j=f.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return $w(g,0,x)})(wl(t)),{mtime:0});return{contentType:Fw,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===$n.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(wl(t)),o=(f=>"data="+encodeURIComponent(typeof f=="string"?f:wl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=wl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Hw=e=>{var t,n,i=()=>e.transport==="sendBeacon"?{url:ex(e.url,{compression:$n.Base64}),encodedBody:Xp(me({},e,{compression:$n.Base64,Vr:void 0}))}:{url:Uw(e.url,"compression"),encodedBody:Xp(me({},e,{compression:void 0,Vr:void 0}))};try{t=Xp(e)}catch(a){if(Ib(e.compression,Tl(e.url,"compression")))return Se.error("Failed to gzip request body, sending uncompressed payload",a),i();throw a}return t&&Ib(e.compression,Tl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Bm(new Uint8Array(n)):ArrayBuffer.isView(n)&&Bm(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Cd=!0,i()):{url:e.url,encodedBody:t}},Iw=e=>{try{return Hw(e)}catch(t){return Se.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},JC=(function(){var e=tn((function*(t){var n=wl(t.data),i=yield(function(o,u,f){return Pm.apply(this,arguments)})(n,St.DEBUG,{rethrow:!0});if(!i)return t;var a=yield i.arrayBuffer();return me({},t,{Vr:{contentType:Fw,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),e4=/Failed to fetch|NetworkError|Load failed/i,qw=e=>{var t=Iw(e);if(t){var n=t.url,i=t.encodedBody,a=i??{},o=a.contentType,u=a.body,f=a.estimatedSize,h=new Headers;Rt(e.headers,(function(_,j){h.append(j,_)})),o&&h.append("Content-Type",o);var p=null,g=!1;if(Bb){var x=new Bb;p={signal:x.signal,timeout:setTimeout((()=>{var _,j;g=!0,x.abort((_=e.timeout,(j=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",j))}),e.timeout)}}var b=_=>{g&&(_==null?void 0:_.name)==="AbortError"||(j=>(j==null?void 0:j.name)==="TypeError"&&e4.test((j==null?void 0:j.message)||""))(_)?Se.warn(_):Se.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Pg(n,me({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(f||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var N={statusCode:_.status,text:j};if(_.status===200)try{N.json=JSON.parse(j)}catch(k){Se.error(k)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},gg=e=>{try{var t,n=Hw(e),i=n.url,a=n.encodedBody,o=a??{},u=o.body,f=o.estimatedSize;if(!u)return;var h=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Hn.sendBeacon(i,h))return;var p=Ge(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Ge(p)&&p.length>1&&(f??0)>16384){var g=Math.ceil(p.length/2),x=b=>Ge(e.data)?b:me({},e.data,{batch:b});return gg(me({},e,{data:x(p.slice(0,g))})),void gg(me({},e,{data:x(p.slice(g))}))}Se.warn("Beacon of ~"+(f??0)+" bytes was rejected by the browser, falling back to fetch"),qw(me({},e,{Wr:!0}))}catch(b){Se.warn("Beacon send failed",b)}},by=(e,t,n,i)=>{var a=i==="query"?t==="POST"?"sent_at":"_":void 0;return ex(n===$n.GZipJS?Uw(e,"compression"):e,me({},a?{[a]:Date.now().toString()}:{},n===$n.GZipJS?{}:{compression:n}))},Ed=[];Pg&&Ed.push({transport:"fetch",method:qw}),Om&&Ed.push({transport:"XHR",method(e){var t=Iw(e);if(t){var n=new Om,i=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=i??{},o=a.contentType,u=a.body;Rt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Hn!=null&&Hn.sendBeacon&&Ed.push({transport:"sendBeacon",method:gg});var xg=3e3;class t4{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=ci((n==null?void 0:n.flush_interval_ms)||xg,250,5e3,Se.createLogger("flush interval"),xg),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ei():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ti(me({},i,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ei(),i=function(){var o=n[a],u=new Date().getTime();o.data&&Ge(o.data)&&Rt(o.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.ti(o)};for(var a in n)i()}}),this.Qr))}ti(t){try{this.Jr(t)}catch(n){Se.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var t={};return Rt(this.Gr,(n=>{var i,a=n,o=(a?a.batchKey:null)||a.url;_e(t[o])&&(t[o]=me({},a,{data:[]})),(i=t[o].data)==null||i.push(a.data)})),this.Gr=[],t}}var n4=["retriesPerformedSoFar"];class r4{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!_e(ie)&&"onLine"in ie.navigator&&(this.ni=ie.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},Qt(ie,"online",this.si),Qt(ie,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,i=v5(t,n4);zi(n)&&(i.url=ex(i.url,{retry_count:n})),this._instance._send_request(me({},i,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.kt(me({retriesPerformedSoFar:n},i));a.statusCode===0&&Se.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(a)}}))}kt(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),a=Date.now()+i;this.Gr.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),Se.warn(o),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],i=this.Gr.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.Gr=n,i.length>0)for(var a of i)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,_e(ie)||(this.si&&(ie.removeEventListener("online",this.si),this.si=void 0),this.ai&&(ie.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(me({},n,{transport:"sendBeacon"}))}catch(i){Se.error(i)}}this.Gr=[]}}class i4{constructor(t){this.hi=()=>{var n,i,a,o;this.di||(this.di={});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.di.lastScrollY=Math.ceil(f),this.di.maxScrollY=Math.max(f,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(h,(i=this.di.maxScrollHeight)!==null&&i!==void 0?i:0),this.di.lastContentY=p,this.di.maxContentY=Math.max(p,(a=this.di.maxContentY)!==null&&a!==void 0?a:0),this.di.maxContentHeight=Math.max(g,(o=this.di.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){Qt(ie,"scroll",this.hi,{capture:!0}),Qt(ie,"scrollend",this.hi,{capture:!0}),Qt(ie,"resize",this.hi)}scrollElement(){if(!this.ci)return ie==null?void 0:ie.document.documentElement;var t=Ge(this.ci)?this.ci:[this.ci];for(var n of t){var i=ie==null?void 0:ie.document.querySelector(n);if(i)return i}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[n]||0}return ie?t==="y"?ie.scrollY||ie.pageYOffset||ie.document.documentElement.scrollTop||0:ie.scrollX||ie.pageXOffset||ie.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var s4=e=>Mw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class yy{constructor(t,n,i,a){this.fi=o=>{var u=this.pi();if(!u||u.sessionId!==o){var f={sessionId:o,props:this.gi(this._instance)};this.mi.register({[sg]:f})}},this._instance=t,this.yi=n,this.mi=i,this.gi=a||s4,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[sg]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?Rw(n,this._instance.config.disable_capture_url_hashes):{$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(Wg(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+$m(i)]=n})),t}}class tx{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.bi[t]||[])i(n);for(var a of this.bi["*"]||[])a(t,n)}constructor(){this.bi={}}}var Ho=Vt("[SessionId]");class _y{on(t,n){return this.wi.on(t,n)}constructor(t,n,i){var a;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new tx,this.Ti=(p,g)=>!(!zi(p)||!zi(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===$i)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=n||Pi,this.Ri=i||Pi;var o=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*ci(this.Te.session_idle_timeout_seconds||1800,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+o+"_window_id",this.Fi="ph_"+o+"_primary_window_exists",this.Li()){var u=Nn.F(this.Oi),f=Nn.F(this.Fi);u&&!f?this.Ii=u:Nn.P(this.Oi),Nn.q(this.Fi,!0)}if((a=this.Te.bootstrap)!=null&&a.sessionID)try{var h=(p=>{var g=this.Te.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.$i(this.Te.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Ho.error("Invalid sessionID in bootstrap",p)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _e(this.ki)&&(this.ki=[]),this.ki.push(t),this.Mi&&t(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((n=>n!==t))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&Nn.N()}Ni(t){t!==this.Ii&&(this.Ii=t,this.Li()&&Nn.q(this.Oi,t))}Di(){return this.Ii?this.Ii:this.Li()?Nn.F(this.Oi):null}qi(t){var n=this.xi;return!In(n)&&!In(t)&&5e3>Math.abs(t-n)}$i(t,n,i){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.Mi=t,o&&!a||o&&this.qi(n)||(this.xi=n,this.mi.register({[_l]:[n,t,i]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return zi(n)&&n>0}Hi(){this.ji()?this.mi.refreshKey(_l):(this.mi.flush(),this.mi.load())}Bi(){var t;if(!In(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var n=this.Ui();n[1]===this.Mi&&n[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[_l]:[this._sessionActivityTimestamp,(t=this.Mi)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=zi(t)?t:0,i=zi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}Vi(t){return this.Hi(),this.Ti(t,this.zi())}Ui(){var t=this.mi.props[_l];return Ge(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&ie&&(ie.removeEventListener(Qd,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&Nn.P(this.Fi)},Qt(ie,Qd,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===$i)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),a=this.Ui(),o=a[1],u=a[2],f=this.zi(),h=this.Di(),p=zi(u)&&Math.abs(i-u)>864e5,g=!1,x=!1,b=!o,y=o,_=!b&&!t&&this.Ti(i,f);if(_){(_=this.Vi(i))||Ho.info("cross-tab refresh kept the session alive",{sessionId:o});var j=this.Ui();o=j[1],u=j[2]}b||_||p?(o=this.Ei(),h=this.Ri(),Ho.info("new session ID generated",{sessionId:o,windowId:h,changeReason:{noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p}}),u=i,g=!0):(h||(h=this.Ri(),g=!0),(x=o!==y)&&(Ho.info("adopted cross-tab session id",{sessionId:o,windowId:h}),g=!0));var N=zi(f)&&t&&!p?f:i,k=zi(u)?u:new Date().getTime();this.Ni(h),this.$i(o,N,k),t||this.Pi();var A={noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p,crossTabAdoption:x};return g&&this.ki.forEach((C=>C(o,h,A))),{sessionId:o,windowId:h,sessionStartTimestamp:k,changeReason:g?A:void 0,lastActivityTimestamp:f}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var t=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var Vw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Vb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((a=>Vb(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function Gw(){return(Gw=tn((function*(){var e=Hn==null?void 0:Hn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Mt(n)&&n.length>0?n:void 0}catch(i){return void Se.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var nf=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 wy(e,t,n){return wl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Yw={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=>nf(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!nf(n,i))))),icontains:(e,t)=>t.map(cd).some((n=>e.map(cd).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(cd).every((n=>e.map(cd).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i<parseFloat(a)))}))},cd=e=>e.toLowerCase();function Ww(e,t){return!e||Object.entries(e).every((n=>{var i=n[1],a=t==null?void 0:t[n[0]];if(_e(a)||In(a))return!1;var o=[String(a)],u=Yw[i.operator];return!!u&&u(i.values,o)}))}var vg="custom",Sy="i.posthog.com",a4=/^\/static\//;class l4{constructor(t){this.Zi={},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("."+Sy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Zi[this.apiHost]||(this.Zi[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":vg),this.Zi[this.apiHost]}Gi(t){if(a4.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.Gi(n);if(i)return""+i+n}if(this.region===vg)return this.apiHost+n;var a=Sy+n;switch(t){case"assets":return"https://"+this.region+"-assets."+a;case"api":return"https://"+this.region+"."+a}}}function Qw(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Ct=Vt("[Surveys]"),Xw="seenSurvey_",Kw=e=>{try{var t=(n=>((i,a)=>""+Xw+(function(o){return o.current_iteration&&o.current_iteration>0?o.id+"_"+o.current_iteration:o.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){Ct.error("Failed to persist survey seen state",n)}},o4=[Gp.Popover,Gp.Widget,Gp.API],c4={ignoreConditions:!1,ignoreDelay:!1,displayType:fg.Popover},u4=Vt("[PostHog ExternalIntegrations]"),d4={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class f4{constructor(t){this._instance=t}er(t,n){var i;(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(a=>{if(a)return u4.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,f,h=i[0],p=i[1];!p||(o=Oe.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[h]||t.er(d4[h],(()=>{var g;(g=Oe.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[h])==null||g.start(t._instance)})),!p&&(u=Oe.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[h]&&((f=Oe.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[h])==null||f.stop())};for(var i of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}var dc={},Kp=0,rf=()=>{},ky='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Io="Surveys module not available",jy="sanitize_properties is deprecated. Use before_send instead",Zw="Invalid value for property_denylist config: ",h4=["token","distinct_id",rw],bl="posthog",Jw=!ZC&&(er==null?void 0:er.indexOf("MSIE"))===-1&&(er==null?void 0:er.indexOf("Mozilla"))===-1,Zp=e=>{var t;return me({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:gC(Ce==null?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rf,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:an&&Mt(an==null?void 0:an.search)&&an.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(ie==null||(t=ie.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){Se.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:cg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:xg},error_tracking:{},_onCapture:rf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:EC,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-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}: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),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},p4=[["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"]],Ny=e=>{var t={};for(var n of p4){var i=n[0],a=n[1];_e(e[i])||(t[a]=e[i])}var o=$t({},t,e),u=e.__preview_external_dependency_versioned_paths;return _e(u)||(_e(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),Mt(u)&&_e(e.asset_host)&&(o.asset_host=u)),Ge(e.property_blacklist)&&(_e(e.property_denylist)?o.property_denylist=e.property_blacklist:Ge(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:Se.error(Zw+e.property_denylist)),o};class m4{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(t){Se.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Dr{Ji(t,n){if(t){var i=this.Ki.indexOf(t);i!==-1&&this.Ki.splice(i,1)}return this.Ki.push(n),n.initialize==null||n.initialize(),n}Yi(){return this.config.cookieless_mode===$i||this.config.cookieless_mode===fa&&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 m4,this.Xi=!1,this.version=St.LIB_VERSION,this.en=new tx,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zp(),this.SentryIntegration=BC,this.sentryIntegration=i=>(function(a,o){var u=kw(a,o);return{name:Sw,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new i4(this),this.pageViewManager=new dy(this),this.rateLimiter=new GC(this),this.requestRouter=new l4(this),this.consent=new SC(this),this.externalIntegrations=new f4(this);var n=(t=Dr.__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.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,o)=>{var u=Mt(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{var u=Mt(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(i=>Se.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==bl){var a,o=(a=dc[i])!==null&&a!==void 0?a:new Dr;return o._init(t,n,i),dc[i]=o,dc[bl][i]=o,o}return this._init(t,n,i)}_init(t,n,i){var a,o;n===void 0&&(n={});var u=Mt(t)?t.trim():"";if(!u)return Se.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=Zp(n.defaults),n.debug=this.an(n.debug),this.ln=n,this.un=[],n.person_profiles?this.nn=n.person_profiles:n.process_person&&(this.nn=n.process_person);var f=Zp(n.defaults),h=Ny(n),p=$t({},f,h,{name:i,token:u});It(f.rageclick)&&It(h.rageclick)&&(p.rageclick=$t({},f.rageclick,h.rageclick)),It(f.session_recording)&&It(h.session_recording)&&(p.session_recording=$t({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&Se.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:$n.GZipJS;var g=this.hn();this.persistence=new Vp(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vp(me({},this.config,{persistence:"sessionStorage"}),g,!1);var x=me({},this.persistence.props),b=me({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new t4((L=>this.cn(L)),this.config.request_queue_config),this.vn=new r4(this),this.__request_queue=[];var y=this.Yi();if(y||(this.sessionManager=new _y(this),this.sessionPropsManager=new yy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Se.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(y)}),0)):(Se.info("Initializing extensions synchronously"),this.fn(y)),St.DEBUG=St.DEBUG||this.config.debug,St.DEBUG&&Se.info("Starting in debug mode",{this:this,config:n,thisC:me({},this.config),p:x,s:b}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=me({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var _=n.bootstrap.distinctID,j=this.get_distinct_id(),N=this.persistence.get_property(Vr);if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&N===ul)this.identify(_);else if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&N===dl)Se.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 k=this.config.get_device_id(Pi()),A=n.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(Vr,n.bootstrap.isIdentifiedID?dl:ul),this.register({distinct_id:_,$device_id:A})}}if(y)this.register_once({distinct_id:id,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(Pi());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(Vr,ul)}return Qt(ie,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,D){var z=L.config.segment;if(!z)return D();(function(q,$){var G=q.config.segment;if(!G)return $();var O=T=>{var ae=()=>T.anonymousId()||Pi();q.config.get_device_id=ae,T.id()&&(q.register({distinct_id:T.id(),$device_id:ae()}),q.persistence.set_property(Vr,dl)),$()},I=G.user();"then"in I&&Gr(I.then)?I.then(O):O(I)})(L,(()=>{z.register((q=>{typeof Promise<"u"&&Promise.resolve||Ip.warn("This browser does not have Promise support, and can not use the segment integration");var $=(G,O)=>{if(!O)return G;G.event.userId||G.event.anonymousId===q.get_distinct_id()||(Ip.info("No userId set, resetting PostHog"),q.reset()),G.event.userId&&G.event.userId!==q.get_distinct_id()&&(Ip.info("UserId set, identifying with PostHog"),q.identify(G.event.userId));var I=q.calculateEventProperties(O,G.event.properties);return G.event.properties=Object.assign({},I,G.event.properties),G};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:G=>$(G,G.event.event),page:G=>$(G,vl),identify:G=>$(G,Fp),screen:G=>$(G,"$screen")}})(L)).then((()=>{D()}))}))})(this,(()=>this.pn())):this.pn(),Gr(this.config._onCapture)&&this.config._onCapture!==rf&&(Se.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&Se.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.config.disableDeviceModel||(function(){return Gw.apply(this,arguments)})().then((L=>{L&&this.register({[Pp]:L})})).catch(rf),this}fn(t){var n,i,a,o,u,f,h,p,g=performance.now(),x=me({},Dr.__defaultExtensionClasses,this.config.__extensionClasses),b=[];x.featureFlags&&this.Ki.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new x.featureFlags(this)),x.exceptions&&this.Ki.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new x.exceptions(this)),x.historyAutocapture&&this.Ki.push(this.historyAutocapture=new x.historyAutocapture(this)),x.tracingHeaders&&this.Ki.push(this.tracingHeaders=new x.tracingHeaders(this)),x.siteApps&&this.Ki.push(this.siteApps=new x.siteApps(this)),x.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new x.sessionRecording(this)),this.config.disable_scroll_properties||b.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),x.autocapture&&this.Ki.push(this.autocapture=new x.autocapture(this)),x.surveys&&this.Ki.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new x.surveys(this)),x.logs&&this.Ki.push(this.logs=(o=this.logs)!==null&&o!==void 0?o:new x.logs(this)),x.metrics&&this.Ki.push(this.metrics=(u=this.metrics)!==null&&u!==void 0?u:new x.metrics(this)),x.conversations&&this.Ki.push(this.conversations=(f=this.conversations)!==null&&f!==void 0?f:new x.conversations(this)),x.productTours&&this.Ki.push(this.productTours=new x.productTours(this)),x.heatmaps&&this.Ki.push(this.heatmaps=new x.heatmaps(this)),x.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new x.webVitalsAutocapture(this)),x.exceptionObserver&&this.Ki.push(this.exceptionObserver=new x.exceptionObserver(this)),x.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new x.deadClicksAutocapture(this,OC)),x.toolbar&&this.Ki.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new x.toolbar(this)),x.experiments&&this.Ki.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new x.experiments(this)),this.Ki.forEach((y=>{y.initialize&&b.push((()=>{y.initialize==null||y.initialize()}))})),b.push((()=>{if(this.gn){var y=this.gn;this.gn=void 0,this.Hr(y)}})),this.mn(b,g)}mn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,n)}),0);var i=t.shift();if(i)try{i()}catch(o){Se.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[iw]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[sw]:a}),this.config.__preview_deferred_init_extensions&&Se.info("PostHog extensions initialized ("+a+"ms)")}Hr(t){if(!Ce||!Ce.body)return Se.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var n,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(i.supportedCompression,$n.GZipJS)?$n.GZipJS:qe(i.supportedCompression,$n.Base64)?$n.Base64:void 0),(n=i.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:cg}),this.Ki.forEach((a=>a.onRemoteConfig==null?void 0:a.onRemoteConfig(t)))}pn(){try{this.config.loaded(this)}catch(i){Se.critical("`loaded` function failed",i)}if(this.bn(),this.config.internal_or_test_user_hostname&&an!=null&&an.hostname){var t=an.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.Yi())&&this._n()}),1),this.wn=new Dw(this),this.wn.load()}bn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.dn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&sd(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn()}_handle_unload(){var t,n,i,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture($p),(i=this.logs)==null||i.flushLogs("sendBeacon"),(a=this.dn)==null||a.unload(),(o=this.vn)==null||o.unload()):this.xn()&&this.capture($p,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Jw?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.headers=me({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(_e(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,a,o,u=me({},n);u.timeout=u.timeout||6e4;var f,h,p,g,x,b=(i=u.transport)!==null&&i!==void 0?i:"fetch";b==="sendBeacon"&&_e(u.compression)&&u.data&&(u.compression=$n.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data={api_key:(h=(x=(g=Ge(f=u.data)?f:[f])[0])==null||(p=x.properties)==null?void 0:p.token)!==null&&h!==void 0?h:x==null?void 0:x.token,batch:g,sent_at:new Date().toISOString()}:u.timestampMode!=="body"||Ge(u.data)||(u.data=me({},u.data,{sent_at:new Date().toISOString()}))),u.url=by(u.url,u.method,u.compression,u.timestampMode);var y=Ed.filter((j=>!u.disableTransport||!j.transport||!u.disableTransport.includes(j.transport))),_=(a=(o=(function(j,N){for(var k=0;j.length>k;k++)if(j[k].transport===b)return j[k]})(y))==null?void 0:o.method)!==null&&a!==void 0?a:y[0].method;if(!_)throw new Error("No available transport method");b!=="sendBeacon"&&u.data&&u.compression===$n.GZipJS&&v3&&typeof Promise<"u"&&!Cd?JC(u).then((j=>{_(j)})).catch((j=>{if(qb(j))return Cd=!0,void _(me({},u,{compression:void 0,url:by(n.url,n.method,void 0,n.timestampMode)}));(N=>{if(!N||typeof N!="object")return!1;var k="name"in N?String(N.name):"";return qb(N)||k===b5})(j)&&(Cd=!0),_(u)})):_(u)})(me({},t,{callback:n=>{var i,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(a=this.config).on_request_error)==null||i.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t)}_execute_array(t){Kp++;try{var n,i=[],a=[],o=[];sd(t,(f=>{if(f)if(Ge(n=f[0]))o.push(f);else if(Gr(f))try{f.call(this)}catch(h){Se.error("Error executing queued PostHog call",f,h)}else Ge(f)&&n==="alias"?i.push(f):Ge(f)&&n.indexOf("capture")!==-1&&Gr(this[n])?o.push(f):a.push(f)}));var u=function(f,h){sd(f,(function(p){try{if(Ge(p[0])){var g=h;Rt(p,(function(x){g=g[x[0]].apply(g,x.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(x){Se.error("Error executing queued PostHog call",p,x)}}))};u(i,this),u(a,this),u(o,this)}finally{Kp--}}push(t){if(Kp>0&&Ge(t)&&Mt(t[0])){var n=Dr.prototype[t[0]];Gr(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var a,o,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!_e(t)&&Mt(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&&!Mt(n==null?void 0:n.$current_url)&&(Se.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.kn||Se.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 x=new Date,b=(i==null?void 0:i.timestamp)||x,y=Qb(i==null?void 0:i.uuid,Pi),_={uuid:y,event:t,properties:this.calculateEventProperties(t,n||{},b,y)};t===vl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var j=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(qd)===!0;i!=null&&i.$set&&!j&&(_.$set=i==null?void 0:i.$set);var N=i==null?void 0:i.$unset;N&&(_.$unset=N);var k,A,C,L=j?void 0:this.Sn(i==null?void 0:i.$set_once,t!==ey,t===Fp);if(L&&(_.$set_once=L),i!=null&&i._noTruncate||(o=this.config.properties_string_max_length,u=_,f=T=>Mt(T)?T.slice(0,o):T,h=new Set,_=(function T(ae,J){if(ae!==Object(ae))return f?f(ae):ae;if(!h.has(ae)){var W;if(h.add(ae),Ge(ae))W=[],sd(ae,(F=>{W.push(T(F))}));else{var B={};Rt(ae,((F,Y)=>{h.has(F)||(B[Y]=T(F))})),W=B}return W}})(u)),_.timestamp=b,_e(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=x),j&&(_.properties=(function(T,ae){ae===void 0&&(ae=[]);var J={},W=B=>{T[B]!==void 0&&(J[B]=T[B])};return b3.forEach(W),ae.forEach(W),J})(_.properties,h4)),t===Ui.DISMISSED||t===Ui.SENT){var D=n==null?void 0:n[Yp.SURVEY_ID],z=n==null?void 0:n[Yp.SURVEY_ITERATION];Kw({id:D,current_iteration:z}),_.$set=me({},_.$set,{[(k={id:D,current_iteration:z},A=t===Ui.SENT?"responded":"dismissed",C="$survey_"+A+"/"+k.id,k.current_iteration&&k.current_iteration>0&&(C="$survey_"+A+"/"+k.id+"/"+k.current_iteration),C)]:!0})}else t===Ui.SHOWN&&(_.$set=me({},_.$set,{[Yp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===VC.SHOWN){var q=n==null?void 0:n[hy.TOUR_TYPE];q&&(_.$set=me({},_.$set,{[hy.TOUR_LAST_SEEN_DATE+"/"+q]:new Date().toISOString()}))}var $=me({},_.properties.$set,_.$set);if(js($)||this.setPersonPropertiesForFlags($),!We(this.config.before_send)){var G=this.wt(_);if(!G)return;(_=G).uuid=Qb(_.uuid,Pi)}this.en.emit("eventCaptured",_);var O=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I={method:"POST",url:O,data:_,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(O)?"query":"capture-body",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.cn(I):this.dn.enqueue(I),_}Se.critical("This capture call is ignored due to client rate limiting.")}}else Se.error("No event name provided to posthog.capture")}else Se.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=o?void 0:this.persistence.remove_event_timer(t),f=me({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Yi()&&(f[rw]=!0),t==="$snapshot"){var h=me({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Mt(f.distinct_id)&&!Cn(f.distinct_id)||Fm(f.distinct_id))&&Se.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(C,L,D,z){var q,$,G,O;if(z===void 0&&(z=!1),!er)return{};var I,T=C?[...Al,...L||[]]:[],ae=(function(Xt){for(var pt=0;Yb.length>pt;pt++){var yt=Yb[pt],kt=yt[1],ge=yt[0].exec(Xt),Fe=ge&&(Gr(kt)?kt(ge,Xt):kt);if(Fe)return Fe}return["",""]})(er),J=ae[0],W=ae[1],B=(I=typeof navigator<"u"?navigator:void 0)!=null&&I.brave?{brave:!0}:{},F={};_e(D)||(F.detectGoogleSearchApp=D);var Y={},xe=(q=navigator)==null||(q=q.userAgentData)==null?void 0:q.platform,R=($=navigator)==null?void 0:$.maxTouchPoints,P=ie==null||(G=ie.screen)==null?void 0:G.width,Z=ie==null||(O=ie.screen)==null?void 0:O.height,M=ie==null?void 0:ie.devicePixelRatio;_e(xe)||(Y.userAgentDataPlatform=xe),_e(R)||(Y.maxTouchPoints=R),_e(P)||(Y.screenWidth=P),_e(Z)||(Y.screenHeight=Z),_e(M)||(Y.devicePixelRatio=M);var de,be,je,Re,Le,Be,Je,it,ht=$t(Wg({$os:J,$os_version:W,$browser:I5(er,navigator.vendor,B,F),$device:Wb(er),$device_type:(be=er,je=Y,it=Wb(be),it===j5||it===k5||it==="Kobo"||it==="Kindle Fire"||it===P5?Nl:it===bc||it===kl||it===yc||it===Hm?"Console":it===C5?"Wearable":it?mr:(je==null?void 0:je.userAgentDataPlatform)==="Android"&&((Re=je==null?void 0:je.maxTouchPoints)!==null&&Re!==void 0?Re:0)>0?600>Math.min((Le=je==null?void 0:je.screenWidth)!==null&&Le!==void 0?Le:0,(Be=je==null?void 0:je.screenHeight)!==null&&Be!==void 0?Be:0)/((Je=je==null?void 0:je.devicePixelRatio)!==null&&Je!==void 0?Je:1)?mr:Nl:"Desktop"),$timezone:Lw(),$timezone_offset:HC()}),{$current_url:Sc(z?Es(an==null?void 0:an.href):an==null?void 0:an.href,T,kc),$host:an==null?void 0:an.host,$pathname:an==null?void 0:an.pathname,$raw_user_agent:er.length>1e3?er.substring(0,997)+"...":er,$browser_version:P3(er,navigator.vendor,B,F),$browser_language:fy(),$browser_language_prefix:(de=fy(),typeof de=="string"?de.split("-")[0]:void 0),$screen_height:ie==null?void 0:ie.screen.height,$screen_width:ie==null?void 0:ie.screen.width,$viewport_height:ie==null?void 0:ie.innerHeight,$viewport_width:ie==null?void 0:ie.innerWidth,$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return St.SDK_DIST_CHANNEL&&(ht.$sdk_dist_channel=St.SDK_DIST_CHANNEL),ht})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var x=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime()),b=x.windowId;f.$session_id=x.sessionId,f.$window_id=b}this.sessionPropsManager&&$t(f,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&$t(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(y=this.vn)==null?void 0:y.length}catch(C){f.$sdk_debug_error_capturing_properties=String(C)}if(this.requestRouter.region===vg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==vl||o?t!==$p||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=$t(f,p),t===vl&&Ce&&(f.title=Ce.title),!_e(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}er&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties();Rt(["$referrer","$referring_domain"],(C=>{C in j&&delete N[C]})),(f=$t({},g,j,N,f)).$is_identified=this._isIdentified(),Ge(this.config.property_denylist)?Rt(this.config.property_denylist,(function(C){delete f[C]})):Se.error(Zw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Se.error(jy),f=k(f,t));var A=this.Cn();return f.$process_person_profile=A,A&&!o&&this.Tn("_calculate_event_properties"),f}Sn(t,n,i){var a;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=$t({},o,u||{},t||{}),h=this.config.sanitize_properties;return h&&(Se.error(jy),f=h(f,"$set_once")),n&&(this.Xi=!0),js(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)==null||a.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)}In(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)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.en.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:Io}),()=>{})}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:Io})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Io})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=c4),(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:Io}}canRenderSurveyAsync(t,n){var i,a;return n===void 0&&(n=!1),(i=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Io})}Mn(t){return!t||Fm(t)?(Se.critical("Unique user id has not been set in posthog.identify"),!1):t===id?(Se.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())||(Se.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 Se.uninitializedWarning("posthog.identify");if(Cn(t)&&(t=t.toString(),Se.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.Tn("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Id)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(Jo)&&(this.unregister(Jo),this.register({distinct_id:t}));var o,u=(this.persistence.get_property(Vr)||ul)===ul;t!==a&&u?(this.persistence.set_property(Vr,dl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Fp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:i||{}}),this.sn=wy(t,n,i),(o=this.featureFlags)==null||o.setAnonymousDistinctId(a)):(n||i)&&this.setPersonProperties(n,i),t!==a&&(this.reloadFeatureFlags(),this.unregister(oc))}}setPersonProperties(t,n){if((t||n)&&this.Tn("posthog.setPersonProperties")){var i=wy(this.get_distinct_id(),t,n);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.sn=i):Se.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ge(t)?t:[t]).filter((a=>Mt(a)&&a.length>0));i.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(t,n,i){if(t&&n){var a=this.getGroups(),o=a[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:me({},a,{[t]:n})}),o||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(ey,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}else Se.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.Tn("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,a,o,u,f,h,p,g,x;if(Se.info("reset"),!this.__loaded)return Se.uninitializedWarning("posthog.reset");var b,y=this.get_property(Id),_=this.get_property(Pp),j=this.get_property(ma);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),_e(j)||(b=this.persistence)==null||b.register({[ma]:j}),(a=this.surveys)==null||a.reset(),(o=this.wn)==null||o.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.metrics)==null||p.reset(),(g=this.persistence)==null||g.set_property(Vr,ul),(x=this.sessionManager)==null||x.resetSessionId(),this.sn=null,this.config.cookieless_mode===$i)this.register_once({distinct_id:id,$device_id:null},"");else{var N=this.config.get_device_id(Pi());this.register_once({distinct_id:N,$device_id:t?N:y},""),t||_e(_)||this.register({[Pp]:_})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var n=this;return tn((function*(){var i,a,o,u,f;n.__loaded?((i=n.logs)==null||i.flushLogs("sendBeacon"),(a=n.metrics)==null||a.flush("sendBeacon"),(o=n.dn)==null||o.unload(),(u=n.vn)==null||u.unload(),(f=n.featureFlags)==null||f.destroy()):Se.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.En()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.Rn()}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 n=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&i){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(K5)?(Se.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(_e(n)&&(n=this.get_distinct_id()),t!==n?(this.In(Jo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Se.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=me({},this.config);if(It(t)){var i,a,o,u,f,h,p,g,x,b,y;$t(this.config,Ny(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 Vp(me({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.an(this.config.debug);Wr(j)&&(this.config.debug=j),Wr(this.config.debug)&&(this.config.debug?(St.DEBUG=!0,zt.N()&&zt.q("ph_debug",!0),Se.info("set_config",{config:t,oldConfig:n,newConfig:me({},this.config)})):(St.DEBUG=!1,zt.N()&&zt.P("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(o=this.exceptions)==null||o.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(),(x=this.deadClicksAutocapture)==null||x.startIfEnabledOrStop(),(b=this.surveys)==null||b.loadIfEnabled(),this.Pn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){St.LIB_NAME=t,St.LIB_VERSION=n}startSessionRecording(t){var n,i,a,o,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&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((o=this.sessionRecording)==null||o.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"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(me({},a,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:Dr.On}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:bl;return n!==bl&&(n=bl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Vr))===dl||((n=this.sessionPersistence)==null?void 0:n.get_property(Vr))===dl}Cn(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===cg&&!this._isIdentified()&&js(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Jo])&&((n=this.persistence)==null||(n=n.props)==null||!n[Yd]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(t){return this.config.person_profiles==="never"?(Se.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(Yd,!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!==fa)}Pn(){var t,n,i,a,o=this.hn();return((t=this.persistence)==null?void 0:t.yr)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.yr)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==$i){if(this.Yi()){var i,a,o,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new _y(this),this.pageViewManager=new dy(this),this.persistence&&(this.sessionPropsManager=new yy(this,this.sessionManager,this.persistence));var h,p=(o=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&o!==void 0?o:(f=Dr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.Ji(this.sessionRecording,new p(this)),this.yn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.yn)))}var g,x;this.consent.optInOut(!0),this.Pn(),this.bn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==fa&&((g=this.surveys)==null||g.loadIfEnabled()),(_e(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((x=t==null?void 0:t.captureEventName)!==null&&x!==void 0?x:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else Se.warn(ky)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==$i?(this.config.cookieless_mode===fa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===fa&&(this.register({distinct_id:id,$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._n(),this.bn())):Se.warn(ky)}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===$i||(this.config.cookieless_mode===fa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return Hn?Vw(Hn,this.config.custom_blocked_useragents):void 0}_n(){Ce&&(Ce.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(vl,{title:Ce.title},{send_instantly:!0}),this.rn&&(Ce.removeEventListener(Wd,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),Qt(Ce,Wd,this.rn)))}debug(t){t===!1?(ie==null||ie.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ie==null||ie.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}))}Ur(){var t=this.ln||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Se.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):(function(n,i,a,o,u){var f=i in n&&!We(n[i]),h=a in n&&!We(n[a]);return f?n[i]:!!h&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,Se)}wt(t){var n;if(We(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(N3),a=Ge(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a){if(o=u(o),We(o)){var f="Event '"+t.event+"' was rejected in beforeSend function";return j3(t.event)?Se.warn(f+". This can cause unexpected behavior."):Se.info(f),null}o.properties&&!js(o.properties)||Se.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(o.properties&&We(o.properties[h]))return Se.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 o}getPageViewId(){var t;return(t=this.pageViewManager.ir)==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)})}an(t){var n=Wr(t)&&!t,i=zt.N()&&zt.A("ph_debug")==="true";return!n&&(!!i||t)}}Dr.__defaultExtensionClasses={},Dr.On=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=pC(e.prototype[t[n]])})(Dr,["identify"]);class Cy{constructor(t){this.disabled=t===!1;var n=It(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 a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>i-a.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 Jp="$copy_autocapture",em=Vt("[AutoCapture]");function tm(e,t){return t.length>e?t.slice(0,e)+"...":t}function g4(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ts(t));return t}function x4(e,t){var n,i,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,f=t.elementAttributeIgnoreList,h=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Ts(e))return{props:{}};for(var g=[e],x=new Set([e]),b=e;b.parentNode&&!pr(b,"body")&&pw>g.length;)if(hw(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),g.push(y),b=y}else{if(!Ts(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),g.push(b.parentNode),b=b.parentNode}var _,j,N=[],k={},A=!1,C=!1;if(Rt(g,($=>{var G=dg($);if(pr($,"a")){var O=$.getAttribute("href");A=!!(G&&O&&cc(O))&&(p?Es(O):O)}qe(Kd($),"ph-no-capture")&&(C=!0),N.push((function(T,ae,J,W,B){B===void 0&&(B=!1);var F=T.tagName.toLowerCase(),Y={tag_name:F};Xg.indexOf(F)>-1&&!J&&(Y.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?tm(1024,oy(T)):tm(1024,wc(T)));var xe=Kd(T);xe.length>0&&(Y.classes=xe.filter((function(M){return M!==""}))),Rt(T.attributes,(function(M){var de;if((!bw(T)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(W==null||!W.includes(M.name))&&!ae&&cc(M.value)&&(!Mt(de=M.name)||de.substring(0,10)!=="_ngcontent"&&de.substring(0,7)!=="_nghost")){var be=M.value;M.name==="class"&&(be=Qg(be).join(" ")),Y["attr__"+M.name]=tm(1024,M.name==="href"&&B?Es(be):be)}}));for(var R=1,P=1,Z=T;Z=g4(Z);)R++,Z.tagName===T.tagName&&P++;return Y.nth_child=R,Y.nth_of_type=P,Y})($,o,u,f,p));var I=(function(T){if(!dg(T))return{};var ae={};return Rt(T.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var W=J.name.replace("data-ph-capture-attribute-",""),B=J.value;W&&B&&cc(B)&&(ae[W]=B)}})),ae})($);$t(k,I)})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=pr(e,"a")||pr(e,"button")?oy(e):wc(e)),A){var L,D;N[0].attr__href=A;var z=(L=Zd(A))==null?void 0:L.host,q=ie==null||(D=ie.location)==null?void 0:D.host;z&&q&&z!==q&&(_=A)}return{props:$t({$event_type:a.type,$ce_version:1},h?{}:{$elements:N},{$elements_chain:(j=N,(function($){return $.map((G=>{var O,I,T="";if(G.tag_name&&(T+=G.tag_name),G.attr_class)for(var ae of(G.attr_class.sort(),G.attr_class))T+="."+ae.replace(/"/g,"");var J=me({},G.text?{text:G.text}:{},{"nth-child":(O=G.nth_child)!==null&&O!==void 0?O:0,"nth-of-type":(I=G.nth_of_type)!==null&&I!==void 0?I:0},G.href?{href:G.href}:{},G.attr_id?{attr_id:G.attr_id}:{},G.attributes),W={};return Nd(J).sort(((B,F)=>B[0].localeCompare(F[0]))).forEach((B=>{var F=B[1];return W[cy(B[0].toString())]=cy(F.toString())})),(T+=":")+Nd(W).map((B=>B[0]+'="'+B[1]+'"')).join("")})).join(";")})((function($){return $.map((G=>{var O,I,T={text:(O=G.$el_text)==null?void 0:O.slice(0,400),tag_name:G.tag_name,href:(I=G.attr__href)==null?void 0:I.slice(0,2048),attr_class:DC(G),attr_id:G.attr__id,nth_child:G.nth_child,nth_of_type:G.nth_of_type,attributes:{}};return Nd(G).filter((ae=>ae[0].indexOf("attr__")===0)).forEach((ae=>T.attributes[ae[0]]=ae[1])),T}))})(j)))},(n=N[0])!=null&&n.$el_text?{$el_text:(i=N[0])==null?void 0:i.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},k)}}var qo=Vt("[ExceptionAutocapture]"),Ey=()=>{},v4=Vt("[TracingHeaders]"),sa=Vt("[Web Vitals]"),Ty=9e5,Ay="disabled",My="lazy_loading",Vo="awaiting_config",ud="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var bg="[SessionRecording]",Mi=Vt(bg),b4=Vt("[Heatmaps]");function nm(e){return It(e)&&"clientX"in e&&"clientY"in e&&Cn(e.clientX)&&Cn(e.clientY)}var rm=Vt("[Product Tours]"),im=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Vg))},y4=["$set_once","$set"],ai=Vt("[SiteApps]"),Ry="Error while initializing PostHog app with config id ";function pl(e,t,n){if(We(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 _4{constructor(t){this.Fn=new tx,this.Ln=(n,i)=>this.$n(n,i)&&this.An(n,i)&&this.Nn(n,i)&&this.Dn(n,i),this.$n=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.qn=new Set,this.jn=new Set}init(){var t,n;_e((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.on(i,a)}))}register(t){var n,i;if(!_e((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.jn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.qn)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var a,o=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&o.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,n){var i;n!=null&&t.length!=0&&(this.qn.has(t)||this.qn.has(n.event))&&this.jn&&((i=this.jn)==null?void 0:i.size)>0&&this.jn.forEach((a=>{this.Hn(n,a)&&this.Fn.emit("actionCaptured",a.name)}))}Bn(t){this.onAction("actionCaptured",(n=>t(n)))}Hn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.Ln(t,i))return!0;return!1}onAction(t,n){return this.Fn.on(t,n)}An(t,n){if(n!=null&&n.url){var i,a=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!a||typeof a!="string"||!pl(a,n.url,n.url_matching||"contains"))return!1}return!0}Nn(t,n){return!!this.Un(t,n)&&!!this.zn(t,n)&&!!this.Vn(t,n)}Un(t,n){var i;if(n==null||!n.href)return!0;var a=this.Wn(t);if(a.length>0)return a.some((f=>pl(f.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&pl((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}zn(t,n){var i;if(n==null||!n.text)return!0;var a=this.Wn(t);if(a.length>0)return a.some((p=>pl(p.text,n.text,n.text_matching||"exact")||pl(p.$el_text,n.text,n.text_matching||"exact")));var o,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(o=(function(p){for(var g,x=[],b=/(?::|")text="(.*?)"/g;!We(g=b.exec(p));)x.includes(g[1])||x.push(g[1]);return x})(h),u=n.text,f=n.text_matching||"exact",o.some((p=>pl(p,u,f))))}Vn(t,n){var i,a;if(n==null||!n.selector)return!0;var o=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}Wn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Dn(t,n){return n==null||!n.properties||n.properties.length===0||Ww(n.properties.reduce(((i,a)=>{var o=Ge(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return i[a.key]={values:o,operator:a.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class w4{constructor(t){var n;this.Zn=[],this._instance=t,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((i=>this.Kn(i)))}Yn(t,n){return!!t&&Ww(t.propertyFilters,n==null?void 0:n.properties)}Xn(t,n){var i=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(a.id),i.set(u.name,f)}}))})),i}es(t,n,i){var a=(i===Po.Activation?this.Gn:this.Qn).get(t),o=[];return this.ts((u=>{o=u.filter((f=>a==null?void 0:a.includes(f.id)))})),o.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.Yn(h,n)}))}register(t){var n;_e((n=this._instance)==null?void 0:n._addCaptureHook)||(this.rs(t),this.ns(t))}ns(t){var n=t.filter((i=>{var a,o;return((a=i.conditions)==null?void 0:a.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));n.length!==0&&(this.ss==null&&(this.ss=new _4(this._instance),this.ss.init(),this.ss.Bn((i=>{this.onAction(i)}))),n.forEach((i=>{var a,o,u,f,h;i.conditions&&(a=i.conditions)!=null&&a.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.ss)==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.Jn.get(p.name);g&&g.push(i.id),this.Jn.set(p.name,g||[i.id])}})))})))}rs(t){var n,i=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.events)&&((f=o.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.cancelEvents)&&((f=o.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((o,u)=>{this.onEvent(o,u)})),this.Gn=this.Xn(t,Po.Activation),this.Qn=this.Xn(t,Po.Cancellation))}onEvent(t,n){var i,a,o=this.os(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.ls(t,u);if(f==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.us([u]);if(f==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.hs(u)}if(this.Qn.has(t)){var h=this.es(t,n,Po.Cancellation);h.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.us(h.map((g=>g.id))),h.forEach((g=>this.ds(g.id))))}if(this.Gn.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.Gn.get(t)});var p=this.es(t,n,Po.Activation);this.cs(p.map((g=>g.id)))}}onAction(t){this.Jn.has(t)&&this.cs(this.Jn.get(t)||[])}cs(t){t.length!==0&&(this.Zn=[...new Set([...this.Zn,...t])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(t){this.Zn=this.Zn.filter((i=>i!==t));var n=this.vs();n.includes(t)||(this.fs([...n,t]),this.ps())}us(t){var n=new Set(t);this.Zn=this.Zn.filter((o=>!n.has(o)));var i=this.gs(),a=i.filter((o=>!n.has(o)));a.length!==i.length&&(this.fs(a),a.length===0&&this.ys())}gs(){var t,n=this.bs();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}vs(){var t,n,i=this.gs();if(i.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this._s()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?i:[]}ps(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.ws(n)}ys(){this.xs()}Kn(t){var n,i=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this._s()];i&&i!==t&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((t=>!this.ks(t)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class S4 extends w4{constructor(t){super(t)}bs(){return ng}_s(){return jd}Cs(){return Ui.SHOWN}ts(t){var n;(n=this._instance)==null||n.getSurveys(t)}ds(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}os(){return Ct}fs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[ng]:t})}ws(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[jd]:t})}xs(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(jd)}ks(){return!1}ls(t,n){var i;this.ts((o=>{i=o.find((u=>u.id===n))}));var a=!i||(function(o){var u;return Qw(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(i);return a?t===Ui.SHOWN?"consume":"ignore":t===Ui.SHOWN?"persist":t===Ui.DISMISSED||t===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var dd="SDK is not enabled or survey functionality is not yet loaded",Ly="Disabled. Not loading surveys.",k4=ie!=null&&ie.location?Jd(ie.location.hash,"__posthog")||Jd(location.hash,"state"):null,Dy="_postHogToolbarParams",zy=Vt("[Toolbar]"),fn=Vt("[FeatureFlags]"),aa=Vt("[FeatureFlags]",{debugEnabled:!0}),sm=`" failed. Feature flags didn't load in time.`,Oy=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},By=e=>{var t={};for(var n of Nd(e||{})){var i=n[1];i&&(t[n[0]]=i)}return t},Ri=Vt("[Error tracking]"),Py="Refusing to render web experiment since the viewer is a likely bot",j4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>nf(t,e),not_regex:(e,t)=>!nf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((a=>{Mn.Ts("retrieved web experiments from the server"),n.Is=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.Is&&(Mn.Ts("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.Is)==null||u.set(o.feature_flag_key,o));var f=n._instance.getFeatureFlag(o.feature_flag_key);Mt(f)&&o.variants[f]&&n.Ms(o.name,f,o.variants[f].transforms)}else if(o.variants)for(var h in o.variants){var p=o.variants[h];Mn.Es(p,n._instance)&&n.Ms(o.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.Ts(Py);else if(!this.Te.disable_web_experiments){if(We(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.Ts("applying feature flags",t),t.forEach((n=>{var i;if(this.Is&&(i=this.Is)!=null&&i.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.Is)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.Ms(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Tl(t==null?void 0:t.search,"__experiment_id"),i=Tl(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Mn.Ts("previewing web experiments "+n+" && "+i),this.getWebExperiments((a=>{this.Rs(parseInt(n),i,a)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Te.disable_web_experiments&&!i)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Rs(t,n,i){var a=i.filter((o=>o.id===t));a&&a.length>0&&(Mn.Ts("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Ms(a[0].name,n,a[0].variants[n].transforms))}static Es(t,n){return!We(t.conditions)&&Mn.Ps(t,n)&&Mn.Os(t)}static Ps(t,n){var i;if(We(t.conditions)||We((i=t.conditions)==null?void 0:i.url))return!0;var a=Mn.getWindowLocation();if(a){var o,u,f,h=uw(n,a.href);return(o=t.conditions)==null||!o.url||j4[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return ie==null?void 0:ie.location}static Os(t){var n;if(We(t.conditions)||We((n=t.conditions)==null?void 0:n.utm))return!0;var i=Cw();if(i.utm_source){var a,o,u,f,h,p,g,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,y=(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,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static Ts(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;n>a;a++)i[a-1]=arguments[a];Se.info("[WebExperiments] "+t,i)}Ms(t,n,i){this._is_bot()?Mn.Ts(Py):n!=="control"?i.forEach((a=>{if(a.selector){var o;Mn.Ts("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.Ts("Control variants leave the page unmodified.")}_is_bot(){return Hn&&this._instance?Vw(Hn,this.Te.custom_blocked_useragents):void 0}}var Mr=Vt("[Conversations]"),la="Conversations not available yet.",$y="console",pf={featureFlags:class{constructor(e){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],ie&&Qt(ie,"online",this.Bs)}destroy(){ie==null||ie.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(e){return this._instance.get_property(e)}Vs(){var e,t;return(e=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,fn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var e,t=(e=this.Te.evaluation_contexts)!==null&&e!==void 0?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(fn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||fn.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}Gs(){return this.Zs().length>0}Qs(){var e=this.Te.flag_keys;if(!_e(e)){if(Ge(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||fn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));fn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},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,a,o=n!=null&&n.merge&&(i=this.zs(pa))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.zs(kd))!==null&&a!==void 0?a:{},f=me({},o,e),h=me({},u,t),p={};for(var g of Object.entries(f)){var x=g[0],b=g[1];p[x]={key:x,enabled:Fb(b),variant:Ub(b),reason:void 0,metadata:_e(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}}}this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.zs(Jm),t=this.zs(Oi),n=this.zs(xl);if(!n&&!t)return e||{};var i=$t({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,f,h=i[o],p=t==null?void 0:t[o],g=_e(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,x=_e(p)?h.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=me({},h,{enabled:g,variant:g?x??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=me({},h==null?void 0:h.metadata,{payload:b,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[o]=y}return this.Fs||(fn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Fs=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var i=e[n];return{key:n,enabled:Fb(i),variant:Ub(i),payload:$b(t[n])}}))}getFlagVariants(){var e=this.zs(pa),t=this.zs(Oi);if(!t)return e||{};for(var n=$t({},e),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Fs||(fn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Fs=!0),n}getFlagPayloads(){var e=this.zs(kd),t=this.zs(xl);if(!t)return e||{};for(var n=$t({},e||{}),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Fs||(fn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Fs=!0),n}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.As=e}Ks(e){var t;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var n=this.Te.token,i=this.zs(Id),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:me({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.zs(ua)||{},{$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION}),group_properties:this.zs(da),timezone:Lw()};In(i)||_e(i)||(a.$device_id=i),(e!=null&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Gs()&&(a.evaluation_contexts=this.Zs());var o=this.Qs();_e(o)||(a.flag_keys=o);var u=!!this.Te.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:f,data:a,compression:this.Te.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:h=>{var p,g,x,b=!0;if(this.Xs(h.statusCode),h.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),b=!1),this.$s=!1,!a.disable_flags||this.Ns){this.Ds=!b;var y=[];h.error?h.error instanceof Error?y.push(h.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):h.statusCode!==200&&y.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&y.push("quota_limited"),(x=this.mi)==null||x.register({[ig]:y}),j?fn.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."):(a.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},b,{partialResponse:u}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return jw(this.Hs,3)}Xs(e){this.Hs=Nw(e,this.Hs,3,(()=>fn.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){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 fn.warn('getFeatureFlag for key "'+e+sm)}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.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),f=this.zs(eg)||void 0,h=this.zs(_c)||void 0,p=this.zs(oc)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var g,x=this._instance.get_session_id(),b=this.zs(rg);x&&x!==b&&(p={},(g=this.mi)==null||g.register({[oc]:p,[rg]:x}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var y,_,j,N,k,A,C,L,D,z,q;Ge(p[e])?p[e].push(u):p[e]=[u],(y=this.mi)==null||y.register({[oc]:p});var $=this.getFeatureFlagDetails(e),G=[...(_=this.zs(ig))!==null&&_!==void 0?_:[]];_e(a)&&G.push("flag_missing");var O={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Te.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((N=this.Te.bootstrap)==null||(N=N.featureFlagPayloads)==null?void 0:N[e])||null,$used_bootstrap_value:!this.Ds};_e($==null||(k=$.metadata)==null?void 0:k.has_experiment)||(O.$feature_flag_has_experiment=$.metadata.has_experiment),_e($==null||(A=$.metadata)==null?void 0:A.version)||(O.$feature_flag_version=$.metadata.version);var I,T=(C=$==null||(L=$.reason)==null?void 0:L.description)!==null&&C!==void 0?C:$==null||(D=$.reason)==null?void 0:D.code;T&&(O.$feature_flag_reason=T),$!=null&&(z=$.metadata)!=null&&z.id&&(O.$feature_flag_id=$.metadata.id),_e($==null?void 0:$.original_variant)&&_e($==null?void 0:$.original_enabled)||(O.$feature_flag_original_response=_e($.original_variant)?$.original_enabled:$.original_variant),$!=null&&(q=$.metadata)!=null&&q.original_payload&&(O.$feature_flag_original_payload=$==null||(I=$.metadata)==null?void 0:I.original_payload),G.length&&(O.$feature_flag_error=G.join(",")),this._instance.capture("$feature_flag_called",O)}if(i)return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:$b(o)}}}else fn.warn('getFeatureFlagResult for key "'+e+sm)}getRemoteConfigPayload(e,t){var n=this.Te.token,i={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION}};this.Gs()&&(i.evaluation_contexts=this.Zs());var a=this.Qs();_e(a)||(i.flag_keys=a),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Te.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(o){var u,f=(u=o.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.Ds)return t.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return fn.warn('isFeatureEnabled for key "'+e+sm),t.defaultValue;var n=this.getFeatureFlag(e,t);return _e(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.mi){this.Ls=!0;var i=this.getFlagVariants(),a=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(u,f,h,p,g,x){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var b=($=>{var G=$.flags;return G?($.featureFlags=Object.fromEntries(Object.keys(G).map((O=>{var I;return[O,(I=G[O].variant)!==null&&I!==void 0?I:G[O].enabled]}))),$.featureFlagPayloads=Object.fromEntries(Object.keys(G).filter((O=>G[O].enabled)).filter((O=>{var I;return(I=G[O].metadata)==null?void 0:I.payload})).map((O=>{var I;return[O,(I=G[O].metadata)==null?void 0:I.payload]})))):$.featureFlags&&fn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$})(u),y=b.flags,_=b.featureFlags,j=b.featureFlagPayloads;if(_){var N=u.requestId,k=u.evaluatedAt;if(Ge(_)){fn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var A={};if(_)for(var C=0;_.length>C;C++)A[_[C]]=!0;f&&f.register({[Sd]:_,[pa]:A,[qd]:!1})}else{var L=_,D=j,z=y;if(x!=null&&x.partialResponse)L=me({},h,L),D=me({},p,D),z=me({},g,z);else if(u.errorsWhileComputingFlags)if(y){var q=new Set(Object.keys(y).filter(($=>{var G;return!((G=y[$])!=null&&G.failed)})));L=me({},h,Object.fromEntries(Object.entries(L).filter(($=>q.has($[0]))))),D=me({},p,Object.fromEntries(Object.entries(D||{}).filter(($=>q.has($[0]))))),z=me({},g,Object.fromEntries(Object.entries(z||{}).filter(($=>q.has($[0])))))}else L=me({},h,L),D=me({},p,D),z=me({},g,z);f&&f.register(me({[Sd]:Object.keys(By(L)),[pa]:L||{},[kd]:D||{},[Jm]:z||{},[qd]:u.minimalFlagCalledEvents===!0},N?{[eg]:N}:{},k?{[_c]:k}:{}))}}})(e,this.mi,i,a,o,n),t||(this.js=!1),this.eo(t)}}override(e,t){t===void 0&&(t=!1),fn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return fn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(Oi),this.mi.unregister(xl),this.eo(),aa.info("All overrides cleared");if(Ge(e)){var t=Oy(e);return this.mi.register({[Oi]:t}),this.eo(),aa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.Fs=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.mi.unregister(Oi),aa.info("Flag overrides cleared");else if(i.flags){if(Ge(i.flags)){var a=Oy(i.flags);this.mi.register({[Oi]:a})}else this.mi.register({[Oi]:i.flags});aa.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.mi.unregister(xl),aa.info("Payload overrides cleared")):i.payloads&&(this.mi.register({[xl]:i.payloads}),aa.info("Payload overrides set",{payloads:i.payloads}))),void this.eo()}if(e&&typeof e=="object")return this.mi.register({[Oi]:e}),this.eo(),aa.info("Flag overrides set",{flags:e});fn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Ls){var t=this.ro(),n=t.flags,i=t.flagVariants;try{e(n,i)}catch(a){fn.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,a=(this.zs(tc)||[]).find((h=>h.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(o,!1);var f=me({},this.getFlagVariants(),{[e]:t});(i=this.mi)==null||i.register({[Sd]:Object.keys(By(f)),[pa]:f}),this.eo()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.zs(tc),a=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+a),method:"GET",timestampMode:"query",callback:o=>{var u,f;if(o.json){var h=o.json.earlyAccessFeatures;return(u=this.mi)==null||u.unregister(tc),(f=this.mi)==null||f.register({[tc]:h}),e(h)}}})}ro(){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)),{})}}eo(e){var t=this.ro(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,i,{errorsLoading:e})}catch(o){fn.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.zs(ua)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this._instance.register({[ua]:me({},n,o,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=me({},this.zs(ua)||{});e.forEach((i=>{delete n[i]})),this._instance.register({[ua]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ua),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.zs(da)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=me({},n[i],e[i]),delete e[i]})),this._instance.register({[da]:me({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.zs(da)||{};this._instance.register({[da]:me({},t,{[e]:{}})})}else this._instance.unregister(da)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},N4={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!((e=this.io)==null||!e.isStarted)}get status(){var e,t;return this.no===Vo||this.no===ud?this.no:(e=(t=this.io)==null?void 0:t.status)!==null&&e!==void 0?e:this.no}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=Ay,this.so=void 0,this._instance=e,!this._instance.sessionManager)throw Mi.error("started without valid sessionManager"),new Error(bg+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===$i)throw new Error(bg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var e,t=!((e=this._instance.get_property(ma))==null||!e.enabled),n=!this.Te.disable_session_recording,i=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return ie&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.oo||(t=this.io)==null||!t.isStarted){var n=!_e(Object.assign)&&!_e(Array.from);this.oo&&n?(this.ao(e),Mi.info("starting")):(this.no=Ay,this.stopRecording())}}ao(e){var t,n,i;this.oo&&(this.no!==Vo&&this.no!==ud&&(this.no=My),Oe!=null&&(t=Oe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Oe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.lo(e):(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.uo,(a=>{if(a)return Mi.error("could not load recorder",a);this.lo(e)})))}stopRecording(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.stop()}ho(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.discard()}do(){var e,t;(e=this.mi)==null||e.unregister(Gg),(t=this.mi)==null||t.unregister(Z5)}co(e,t){if(We(e))return null;var n,i=Cn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Mi.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}vo(e){if(this.mi){var t,n,i=this.mi,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.co((o=this.Te.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),h=this.co(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;We(p)&&this.do();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[ma]:me({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:me({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:_e(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})})};a(),(t=this.so)==null||t.call(this),this.so=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.vo(t),void this.ho()):(this.vo(t),void this.startIfEnabledOrStop()):(this.no===Vo&&(this.no=ud,Mi.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.io)!=null&&n.log?this.io.log(e,t):Mi.warn("log called before recorder was ready")}get uo(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ma);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}fo(){var e,t,n=this._instance.get_property(ma);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(a){return Mi.warn("persisted remote config for session recording is invalid and will be ignored",a),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}lo(e){var t,n;if((t=Oe.__PosthogExtensions__)==null||!t.initSessionRecording)return Mi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[aw]:!0});if(this.io||(this.io=(n=Oe.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===ud||this.no===Vo?void 0:(this.no=Vo,Mi.info("persisted remote config is stale, requesting fresh config before starting"),void new Dw(this._instance).load());this.no=My,this.io.start(e)}onRRwebEmit(e){var t;(t=this.io)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.io||(t=this.mi)==null||t.register({[ew]:!0}),(e=this.io)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.io||(t=this.mi)==null||t.register({[J5]:!0}),(e=this.io)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.io||(n=this.mi)==null||n.register({[e==="url"?tw:nw]:!0}),(t=this.io)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.io)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.io)==null||!n.tryAddCustomEvent(e,t))}}},C4={autocapture:class{constructor(e){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=e,this.rageclicks=new Cy(e.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var e,t,n=It(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}wo(){if(this.isBrowserSupported()){if(ie&&Ce){var e=n=>{n=n||(ie==null?void 0:ie.event);try{this.xo(n)}catch(i){em.error("Failed to capture event",i)}};if(Qt(Ce,"submit",e,{capture:!0}),Qt(Ce,"change",e,{capture:!0}),Qt(Ce,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(ie==null?void 0:ie.event);try{this.xo(n,Jp)}catch(i){em.error("Failed to capture copy/cut event",i)}};Qt(Ce,"copy",t,{capture:!0}),Qt(Ce,"cut",t,{capture:!0})}}}else em.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(e){if(this.yo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.bo=t.elementsChainAsString);var n=t.autocapture_opt_out;Wr(n)&&(this.instance.persistence&&this.instance.persistence.register({[Gm]:n}),this.mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._o=e}getElementSelectors(e){var t,n=[];return(t=this._o)==null||t.forEach((i=>{var a=Ce==null?void 0:Ce.querySelectorAll(i);a==null||a.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Gm],i=this.mo,a=this.instance.Ur()&&!this.yo;if(In(i)&&!Wr(n)&&!a)return!1;var o=(t=this.mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}xo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Hp(e);fw(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())&&ly(i,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var a=t===Jp;if(i&&(function(x,b,y,_,j,N){var k;if(!ie||Kg(x)||y!=null&&y.url_allowlist&&!iy(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&iy(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){var A=y.dom_event_allowlist;if(A&&!A.some(($=>b.type===$)))return!1}var C=vw(x,_),L=C.parentIsUsefulElement,D=C.targetElementList;if(!(function($,G){var O=G==null?void 0:G.element_allowlist;if(_e(O))return!0;var I,T=function(J){if(O.some((W=>J.tagName.toLowerCase()===W)))return{v:!0}};for(var ae of $)if(I=T(ae))return I.v;return!1})(D,y)||!ug(D,y==null?void 0:y.css_selector_allowlist)||ug(D,(k=y==null?void 0:y.css_selector_ignorelist)!==null&&k!==void 0?k:CC))return!1;try{var z=ie.getComputedStyle(x);if(z&&z.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}var q=x.tagName.toLowerCase();switch(q){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return L?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(Xg.indexOf(q)>-1||x.getAttribute("contenteditable")==="true")}})(i,e,this.Te,a,a?["copy","cut"]:void 0,this.instance)){var o=x4(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),u=o.props;if(o.explicitNoCapture)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(u.$element_selectors=f),t===Jp){var h,p=mw(ie==null||(h=ie.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=g}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Gr(Ce==null?void 0:Ce.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ko=(ie==null||(t=ie.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Se.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,Se.info("History API monitoring stopped")}monitorHistoryChanges(){ie&&ie.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(e){var t;if(ie&&((t=ie.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,a,o){try{if(!(a in i))return Ey;var u={next:i[a]},f=o((function(){for(var h=arguments.length,p=new Array(h),g=0;h>g;g++)p[g]=arguments[g];return u.next.apply(this,p)}));return Gr(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:u}})),i[a]=f,()=>{if(i[a]!==f)for(var h=i[a];Gr(h)&&h.__posthog_layer__;){var p=h.__posthog_layer__;if(p.next===f)return void(p.next=u.next);h=p.next}else i[a]=u.next}}catch{return Ey}})(ie.history,e,(i=>function(a,o,u){i.call(this,a,o,u),n.Io(e)}))}}Io(e){try{var t,n=ie==null||(t=ie.location)==null?void 0:t.pathname;if(!n)return;n!==this.ko&&this.isEnabled&&this._instance.capture(vl,{navigation_type:e}),this.ko=n}catch(i){Se.error("Error capturing "+e+" pageview",i)}}To(){if(!this.So){var e=()=>{this.Io("popstate")};Qt(ie,"popstate",e),this.So=()=>{ie&&ie.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=e,this.Mo=!((t=this.instance.persistence)==null||!t.props[Ym]),this.rageclicks=new Cy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return It(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return We(this.Te.capture_heatmaps)?We(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;b4.info("starting..."),this.Ro(),this.ke()}else{var e;clearInterval((e=this.Eo)!==null&&e!==void 0?e:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ym]:n}),this.Mo=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Oo(e){nm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=(Ce==null?void 0:Ce.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){ie&&Ce&&(this.Fo=this.oi.bind(this),Qt(ie,Qd,this.Fo),this.Lo=e=>this.pe(e||(ie==null?void 0:ie.event)),Qt(Ce,"click",this.Lo,{capture:!0}),this.$o=e=>this.Ao(e||(ie==null?void 0:ie.event)),Qt(Ce,"mousemove",this.$o,{capture:!0}),this.No=new uy(this.instance,zC,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),Qt(Ce,Wd,this.Do),this.po=!0)}Po(){var e;ie&&Ce&&(this.Fo&&ie.removeEventListener(Qd,this.Fo),this.Lo&&Ce.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&Ce.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&Ce.removeEventListener(Wd,this.Do),clearTimeout(this.qo),(e=this.No)==null||e.stop(),this.po=!1)}jo(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,f,h){for(var p=u;p&&Ts(p)&&!pr(p,"body");){if(p===h)return!1;var g=void 0;try{var x,b,y;g=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:ie)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(qe(f,g))return!0;p=gw(p)}return!1})(Hp(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}pe(e,t){var n;if(t===void 0&&(t="click"),!ry(e.target)&&nm(e)){var i=this.jo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ly(Hp(e),this.instance.config.rageclick)&&this.Nt(me({},i,{type:"rageclick"})),this.Nt(i)}}Ao(e){!ry(e.target)&&nm(e)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(e,"mousemove"))}),500))}Nt(e){if(ie){var t=this.Te.disable_capture_url_hashes?Es(ie.location.href):ie.location.href,n=this.Te.custom_personal_data_properties,i=this.Te.mask_personal_data_properties?[...Al,...n||[]]:[],a=Sc(t,i,kc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}oi(){this.R&&!js(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:uy,webVitalsAutocapture:class{constructor(e){var t;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,i)=>me({},n,{["$web_vitals_"+i.name+"_event"]:me({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=n=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.zo();if(!_e(a))if(We(n==null?void 0:n.name)||We(n==null?void 0:n.value))sa.error("Invalid metric received",n);else if(!this.Vo||this.Vo>n.value){this.R.url!==a&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),_e(this.R.url)&&(this.R.url=a),this.R.firstMetricTimestamp=_e(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var o=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),u=me({},n,{$current_url:a,timestamp:Date.now()});_e(o)||(u.$session_id=o.sessionId,u.$window_id=o.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else sa.error("Ignoring metric with value >= "+this.Vo,n)},this.Wo=()=>{if(!this.po){var n,i,a,o,u=Oe.__PosthogExtensions__;if(!_e(u)&&!_e(u.postHogWebVitalsCallbacks)){var f=u.postHogWebVitalsCallbacks;n=f.onLCP,i=f.onCLS,a=f.onFCP,o=f.onINP}n&&i&&a&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Uo.bind(this)),this.po=!0):sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Mo=!((t=this._instance.persistence)==null||!t.props[Km]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=It(this.Zo)?(e=this.Zo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return We(n)?((t=this._instance.persistence)==null?void 0:t.props[Zm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(It(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=It(this.Zo)?this.Zo.web_vitals_attribution:void 0;return e!=null&&e}get Vo(){var e=It(this.Zo)&&Cn(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Ty;return e>0&&6e4>=e?Ty:e}get isEnabled(){var e=an==null?void 0:an.protocol;if(e!=="http:"&&e!=="https:")return sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=It(this.Zo)?this.Zo.web_vitals:Wr(this.Zo)?this.Zo:void 0;return Wr(t)?t:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(sa.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=It(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=It(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Km]:n}),this._instance.persistence.register({[Zm]:i})),this.Mo=n,this.startIfEnabled()}}}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?sa.error("failed to load script",i):e()}))}zo(){var e=ie?this._instance.config.disable_capture_url_hashes?Es(ie.location.href):ie.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Al,...t||[]]:[];return Sc(e,n,kc)}sa.error("Could not determine current URL")}}},E4={exceptionObserver:class{constructor(e){var t;this.Wo=()=>{var n;if(ie&&this.isEnabled&&(n=Oe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var i=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=a(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=o(this.captureException.bind(this)))}catch(u){qo.error("failed to start",u),this.Ko()}}},this._instance=e,this.Yo=!((t=this._instance.persistence)==null||!t.props[Wm]),this.Xo=new T3(me({},(function(n){var i,a,o,u;return n===void 0&&(n={}),{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:qo})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return It(e)?t=me({},t,e):(_e(e)?this.Yo:e)&&(t=me({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qo.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return qo.error("failed to load script",i);e()}))}Ko(){var e,t,n;(e=this.Go)==null||e.call(this),this.Go=void 0,(t=this.Qo)==null||t.call(this),this.Qo=void 0,(n=this.Jo)==null||n.call(this),this.Jo=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Yo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Wm]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(e){var t,n,i,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.Xo.consumeRateLimit(a)?qo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.ta=[],this.ra=new G3([new eC,new cC,new nC,new tC,new lC,new aC,new iC,new oC],(function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
64
|
-
`),x=h;g.length>x;x++){var b=g[x];if(1024>=b.length){var y=Jb.test(b)?b.replace(Jb,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,i);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var k=Array.from(N);return k.reverse(),k.slice(0,50).map((A=>{return me({},A,{filename:A.filename||(C=k,C[C.length-1]||{}).filename,function:A.function||El});var C}))})(p)}})("web:javascript",X3,J3)),this._instance=e,this.ta=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Qm))!==null&&t!==void 0?t:[],this.ia=Hd(this.na()),this.sa=new dC(this.ia)}onConfigChange(){this.ia=Hd(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(e){var t,n,i;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ta=o,this._instance.persistence&&this._instance.persistence.register({[Qm]:this.ta,[Xm]:u})}}}get oa(){var e,t=!!this._instance.get_property(Xm),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ra.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ia.enabled)try{if(!Mt(e)||e.trim().length===0)return void Ri.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((f,h)=>uC.has(h)?(u.push(h),f):(f[h]=o[h],f)),{}),droppedKeys:u}})(this.aa(t)),i=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&Ri.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.sa.add(me({[Fd]:e,[Ud]:new Date().toISOString()},i))}catch(o){Ri.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.la(t)){if(this.ua(t))return this.ha("Exception dropped: matched a suppression rule"),void Ri.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(t))return this.ha("Exception dropped: thrown by a browser extension"),void Ri.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(t))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Ri.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ia.enabled&&We(e.$exception_steps)?this.va(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return i&&this.sa.clear(),i}catch(a){return Ri.error("Failed to capture exception event. Dropping this exception.",a),void this.sa.clear()}}catch(a){return void Ri.error("Failed to process exception event. Ignoring this exception.",a)}}va(e){try{var t=this.sa.getAttachable();return t.length===0?e:me({},e,{$exception_steps:t})}catch(n){return Ri.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ha(e){this.ia.enabled&&this.sa.add({[Fd]:e,[Ud]:new Date().toISOString()})}aa(e){return It(e)?me({},e):{}}na(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ua(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var a=i.type,o=i.value;return Mt(a)&&a.length>0&&n.$exception_types.push(a),Mt(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.ta.some((n=>{var i=n.values.map((a=>{var o,u=Yw[a.operator],f=Ge(a.value)?a.value:[a.value],h=(o=t[a.key])!==null&&o!==void 0?o:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}da(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://")))}ca(e){if(e.length>0){var t,n,i,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}la(e){return!We(e)&&Ge(e)}}},T4=me({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.fa=null,this.pa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,i;if(this.mi&&this.mi.register({[Vg]:!!t.productTours}),!im(this._instance))return!this.fa&&We((n=this.mi)==null?void 0:n.props[nc])||rm.info("product tours disabled; stopping and clearing cached tours"),(i=this.fa)==null||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&im(this._instance)&&this.er((()=>this.ga()))}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?rm.error("Could not load product tours script",i):e()}))}ga(){var e;!this.fa&&(e=Oe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.fa=Oe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ge(this.pa)||t){var n=this.mi;if(n){var i=n.props[nc];if(Ge(i)&&!t)return this.pa=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",timestampMode:"query",callback:a=>{if(im(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return rm.error(u),void e([],{isLoaded:!1,error:u})}var f=Ge(a.json.product_tours)?a.json.product_tours:[];this.pa=f,n&&n.register({[nc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.pa,{isLoaded:!0})}getActiveProductTours(e){We(this.fa)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(e)}showProductTour(e){var t;(t=this.fa)==null||t.showTourById(e)}previewTour(e){this.fa?this.fa.previewTour(e):this.er((()=>{var t;this.ga(),(t=this.fa)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.fa)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.fa)==null||e.nextStep()}previousStep(){var e;(e=this.fa)==null||e.previousStep()}clearCache(){var e;this.pa=null,(e=this.mi)==null||e.unregister(nc)}resetTour(e){var t;(t=this.fa)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.fa)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.fa)==null||t.cancelPendingTour(e)}}},pf),A4={siteApps:class{constructor(e){this.ma=0,this._instance=e,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(e,t){if(t){var n=this.globalsForEvent(t);this.ya.push(n),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var e;return(e=Oe._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.ba.bind(this));this._a=()=>{e(),this.ya=[],this._a=void 0}}}globalsForEvent(e){var t,n,i,a,o,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 x of Object.entries(g)){var b=x[0];h[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:me({},v5(e,y4),{properties:me({},e.properties,_?{$set:me({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:me({},(i=(a=e.properties)==null?void 0:a.$set_once)!==null&&i!==void 0?i:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}wa(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)||(ai.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)||(ai.error("prepare_external_dependency_script returned null"),null):e}xa(){var e,t,n,i,a,o,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ce==null?void 0:Ce.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.ma++,this.ka)return this.Sa();var g=[],x=this,b=new WeakSet,y=(N,k,A)=>{if(N!=null&&N[k]){var C=N[k];N[k]=A(C),g.push((()=>{N[k]=C}))}},_=N=>{if(b.has(N))return N;var k=x.wa(N);return k&&b.add(k),k},j=N=>N.map((k=>typeof k=="string"?k:_(k))).filter((k=>!In(k)));return y(p,"appendChild",(N=>function(k){var A=_(k);return A?N.call(this,A):k})),y(p,"insertBefore",(N=>function(k,A){var C=_(k);return C?N.call(this,C,A):k})),y(p,"replaceChild",(N=>function(k,A){var C=_(k);return C?N.call(this,C,A):A})),[(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((N=>{y(N,"append",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"prepend",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(o=h.CharacterData)==null?void 0:o.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"after",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"replaceWith",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];var D=j(C);return C.length&&!D.length?void 0:k.apply(this,D)}))})),y((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(N=>function(k,A){var C=_(A);return C?N.call(this,k,C):null})),this.ka=()=>{g.forEach((N=>N())),this.ka=void 0},this.Sa()}Sa(){var e=!1;return()=>{var t;e||(e=!0,this.ma--,this.ma===0&&((t=this.ka)==null||t.call(this)))}}Ca(e,t){t===void 0&&(t=!0);var n=this.xa();try{var i=e(n);return t&&n(),i}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.ya.length&&(ai.info("Processing "+this.ya.length+" events for site app with id "+e.id),this.ya.forEach((f=>this.Ca((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this._a)==null||u.call(this))},i=!1,a=u=>{t.errored=!u,t.loaded=!0,ai.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var o=this.Ca((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1).processEvent;o&&(t.processEvent=o),i=!0}catch(u){ai.error(Ry+e.id,u),a(!1)}if(i&&t.loaded)try{n()}catch(u){ai.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Ta(){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)}Ia(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(o){try{t.Ca((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){ai.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))i(a)}}onRemoteConfig(e){var t,n,i,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(h=>this.Ia(h)))):void ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this._a)==null||n.call(this),e.ok){var o=e.config;if((i=o.siteApps)!=null&&i.length)if(this.isEnabled){var u=function(){var h,p=f.id,g=f.url;Oe["__$$ph_site_app_"+p]=a._instance,(h=Oe.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(a._instance,g,(x=>{if(x)return ai.error(Ry+p,x)}))};for(var f of o.siteApps)u()}else ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},M4={tracingHeaders:class{constructor(e){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,n,i=this.Pa();i?(_e(this.Ma)&&(this.Ma=(t=Oe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),_e(this.Ea)&&(this.Ea=(n=Oe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=e}initialize(){this.startIfEnabledOrStop()}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return v4.error("failed to load script",i);e()}))}Oa(){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}Pa(){var e=this.Oa();return Ge(e)?(Ge(this.Ra)?this.Ra.splice(0,this.Ra.length,...e):this.Ra=[...e],e.length>0?this.Ra:void 0):(Ge(this.Ra)&&this.Ra.splice(0),this.Ra=e||void 0,this.Ra)}Ko(){var e,t;(e=this.Ma)==null||e.call(this),(t=this.Ea)==null||t.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},R4=me({surveys:class{get Te(){return this._instance.config}constructor(e){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return Ct.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(We(t))return Ct.warn("Flags not loaded yet. Not loading surveys.");var n=Ge(t);this.Fa=n?t.length>0:t,Ct.info("flags response received, isSurveysEnabled: "+this.Fa),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(Xw)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)Ct.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)Ct.info(Ly);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())Ct.info("Not loading surveys in cookieless mode without consent.");else{var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){if(!_e(this.Fa)||this.Te.advanced_enable_surveys){var t=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var n=e.generateSurveys;if(n)return void this.Da(n,t);var i=e.loadExternalDependency;if(!i)return void this.qa(Yg);i(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.qa("Could not load surveys script",a):this.Da(e.generateSurveys,t)}))}catch(a){throw this.qa("Error initializing surveys",a),a}finally{this.La=!1}}}else Ct.error("PostHog Extensions not found.")}}Da(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new S4(this._instance),Ct.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(e,t){Ct.error(e,t),this.ja({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$a.push(e),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return Ct.info(Ly),e([]);var n,i=this._instance.get_property(tg);if(i&&!t)return e(i,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((a=>e(a.surveys,a.context))):(typeof Promise<"u"&&(this.Aa=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:a=>{var o;this.Aa=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;Ct.error(f),this.Na=Date.now();var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}this.Na=null;var p,g=a.json.surveys||[],x=g.filter((y=>(function(_){return!(!_.start_date||_.end_date)})(y)&&(Qw(y)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(y))));x.length>0&&((p=this._surveyEventReceiver)==null||p.register(x)),(o=this._instance.persistence)==null||o.register({[tg]:g,[Vd]:Date.now()});var b={isLoaded:!0};e(g,b),n==null||n({surveys:g,context:b})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var e=this._instance.get_property(Vd);return Cn(e)&&Date.now()-e>3e5}Ua(){return Cn(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(e,t){var n,i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};Kw(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(e){for(var t of this.$a)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Ct.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!We(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ct.warn("init was not called")}za(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((a=>a.id===e)))!==null&&i!==void 0?i:null})),t}Va(e){if(We(this._surveyManager))return{eligible:!1,reason:dd};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wa(e){if(We(this._surveyManager))return{eligible:!1,reason:dd};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(We(this._surveyManager))return Ct.warn("init was not called"),{visible:!1,disabledReason:dd};var t=this.Wa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return We(this._surveyManager)?(Ct.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dd})):new Promise((n=>{this.getSurveys((i=>{var a,o=(a=i.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(o){var u=this.Wa(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(We(this._surveyManager))Ct.warn("init was not called");else{var a=typeof e=="string"?this.za(e):e;if(a!=null&&a.id)if(o4.includes(a.type)){var o=Ce==null?void 0:Ce.querySelector(t);if(o)return(i=a.appearance)!=null&&i.surveyPopupDelaySeconds?(Ct.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Ct.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,o,n),Ct.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,o,n);Ct.warn("Survey element not found")}else Ct.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Ct.warn("Survey not found")}}displaySurvey(e,t){var n;if(We(this._surveyManager))Ct.warn("init was not called");else{var i=this.za(e);if(i){var a=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=me({},i,{appearance:me({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==fg.Popover&&t.initialResponses&&Ct.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.Va(i);if(!o.eligible)return void Ct.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==fg.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else Ct.warn("Survey not found")}}cancelPendingSurvey(e){We(this._surveyManager)?Ct.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},pf),L4={toolbar:class{constructor(e){this.instance=e}Za(e){Oe.ph_toolbar_state=e}Ga(){var e;return(e=Oe.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),lw(this.instance.config)||!ie||!Ce)return!1;e=e??ie.location,n=n??ie.history;try{if(!t){try{ie.localStorage.setItem("test","test"),ie.localStorage.removeItem("test")}catch{return!1}t=ie==null?void 0:ie.localStorage}var i,a=k4||Jd(e.hash,"__posthog")||Jd(e.hash,"state"),o=a?ty((()=>JSON.parse(atob(decodeURIComponent(a)))))||ty((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Dy)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Qa(e){var t=Oe.ph_load_toolbar||Oe.ph_load_editor;!We(t)&&Gr(t)?t(e,this.instance):zy.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ce==null||!Ce.getElementById(dw));if(!ie||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=me({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ie.localStorage.setItem(Dy,JSON.stringify(me({},i,{source:void 0}))),this.Ga()===2)this.Qa(i);else if(this.Ga()===0){var a;this.Za(1),(a=Oe.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return zy.error("[Toolbar] Failed to load",o),void this.Za(0);this.Za(2),this.Qa(i)})),Qt(ie,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(i)}))}return!0}Ja(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)}}},D4=me({experiments:Mn},pf),z4={conversations:class{constructor(e){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;We(t)||(Wr(t)?this.Ka=t:(this.Ka=t.enabled,this.Xa=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||lw(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e&&!_e(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var t=e.initConversations;if(t)return this.el(t),void(this.Ya=!1);var n=e.loadExternalDependency;if(!n)return void this.tl(Yg);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.tl("Could not load conversations script",i):this.el(e.initConversations),this.Ya=!1}))}catch(i){this.tl("Error initializing conversations",i),this.Ya=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}}el(e){if(this.Xa)try{this._conversationsManager=e(this.Xa,this._instance),Mr.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}tl(e,t){Mr.error(e,t),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!In(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 tn((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Mr.warn(la),null)}))()}getMessages(e,t){var n=this;return tn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn(la),null)}))()}markAsRead(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn(la),null)}))()}getTickets(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn(la),null)}))()}requestRestoreLink(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Mr.warn(la),null)}))()}restoreFromToken(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Mr.warn(la),null)}))()}restoreFromUrlToken(){var e=this;return tn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Mr.warn(la),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}En(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Rn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},O4={logs:class{constructor(e){var t;this.rl=!1,this.il=!1,this.Ge=Vt("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var n,i;this.Hs=0,(n=this.ol)==null||n.onReconnect(),(i=this.al)==null||i.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.rl=!0),ie&&Qt(ie,"online",this.sl)}ll(e,t,n,i){var a,o=(function(u,f){var h,p,g,x,b,y,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,N=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(g=u==null?void 0:u.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,A=_e(k)?Math.max(N,2048):Math.max(N,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(x=(b=C==null?void 0:C["service.name"])!==null&&b!==void 0?b:u==null?void 0:u.serviceName)!==null&&x!==void 0?x:f==null?void 0:f.serviceNameDefault,serviceVersion:(y=C==null?void 0:C["service.version"])!==null&&y!==void 0?y:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:N,maxQueueSize:A,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new I3(this.ul(e,t),o,this.Ge,(()=>this.hl()),(u=>u()),void 0,i),o]}dl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.ol||this.cl!==t){var n;(n=this.ol)==null||n.reset(),this.cl=t;var i=this.ll((()=>this.Gr),(a=>{this.Gr=a}));this.ol=i[0],this.vl=i[1]}return this.ol}fl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.al||this.pl!==t){var n;(n=this.al)==null||n.reset(),this.pl=t;var i=this.ll((()=>this.nl),(a=>{this.nl=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$y);this.al=i[0],this.gl=i[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!We(n)&&n&&(this.rl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.ol)==null||e.reset(),this.nl=[],(t=this.al)==null||t.reset(),this.Hs=0}captureLog(e){this.dl().captureLog(e)}le(e){this.fl().captureLog(e)}get logger(){return this.ml||(this.ml={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.ml}flushLogs(e){e?this.yl(e):(this.ol&&this.ol.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))),this.al&&this.al.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.rl&&!this.il){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.Ge.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Yg)}else this.Ge.error("PostHog Extensions not found.")}}ul(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Bi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Bi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},Tt:i=>this.Tt(i),getLibraryId:()=>St.LIB_NAME,getLibraryVersion:()=>St.LIB_VERSION}}Tt(e){return new Promise((t=>{if(jw(this.Hs,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,i=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this._l(u),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=o.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}}))}_l(e){(e!==0||this._instance.__loaded)&&(this.Hs=Nw(e,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(e){this.Gr.length>0&&this.wl(e,this.Gr,this.vl,St.LIB_NAME,(t=>{this.Gr=t})),this.nl.length>0&&this.wl(e,this.nl,this.gl,$y,(t=>{this.nl=t}))}wl(e,t,n,i,a){if(t.length!==0){var o=t.map((f=>f.record));a([]);var u=Y5(o,G5(n,St.LIB_NAME,St.LIB_VERSION),i,St.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=i,We(a)||(t.sessionStartTimestamp=a),We(o)||(t.lastActivityTimestamp=o)}if(Oe!=null&&(e=Oe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Es(Oe.location.href):Oe.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},B4={metrics:class{constructor(e){this.Ge=Vt("[metrics]"),this._instance=e}initialize(){}dl(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.ol&&this.cl===n||((t=this.ol)==null||t.reset(),this.cl=n,this.ol=new q3(this.ul(),(function(i){var a,o,u,f,h,p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(f=i==null?void 0:i.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=i==null?void 0:i.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.Ge)),this.ol}count(e,t,n){t===void 0&&(t=1),this.dl().count(e,t,n)}gauge(e,t,n){this.dl().gauge(e,t,n)}histogram(e,t,n){this.dl().histogram(e,t,n)}flush(e){if(!this.ol)return Promise.resolve();if(e){var t=this.ol.drainWindow();return t&&this.Bt(t,e),Promise.resolve()}return this.ol.flush().catch((n=>this.Ge.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.ol)==null||e.reset()}ul(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Bt:n=>t.Bt(n),getLibraryId:()=>St.LIB_NAME,getLibraryVersion:()=>St.LIB_VERSION}}Bt(e,t){return new Promise((n=>{var i=!1,a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(me({method:"POST",url:this.xl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==429&&500>f)a({kind:"fatal",error:new Error("metrics request failed with status "+f)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+f)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},P4=me({},pf,N4,C4,E4,T4,A4,R4,M4,L4,D4,z4,O4,B4);Dr.__defaultExtensionClasses=me({},P4);var jc=(function(){St.SDK_DIST_CHANNEL="npm";var e=dc[bl]=new Dr;return(function(){function t(){t.done||(t.done=!0,Jw=!1,Rt(dc,(function(n){n._dom_loaded()})))}Ce!=null&&Ce.addEventListener?Ce.readyState==="complete"?t():Qt(Ce,"DOMContentLoaded",t,{capture:!1}):ie&&Se.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const $4="https://us.i.posthog.com",e2="cc-telemetry-enabled";let yg=!1,Nc=!1;function F4(){return $4}function U4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(e2);return e===null?!0:e==="true"}function t2(e){yg&&(e?(jc.opt_in_capturing({captureEventName:null}),Nc=!0):(jc.opt_out_capturing(),Nc=!1))}function gD(e){typeof localStorage<"u"&&localStorage.setItem(e2,String(e)),t2(e)}function H4(){const e=void 0;return e?(jc.init(e,{api_host:F4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),yg=!0,t2(U4()),!0):(yg=!1,Nc=!1,!1)}function nx(e,t){Nc&&jc.capture(e,t)}function As(e,t){Nc&&jc.captureException(e,t)}function I4(e){nx("$pageview",{$current_url:e})}const ui="/api",n2="companion_auth_token";function Ms(){if(typeof window>"u")return{};const e=localStorage.getItem(n2);return e?{Authorization:`Bearer ${e}`}:{}}function ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(n2),qn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>uN);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function pn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Mc(e,t,n,i){nx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function di(e,t,n,i,a){nx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),As(i,{method:e,path:t,status:a})}async function He(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("POST",e,pn()-n,u,a.status),i=!0,u}return Mc("POST",e,pn()-n,a.status),a.json()}catch(a){throw i||di("POST",e,pn()-n,a),a}}async function Ae(e){const t=pn();let n=!1;try{const i=await fetch(`${ui}${e}`,{headers:{...Ms()}});if(!i.ok){ba(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw di("GET",e,pn()-t,o,i.status),n=!0,o}return Mc("GET",e,pn()-t,i.status),i.json()}catch(i){throw n||di("GET",e,pn()-t,i),i}}async function Rr(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("PUT",e,pn()-n,u,a.status),i=!0,u}return Mc("PUT",e,pn()-n,a.status),a.json()}catch(a){throw i||di("PUT",e,pn()-n,a),a}}async function q4(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("PATCH",e,pn()-n,u,a.status),i=!0,u}return Mc("PATCH",e,pn()-n,a.status),a.json()}catch(a){throw i||di("PATCH",e,pn()-n,a),a}}async function Lr(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("DELETE",e,pn()-n,u,a.status),i=!0,u}return Mc("DELETE",e,pn()-n,a.status),a.json()}catch(a){throw i||di("DELETE",e,pn()-n,a),a}}async function V4(e,t){const n=await fetch(`${ui}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ms()},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(),a=new TextDecoder;let o="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;o+=a.decode(h,{stream:!0});const p=o.split(`
|
|
63
|
+
`)}function Mp(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 o3(e,t){const n=e||[],i=t||[];if(n.length===0&&i.length===0)return;const a=new Map;for(const f of i)a.set(Mp(f),f);const o=[],u=new Set;for(const f of n){const h=Mp(f);u.has(h)||(u.add(h),o.push(a.get(h)||f))}for(const f of i){const h=Mp(f);u.has(h)||(u.add(h),o.push(f))}return o}function zb(e,t,n,i,a){return{toolUseId:e,toolName:t,preview:gc(t,n),startedAt:i,elapsedSeconds:0,isError:!1,parentToolUseId:a||void 0}}function Dm(e,t){const n=o3(e.contentBlocks,t.contentBlocks),i=n&&n.length>0?_d(n):t.content||e.content;return{...e,...t,content:i,contentBlocks:n,timestamp:e.timestamp??t.timestamp,isStreaming:t.isStreaming}}function c3(e,t){const n=X.getState(),i=n.messages.get(e)||[],a=i.findIndex(u=>u.role==="assistant"&&u.id===t.id);if(a===-1){n.appendMessage(e,t);return}const o=[...i];o[a]=Dm(o[a],t),n.setMessages(e,o)}function u3(e,t){var a,o;let n;try{n=JSON.parse(t.data)}catch{console.warn(`[ws] Failed to parse incoming message for session ${e}:`,(o=(a=t.data)==null?void 0:a.substring)==null?void 0:o.call(a,0,120));return}const i=X.getState();i.connectionStatus.get(e)==="connecting"&&i.setConnectionStatus(e,"connected"),g5(e,n)}function g5(e,t,n={}){var u,f,h,p,g,x;const{processSeq:i=!0,ackSeqMessage:a=!0}=n,o=X.getState();if(i&&typeof t.seq=="number"){const b=Lm(e);if(t.seq<=b)return;Lb(e,t.seq),a&&Db(e,t.seq)}switch(QN.has(t.type)&&o.setLastActivity(e,Date.now()),t.type){case"session_init":{const b=o.sessions.get(e);if(o.addSession(t.session),o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b||o.setSessionStatus(e,"idle"),!o.sessionNames.has(e)){const y=new Set(o.sessionNames.values()),_=l5(y);o.setSessionName(e,_)}break}case"session_update":{o.updateSession(e,t.session);break}case"assistant":{const b=t.message;if(b.model==="<synthetic>"){ws(e),o.setStreaming(e,null),cl(e,"synthetic_noop",{detail:{stopReason:b.stop_reason,text:_d(b.content).slice(0,120)},userText:"The session resumed without generating a new response. If it seems stuck, resend your last message."});break}const y=_d(b.content),_={id:b.id,role:"assistant",content:y,contentBlocks:b.content,timestamp:t.timestamp||Date.now(),parentToolUseId:t.parent_tool_use_id,model:b.model,stopReason:b.stop_reason};if(ws(e),c3(e,_),o.setStreaming(e,null),ks.delete(e),Di.delete(e),(u=b.content)!=null&&u.length)for(const j of b.content)j.type==="tool_result"&&o.clearToolProgress(e,j.tool_use_id);if(o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now()}),(f=b.content)!=null&&f.length)for(const j of b.content){if(j.type==="tool_use"){const N=j.input||{};o.addToolActivity(e,zb(j.id,j.name,N,t.timestamp||Date.now(),t.parent_tool_use_id))}j.type==="tool_result"&&o.updateToolActivity(e,j.tool_use_id,{completedAt:Date.now(),isError:!!j.is_error})}(h=b.content)!=null&&h.length&&(Cp(e,b.content),Ep(e,b.content),Tp(e,b.content),Ap(e,b.content));break}case"stream_event":{const b=t.event;if(b&&typeof b=="object"){if(b.type==="message_start"&&(ks.delete(e),Di.delete(e),ws(e),o.setSessionStatus(e,"running"),o.streamingStartedAt.has(e)||o.setStreamingStats(e,{startedAt:Date.now(),outputTokens:0})),b.type==="content_block_delta"){const y=b.delta;if((y==null?void 0:y.type)==="text_delta"&&typeof y.text=="string"){const _=Di.get(e)||{thinking:"",text:""};ks.get(e)==="thinking"&&(_.thinking=""),_.text+=y.text,Di.set(e,_),ks.set(e,"text"),o.setStreaming(e,_.text),Mb(e,_.text,"text")}if((y==null?void 0:y.type)==="thinking_delta"&&typeof y.thinking=="string"){const _=Di.get(e)||{thinking:"",text:""};_.thinking+=y.thinking,Di.set(e,_),ks.set(e,"thinking"),o.setStreaming(e,_.thinking),Mb(e,_.thinking,"thinking")}}if(b.type==="message_delta"){const y=b.usage;y!=null&&y.output_tokens&&o.setStreamingStats(e,{outputTokens:y.output_tokens})}}break}case"result":{Rd.delete(e),Ld.delete(e);const b=t.data,y={total_cost_usd:b.total_cost_usd,num_turns:b.num_turns};if(typeof b.total_lines_added=="number"&&(y.total_lines_added=b.total_lines_added),typeof b.total_lines_removed=="number"&&(y.total_lines_removed=b.total_lines_removed),b.modelUsage){for(const _ of Object.values(b.modelUsage))if(_.contextWindow>0){const j=Math.round((_.inputTokens+_.outputTokens)/_.contextWindow*100);y.context_used_percent=Math.max(0,Math.min(j,100))}}o.updateSession(e,y),ws(e),o.setStreaming(e,null),ks.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"),!document.hasFocus()&&o.notificationSound&&gN(),!document.hasFocus()&&o.notificationDesktop&&Eb("Session completed","Claude finished the task",e),b.is_error&&o.appendMessage(e,{id:li(),role:"system",content:Ab(b),timestamp:Date.now()});break}case"permission_request":{if(o.addPermission(e,t.request),!document.hasFocus()&&o.notificationDesktop){const y=t.request;Eb("Permission needed",`${y.tool_name}: approve or deny`,y.request_id)}const b=t.request;if(b.tool_name&&b.input){const y=[{type:"tool_use",id:b.tool_use_id,name:b.tool_name,input:b.input}];Cp(e,y),Ep(e,y),Tp(e,y),Ap(e,y)}break}case"permission_cancelled":{o.removePermission(e,t.request_id);break}case"permission_auto_resolved":{o.addAiResolvedPermission(e,{request:t.request,behavior:t.behavior,reason:t.reason,timestamp:Date.now()});break}case"tool_progress":{o.setToolProgress(e,t.tool_use_id,{toolName:t.tool_name,elapsedSeconds:t.elapsed_time_seconds}),o.updateToolActivity(e,t.tool_use_id,{elapsedSeconds:t.elapsed_time_seconds});break}case"tool_use_summary":{((p=o.sdkSessions.find(y=>y.sessionId===e))==null?void 0:p.backendType)==="codex"&&o.appendMessage(e,{id:li(),role:"system",content:t.summary,timestamp:Date.now()});break}case"user_message":{o.appendMessage(e,{id:t.id||li(),role:"user",content:t.content,timestamp:t.timestamp||Date.now()}),o.clearPromptSuggestions(e);break}case"system_event":{if(((g=t.event)==null?void 0:g.subtype)==="task_notification"){const{task_id:y,status:_,summary:j}=t.event;y&&_&&o.updateProcess(e,y,{status:_,completedAt:Date.now(),summary:j||void 0})}const b=Tb(t.event);if(!b)break;o.appendMessage(e,{id:li(),role:"system",content:b,timestamp:t.timestamp||Date.now()});break}case"status_change":{t.status==="compacting"?o.setSessionStatus(e,"compacting"):o.setSessionStatus(e,t.status);break}case"auth_status":{t.error&&o.appendMessage(e,{id:li(),role:"system",content:`Auth error: ${t.error}`,timestamp:Date.now()});break}case"error":{o.appendMessage(e,{id:li(),role:"system",content:t.message,timestamp:Date.now()});break}case"session_phase":{const b=t.phase;b==="terminated"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)?cl(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."}):cl(e,"session_terminated",{detail:{trigger:"session_phase:terminated",previousPhase:t.previousPhase,hadDraft:!1}})):b==="reconnecting"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)&&cl(e,"interrupted_mid_stream",{detail:{trigger:"session_phase:reconnecting",previousPhase:t.previousPhase},userText:"Response interrupted — reconnecting to the backend…"})):b==="starting"||b==="initializing"?(o.setCliConnected(e,!1),o.setCliReconnecting(e,!0)):(o.setCliConnected(e,!0),o.setCliReconnecting(e,!1),b==="ready"?o.setSessionStatus(e,"idle"):b==="streaming"?o.setSessionStatus(e,"running"):b==="compacting"?o.setSessionStatus(e,"compacting"):b==="awaiting_permission"&&o.setSessionStatus(e,"running"));break}case"cli_disconnected":{o.setCliConnected(e,!1),o.setCliReconnecting(e,!1),o.setSessionStatus(e,null),o.setStreaming(e,null),o.setStreamingStats(e,null),ws(e)?cl(e,"interrupted_mid_stream",{detail:{trigger:"cli_disconnected"},userText:"Response interrupted — the backend disconnected before finishing. Trying to reconnect…"}):cl(e,"cli_disconnected",{detail:{trigger:"cli_disconnected",hadDraft:!1}});break}case"cli_connected":{o.setCliConnected(e,!0),o.setCliReconnecting(e,!1);break}case"session_name_update":{const b=o.sessionNames.get(e),y=b&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(b);(!b||y)&&(o.setSessionName(e,t.name),o.markRecentlyRenamed(e));break}case"pr_status_update":{o.setPRStatus(e,{available:t.available,pr:t.pr});break}case"mcp_status":{o.setMcpServers(e,t.servers);break}case"rate_limit":{o.setRateLimit(e,t.info);break}case"message_history":{const b=[],y=new Map;for(let j=0;j<t.messages.length;j++){const N=t.messages[j];if(N.type==="user_message")b.push({id:N.id||li(),role:"user",content:N.content,timestamp:N.timestamp});else if(N.type==="assistant"){const k=N.message,A=_d(k.content),C={id:k.id,role:"assistant",content:A,contentBlocks:k.content,timestamp:N.timestamp||Date.now(),parentToolUseId:N.parent_tool_use_id,model:k.model,stopReason:k.stop_reason},L=b.findIndex(D=>D.role==="assistant"&&D.id===C.id);if(L===-1?b.push(C):b[L]=Dm(b[L],C),(x=k.content)!=null&&x.length){Cp(e,k.content),Ep(e,k.content),Tp(e,k.content),Ap(e,k.content);const D=N.timestamp||Date.now();for(const z of k.content){if(z.type==="tool_use"){const q=z.input||{},$=y.get(z.id);y.set(z.id,$??zb(z.id,z.name,q,D,N.parent_tool_use_id))}if(z.type==="tool_result"){const q=y.get(z.tool_use_id);q&&y.set(z.tool_use_id,{...q,completedAt:D,isError:q.isError||!!z.is_error,elapsedSeconds:Math.max(q.elapsedSeconds,q.completedAt?q.elapsedSeconds:Math.max(0,(D-q.startedAt)/1e3))})}}}}else if(N.type==="result"){const k=N.data;k.is_error&&b.push({id:`hist-error-${j}`,role:"system",content:Ab(k),timestamp:Date.now()});const A={total_cost_usd:k.total_cost_usd,num_turns:k.num_turns};if(typeof k.total_lines_added=="number"&&(A.total_lines_added=k.total_lines_added),typeof k.total_lines_removed=="number"&&(A.total_lines_removed=k.total_lines_removed),k.modelUsage){for(const C of Object.values(k.modelUsage))if(C.contextWindow>0){const L=C,D=Math.round((L.inputTokens+L.outputTokens)/L.contextWindow*100);A.context_used_percent=Math.max(0,Math.min(D,100))}}o.updateSession(e,A)}else if(N.type==="system_event"){const k=Tb(N.event);if(!k)continue;b.push({id:`hist-system-event-${j}`,role:"system",content:k,timestamp:N.timestamp||Date.now()})}}if(b.length>0){const j=o.messages.get(e)||[];if(j.length===0)o.setMessages(e,b);else{const N=[...j];for(const k of b){const A=N.findIndex(L=>L.id===k.id);if(A===-1){N.push(k);continue}const C=N[A];C.role==="assistant"&&k.role==="assistant"?N[A]=Dm(C,k):N[A]=k}N.sort((k,A)=>(k.timestamp??0)-(A.timestamp??0)),o.setMessages(e,N)}}o.setToolActivity(e,Array.from(y.values()).sort((j,N)=>j.startedAt-N.startedAt));const _=t.messages[t.messages.length-1];(_==null?void 0:_.type)==="result"&&(ws(e),o.setStreaming(e,null),ks.delete(e),Di.delete(e),o.setStreamingStats(e,null),o.clearToolProgress(e),o.setSessionStatus(e,"idle"));break}case"event_replay":{let b;for(const y of t.events){const _=Lm(e);y.seq<=_||(Lb(e,y.seq),b=y.seq,g5(e,y.message,{processSeq:!1,ackSeqMessage:!1}))}typeof b=="number"&&Db(e,b);break}case"prompt_suggestion":{const b=t.suggestions;o.setPromptSuggestions(e,b);break}case"streamlined_text":{o.appendMessage(e,{id:li(),role:"assistant",content:t.text,timestamp:Date.now()});break}case"streamlined_tool_use_summary":{o.appendMessage(e,{id:li(),role:"system",content:t.tool_summary,timestamp:Date.now()});break}default:{console.debug("[ws] Unhandled message type:",t.type);break}}}function Ac(e){const t=Yr.get(e);if(f5(t))return;if(t){try{t.close()}catch{}Yr.delete(e)}X.getState().setConnectionStatus(e,"connecting");const i=new WebSocket(l3(e));Yr.set(e,i),i.onopen=()=>{const a=Lm(e);i.send(JSON.stringify({type:"session_subscribe",last_seq:a})),i3(e,i);const o=Ii.get(e);o&&(clearTimeout(o),Ii.delete(e))},i.onmessage=a=>u3(e,a),i.onclose=()=>{Yr.get(e)===i&&(Yr.delete(e),X.getState().setConnectionStatus(e,"disconnected"),d3(e))},i.onerror=()=>{i.close()}}function d3(e){if(Ii.has(e)||vc)return;const t=setTimeout(()=>{Ii.delete(e),!vc&&h5(e)&&Ac(e)},WN);Ii.set(e,t)}function zm(e){const t=Ii.get(e);t&&(clearTimeout(t),Ii.delete(e));const n=Yr.get(e);n&&(n.close(),Yr.delete(e)),X.getState().setConnectionStatus(e,"disconnected"),Rd.delete(e),Ld.delete(e),Ko.delete(e),bd.delete(e),ks.delete(e),sc.delete(e),Di.delete(e),Md.delete(e),xc.delete(e)}function f3(e){if(!vc)for(const t of e)t.archived||Ac(t.sessionId)}function h3(e){return new Promise((t,n)=>{const i=setInterval(()=>{const o=Yr.get(e);(o==null?void 0:o.readyState)===WebSocket.OPEN&&(clearInterval(i),clearTimeout(a),t())},50),a=setTimeout(()=>{clearInterval(i),n(new Error("Connection timeout"))},1e4)})}function Fn(e,t){const n=Yr.get(e);let i=t;const a=a3.has(t.type);if(a)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:p5()});break}if((n==null?void 0:n.readyState)===WebSocket.OPEN){n.send(JSON.stringify(i));return}a&&r3(e,i)}function Ob(e){Fn(e,{type:"mcp_get_status"})}function p3(e,t,n){Fn(e,{type:"mcp_toggle",serverName:t,enabled:n})}function m3(e,t){Fn(e,{type:"mcp_reconnect",serverName:t})}function g3(e,t){Fn(e,{type:"mcp_set_servers",servers:t})}function x3(e,t){Fn(e,{type:"set_ai_validation",...t})}var ie=typeof window<"u"?window:void 0,Rn=typeof globalThis<"u"?globalThis:ie,Hn=Rn==null?void 0:Rn.navigator,Ce=Rn==null?void 0:Rn.document,an=Rn==null?void 0:Rn.location,Pg=Rn==null?void 0:Rn.fetch,Om=Rn!=null&&Rn.XMLHttpRequest&&"withCredentials"in new Rn.XMLHttpRequest?Rn.XMLHttpRequest:void 0,Bb=Rn==null?void 0:Rn.AbortController,v3=Rn==null?void 0:Rn.CompressionStream,er=Hn==null?void 0:Hn.userAgent;function x5(){return!(!ie||ie.navigator.onLine===!1)}var zo=typeof globalThis<"u"?globalThis:ie;zo&&typeof self>"u"&&(zo.self=zo),zo&&typeof File>"u"&&(zo.File=function(){});var Oe=ie??{},St={DEBUG:!1,LIB_VERSION:"0.2.3",LIB_NAME:"browser-common"};function Pb(e,t,n,i,a,o,u){try{var f=e[o](u),h=f.value}catch(p){return void n(p)}f.done?t(h):Promise.resolve(h).then(i,a)}function tn(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var o=e.apply(t,n);function u(h){Pb(o,i,a,u,f,"next",h)}function f(h){Pb(o,i,a,u,f,"throw",h)}u(void 0)}))}}function pe(){return pe=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},pe.apply(null,arguments)}function v5(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 $b=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Fb(e){return typeof e=="string"||e}function Ub(e){return typeof e=="string"?e:void 0}var Oo,b3=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],Bi=(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.AiQueue="ai_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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",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})({}),Hb=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),y3=["$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"],_3=["token"],b5="NativeGzipValidationError",Bm=e=>e.length>=2&&e[0]===31&&e[1]===139,Ib=(e,t)=>e===Hb.GZipJS||t===Hb.GZipJS||t==="gzip",qb=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",nd=e=>{var t=new Error("Native gzip produced invalid output: "+e);throw t.name=b5,t},w3=(function(){var e=tn((function*(t,n){18>t.size&&nd("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Bm(i)&&i[2]===8||nd("invalid-header");var a=new DataView(yield t.slice(t.size-8).arrayBuffer());a.getUint32(0,!0)!==(u=>{for(var f=(()=>{if(Oo)return Oo;Oo=[];for(var g=0;256>g;g++){for(var x=g,b=0;8>b;b++)x=1&x?3988292384^x>>>1:x>>>1;Oo[g]=x>>>0}return Oo})(),h=4294967295,p=0;u.length>p;p++)h=f[255&(h^u[p])]^h>>>8;return(4294967295^h)>>>0})(n)&&nd("invalid-crc");var o=n.length>>>0;a.getUint32(4,!0)!==o&&nd("invalid-size")}));return function(t,n){return e.apply(this,arguments)}})();function Pm(){return Pm=tn((function*(e,t,n){t===void 0&&(t=!0);try{var i=new TextEncoder().encode(e),a=new globalThis.CompressionStream("gzip"),o=a.writable.getWriter(),u=o.write(i).then((()=>o.close())).catch((function(){var p=tn((function*(g){try{yield o.abort(g)}catch{}throw g}));return function(g){return p.apply(this,arguments)}})()),f=new Response(a.readable).blob(),h=(yield Promise.all([f,u]))[0];return yield w3(h,i),h}catch(p){if(n!=null&&n.rethrow)throw p;return t&&console.error("Failed to gzip compress data",p),null}})),Pm.apply(this,arguments)}var S3=["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"],Vb=function(e,t){if(t===void 0&&(t=[]),!e)return!1;var n=e.toLowerCase();return S3.concat(t).some((i=>{var a=i.toLowerCase();return n.indexOf(a)!==-1}))};function qe(e,t){return e.indexOf(t)!==-1}var ff=function(e){return e.trim()},$m=function(e){return e.replace(/^\$/,"")};function y5(e){var t,n=[];return(t=JSON.stringify(e,(function(i,a){if(typeof a=="bigint")return a.toString();if(typeof a!="function"&&typeof a!="symbol"){if(a instanceof Error)return{name:a.name,message:a.message,stack:a.stack};if(a&&typeof a=="object"){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(a))return"[Circular]";n.push(a)}return a}})))!==null&&t!==void 0?t:"null"}var _5=Object.prototype,w5=_5.hasOwnProperty,hf=_5.toString,Ge=Array.isArray||function(e){return hf.call(e)==="[object Array]"},Gr=e=>typeof e=="function",It=e=>e===Object(e)&&!Ge(e),js=e=>{if(It(e)){for(var t in e)if(w5.call(e,t))return!1;return!0}return!1},_e=e=>e===void 0,Mt=e=>hf.call(e)=="[object String]",Fm=e=>Mt(e)&&e.trim().length===0,In=e=>e===null,We=e=>_e(e)||In(e),Cn=e=>hf.call(e)=="[object Number]"&&e==e,zi=e=>Cn(e)&&e>0,Wr=e=>hf.call(e)==="[object Boolean]",k3=e=>e instanceof FormData,j3=e=>qe(y3,e),N3=e=>qe(_3,e);function S5(e){return e===null||typeof e!="object"}function Dd(e,t){return{}.toString.call(e)==="[object "+t+"]"}function $g(e){return typeof Event<"u"&&(function(t,n){try{return t instanceof n}catch{return!1}})(e,Event)}var C3=[!0,"true",1,"1","yes"],Rp=e=>qe(C3,e),E3=[!1,"false",0,"0","no"];function ci(e,t,n,i,a){return t>n&&(i.warn("min cannot be greater than max."),t=n),Cn(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: "+a),ci(a||n,t,n,i))}class T3{constructor(t){this.$e={},this.ze=t.ze,this.Ze=ci(t.bucketSize,0,100,t.Ge),this.Qe=ci(t.refillRate,0,this.Ze,t.Ge),this.Je=ci(t.refillInterval,0,864e5,t.Ge)}Ke(t,n){var i=Math.floor((n-t.lastAccess)/this.Je);i>0&&(t.tokens=Math.min(t.tokens+i*this.Qe,this.Ze),t.lastAccess=t.lastAccess+i*this.Je)}consumeRateLimit(t){var n,i=Date.now(),a=String(t),o=this.$e[a];return o?this.Ke(o,i):this.$e[a]=o={tokens:this.Ze,lastAccess:i},o.tokens===0||(o.tokens--,o.tokens===0&&((n=this.ze)==null||n.call(this,t)),o.tokens===0)}stop(){this.$e={}}}var mr="Mobile",zd="iOS",Hi="Android",Nl="Tablet",k5=Hi+" "+Nl,j5="iPad",N5="Apple",C5=N5+" Watch",ac="Safari",Cl="BlackBerry",E5="Samsung",T5=E5+"Browser",A5=E5+" Internet",ga="Chrome",A3=ga+" OS",M5=ga+" "+zd,Fg="Internet Explorer",R5=Fg+" "+mr,Ug="Opera",M3=Ug+" Mini",Hg="Edge",L5="Microsoft "+Hg,Sl="Firefox",D5=Sl+" "+zd,bc="Nintendo",yc="PlayStation",kl="Xbox",z5=Hi+" "+mr,O5=mr+" "+ac,Zo="Windows",Um=Zo+" Phone",Gb="Nokia",Hm="Ouya",B5="Generic",R3=B5+" "+mr.toLowerCase(),P5=B5+" "+Nl.toLowerCase(),Im="Konqueror",$5="Oculus Browser",Od="Vivaldi",F5="Yandex",Bd="Whale",qm="DuckDuckGo",U5="Pale Moon",Pd="Waterfox",lc="Brave",H5="Google Search App",Wt="(\\d+(\\.\\d+)?)",Lp=new RegExp("Version/"+Wt),L3=new RegExp(kl,"i"),D3=new RegExp(yc+" \\w+","i"),z3=new RegExp(bc+" \\w+","i"),Ig=new RegExp(Cl+"|PlayBook|BB10","i"),O3={"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"},I5=function(e,t,n,i){t=t||"";var a=(function(o){return o!=null&&o.brave?lc:null})(n);return a||(i!=null&&i.detectGoogleSearchApp&&qe(e,"GSA/")?H5:qe(e," OPR/")&&qe(e,"Mini")?M3:qe(e," OPR/")?Ug:Ig.test(e)?Cl:qe(e,"IE"+mr)||qe(e,"WPDesktop")?R5:qe(e,"OculusBrowser")?$5:qe(e,T5)?A5:qe(e,Hg)||qe(e,"Edg/")?L5:qe(e,Od+"/")?Od:qe(e,"YaBrowser/")?F5:qe(e,Bd+"/")?Bd:qe(e,qm+"/")||qe(e,"Ddg/")?qm:qe(e,"FBIOS")?"Facebook "+mr:qe(e,"UCWEB")||qe(e,"UCBrowser")?"UC Browser":qe(e,"CriOS")?M5:qe(e,"CrMo")||qe(e,ga)?ga:qe(e,Hi)&&qe(e,ac)?z5:qe(e,"FxiOS")?D5:qe(e.toLowerCase(),Im.toLowerCase())?Im:qe(e,lc+"/")?lc:((o,u)=>u&&qe(u,N5)||(function(f){return qe(f,ac)&&!qe(f,ga)&&!qe(f,Hi)})(o))(e,t)?qe(e,mr)?O5:ac:qe(e,"PaleMoon/")?U5:qe(e,Pd+"/")?Pd:qe(e,Sl)?Sl:qe(e,"MSIE")||qe(e,"Trident/")?Fg:qe(e,"Gecko")?Sl:"")},B3={[R5]:[new RegExp("rv:"+Wt)],[L5]:[new RegExp(Hg+"?\\/"+Wt)],[ga]:[new RegExp("("+ga+"|CrMo)\\/"+Wt)],[M5]:[new RegExp("CriOS\\/"+Wt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Wt)],[ac]:[Lp],[O5]:[Lp],[Ug]:[new RegExp("(Opera|OPR)\\/"+Wt)],[Sl]:[new RegExp(Sl+"\\/"+Wt)],[D5]:[new RegExp("FxiOS\\/"+Wt)],[Im]:[new RegExp("Konqueror[:/]?"+Wt,"i")],[Cl]:[new RegExp(Cl+" "+Wt),Lp],[z5]:[new RegExp("android\\s"+Wt,"i")],[A5]:[new RegExp(T5+"\\/"+Wt)],[$5]:[new RegExp("OculusBrowser\\/"+Wt)],[Od]:[new RegExp(Od+"\\/"+Wt)],[F5]:[new RegExp("YaBrowser\\/"+Wt)],[Bd]:[new RegExp(Bd+"\\/"+Wt)],[lc]:[new RegExp(lc+"\\/"+Wt)],[qm]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Wt)],[U5]:[new RegExp("PaleMoon\\/"+Wt)],[Pd]:[new RegExp(Pd+"\\/"+Wt)],[H5]:[new RegExp("GSA\\/"+Wt)],[Fg]:[new RegExp("(rv:|MSIE )"+Wt)],Mozilla:[new RegExp("rv:"+Wt)]},P3=function(e,t,n,i){var a=I5(e,t,n,i),o=B3[a];if(_e(o))return null;for(var u=0;o.length>u;u++){var f=e.match(o[u]);if(f)return parseFloat(f[f.length-2])}return null},Yb=[[new RegExp(kl+"; "+kl+" (.*?)[);]","i"),e=>[kl,e&&e[1]||""]],[new RegExp(bc,"i"),[bc,""]],[new RegExp(yc,"i"),[yc,""]],[Ig,[Cl,""]],[new RegExp(Zo,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Um,""];if(new RegExp(mr).test(t)&&!/IEMobile\b/.test(t))return[Zo+" "+mr,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var i=O3[n[1]]||"";return/arm/i.test(t)&&(i="RT"),[Zo,i]}return[Zo,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[zd,[e[3],e[4],e[5]||"0"].join(".")]:[zd,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=_e(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/,[A3,""]],[/Linux|debian/i,["Linux",""]]],Wb=function(e){return z3.test(e)?bc:D3.test(e)?yc:L3.test(e)?kl:new RegExp(Hm,"i").test(e)?Hm:new RegExp("("+Um+"|WPDesktop)","i").test(e)?Um:/iPad/.test(e)?j5:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?C5:Ig.test(e)?Cl:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Gb,"i").test(e)?Gb:/(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(mr).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:k5:new RegExp("(pda|"+mr+")","i").test(e)?R3:new RegExp(Nl,"i").test(e)&&!new RegExp(Nl+" pc","i").test(e)?P5:""},$3=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Qb(e,t){return typeof(n=e)=="string"&&$3.test(n)?e:t();var n}function Es(e){return e&&e.split("#")[0]}function wd(e,t){var n=setTimeout(e,t);return n!=null&&n.unref&&(n==null||n.unref()),n}var F3=e=>e instanceof Error,q5={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}},U3=q5.info;function V5(e){if(Wr(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(Ge(e))return{arrayValue:{values:e.map((t=>V5(t)))}};try{return{stringValue:JSON.stringify(e)}}catch{return{stringValue:String(e)}}}function $d(e){var t=[];for(var n in e){var i=e[n];In(i)||_e(i)||t.push({key:n,value:V5(i)})}return t}function H3(e,t){var n=q5[e.level||"info"]||U3,i=n.text,a=n.number,o=String(Date.now())+"000000",u={};t.distinctId&&(u.posthogDistinctId=t.distinctId),t.sessionId&&(u.sessionId=t.sessionId),t.windowId&&(u["window.id"]=t.windowId),We(t.sessionStartTimestamp)||(u.sessionStartTimestamp=String(t.sessionStartTimestamp)),We(t.lastActivityTimestamp)||(u.lastActivityTimestamp=String(t.lastActivityTimestamp)),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=pe({},u,e.attributes||{}),h={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:a,severityText:i,body:{stringValue:e.body},attributes:$d(f)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),_e(e.trace_flags)||(h.flags=e.trace_flags),h}function G5(e,t,n){return pe({},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 Y5(e,t,n,i){return{resourceLogs:[{resource:{attributes:$d(t)},scopeLogs:[{scope:{name:n,version:i},logRecords:e}]}]}}let I3=class{constructor(e,t,n,i,a,o,u){var f;o===void 0&&(o=()=>Promise.resolve()),this._instance=e,this.Te=t,this.Ge=n,this.Ye=i,this.Xe=a,this.et=o,this.tt=u,this.rt=null,this.it=0,this.nt=0,this.st=0,this.ot=0,this.ut=!1,this.ht=t.maxBufferSize,this.dt=Math.max((f=t.maxQueueSize)!==null&&f!==void 0?f:t.maxBufferSize,t.maxBufferSize),this.ct=t.flushIntervalMs,this.vt=t.maxBatchRecordsPerPost,this.ft=t.rateCapWindowMs,this.yt=t.maxLogsPerInterval}reset(){this.bt(),this.rt=null,this.st=0,this.ot=0,this.ut=!1,this.it=0,this.nt=0,this.vt=this.Te.maxBatchRecordsPerPost}onReconnect(){this.nt=0,this._t()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&e!=null&&e.body){var t=this.wt(e);if(t!==null)if(t.body){if(this.xt()){var n={record:H3(t,this.Ye())};this.Xe((()=>this.kt(n)))}}else this.Ge.info("Log was rejected in beforeSend function")}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var n=Ge(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.Ge.info("Log was rejected in beforeSend function"),null;i=o}catch(u){return this.Ge.error("Error in beforeSend function for log:",u),null}return i}xt(){if(this.yt===void 0)return!0;var e=Date.now(),t=e-this.st;return this.ft>t&&t>=0||(this.st=e,this.ot=0,this.ut=!1),this.yt>this.ot?(this.ot++,!0):(this.ut||(this.Ge.warn("captureLog dropping logs: exceeded "+this.yt+" logs per "+this.ft+"ms"),this.ut=!0),!1)}flush(){var e=this;return tn((function*(){if(!e._instance.isDisabled)return e.rt||(e.rt=e.St().finally((()=>{e.rt=null}))),e.rt}))()}St(){var e=this;return tn((function*(){var t;e.bt();var n=(t=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];if(n.length!==0)for(var i=n.length,a=0;n.length>0&&i>a;){var o,u;e.it=0;var f=Math.min(n.length,e.vt),h=n.slice(0,f),p=Y5(h.map((x=>x.record)),e.Ct(),(o=e.tt)!==null&&o!==void 0?o:e._instance.getLibraryId(),e._instance.getLibraryVersion()),g=yield e._instance.Tt(p);if(g.kind==="too-large"&&h.length>1)e.vt=Math.max(1,Math.floor(h.length/2)),e.Ge.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+e.vt);else if(g.kind==="retry-later"||(g.kind==="too-large"?e.Ge.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."):g.kind==="ok"&&e.Te.maxBatchRecordsPerPost>e.vt&&(e.vt=Math.min(e.Te.maxBatchRecordsPerPost,e.vt+1)),yield e.It(h.length),n=(u=e._instance.getPersistedProperty(Bi.LogsQueue))!==null&&u!==void 0?u:[],a+=h.length,g.kind==="fatal"))throw g.error}}))()}It(e){var t=this;return tn((function*(){var n,i=Math.max(0,e-t.it),a=(n=t._instance.getPersistedProperty(Bi.LogsQueue))!==null&&n!==void 0?n:[];t._instance.setPersistedProperty(Bi.LogsQueue,a.slice(i)),yield t.et()}))()}Ct(){return G5(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion())}kt(e){var t;if(!this._instance.optedOut){var n=(t=this._instance.getPersistedProperty(Bi.LogsQueue))!==null&&t!==void 0?t:[];this.dt>n.length||(n.shift(),this.it++,this.Ge.info("Logs queue is full, dropping oldest record.")),n.push(e),this._instance.setPersistedProperty(Bi.LogsQueue,n),this.ht>n.length?this.Mt():this._t()}}Mt(e){e===void 0&&(e=this.ct),this.Et||(this.Et=wd((()=>{this.Et=void 0,this._t()}),e))}Rt(){var e=Math.min(Math.max(0,this.nt-1),6);return this.ct*Math.pow(2,e)}Pt(){var e=this._instance.getPersistedProperty(Bi.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return tn((function*(){t.bt();var n=t.flush().catch((()=>{}));e!==void 0?yield Promise.race([n,new Promise((i=>wd(i,e)))]):yield n}))()}flushWithTimeout(e){var t=this;return tn((function*(){var n=!1,i=t.flush(),a=new Promise((o=>wd((()=>{n=!0,o()}),e)));try{yield Promise.race([i,a])}finally{n&&i.catch((()=>{}))}}))()}_t(){this.flush().then((()=>{this.nt=0}),(e=>{this.nt++,this.Ge.error("PostHog logs flush failed:",e)})).finally((()=>{!this._instance.isDisabled&&this.Pt()&&this.Mt(this.Rt())}))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}};var Dp=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Xb(e){return String(e)+"000000"}function Kb(e,t,n,i){var a="";return i&&(a=Object.keys(i).sort().map((o=>JSON.stringify(o)+":"+JSON.stringify(i[o]))).join(",")),e+"\0"+t+"\0"+(n??"")+"\0"+a}let q3=class{constructor(e,t,n){this._instance=e,this.Te=t,this.Ge=n,this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.At=0}count(e,t,n){t===void 0&&(t=1),this.Nt({name:e,type:"count",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}gauge(e,t,n){this.Nt({name:e,type:"gauge",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}histogram(e,t,n){this.Nt({name:e,type:"histogram",value:t,unit:n==null?void 0:n.unit,attributes:n==null?void 0:n.attributes})}flush(){var e=this,t=this.rt,n=(function(){var a=tn((function*(){t&&(yield t.catch((()=>{}))),yield e.Dt()}));return function(){return a.apply(this,arguments)}})(),i=n().finally((()=>{this.rt===i&&(this.rt=null)}));return this.rt=i,i}drainWindow(){if(this.Ot.size===0)return null;var e=this.Ot;return this.Ot=new Map,this.Ft=!1,this.Lt=new Map,this.$t=new Set,this.qt(e)}reset(){this.At++,this.bt(),this.Ot=new Map,this.rt=null,this.Ft=!1,this.Lt=new Map,this.$t=new Set}Nt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.wt(e);if(t!==null)if(t.name&&typeof t.name=="string")if(typeof t.value=="number"&&Number.isFinite(t.value))if(t.type==="count"&&0>t.value)this.Ge.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{var n,i;try{n=t.attributes?pe({},t.attributes):void 0,i=Kb(t.type,t.name,t.unit,n)}catch(u){return void this.Ge.warn("Dropping metric '"+t.name+"': attributes could not be serialized",u)}var a=this.Ot.get(i);if(!a){if(!this.jt())return;a={name:t.name,type:t.type,unit:t.unit,attributes:n,windowStartMs:Date.now()},this.Ot.set(i,a)}var o=this.Lt.get(t.name);o===void 0?this.Lt.set(t.name,t.type):o===t.type||this.$t.has(t.name)||(this.$t.add(t.name),this.Ge.warn("Metric name '"+t.name+"' is already used as a "+o+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Ht(a,t.value),this.Mt()}else this.Ge.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.Ge.warn("Dropping metric with empty name")}}jt(){return this.Te.maxSeriesPerFlush>this.Ot.size||(this.Ft||(this.Ft=!0,this.Ge.warn("Metric series cap reached ("+this.Te.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ht(e,t){var n;switch(e.type){case"count":e.total=((n=e.total)!==null&&n!==void 0?n:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Dp.length+1).fill(0)});var i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[(function(a,o){for(var u=0;o.length>u;u++)if(o[u]>=a)return u;return o.length})(t,Dp)]+=1}}wt(e){var t=this.Te.beforeSend;if(!t)return e;var n=Ge(t)?t:[t],i=e;for(var a of n)try{var o=a(i);if(!o)return this.Ge.info("Metric was rejected in beforeSend function"),null;i=o}catch(u){return this.Ge.error("Error in beforeSend function for metric:",u),null}return i}Mt(){this.Et||(this.Et=wd((()=>{this.Et=void 0,this.flush().catch((e=>{this.Ge.error("Metrics flush failed:",e)}))}),this.Te.flushIntervalMs))}bt(){this.Et&&(clearTimeout(this.Et),this.Et=void 0)}Dt(){var e=this;return tn((function*(){if(e.Ot.size!==0){var t=e.Ot;e.Ot=new Map,e.Ft=!1,e.Lt=new Map,e.$t=new Set;var n=e.At,i=yield e._instance.Bt(e.qt(t));if(n===e.At)switch(i.kind){case"ok":return;case"retry-later":return e.Ut(t),void e.Mt();case"too-large":return void e.Ge.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.Ge.error("Failed to send metrics batch:",i.error)}}}))()}qt(e){return t=this.zt(e),n=(function(o,u,f){return pe({},o.resourceAttributes,{"service.name":o.serviceName||"unknown_service"},o.environment&&{"deployment.environment":o.environment},o.serviceVersion&&{"service.version":o.serviceVersion},{"telemetry.sdk.name":u,"telemetry.sdk.version":f})})(this.Te,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),a=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:$d(n)},scopeMetrics:[{scope:{name:i,version:a},metrics:t}]}]};var t,n,i,a}zt(e){var t=Xb(Date.now()),n=new Map;for(var i of e.values()){var a,o=Kb(i.type,i.name,i.unit,void 0),u=n.get(o);u||(u=pe({name:i.name},i.unit&&{unit:i.unit}),i.type==="count"?u.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:i.type==="gauge"?u.gauge={dataPoints:[]}:u.histogram={aggregationTemporality:1,dataPoints:[]},n.set(o,u));var f=$d((a=i.attributes)!==null&&a!==void 0?a:{}),h=Xb(i.windowStartMs);if(i.type==="count"){var p,g={attributes:f,startTimeUnixNano:h,timeUnixNano:t,asDouble:(p=i.total)!==null&&p!==void 0?p:0};u.sum.dataPoints.push(g)}else if(i.type==="gauge"){var x,b={attributes:f,timeUnixNano:t,asDouble:(x=i.last)!==null&&x!==void 0?x:0};u.gauge.dataPoints.push(b)}else i.hist&&u.histogram.dataPoints.push({attributes:f,startTimeUnixNano:h,timeUnixNano:t,count:i.hist.count,sum:i.hist.sum,min:i.hist.min,max:i.hist.max,bucketCounts:i.hist.bucketCounts,explicitBounds:Dp})}return Array.from(n.values())}Ut(e){var t,n;for(var i of e){var a=i[0],o=i[1],u=this.Ot.get(a);if(u)switch(u.windowStartMs=Math.min(u.windowStartMs,o.windowStartMs),u.type){case"count":u.total=((t=u.total)!==null&&t!==void 0?t:0)+((n=o.total)!==null&&n!==void 0?n:0);break;case"gauge":break;case"histogram":if(o.hist)if(u.hist){u.hist.count+=o.hist.count,u.hist.sum+=o.hist.sum,u.hist.min=Math.min(u.hist.min,o.hist.min),u.hist.max=Math.max(u.hist.max,o.hist.max);for(var f=0;u.hist.bucketCounts.length>f;f++)u.hist.bucketCounts[f]+=o.hist.bucketCounts[f]}else u.hist=o.hist}else this.jt()&&this.Ot.set(a,o)}}};var rd,Zb,zp;function V3(e){var t=globalThis._posthogChunkIds;if(t){var n=Object.keys(t);return zp&&n.length===Zb||(Zb=n.length,zp=n.reduce(((i,a)=>{rd||(rd={});var o=rd[a];if(o)i[o[0]]=o[1];else for(var u=e(a),f=u.length-1;f>=0;f--){var h=u[f],p=h==null?void 0:h.filename,g=t[a];if(p&&g){i[p]=g,rd[a]=[p,g];break}}return i}),{})),zp}}class G3{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"},a=this.buildCoercingContext(i,n,0).apply(t),o=this.buildParsingContext(n),u=this.parseStacktrace(a,o);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}modifyFrames(t){var n=this;return tn((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&Ge(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,a;return t.cause!=null&&(i=this.parseStacktrace(t.cause,n)),t.stack!=""&&t.stack!=null&&(a=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?n.skipFirstLines:0),n.chunkIdMap)),pe({},t,{cause:i,stack:a})}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 tn((function*(){var i=t;for(var a of n.modifiers)i=yield a(i);return i}))()}convertToExceptionList(t,n){var i,a,o,u={type:t.type,value:t.value,mechanism:{type:(i=n.type)!==null&&i!==void 0?i:"generic",handled:(a=n.handled)===null||a===void 0||a,synthetic:(o=t.synthetic)!==null&&o!==void 0&&o}};t.stack&&(u.stacktrace={type:"raw",frames:t.stack});var f=[u];return t.cause!=null&&f.push(...this.convertToExceptionList(t.cause,pe({},n,{handled:!0}))),f}buildParsingContext(t){var n;return{chunkIdMap:V3(this.stackParser),skipFirstLines:(n=t.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(t,n,i){i===void 0&&(i=0);var a=(o,u)=>{if(4>=u){var f=this.buildCoercingContext(t,n,u);return this.applyCoercers(o,f)}};return pe({},n,{syntheticException:i==0?n.syntheticException:void 0,mechanism:t,apply:o=>a(o,i),next:o=>a(o,i+1)})}}var El="?";function Vm(e,t,n,i,a){var o={platform:e,filename:t,function:n==="<anonymous>"?El:n,in_app:!0};return _e(i)||(o.lineno=i),_e(a)||(o.colno=a),o}var W5=(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]:El,n?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Y3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,W3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Q3=/\((\S*)(?::(\d+))(?::(\d+))\)/,X3=(e,t)=>{var n=Y3.exec(e);if(n)return Vm(t,n[1],El,+n[2],+n[3]);var i=W3.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){var a=Q3.exec(i[2]);a&&(i[2]=a[1],i[3]=a[2],i[4]=a[3])}var o=W5(i[1]||El,i[2]);return Vm(t,o[1],o[0],i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},K3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Z3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,J3=(e,t)=>{var n=K3.exec(e);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var i=Z3.exec(n[3]);i&&(n[1]=n[1]||"eval",n[3]=i[1],n[4]=i[2],n[5]="")}var a=n[3],o=n[1]||El,u=W5(o,a);return Vm(t,a=u[1],o=u[0],n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},Jb=/\(error: (.*)\)/;class eC{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,n){var i=Mt(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 Dd(t,"DOMException")}isDOMError(t){return Dd(t,"DOMError")}}class tC{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 nC{constructor(){}match(t){return Dd(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 rC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class iC{match(t){return typeof t=="string"}coerce(t,n){var i,a=this.getInfos(t),o=a[0],u=a[1];return{type:o??"Error",value:u??t,stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(t){var n="Error",i=t,a=t.match(rC);return a&&(n=a[1],i=a[2]),[n,i]}}var sC=["fatal","error","warning","log","info","debug"];function Q5(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 a=n.slice(0,i).join(", ");if(t>=a.length)return i===n.length?a:a.length>t?a.slice(0,t)+"...":a}return""}class aC{match(t){return typeof t=="object"&&t!==null}coerce(t,n){var i,a=this.getErrorPropertyFromObject(t);return a?n.apply(a):{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 $g(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: "+Q5(t)}isSeverityLevel(t){return Mt(t)&&!Fm(t)&&sC.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var n in t)if({}.hasOwnProperty.call(t,n)){var i=t[n];if(F3(i))return i}}getObjectClassName(t){try{var n=Object.getPrototypeOf(t);return n?n.constructor.name:void 0}catch{return}}}class lC{match(t){return $g(t)}coerce(t,n){var i,a=t.constructor.name;return{type:a,value:a+" captured as exception with keys: "+Q5(t),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class oC{match(t){return S5(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 cC{match(t){return Dd(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!$g(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,a=this.getUnhandledRejectionReason(t);return S5(a)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(a),stack:(i=n.syntheticException)==null?void 0:i.stack,synthetic:!0}:n.apply(a)}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 Fd="$message",Ud="$timestamp",uC=new Set([Fd,Ud]),Op={enabled:!0,max_bytes:32768};function Hd(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:Op.enabled,max_bytes:fC(e.max_bytes,Op.max_bytes)}:pe({},Op)}class dC{constructor(t){this.Vt=[],this.Wt=0,this.Te=Hd(t)}setConfig(t){this.Te=Hd(t),this.Zt()}add(t){var n=(function(a){var o;try{o=y5(a)}catch{return}try{var u=JSON.parse(o);if(!It(u))return;var f=u,h=f[Fd],p=f[Ud];return!Mt(h)||h.trim().length===0||!Mt(p)&&!Cn(p)?void 0:{step:f,json:o}}catch{return}})(t);if(n){var i=(function(a){if(typeof TextEncoder<"u")return new TextEncoder().encode(a).length;for(var o=encodeURIComponent(a),u=0,f=0;o.length>f;f++)o[f]==="%"?(u+=1,f+=2):u+=1;return u})(n.json);i>this.Te.max_bytes||(this.Vt.push({step:n.step,bytes:i}),this.Wt+=i,this.Zt())}}getAttachable(){return this.Vt.map((t=>t.step))}clear(){this.Vt=[],this.Wt=0}size(){return this.Vt.length}Zt(){for(;this.Wt>this.Te.max_bytes&&this.Vt.length>0;){var t=this.Vt.shift();t&&(this.Wt-=t.bytes)}}}function fC(e,t){if(!Cn(e)||e===1/0||e===-1/0)return t;var n=Math.floor(e);return 0>n?t:n}var X5=function(e,t){var n=(t===void 0?{}:t).debugEnabled,i={k(a){if(ie&&(St.DEBUG||ie.POSTHOG_DEBUG||n)&&!_e(ie.console)&&ie.console){for(var o=("__rrweb_original__"in ie.console[a])?ie.console[a].__rrweb_original__:ie.console[a],u=arguments.length,f=new Array(u>1?u-1:0),h=1;u>h;h++)f[h-1]=arguments[h];o(e,...f)}},debug(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("debug",...o)},info(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("log",...o)},warn(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("warn",...o)},error(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];i.k("error",...o)},critical(){for(var a=arguments.length,o=new Array(a),u=0;a>u;u++)o[u]=arguments[u];console.error(e,...o)},uninitializedWarning(a){i.error("You must initialize PostHog before calling "+a)},createLogger:(a,o)=>X5(e+" "+a,o)};return i},Se=X5("[PostHog.js]"),Vt=Se.createLogger,hC=Vt("[ExternalScriptsLoader]"),Bp=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return hC.warn(t+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var i=Ce==null?void 0:Ce.querySelectorAll("script");if(i){for(var a,o=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(a=o())return a.v}var f=()=>{if(!Ce)return n("document not found");var h=Ce.createElement("script");if(h.type="text/javascript",h.crossOrigin="anonymous",h.src=t,h.onload=x=>{h.__posthog_loading_callback_fired=!0,n(void 0,x)},h.onerror=x=>n(x),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")Ce.head.appendChild(h);else{var p,g=Ce.querySelectorAll("body > script");g.length>0?(p=g[0].parentNode)==null||p.insertBefore(h,g[0]):Ce.body.appendChild(h)}};Ce!=null&&Ce.body?f():Ce==null||Ce.addEventListener("DOMContentLoaded",f)};Oe.__PosthogExtensions__=Oe.__PosthogExtensions__||{},Oe.__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 a="/static/"+t+".js?v="+e.version;if(t==="toolbar"){var o=3e5;a=a+"&t="+Math.floor(Date.now()/o)*o}i=e.requestRouter.endpointFor("assets",a)}Bp(e,i,n)}else{var u=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");Bp(e,u,n)}},Oe.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var i=e.requestRouter.endpointFor("api",t);Bp(e,i,n)};St.DEBUG=!1,St.LIB_VERSION="1.407.4",St.LIB_NAME="web";var K5="$people_distinct_id",Id="$device_id",Pp="$device_model",Jo="__alias",ec="__timers",Gm="$autocapture_disabled_server_side",Ym="$heatmaps_enabled_server_side",Wm="$exception_capture_enabled_server_side",Qm="$error_tracking_suppression_rules",Xm="$error_tracking_capture_extension_exceptions",Km="$web_vitals_enabled_server_side",qg="$dead_clicks_enabled_server_side",Vg="$product_tours_enabled_server_side",Zm="$web_vitals_allowed_metrics",ma="$session_recording_remote_config",Z5="$replay_sample_rate",J5="$replay_override_sampling",ew="$replay_override_linked_flag",tw="$replay_override_url_trigger",nw="$replay_override_event_trigger",_l="$sesid",Gg="$session_is_sampled",pa="$enabled_feature_flags",Sd="$active_feature_flags",tc="$early_access_features",Jm="$feature_flag_details",kd="$feature_flag_payloads",eg="$feature_flag_request_id",qd="$minimal_flag_called_events",Oi="$override_feature_flags",xl="$override_feature_flag_payloads",ua="$stored_person_properties",da="$stored_group_properties",tg="$surveys",Vd="$surveys_loaded_at",ng="$surveys_activated",jd="$surveys_activated_session",nc="ph_product_tours",oc="$flag_call_reported",rg="$flag_call_reported_session_id",ig="$feature_flag_errors",_c="$feature_flag_evaluated_at",Vr="$user_state",sg="$client_session_props",ag="$capture_rate_limit",lg="$initial_campaign_params",og="$initial_referrer_info",Gd="$initial_person_info",Yd="$epp",id="$posthog_cookieless",rw="$cookieless_mode",iw="$sdk_debug_extensions_init_method",sw="$sdk_debug_extensions_init_time_ms",aw="$sdk_debug_recording_script_not_loaded",Yg="PostHog loadExternalDependency extension not found.",fa="on_reject",$i="always",ul="anonymous",dl="identified",cg="identified_only",Wd="visibilitychange",Qd="beforeunload",vl="$pageview",$p="$pageleave",Fp="$identify",ey="$groupidentify";function sd(e,t){Ge(e)&&e.forEach(t)}function Rt(e,t){if(!We(e))if(Ge(e))e.forEach(t);else if(k3(e))e.forEach(((i,a)=>t(i,a)));else for(var n in e)w5.call(e,n)&&t(e[n],n)}var $t=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 a of n)for(var o in a)a[o]!==void 0&&(e[o]=a[o]);return e};function Nd(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 ty=function(e){try{return e()}catch{return}},pC=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(a){Se.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Se.critical(a)}}},Wg=function(e){var t={};return Rt(e,(function(n,i){(Mt(n)&&n.length>0||Cn(n))&&(t[i]=n)})),t},mC=["herokuapp.com","vercel.app","netlify.app"];function gC(e){var t=e==null?void 0:e.hostname;if(!Mt(t))return!1;var n=t.split(".").slice(-2).join(".");for(var i of mC)if(n===i)return!1;return!0}function Qt(e,t,n,i){var a=i??{},o=a.capture,u=a.passive;e==null||e.addEventListener(t,n,{capture:o!==void 0&&o,passive:u===void 0||u})}function lw(e){return e.name==="ph_toolbar_internal"}var ow=e=>{if(Ce){try{for(var t=e+"=",n=Ce.cookie.split(";").filter((o=>o.length)),i=0;n.length>i;i++){for(var a=n[i];a.charAt(0)==" ";)a=a.substring(1,a.length);if(a.indexOf(t)===0)return decodeURIComponent(a.substring(t.length,a.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Cn(e)&&isFinite(e)&&Math.floor(e)===e});class Xd{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,i,a){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(i)||!Number.isInteger(a)||0>t||0>n||0>i||0>a||t>0xffffffffffff||n>4095||i>1073741823||a>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/256,o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=a>>>24,o[13]=a>>>16,o[14]=a>>>8,o[15]=a,new Xd(o)}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 Xd(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 xC{generate(){var t=this.generateOrAbort();if(!_e(t))return t;this.S=0;var n=this.generateOrAbort();if(_e(n))throw new Error("Could not generate UUID after timestamp reset");return n}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.C();else{if(this.S>=t+1e4)return;this.I++,this.I>4398046511103&&(this.S++,this.C())}return Xd.fromFieldsV7(this.S,Math.trunc(this.I/Math.pow(2,30)),this.I&Math.pow(2,30)-1,this.M.nextUint32())}C(){this.I=1024*this.M.nextUint32()+(1023&this.M.nextUint32())}constructor(){this.S=0,this.I=0,this.M=new vC}}var ny,cw=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};ie&&!_e(ie.crypto)&&crypto.getRandomValues&&(cw=e=>crypto.getRandomValues(e));class vC{nextUint32(){return this.R.length>this.O||(cw(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var Pi=()=>bC().toString(),bC=()=>(ny||(ny=new xC)).generate(),Bo="",yC=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fi={N:()=>!!Ce,D(e){Se.error("cookieStore error: "+e)},A:ow,F(e){var t;try{t=JSON.parse(Fi.A(e))||{}}catch{}return t},q(e,t,n,i,a){if(!Ce)return!1;try{var o="",u="",f=(function(g,x){if(x){var b=(function(_,j){if(j===void 0&&(j=Ce),Bo)return Bo;if(!j||["localhost","127.0.0.1"].includes(_))return"";for(var N=_.split("."),k=Math.min(N.length,8),A="dmn_chk_"+Pi();!Bo&&k--;){var C=N.slice(k).join("."),L=A+"=1;domain=."+C+";path=/";j.cookie=L+";max-age=3",j.cookie.includes(A)&&(j.cookie=L+";max-age=0",Bo=C)}return Bo})(g);if(!b){var y=(_=>{var j=_.match(yC);return j?j[0]:""})(g);y!==b&&Se.info("Warning: cookie subdomain discovery mismatch",y,b),b=y}return b?"; domain=."+b:""}return""})(Ce.location.hostname,i);if(n){var h=new Date;h.setTime(h.getTime()+864e5*n),o="; expires="+h.toUTCString()}a&&(u="; secure");var p=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+f+u;return p.length>3686.4&&Se.warn("cookieStore warning: large cookie, len="+p.length),Ce.cookie=p,!0}catch{return!1}},P(e,t){if(Ce!=null&&Ce.cookie)try{Fi.q(e,"",-1,t)}catch{return}}},Up=null,zt={N(){if(!In(Up))return Up;var e=!0;if(_e(ie))e=!1;else try{var t="__mplssupport__";zt.q(t,"xyz"),zt.A(t)!=='"xyz"'&&(e=!1),zt.P(t)}catch{e=!1}return e||Se.error("localStorage unsupported; falling back to cookie store"),Up=e,e},D(e){Se.error("localStorage error: "+e)},A(e){try{return ie==null?void 0:ie.localStorage.getItem(e)}catch(t){zt.D(t)}return null},F(e){try{return JSON.parse(zt.A(e))||{}}catch{}return null},q(e,t){try{return ie==null||ie.localStorage.setItem(e,JSON.stringify(t)),!0}catch(n){zt.D(n)}return!1},P(e){try{ie==null||ie.localStorage.removeItem(e)}catch(t){zt.D(t)}}},_C=[Id,"distinct_id",_l,Gg,Yd,Gd,Vr],ad={},wC={N:()=>!0,D(e){Se.error("memoryStorage error: "+e)},A:e=>ad[e]||null,F:e=>ad[e]||null,q:(e,t)=>(ad[e]=t,!0),P(e){delete ad[e]}},ra=null,Nn={N(){if(!In(ra))return ra;if(ra=!0,_e(ie))ra=!1;else try{var e="__support__";Nn.q(e,"xyz"),Nn.A(e)!=='"xyz"'&&(ra=!1),Nn.P(e)}catch{ra=!1}return ra},D(e){Se.error("sessionStorage error: ",e)},A(e){try{return ie==null?void 0:ie.sessionStorage.getItem(e)}catch(t){Nn.D(t)}return null},F(e){try{return JSON.parse(Nn.A(e))||null}catch{}return null},q(e,t){try{return ie==null||ie.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(n){Nn.D(n)}return!1},P(e){try{ie==null||ie.sessionStorage.removeItem(e)}catch(t){Nn.D(t)}}};class SC{constructor(t){this._instance=t}get Te(){return this._instance.config}get consent(){return this.Gt()?0:this.Qt}isOptedOut(){return this.Te.cookieless_mode===$i||this.isRejected()||this.consent===-1&&this.Te.cookieless_mode===fa}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Te.opt_out_capturing_by_default}optInOut(t){this.Jt.q(this.Kt,t?1:0,this.Te.cookie_expiration,this.Te.cross_subdomain_cookie,this.Te.secure_cookie)}reset(){this.Jt.P(this.Kt,this.Te.cross_subdomain_cookie)}get Kt(){var t=this._instance.config,n=t.token,i=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(i?i+n:"__ph_opt_in_out_"+n)}get Qt(){var t=this.Jt.A(this.Kt);return Rp(t)?1:qe(E3,t)?0:-1}get Jt(){var t=this.Te.opt_out_capturing_persistence_type,n=t==="localStorage"?zt:Fi;if(!this.Yt||this.Yt!==n){this.Yt=n;var i=t==="localStorage"?Fi:zt;i.A(this.Kt)&&(this.Yt.A(this.Kt)||this.optInOut(Rp(i.A(this.Kt))),i.P(this.Kt,this.Te.cross_subdomain_cookie))}return this.Yt}Gt(){return!!this.Te.respect_dnt&&[Hn==null?void 0:Hn.doNotTrack,Hn==null?void 0:Hn.msDoNotTrack,Oe.doNotTrack].some((t=>Rp(t)))}}function uw(e,t){var n,i=e==null||(n=e.config)==null?void 0:n.get_current_url;if(!Gr(i))return t;try{var a=i(t);return Mt(a)&&a?a:t}catch(o){return Se.error("Error in get_current_url, falling back to window.location.href",o),t}}var dw="__POSTHOG_TOOLBAR__",kC=1,jC=3,NC=11;function ry(e){return e instanceof Element&&(e.id===dw||!(e.closest==null||!e.closest(".toolbar-global-fade-container")))}function Ts(e){return!!e&&e.nodeType===kC}function pr(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function fw(e){return!!e&&e.nodeType===jC}function hw(e){return!!e&&e.nodeType===NC&&Ts(e.host)}var pw=1e3;function Qg(e){return e?ff(e).split(/\s+/):[]}function iy(e,t){var n=(function(i){var a,o=ie==null||(a=ie.location)==null?void 0:a.href;return _e(o)?void 0:uw(i,o)})(t);return!!(n&&e&&e.some((i=>n.match(i))))}function Kd(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 Qg(t)}function mw(e){return We(e)?null:ff(e).split(/(\s+)/).filter((t=>cc(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function wc(e){var t="";return dg(e)&&!bw(e)&&e.childNodes&&e.childNodes.length&&Rt(e.childNodes,(function(n){var i;fw(n)&&n.textContent&&(t+=(i=mw(n.textContent))!==null&&i!==void 0?i:"")})),ff(t)}function Hp(e){var t;return _e(e.target)?e.srcElement||null:(t=e.target)!=null&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var Xg=["a","button","form","input","select","textarea","label"];function ug(e,t){if(_e(t))return!0;var n,i=function(o){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}})(o,u))))return{v:!0}};for(var a of e)if(n=i(a))return n.v;return!1}function gw(e){var t=e.parentNode;return!(!t||!Ts(t))&&t}var CC=[".ph-no-autocapture","[data-ph-no-autocapture]"],xw=["next","previous","prev",">","<"],EC=[...xw,"+","-","−","–"],sy=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ay=[".ph-no-rageclick",".ph-no-capture"],TC=["","text","search","email","password","url","tel","number"];function ly(e,t){if(!ie||Kg(e))return!1;var n,i,a,o,u;if(Wr(t)?(n=!!t&&ay,i=void 0,a=!1):(n=(o=t==null?void 0:t.css_selector_ignorelist)!==null&&o!==void 0?o:ay,i=t==null?void 0:t.content_ignorelist,a=(u=t==null?void 0:t.ignore_text_selection)!==null&&u!==void 0&&u),n===!1||a&&(function(h){return!(!h||!Ts(h))&&(!!pr(h,"textarea")||(pr(h,"input")?qe(TC,(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 f=vw(e,!1).targetElementList;return!(function(h,p){if(h===!1||_e(h))return!1;var g;if(h===!0)g=xw;else{if(!Ge(h))return!1;if(h.length>10)return Se.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;g=h.map((x=>x.toLowerCase()))}return p.some((x=>{var b=x.safeText,y=x.ariaLabel;return g.some((_=>sy(b,_)||sy(y,_)))}))})(i,f.map((h=>{var p;return{safeText:wc(h).toLowerCase(),ariaLabel:((p=h.getAttribute("aria-label"))==null?void 0:p.toLowerCase().trim())||""}})))&&!ug(f,n)}var Kg=e=>!e||pr(e,"html")||!Ts(e),vw=(e,t)=>{if(!ie||Kg(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,i=[e],a=e;a.parentNode&&!pr(a,"body");)if(hw(a.parentNode))i.push(a.parentNode.host),a=a.parentNode.host;else{var o=gw(a);if(!o)break;if(t||Xg.indexOf(o.tagName.toLowerCase())>-1)n=!0;else try{var u=ie.getComputedStyle(o);u&&u.getPropertyValue("cursor")==="pointer"&&(n=!0)}catch{}i.push(o),a=o}return{parentIsUsefulElement:n,targetElementList:i}};function dg(e){for(var t=new Set,n=0,i=e;i.parentNode&&!pr(i,"body");i=i.parentNode){if(n++>=pw||t.has(i))return!1;t.add(i);var a=Kd(i);if(qe(a,"ph-sensitive")||qe(a,"ph-no-capture"))return!1}if(qe(Kd(e),"ph-include"))return!0;var o=e.type||"";if(Mt(o))switch(o.toLowerCase()){case"hidden":case"password":return!1}var u=e.name||e.id||"";return!Mt(u)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(u.replace(/[^a-zA-Z0-9]/g,""))}function bw(e){return!!(pr(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||pr(e,"select")||pr(e,"textarea")||e.getAttribute("contenteditable")==="true")}var yw="(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})",AC=new RegExp("^(?:"+yw+")$"),MC=new RegExp(yw),_w="\\d{3}-?\\d{2}-?\\d{4}",RC=new RegExp("^("+_w+")$"),LC=new RegExp("("+_w+")");function cc(e,t){return t===void 0&&(t=!0),!(We(e)||Mt(e)&&(e=ff(e),(t?AC:MC).test((e||"").replace(/[- ]/g,""))||(t?RC:LC).test(e)))}function oy(e){var t=wc(e);return cc(t=(t+" "+ww(e)).trim())?t:""}function ww(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 a=wc(n);t=(t+" "+a).trim(),n.childNodes&&n.childNodes.length&&(t=(t+" "+ww(n)).trim())}catch(o){Se.error("[AutoCapture]",o)}})),t}function cy(e){return e.replace(/"|\\"/g,'\\"')}function DC(e){var t=e.attr__class;if(t)return Ge(t)?t:Qg(t)}var ld=Vt("[Dead Clicks]"),zC=()=>!0,OC=e=>{var t,n=!((t=e.instance.persistence)==null||!t.get_property(qg)),i=e.instance.config.capture_dead_clicks;return Wr(i)?i:!!It(i)||n};class uy{get lazyLoadedDeadClicksAutocapture(){return this.Xt}constructor(t,n,i){this.instance=t,this.isEnabled=n,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var n=t.config;"captureDeadClicks"in n&&(this.instance.persistence&&this.instance.persistence.register({[qg]:n.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.er((()=>{this.tr()})):this.stop()}er(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture?t():(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(a=>{a?ld.error("failed to load script",a):t()}))}tr(){var t;if(Ce){if(!this.Xt&&(t=Oe.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture){var n=It(this.instance.config.capture_dead_clicks)?pe({},this.instance.config.capture_dead_clicks):{};n.__onCapture=this.onCapture,this.onCapture&&(n.capture_dead_swipes=!1),this.Xt=Oe.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.Xt.start(Ce),ld.info("starting...")}}else ld.error("`document` not found. Cannot start.")}stop(){this.Xt&&(this.Xt.stop(),this.Xt=void 0,ld.info("stopping..."))}}var Ip=Vt("[SegmentIntegration]"),Sw="posthog-js";function kw(e,t){var n=t===void 0?{}:t,i=n.organization,a=n.projectId,o=n.prefix,u=n.severityAllowList,f=u===void 0?["error"]:u,h=n.sendExceptionsToPostHog,p=h===void 0||h;return g=>{var x,b,y,_,j;if(f!=="*"&&!f.includes(g.level)||!e.__loaded)return g;g.tags||(g.tags={});var N=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());g.tags["PostHog Person URL"]=N,e.sessionRecordingStarted()&&(g.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var k,A=((x=g.exception)==null?void 0:x.values)||[],C=A.map((D=>pe({},D,{stacktrace:D.stacktrace?pe({},D.stacktrace,{type:"raw",frames:(D.stacktrace.frames||[]).map((z=>pe({},z,{platform:"web:javascript"})))}):void 0}))),L={$exception_message:((b=A[0])==null?void 0:b.value)||g.message,$exception_type:(y=A[0])==null?void 0:y.type,$exception_level:g.level,$exception_list:C,$sentry_event_id:g.event_id,$sentry_exception:g.exception,$sentry_exception_message:((_=A[0])==null?void 0:_.value)||g.message,$sentry_exception_type:(j=A[0])==null?void 0:j.type,$sentry_tags:g.tags};return i&&a&&(L.$sentry_url=(o||"https://sentry.io/organizations/")+i+"/issues/?project="+a+"&query="+g.event_id),p&&((k=e.exceptions)==null||k.sendExceptionEvent(L)),g}}class BC{constructor(t,n,i,a,o,u){this.name=Sw,this.setupOnce=function(f){f(kw(t,{organization:n,projectId:i,prefix:a,severityAllowList:o,sendExceptionsToPostHog:u==null||u}))}}}class dy{constructor(t){this.rr=(n,i,a)=>{a&&(a.noSessionId||a.activityTimeout||a.sessionPastMaximumLength||a.crossTabAdoption)&&(Se.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:a}),this.ir=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.nr()}nr(){var t;this.sr=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(this.rr)}destroy(){var t;(t=this.sr)==null||t.call(this),this.sr=void 0}doPageView(t,n){var i,a=this.ar(t,n);return this.ir={pathname:(i=ie==null?void 0:ie.location.pathname)!==null&&i!==void 0?i:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),a}doPageLeave(t){var n;return this.ar(t,(n=this.ir)==null?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this.ir)==null?void 0:t.pageViewId}}ar(t,n){var i=this.ir;if(!i)return{$pageview_id:n};var a={$pageview_id:n,$prev_pageview_id:i.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var u=o.maxScrollHeight,f=o.lastScrollY,h=o.maxScrollY,p=o.maxContentHeight,g=o.lastContentY,x=o.maxContentY;if(!(_e(u)||_e(f)||_e(h)||_e(p)||_e(g)||_e(x))){u=Math.ceil(u),f=Math.ceil(f),h=Math.ceil(h),p=Math.ceil(p),g=Math.ceil(g),x=Math.ceil(x);var b=u>1?ci(f/u,0,1,Se):1,y=u>1?ci(h/u,0,1,Se):1,_=p>1?ci(g/p,0,1,Se):1,j=p>1?ci(x/p,0,1,Se):1;a=$t(a,{$prev_pageview_last_scroll:f,$prev_pageview_last_scroll_percentage:b,$prev_pageview_max_scroll:h,$prev_pageview_max_scroll_percentage:y,$prev_pageview_last_content:g,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:x,$prev_pageview_max_content_percentage:j})}}return i.pathname&&(a.$prev_pageview_pathname=i.pathname),i.timestamp&&(a.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),a}}var qp=["flags","surveys"],PC={[K5]:{exposure:"hidden"},[Jo]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ec]:{exposure:"hidden"},[Gm]:{exposure:"event"},[Ym]:{exposure:"hidden"},[Wm]:{exposure:"event"},[Qm]:{exposure:"hidden"},[Xm]:{exposure:"event"},[Km]:{exposure:"event"},[qg]:{exposure:"event"},[Vg]:{exposure:"hidden"},[Zm]:{exposure:"event"},[ma]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[_l]:{exposure:"hidden"},[Gg]:{exposure:"event"},[Z5]:{exposure:"event",shouldSkipFromEventProperties:e=>In(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"},[pa]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!It(e))return{};for(var t={},n=Object.keys(e),i=0;n.length>i;i++)t["$feature/"+n[i]]=e[n[i]];return t}},[Sd]:{exposure:"event",storageGroup:"flags"},[tc]:{exposure:"hidden"},[Jm]:{exposure:"hidden",storageGroup:"flags"},[kd]:{exposure:"event",storageGroup:"flags"},[eg]:{exposure:"event",storageGroup:"flags",volatile:!0},[qd]:{exposure:"hidden",storageGroup:"flags"},[Oi]:{exposure:"event"},[xl]:{exposure:"hidden"},[ua]:{exposure:"hidden"},[da]:{exposure:"hidden"},[tg]:{exposure:"hidden",storageGroup:"surveys"},[Vd]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ng]:{exposure:"event"},[jd]:{exposure:"hidden"},[nc]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[oc]:{exposure:"hidden"},[rg]:{exposure:"hidden"},[ig]:{exposure:"hidden"},[_c]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Vr]:{exposure:"hidden"},[sg]:{exposure:"hidden"},[ag]:{exposure:"hidden"},[lg]:{exposure:"hidden"},[og]:{exposure:"hidden"},[Gd]:{exposure:"hidden"},[Yd]:{exposure:"hidden"},[J5]:{exposure:"event"},[ew]:{exposure:"event"},[tw]:{exposure:"event"},[nw]:{exposure:"event"},[iw]:{exposure:"event"},[sw]:{exposure:"event"},[aw]:{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"}},$C=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ia=e=>{var t=PC[e];if(t)return t;for(var n of $C){var i=n[1];if(e.indexOf(n[0])===0)return i}},wl=(e,t)=>{try{return JSON.stringify(e,((n,i)=>typeof i=="bigint"?i.toString():i),t)}catch{return y5(e)}},Zd=e=>{var t=Ce==null?void 0:Ce.createElement("a");return _e(t)?null:(t.href=e,t)},Tl=function(e,t){for(var n,i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),a=0;i.length>a;a++){var o=i[a].split("=");if(o[0]===t){n=o;break}}if(!Ge(n)||2>n.length)return"";var u=n[1];try{u=decodeURIComponent(u)}catch{Se.error("Skipping decoding for malformed query param: "+u)}return u.replace(/\+/g," ")},Sc=function(e,t,n){if(!e||!t||!t.length)return e;for(var i=e.split("#"),a=i[1],o=(i[0]||"").split("?"),u=o[1],f=o[0],h=(u||"").split("&"),p=[],g=0;h.length>g;g++){var x=h[g].split("=");Ge(x)&&(t.includes(x[0])?p.push(x[0]+"="+n):p.push(h[g]))}var b=f;return u!=null&&(b+="?"+p.join("&")),a!=null&&(b+="#"+a),b},Jd=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},jw=(e,t)=>e>=t&&x5(),Nw=(e,t,n,i)=>{if(e===0){if(x5()){var a=t+1;return a===n&&i(),a}return t}return 0},od="https?://(.*)",Al=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],FC=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Al],kc="<masked>",UC=["li_fat_id"];function Cw(e,t,n){if(!Ce)return{};var i,a=t?[...Al,...n||[]]:[],o=Ew(Sc(Ce.URL,a,kc),e),u=(i={},Rt(UC,(function(f){var h=ow(f);i[f]=h||null})),i);return $t(u,o)}function Ew(e,t){var n=FC.concat(t||[]),i={};return Rt(n,(function(a){var o=Tl(e,a);i[a]=o||null})),i}function Tw(e){var t=(function(o){return o?o.search(od+"google.([^/?]*)")===0?"google":o.search(od+"bing.com")===0?"bing":o.search(od+"yahoo.com")===0?"yahoo":o.search(od+"duckduckgo.com")===0?"duckduckgo":null:null})(e),n=t!="yahoo"?"q":"p",i={};if(!In(t)){i.$search_engine=t;var a=Ce?Tl(Ce.referrer,n):"";a.length&&(i.ph_keyword=a)}return i}function fy(){return navigator.language||navigator.userLanguage}var ef="$direct";function Aw(){return(Ce==null?void 0:Ce.referrer)||ef}function Mw(e,t,n){n===void 0&&(n=!1);var i=e?[...Al,...t||[]]:[],a=n?Es(an==null?void 0:an.href):an==null?void 0:an.href,o=a==null?void 0:a.substring(0,1e3);return{r:Aw().substring(0,1e3),u:o?Sc(o,i,kc):void 0}}function Rw(e,t){var n;t===void 0&&(t=!1);var i=e.r,a=e.u,o=t?Es(a):a,u={$referrer:i,$referring_domain:i==null?void 0:i==ef?ef:(n=Zd(i))==null?void 0:n.host};if(o){u.$current_url=o;var f=Zd(o);u.$host=f==null?void 0:f.host,u.$pathname=f==null?void 0:f.pathname;var h=Ew(o);$t(u,h)}if(i){var p=Tw(i);$t(u,p)}return u}function Lw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function HC(){try{return new Date().getTimezoneOffset()}catch{return}}var IC={flags:_c,surveys:Vd},qC=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],fl="main";class Vp{constructor(t,n,i){if(i===void 0&&(i=!0),this.lr={},this.ur=!1,this.hr=!1,this.Te=t,this.dr=i,this.props={},this.cr=!1,this.vr=(o=>{var u="";return o.token&&(u=o.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),o.persistence_name?"ph_"+o.persistence_name:"ph_"+u+"_posthog"})(t),this.Jt=this.pr(t),this.hr=this.gr(t),this.load(),t.debug&&Se.info("Persistence loaded",t.persistence,pe({},this.props)),this.update_config(t,t,n),this.save(),ie){var a=()=>this.flush();Qt(ie,"beforeunload",a,{capture:!1}),Qt(ie,"pagehide",a,{capture:!1})}}mr(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return Cn(n)&&n>0?n:0}isDisabled(){return!!this.yr}pr(t){qC.indexOf(t.persistence.toLowerCase())===-1&&(Se.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=[..._C,...u];return pe({},zt,{F(p){try{var g={};try{g=Fi.F(p)||{}}catch{}var x,b=JSON.parse(zt.A(p)||"{}");if(f){var y={};for(var _ in g){var j=g[_];In(j)||j===""||(y[_]=j)}x=$t(b,y)}else x=$t(g,b);return zt.q(p,x),x}catch{}return null},q(p,g,x,b,y,_){var j=zt.q(p,g,void 0,void 0,_);try{var N={};h.forEach((k=>{g[k]&&(N[k]=g[k])})),Object.keys(N).length&&Fi.q(p,N,x,b,y,_)}catch(k){zt.D(k)}return j},P(p,g){try{ie==null||ie.localStorage.removeItem(p),Fi.P(p,g)}catch(x){zt.D(x)}}})})(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),a=!1,o=t.persistence.toLowerCase();return o==="localstorage"&&zt.N()?(n=zt,a=!0):o==="localstorage+cookie"&&i.N()?(n=i,a=!0):o==="sessionstorage"&&Nn.N()?n=Nn:o==="memory"?n=wC:o==="cookie"?n=Fi:i.N()?(n=i,a=!0):n=Fi,this.ur=a,n}br(t){return this.vr+"__"+t}gr(t){return this.ur&&!!t.split_storage}_r(t){var n=t??this.Te.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var i=this.props[_c];return!i||typeof i!="number"||Date.now()-i>n}properties(){var t={};return Rt(this.props,((n,i)=>{var a=ia(i);if((a==null?void 0:a.exposure)==="derived"){if(a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,i===pa?()=>this._r():()=>!1))return;a.transformToEventProperties&&$t(t,a.transformToEventProperties(n))}else if(!a||a.exposure==="event"){if(a!=null&&a.shouldSkipFromEventProperties!=null&&a.shouldSkipFromEventProperties(n,(()=>!1)))return;t[i]=n}})),t}load(){if(!this.yr){var t=this.Jt.F(this.vr);t&&(this.props=$t({},t)),this.hr&&this.wr()}}wr(){for(var t of qp){var n=zt.F(this.br(t));if(n&&!js(n)){var i=this.kr(t);i.persisted=!0,this.Sr(t)||(i.fingerprint=this.Cr(n,t)),this.Tr(t,n)||$t(this.props,n)}}}Sr(t){return Object.keys(this.props).some((n=>{var i;return((i=ia(n))==null?void 0:i.storageGroup)===t}))}Tr(t,n){var i=IC[t];if(!i)return!1;var a=n[i],o=this.props[i];return Cn(a)&&Cn(o)&&o>a}refreshKey(t){var n;if(!this.yr){var i=this.hr?(n=ia(t))==null?void 0:n.storageGroup:void 0,a=i?zt.F(this.br(i)):this.Jt.F(this.vr);if(a&&t in a)this.Ir(t,a[t]);else{if(i){var o=this.Jt.F(this.vr);if(o&&t in o)return void this.Ir(t,o[t])}this.Mr(t)}}}save(){if(!this.yr){var t=this.mr();t>0?_e(this.Er)&&(this.Er=setTimeout((()=>{this.Er=void 0,this.Rr()}),t)):this.Rr()}}flush(){_e(this.Er)||(clearTimeout(this.Er),this.Er=void 0,this.Rr())}Rr(){this.yr||(this.hr?this.Pr():this.Or(this.Jt,this.vr,this.props,fl))}Pr(){var t=this.Fr(),n=t.main,i=t.groups;for(var a of(this.Or(this.Jt,this.vr,n,fl),qp)){var o,u=i[a];(!js(u)||(o=this.lr[a])!=null&&o.persisted)&&this.Or(zt,this.br(a),u,a)}}Fr(){var t={},n={flags:{},surveys:{}};return Rt(this.props,((i,a)=>{var o,u=(o=ia(a))==null?void 0:o.storageGroup;u?n[u][a]=i:t[a]=i})),{main:t,groups:n}}Cr(t,n){if(n===fl)return JSON.stringify(t)+"|"+this.Lr+"|"+this.$r+"|"+this.Ar;var i={};return Rt(t,((a,o)=>{var u;i[o]=(u=ia(o))!=null&&u.volatile?"__volatile__":a})),JSON.stringify(i)}Or(t,n,i,a){var o=this.kr(a);if(a===fl||o.dirty||_e(o.fingerprint)){var u;try{if((u=this.Cr(i,a))===o.fingerprint)return void(o.dirty=!1)}catch{u=void 0}t.q(n,i,this.Lr,this.$r,this.Ar,this.Te.debug)?(o.dirty=!1,a!==fl&&(o.persisted=!0),_e(u)||(o.fingerprint=u)):this.Te.debug&&Se.warn('failed to persist storage entry "'+n+'"; will retry on next save')}}remove(t){var n=(t===void 0?{}:t).keepGroupEntries,i=n!==void 0&&n;if(_e(this.Er)||(clearTimeout(this.Er),this.Er=void 0),this.Jt.P(this.vr,!1),this.Jt.P(this.vr,!0),!i&&this.dr)for(var a of qp)zt.P(this.br(a));i?delete this.lr[fl]:this.lr={}}clear(){this.remove(),this.props={}}register_once(t,n,i){if(It(t)){_e(n)&&(n="None"),this.Lr=_e(i)?this.Nr:i;var a=!1;if(Rt(t,((o,u)=>{this.props.hasOwnProperty(u)&&this.props[u]!==n||(this.Ir(u,o),a=!0)})),a)return this.save(),!0}return!1}register(t,n){if(It(t)){this.Lr=_e(n)?this.Nr:n;var i=!1;if(Rt(t,((a,o)=>{t.hasOwnProperty(o)&&this.props[o]!==a&&(this.Ir(o,a),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Mr(t),this.save())}update_campaign_params(){if(!this.cr){var t=Cw(this.Te.custom_campaign_params,this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties);js(Wg(t))||this.register(t),this.cr=!0}}update_search_keyword(){var t;this.register((t=Ce==null?void 0:Ce.referrer)?Tw(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Aw(),$referring_domain:Ce!=null&&Ce.referrer&&((t=Zd(Ce.referrer))==null?void 0:t.host)||ef},void 0)}set_initial_person_info(){this.props[lg]||this.props[og]||this.register_once({[Gd]:Mw(this.Te.mask_personal_data_properties,this.Te.custom_personal_data_properties,this.Te.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};Rt([og,lg],(a=>{var o=this.props[a];o&&Rt(o,(function(u,f){t["$initial_"+$m(f)]=u}))}));var n=this.props[Gd];if(n){var i=(function(a,o){o===void 0&&(o=!1);var u=Rw(a,o),f={};return Rt(u,(function(h,p){f["$initial_"+$m(p)]=h})),f})(n,this.Te.disable_capture_url_hashes);$t(t,i)}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.Nr=this.Lr=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 a=t.persistence!==n.persistence||!((h,p)=>{if(h.length!==p.length)return!1;var g=[...h].sort(),x=[...p].sort();return g.every(((b,y)=>b===x[y]))})(t.cookie_persisted_properties||[],n.cookie_persisted_properties||[]),o=a?this.pr(t):this.Jt,u=this.gr(t);if(a||u!==this.hr){var f=this.props;this.clear(),this.Jt=o,this.hr=u,this.props=f,this.save()}}set_disabled(t){this.yr=t,this.yr?this.remove():this.save()}set_cross_subdomain(t){t!==this.$r&&(this.$r=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Ar&&(this.Ar=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,n){var i=this.props[ec]||{};i[t]=n,this.Ir(ec,i),this.save()}remove_event_timer(t){var n=this.props[ec]||{},i=n[t];return _e(i)||(delete n[t],this.Ir(ec,n),this.save()),i}get_property(t){return this.props[t]}set_property(t,n){this.Ir(t,n),this.save()}Ir(t,n){var i;this.props[t]=n,(i=ia(t))!=null&&i.volatile||this.Dr(t)}Mr(t){delete this.props[t],this.Dr(t)}Dr(t){var n,i=(n=ia(t))==null?void 0:n.storageGroup;i&&(this.kr(i).dirty=!0)}kr(t){return this.lr[t]||(this.lr[t]={})}}var $n={GZipJS:"gzip-js",Base64:"base64"},Po={Activation:"events",Cancellation:"cancelEvents"},Gp={Popover:"popover",API:"api",Widget:"widget"},Ui={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Yp={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},fg={Popover:"popover",Inline:"inline"},VC={SHOWN:"product tour shown"},hy={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},py=Vt("[RateLimiter]");class GC{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((a=>{py.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void py.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.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,a;t===void 0&&(t=!1);var o=this.captureEventsBurstLimit,u=this.captureEventsPerSecond,f=new Date().getTime(),h=(n=(i=this.instance.persistence)==null?void 0:i.get_property(ag))!==null&&n!==void 0?n:{tokens:o,last:f};h.tokens+=(f-h.last)/1e3*u,h.last=f,h.tokens>o&&(h.tokens=o);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 "+o+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=p,(a=this.instance.persistence)==null||a.set_property(ag,h),{isRateLimited:p,remainingTokens:h.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var $o=Vt("[RemoteConfig]");class Dw{constructor(t){this._instance=t}get remoteConfig(){var t;return(t=Oe._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.config}qr(t){var n,i;(n=Oe.__PosthogExtensions__)!=null&&n.loadExternalDependency?(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}jr(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 $o.info("Using preloaded remote config",this.remoteConfig),this.Hr(this.remoteConfig),void this.Br();if(this._instance.Ur())return void $o.warn("Remote config is disabled. Falling back to local config.");this.qr((t=>{if(!t)return $o.info("No config found after loading remote JS config. Falling back to JSON."),void this.jr((n=>{this.Hr(n),this.Br()}));this.Hr(t),this.Br()}))}catch(t){$o.error("Error loading remote config",t)}}stop(){this.zr&&(clearInterval(this.zr),this.zr=void 0)}refresh(){!this._instance.Ur()&&Ce&&Ce.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Br(){var t;if(!this.zr){var n=(t=this._instance.config.remote_config_refresh_interval_ms)!==null&&t!==void 0?t:3e5;n!==0&&(this.zr=setInterval((()=>{this.refresh()}),n))}}Hr(t){var n;t||$o.error("Failed to fetch remote config from PostHog."),this._instance.Hr(t?{ok:!0,config:t}:{ok:!1}),(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 Or=Uint8Array,tr=Uint16Array,Ml=Uint32Array,Zg=new Or([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]),Jg=new Or([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]),my=new Or([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zw=function(e,t){for(var n=new tr(31),i=0;31>i;++i)n[i]=t+=1<<e[i-1];var a=new Ml(n[30]);for(i=1;30>i;++i)for(var o=n[i];n[i+1]>o;++o)a[o]=o-n[i]<<5|i;return[n,a]},Ow=zw(Zg,2),hg=Ow[1];Ow[0][28]=258,hg[258]=28;for(var gy=zw(Jg,0)[1],Bw=new tr(32768),qt=0;32768>qt;++qt){var hl=(43690&qt)>>>1|(21845&qt)<<1;Bw[qt]=((65280&(hl=(61680&(hl=(52428&hl)>>>2|(13107&hl)<<2))>>>4|(3855&hl)<<4))>>>8|(255&hl)<<8)>>>1}var uc=function(e,t,n){for(var i=e.length,a=0,o=new tr(t);i>a;++a)++o[e[a]-1];var u,f=new tr(t);for(a=0;t>a;++a)f[a]=f[a-1]+o[a-1]<<1;for(u=new tr(i),a=0;i>a;++a)u[a]=Bw[f[e[a]-1]++]>>>15-e[a];return u},va=new Or(288);for(qt=0;144>qt;++qt)va[qt]=8;for(qt=144;256>qt;++qt)va[qt]=9;for(qt=256;280>qt;++qt)va[qt]=7;for(qt=280;288>qt;++qt)va[qt]=8;var tf=new Or(32);for(qt=0;32>qt;++qt)tf[qt]=5;var YC=uc(va,9),WC=uc(tf,5),Pw=function(e){return(e/8>>0)+(7&e&&1)},$w=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var i=new(e instanceof tr?tr:e instanceof Ml?Ml:Or)(n-t);return i.set(e.subarray(t,n)),i},Ai=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8},Fo=function(e,t,n){var i=t/8>>0;e[i]|=n<<=7&t,e[i+1]|=n>>>8,e[i+2]|=n>>>16},Wp=function(e,t){for(var n=[],i=0;e.length>i;++i)e[i]&&n.push({s:i,f:e[i]});var a=n.length,o=n.slice();if(!a)return[new Or(0),0];if(a==1){var u=new Or(n[0].s+1);return u[n[0].s]=1,[u,1]}n.sort((function(D,z){return D.f-z.f})),n.push({s:-1,f:25001});var f=n[0],h=n[1],p=0,g=1,x=2;for(n[0]={s:-1,f:f.f+h.f,l:f,r:h};g!=a-1;)f=n[n[x].f>n[p].f?p++:x++],h=n[p!=g&&n[x].f>n[p].f?p++:x++],n[g++]={s:-1,f:f.f+h.f,l:f,r:h};var b=o[0].s;for(i=1;a>i;++i)o[i].s>b&&(b=o[i].s);var y=new tr(b+1),_=pg(n[g-1],y,0);if(_>t){i=0;var j=0,N=_-t,k=1<<N;for(o.sort((function(D,z){return y[z.s]-y[D.s]||D.f-z.f}));a>i;++i){var A=o[i].s;if(t>=y[A])break;j+=k-(1<<_-y[A]),y[A]=t}for(j>>>=N;j>0;){var C=o[i].s;t>y[C]?j-=1<<t-y[C]++-1:++i}for(;i>=0&&j;--i){var L=o[i].s;y[L]==t&&(--y[L],++j)}_=t}return[new Or(y),_]},pg=function(e,t,n){return e.s==-1?Math.max(pg(e.l,t,n+1),pg(e.r,t,n+1)):t[e.s]=n},xy=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new tr(++t),i=0,a=e[0],o=1,u=function(h){n[i++]=h},f=1;t>=f;++f)if(e[f]==a&&f!=t)++o;else{if(!a&&o>2){for(;o>138;o-=138)u(32754);o>2&&(u(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(u(a),--o;o>6;o-=6)u(8304);o>2&&(u(o-3<<5|8208),o=0)}for(;o--;)u(a);o=1,a=e[f]}return[n.subarray(0,i),t]},Uo=function(e,t){for(var n=0,i=0;t.length>i;++i)n+=e[i]*t[i];return n},mg=function(e,t,n){var i=n.length,a=Pw(t+2);e[a]=255&i,e[a+1]=i>>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var o=0;i>o;++o)e[a+o+4]=n[o];return 8*(a+4+i)},vy=function(e,t,n,i,a,o,u,f,h,p,g){Ai(t,g++,n),++a[256];for(var x=Wp(a,15),b=x[0],y=x[1],_=Wp(o,15),j=_[0],N=_[1],k=xy(b),A=k[0],C=k[1],L=xy(j),D=L[0],z=L[1],q=new tr(19),$=0;A.length>$;++$)q[31&A[$]]++;for($=0;D.length>$;++$)q[31&D[$]]++;for(var G=Wp(q,7),O=G[0],I=G[1],T=19;T>4&&!O[my[T-1]];--T);var ae,J,W,B,F=p+5<<3,Y=Uo(a,va)+Uo(o,tf)+u,xe=Uo(a,b)+Uo(o,j)+u+14+3*T+Uo(q,O)+(2*q[16]+3*q[17]+7*q[18]);if(Y>=F&&xe>=F)return mg(t,g,e.subarray(h,h+p));if(Ai(t,g,1+(Y>xe)),g+=2,Y>xe){ae=uc(b,y),J=b,W=uc(j,N),B=j;var R=uc(O,I);for(Ai(t,g,C-257),Ai(t,g+5,z-1),Ai(t,g+10,T-4),g+=14,$=0;T>$;++$)Ai(t,g+3*$,O[my[$]]);g+=3*T;for(var P=[A,D],Z=0;2>Z;++Z){var M=P[Z];for($=0;M.length>$;++$)Ai(t,g,R[de=31&M[$]]),g+=O[de],de>15&&(Ai(t,g,M[$]>>>5&127),g+=M[$]>>>12)}}else ae=YC,J=va,W=WC,B=tf;for($=0;f>$;++$)if(i[$]>255){var de;Fo(t,g,ae[257+(de=i[$]>>>18&31)]),g+=J[de+257],de>7&&(Ai(t,g,i[$]>>>23&31),g+=Zg[de]);var be=31&i[$];Fo(t,g,W[be]),g+=B[be],be>3&&(Fo(t,g,i[$]>>>5&8191),g+=Jg[be])}else Fo(t,g,ae[i[$]]),g+=J[i[$]];return Fo(t,g,ae[256]),g+J[256]},QC=new Ml([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),XC=(function(){for(var e=new Ml(256),t=0;256>t;++t){for(var n=t,i=9;--i;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e})(),Qp=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function KC(e,t){t===void 0&&(t={});var n=(function(){var x=4294967295;return{p(b){for(var y=x,_=0;b.length>_;++_)y=XC[255&y^b[_]]^y>>>8;x=y},d(){return 4294967295^x}}})(),i=e.length;n.p(e);var a,o,u,f,h,p=(f=10+((a=t).filename&&a.filename.length+1||0),h=8,(function(x,b,y,_,j,N){var k=x.length,A=new Or(_+k+5*(1+Math.floor(k/7e3))+j),C=A.subarray(_,A.length-j),L=0;if(!b||8>k)for(var D=0;k>=D;D+=65535){var z=D+65535;k>z?L=mg(C,L,x.subarray(D,z)):(C[D]=!0,L=mg(C,L,x.subarray(D,k)))}else{for(var q=QC[b-1],$=q>>>13,G=8191&q,O=(1<<y)-1,I=new tr(32768),T=new tr(O+1),ae=Math.ceil(y/3),J=2*ae,W=function(mt){return(x[mt]^x[mt+1]<<ae^x[mt+2]<<J)&O},B=new Ml(25e3),F=new tr(288),Y=new tr(32),xe=0,R=0,P=(D=0,0),Z=0,M=0;k>D;++D){var de=W(D),be=32767&D,je=T[de];if(I[be]=je,T[de]=be,D>=Z){var Re=k-D;if((xe>7e3||P>24576)&&Re>423){L=vy(x,C,0,B,F,Y,R,P,M,D-M,L),P=xe=R=0,M=D;for(var Le=0;286>Le;++Le)F[Le]=0;for(Le=0;30>Le;++Le)Y[Le]=0}var Be=2,Je=0,it=G,ht=be-je&32767;if(Re>2&&de==W(D-ht))for(var Xt=Math.min($,Re)-1,pt=Math.min(32767,D),yt=Math.min(258,Re);pt>=ht&&--it&&be!=je;){if(x[D+Be]==x[D+Be-ht]){for(var kt=0;yt>kt&&x[D+kt]==x[D+kt-ht];++kt);if(kt>Be){if(Be=kt,Je=ht,kt>Xt)break;var ge=Math.min(ht,kt-2),Fe=0;for(Le=0;ge>Le;++Le){var ct=D-ht+Le+32768&32767,mn=ct-I[ct]+32768&32767;mn>Fe&&(Fe=mn,je=ct)}}}ht+=(be=je)-(je=I[be])+32768&32767}if(Je){B[P++]=268435456|hg[Be]<<18|gy[Je];var ke=31&hg[Be],ze=31&gy[Je];R+=Zg[ke]+Jg[ze],++F[257+ke],++Y[ze],Z=D+Be,++xe}else B[P++]=x[D],++F[x[D]]}}L=vy(x,C,!0,B,F,Y,R,P,M,D-M,L)}return $w(A,0,_+Pw(L)+j)})(o=e,(u=t).level==null?6:u.level,u.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(o.length)))):12+u.mem,f,h)),g=p.length;return(function(x,b){var y=b.filename;if(x[0]=31,x[1]=139,x[2]=8,x[8]=2>b.level?4:b.level==9?2:0,x[9]=3,b.mtime!=0&&Qp(x,4,Math.floor(new Date(b.mtime||Date.now())/1e3)),y){x[3]=8;for(var _=0;y.length>=_;++_)x[_+10]=y.charCodeAt(_)}})(p,t),Qp(p,g-8,n.d()),Qp(p,g-4,i),p}var ZC=!!Om||!!Pg,Fw="text/plain",Cd=!1,Uw=(e,t)=>{var n=e.split("#"),i=n[1],a=n[0].split("?"),o=a[0],u=a[1];if(!u)return e;var f=u.split("&").filter((h=>h.split("=")[0]!==t)).join("&");return o+(f?"?"+f:"")+(i?"#"+i:"")},ex=function(e,t,n){var i;n===void 0&&(n=!0);var a=e.split("?"),o=a[0],u=a[1],f=pe({},t),h=(i=u==null?void 0:u.split("&").map((g=>{var x,b=g.split("="),y=b[0],_=n&&(x=f[y])!==null&&x!==void 0?x:b[1];return delete f[y],y+"="+_})))!==null&&i!==void 0?i:[],p=(function(g,x){var b,y;x===void 0&&(x="&");var _=[];return Rt(g,(function(j,N){_e(j)||_e(N)||N==="undefined"||(b=encodeURIComponent((k=>k instanceof File)(j)?j.name:j.toString()),y=encodeURIComponent(N),_[_.length]=y+"="+b)})),_.join(x)})(f);return p&&h.push(p),h.length>0?o+"?"+h.join("&"):o},Xp=e=>{if(e.Vr)return e.Vr;var t=e.data,n=e.compression;if(t){if(n===$n.GZipJS){var i=KC((function(f,h){var p=f.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(f);for(var g=new Or(f.length+(f.length>>>1)),x=0,b=function(N){g[x++]=N},y=0;p>y;++y){if(x+5>g.length){var _=new Or(x+8+(p-y<<1));_.set(g),g=_}var j=f.charCodeAt(y);128>j?b(j):2048>j?(b(192|j>>>6),b(128|63&j)):j>55295&&57344>j?(b(240|(j=65536+(1047552&j)|1023&f.charCodeAt(++y))>>>18),b(128|j>>>12&63),b(128|j>>>6&63),b(128|63&j)):(b(224|j>>>12),b(128|j>>>6&63),b(128|63&j))}return $w(g,0,x)})(wl(t)),{mtime:0});return{contentType:Fw,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(n===$n.Base64){var a=(function(f){return f&&btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,((h,p)=>String.fromCharCode(parseInt(p,16)))))})(wl(t)),o=(f=>"data="+encodeURIComponent(typeof f=="string"?f:wl(f)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var u=wl(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Hw=e=>{var t,n,i=()=>e.transport==="sendBeacon"?{url:ex(e.url,{compression:$n.Base64}),encodedBody:Xp(pe({},e,{compression:$n.Base64,Vr:void 0}))}:{url:Uw(e.url,"compression"),encodedBody:Xp(pe({},e,{compression:void 0,Vr:void 0}))};try{t=Xp(e)}catch(a){if(Ib(e.compression,Tl(e.url,"compression")))return Se.error("Failed to gzip request body, sending uncompressed payload",a),i();throw a}return t&&Ib(e.compression,Tl(e.url,"compression"))&&!((n=t.body)instanceof ArrayBuffer?Bm(new Uint8Array(n)):ArrayBuffer.isView(n)&&Bm(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Cd=!0,i()):{url:e.url,encodedBody:t}},Iw=e=>{try{return Hw(e)}catch(t){return Se.error(t),void(e.callback==null||e.callback({statusCode:0,error:t}))}},JC=(function(){var e=tn((function*(t){var n=wl(t.data),i=yield(function(o,u,f){return Pm.apply(this,arguments)})(n,St.DEBUG,{rethrow:!0});if(!i)return t;var a=yield i.arrayBuffer();return pe({},t,{Vr:{contentType:Fw,body:a,estimatedSize:a.byteLength}})}));return function(t){return e.apply(this,arguments)}})(),e4=/Failed to fetch|NetworkError|Load failed/i,qw=e=>{var t=Iw(e);if(t){var n=t.url,i=t.encodedBody,a=i??{},o=a.contentType,u=a.body,f=a.estimatedSize,h=new Headers;Rt(e.headers,(function(_,j){h.append(j,_)})),o&&h.append("Content-Type",o);var p=null,g=!1;if(Bb){var x=new Bb;p={signal:x.signal,timeout:setTimeout((()=>{var _,j;g=!0,x.abort((_=e.timeout,(j=new Error("PostHog request timed out"+(_?" after "+_+"ms":""))).name="AbortError",j))}),e.timeout)}}var b=_=>{g&&(_==null?void 0:_.name)==="AbortError"||(j=>(j==null?void 0:j.name)==="TypeError"&&e4.test((j==null?void 0:j.message)||""))(_)?Se.warn(_):Se.error(_),e.callback==null||e.callback({statusCode:0,error:_})};try{var y;Pg(n,pe({method:(e==null?void 0:e.method)||"GET",headers:h,keepalive:e.method==="POST"&&!e.Wr&&52428.8>(f||0),body:u,signal:(y=p)==null?void 0:y.signal},e.fetchOptions)).then((_=>_.text().then((j=>{var N={statusCode:_.status,text:j};if(_.status===200)try{N.json=JSON.parse(j)}catch(k){Se.error(k)}e.callback==null||e.callback(N)})))).catch(b).finally((()=>p?clearTimeout(p.timeout):null))}catch(_){p&&clearTimeout(p.timeout),b(_)}}},gg=e=>{try{var t,n=Hw(e),i=n.url,a=n.encodedBody,o=a??{},u=o.body,f=o.estimatedSize;if(!u)return;var h=u instanceof Blob?u:new Blob([u],{type:o.contentType});if(Hn.sendBeacon(i,h))return;var p=Ge(e.data)?e.data:(t=e.data)==null?void 0:t.batch;if(Ge(p)&&p.length>1&&(f??0)>16384){var g=Math.ceil(p.length/2),x=b=>Ge(e.data)?b:pe({},e.data,{batch:b});return gg(pe({},e,{data:x(p.slice(0,g))})),void gg(pe({},e,{data:x(p.slice(g))}))}Se.warn("Beacon of ~"+(f??0)+" bytes was rejected by the browser, falling back to fetch"),qw(pe({},e,{Wr:!0}))}catch(b){Se.warn("Beacon send failed",b)}},by=(e,t,n,i)=>{var a=i==="query"?t==="POST"?"sent_at":"_":void 0;return ex(n===$n.GZipJS?Uw(e,"compression"):e,pe({},a?{[a]:Date.now().toString()}:{},n===$n.GZipJS?{}:{compression:n}))},Ed=[];Pg&&Ed.push({transport:"fetch",method:qw}),Om&&Ed.push({transport:"XHR",method(e){var t=Iw(e);if(t){var n=new Om,i=t.encodedBody;n.open(e.method||"GET",t.url,!0);var a=i??{},o=a.contentType,u=a.body;Rt(e.headers,(function(f,h){n.setRequestHeader(h,f)})),o&&n.setRequestHeader("Content-Type",o),e.timeout&&(n.timeout=e.timeout),n.onreadystatechange=()=>{if(n.readyState===4){var f={statusCode:n.status,text:n.responseText};if(n.status===200)try{f.json=JSON.parse(n.responseText)}catch{}e.callback==null||e.callback(f)}},n.send(u)}}}),Hn!=null&&Hn.sendBeacon&&Ed.push({transport:"sendBeacon",method:gg});var xg=3e3;class t4{constructor(t,n){this.Zr=!0,this.Gr=[],this.Qr=ci((n==null?void 0:n.flush_interval_ms)||xg,250,5e3,Se.createLogger("flush interval"),xg),this.Jr=t}enqueue(t){this.Gr.push(t),this.Kr||this.Yr()}unload(){this.Xr();var t=this.Gr.length>0?this.ei():{},n=Object.values(t);[...n.filter((i=>i.url.indexOf("/e")===0)),...n.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.ti(pe({},i,{transport:"sendBeacon"}))}))}enable(){this.Zr=!1,this.Yr()}Yr(){var t=this;this.Zr||(this.Kr=setTimeout((()=>{if(this.Xr(),this.Gr.length>0){var n=this.ei(),i=function(){var o=n[a],u=new Date().getTime();o.data&&Ge(o.data)&&Rt(o.data,(f=>{f.offset=Math.abs(f.timestamp-u),delete f.timestamp})),t.ti(o)};for(var a in n)i()}}),this.Qr))}ti(t){try{this.Jr(t)}catch(n){Se.error(n)}}Xr(){clearTimeout(this.Kr),this.Kr=void 0}ei(){var t={};return Rt(this.Gr,(n=>{var i,a=n,o=(a?a.batchKey:null)||a.url;_e(t[o])&&(t[o]=pe({},a,{data:[]})),(i=t[o].data)==null||i.push(a.data)})),this.Gr=[],t}}var n4=["retriesPerformedSoFar"];class r4{constructor(t){this.ri=!1,this.ii=3e3,this.Gr=[],this._instance=t,this.Gr=[],this.ni=!0,!_e(ie)&&"onLine"in ie.navigator&&(this.ni=ie.navigator.onLine,this.si=()=>{this.ni=!0,this.oi()},this.ai=()=>{this.ni=!1},Qt(ie,"online",this.si),Qt(ie,"offline",this.ai))}get length(){return this.Gr.length}retriableRequest(t){var n=t.retriesPerformedSoFar,i=v5(t,n4);zi(n)&&(i.url=ex(i.url,{retry_count:n})),this._instance._send_request(pe({},i,{callback:a=>{if(a.statusCode!==200&&(400>a.statusCode||a.statusCode>=500)){if((a.statusCode===0?3:10)>(n??0))return void this.kt(pe({retriesPerformedSoFar:n},i));a.statusCode===0&&Se.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(a)}}))}kt(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),a=Date.now()+i;this.Gr.push({retryAt:a,requestOptions:t});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),Se.warn(o),this.ri||(this.ri=!0,this.li())}li(){if(this.ui&&clearTimeout(this.ui),this.Gr.length===0)return this.ri=!1,void(this.ui=void 0);this.ui=setTimeout((()=>{this.ni&&this.Gr.length>0&&this.oi(),this.li()}),this.ii)}oi(){var t=Date.now(),n=[],i=this.Gr.filter((o=>t>o.retryAt||(n.push(o),!1)));if(this.Gr=n,i.length>0)for(var a of i)this.retriableRequest(a.requestOptions)}unload(){for(var t of(this.ui&&(clearTimeout(this.ui),this.ui=void 0),this.ri=!1,_e(ie)||(this.si&&(ie.removeEventListener("online",this.si),this.si=void 0),this.ai&&(ie.removeEventListener("offline",this.ai),this.ai=void 0)),this.Gr)){var n=t.requestOptions;try{this._instance._send_request(pe({},n,{transport:"sendBeacon"}))}catch(i){Se.error(i)}}this.Gr=[]}}class i4{constructor(t){this.hi=()=>{var n,i,a,o;this.di||(this.di={});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.di.lastScrollY=Math.ceil(f),this.di.maxScrollY=Math.max(f,(n=this.di.maxScrollY)!==null&&n!==void 0?n:0),this.di.maxScrollHeight=Math.max(h,(i=this.di.maxScrollHeight)!==null&&i!==void 0?i:0),this.di.lastContentY=p,this.di.maxContentY=Math.max(p,(a=this.di.maxContentY)!==null&&a!==void 0?a:0),this.di.maxContentHeight=Math.max(g,(o=this.di.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=t}get ci(){return this._instance.config.scroll_root_selector}getContext(){return this.di}resetContext(){var t=this.di;return setTimeout(this.hi,0),t}startMeasuringScrollPosition(){Qt(ie,"scroll",this.hi,{capture:!0}),Qt(ie,"scrollend",this.hi,{capture:!0}),Qt(ie,"resize",this.hi)}scrollElement(){if(!this.ci)return ie==null?void 0:ie.document.documentElement;var t=Ge(this.ci)?this.ci:[this.ci];for(var n of t){var i=ie==null?void 0:ie.document.querySelector(n);if(i)return i}}vi(t){var n=t==="y"?"scrollTop":"scrollLeft";if(this.ci){var i=this.scrollElement();return i&&i[n]||0}return ie?t==="y"?ie.scrollY||ie.pageYOffset||ie.document.documentElement.scrollTop||0:ie.scrollX||ie.pageXOffset||ie.document.documentElement.scrollLeft||0:0}scrollY(){return this.vi("y")}scrollX(){return this.vi("x")}}var s4=e=>Mw(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes);class yy{constructor(t,n,i,a){this.fi=o=>{var u=this.pi();if(!u||u.sessionId!==o){var f={sessionId:o,props:this.gi(this._instance)};this.mi.register({[sg]:f})}},this._instance=t,this.yi=n,this.mi=i,this.gi=a||s4,this.yi.onSessionId(this.fi)}pi(){return this.mi.props[sg]}getSetOnceProps(){var t,n=(t=this.pi())==null?void 0:t.props;return n?"r"in n?Rw(n,this._instance.config.disable_capture_url_hashes):{$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(Wg(this.getSetOnceProps()),((n,i)=>{i==="$current_url"&&(i="url"),t["$session_entry_"+$m(i)]=n})),t}}class tx{on(t,n){return this.bi[t]||(this.bi[t]=[]),this.bi[t].push(n),()=>{this.bi[t]=this.bi[t].filter((i=>i!==n))}}emit(t,n){for(var i of this.bi[t]||[])i(n);for(var a of this.bi["*"]||[])a(t,n)}constructor(){this.bi={}}}var Ho=Vt("[SessionId]");class _y{on(t,n){return this.wi.on(t,n)}constructor(t,n,i){var a;if(this.xi=null,this.ki=[],this.Si=void 0,this.Ci=!1,this.wi=new tx,this.Ti=(p,g)=>!(!zi(p)||!zi(g))&&Math.abs(p-g)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===$i)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Te=t.config,this.mi=t.persistence,this.Ii=void 0,this.Mi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ei=n||Pi,this.Ri=i||Pi;var o=this.Te.persistence_name||this.Te.token;if(this._sessionTimeoutMs=1e3*ci(this.Te.session_idle_timeout_seconds||1800,60,36e3,Ho.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Pi(),this.Oi="ph_"+o+"_window_id",this.Fi="ph_"+o+"_primary_window_exists",this.Li()){var u=Nn.F(this.Oi),f=Nn.F(this.Fi);u&&!f?this.Ii=u:Nn.P(this.Oi),Nn.q(this.Fi,!0)}if((a=this.Te.bootstrap)!=null&&a.sessionID)try{var h=(p=>{var g=this.Te.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.$i(this.Te.bootstrap.sessionID,new Date().getTime(),h)}catch(p){Ho.error("Invalid sessionID in bootstrap",p)}this.Ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _e(this.ki)&&(this.ki=[]),this.ki.push(t),this.Mi&&t(this.Mi,this.Ii),()=>{this.ki=this.ki.filter((n=>n!==t))}}Li(){return this.Te.persistence!=="memory"&&!this.mi.yr&&Nn.N()}Ni(t){t!==this.Ii&&(this.Ii=t,this.Li()&&Nn.q(this.Oi,t))}Di(){return this.Ii?this.Ii:this.Li()?Nn.F(this.Oi):null}qi(t){var n=this.xi;return!In(n)&&!In(t)&&5e3>Math.abs(t-n)}$i(t,n,i){var a=n!==this._sessionActivityTimestamp,o=!(t!==this.Mi||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=n,this.Mi=t,o&&!a||o&&this.qi(n)||(this.xi=n,this.mi.register({[_l]:[n,t,i]}))}ji(){var t,n=(t=this.Te)==null?void 0:t.persistence_save_debounce_ms;return zi(n)&&n>0}Hi(){this.ji()?this.mi.refreshKey(_l):(this.mi.flush(),this.mi.load())}Bi(){var t;if(!In(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.xi){this.Hi();var n=this.Ui();n[1]===this.Mi&&n[2]===this._sessionStartTimestamp&&(this.xi=this._sessionActivityTimestamp,this.mi.register({[_l]:[this._sessionActivityTimestamp,(t=this.Mi)!==null&&t!==void 0?t:null,this._sessionStartTimestamp]}),this.mi.flush())}}zi(){var t=this.Ui()[0],n=zi(t)?t:0,i=zi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(n,i)}Vi(t){return this.Hi(),this.Ti(t,this.zi())}Ui(){var t=this.mi.props[_l];return Ge(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.xi=null,clearTimeout(this.Wi),this.Wi=void 0,this.$i(null,null,null)}destroy(){this.Ci=!0,this.Bi(),clearTimeout(this.Wi),this.Wi=void 0,this.Si&&ie&&(ie.removeEventListener(Qd,this.Si,{capture:!1}),this.Si=void 0),this.ki=[]}Ai(){this.Si=()=>{this.Bi(),this.Li()&&Nn.P(this.Fi)},Qt(ie,Qd,this.Si,{capture:!1})}checkAndGetSessionAndWindowId(t,n){if(t===void 0&&(t=!1),n===void 0&&(n=null),this.Te.cookieless_mode===$i)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=n||new Date().getTime(),a=this.Ui(),o=a[1],u=a[2],f=this.zi(),h=this.Di(),p=zi(u)&&Math.abs(i-u)>864e5,g=!1,x=!1,b=!o,y=o,_=!b&&!t&&this.Ti(i,f);if(_){(_=this.Vi(i))||Ho.info("cross-tab refresh kept the session alive",{sessionId:o});var j=this.Ui();o=j[1],u=j[2]}b||_||p?(o=this.Ei(),h=this.Ri(),Ho.info("new session ID generated",{sessionId:o,windowId:h,changeReason:{noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p}}),u=i,g=!0):(h||(h=this.Ri(),g=!0),(x=o!==y)&&(Ho.info("adopted cross-tab session id",{sessionId:o,windowId:h}),g=!0));var N=zi(f)&&t&&!p?f:i,k=zi(u)?u:new Date().getTime();this.Ni(h),this.$i(o,N,k),t||this.Pi();var A={noSessionId:b,activityTimeout:_,sessionPastMaximumLength:p,crossTabAdoption:x};return g&&this.ki.forEach((C=>C(o,h,A))),{sessionId:o,windowId:h,sessionStartTimestamp:k,changeReason:g?A:void 0,lastActivityTimestamp:f}}Pi(){this.Ci||(clearTimeout(this.Wi),this.Wi=setTimeout((()=>{if(!this.Ci)if(this.Vi(new Date().getTime())){var t=this.Mi;this.resetSessionId(),this.wi.emit("forcedIdleReset",{idleSessionId:t})}else this.Pi()}),1.1*this.sessionTimeoutMs))}}var Vw=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Vb(n,t))return!0;try{var i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some((a=>Vb(a==null?void 0:a.brand,t))))return!0}catch{}return!!e.webdriver};function Gw(){return(Gw=tn((function*(){var e=Hn==null?void 0:Hn.userAgentData;if(e!=null&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),n=t==null?void 0:t.model;return Mt(n)&&n.length>0?n:void 0}catch(i){return void Se.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",i)}}))).apply(this,arguments)}var nf=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 wy(e,t,n){return wl({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}var Yw={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=>nf(n,i))))),not_regex:(e,t)=>t.every((n=>e.every((i=>!nf(n,i))))),icontains:(e,t)=>t.map(cd).some((n=>e.map(cd).some((i=>n.includes(i))))),not_icontains:(e,t)=>t.map(cd).every((n=>e.map(cd).every((i=>!n.includes(i))))),gt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i>parseFloat(a)))})),lt:(e,t)=>t.some((n=>{var i=parseFloat(n);return!isNaN(i)&&e.some((a=>i<parseFloat(a)))}))},cd=e=>e.toLowerCase();function Ww(e,t){return!e||Object.entries(e).every((n=>{var i=n[1],a=t==null?void 0:t[n[0]];if(_e(a)||In(a))return!1;var o=[String(a)],u=Yw[i.operator];return!!u&&u(i.values,o)}))}var vg="custom",Sy="i.posthog.com",a4=/^\/static\//;class l4{constructor(t){this.Zi={},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("."+Sy,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.Zi[this.apiHost]||(this.Zi[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":vg),this.Zi[this.apiHost]}Gi(t){if(a4.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.Gi(n);if(i)return""+i+n}if(this.region===vg)return this.apiHost+n;var a=Sy+n;switch(t){case"assets":return"https://"+this.region+"-assets."+a;case"api":return"https://"+this.region+"."+a}}}function Qw(e){var t;return!((t=e.conditions)==null||(t=t.events)==null||(t=t.values)==null||!t.length)}var Ct=Vt("[Surveys]"),Xw="seenSurvey_",Kw=e=>{try{var t=(n=>((i,a)=>""+Xw+(function(o){return o.current_iteration&&o.current_iteration>0?o.id+"_"+o.current_iteration:o.id})(a))(0,n))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(n){Ct.error("Failed to persist survey seen state",n)}},o4=[Gp.Popover,Gp.Widget,Gp.API],c4={ignoreConditions:!1,ignoreDelay:!1,displayType:fg.Popover},u4=Vt("[PostHog ExternalIntegrations]"),d4={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class f4{constructor(t){this._instance=t}er(t,n){var i;(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,t,(a=>{if(a)return u4.error("failed to load script",a);n()}))}startIfEnabledOrStop(){var t=this,n=function(){var o,u,f,h=i[0],p=i[1];!p||(o=Oe.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[h]||t.er(d4[h],(()=>{var g;(g=Oe.__PosthogExtensions__)==null||(g=g.integrations)==null||(g=g[h])==null||g.start(t._instance)})),!p&&(u=Oe.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[h]&&((f=Oe.__PosthogExtensions__)==null||(f=f.integrations)==null||(f=f[h])==null||f.stop())};for(var i of Object.entries((a=this._instance.config.integrations)!==null&&a!==void 0?a:{})){var a;n()}}}var dc={},Kp=0,rf=()=>{},ky='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Io="Surveys module not available",jy="sanitize_properties is deprecated. Use before_send instead",Zw="Invalid value for property_denylist config: ",h4=["token","distinct_id",rw],bl="posthog",Jw=!ZC&&(er==null?void 0:er.indexOf("MSIE"))===-1&&(er==null?void 0:er.indexOf("Mozilla"))===-1,Zp=e=>{var t;return pe({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:gC(Ce==null?void 0:Ce.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rf,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:an&&Mt(an==null?void 0:an.search)&&an.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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:(ie==null||(t=ie.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){Se.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:cg,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:xg},error_tracking:{},_onCapture:rf},(n=>({rageclick:n&&n>="2026-05-30"?{content_ignorelist:EC,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-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}: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),disable_capture_url_hashes:!(!n||"2026-06-25">n)}))(e))},p4=[["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"]],Ny=e=>{var t={};for(var n of p4){var i=n[0],a=n[1];_e(e[i])||(t[a]=e[i])}var o=$t({},t,e),u=e.__preview_external_dependency_versioned_paths;return _e(u)||(_e(e.strict_script_versioning)&&(o.strict_script_versioning=!!u),Mt(u)&&_e(e.asset_host)&&(o.asset_host=u)),Ge(e.property_blacklist)&&(_e(e.property_denylist)?o.property_denylist=e.property_blacklist:Ge(e.property_denylist)?o.property_denylist=[...e.property_blacklist,...e.property_denylist]:Se.error(Zw+e.property_denylist)),o};class m4{constructor(){this.__forceAllowLocalhost=!1}get Qi(){return this.__forceAllowLocalhost}set Qi(t){Se.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Dr{Ji(t,n){if(t){var i=this.Ki.indexOf(t);i!==-1&&this.Ki.splice(i,1)}return this.Ki.push(n),n.initialize==null||n.initialize(),n}Yi(){return this.config.cookieless_mode===$i||this.config.cookieless_mode===fa&&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 m4,this.Xi=!1,this.version=St.LIB_VERSION,this.en=new tx,this.Ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zp(),this.SentryIntegration=BC,this.sentryIntegration=i=>(function(a,o){var u=kw(a,o);return{name:Sw,processEvent:f=>u(f)}})(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tn=!1,this.rn=null,this.nn=null,this.sn=null,this.scrollManager=new i4(this),this.pageViewManager=new dy(this),this.rateLimiter=new GC(this),this.requestRouter=new l4(this),this.consent=new SC(this),this.externalIntegrations=new f4(this);var n=(t=Dr.__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.metrics=n.metrics&&new n.metrics(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(i,a,o)=>{var u=Mt(i)?{[i]:a}:i;this.setPersonProperties(u),o==null||o({})},set_once:(i,a,o)=>{var u=Mt(i)?{[i]:a}:i;this.setPersonProperties(void 0,u),o==null||o({})}},this.on("eventCaptured",(i=>Se.info('send "'+(i==null?void 0:i.event)+'"',i)))}init(t,n,i){if(i&&i!==bl){var a,o=(a=dc[i])!==null&&a!==void 0?a:new Dr;return o._init(t,n,i),dc[i]=o,dc[bl][i]=o,o}return this._init(t,n,i)}_init(t,n,i){var a,o;n===void 0&&(n={});var u=Mt(t)?t.trim():"";if(!u)return Se.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=Zp(n.defaults),n.debug=this.an(n.debug),this.ln=n,this.un=[],n.person_profiles?this.nn=n.person_profiles:n.process_person&&(this.nn=n.process_person);var f=Zp(n.defaults),h=Ny(n),p=$t({},f,h,{name:i,token:u});It(f.rageclick)&&It(h.rageclick)&&(p.rageclick=$t({},f.rageclick,h.rageclick)),It(f.session_recording)&&It(h.session_recording)&&(p.session_recording=$t({},f.session_recording,h.session_recording)),this.set_config(p),this.config.on_xhr_error&&Se.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:$n.GZipJS;var g=this.hn();this.persistence=new Vp(this.config,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Vp(pe({},this.config,{persistence:"sessionStorage"}),g,!1);var x=pe({},this.persistence.props),b=pe({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.dn=new t4((L=>this.cn(L)),this.config.request_queue_config),this.vn=new r4(this),this.__request_queue=[];var y=this.Yi();if(y||(this.sessionManager=new _y(this),this.sessionPropsManager=new yy(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Se.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.fn(y)}),0)):(Se.info("Initializing extensions synchronously"),this.fn(y)),St.DEBUG=St.DEBUG||this.config.debug,St.DEBUG&&Se.info("Starting in debug mode",{this:this,config:n,thisC:pe({},this.config),p:x,s:b}),!this.config.identity_distinct_id||(a=n.bootstrap)!=null&&a.distinctID||(n.bootstrap=pe({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((o=n.bootstrap)==null?void 0:o.distinctID)!==void 0){var _=n.bootstrap.distinctID,j=this.get_distinct_id(),N=this.persistence.get_property(Vr);if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&N===ul)this.identify(_);else if(n.bootstrap.isIdentifiedID&&j!=null&&j!==_&&N===dl)Se.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 k=this.config.get_device_id(Pi()),A=n.bootstrap.isIdentifiedID?k:_;this.persistence.set_property(Vr,n.bootstrap.isIdentifiedID?dl:ul),this.register({distinct_id:_,$device_id:A})}}if(y)this.register_once({distinct_id:id,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(Pi());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(Vr,ul)}return Qt(ie,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?(function(L,D){var z=L.config.segment;if(!z)return D();(function(q,$){var G=q.config.segment;if(!G)return $();var O=T=>{var ae=()=>T.anonymousId()||Pi();q.config.get_device_id=ae,T.id()&&(q.register({distinct_id:T.id(),$device_id:ae()}),q.persistence.set_property(Vr,dl)),$()},I=G.user();"then"in I&&Gr(I.then)?I.then(O):O(I)})(L,(()=>{z.register((q=>{typeof Promise<"u"&&Promise.resolve||Ip.warn("This browser does not have Promise support, and can not use the segment integration");var $=(G,O)=>{if(!O)return G;G.event.userId||G.event.anonymousId===q.get_distinct_id()||(Ip.info("No userId set, resetting PostHog"),q.reset()),G.event.userId&&G.event.userId!==q.get_distinct_id()&&(Ip.info("UserId set, identifying with PostHog"),q.identify(G.event.userId));var I=q.calculateEventProperties(O,G.event.properties);return G.event.properties=Object.assign({},I,G.event.properties),G};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:G=>$(G,G.event.event),page:G=>$(G,vl),identify:G=>$(G,Fp),screen:G=>$(G,"$screen")}})(L)).then((()=>{D()}))}))})(this,(()=>this.pn())):this.pn(),Gr(this.config._onCapture)&&this.config._onCapture!==rf&&(Se.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(L=>this.config._onCapture(L.event,L)))),this.config.ip&&Se.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.config.disableDeviceModel||(function(){return Gw.apply(this,arguments)})().then((L=>{L&&this.register({[Pp]:L})})).catch(rf),this}fn(t){var n,i,a,o,u,f,h,p,g=performance.now(),x=pe({},Dr.__defaultExtensionClasses,this.config.__extensionClasses),b=[];x.featureFlags&&this.Ki.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new x.featureFlags(this)),x.exceptions&&this.Ki.push(this.exceptions=(i=this.exceptions)!==null&&i!==void 0?i:new x.exceptions(this)),x.historyAutocapture&&this.Ki.push(this.historyAutocapture=new x.historyAutocapture(this)),x.tracingHeaders&&this.Ki.push(this.tracingHeaders=new x.tracingHeaders(this)),x.siteApps&&this.Ki.push(this.siteApps=new x.siteApps(this)),x.sessionRecording&&!t&&this.Ki.push(this.sessionRecording=new x.sessionRecording(this)),this.config.disable_scroll_properties||b.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),x.autocapture&&this.Ki.push(this.autocapture=new x.autocapture(this)),x.surveys&&this.Ki.push(this.surveys=(a=this.surveys)!==null&&a!==void 0?a:new x.surveys(this)),x.logs&&this.Ki.push(this.logs=(o=this.logs)!==null&&o!==void 0?o:new x.logs(this)),x.metrics&&this.Ki.push(this.metrics=(u=this.metrics)!==null&&u!==void 0?u:new x.metrics(this)),x.conversations&&this.Ki.push(this.conversations=(f=this.conversations)!==null&&f!==void 0?f:new x.conversations(this)),x.productTours&&this.Ki.push(this.productTours=new x.productTours(this)),x.heatmaps&&this.Ki.push(this.heatmaps=new x.heatmaps(this)),x.webVitalsAutocapture&&this.Ki.push(this.webVitalsAutocapture=new x.webVitalsAutocapture(this)),x.exceptionObserver&&this.Ki.push(this.exceptionObserver=new x.exceptionObserver(this)),x.deadClicksAutocapture&&this.Ki.push(this.deadClicksAutocapture=new x.deadClicksAutocapture(this,OC)),x.toolbar&&this.Ki.push(this.toolbar=(h=this.toolbar)!==null&&h!==void 0?h:new x.toolbar(this)),x.experiments&&this.Ki.push(this.experiments=(p=this.experiments)!==null&&p!==void 0?p:new x.experiments(this)),this.Ki.forEach((y=>{y.initialize&&b.push((()=>{y.initialize==null||y.initialize()}))})),b.push((()=>{if(this.gn){var y=this.gn;this.gn=void 0,this.Hr(y)}})),this.mn(b,g)}mn(t,n){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&t.length>0)return void setTimeout((()=>{this.mn(t,n)}),0);var i=t.shift();if(i)try{i()}catch(o){Se.error("Error initializing extension:",o)}}var a=Math.round(performance.now()-n);this.register_for_session({[iw]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[sw]:a}),this.config.__preview_deferred_init_extensions&&Se.info("PostHog extensions initialized ("+a+"ms)")}Hr(t){if(!Ce||!Ce.body)return Se.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Hr(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.gn=t),this.yn=t,this.compression=void 0,t.ok){var n,i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=qe(i.supportedCompression,$n.GZipJS)?$n.GZipJS:qe(i.supportedCompression,$n.Base64)?$n.Base64:void 0),(n=i.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.nn?this.nn:cg}),this.Ki.forEach((a=>a.onRemoteConfig==null?void 0:a.onRemoteConfig(t)))}pn(){try{this.config.loaded(this)}catch(i){Se.critical("`loaded` function failed",i)}if(this.bn(),this.config.internal_or_test_user_hostname&&an!=null&&an.hostname){var t=an.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.Yi())&&this._n()}),1),this.wn=new Dw(this),this.wn.load()}bn(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.dn)==null||t.enable())}_dom_loaded(){this.is_capturing()&&sd(this.__request_queue,(t=>this.cn(t))),this.__request_queue=[],this.bn()}_handle_unload(){var t,n,i,a,o;(t=this.surveys)==null||t.handlePageUnload==null||t.handlePageUnload(),(n=this.metrics)==null||n.flush("sendBeacon"),this.config.request_batching?(this.xn()&&this.capture($p),(i=this.logs)==null||i.flushLogs("sendBeacon"),(a=this.dn)==null||a.unload(),(o=this.vn)==null||o.unload()):this.xn()&&this.capture($p,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Jw?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.headers=pe({},this.config.request_headers,t.headers),t.compression=t.compression==="best-available"?this.compression:t.compression,(_e(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,a,o,u=pe({},n);u.timeout=u.timeout||6e4;var f,h,p,g,x,b=(i=u.transport)!==null&&i!==void 0?i:"fetch";b==="sendBeacon"&&_e(u.compression)&&u.data&&(u.compression=$n.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data={api_key:(h=(x=(g=Ge(f=u.data)?f:[f])[0])==null||(p=x.properties)==null?void 0:p.token)!==null&&h!==void 0?h:x==null?void 0:x.token,batch:g,sent_at:new Date().toISOString()}:u.timestampMode==="body"&&(u.data=(function(j,N){return N===void 0&&(N=new Date().toISOString()),Ge(j)?j.map((k=>pe({},k,{sent_at:N}))):pe({},j,{sent_at:N})})(u.data))),u.url=by(u.url,u.method,u.compression,u.timestampMode);var y=Ed.filter((j=>!u.disableTransport||!j.transport||!u.disableTransport.includes(j.transport))),_=(a=(o=(function(j,N){for(var k=0;j.length>k;k++)if(j[k].transport===b)return j[k]})(y))==null?void 0:o.method)!==null&&a!==void 0?a:y[0].method;if(!_)throw new Error("No available transport method");b!=="sendBeacon"&&u.data&&u.compression===$n.GZipJS&&v3&&typeof Promise<"u"&&!Cd?JC(u).then((j=>{_(j)})).catch((j=>{if(qb(j))return Cd=!0,void _(pe({},u,{compression:void 0,url:by(n.url,n.method,void 0,n.timestampMode)}));(N=>{if(!N||typeof N!="object")return!1;var k="name"in N?String(N.name):"";return qb(N)||k===b5})(j)&&(Cd=!0),_(u)})):_(u)})(pe({},t,{callback:n=>{var i,a;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(i=(a=this.config).on_request_error)==null||i.call(a,n),t.callback==null||t.callback(n)}}))):t.fireCallbackOnDrop&&(t.callback==null||t.callback({statusCode:0}))}cn(t){this.vn?this.vn.retriableRequest(t):this._send_request(t)}_execute_array(t){Kp++;try{var n,i=[],a=[],o=[];sd(t,(f=>{if(f)if(Ge(n=f[0]))o.push(f);else if(Gr(f))try{f.call(this)}catch(h){Se.error("Error executing queued PostHog call",f,h)}else Ge(f)&&n==="alias"?i.push(f):Ge(f)&&n.indexOf("capture")!==-1&&Gr(this[n])?o.push(f):a.push(f)}));var u=function(f,h){sd(f,(function(p){try{if(Ge(p[0])){var g=h;Rt(p,(function(x){g=g[x[0]].apply(g,x.slice(1))}))}else h[p[0]].apply(h,p.slice(1))}catch(x){Se.error("Error executing queued PostHog call",p,x)}}))};u(i,this),u(a,this),u(o,this)}finally{Kp--}}push(t){if(Kp>0&&Ge(t)&&Mt(t[0])){var n=Dr.prototype[t[0]];Gr(n)&&n.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,n,i){var a,o,u,f,h;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.dn){if(this.is_capturing())if(!_e(t)&&Mt(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&&!Mt(n==null?void 0:n.$current_url)&&(Se.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.kn||Se.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 x=new Date,b=(i==null?void 0:i.timestamp)||x,y=Qb(i==null?void 0:i.uuid,Pi),_={uuid:y,event:t,properties:this.calculateEventProperties(t,n||{},b,y)};t===vl&&this.config.__preview_capture_bot_pageviews&&p&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),g&&(_.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var j=t==="$feature_flag_called"&&_.properties.$feature_flag_has_experiment===!1&&this.get_property(qd)===!0;i!=null&&i.$set&&!j&&(_.$set=i==null?void 0:i.$set);var N=i==null?void 0:i.$unset;N&&(_.$unset=N);var k,A,C,L=j?void 0:this.Sn(i==null?void 0:i.$set_once,t!==ey,t===Fp);if(L&&(_.$set_once=L),i!=null&&i._noTruncate||(o=this.config.properties_string_max_length,u=_,f=T=>Mt(T)?T.slice(0,o):T,h=new Set,_=(function T(ae,J){if(ae!==Object(ae))return f?f(ae):ae;if(!h.has(ae)){var W;if(h.add(ae),Ge(ae))W=[],sd(ae,(F=>{W.push(T(F))}));else{var B={};Rt(ae,((F,Y)=>{h.has(F)||(B[Y]=T(F))})),W=B}return W}})(u)),_.timestamp=b,_e(i==null?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=x),j&&(_.properties=(function(T,ae){ae===void 0&&(ae=[]);var J={},W=B=>{T[B]!==void 0&&(J[B]=T[B])};return b3.forEach(W),ae.forEach(W),J})(_.properties,h4)),t===Ui.DISMISSED||t===Ui.SENT){var D=n==null?void 0:n[Yp.SURVEY_ID],z=n==null?void 0:n[Yp.SURVEY_ITERATION];Kw({id:D,current_iteration:z}),_.$set=pe({},_.$set,{[(k={id:D,current_iteration:z},A=t===Ui.SENT?"responded":"dismissed",C="$survey_"+A+"/"+k.id,k.current_iteration&&k.current_iteration>0&&(C="$survey_"+A+"/"+k.id+"/"+k.current_iteration),C)]:!0})}else t===Ui.SHOWN&&(_.$set=pe({},_.$set,{[Yp.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(t===VC.SHOWN){var q=n==null?void 0:n[hy.TOUR_TYPE];q&&(_.$set=pe({},_.$set,{[hy.TOUR_LAST_SEEN_DATE+"/"+q]:new Date().toISOString()}))}var $=pe({},_.properties.$set,_.$set);if(js($)||this.setPersonPropertiesForFlags($),!We(this.config.before_send)){var G=this.wt(_);if(!G)return;(_=G).uuid=Qb(_.uuid,Pi)}this.en.emit("eventCaptured",_);var O=(a=i==null?void 0:i._url)!==null&&a!==void 0?a:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),I={method:"POST",url:O,data:_,compression:"best-available",timestampMode:(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(O)?"body":"capture-body",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.cn(I):this.dn.enqueue(I),_}Se.critical("This capture call is ignored due to client rate limiting.")}}else Se.error("No event name provided to posthog.capture")}else Se.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(n=>t(n.event,n)))}calculateEventProperties(t,n,i,a,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return n;var u=o?void 0:this.persistence.remove_event_timer(t),f=pe({},n);if(f.token=this.config.token,f.$config_defaults=this.config.defaults,this.Yi()&&(f[rw]=!0),t==="$snapshot"){var h=pe({},this.persistence.properties(),this.sessionPersistence.properties());return f.distinct_id=h.distinct_id,(!Mt(f.distinct_id)&&!Cn(f.distinct_id)||Fm(f.distinct_id))&&Se.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),f}var p,g=(function(C,L,D,z){var q,$,G,O;if(z===void 0&&(z=!1),!er)return{};var I,T=C?[...Al,...L||[]]:[],ae=(function(Xt){for(var pt=0;Yb.length>pt;pt++){var yt=Yb[pt],kt=yt[1],ge=yt[0].exec(Xt),Fe=ge&&(Gr(kt)?kt(ge,Xt):kt);if(Fe)return Fe}return["",""]})(er),J=ae[0],W=ae[1],B=(I=typeof navigator<"u"?navigator:void 0)!=null&&I.brave?{brave:!0}:{},F={};_e(D)||(F.detectGoogleSearchApp=D);var Y={},xe=(q=navigator)==null||(q=q.userAgentData)==null?void 0:q.platform,R=($=navigator)==null?void 0:$.maxTouchPoints,P=ie==null||(G=ie.screen)==null?void 0:G.width,Z=ie==null||(O=ie.screen)==null?void 0:O.height,M=ie==null?void 0:ie.devicePixelRatio;_e(xe)||(Y.userAgentDataPlatform=xe),_e(R)||(Y.maxTouchPoints=R),_e(P)||(Y.screenWidth=P),_e(Z)||(Y.screenHeight=Z),_e(M)||(Y.devicePixelRatio=M);var de,be,je,Re,Le,Be,Je,it,ht=$t(Wg({$os:J,$os_version:W,$browser:I5(er,navigator.vendor,B,F),$device:Wb(er),$device_type:(be=er,je=Y,it=Wb(be),it===j5||it===k5||it==="Kobo"||it==="Kindle Fire"||it===P5?Nl:it===bc||it===kl||it===yc||it===Hm?"Console":it===C5?"Wearable":it?mr:(je==null?void 0:je.userAgentDataPlatform)==="Android"&&((Re=je==null?void 0:je.maxTouchPoints)!==null&&Re!==void 0?Re:0)>0?600>Math.min((Le=je==null?void 0:je.screenWidth)!==null&&Le!==void 0?Le:0,(Be=je==null?void 0:je.screenHeight)!==null&&Be!==void 0?Be:0)/((Je=je==null?void 0:je.devicePixelRatio)!==null&&Je!==void 0?Je:1)?mr:Nl:"Desktop"),$timezone:Lw(),$timezone_offset:HC()}),{$current_url:Sc(z?Es(an==null?void 0:an.href):an==null?void 0:an.href,T,kc),$host:an==null?void 0:an.host,$pathname:an==null?void 0:an.pathname,$raw_user_agent:er.length>1e3?er.substring(0,997)+"...":er,$browser_version:P3(er,navigator.vendor,B,F),$browser_language:fy(),$browser_language_prefix:(de=fy(),typeof de=="string"?de.split("-")[0]:void 0),$screen_height:ie==null?void 0:ie.screen.height,$screen_width:ie==null?void 0:ie.screen.width,$viewport_height:ie==null?void 0:ie.innerHeight,$viewport_width:ie==null?void 0:ie.innerWidth,$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return St.SDK_DIST_CHANNEL&&(ht.$sdk_dist_channel=St.SDK_DIST_CHANNEL),ht})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var x=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime()),b=x.windowId;f.$session_id=x.sessionId,f.$window_id=b}this.sessionPropsManager&&$t(f,this.sessionPropsManager.getSessionProps());try{var y;this.sessionRecording&&$t(f,this.sessionRecording.sdkDebugProperties),f.$sdk_debug_retry_queue_size=(y=this.vn)==null?void 0:y.length}catch(C){f.$sdk_debug_error_capturing_properties=String(C)}if(this.requestRouter.region===vg&&(f.$lib_custom_api_host=this.config.api_host),p=t!==vl||o?t!==$p||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,a),f=$t(f,p),t===vl&&Ce&&(f.title=Ce.title),!_e(u)){var _=i.getTime()-u;f.$duration=parseFloat((_/1e3).toFixed(3))}er&&this.config.opt_out_useragent_filter&&(f.$browser_type=this._is_bot()?"bot":"browser");var j=this.persistence.properties(),N=this.sessionPersistence.properties();Rt(["$referrer","$referring_domain"],(C=>{C in j&&delete N[C]})),(f=$t({},g,j,N,f)).$is_identified=this._isIdentified(),Ge(this.config.property_denylist)?Rt(this.config.property_denylist,(function(C){delete f[C]})):Se.error(Zw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Se.error(jy),f=k(f,t));var A=this.Cn();return f.$process_person_profile=A,A&&!o&&this.Tn("_calculate_event_properties"),f}Sn(t,n,i){var a;if(n===void 0&&(n=!0),i===void 0&&(i=!1),!this.persistence||!this.Cn()||this.Xi&&!i)return t;var o=this.persistence.get_initial_props(),u=(a=this.sessionPropsManager)==null?void 0:a.getSetOnceProps(),f=$t({},o,u||{},t||{}),h=this.config.sanitize_properties;return h&&(Se.error(jy),f=h(f,"$set_once")),n&&(this.Xi=!0),js(f)?void 0:f}register(t,n){var i;(i=this.persistence)==null||i.register(t,n)}register_once(t,n,i){var a;(a=this.persistence)==null||a.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)}In(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)}getAllFeatureFlags(){var t,n;return(t=(n=this.featureFlags)==null?void 0:n.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,n){var i,a;return(i=(a=this.featureFlags)==null?void 0:a.isFeatureEnabled(t,n))!==null&&i!==void 0?i:n==null?void 0:n.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)==null||t.reloadFeatureFlags()}updateFlags(t,n,i){var a;(a=this.featureFlags)==null||a.updateFlags(t,n,i)}updateEarlyAccessFeatureEnrollment(t,n,i){var a;(a=this.featureFlags)==null||a.updateEarlyAccessFeatureEnrollment(t,n,i)}getEarlyAccessFeatures(t,n,i){var a;return n===void 0&&(n=!1),(a=this.featureFlags)==null?void 0:a.getEarlyAccessFeatures(t,n,i)}on(t,n){return this.en.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:Io}),()=>{})}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:Io})}getActiveMatchingSurveys(t,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,n):t([],{isLoaded:!1,error:Io})}renderSurvey(t,n){var i;(i=this.surveys)==null||i.renderSurvey(t,n)}displaySurvey(t,n){var i;n===void 0&&(n=c4),(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:Io}}canRenderSurveyAsync(t,n){var i,a;return n===void 0&&(n=!1),(i=(a=this.surveys)==null?void 0:a.canRenderSurveyAsync(t,n))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Io})}Mn(t){return!t||Fm(t)?(Se.critical("Unique user id has not been set in posthog.identify"),!1):t===id?(Se.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())||(Se.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 Se.uninitializedWarning("posthog.identify");if(Cn(t)&&(t=t.toString(),Se.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Mn(t)&&this.Tn("posthog.identify")){var a=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Id)||this.register_once({$had_persisted_distinct_id:!0,$device_id:a},""),t!==a&&t!==this.get_property(Jo)&&(this.unregister(Jo),this.register({distinct_id:t}));var o,u=(this.persistence.get_property(Vr)||ul)===ul;t!==a&&u?(this.persistence.set_property(Vr,dl),this.setPersonPropertiesForFlags({$set:n||{},$set_once:i||{}},!1),this.capture(Fp,{distinct_id:t,$anon_distinct_id:a},{$set:n||{},$set_once:i||{}}),this.sn=wy(t,n,i),(o=this.featureFlags)==null||o.setAnonymousDistinctId(a)):(n||i)&&this.setPersonProperties(n,i),t!==a&&(this.reloadFeatureFlags(),this.unregister(oc))}}setPersonProperties(t,n){if((t||n)&&this.Tn("posthog.setPersonProperties")){var i=wy(this.get_distinct_id(),t,n);this.sn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:n||{}},!0),this.capture("$set",{$set:t||{},$set_once:n||{}}),this.sn=i):Se.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var n,i=(Ge(t)?t:[t]).filter((a=>Mt(a)&&a.length>0));i.length!==0&&this.Tn("posthog.unsetPersonProperties")&&((n=this.featureFlags)==null||n.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.sn=null)}group(t,n,i){if(t&&n){var a=this.getGroups(),o=a[t]!==n;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:pe({},a,{[t]:n})}),o||i){var u={$group_type:t,$group_key:n};i&&(u.$group_set=i),this.capture(ey,u)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}else Se.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.Tn("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,a,o,u,f,h,p,g,x;if(Se.info("reset"),!this.__loaded)return Se.uninitializedWarning("posthog.reset");var b,y=this.get_property(Id),_=this.get_property(Pp),j=this.get_property(ma);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(i=this.sessionPersistence)==null||i.clear(),_e(j)||(b=this.persistence)==null||b.register({[ma]:j}),(a=this.surveys)==null||a.reset(),(o=this.wn)==null||o.stop(),(u=this.featureFlags)==null||u.reset(),(f=this.conversations)==null||f.reset(),(h=this.logs)==null||h.reset(),(p=this.metrics)==null||p.reset(),(g=this.persistence)==null||g.set_property(Vr,ul),(x=this.sessionManager)==null||x.resetSessionId(),this.sn=null,this.config.cookieless_mode===$i)this.register_once({distinct_id:id,$device_id:null},"");else{var N=this.config.get_device_id(Pi());this.register_once({distinct_id:N,$device_id:t?N:y},""),t||_e(_)||this.register({[Pp]:_})}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(t){var n=this;return tn((function*(){var i,a,o,u,f;n.__loaded?((i=n.logs)==null||i.flushLogs("sendBeacon"),(a=n.metrics)==null||a.flush("sendBeacon"),(o=n.dn)==null||o.unload(),(u=n.vn)==null||u.unload(),(f=n.featureFlags)==null||f.destroy()):Se.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,n){var i;this.config.identity_distinct_id=t,this.config.identity_hash=n,this.alias(t),(i=this.conversations)==null||i.En()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,(t=this.conversations)==null||t.Rn()}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 n=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.sessionStartTimestamp,a=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n.sessionId);if(t!=null&&t.withTimestamp&&i){var o,u=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return a;a+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-u,0)}return a}alias(t,n){return t===this.get_property(K5)?(Se.critical("Attempting to create alias for existing People user - aborting."),-2):this.Tn("posthog.alias")?(_e(n)&&(n=this.get_distinct_id()),t!==n?(this.In(Jo,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Se.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n=pe({},this.config);if(It(t)){var i,a,o,u,f,h,p,g,x,b,y;$t(this.config,Ny(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 Vp(pe({},this.config,{persistence:"sessionStorage"}),_,!1);var j=this.an(this.config.debug);Wr(j)&&(this.config.debug=j),Wr(this.config.debug)&&(this.config.debug?(St.DEBUG=!0,zt.N()&&zt.q("ph_debug",!0),Se.info("set_config",{config:t,oldConfig:n,newConfig:pe({},this.config)})):(St.DEBUG=!1,zt.N()&&zt.P("ph_debug"))),(a=this.exceptionObserver)==null||a.onConfigChange(),(o=this.exceptions)==null||o.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(),(x=this.deadClicksAutocapture)==null||x.startIfEnabledOrStop(),(b=this.surveys)==null||b.loadIfEnabled(),this.Pn(),(y=this.externalIntegrations)==null||y.startIfEnabledOrStop()}}_overrideSDKInfo(t,n){St.LIB_NAME=t,St.LIB_VERSION=n}startSessionRecording(t){var n,i,a,o,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&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),h.url_trigger&&((o=this.sessionRecording)==null||o.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"),a=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(pe({},a,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:Dr.On}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:bl;return n!==bl&&(n=bl+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)==null?void 0:t.get_property(Vr))===dl||((n=this.sessionPersistence)==null?void 0:n.get_property(Vr))===dl}Cn(){var t,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===cg&&!this._isIdentified()&&js(this.getGroups())&&((t=this.persistence)==null||(t=t.props)==null||!t[Jo])&&((n=this.persistence)==null||(n=n.props)==null||!n[Yd]))}xn(){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.Cn()||this.Tn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Tn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Tn(t){return this.config.person_profiles==="never"?(Se.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.In(Yd,!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!==fa)}Pn(){var t,n,i,a,o=this.hn();return((t=this.persistence)==null?void 0:t.yr)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((n=this.sessionPersistence)==null?void 0:n.yr)!==o&&((a=this.sessionPersistence)==null||a.set_disabled(o)),o}opt_in_capturing(t){var n;if(this.config.cookieless_mode!==$i){if(this.Yi()){var i,a,o,u,f;this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(a=this.pageViewManager)==null||a.destroy(),this.sessionManager=new _y(this),this.pageViewManager=new dy(this),this.persistence&&(this.sessionPropsManager=new yy(this,this.sessionManager,this.persistence));var h,p=(o=(u=this.config.__extensionClasses)==null?void 0:u.sessionRecording)!==null&&o!==void 0?o:(f=Dr.__defaultExtensionClasses)==null?void 0:f.sessionRecording;p&&(this.sessionRecording=this.Ji(this.sessionRecording,new p(this)),this.yn&&((h=this.sessionRecording)==null||h.onRemoteConfig==null||h.onRemoteConfig(this.yn)))}var g,x;this.consent.optInOut(!0),this.Pn(),this.bn(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==fa&&((g=this.surveys)==null||g.loadIfEnabled()),(_e(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((x=t==null?void 0:t.captureEventName)!==null&&x!==void 0?x:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._n()}else Se.warn(ky)}opt_out_capturing(){var t,n,i;this.config.cookieless_mode!==$i?(this.config.cookieless_mode===fa&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Pn(),this.config.cookieless_mode===fa&&(this.register({distinct_id:id,$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._n(),this.bn())):Se.warn(ky)}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===$i||(this.config.cookieless_mode===fa?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Pn()}_is_bot(){return Hn?Vw(Hn,this.config.custom_blocked_useragents):void 0}_n(){Ce&&(Ce.visibilityState==="visible"?this.tn||(this.tn=!0,this.capture(vl,{title:Ce.title},{send_instantly:!0}),this.rn&&(Ce.removeEventListener(Wd,this.rn),this.rn=null)):this.rn||(this.rn=this._n.bind(this),Qt(Ce,Wd,this.rn)))}debug(t){t===!1?(ie==null||ie.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(ie==null||ie.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}))}Ur(){var t=this.ln||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Se.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):(function(n,i,a,o,u){var f=i in n&&!We(n[i]),h=a in n&&!We(n[a]);return f?n[i]:!!h&&(u&&u.warn("Config field '"+a+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),n[a])})(t,"advanced_disable_flags","advanced_disable_decide",0,Se)}wt(t){var n;if(We(this.config.before_send))return t;var i=Object.keys((n=t.properties)!==null&&n!==void 0?n:{}).filter(N3),a=Ge(this.config.before_send)?this.config.before_send:[this.config.before_send],o=t;for(var u of a){if(o=u(o),We(o)){var f="Event '"+t.event+"' was rejected in beforeSend function";return j3(t.event)?Se.warn(f+". This can cause unexpected behavior."):Se.info(f),null}o.properties&&!js(o.properties)||Se.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var h of i)if(o.properties&&We(o.properties[h]))return Se.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 o}getPageViewId(){var t;return(t=this.pageViewManager.ir)==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)})}an(t){var n=Wr(t)&&!t,i=zt.N()&&zt.A("ph_debug")==="true";return!n&&(!!i||t)}}Dr.__defaultExtensionClasses={},Dr.On=(()=>{var e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(var n=0;t.length>n;n++)e.prototype[t[n]]=pC(e.prototype[t[n]])})(Dr,["identify"]);class Cy{constructor(t){this.disabled=t===!1;var n=It(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 a=this.clicks[this.clicks.length-1];if(a&&Math.abs(t-a.x)+Math.abs(n-a.y)<this.thresholdPx&&this.timeoutMs>i-a.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 Jp="$copy_autocapture",em=Vt("[AutoCapture]");function tm(e,t){return t.length>e?t.slice(0,e)+"...":t}function g4(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!Ts(t));return t}function x4(e,t){var n,i,a=t.e,o=t.maskAllElementAttributes,u=t.maskAllText,f=t.elementAttributeIgnoreList,h=t.elementsChainAsString,p=t.disableCaptureUrlHashes;if(!Ts(e))return{props:{}};for(var g=[e],x=new Set([e]),b=e;b.parentNode&&!pr(b,"body")&&pw>g.length;)if(hw(b.parentNode)){var y=b.parentNode.host;if(x.has(y))break;x.add(y),g.push(y),b=y}else{if(!Ts(b.parentNode)||x.has(b.parentNode))break;x.add(b.parentNode),g.push(b.parentNode),b=b.parentNode}var _,j,N=[],k={},A=!1,C=!1;if(Rt(g,($=>{var G=dg($);if(pr($,"a")){var O=$.getAttribute("href");A=!!(G&&O&&cc(O))&&(p?Es(O):O)}qe(Kd($),"ph-no-capture")&&(C=!0),N.push((function(T,ae,J,W,B){B===void 0&&(B=!1);var F=T.tagName.toLowerCase(),Y={tag_name:F};Xg.indexOf(F)>-1&&!J&&(Y.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?tm(1024,oy(T)):tm(1024,wc(T)));var xe=Kd(T);xe.length>0&&(Y.classes=xe.filter((function(M){return M!==""}))),Rt(T.attributes,(function(M){var de;if((!bw(T)||["name","id","class","aria-label"].indexOf(M.name)!==-1)&&(W==null||!W.includes(M.name))&&!ae&&cc(M.value)&&(!Mt(de=M.name)||de.substring(0,10)!=="_ngcontent"&&de.substring(0,7)!=="_nghost")){var be=M.value;M.name==="class"&&(be=Qg(be).join(" ")),Y["attr__"+M.name]=tm(1024,M.name==="href"&&B?Es(be):be)}}));for(var R=1,P=1,Z=T;Z=g4(Z);)R++,Z.tagName===T.tagName&&P++;return Y.nth_child=R,Y.nth_of_type=P,Y})($,o,u,f,p));var I=(function(T){if(!dg(T))return{};var ae={};return Rt(T.attributes,(function(J){if(J.name&&J.name.indexOf("data-ph-capture-attribute")===0){var W=J.name.replace("data-ph-capture-attribute-",""),B=J.value;W&&B&&cc(B)&&(ae[W]=B)}})),ae})($);$t(k,I)})),C)return{props:{},explicitNoCapture:C};if(u||(N[0].$el_text=pr(e,"a")||pr(e,"button")?oy(e):wc(e)),A){var L,D;N[0].attr__href=A;var z=(L=Zd(A))==null?void 0:L.host,q=ie==null||(D=ie.location)==null?void 0:D.host;z&&q&&z!==q&&(_=A)}return{props:$t({$event_type:a.type,$ce_version:1},h?{}:{$elements:N},{$elements_chain:(j=N,(function($){return $.map((G=>{var O,I,T="";if(G.tag_name&&(T+=G.tag_name),G.attr_class)for(var ae of(G.attr_class.sort(),G.attr_class))T+="."+ae.replace(/"/g,"");var J=pe({},G.text?{text:G.text}:{},{"nth-child":(O=G.nth_child)!==null&&O!==void 0?O:0,"nth-of-type":(I=G.nth_of_type)!==null&&I!==void 0?I:0},G.href?{href:G.href}:{},G.attr_id?{attr_id:G.attr_id}:{},G.attributes),W={};return Nd(J).sort(((B,F)=>B[0].localeCompare(F[0]))).forEach((B=>{var F=B[1];return W[cy(B[0].toString())]=cy(F.toString())})),(T+=":")+Nd(W).map((B=>B[0]+'="'+B[1]+'"')).join("")})).join(";")})((function($){return $.map((G=>{var O,I,T={text:(O=G.$el_text)==null?void 0:O.slice(0,400),tag_name:G.tag_name,href:(I=G.attr__href)==null?void 0:I.slice(0,2048),attr_class:DC(G),attr_id:G.attr__id,nth_child:G.nth_child,nth_of_type:G.nth_of_type,attributes:{}};return Nd(G).filter((ae=>ae[0].indexOf("attr__")===0)).forEach((ae=>T.attributes[ae[0]]=ae[1])),T}))})(j)))},(n=N[0])!=null&&n.$el_text?{$el_text:(i=N[0])==null?void 0:i.$el_text}:{},_&&a.type==="click"?{$external_click_url:_}:{},k)}}var qo=Vt("[ExceptionAutocapture]"),Ey=()=>{},v4=Vt("[TracingHeaders]"),sa=Vt("[Web Vitals]"),Ty=9e5,Ay="disabled",My="lazy_loading",Vo="awaiting_config",ud="missing_config";Vt("[SessionRecording]"),Vt("[SessionRecording]");var bg="[SessionRecording]",Mi=Vt(bg),b4=Vt("[Heatmaps]");function nm(e){return It(e)&&"clientX"in e&&"clientY"in e&&Cn(e.clientX)&&Cn(e.clientY)}var rm=Vt("[Product Tours]"),im=e=>{var t;return!e.config.disable_product_tours&&!((t=e.persistence)==null||!t.get_property(Vg))},y4=["$set_once","$set"],ai=Vt("[SiteApps]"),Ry="Error while initializing PostHog app with config id ";function pl(e,t,n){if(We(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 _4{constructor(t){this.Fn=new tx,this.Ln=(n,i)=>this.$n(n,i)&&this.An(n,i)&&this.Nn(n,i)&&this.Dn(n,i),this.$n=(n,i)=>i==null||!i.event||(n==null?void 0:n.event)===(i==null?void 0:i.event),this._instance=t,this.qn=new Set,this.jn=new Set}init(){var t,n;_e((t=this._instance)==null?void 0:t._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook(((i,a)=>{this.on(i,a)}))}register(t){var n,i;if(!_e((n=this._instance)==null?void 0:n._addCaptureHook)&&(t.forEach((u=>{var f,h;(f=this.jn)==null||f.add(u),(h=u.steps)==null||h.forEach((p=>{var g;(g=this.qn)==null||g.add((p==null?void 0:p.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var a,o=new Set;t.forEach((u=>{var f;(f=u.steps)==null||f.forEach((h=>{h!=null&&h.selector&&o.add(h==null?void 0:h.selector)}))})),(a=this._instance)==null||a.autocapture.setElementSelectors(o)}}on(t,n){var i;n!=null&&t.length!=0&&(this.qn.has(t)||this.qn.has(n.event))&&this.jn&&((i=this.jn)==null?void 0:i.size)>0&&this.jn.forEach((a=>{this.Hn(n,a)&&this.Fn.emit("actionCaptured",a.name)}))}Bn(t){this.onAction("actionCaptured",(n=>t(n)))}Hn(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var i of n.steps)if(this.Ln(t,i))return!0;return!1}onAction(t,n){return this.Fn.on(t,n)}An(t,n){if(n!=null&&n.url){var i,a=t==null||(i=t.properties)==null?void 0:i.$current_url;if(!a||typeof a!="string"||!pl(a,n.url,n.url_matching||"contains"))return!1}return!0}Nn(t,n){return!!this.Un(t,n)&&!!this.zn(t,n)&&!!this.Vn(t,n)}Un(t,n){var i;if(n==null||!n.href)return!0;var a=this.Wn(t);if(a.length>0)return a.some((f=>pl(f.href,n.href,n.href_matching||"exact")));var o,u=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!u&&pl((o=u.match(/(?::|")href="(.*?)"/))?o[1]:"",n.href,n.href_matching||"exact")}zn(t,n){var i;if(n==null||!n.text)return!0;var a=this.Wn(t);if(a.length>0)return a.some((p=>pl(p.text,n.text,n.text_matching||"exact")||pl(p.$el_text,n.text,n.text_matching||"exact")));var o,u,f,h=(t==null||(i=t.properties)==null?void 0:i.$elements_chain)||"";return!!h&&(o=(function(p){for(var g,x=[],b=/(?::|")text="(.*?)"/g;!We(g=b.exec(p));)x.includes(g[1])||x.push(g[1]);return x})(h),u=n.text,f=n.text_matching||"exact",o.some((p=>pl(p,u,f))))}Vn(t,n){var i,a;if(n==null||!n.selector)return!0;var o=t==null||(i=t.properties)==null?void 0:i.$element_selectors;if(o!=null&&o.includes(n.selector))return!0;var u=(t==null||(a=t.properties)==null?void 0:a.$elements_chain)||"";if(n.selector_regex&&u)try{return new RegExp(n.selector_regex).test(u)}catch{return!1}return!1}Wn(t){var n;return(t==null||(n=t.properties)==null?void 0:n.$elements)==null?[]:t==null?void 0:t.properties.$elements}Dn(t,n){return n==null||!n.properties||n.properties.length===0||Ww(n.properties.reduce(((i,a)=>{var o=Ge(a.value)?a.value.map(String):a.value!=null?[String(a.value)]:[];return i[a.key]={values:o,operator:a.operator||"exact"},i}),{}),t==null?void 0:t.properties)}}class w4{constructor(t){var n;this.Zn=[],this._instance=t,this.Gn=new Map,this.Qn=new Map,this.Jn=new Map,(n=this._instance)==null||n.onSessionId==null||n.onSessionId((i=>this.Kn(i)))}Yn(t,n){return!!t&&Ww(t.propertyFilters,n==null?void 0:n.properties)}Xn(t,n){var i=new Map;return t.forEach((a=>{var o;(o=a.conditions)==null||(o=o[n])==null||(o=o.values)==null||o.forEach((u=>{if(u!=null&&u.name){var f=i.get(u.name)||[];f.push(a.id),i.set(u.name,f)}}))})),i}es(t,n,i){var a=(i===Po.Activation?this.Gn:this.Qn).get(t),o=[];return this.ts((u=>{o=u.filter((f=>a==null?void 0:a.includes(f.id)))})),o.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.Yn(h,n)}))}register(t){var n;_e((n=this._instance)==null?void 0:n._addCaptureHook)||(this.rs(t),this.ns(t))}ns(t){var n=t.filter((i=>{var a,o;return((a=i.conditions)==null?void 0:a.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));n.length!==0&&(this.ss==null&&(this.ss=new _4(this._instance),this.ss.init(),this.ss.Bn((i=>{this.onAction(i)}))),n.forEach((i=>{var a,o,u,f,h;i.conditions&&(a=i.conditions)!=null&&a.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((u=i.conditions)==null||(u=u.actions)==null||(u=u.values)==null?void 0:u.length)>0&&((f=this.ss)==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.Jn.get(p.name);g&&g.push(i.id),this.Jn.set(p.name,g||[i.id])}})))})))}rs(t){var n,i=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.events)&&((f=o.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.length)>0})),a=t.filter((o=>{var u,f;return((u=o.conditions)==null?void 0:u.cancelEvents)&&((f=o.conditions)==null||(f=f.cancelEvents)==null||(f=f.values)==null?void 0:f.length)>0}));i.length===0&&a.length===0||((n=this._instance)==null||n._addCaptureHook(((o,u)=>{this.onEvent(o,u)})),this.Gn=this.Xn(t,Po.Activation),this.Qn=this.Xn(t,Po.Cancellation))}onEvent(t,n){var i,a,o=this.os(),u=(n==null||(i=n.properties)==null?void 0:i.$survey_id)||(n==null||(a=n.properties)==null?void 0:a.$product_tour_id);if(u&&this.getActivatedIds().includes(u)){var f=this.ls(t,u);if(f==="consume")return o.info("event consumed activated item, removing it",{event:t,itemId:u}),void this.us([u]);if(f==="persist")return o.info("shown item promoted to persisted activation",{event:t,itemId:u}),void this.hs(u)}if(this.Qn.has(t)){var h=this.es(t,n,Po.Cancellation);h.length>0&&(o.info("cancel event matched, cancelling items",{event:t,itemsToCancel:h.map((g=>g.id))}),this.us(h.map((g=>g.id))),h.forEach((g=>this.ds(g.id))))}if(this.Gn.has(t)){o.info("event name matched",{event:t,eventPayload:n,items:this.Gn.get(t)});var p=this.es(t,n,Po.Activation);this.cs(p.map((g=>g.id)))}}onAction(t){this.Jn.has(t)&&this.cs(this.Jn.get(t)||[])}cs(t){t.length!==0&&(this.Zn=[...new Set([...this.Zn,...t])],this.os().info("updating activated items",{activatedItems:this.getActivatedIds()}))}hs(t){this.Zn=this.Zn.filter((i=>i!==t));var n=this.vs();n.includes(t)||(this.fs([...n,t]),this.ps())}us(t){var n=new Set(t);this.Zn=this.Zn.filter((o=>!n.has(o)));var i=this.gs(),a=i.filter((o=>!n.has(o)));a.length!==i.length&&(this.fs(a),a.length===0&&this.ys())}gs(){var t,n=this.bs();return((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[n])||[]}vs(){var t,n,i=this.gs();if(i.length===0)return[];var a=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[this._s()],o=(n=this._instance)==null||n.get_session_id==null?void 0:n.get_session_id();return o&&a===o?i:[]}ps(){var t,n=(t=this._instance)==null||t.get_session_id==null?void 0:t.get_session_id();n&&this.ws(n)}ys(){this.xs()}Kn(t){var n,i=(n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[this._s()];i&&i!==t&&(this.gs().length>0&&this.fs([]),this.ys())}getActivatedIds(){return[...new Set([...this.vs(),...this.Zn])].filter((t=>!this.ks(t)))}reset(){this.Zn=[],this.gs().length>0&&this.fs([]),this.ys()}getEventToItemsMap(){return this.Gn}Ss(){return this.ss}}class S4 extends w4{constructor(t){super(t)}bs(){return ng}_s(){return jd}Cs(){return Ui.SHOWN}ts(t){var n;(n=this._instance)==null||n.getSurveys(t)}ds(t){var n;(n=this._instance)==null||n.cancelPendingSurvey(t)}os(){return Ct}fs(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[ng]:t})}ws(t){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[jd]:t})}xs(){var t;(t=this._instance)==null||(t=t.persistence)==null||t.unregister(jd)}ks(){return!1}ls(t,n){var i;this.ts((o=>{i=o.find((u=>u.id===n))}));var a=!i||(function(o){var u;return Qw(o)&&!((u=o.conditions)==null||(u=u.events)==null||!u.repeatedActivation)||o.schedule==="always"})(i);return a?t===Ui.SHOWN?"consume":"ignore":t===Ui.SHOWN?"persist":t===Ui.DISMISSED||t===Ui.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var dd="SDK is not enabled or survey functionality is not yet loaded",Ly="Disabled. Not loading surveys.",k4=ie!=null&&ie.location?Jd(ie.location.hash,"__posthog")||Jd(location.hash,"state"):null,Dy="_postHogToolbarParams",zy=Vt("[Toolbar]"),fn=Vt("[FeatureFlags]"),aa=Vt("[FeatureFlags]",{debugEnabled:!0}),sm=`" failed. Feature flags didn't load in time.`,Oy=e=>{for(var t={},n=0;e.length>n;n++)t[e[n]]=!0;return t},By=e=>{var t={};for(var n of Nd(e||{})){var i=n[1];i&&(t[n[0]]=i)}return t},Ri=Vt("[Error tracking]"),Py="Refusing to render web experiment since the viewer is a likely bot",j4={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>nf(t,e),not_regex:(e,t)=>!nf(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e};class Mn{get Te(){return this._instance.config}constructor(t){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),n.getWebExperiments((a=>{Mn.Ts("retrieved web experiments from the server"),n.Is=new Map,a.forEach((o=>{if(o.feature_flag_key){var u;n.Is&&(Mn.Ts("setting flag key ",o.feature_flag_key," to web experiment ",o),(u=n.Is)==null||u.set(o.feature_flag_key,o));var f=n._instance.getFeatureFlag(o.feature_flag_key);Mt(f)&&o.variants[f]&&n.Ms(o.name,f,o.variants[f].transforms)}else if(o.variants)for(var h in o.variants){var p=o.variants[h];Mn.Es(p,n._instance)&&n.Ms(o.name,h,p.transforms)}}))}),i)},this._instance=t,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Mn.Ts(Py);else if(!this.Te.disable_web_experiments){if(We(this.Is))return this.Is=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Mn.Ts("applying feature flags",t),t.forEach((n=>{var i;if(this.Is&&(i=this.Is)!=null&&i.has(n)){var a,o=this._instance.getFeatureFlag(n),u=(a=this.Is)==null?void 0:a.get(n);o&&u!=null&&u.variants[o]&&this.Ms(u.name,o,u.variants[o].transforms)}}))}}previewWebExperiment(){var t=Mn.getWindowLocation();if(t!=null&&t.search){var n=Tl(t==null?void 0:t.search,"__experiment_id"),i=Tl(t==null?void 0:t.search,"__experiment_variant");n&&i&&(Mn.Ts("previewing web experiments "+n+" && "+i),this.getWebExperiments((a=>{this.Rs(parseInt(n),i,a)}),!1,!0))}}loadIfEnabled(){this.Te.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,i){if(this.Te.disable_web_experiments&&!i)return t([]);var a=this._instance.get_property("$web_experiments");if(a&&!n)return t(a);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Te.token),method:"GET",timestampMode:"query",callback:o=>t(o.statusCode===200&&o.json&&o.json.experiments||[])})}Rs(t,n,i){var a=i.filter((o=>o.id===t));a&&a.length>0&&(Mn.Ts("Previewing web experiment ["+a[0].name+"] with variant ["+n+"]"),this.Ms(a[0].name,n,a[0].variants[n].transforms))}static Es(t,n){return!We(t.conditions)&&Mn.Ps(t,n)&&Mn.Os(t)}static Ps(t,n){var i;if(We(t.conditions)||We((i=t.conditions)==null?void 0:i.url))return!0;var a=Mn.getWindowLocation();if(a){var o,u,f,h=uw(n,a.href);return(o=t.conditions)==null||!o.url||j4[(u=(f=t.conditions)==null?void 0:f.urlMatchType)!==null&&u!==void 0?u:"icontains"](t.conditions.url,h)}return!1}static getWindowLocation(){return ie==null?void 0:ie.location}static Os(t){var n;if(We(t.conditions)||We((n=t.conditions)==null?void 0:n.utm))return!0;var i=Cw();if(i.utm_source){var a,o,u,f,h,p,g,x,b=(a=t.conditions)==null||(a=a.utm)==null||!a.utm_campaign||((o=t.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,y=(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,j=(g=t.conditions)==null||(g=g.utm)==null||!g.utm_term||((x=t.conditions)==null||(x=x.utm)==null?void 0:x.utm_term)==i.utm_term;return b&&_&&j&&y}return!1}static Ts(t){for(var n=arguments.length,i=new Array(n>1?n-1:0),a=1;n>a;a++)i[a-1]=arguments[a];Se.info("[WebExperiments] "+t,i)}Ms(t,n,i){this._is_bot()?Mn.Ts(Py):n!=="control"?i.forEach((a=>{if(a.selector){var o;Mn.Ts("applying transform of variant "+n+" for experiment "+t+" ",a);var u=(o=document)==null?void 0:o.querySelectorAll(a.selector);u==null||u.forEach((f=>{var h=f;a.html&&(h.innerHTML=a.html),a.css&&h.setAttribute("style",a.css)}))}})):Mn.Ts("Control variants leave the page unmodified.")}_is_bot(){return Hn&&this._instance?Vw(Hn,this.Te.custom_blocked_useragents):void 0}}var Mr=Vt("[Conversations]"),la="Conversations not available yet.",$y="console",pf={featureFlags:class{constructor(e){this.Fs=!1,this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.qs=!1,this.js=!1,this.Hs=0,this.Bs=()=>{var t=this.Us();this.Hs=0,t&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],ie&&Qt(ie,"online",this.Bs)}destroy(){ie==null||ie.removeEventListener("online",this.Bs)}get Te(){return this._instance.config}get mi(){return this._instance.persistence}zs(e){return this._instance.get_property(e)}Vs(){var e,t;return(e=(t=this.mi)==null?void 0:t._r(this.Te.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}Ws(){return!!this.Vs()&&(this.js||this.$s||(this.js=!0,fn.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Zs(){var e,t=(e=this.Te.evaluation_contexts)!==null&&e!==void 0?e:this.Te.evaluation_environments;return!this.Te.evaluation_environments||this.Te.evaluation_contexts||this.qs||(fn.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.qs=!0),t!=null&&t.length?t.filter((n=>{var i=n&&typeof n=="string"&&n.trim().length>0;return i||fn.error("Invalid evaluation context found:",n,"Expected non-empty string"),i})):[]}Gs(){return this.Zs().length>0}Qs(){var e=this.Te.flag_keys;if(!_e(e)){if(Ge(e))return e.filter((t=>{var n=t&&typeof t=="string"&&t.trim().length>0;return n||fn.error("Invalid flag key found:",t,"Expected non-empty string"),n}));fn.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,n=this._instance.config,i=(e=(t=n.bootstrap)==null?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var a,o,u=(a=(o=n.bootstrap)==null?void 0:o.featureFlagPayloads)!==null&&a!==void 0?a:{},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,a,o=n!=null&&n.merge&&(i=this.zs(pa))!==null&&i!==void 0?i:{},u=n!=null&&n.merge&&(a=this.zs(kd))!==null&&a!==void 0?a:{},f=pe({},o,e),h=pe({},u,t),p={};for(var g of Object.entries(f)){var x=g[0],b=g[1];p[x]={key:x,enabled:Fb(b),variant:Ub(b),reason:void 0,metadata:_e(h==null?void 0:h[x])?void 0:{id:0,version:void 0,description:void 0,payload:h[x]}}}this.receivedFeatureFlags({flags:p})}get hasLoadedFlags(){return this.Ls}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.zs(Jm),t=this.zs(Oi),n=this.zs(xl);if(!n&&!t)return e||{};var i=$t({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var u,f,h=i[o],p=t==null?void 0:t[o],g=_e(p)?(u=h==null?void 0:h.enabled)!==null&&u!==void 0&&u:!!p,x=_e(p)?h.variant:typeof p=="string"?p:void 0,b=n==null?void 0:n[o],y=pe({},h,{enabled:g,variant:g?x??(h==null?void 0:h.variant):void 0});g!==(h==null?void 0:h.enabled)&&(y.original_enabled=h==null?void 0:h.enabled),x!==(h==null?void 0:h.variant)&&(y.original_variant=h==null?void 0:h.variant),b&&(y.metadata=pe({},h==null?void 0:h.metadata,{payload:b,original_payload:h==null||(f=h.metadata)==null?void 0:f.payload})),i[o]=y}return this.Fs||(fn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:i}),this.Fs=!0),i}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map((n=>{var i=e[n];return{key:n,enabled:Fb(i),variant:Ub(i),payload:$b(t[n])}}))}getFlagVariants(){var e=this.zs(pa),t=this.zs(Oi);if(!t)return e||{};for(var n=$t({},e),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Fs||(fn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.Fs=!0),n}getFlagPayloads(){var e=this.zs(kd),t=this.zs(xl);if(!t)return e||{};for(var n=$t({},e||{}),i=Object.keys(t),a=0;i.length>a;a++)n[i[a]]=t[i[a]];return this.Fs||(fn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.Fs=!0),n}reloadFeatureFlags(){this.As||this.Te.advanced_disable_feature_flags||this.Us()||this.Js||(this._instance.en.emit("featureFlagsReloading",!0),this.Js=setTimeout((()=>{this.Ks()}),5))}Ys(){clearTimeout(this.Js),this.Js=void 0}ensureFlagsLoaded(){this.Ls||this.$s||this.Js||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.As=e}Ks(e){var t;if(this.Ys(),!this._instance.Ur()&&!this.Us())if(this.$s)this.Ns=!0;else{var n=this.Te.token,i=this.zs(Id),a={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:pe({},((t=this.mi)==null?void 0:t.get_initial_props())||{},this.zs(ua)||{},{$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION}),group_properties:this.zs(da),timezone:Lw()};In(i)||_e(i)||(a.$device_id=i),(e!=null&&e.disableFlags||this.Te.advanced_disable_feature_flags)&&(a.disable_flags=!0),this.Gs()&&(a.evaluation_contexts=this.Zs());var o=this.Qs();_e(o)||(a.flag_keys=o);var u=!!this.Te.advanced_only_evaluate_survey_feature_flags,f=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Te.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$s=!0,this._instance._send_request({method:"POST",url:f,data:a,compression:this.Te.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback:h=>{var p,g,x,b=!0;if(this.Xs(h.statusCode),h.statusCode===200&&(this.Ns||(this.$anon_distinct_id=void 0),b=!1),this.$s=!1,!a.disable_flags||this.Ns){this.Ds=!b;var y=[];h.error?h.error instanceof Error?y.push(h.error.name==="AbortError"?"timeout":"connection_error"):y.push("unknown_error"):h.statusCode!==200&&y.push("api_error_"+h.statusCode),(p=h.json)!=null&&p.errorsWhileComputingFlags&&y.push("errors_while_computing_flags");var _,j=!((g=h.json)==null||(g=g.quotaLimited)==null||!g.includes("feature_flags"));j&&y.push("quota_limited"),(x=this.mi)==null||x.register({[ig]:y}),j?fn.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."):(a.disable_flags||this.receivedFeatureFlags((_=h.json)!==null&&_!==void 0?_:{},b,{partialResponse:u}),this.Ns&&(this.Ns=!1,this.Ks()))}}})}}Us(){return jw(this.Hs,3)}Xs(e){this.Hs=Nw(e,this.Hs,3,(()=>fn.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(e,t){var n;if(t===void 0&&(t={}),!t.fresh||this.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){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 fn.warn('getFeatureFlag for key "'+e+sm)}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.Ds)if(this.Ls||this.getFlags()&&this.getFlags().length>0){if(!this.Ws()){var n=this.getFlagVariants(),i=e in n,a=n[e],o=this.getFlagPayloads()[e],u=String(a),f=this.zs(eg)||void 0,h=this.zs(_c)||void 0,p=this.zs(oc)||{};if(this.Te.advanced_feature_flags_dedup_per_session){var g,x=this._instance.get_session_id(),b=this.zs(rg);x&&x!==b&&(p={},(g=this.mi)==null||g.register({[oc]:p,[rg]:x}))}if((t.send_event||!("send_event"in t))&&(!(e in p)||!p[e].includes(u))){var y,_,j,N,k,A,C,L,D,z,q;Ge(p[e])?p[e].push(u):p[e]=[u],(y=this.mi)==null||y.register({[oc]:p});var $=this.getFeatureFlagDetails(e),G=[...(_=this.zs(ig))!==null&&_!==void 0?_:[]];_e(a)&&G.push("flag_missing");var O={$feature_flag:e,$feature_flag_response:a,$feature_flag_payload:o||null,$feature_flag_request_id:f,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:((j=this.Te.bootstrap)==null||(j=j.featureFlags)==null?void 0:j[e])||null,$feature_flag_bootstrapped_payload:((N=this.Te.bootstrap)==null||(N=N.featureFlagPayloads)==null?void 0:N[e])||null,$used_bootstrap_value:!this.Ds};_e($==null||(k=$.metadata)==null?void 0:k.has_experiment)||(O.$feature_flag_has_experiment=$.metadata.has_experiment),_e($==null||(A=$.metadata)==null?void 0:A.version)||(O.$feature_flag_version=$.metadata.version);var I,T=(C=$==null||(L=$.reason)==null?void 0:L.description)!==null&&C!==void 0?C:$==null||(D=$.reason)==null?void 0:D.code;T&&(O.$feature_flag_reason=T),$!=null&&(z=$.metadata)!=null&&z.id&&(O.$feature_flag_id=$.metadata.id),_e($==null?void 0:$.original_variant)&&_e($==null?void 0:$.original_enabled)||(O.$feature_flag_original_response=_e($.original_variant)?$.original_enabled:$.original_variant),$!=null&&(q=$.metadata)!=null&&q.original_payload&&(O.$feature_flag_original_payload=$==null||(I=$.metadata)==null?void 0:I.original_payload),G.length&&(O.$feature_flag_error=G.join(",")),this._instance.capture("$feature_flag_called",O)}if(i)return{key:e,enabled:!!a,variant:typeof a=="string"?a:void 0,payload:$b(o)}}}else fn.warn('getFeatureFlagResult for key "'+e+sm)}getRemoteConfigPayload(e,t){var n=this.Te.token,i={distinct_id:this._instance.get_distinct_id(),token:n,person_properties:{$lib:St.LIB_NAME,$lib_version:St.LIB_VERSION}};this.Gs()&&(i.evaluation_contexts=this.Zs());var a=this.Qs();_e(a)||(i.flag_keys=a),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:i,compression:this.Te.disable_compression?void 0:$n.Base64,timestampMode:"body",timeout:this.Te.feature_flag_request_timeout_ms,callback(o){var u,f=(u=o.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.Ds)return t.defaultValue;if(!(this.Ls||this.getFlags()&&this.getFlags().length>0))return fn.warn('isFeatureEnabled for key "'+e+sm),t.defaultValue;var n=this.getFeatureFlag(e,t);return _e(n)?t.defaultValue:!!n}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t,n){if(this.mi){this.Ls=!0;var i=this.getFlagVariants(),a=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(u,f,h,p,g,x){h===void 0&&(h={}),p===void 0&&(p={}),g===void 0&&(g={});var b=($=>{var G=$.flags;return G?($.featureFlags=Object.fromEntries(Object.keys(G).map((O=>{var I;return[O,(I=G[O].variant)!==null&&I!==void 0?I:G[O].enabled]}))),$.featureFlagPayloads=Object.fromEntries(Object.keys(G).filter((O=>G[O].enabled)).filter((O=>{var I;return(I=G[O].metadata)==null?void 0:I.payload})).map((O=>{var I;return[O,(I=G[O].metadata)==null?void 0:I.payload]})))):$.featureFlags&&fn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$})(u),y=b.flags,_=b.featureFlags,j=b.featureFlagPayloads;if(_){var N=u.requestId,k=u.evaluatedAt;if(Ge(_)){fn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var A={};if(_)for(var C=0;_.length>C;C++)A[_[C]]=!0;f&&f.register({[Sd]:_,[pa]:A,[qd]:!1})}else{var L=_,D=j,z=y;if(x!=null&&x.partialResponse)L=pe({},h,L),D=pe({},p,D),z=pe({},g,z);else if(u.errorsWhileComputingFlags)if(y){var q=new Set(Object.keys(y).filter(($=>{var G;return!((G=y[$])!=null&&G.failed)})));L=pe({},h,Object.fromEntries(Object.entries(L).filter(($=>q.has($[0]))))),D=pe({},p,Object.fromEntries(Object.entries(D||{}).filter(($=>q.has($[0]))))),z=pe({},g,Object.fromEntries(Object.entries(z||{}).filter(($=>q.has($[0])))))}else L=pe({},h,L),D=pe({},p,D),z=pe({},g,z);f&&f.register(pe({[Sd]:Object.keys(By(L)),[pa]:L||{},[kd]:D||{},[Jm]:z||{},[qd]:u.minimalFlagCalledEvents===!0},N?{[eg]:N}:{},k?{[_c]:k}:{}))}}})(e,this.mi,i,a,o,n),t||(this.js=!1),this.eo(t)}}override(e,t){t===void 0&&(t=!1),fn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.mi)return fn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this.mi.unregister(Oi),this.mi.unregister(xl),this.eo(),aa.info("All overrides cleared");if(Ge(e)){var t=Oy(e);return this.mi.register({[Oi]:t}),this.eo(),aa.info("Flag overrides set",{flags:e})}if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,i=e;if(this.Fs=!!((n=i.suppressWarning)!==null&&n!==void 0&&n),"flags"in i){if(i.flags===!1)this.mi.unregister(Oi),aa.info("Flag overrides cleared");else if(i.flags){if(Ge(i.flags)){var a=Oy(i.flags);this.mi.register({[Oi]:a})}else this.mi.register({[Oi]:i.flags});aa.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this.mi.unregister(xl),aa.info("Payload overrides cleared")):i.payloads&&(this.mi.register({[xl]:i.payloads}),aa.info("Payload overrides set",{payloads:i.payloads}))),void this.eo()}if(e&&typeof e=="object")return this.mi.register({[Oi]:e}),this.eo(),aa.info("Flag overrides set",{flags:e});fn.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Ls){var t=this.ro(),n=t.flags,i=t.flagVariants;try{e(n,i)}catch(a){fn.error("Error while running feature flags callback",a)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,n){var i,a=(this.zs(tc)||[]).find((h=>h.flagKey===e)),o={["$feature_enrollment/"+e]:t},u={$feature_flag:e,$feature_enrollment:t,$set:o};a&&(u.$early_access_feature_name=a.name),n&&(u.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",u),this.setPersonPropertiesForFlags(o,!1);var f=pe({},this.getFlagVariants(),{[e]:t});(i=this.mi)==null||i.register({[Sd]:Object.keys(By(f)),[pa]:f}),this.eo()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var i=this.zs(tc),a=n?"&"+n.map((o=>"stage="+o)).join("&"):"";if(i&&!t)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Te.token+a),method:"GET",timestampMode:"query",callback:o=>{var u,f;if(o.json){var h=o.json.earlyAccessFeatures;return(u=this.mi)==null||u.unregister(tc),(f=this.mi)==null||f.register({[tc]:h}),e(h)}}})}ro(){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)),{})}}eo(e){var t=this.ro(),n=t.flags,i=t.flagVariants;this.featureFlagEventHandlers.forEach((a=>{try{a(n,i,{errorsLoading:e})}catch(o){fn.error("Error while running feature flags callback",o)}}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.zs(ua)||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),a=e==null?void 0:e.$set_once,o={};if(a)for(var u in a)({}).hasOwnProperty.call(a,u)&&(u in n||(o[u]=a[u]));this._instance.register({[ua]:pe({},n,o,i)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=pe({},this.zs(ua)||{});e.forEach((i=>{delete n[i]})),this._instance.register({[ua]:n}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){e===void 0&&(e=!0),this._instance.unregister(ua),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this.zs(da)||{};Object.keys(n).length!==0&&Object.keys(n).forEach((i=>{n[i]=pe({},n[i],e[i]),delete e[i]})),this._instance.register({[da]:pe({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.zs(da)||{};this._instance.register({[da]:pe({},t,{[e]:{}})})}else this._instance.unregister(da)}reset(){this.Ls=!1,this.$s=!1,this.As=!1,this.Ns=!1,this.Ds=!1,this.$anon_distinct_id=void 0,this.Ys(),this.Fs=!1,this.Hs=0}}},N4={sessionRecording:class{get Te(){return this._instance.config}get mi(){return this._instance.persistence}get started(){var e;return!((e=this.io)==null||!e.isStarted)}get status(){var e,t;return this.no===Vo||this.no===ud?this.no:(e=(t=this.io)==null?void 0:t.status)!==null&&e!==void 0?e:this.no}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.no=Ay,this.so=void 0,this._instance=e,!this._instance.sessionManager)throw Mi.error("started without valid sessionManager"),new Error(bg+" started without valid sessionManager. This is a bug.");if(this.Te.cookieless_mode===$i)throw new Error(bg+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get oo(){var e,t=!((e=this._instance.get_property(ma))==null||!e.enabled),n=!this.Te.disable_session_recording,i=this.Te.disable_session_recording||this._instance.consent.isOptedOut();return ie&&t&&n&&!i}startIfEnabledOrStop(e){var t;if(!this.oo||(t=this.io)==null||!t.isStarted){var n=!_e(Object.assign)&&!_e(Array.from);this.oo&&n?(this.ao(e),Mi.info("starting")):(this.no=Ay,this.stopRecording())}}ao(e){var t,n,i;this.oo&&(this.no!==Vo&&this.no!==ud&&(this.no=My),Oe!=null&&(t=Oe.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(n=Oe.__PosthogExtensions__)!=null&&n.initSessionRecording?this.lo(e):(i=Oe.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.uo,(a=>{if(a)return Mi.error("could not load recorder",a);this.lo(e)})))}stopRecording(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.stop()}ho(){var e,t;(e=this.so)==null||e.call(this),this.so=void 0,(t=this.io)==null||t.discard()}do(){var e,t;(e=this.mi)==null||e.unregister(Gg),(t=this.mi)==null||t.unregister(Z5)}co(e,t){if(We(e))return null;var n,i=Cn(e)?e:parseFloat(e);return typeof(n=i)!="number"||!Number.isFinite(n)||0>n||n>1?(Mi.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}vo(e){if(this.mi){var t,n,i=this.mi,a=()=>{var o,u=e.sessionRecording===!1?void 0:e.sessionRecording,f=this.co((o=this.Te.session_recording)==null?void 0:o.sampleRate,"session_recording.sampleRate"),h=this.co(u==null?void 0:u.sampleRate,"remote config sampleRate"),p=f??h;We(p)&&this.do();var g=u==null?void 0:u.minimumDurationMilliseconds;i.register({[ma]:pe({cache_timestamp:Date.now(),enabled:!!u},u,{networkPayloadCapture:pe({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:_e(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})})};a(),(t=this.so)==null||t.call(this),this.so=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(a)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.vo(t),void this.ho()):(this.vo(t),void this.startIfEnabledOrStop()):(this.no===Vo&&(this.no=ud,Mi.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.io)!=null&&n.log?this.io.log(e,t):Mi.warn("log called before recorder was ready")}get uo(){var e,t,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ma);return(n==null||(t=n.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}fo(){var e,t,n=this._instance.get_property(ma);if(!n)return!1;try{t=typeof n=="object"?n:JSON.parse(n)}catch(a){return Mi.warn("persisted remote config for session recording is invalid and will be ignored",a),!1}var i=(e=t.cache_timestamp)!==null&&e!==void 0?e:Date.now();return 36e5>=Date.now()-i}lo(e){var t,n;if((t=Oe.__PosthogExtensions__)==null||!t.initSessionRecording)return Mi.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[aw]:!0});if(this.io||(this.io=(n=Oe.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.io._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.fo())return this.no===ud||this.no===Vo?void 0:(this.no=Vo,Mi.info("persisted remote config is stale, requesting fresh config before starting"),void new Dw(this._instance).load());this.no=My,this.io.start(e)}onRRwebEmit(e){var t;(t=this.io)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.io||(t=this.mi)==null||t.register({[ew]:!0}),(e=this.io)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.io||(t=this.mi)==null||t.register({[J5]:!0}),(e=this.io)==null||e.overrideSampling()}overrideTrigger(e){var t,n;this.io||(n=this.mi)==null||n.register({[e==="url"?tw:nw]:!0}),(t=this.io)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.io)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var n;return!((n=this.io)==null||!n.tryAddCustomEvent(e,t))}}},C4={autocapture:class{constructor(e){this.po=!1,this.mo=null,this.yo=!1,this.bo=!1,this.instance=e,this.rageclicks=new Cy(e.config.rageclick),this._o=null}initialize(){this.startIfEnabled()}get Te(){var e,t,n=It(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}wo(){if(this.isBrowserSupported()){if(ie&&Ce){var e=n=>{n=n||(ie==null?void 0:ie.event);try{this.xo(n)}catch(i){em.error("Failed to capture event",i)}};if(Qt(Ce,"submit",e,{capture:!0}),Qt(Ce,"change",e,{capture:!0}),Qt(Ce,"click",e,{capture:!0}),this.Te.capture_copied_text){var t=n=>{n=n||(ie==null?void 0:ie.event);try{this.xo(n,Jp)}catch(i){em.error("Failed to capture copy/cut event",i)}};Qt(Ce,"copy",t,{capture:!0}),Qt(Ce,"cut",t,{capture:!0})}}}else em.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.po&&(this.wo(),this.po=!0)}onRemoteConfig(e){if(this.yo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.bo=t.elementsChainAsString);var n=t.autocapture_opt_out;Wr(n)&&(this.instance.persistence&&this.instance.persistence.register({[Gm]:n}),this.mo=n),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this._o=e}getElementSelectors(e){var t,n=[];return(t=this._o)==null||t.forEach((i=>{var a=Ce==null?void 0:Ce.querySelectorAll(i);a==null||a.forEach((o=>{e===o&&n.push(i)}))})),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[Gm],i=this.mo,a=this.instance.Ur()&&!this.yo;if(In(i)&&!Wr(n)&&!a)return!1;var o=(t=this.mo)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!o}xo(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,i=Hp(e);fw(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())&&ly(i,this.instance.config.rageclick)&&this.xo(e,"$rageclick");var a=t===Jp;if(i&&(function(x,b,y,_,j,N){var k;if(!ie||Kg(x)||y!=null&&y.url_allowlist&&!iy(y.url_allowlist,N)||y!=null&&y.url_ignorelist&&iy(y.url_ignorelist,N))return!1;if(y!=null&&y.dom_event_allowlist){var A=y.dom_event_allowlist;if(A&&!A.some(($=>b.type===$)))return!1}var C=vw(x,_),L=C.parentIsUsefulElement,D=C.targetElementList;if(!(function($,G){var O=G==null?void 0:G.element_allowlist;if(_e(O))return!0;var I,T=function(J){if(O.some((W=>J.tagName.toLowerCase()===W)))return{v:!0}};for(var ae of $)if(I=T(ae))return I.v;return!1})(D,y)||!ug(D,y==null?void 0:y.css_selector_allowlist)||ug(D,(k=y==null?void 0:y.css_selector_ignorelist)!==null&&k!==void 0?k:CC))return!1;try{var z=ie.getComputedStyle(x);if(z&&z.getPropertyValue("cursor")==="pointer"&&b.type==="click")return!0}catch{}var q=x.tagName.toLowerCase();switch(q){case"html":return!1;case"form":return(j||["submit"]).indexOf(b.type)>=0;case"input":case"select":case"textarea":return(j||["change","click"]).indexOf(b.type)>=0;default:return L?(j||["click"]).indexOf(b.type)>=0:(j||["click"]).indexOf(b.type)>=0&&(Xg.indexOf(q)>-1||x.getAttribute("contenteditable")==="true")}})(i,e,this.Te,a,a?["copy","cut"]:void 0,this.instance)){var o=x4(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Te.element_attribute_ignorelist,elementsChainAsString:this.bo,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),u=o.props;if(o.explicitNoCapture)return!1;var f=this.getElementSelectors(i);if(f&&f.length>0&&(u.$element_selectors=f),t===Jp){var h,p=mw(ie==null||(h=ie.getSelection())==null?void 0:h.toString()),g=e.type||"clipboard";if(!p)return!1;u.$selected_content=p,u.$copy_type=g}return this.instance.capture(t,u),!0}}}isBrowserSupported(){return Gr(Ce==null?void 0:Ce.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.ko=(ie==null||(t=ie.location)==null?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Se.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.So&&this.So(),this.So=void 0,Se.info("History API monitoring stopped")}monitorHistoryChanges(){ie&&ie.history&&(this.Co("pushState"),this.Co("replaceState"),this.To())}Co(e){var t;if(ie&&((t=ie.history[e])==null||!t.__posthog_wrapped__)){var n=this;(function(i,a,o){try{if(!(a in i))return Ey;var u={next:i[a]},f=o((function(){for(var h=arguments.length,p=new Array(h),g=0;h>g;g++)p[g]=arguments[g];return u.next.apply(this,p)}));return Gr(f)&&(f.prototype=f.prototype||{},Object.defineProperties(f,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:u}})),i[a]=f,()=>{if(i[a]!==f)for(var h=i[a];Gr(h)&&h.__posthog_layer__;){var p=h.__posthog_layer__;if(p.next===f)return void(p.next=u.next);h=p.next}else i[a]=u.next}}catch{return Ey}})(ie.history,e,(i=>function(a,o,u){i.call(this,a,o,u),n.Io(e)}))}}Io(e){try{var t,n=ie==null||(t=ie.location)==null?void 0:t.pathname;if(!n)return;n!==this.ko&&this.isEnabled&&this._instance.capture(vl,{navigation_type:e}),this.ko=n}catch(i){Se.error("Error capturing "+e+" pageview",i)}}To(){if(!this.So){var e=()=>{this.Io("popstate")};Qt(ie,"popstate",e),this.So=()=>{ie&&ie.removeEventListener("popstate",e)}}}},heatmaps:class{get Te(){return this.instance.config}constructor(e){var t;this.Mo=!1,this.po=!1,this.Eo=null,this.instance=e,this.Mo=!((t=this.instance.persistence)==null||!t.props[Ym]),this.rageclicks=new Cy(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return It(this.Te.capture_heatmaps)&&this.Te.capture_heatmaps.flush_interval_milliseconds&&(e=this.Te.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return We(this.Te.capture_heatmaps)?We(this.Te.enable_heatmaps)?this.Mo:this.Te.enable_heatmaps:this.Te.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.po)return;b4.info("starting..."),this.Ro(),this.ke()}else{var e;clearInterval((e=this.Eo)!==null&&e!==void 0?e:void 0),this.Po(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ym]:n}),this.Mo=n,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Oo(e){nm(e.originalEvent)&&this.pe(e.originalEvent,"deadclick")}ke(){this.Eo&&clearInterval(this.Eo),this.Eo=(Ce==null?void 0:Ce.visibilityState)==="visible"?setInterval(this.oi.bind(this),this.flushIntervalMilliseconds):null}Ro(){ie&&Ce&&(this.Fo=this.oi.bind(this),Qt(ie,Qd,this.Fo),this.Lo=e=>this.pe(e||(ie==null?void 0:ie.event)),Qt(Ce,"click",this.Lo,{capture:!0}),this.$o=e=>this.Ao(e||(ie==null?void 0:ie.event)),Qt(Ce,"mousemove",this.$o,{capture:!0}),this.No=new uy(this.instance,zC,this.Oo.bind(this)),this.No.startIfEnabledOrStop(),this.Do=this.ke.bind(this),Qt(Ce,Wd,this.Do),this.po=!0)}Po(){var e;ie&&Ce&&(this.Fo&&ie.removeEventListener(Qd,this.Fo),this.Lo&&Ce.removeEventListener("click",this.Lo,{capture:!0}),this.$o&&Ce.removeEventListener("mousemove",this.$o,{capture:!0}),this.Do&&Ce.removeEventListener(Wd,this.Do),clearTimeout(this.qo),(e=this.No)==null||e.stop(),this.po=!1)}jo(e,t){var n=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=(function(u,f,h){for(var p=u;p&&Ts(p)&&!pr(p,"body");){if(p===h)return!1;var g=void 0;try{var x,b,y;g=(x=(b=(y=p.ownerDocument)==null?void 0:y.defaultView)!==null&&b!==void 0?b:ie)==null?void 0:x.getComputedStyle(p).position}catch{return!1}if(qe(f,g))return!0;p=gw(p)}return!1})(Hp(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:n),target_fixed:o,type:t}}pe(e,t){var n;if(t===void 0&&(t="click"),!ry(e.target)&&nm(e)){var i=this.jo(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ly(Hp(e),this.instance.config.rageclick)&&this.Nt(pe({},i,{type:"rageclick"})),this.Nt(i)}}Ao(e){!ry(e.target)&&nm(e)&&(clearTimeout(this.qo),this.qo=setTimeout((()=>{this.Nt(this.jo(e,"mousemove"))}),500))}Nt(e){if(ie){var t=this.Te.disable_capture_url_hashes?Es(ie.location.href):ie.location.href,n=this.Te.custom_personal_data_properties,i=this.Te.mask_personal_data_properties?[...Al,...n||[]]:[],a=Sc(t,i,kc);this.R=this.R||{},this.R[a]||(this.R[a]=[]),this.R[a].push(e)}}oi(){this.R&&!js(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:uy,webVitalsAutocapture:class{constructor(e){var t;this.Mo=!1,this.po=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Ho=()=>{clearTimeout(this.Bo),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((n,i)=>pe({},n,{["$web_vitals_"+i.name+"_event"]:pe({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Uo=n=>{var i;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.zo();if(!_e(a))if(We(n==null?void 0:n.name)||We(n==null?void 0:n.value))sa.error("Invalid metric received",n);else if(!this.Vo||this.Vo>n.value){this.R.url!==a&&(this.Ho(),this.Bo=setTimeout(this.Ho,this.flushToCaptureTimeoutMs)),_e(this.R.url)&&(this.R.url=a),this.R.firstMetricTimestamp=_e(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0);var o=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0),u=pe({},n,{$current_url:a,timestamp:Date.now()});_e(o)||(u.$session_id=o.sessionId,u.$window_id=o.windowId),this.R.metrics.push(u),this.R.metrics.length===this.allowedMetrics.length&&this.Ho()}else sa.error("Ignoring metric with value >= "+this.Vo,n)},this.Wo=()=>{if(!this.po){var n,i,a,o,u=Oe.__PosthogExtensions__;if(!_e(u)&&!_e(u.postHogWebVitalsCallbacks)){var f=u.postHogWebVitalsCallbacks;n=f.onLCP,i=f.onCLS,a=f.onFCP,o=f.onINP}n&&i&&a&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Uo.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Uo.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Uo.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Uo.bind(this)),this.po=!0):sa.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Mo=!((t=this._instance.persistence)==null||!t.props[Km]),this.startIfEnabled()}get Zo(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,n=It(this.Zo)?(e=this.Zo)==null?void 0:e.web_vitals_allowed_metrics:void 0;return We(n)?((t=this._instance.persistence)==null?void 0:t.props[Zm])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(It(this.Zo)?this.Zo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=It(this.Zo)?this.Zo.web_vitals_attribution:void 0;return e!=null&&e}get Vo(){var e=It(this.Zo)&&Cn(this.Zo.__web_vitals_max_value)?this.Zo.__web_vitals_max_value:Ty;return e>0&&6e4>=e?Ty:e}get isEnabled(){var e=an==null?void 0:an.protocol;if(e!=="http:"&&e!=="https:")return sa.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=It(this.Zo)?this.Zo.web_vitals:Wr(this.Zo)?this.Zo:void 0;return Wr(t)?t:this.Mo}startIfEnabled(){this.isEnabled&&!this.po&&(sa.info("enabled, starting..."),this.er(this.Wo))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var n=It(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=It(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Km]:n}),this._instance.persistence.register({[Zm]:i})),this.Mo=n,this.startIfEnabled()}}}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?sa.error("failed to load script",i):e()}))}zo(){var e=ie?this._instance.config.disable_capture_url_hashes?Es(ie.location.href):ie.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Al,...t||[]]:[];return Sc(e,n,kc)}sa.error("Could not determine current URL")}}},E4={exceptionObserver:class{constructor(e){var t;this.Wo=()=>{var n;if(ie&&this.isEnabled&&(n=Oe.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var i=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=Oe.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Go&&this.Te.capture_unhandled_errors&&(this.Go=i(this.captureException.bind(this))),!this.Qo&&this.Te.capture_unhandled_rejections&&(this.Qo=a(this.captureException.bind(this))),!this.Jo&&this.Te.capture_console_errors&&(this.Jo=o(this.captureException.bind(this)))}catch(u){qo.error("failed to start",u),this.Ko()}}},this._instance=e,this.Yo=!((t=this._instance.persistence)==null||!t.props[Wm]),this.Xo=new T3(pe({},(function(n){var i,a,o,u;return n===void 0&&(n={}),{refillRate:(i=(a=n.exceptionRateLimiterRefillRate)!==null&&a!==void 0?a:n.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(o=(u=n.exceptionRateLimiterBucketSize)!==null&&u!==void 0?u:n.__exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:10}})(this._instance.config.error_tracking),{refillInterval:1e4,Ge:qo})),this.Te=this.ea(),this.startIfEnabledOrStop()}ea(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return It(e)?t=pe({},t,e):(_e(e)?this.Yo:e)&&(t=pe({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Te.capture_console_errors||this.Te.capture_unhandled_errors||this.Te.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(qo.info("enabled"),this.Ko(),this.er(this.Wo)):this.Ko()}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.errorWrappingFunctions?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return qo.error("failed to load script",i);e()}))}Ko(){var e,t,n;(e=this.Go)==null||e.call(this),this.Go=void 0,(t=this.Qo)==null||t.call(this),this.Qo=void 0,(n=this.Jo)==null||n.call(this),this.Jo=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.Yo=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Wm]:this.Yo}),this.Te=this.ea(),this.startIfEnabledOrStop())}}onConfigChange(){this.Te=this.ea()}captureException(e){var t,n,i,a=(t=e==null||(n=e.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&t!==void 0?t:"Exception";this.Xo.consumeRateLimit(a)?qo.info("Skipping exception capture because of client rate limiting.",{exception:a}):(i=this._instance.exceptions)==null||i.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,n;this.ta=[],this.ra=new G3([new eC,new cC,new nC,new tC,new lC,new aC,new iC,new oC],(function(i){for(var a=arguments.length,o=new Array(a>1?a-1:0),u=1;a>u;u++)o[u-1]=arguments[u];return function(f,h){h===void 0&&(h=0);for(var p=[],g=f.split(`
|
|
64
|
+
`),x=h;g.length>x;x++){var b=g[x];if(1024>=b.length){var y=Jb.test(b)?b.replace(Jb,"$1"):b;if(!y.match(/\S*Error: /)){for(var _ of o){var j=_(y,i);if(j){p.push(j);break}}if(p.length>=50)break}}}return(function(N){if(!N.length)return[];var k=Array.from(N);return k.reverse(),k.slice(0,50).map((A=>{return pe({},A,{filename:A.filename||(C=k,C[C.length-1]||{}).filename,function:A.function||El});var C}))})(p)}})("web:javascript",X3,J3)),this._instance=e,this.ta=(t=(n=this._instance.persistence)==null?void 0:n.get_property(Qm))!==null&&t!==void 0?t:[],this.ia=Hd(this.na()),this.sa=new dC(this.ia)}onConfigChange(){this.ia=Hd(this.na()),this.sa.setConfig(this.ia)}onRemoteConfig(e){var t,n,i;if(e.ok){var a=e.config;if("errorTracking"in a){var o=(t=(n=a.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[],u=(i=a.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ta=o,this._instance.persistence&&this._instance.persistence.register({[Qm]:this.ta,[Xm]:u})}}}get oa(){var e,t=!!this._instance.get_property(Xm),n=this._instance.config.error_tracking.captureExtensionExceptions;return(e=n??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ra.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.ia.enabled)try{if(!Mt(e)||e.trim().length===0)return void Ri.warn("Ignoring exception step because message must be a non-empty string");var n=(function(o){if(!o)return{sanitizedProperties:{},droppedKeys:[]};var u=[];return{sanitizedProperties:Object.keys(o).reduce(((f,h)=>uC.has(h)?(u.push(h),f):(f[h]=o[h],f)),{}),droppedKeys:u}})(this.aa(t)),i=n.sanitizedProperties,a=n.droppedKeys;a.length>0&&Ri.warn("Ignoring reserved exception step fields",{droppedKeys:a}),this.sa.add(pe({[Fd]:e,[Ud]:new Date().toISOString()},i))}catch(o){Ri.error("Failed to add exception step. Ignoring breadcrumb.",o)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.la(t)){if(this.ua(t))return this.ha("Exception dropped: matched a suppression rule"),void Ri.info("Skipping exception capture because a suppression rule matched");if(!this.oa&&this.da(t))return this.ha("Exception dropped: thrown by a browser extension"),void Ri.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ca(t))return this.ha("Exception dropped: thrown by the PostHog SDK"),void Ri.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.ia.enabled&&We(e.$exception_steps)?this.va(e):e;try{var i=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",kn:!0});return i&&this.sa.clear(),i}catch(a){return Ri.error("Failed to capture exception event. Dropping this exception.",a),void this.sa.clear()}}catch(a){return void Ri.error("Failed to process exception event. Ignoring this exception.",a)}}va(e){try{var t=this.sa.getAttachable();return t.length===0?e:pe({},e,{$exception_steps:t})}catch(n){return Ri.error("Failed to read buffered exception steps. Capturing exception without steps.",n),e}}ha(e){this.ia.enabled&&this.sa.add({[Fd]:e,[Ud]:new Date().toISOString()})}aa(e){return It(e)?pe({},e):{}}na(){var e,t;return(e=(t=this._instance.config.error_tracking)==null?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ua(e){if(e.length===0)return!1;var t=e.reduce(((n,i)=>{var a=i.type,o=i.value;return Mt(a)&&a.length>0&&n.$exception_types.push(a),Mt(o)&&o.length>0&&n.$exception_values.push(o),n}),{$exception_types:[],$exception_values:[]});return this.ta.some((n=>{var i=n.values.map((a=>{var o,u=Yw[a.operator],f=Ge(a.value)?a.value:[a.value],h=(o=t[a.key])!==null&&o!==void 0?o:[];return f.length>0&&u(f,h)}));return n.type==="OR"?i.some(Boolean):i.every(Boolean)}))}da(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://")))}ca(e){if(e.length>0){var t,n,i,a,o=(t=(n=e[0].stacktrace)==null?void 0:n.frames)!==null&&t!==void 0?t:[],u=o[o.length-1];return(i=u==null||(a=u.filename)==null?void 0:a.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}la(e){return!We(e)&&Ge(e)}}},T4=pe({productTours:class{get mi(){return this._instance.persistence}constructor(e){this.fa=null,this.pa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t=e.config;if("productTours"in t){var n,i;if(this.mi&&this.mi.register({[Vg]:!!t.productTours}),!im(this._instance))return!this.fa&&We((n=this.mi)==null?void 0:n.props[nc])||rm.info("product tours disabled; stopping and clearing cached tours"),(i=this.fa)==null||i.stop(),this.fa=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.fa&&im(this._instance)&&this.er((()=>this.ga()))}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.generateProductTours?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",(i=>{i?rm.error("Could not load product tours script",i):e()}))}ga(){var e;!this.fa&&(e=Oe.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.fa=Oe.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!Ge(this.pa)||t){var n=this.mi;if(n){var i=n.props[nc];if(Ge(i)&&!t)return this.pa=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",timestampMode:"query",callback:a=>{if(im(this._instance)){var o=a.statusCode;if(o!==200||!a.json){var u="Product Tours API could not be loaded, status: "+o;return rm.error(u),void e([],{isLoaded:!1,error:u})}var f=Ge(a.json.product_tours)?a.json.product_tours:[];this.pa=f,n&&n.register({[nc]:f}),e(f,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.pa,{isLoaded:!0})}getActiveProductTours(e){We(this.fa)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.fa.getActiveProductTours(e)}showProductTour(e){var t;(t=this.fa)==null||t.showTourById(e)}previewTour(e){this.fa?this.fa.previewTour(e):this.er((()=>{var t;this.ga(),(t=this.fa)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.fa)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.fa)==null||e.nextStep()}previousStep(){var e;(e=this.fa)==null||e.previousStep()}clearCache(){var e;this.pa=null,(e=this.mi)==null||e.unregister(nc)}resetTour(e){var t;(t=this.fa)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.fa)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.fa)==null||t.cancelPendingTour(e)}}},pf),A4={siteApps:class{constructor(e){this.ma=0,this._instance=e,this.ya=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ba(e,t){if(t){var n=this.globalsForEvent(t);this.ya.push(n),this.ya.length>1e3&&(this.ya=this.ya.slice(10))}}get siteAppLoaders(){var e;return(e=Oe._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.ba.bind(this));this._a=()=>{e(),this.ya=[],this._a=void 0}}}globalsForEvent(e){var t,n,i,a,o,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 x of Object.entries(g)){var b=x[0];h[b]={id:p[b],type:b,properties:x[1]}}var y=e.$set_once,_=e.$set;return{event:pe({},v5(e,y4),{properties:pe({},e.properties,_?{$set:pe({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},_)}:{},y?{$set_once:pe({},(i=(a=e.properties)==null?void 0:a.$set_once)!==null&&i!==void 0?i:{},y)}:{}),elements_chain:(o=(u=e.properties)==null?void 0:u.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(f=e.properties)==null?void 0:f.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}wa(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)||(ai.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)||(ai.error("prepare_external_dependency_script returned null"),null):e}xa(){var e,t,n,i,a,o,u,f;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=Ce==null?void 0:Ce.defaultView,p=h==null||(e=h.Node)==null?void 0:e.prototype;if(!h||!p)return()=>{};if(this.ma++,this.ka)return this.Sa();var g=[],x=this,b=new WeakSet,y=(N,k,A)=>{if(N!=null&&N[k]){var C=N[k];N[k]=A(C),g.push((()=>{N[k]=C}))}},_=N=>{if(b.has(N))return N;var k=x.wa(N);return k&&b.add(k),k},j=N=>N.map((k=>typeof k=="string"?k:_(k))).filter((k=>!In(k)));return y(p,"appendChild",(N=>function(k){var A=_(k);return A?N.call(this,A):k})),y(p,"insertBefore",(N=>function(k,A){var C=_(k);return C?N.call(this,C,A):k})),y(p,"replaceChild",(N=>function(k,A){var C=_(k);return C?N.call(this,C,A):A})),[(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((N=>{y(N,"append",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"prepend",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))}))})),[(a=h.Element)==null?void 0:a.prototype,(o=h.CharacterData)==null?void 0:o.prototype,(u=h.DocumentType)==null?void 0:u.prototype].forEach((N=>{y(N,"before",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"after",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];return k.apply(this,j(C))})),y(N,"replaceWith",(k=>function(){for(var A=arguments.length,C=new Array(A),L=0;A>L;L++)C[L]=arguments[L];var D=j(C);return C.length&&!D.length?void 0:k.apply(this,D)}))})),y((f=h.Element)==null?void 0:f.prototype,"insertAdjacentElement",(N=>function(k,A){var C=_(A);return C?N.call(this,k,C):null})),this.ka=()=>{g.forEach((N=>N())),this.ka=void 0},this.Sa()}Sa(){var e=!1;return()=>{var t;e||(e=!0,this.ma--,this.ma===0&&((t=this.ka)==null||t.call(this)))}}Ca(e,t){t===void 0&&(t=!0);var n=this.xa();try{var i=e(n);return t&&n(),i}catch(a){throw n(),a}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var u;!t.errored&&this.ya.length&&(ai.info("Processing "+this.ya.length+" events for site app with id "+e.id),this.ya.forEach((f=>this.Ca((()=>t.processEvent==null?void 0:t.processEvent(f))))),t.processedBuffer=!0),Object.values(this.apps).every((f=>f.processedBuffer||f.errored))&&((u=this._a)==null||u.call(this))},i=!1,a=u=>{t.errored=!u,t.loaded=!0,ai.info("Site app with id "+e.id+" "+(u?"loaded":"errored")),i&&n()};try{var o=this.Ca((u=>e.init({posthog:this._instance,callback(f){u(),a(f)}})),!1).processEvent;o&&(t.processEvent=o),i=!0}catch(u){ai.error(Ry+e.id,u),a(!1)}if(i&&t.loaded)try{n()}catch(u){ai.error("Error while processing buffered events PostHog app with config id "+e.id,u),t.errored=!0}}Ta(){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)}Ia(e){var t=this;if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e),i=function(o){try{t.Ca((()=>o.processEvent==null?void 0:o.processEvent(n)))}catch(u){ai.error("Error while processing event "+e.event+" for site app "+o.id,u)}};for(var a of Object.values(this.apps))i(a)}}onRemoteConfig(e){var t,n,i,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.Ta(),void this._instance.on("eventCaptured",(h=>this.Ia(h)))):void ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this._a)==null||n.call(this),e.ok){var o=e.config;if((i=o.siteApps)!=null&&i.length)if(this.isEnabled){var u=function(){var h,p=f.id,g=f.url;Oe["__$$ph_site_app_"+p]=a._instance,(h=Oe.__PosthogExtensions__)==null||h.loadSiteApp==null||h.loadSiteApp(a._instance,g,(x=>{if(x)return ai.error(Ry+p,x)}))};for(var f of o.siteApps)u()}else ai.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},M4={tracingHeaders:class{constructor(e){this.Ma=void 0,this.Ea=void 0,this.Ra=void 0,this.Wo=()=>{var t,n,i=this.Pa();i?(_e(this.Ma)&&(this.Ma=(t=Oe.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),_e(this.Ea)&&(this.Ea=(n=Oe.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null?void 0:n._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ko()},this._instance=e}initialize(){this.startIfEnabledOrStop()}er(e){var t,n;(t=Oe.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns?e():(n=Oe.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return v4.error("failed to load script",i);e()}))}Oa(){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}Pa(){var e=this.Oa();return Ge(e)?(Ge(this.Ra)?this.Ra.splice(0,this.Ra.length,...e):this.Ra=[...e],e.length>0?this.Ra:void 0):(Ge(this.Ra)&&this.Ra.splice(0),this.Ra=e||void 0,this.Ra)}Ko(){var e,t;(e=this.Ma)==null||e.call(this),(t=this.Ea)==null||t.call(this),this.Ma=void 0,this.Ea=void 0}startIfEnabledOrStop(){this.Pa()?this.er(this.Wo):this.Ko()}}},R4=pe({surveys:class{get Te(){return this._instance.config}constructor(e){this.Fa=void 0,this._surveyManager=null,this.La=!1,this.$a=[],this.Aa=null,this.Na=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Te.disable_surveys){if(!e.ok)return Ct.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(We(t))return Ct.warn("Flags not loaded yet. Not loading surveys.");var n=Ge(t);this.Fa=n?t.length>0:t,Ct.info("flags response received, isSurveysEnabled: "+this.Fa),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(Xw)||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((a=>localStorage.removeItem(a)))}catch{}}loadIfEnabled(){if(!this._surveyManager)if(this.La)Ct.info("Already initializing surveys, skipping...");else if(this.Te.disable_surveys)Ct.info(Ly);else if(this.Te.cookieless_mode&&this._instance.consent.isOptedOut())Ct.info("Not loading surveys in cookieless mode without consent.");else{var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){if(!_e(this.Fa)||this.Te.advanced_enable_surveys){var t=this.Fa||this.Te.advanced_enable_surveys;this.La=!0;try{var n=e.generateSurveys;if(n)return void this.Da(n,t);var i=e.loadExternalDependency;if(!i)return void this.qa(Yg);i(this._instance,"surveys",(a=>{a||!e.generateSurveys?this.qa("Could not load surveys script",a):this.Da(e.generateSurveys,t)}))}catch(a){throw this.qa("Error initializing surveys",a),a}finally{this.La=!1}}}else Ct.error("PostHog Extensions not found.")}}Da(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new S4(this._instance),Ct.info("Surveys loaded successfully"),this.ja({isLoaded:!0})}qa(e,t){Ct.error(e,t),this.ja({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.$a.push(e),this._surveyManager&&this.ja({isLoaded:!0}),()=>{this.$a=this.$a.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this.Te.disable_surveys)return Ct.info(Ly),e([]);var n,i=this._instance.get_property(tg);if(i&&!t)return e(i,{isLoaded:!0}),void(this.Ha()&&this.getSurveys((()=>{}),!0));typeof Promise<"u"&&this.Aa?this.Aa.then((a=>e(a.surveys,a.context))):(typeof Promise<"u"&&(this.Aa=new Promise((a=>{n=a}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Te.token),method:"GET",timestampMode:"query",timeout:this.Te.surveys_request_timeout_ms,callback:a=>{var o;this.Aa=null;var u=a.statusCode;if(u!==200||!a.json){var f="Surveys API could not be loaded, status: "+u;Ct.error(f),this.Na=Date.now();var h={isLoaded:!1,error:f};return e([],h),void(n==null||n({surveys:[],context:h}))}this.Na=null;var p,g=a.json.surveys||[],x=g.filter((y=>(function(_){return!(!_.start_date||_.end_date)})(y)&&(Qw(y)||(function(_){var j;return!((j=_.conditions)==null||(j=j.actions)==null||(j=j.values)==null||!j.length)})(y))));x.length>0&&((p=this._surveyEventReceiver)==null||p.register(x)),(o=this._instance.persistence)==null||o.register({[tg]:g,[Vd]:Date.now()});var b={isLoaded:!0};e(g,b),n==null||n({surveys:g,context:b})}}))}Ha(){return this.Ba()&&!this.Aa&&!this.Ua()}Ba(){var e=this._instance.get_property(Vd);return Cn(e)&&Date.now()-e>3e5}Ua(){return Cn(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(e,t){var n,i={id:e,current_iteration:(n=t==null?void 0:t.iteration)!==null&&n!==void 0?n:null};Kw(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}ja(e){for(var t of this.$a)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(n){Ct.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!We(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ct.warn("init was not called")}za(e){var t=null;return this.getSurveys((n=>{var i;t=(i=n.find((a=>a.id===e)))!==null&&i!==void 0?i:null})),t}Va(e){if(We(this._surveyManager))return{eligible:!1,reason:dd};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wa(e){if(We(this._surveyManager))return{eligible:!1,reason:dd};var t=typeof e=="string"?this.za(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(We(this._surveyManager))return Ct.warn("init was not called"),{visible:!1,disabledReason:dd};var t=this.Wa(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return We(this._surveyManager)?(Ct.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dd})):new Promise((n=>{this.getSurveys((i=>{var a,o=(a=i.find((f=>f.id===e)))!==null&&a!==void 0?a:null;if(o){var u=this.Wa(o);n({visible:u.eligible,disabledReason:u.reason})}else n({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,n){var i;if(We(this._surveyManager))Ct.warn("init was not called");else{var a=typeof e=="string"?this.za(e):e;if(a!=null&&a.id)if(o4.includes(a.type)){var o=Ce==null?void 0:Ce.querySelector(t);if(o)return(i=a.appearance)!=null&&i.surveyPopupDelaySeconds?(Ct.info("Rendering survey "+a.id+" with delay of "+a.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var u,f;Ct.info("Rendering survey "+a.id+" with delay of "+((u=a.appearance)==null?void 0:u.surveyPopupDelaySeconds)+" seconds"),(f=this._surveyManager)==null||f.renderSurvey(a,o,n),Ct.info("Survey "+a.id+" rendered")}),1e3*a.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(a,o,n);Ct.warn("Survey element not found")}else Ct.warn("Surveys of type "+a.type+" cannot be rendered in the app");else Ct.warn("Survey not found")}}displaySurvey(e,t){var n;if(We(this._surveyManager))Ct.warn("init was not called");else{var i=this.za(e);if(i){var a=i;if((n=i.appearance)!=null&&n.surveyPopupDelaySeconds&&t.ignoreDelay&&(a=pe({},i,{appearance:pe({},i.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==fg.Popover&&t.initialResponses&&Ct.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.Va(i);if(!o.eligible)return void Ct.warn("Survey is not eligible to be displayed: ",o.reason)}t.displayType!==fg.Inline?this._surveyManager.handlePopoverSurvey(a,t):this.renderSurvey(a,t.selector,t.properties)}else Ct.warn("Survey not found")}}cancelPendingSurvey(e){We(this._surveyManager)?Ct.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload==null||e.handlePageUnload()}}},pf),L4={toolbar:class{constructor(e){this.instance=e}Za(e){Oe.ph_toolbar_state=e}Ga(){var e;return(e=Oe.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),lw(this.instance.config)||!ie||!Ce)return!1;e=e??ie.location,n=n??ie.history;try{if(!t){try{ie.localStorage.setItem("test","test"),ie.localStorage.removeItem("test")}catch{return!1}t=ie==null?void 0:ie.localStorage}var i,a=k4||Jd(e.hash,"__posthog")||Jd(e.hash,"state"),o=a?ty((()=>JSON.parse(atob(decodeURIComponent(a)))))||ty((()=>JSON.parse(decodeURIComponent(a)))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(t.getItem(Dy)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token||(this.loadToolbar(i),0))}catch{return!1}}Qa(e){var t=Oe.ph_load_toolbar||Oe.ph_load_editor;!We(t)&&Gr(t)?t(e,this.instance):zy.warn("No toolbar load function found")}loadToolbar(e){var t=!(Ce==null||!Ce.getElementById(dw));if(!ie||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=pe({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(ie.localStorage.setItem(Dy,JSON.stringify(pe({},i,{source:void 0}))),this.Ga()===2)this.Qa(i);else if(this.Ga()===0){var a;this.Za(1),(a=Oe.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return zy.error("[Toolbar] Failed to load",o),void this.Za(0);this.Za(2),this.Qa(i)})),Qt(ie,"turbolinks:load",(()=>{this.Za(0),this.loadToolbar(i)}))}return!0}Ja(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)}}},D4=pe({experiments:Mn},pf),z4={conversations:class{constructor(e){this.Ka=void 0,this._conversationsManager=null,this.Ya=!1,this.Xa=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;We(t)||(Wr(t)?this.Ka=t:(this.Ka=t.enabled,this.Xa=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Ka=void 0,this.Xa=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ya||this._instance.config.disable_conversations||lw(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e&&!_e(this.Ka)&&this.Ka)if(this.Xa&&this.Xa.token){this.Ya=!0;try{var t=e.initConversations;if(t)return this.el(t),void(this.Ya=!1);var n=e.loadExternalDependency;if(!n)return void this.tl(Yg);n(this._instance,"conversations",(i=>{i||!e.initConversations?this.tl("Could not load conversations script",i):this.el(e.initConversations),this.Ya=!1}))}catch(i){this.tl("Error initializing conversations",i),this.Ya=!1}}else Mr.error("Conversations enabled but missing token in remote config.")}}el(e){if(this.Xa)try{this._conversationsManager=e(this.Xa,this._instance),Mr.info("Conversations loaded successfully")}catch(t){this.tl("Error completing conversations initialization",t)}else Mr.error("Cannot complete initialization: remote config is null")}tl(e,t){Mr.error(e,t),this._conversationsManager=null,this.Ya=!1}show(){this._conversationsManager?this._conversationsManager.show():Mr.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Ka===!0&&!In(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 tn((function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,n):(Mr.warn(la),null)}))()}getMessages(e,t){var n=this;return tn((function*(){return n._conversationsManager?n._conversationsManager.getMessages(e,t):(Mr.warn(la),null)}))()}markAsRead(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Mr.warn(la),null)}))()}getTickets(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Mr.warn(la),null)}))()}requestRestoreLink(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Mr.warn(la),null)}))()}restoreFromToken(e){var t=this;return tn((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Mr.warn(la),null)}))()}restoreFromUrlToken(){var e=this;return tn((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Mr.warn(la),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}En(){var e;(e=this._conversationsManager)==null||e.setIdentity()}Rn(){var e;(e=this._conversationsManager)==null||e.clearIdentity()}}},O4={logs:class{constructor(e){var t;this.rl=!1,this.il=!1,this.Ge=Vt("[logs]"),this.Gr=[],this.nl=[],this.Hs=0,this.sl=()=>{var n,i;this.Hs=0,(n=this.ol)==null||n.onReconnect(),(i=this.al)==null||i.onReconnect()},this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.rl=!0),ie&&Qt(ie,"online",this.sl)}ll(e,t,n,i){var a,o=(function(u,f){var h,p,g,x,b,y,_,j=(h=u==null?void 0:u.flushIntervalMs)!==null&&h!==void 0?h:3e3,N=(p=u==null?void 0:u.maxBufferSize)!==null&&p!==void 0?p:100,k=f!=null&&f.consoleCapture?void 0:(g=u==null?void 0:u.maxLogsPerInterval)!==null&&g!==void 0?g:1e3,A=_e(k)?Math.max(N,2048):Math.max(N,k),C=u==null?void 0:u.resourceAttributes;return{serviceName:(x=(b=C==null?void 0:C["service.name"])!==null&&b!==void 0?b:u==null?void 0:u.serviceName)!==null&&x!==void 0?x:f==null?void 0:f.serviceNameDefault,serviceVersion:(y=C==null?void 0:C["service.version"])!==null&&y!==void 0?y:u==null?void 0:u.serviceVersion,environment:(_=C==null?void 0:C["deployment.environment"])!==null&&_!==void 0?_:u==null?void 0:u.environment,resourceAttributes:C,beforeSend:u==null?void 0:u.beforeSend,flushIntervalMs:j,maxBufferSize:N,maxQueueSize:A,maxBatchRecordsPerPost:100,rateCapWindowMs:j,maxLogsPerInterval:k,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}})((a=this._instance)==null||(a=a.config)==null?void 0:a.logs,n);return[new I3(this.ul(e,t),o,this.Ge,(()=>this.hl()),(u=>u()),void 0,i),o]}dl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.ol||this.cl!==t){var n;(n=this.ol)==null||n.reset(),this.cl=t;var i=this.ll((()=>this.Gr),(a=>{this.Gr=a}));this.ol=i[0],this.vl=i[1]}return this.ol}fl(){var e,t=(e=this._instance)==null||(e=e.config)==null?void 0:e.logs;if(!this.al||this.pl!==t){var n;(n=this.al)==null||n.reset(),this.pl=t;var i=this.ll((()=>this.nl),(a=>{this.nl=a}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},$y);this.al=i[0],this.gl=i[1]}return this.al}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var n=(t=e.config.logs)==null?void 0:t.captureConsoleLogs;!We(n)&&n&&(this.rl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Gr=[],(e=this.ol)==null||e.reset(),this.nl=[],(t=this.al)==null||t.reset(),this.Hs=0}captureLog(e){this.dl().captureLog(e)}le(e){this.fl().captureLog(e)}get logger(){return this.ml||(this.ml={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.ml}flushLogs(e){e?this.yl(e):(this.ol&&this.ol.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))),this.al&&this.al.flush().catch((t=>this.Ge.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.rl&&!this.il){var e=Oe==null?void 0:Oe.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",(n=>{var i;n||(i=e.logs)==null||!i.initializeLogs?this.Ge.error("Could not load logs script",n):(e.logs.initializeLogs(this._instance),this.il=!0)})):this.Ge.error(Yg)}else this.Ge.error("PostHog Extensions not found.")}}ul(e,t){var n=this._instance;return{get isDisabled(){return!1},get optedOut(){return!n.is_capturing()},getPersistedProperty:i=>i===Bi.LogsQueue?e():void 0,setPersistedProperty(i,a){var o;i===Bi.LogsQueue&&t((o=a)!==null&&o!==void 0?o:[])},Tt:i=>this.Tt(i),getLibraryId:()=>St.LIB_NAME,getLibraryVersion:()=>St.LIB_VERSION}}Tt(e){return new Promise((t=>{if(jw(this.Hs,3))t({kind:"fatal",error:new Error("logs endpoint is unreachable, dropping batch")});else{var n=!1,i=o=>{n||(n=!0,clearTimeout(a),t(o))},a=setTimeout((()=>i({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.bl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:o=>{var u=o.statusCode;if(this._l(u),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=o.error)!==null&&f!==void 0?f:new Error("logs request failed with status "+u)})}}})}}))}_l(e){(e!==0||this._instance.__loaded)&&(this.Hs=Nw(e,this.Hs,3,(()=>this.Ge.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}yl(e){this.Gr.length>0&&this.wl(e,this.Gr,this.vl,St.LIB_NAME,(t=>{this.Gr=t})),this.nl.length>0&&this.wl(e,this.nl,this.gl,$y,(t=>{this.nl=t}))}wl(e,t,n,i,a){if(t.length!==0){var o=t.map((f=>f.record));a([]);var u=Y5(o,G5(n,St.LIB_NAME,St.LIB_VERSION),i,St.LIB_VERSION);this._instance._send_request({method:"POST",url:this.bl(),data:u,compression:"best-available",batchKey:"logs",transport:e})}}bl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}hl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var n=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),i=n.windowId,a=n.sessionStartTimestamp,o=n.lastActivityTimestamp;t.sessionId=n.sessionId,t.windowId=i,We(a)||(t.sessionStartTimestamp=a),We(o)||(t.lastActivityTimestamp=o)}if(Oe!=null&&(e=Oe.location)!=null&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Es(Oe.location.href):Oe.location.href),this._instance.featureFlags){var u=this._instance.featureFlags.getFlags();u&&u.length>0&&(t.activeFeatureFlags=u)}return t}}},B4={metrics:class{constructor(e){this.Ge=Vt("[metrics]"),this._instance=e}initialize(){}dl(){var e,t,n=(e=this._instance)==null||(e=e.config)==null?void 0:e.metrics;return this.ol&&this.cl===n||((t=this.ol)==null||t.reset(),this.cl=n,this.ol=new q3(this.ul(),(function(i){var a,o,u,f,h,p=i==null?void 0:i.resourceAttributes;return{serviceName:(a=p==null?void 0:p["service.name"])!==null&&a!==void 0?a:i==null?void 0:i.serviceName,serviceVersion:(o=p==null?void 0:p["service.version"])!==null&&o!==void 0?o:i==null?void 0:i.serviceVersion,environment:(u=p==null?void 0:p["deployment.environment"])!==null&&u!==void 0?u:i==null?void 0:i.environment,resourceAttributes:p,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(f=i==null?void 0:i.flushIntervalMs)!==null&&f!==void 0?f:1e4,maxSeriesPerFlush:(h=i==null?void 0:i.maxSeriesPerFlush)!==null&&h!==void 0?h:1e3}})(n),this.Ge)),this.ol}count(e,t,n){t===void 0&&(t=1),this.dl().count(e,t,n)}gauge(e,t,n){this.dl().gauge(e,t,n)}histogram(e,t,n){this.dl().histogram(e,t,n)}flush(e){if(!this.ol)return Promise.resolve();if(e){var t=this.ol.drainWindow();return t&&this.Bt(t,e),Promise.resolve()}return this.ol.flush().catch((n=>this.Ge.error("PostHog metrics flush failed:",n)))}reset(){var e;(e=this.ol)==null||e.reset()}ul(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Bt:n=>t.Bt(n),getLibraryId:()=>St.LIB_NAME,getLibraryVersion:()=>St.LIB_VERSION}}Bt(e,t){return new Promise((n=>{var i=!1,a=u=>{i||(i=!0,clearTimeout(o),n(u))},o=setTimeout((()=>a({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(pe({method:"POST",url:this.xl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(u){var f=u.statusCode;if(f>=200&&300>f)a({kind:"ok"});else if(f===413)a({kind:"too-large"});else if(f!==0&&f!==429&&500>f)a({kind:"fatal",error:new Error("metrics request failed with status "+f)});else{var h;a({kind:"retry-later",error:(h=u.error)!==null&&h!==void 0?h:new Error("metrics request failed with status "+f)})}}}))}))}xl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},P4=pe({},pf,N4,C4,E4,T4,A4,R4,M4,L4,D4,z4,O4,B4);Dr.__defaultExtensionClasses=pe({},P4);var jc=(function(){St.SDK_DIST_CHANNEL="npm";var e=dc[bl]=new Dr;return(function(){function t(){t.done||(t.done=!0,Jw=!1,Rt(dc,(function(n){n._dom_loaded()})))}Ce!=null&&Ce.addEventListener?Ce.readyState==="complete"?t():Qt(Ce,"DOMContentLoaded",t,{capture:!1}):ie&&Se.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();const $4="https://us.i.posthog.com",e2="cc-telemetry-enabled";let yg=!1,Nc=!1;function F4(){return $4}function U4(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(e2);return e===null?!0:e==="true"}function t2(e){yg&&(e?(jc.opt_in_capturing({captureEventName:null}),Nc=!0):(jc.opt_out_capturing(),Nc=!1))}function gD(e){typeof localStorage<"u"&&localStorage.setItem(e2,String(e)),t2(e)}function H4(){const e=void 0;return e?(jc.init(e,{api_host:F4(),defaults:"2026-01-30",capture_pageview:!1,capture_pageleave:!0,capture_exceptions:!0,autocapture:!0,respect_dnt:!0}),yg=!0,t2(U4()),!0):(yg=!1,Nc=!1,!1)}function nx(e,t){Nc&&jc.capture(e,t)}function As(e,t){Nc&&jc.captureException(e,t)}function I4(e){nx("$pageview",{$current_url:e})}const ui="/api",n2="companion_auth_token";function Ms(){if(typeof window>"u")return{};const e=localStorage.getItem(n2);return e?{Authorization:`Bearer ${e}`}:{}}function ba(e){e===401&&typeof window<"u"&&(localStorage.removeItem(n2),qn(async()=>{const{useStore:t}=await Promise.resolve().then(()=>uN);return{useStore:t}},void 0).then(({useStore:t})=>{t.getState().logout()}).catch(()=>{}))}function pn(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Mc(e,t,n,i){nx("api_request_succeeded",{method:e,path:t,status:i,duration_ms:Math.round(n)})}function di(e,t,n,i,a){nx("api_request_failed",{method:e,path:t,status:a,duration_ms:Math.round(n),error:i instanceof Error?i.message:String(i)}),As(i,{method:e,path:t,status:a})}async function He(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"POST",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("POST",e,pn()-n,u,a.status),i=!0,u}return Mc("POST",e,pn()-n,a.status),a.json()}catch(a){throw i||di("POST",e,pn()-n,a),a}}async function Ae(e){const t=pn();let n=!1;try{const i=await fetch(`${ui}${e}`,{headers:{...Ms()}});if(!i.ok){ba(i.status);const a=await i.json().catch(()=>({error:i.statusText})),o=new Error(a.error||i.statusText);throw di("GET",e,pn()-t,o,i.status),n=!0,o}return Mc("GET",e,pn()-t,i.status),i.json()}catch(i){throw n||di("GET",e,pn()-t,i),i}}async function Rr(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"PUT",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("PUT",e,pn()-n,u,a.status),i=!0,u}return Mc("PUT",e,pn()-n,a.status),a.json()}catch(a){throw i||di("PUT",e,pn()-n,a),a}}async function q4(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"PATCH",headers:{"Content-Type":"application/json",...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("PATCH",e,pn()-n,u,a.status),i=!0,u}return Mc("PATCH",e,pn()-n,a.status),a.json()}catch(a){throw i||di("PATCH",e,pn()-n,a),a}}async function Lr(e,t){const n=pn();let i=!1;try{const a=await fetch(`${ui}${e}`,{method:"DELETE",headers:{...t?{"Content-Type":"application/json"}:{},...Ms()},body:t?JSON.stringify(t):void 0});if(!a.ok){ba(a.status);const o=await a.json().catch(()=>({error:a.statusText})),u=new Error(o.error||a.statusText);throw di("DELETE",e,pn()-n,u,a.status),i=!0,u}return Mc("DELETE",e,pn()-n,a.status),a.json()}catch(a){throw i||di("DELETE",e,pn()-n,a),a}}async function V4(e,t){const n=await fetch(`${ui}/sessions/create-stream`,{method:"POST",headers:{"Content-Type":"application/json",...Ms()},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(),a=new TextDecoder;let o="",u=null;for(;;){const{done:f,value:h}=await i.read();if(f)break;o+=a.decode(h,{stream:!0});const p=o.split(`
|
|
65
65
|
|
|
66
66
|
`);o=p.pop()||"";for(const g of p){if(!g.trim())continue;let x="",b="";for(const _ of g.split(`
|
|
67
|
-
`))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function G4(){try{const e=await fetch(`${ui}/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 Fy(e){try{const t=await fetch(`${ui}/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 Ne={getAuthQr:()=>Ae("/auth/qr"),getAuthToken:()=>Ae("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Ae("/sessions"),discoverClaudeSessions:(e=200)=>Ae(`/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 Ae(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Lr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ui}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ms()}});if(!n.ok)throw ba(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Ae(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>q4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Ae(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Ae("/fs/home"),listEnvs:()=>Ae("/envs"),getEnv:e=>Ae(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Rr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Lr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Ae("/sandboxes"),getSandbox:e=>Ae(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Rr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Lr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Ae("/docker/base-image"),getSettings:()=>Ae("/settings"),updateSettings:e=>Rr("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Ae("/dashboard"),runDashboardUpdate:()=>He("/dashboard/run"),getDashboardRunStatus:()=>Ae("/dashboard/run/status"),getTailscaleStatus:()=>Ae("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Ae("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Rr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Lr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Ae(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Ae(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Ae(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Ae(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Ae(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Ae(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Rr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Lr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Rr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Lr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Ae(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Ae(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Ae(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Ae(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Lr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Ae(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Ae("/backends"),getBackendModels:e=>Ae(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Ae("/containers/status"),getContainerImages:()=>Ae("/containers/images"),getImageStatus:e=>Ae(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Ae(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Ae(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Ae(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ui}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ms()}});if(!t.ok){ba(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)=>Rr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Ae(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Ae(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Ae(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Rr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Ae(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Ae("/usage-limits"),getSessionUsageLimits:e=>Ae(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Ae("/system/memory"),spawnTerminal:(e,t,n,i)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Ae(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Ae("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Ae("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Ae("/cron/jobs"),getCronJob:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Rr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Lr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Ae(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Ae("/agents"),getAgent:e=>Ae(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Rr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Lr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Ae(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Ae(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/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 Ae(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Ae(`/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 Ae(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Ae(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Lr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Ae("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Rr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Lr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Ae(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Ae("/skills"),sendSessionMessage:(e,t)=>He(`/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 Ae(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Rr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Lr(`/prompts/${encodeURIComponent(e)}`)};let Uy=!1;function Hy(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 a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function Iy(){return new Promise(()=>{})}function Y4(){if(Uy||typeof window>"u")return;Uy=!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 Hy(i)}catch{return Iy()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Hy(n)}catch{return Iy()}}}})}catch{}}const qy="#/session/",Vy="#/agents/";let Gy=!1;function rx(){Gy||(Y4(),Gy=!0)}function ix(e){if(rx(),e==="#/dashboard")return{page:"dashboard"};if(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(Vy)){const n=e.slice(Vy.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(qy)){const n=e.slice(qy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function W4(e){return`#/session/${e}`}function sx(e,t=!1){rx();const n=W4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function am(e=!1){rx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function Q4(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[a,o]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const x=e.trim();if(!x){i("Please enter a token");return}o(!0),i(null),await Fy(x)?u(x):i("Invalid token"),o(!1)},[e,u]);S.useEffect(()=>{G4().then(g=>{if(g){u(g);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),Fy(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),o(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.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:a}),l.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&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!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:a?"Verifying...":"Login"})]}),l.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 Dl=r5();function X4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.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:l.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"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.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"}),l.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 K4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function Z4({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function J4({type:e}){return e==="codex"?l.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"}):l.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 Td({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:k}){const A=e.id.slice(0,8),C=i||e.model||A,L=b===e.id,[D,z]=S.useState(!1),q=S.useRef(null),$=S.useRef(null),G=n?"exited":K4(e,a),O=e.cwd||"";S.useEffect(()=>{if(!D)return;function T(J){var W;q.current&&!q.current.contains(J.target)&&$.current&&!$.current.contains(J.target)&&(z(!1),(W=$.current)==null||W.focus())}function ae(J){var W,B,F;if(J.key==="Escape"){z(!1),(W=$.current)==null||W.focus();return}if(J.key==="Tab"){z(!1);return}if((J.key==="ArrowDown"||J.key==="ArrowUp")&&((B=q.current)!=null&&B.contains(document.activeElement)||$.current===document.activeElement)){J.preventDefault();const Y=(F=q.current)==null?void 0:F.querySelectorAll("[role='menuitem']");if(!Y||Y.length===0)return;const xe=document.activeElement,R=Array.from(Y).indexOf(xe);J.key==="ArrowDown"?Y[R<Y.length-1?R+1:0].focus():Y[R>0?R-1:Y.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",ae)}},[D]),S.useEffect(()=>{D&&requestAnimationFrame(()=>{var T,ae;(ae=(T=q.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||ae.focus()})},[D]);const I=S.useCallback(T=>{z(!1),T()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),f(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!L&&(T.preventDefault(),f(e.id,C))},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:[l.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"}`}),!L&&l.jsx(Z4,{status:G}),L?l.jsx("input",{ref:k,value:y,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),N()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.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"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:C}),O&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(J4,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.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&&!L&&!D&&l.jsx("button",{onClick:T=>{T.stopPropagation(),h(T,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})}),l.jsx("button",{ref:$,onClick:T=>{T.stopPropagation(),z(!D)},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":D,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),D&&l.jsxs("div",{ref:q,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&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,C)),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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>p(T,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.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"}),l.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"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>g(T,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.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"}),l.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"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>h(T,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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 eE({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:A,isFirst:C}){const L=t?e.sessions.slice(0,2).map(D=>a.get(D.id)||D.model||D.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&L&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:L}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(D=>{var q;const z=((q=o.get(D.id))==null?void 0:q.size)??0;return l.jsx(Td,{session:D,isActive:i===D.id,sessionName:a.get(D.id),permCount:z,isRecentlyRenamed:u.has(D.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:A},D.id)})})]})}function tE(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function nE(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function rE(e){const t=new Map;for(const i of e){const a=tE(i.cwd,i.repoRoot||void 0,i.isContainerized),o=nE(a);t.has(a)||t.set(a,{key:a,label:o,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);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,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const iE=[{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"}],sE=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{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"}],aE=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],lE=new Map(sE.map(e=>[e.id,e]));function oE(){var Pr,$r;const[e,t]=S.useState(null),[n,i]=S.useState(""),[a,o]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,x]=S.useState(null),[b,y]=S.useState(!1),[_,j]=S.useState(null),[N,k]=S.useState(!1),[A,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),L=S.useRef(null),D=S.useRef(null),z=X(ne=>ne.sessions),q=X(ne=>ne.sdkSessions),$=X(ne=>ne.currentSessionId),G=X(ne=>ne.cliConnected),O=X(ne=>ne.cliReconnecting),I=X(ne=>ne.sessionStatus),T=X(ne=>ne.removeSession),ae=X(ne=>ne.sessionNames),J=X(ne=>ne.recentlyRenamed),W=X(ne=>ne.clearRecentlyRenamed),B=X(ne=>ne.pendingPermissions),F=X(ne=>ne.linkedLinearIssues),Y=X(ne=>ne.collapsedProjects),xe=X(ne=>ne.toggleProjectCollapse),R=ix(A);S.useEffect(()=>{let ne=!0;async function pe(){try{const Xe=await Ne.listSessions();if(ne){const Bt=X.getState();Bt.setSdkSessions(Xe);const ln=X.getState(),Tn=new Set(Xe.map(Pt=>Pt.sessionId));for(const Pt of ln.sessions.keys())!Tn.has(Pt)&&ln.connectionStatus.get(Pt)!=="connected"&&ln.removeSession(Pt);f3(Xe);for(const Pt of Xe)if(Pt.name&&(!Bt.sessionNames.has(Pt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Bt.sessionNames.get(Pt.sessionId)))){const zn=Bt.sessionNames.get(Pt.sessionId),xr=!!zn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(zn);zn!==Pt.name&&(Bt.setSessionName(Pt.sessionId,Pt.name),xr&&Bt.markRecentlyRenamed(Pt.sessionId))}}}catch{}}pe();const ve=setInterval(pe,5e3);return()=>{ne=!1,clearInterval(ve)}},[]),S.useEffect(()=>{const ne=()=>C(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function P(ne){sx(ne),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){am(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function M(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function de(){t(null),i("")}function be(ne,pe){t(ne),i(pe)}const je=S.useCallback((ne,pe)=>{ne.stopPropagation(),j(pe)},[]),Re=S.useCallback(async ne=>{try{zm(ne),await Ne.deleteSession(ne)}catch{}X.getState().currentSessionId===ne&&am(),T(ne)},[T]),Le=S.useCallback(()=>{_&&(Re(_),j(null))},[_,Re]),Be=S.useCallback(()=>{j(null)},[]),Je=S.useCallback(()=>{k(!0)},[]),it=S.useCallback(async()=>{k(!1);const ne=X.getState(),pe=new Set;for(const Xe of ne.sessions.keys())pe.add(Xe);for(const Xe of ne.sdkSessions)pe.add(Xe.sessionId);const ve=Array.from(pe).filter(Xe=>{const Bt=ne.sdkSessions.find(ln=>ln.sessionId===Xe);return(Bt==null?void 0:Bt.archived)??!1});for(const Xe of ve)await Re(Xe)},[Re]),ht=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var pe,ve;(ve=(pe=D.current)==null?void 0:pe.querySelector("button"))==null||ve.focus()});function ne(pe){var ln;if(pe.key==="Escape"){N?ht():Be();return}if(pe.key!=="Tab")return;const ve=(ln=D.current)==null?void 0:ln.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ve||ve.length===0)return;const Xe=ve[0],Bt=ve[ve.length-1];pe.shiftKey&&document.activeElement===Xe?(pe.preventDefault(),Bt.focus()):!pe.shiftKey&&document.activeElement===Bt&&(pe.preventDefault(),Xe.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,N,Be,ht]);const Xt=S.useCallback(async(ne,pe)=>{ne.stopPropagation();const ve=q.find(zn=>zn.sessionId===pe),Xe=z.get(pe),Bt=(Xe==null?void 0:Xe.is_containerized)||!!(ve!=null&&ve.containerId)||!1,ln=F.get(pe),Tn=((ln==null?void 0:ln.stateType)||"").toLowerCase();if(ln&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const zn=await Ne.getArchiveInfo(pe);if(zn.issueNotDone){p(pe),x(zn),y(Bt);return}}catch{}if(Bt){f(pe);return}pt(pe)},[q,z,F]),pt=S.useCallback(async(ne,pe,ve)=>{try{zm(ne);const Xe={};pe&&(Xe.force=!0),ve&&ve!=="none"&&(Xe.linearTransition=ve),await Ne.archiveSession(ne,Object.keys(Xe).length>0?Xe:void 0)}catch{}X.getState().currentSessionId===ne&&(am(),X.getState().newSession());try{const Xe=await Ne.listSessions();X.getState().setSdkSessions(Xe)}catch{}},[]),yt=S.useCallback(()=>{u&&(pt(u,!0),f(null))},[u,pt]),kt=S.useCallback(()=>{f(null)},[]),ge=S.useCallback((ne,pe)=>{h&&(pt(h,pe,ne),p(null),x(null))},[h,pt]),Fe=S.useCallback(()=>{p(null),x(null)},[]),ct=S.useCallback(async(ne,pe)=>{ne.stopPropagation();try{await Ne.unarchiveSession(pe)}catch{}try{const ve=await Ne.listSessions();X.getState().setSdkSessions(ve)}catch{}},[]),mn=new Set;for(const ne of z.keys())mn.add(ne);for(const ne of q)mn.add(ne.sessionId);const ke=Array.from(mn).map(ne=>{var Xe;const pe=z.get(ne),ve=q.find(Bt=>Bt.sessionId===ne);return{id:ne,model:(pe==null?void 0:pe.model)||(ve==null?void 0:ve.model)||"",cwd:(pe==null?void 0:pe.cwd)||(ve==null?void 0:ve.cwd)||"",gitBranch:(pe==null?void 0:pe.git_branch)||(ve==null?void 0:ve.gitBranch)||"",isContainerized:(pe==null?void 0:pe.is_containerized)||!!(ve!=null&&ve.containerId)||!1,gitAhead:(pe==null?void 0:pe.git_ahead)||(ve==null?void 0:ve.gitAhead)||0,gitBehind:(pe==null?void 0:pe.git_behind)||(ve==null?void 0:ve.gitBehind)||0,linesAdded:(pe==null?void 0:pe.total_lines_added)||(ve==null?void 0:ve.totalLinesAdded)||0,linesRemoved:(pe==null?void 0:pe.total_lines_removed)||(ve==null?void 0:ve.totalLinesRemoved)||0,isConnected:G.get(ne)??!1,isReconnecting:O.get(ne)??!1,status:I.get(ne)??null,sdkState:(ve==null?void 0:ve.state)??null,createdAt:(ve==null?void 0:ve.createdAt)??0,archived:(ve==null?void 0:ve.archived)??!1,backendType:(pe==null?void 0:pe.backend_type)||(ve==null?void 0:ve.backendType)||"claude",repoRoot:(pe==null?void 0:pe.repo_root)||"",permCount:((Xe=B.get(ne))==null?void 0:Xe.size)??0,cronJobId:(pe==null?void 0:pe.cronJobId)||(ve==null?void 0:ve.cronJobId),cronJobName:(pe==null?void 0:pe.cronJobName)||(ve==null?void 0:ve.cronJobName),agentId:(pe==null?void 0:pe.agentId)||(ve==null?void 0:ve.agentId),agentName:(pe==null?void 0:pe.agentName)||(ve==null?void 0:ve.agentName),userName:ve==null?void 0:ve.userName}}).sort((ne,pe)=>pe.createdAt-ne.createdAt),ze=S.useMemo(()=>Array.from(new Set(ke.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[ke]),[mt,Ee]=S.useState("__all__"),Br=ne=>mt==="__all__"?!0:mt==="__none__"?!ne.userName:ne.userName===mt,le=ke.some(ne=>!ne.userName),ye=ke.filter(Br),Q=ye.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),he=ye.filter(ne=>!ne.archived&&!!ne.cronJobId),Me=ye.filter(ne=>!ne.archived&&!!ne.agentId),Qe=ye.filter(ne=>ne.archived),nt=$?ke.find(ne=>ne.id===$):null,rt=(nt==null?void 0:nt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[wt,gn]=S.useState(!0),[et,rr]=S.useState(!0),En=S.useMemo(()=>rE(Q),[Q]),Xr={onSelect:P,onStartRename:be,onArchive:Xt,onUnarchive:ct,onDelete:je,onClearRecentlyRenamed:W,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:M,onCancelRename:de,editInputRef:L};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:rt,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.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"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>X.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.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"})})})]})}),ze.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:mt,onChange:ne=>Ee(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:[l.jsx("option",{value:"__all__",children:"All users"}),ze.map(ne=>l.jsx("option",{value:ne,children:ne},ne)),le&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.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"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.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"}),l.jsx("button",{onClick:yt,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"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&he.length===0&&Qe.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((ne,pe)=>l.jsx(eE,{group:ne,isCollapsed:Y.has(ne.key),onToggleCollapse:xe,currentSessionId:$,sessionNames:ae,pendingPermissions:B,recentlyRenamed:J,isFirst:pe===0,...Xr},ne.key)),he.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>gn(!wt),"aria-expanded":wt,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${wt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",he.length,")"]}),wt&&l.jsx("div",{className:"mt-0.5",children:he.map(ne=>{var pe;return l.jsx(Td,{session:ne,isActive:$===ne.id,sessionName:ae.get(ne.id),permCount:((pe=B.get(ne.id))==null?void 0:pe.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>rr(!et),"aria-expanded":et,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${et?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Me.length,")"]}),et&&l.jsx("div",{className:"mt-0.5",children:Me.map(ne=>{var pe;return l.jsx(Td,{session:ne,isActive:$===ne.id,sessionName:ae.get(ne.id),permCount:((pe=B.get(ne.id))==null?void 0:pe.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Qe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Qe.length,")"]}),a&&Qe.length>1&&l.jsx("button",{onClick:Je,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"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Qe.map(ne=>{var pe;return l.jsx(Td,{session:ne,isActive:$===ne.id,isArchived:!0,sessionName:ae.get(ne.id),permCount:((pe=B.get(ne.id))==null?void 0:pe.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:aE.map(ne=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),l.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(pe=>{const ve=lE.get(pe);if(!ve)return null;const Xe=ve.activePages?ve.activePages.some(Bt=>R.page===Bt):R.page===ve.id;return l.jsxs("button",{onClick:()=>{window.location.hash=ve.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:ve.label,"aria-current":Xe?"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 ${Xe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:ve.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:ve.iconPath,fillRule:ve.fillRule,clipRule:ve.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ve.label})]},ve.id)})})]},ne.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:iE.map(ne=>l.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:l.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||N)&&l.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:N?ht:Be,children:l.jsxs("div",{ref:D,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:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.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"}),l.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"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${Qe.length} archived session${Qe.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?ht:Be,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"}),l.jsx("button",{onClick:N?it: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:N?"Delete all":"Delete"})]})]})}),h&&g&&l.jsx(X4,{issueIdentifier:((Pr=g.issue)==null?void 0:Pr.identifier)||"",issueStateName:(($r=g.issue)==null?void 0:$r.stateName)||"",isContainerized:b,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:ge,onCancel:Fe})]})}function cE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const uE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fE={};function Yy(e,t){return(fE.jsx?dE:uE).test(e)}const hE=/[ \t\n\f\r]/g;function pE(e){return typeof e=="object"?e.type==="text"?Wy(e.value):!1:Wy(e)}function Wy(e){return e.replace(hE,"")===""}class Rc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Rc.prototype.normal={};Rc.prototype.property={};Rc.prototype.space=void 0;function r2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Rc(n,i,t)}function _g(e){return e.toLowerCase()}class nr{constructor(t,n){this.attribute=n,this.property=t}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let mE=0;const Ve=wa(),hn=wa(),wg=wa(),we=wa(),Dt=wa(),xa=wa(),hr=wa();function wa(){return 2**++mE}const Sg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:hn,commaOrSpaceSeparated:hr,commaSeparated:xa,number:we,overloadedBoolean:wg,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),lm=Object.keys(Sg);class ax extends nr{constructor(t,n,i,a){let o=-1;if(super(t,n),Qy(this,"space",a),typeof i=="number")for(;++o<lm.length;){const u=lm[o];Qy(this,lm[o],(i&Sg[u])===Sg[u])}}}ax.prototype.defined=!0;function Qy(e,t,n){n&&(e[t]=n)}function zl(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new ax(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[_g(i)]=i,n[_g(o.attribute)]=i}return new Rc(t,n,e.space)}const i2=zl({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:Dt,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:we,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:Dt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:hn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function s2(e,t){return t in e?e[t]:t}function a2(e,t){return s2(e,t.toLowerCase())}const gE=zl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Dt,autoFocus:Ve,autoPlay:Ve,blocking:Dt,capture:null,charSet:null,checked:Ve,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:we,colSpan:we,command:null,commandFor:null,content:null,contentEditable:hn,controls:Ve,controlsList:Dt,coords:we|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:wg,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Dt,height:we,hidden:wg,high:we,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:Ve,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:we,pattern:null,ping:Dt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Dt,required:Ve,reversed:Ve,rows:we,rowSpan:we,sandbox:Dt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:hn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:xa,part:Dt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:a2}),xE=zl({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:hr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Dt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:hr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hr,rev:hr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hr,requiredFeatures:hr,requiredFonts:hr,requiredFormats:hr,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:hr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:s2}),l2=zl({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()}}),o2=zl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:a2}),c2=zl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vE={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"},bE=/[A-Z]/g,Xy=/-[a-z]/g,yE=/^data[-\w.:]+$/i;function _E(e,t){const n=_g(t);let i=t,a=nr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yE.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Xy,SE);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Xy.test(o)){let u=o.replace(bE,wE);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=ax}return new a(i,t)}function wE(e){return"-"+e.toLowerCase()}function SE(e){return e.charAt(1).toUpperCase()}const kE=r2([i2,gE,l2,o2,c2],"html"),lx=r2([i2,xE,l2,o2,c2],"svg");function jE(e){return e.join(" ").trim()}var ml={},om,Ky;function NE(){if(Ky)return om;Ky=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
67
|
+
`))_.startsWith("event:")?x=_.slice(6).trim():_.startsWith("data:")&&(b=_.slice(5).trim());if(!b)continue;const y=JSON.parse(b);if(x==="progress")t(y);else if(x==="done")u=y;else if(x==="error")throw new Error(y.error||"Session creation failed")}}if(!u)throw new Error("Stream ended without session creation result");return u}async function G4(){try{const e=await fetch(`${ui}/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 Fy(e){try{const t=await fetch(`${ui}/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 Ne={getAuthQr:()=>Ae("/auth/qr"),getAuthToken:()=>Ae("/auth/token"),regenerateAuthToken:()=>He("/auth/regenerate"),createSession:e=>He("/sessions/create",e),listSessions:()=>Ae("/sessions"),discoverClaudeSessions:(e=200)=>Ae(`/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 Ae(`/claude/sessions/${encodeURIComponent(e)}/history?cursor=${encodeURIComponent(String(n))}&limit=${encodeURIComponent(String(i))}`)},killSession:e=>He(`/sessions/${encodeURIComponent(e)}/kill`),deleteSession:e=>Lr(`/sessions/${encodeURIComponent(e)}`),relaunchSession:e=>He(`/sessions/${encodeURIComponent(e)}/relaunch`),exportSession:async(e,t)=>{const n=await fetch(`${ui}/sessions/${encodeURIComponent(e)}/export?format=${t}`,{headers:{...Ms()}});if(!n.ok)throw ba(n.status),new Error(`Export failed (${n.status})`);const i=await n.blob(),o=(n.headers.get("Content-Disposition")||"").match(/filename="?([^"]+)"?/),u=(o==null?void 0:o[1])||`session.${t}`;return{blob:i,filename:u}},archiveSession:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/archive`,t),getArchiveInfo:e=>Ae(`/sessions/${encodeURIComponent(e)}/archive-info`),unarchiveSession:e=>He(`/sessions/${encodeURIComponent(e)}/unarchive`),renameSession:(e,t)=>q4(`/sessions/${encodeURIComponent(e)}/name`,{name:t}),listDirs:e=>Ae(`/fs/list${e?`?path=${encodeURIComponent(e)}`:""}`),getHome:()=>Ae("/fs/home"),listEnvs:()=>Ae("/envs"),getEnv:e=>Ae(`/envs/${encodeURIComponent(e)}`),createEnv:(e,t)=>He("/envs",{name:e,variables:t}),updateEnv:(e,t)=>Rr(`/envs/${encodeURIComponent(e)}`,t),deleteEnv:e=>Lr(`/envs/${encodeURIComponent(e)}`),listSandboxes:()=>Ae("/sandboxes"),getSandbox:e=>Ae(`/sandboxes/${encodeURIComponent(e)}`),createSandbox:(e,t)=>He("/sandboxes",{name:e,...t}),updateSandbox:(e,t)=>Rr(`/sandboxes/${encodeURIComponent(e)}`,t),deleteSandbox:e=>Lr(`/sandboxes/${encodeURIComponent(e)}`),testInitScript:(e,t,n)=>He(`/sandboxes/${encodeURIComponent(e)}/test-init`,{cwd:t,initScript:n}),buildBaseImage:()=>He("/docker/build-base"),getBaseImageStatus:()=>Ae("/docker/base-image"),getSettings:()=>Ae("/settings"),updateSettings:e=>Rr("/settings",e),verifyAnthropicKey:e=>He("/settings/anthropic/verify",{apiKey:e}),getDashboard:()=>Ae("/dashboard"),runDashboardUpdate:()=>He("/dashboard/run"),getDashboardRunStatus:()=>Ae("/dashboard/run/status"),getTailscaleStatus:()=>Ae("/tailscale/status"),startTailscaleFunnel:()=>He("/tailscale/funnel/start"),stopTailscaleFunnel:()=>He("/tailscale/funnel/stop"),listLinearConnections:()=>Ae("/linear/connections"),createLinearConnection:e=>He("/linear/connections",e),updateLinearConnection:(e,t)=>Rr(`/linear/connections/${encodeURIComponent(e)}`,t),deleteLinearConnection:e=>Lr(`/linear/connections/${encodeURIComponent(e)}`),verifyLinearConnection:e=>He(`/linear/connections/${encodeURIComponent(e)}/verify`,{}),searchLinearIssues:(e,t=8,n)=>Ae(`/linear/issues?query=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearConnection:e=>Ae(`/linear/connection${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearStates:e=>Ae(`/linear/states${e?`?connectionId=${encodeURIComponent(e)}`:""}`),transitionLinearIssue:(e,t)=>He(`/linear/issues/${encodeURIComponent(e)}/transition${t?`?connectionId=${encodeURIComponent(t)}`:""}`,{}),listLinearProjects:e=>Ae(`/linear/projects${e?`?connectionId=${encodeURIComponent(e)}`:""}`),getLinearProjectIssues:(e,t=15,n)=>Ae(`/linear/project-issues?projectId=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${n?`&connectionId=${encodeURIComponent(n)}`:""}`),getLinearProjectMapping:e=>Ae(`/linear/project-mappings?repoRoot=${encodeURIComponent(e)}`),upsertLinearProjectMapping:e=>Rr("/linear/project-mappings",e),removeLinearProjectMapping:e=>Lr("/linear/project-mappings",{repoRoot:e}),linkLinearIssue:(e,t,n)=>Rr(`/sessions/${encodeURIComponent(e)}/linear-issue`,{...t,...n!==void 0?{connectionId:n}:{}}),unlinkLinearIssue:e=>Lr(`/sessions/${encodeURIComponent(e)}/linear-issue`),getLinkedLinearIssue:(e,t=!1)=>Ae(`/sessions/${encodeURIComponent(e)}/linear-issue${t?"?refresh=true":""}`),createLinearIssue:e=>He("/linear/issues",e),addLinearComment:(e,t,n)=>He(`/linear/issues/${encodeURIComponent(e)}/comments`,{body:t,connectionId:n}),getRepoInfo:e=>Ae(`/git/repo-info?path=${encodeURIComponent(e)}`),listBranches:e=>Ae(`/git/branches?repoRoot=${encodeURIComponent(e)}`),gitFetch:e=>He("/git/fetch",{repoRoot:e}),gitPull:e=>He("/git/pull",{cwd:e}),listWorktrees:e=>Ae(`/git/worktrees?repoRoot=${encodeURIComponent(e)}`),createWorktree:(e,t,n)=>He("/git/worktree",{repoRoot:e,branch:t,...n}),removeWorktree:(e,t,n)=>Lr("/git/worktree",{repoRoot:e,worktreePath:t,force:n}),getPRStatus:(e,t)=>Ae(`/git/pr-status?cwd=${encodeURIComponent(e)}&branch=${encodeURIComponent(t)}`),getBackends:()=>Ae("/backends"),getBackendModels:e=>Ae(`/backends/${encodeURIComponent(e)}/models`),getContainerStatus:()=>Ae("/containers/status"),getContainerImages:()=>Ae("/containers/images"),getImageStatus:e=>Ae(`/images/${encodeURIComponent(e)}/status`),pullImage:e=>He(`/images/${encodeURIComponent(e)}/pull`),getCloudProviderPlan:(e,t,n)=>Ae(`/cloud/providers/${encodeURIComponent(e)}/plan?cwd=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(n)}`),startEditor:e=>He(`/sessions/${encodeURIComponent(e)}/editor/start`),startBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/start`,t?{url:t}:void 0),navigateBrowser:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/browser/navigate`,{url:t}),getFileTree:e=>Ae(`/fs/tree?path=${encodeURIComponent(e)}`),readFile:e=>Ae(`/fs/read?path=${encodeURIComponent(e)}`),getFileBlob:async e=>{const t=await fetch(`${ui}/fs/raw?path=${encodeURIComponent(e)}`,{headers:{...Ms()}});if(!t.ok){ba(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)=>Rr("/fs/write",{path:e,content:t}),getFileDiff:(e,t)=>Ae(`/fs/diff?path=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getChangedFiles:(e,t)=>Ae(`/fs/changed-files?cwd=${encodeURIComponent(e)}${t?`&base=${encodeURIComponent(t)}`:""}`),getClaudeMdFiles:e=>Ae(`/fs/claude-md?cwd=${encodeURIComponent(e)}`),saveClaudeMd:(e,t)=>Rr("/fs/claude-md",{path:e,content:t}),getClaudeConfig:e=>Ae(`/fs/claude-config?cwd=${encodeURIComponent(e)}`),getUsageLimits:()=>Ae("/usage-limits"),getSessionUsageLimits:e=>Ae(`/sessions/${encodeURIComponent(e)}/usage-limits`),getSystemMemory:()=>Ae("/system/memory"),spawnTerminal:(e,t,n,i)=>He("/terminal/spawn",{cwd:e,cols:t,rows:n,containerId:i==null?void 0:i.containerId}),killTerminal:e=>He("/terminal/kill",{terminalId:e}),getTerminal:e=>Ae(e?`/terminal?terminalId=${encodeURIComponent(e)}`:"/terminal"),checkForUpdate:()=>Ae("/update-check"),forceCheckForUpdate:()=>He("/update-check"),triggerUpdate:()=>He("/update"),getClaudeCompat:()=>Ae("/claude-compat"),refreshClaudeCompat:()=>He("/claude-compat/refresh"),pinClaudeVersion:e=>He("/claude-compat/pin",e?{version:e}:{}),patchClaudeBinary:()=>He("/claude-compat/patch"),unpatchClaudeBinary:()=>He("/claude-compat/unpatch"),dismissClaudeCompatBanner:e=>He("/claude-compat/dismiss-banner",{version:e}),listCronJobs:()=>Ae("/cron/jobs"),getCronJob:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}`),createCronJob:e=>He("/cron/jobs",e),updateCronJob:(e,t)=>Rr(`/cron/jobs/${encodeURIComponent(e)}`,t),deleteCronJob:e=>Lr(`/cron/jobs/${encodeURIComponent(e)}`),toggleCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/toggle`),runCronJob:e=>He(`/cron/jobs/${encodeURIComponent(e)}/run`),getCronJobExecutions:e=>Ae(`/cron/jobs/${encodeURIComponent(e)}/executions`),killProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/${encodeURIComponent(t)}/kill`),killAllProcesses:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/kill-all`,{taskIds:t}),getSystemProcesses:e=>Ae(`/sessions/${encodeURIComponent(e)}/processes/system`),killSystemProcess:(e,t)=>He(`/sessions/${encodeURIComponent(e)}/processes/system/${t}/kill`),listAgents:()=>Ae("/agents"),getAgent:e=>Ae(`/agents/${encodeURIComponent(e)}`),createAgent:e=>He("/agents",e),updateAgent:(e,t)=>Rr(`/agents/${encodeURIComponent(e)}`,t),deleteAgent:e=>Lr(`/agents/${encodeURIComponent(e)}`),toggleAgent:e=>He(`/agents/${encodeURIComponent(e)}/toggle`),runAgent:(e,t)=>He(`/agents/${encodeURIComponent(e)}/run`,{input:t}),getAgentExecutions:e=>Ae(`/agents/${encodeURIComponent(e)}/executions`),importAgent:e=>He("/agents/import",e),exportAgent:e=>Ae(`/agents/${encodeURIComponent(e)}/export`),regenerateAgentWebhookSecret:e=>He(`/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 Ae(`/executions${n?`?${n}`:""}`)},getLinearOAuthStatus:e=>{const t=new URLSearchParams;e&&t.set("stagingId",e);const n=t.toString();return Ae(`/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 Ae(`/linear/oauth/authorize-url${i?`?${i}`:""}`)},disconnectLinearOAuth:()=>He("/linear/oauth/disconnect"),createLinearStaging:e=>He("/linear/oauth/staging",e),getLinearStagingStatus:e=>Ae(`/linear/oauth/staging/${encodeURIComponent(e)}/status`),deleteLinearStaging:e=>Lr(`/linear/oauth/staging/${encodeURIComponent(e)}`),listLinearOAuthConnections:()=>Ae("/linear/oauth-connections"),createLinearOAuthConnection:e=>He("/linear/oauth-connections",e),updateLinearOAuthConnection:(e,t)=>Rr(`/linear/oauth-connections/${encodeURIComponent(e)}`,t),deleteLinearOAuthConnection:e=>Lr(`/linear/oauth-connections/${encodeURIComponent(e)}`),getLinearOAuthConnectionAuthorizeUrl:(e,t)=>Ae(`/linear/oauth-connections/${encodeURIComponent(e)}/authorize-url${t?`?returnTo=${encodeURIComponent(t)}`:""}`),listSkills:()=>Ae("/skills"),sendSessionMessage:(e,t)=>He(`/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 Ae(`/prompts${i?`?${i}`:""}`)},createPrompt:e=>He("/prompts",e),updatePrompt:(e,t)=>Rr(`/prompts/${encodeURIComponent(e)}`,t),deletePrompt:e=>Lr(`/prompts/${encodeURIComponent(e)}`)};let Uy=!1;function Hy(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 a=document.execCommand("copy");if(document.body.removeChild(i),!a){n(new Error("Copy command was rejected"));return}t()}catch(i){n(i instanceof Error?i:new Error("Clipboard copy failed"))}})}function Iy(){return new Promise(()=>{})}function Y4(){if(Uy||typeof window>"u")return;Uy=!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 Hy(i)}catch{return Iy()}}}}catch{}return}try{Object.defineProperty(e,"clipboard",{configurable:!0,value:{writeText:async n=>{try{await Hy(n)}catch{return Iy()}}}})}catch{}}const qy="#/session/",Vy="#/agents/";let Gy=!1;function rx(){Gy||(Y4(),Gy=!0)}function ix(e){if(rx(),e==="#/dashboard")return{page:"dashboard"};if(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(Vy)){const n=e.slice(Vy.length);if(n)return{page:"agent-detail",agentId:n}}if(e.startsWith(qy)){const n=e.slice(qy.length);if(n)return{page:"session",sessionId:n}}return{page:"home"}}function W4(e){return`#/session/${e}`}function sx(e,t=!1){rx();const n=W4(e);t?(history.replaceState(null,"",n),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=`/session/${e}`}function am(e=!1){rx(),e?(history.replaceState(null,"",window.location.pathname+window.location.search),window.dispatchEvent(new HashChangeEvent("hashchange"))):window.location.hash=""}function Q4(){const[e,t]=S.useState(""),[n,i]=S.useState(null),[a,o]=S.useState(!1),u=X(g=>g.setAuthToken),f=S.useCallback(async g=>{g.preventDefault();const x=e.trim();if(!x){i("Please enter a token");return}o(!0),i(null),await Fy(x)?u(x):i("Invalid token"),o(!1)},[e,u]);S.useEffect(()=>{G4().then(g=>{if(g){u(g);return}const b=new URLSearchParams(window.location.search).get("token");b&&(o(!0),Fy(b).then(y=>{if(y){u(b);const _=new URL(window.location.href);_.searchParams.delete("token"),window.history.replaceState({},"",_.toString())}else i("Invalid token from URL"),o(!1)}))})},[u]);const[h,p]=S.useState(!1);return l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg font-sans-ui antialiased",children:l.jsxs("div",{className:"w-full max-w-sm px-6",children:[l.jsxs("div",{className:"text-center mb-8",children:[l.jsx("h1",{className:"text-xl font-semibold text-cc-fg mb-2",children:"The Companion"}),l.jsx("p",{className:"text-sm text-cc-muted",children:"Enter your auth token to continue"})]}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"auth-token",className:"block text-xs text-cc-muted mb-1.5",children:"Auth Token"}),l.jsxs("div",{className:"relative",children:[l.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:a}),l.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&&l.jsx("p",{className:"text-xs text-cc-error",role:"alert",children:n}),l.jsx("button",{type:"submit",disabled:a||!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:a?"Verifying...":"Login"})]}),l.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 Dl=r5();function X4({issueIdentifier:e,issueStateName:t,isContainerized:n,archiveTransitionConfigured:i,archiveTransitionStateName:a,hasBacklogState:o,onConfirm:u,onCancel:f}){const[h,p]=S.useState("none");return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:f,children:l.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:[l.jsxs("div",{className:"flex items-center justify-between mb-3",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Archive session"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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&&l.jsx("div",{className:"mb-3 p-2.5 rounded-lg bg-amber-500/10 border border-amber-500/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.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:l.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"})}),l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]})]})}),l.jsxs("p",{className:"text-xs text-cc-muted mb-3",children:["This session is linked to ",l.jsx("strong",{className:"text-cc-fg",children:e})," ",l.jsxs("span",{className:"text-cc-muted",children:["(",t,")"]}),". What should happen to the issue?"]}),l.jsxs("fieldset",{className:"space-y-2 mb-4",children:[l.jsx("legend",{className:"sr-only",children:"Linear issue transition choice"}),l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"none",checked:h==="none",onChange:()=>p("none"),className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Keep current status"})]}),l.jsxs("label",{className:`flex items-center gap-2.5 px-2.5 py-2 rounded-lg border border-cc-border transition-colors ${o?"hover:bg-cc-hover/50 cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"backlog",checked:h==="backlog",onChange:()=>p("backlog"),disabled:!o,className:"accent-cc-primary"}),l.jsx("span",{className:"text-xs text-cc-fg",children:"Move to Backlog"})]}),i&&a&&l.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:[l.jsx("input",{type:"radio",name:"archive-linear-choice",value:"configured",checked:h==="configured",onChange:()=>p("configured"),className:"accent-cc-primary"}),l.jsxs("span",{className:"text-xs text-cc-fg",children:["Move to ",a]})]})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.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"}),l.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 K4(e,t){return t>0?"awaiting":(e.status==="running"||e.status==="compacting")&&e.isConnected?"running":e.isReconnecting?"reconnecting":e.isConnected?"idle":"exited"}function Z4({status:e}){switch(e){case"running":return l.jsxs("span",{className:"relative shrink-0 w-2 h-2",children:[l.jsx("span",{className:"absolute inset-0 rounded-full bg-cc-success animate-[pulse-dot_1.5s_ease-in-out_infinite]"}),l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-success block"})]});case"awaiting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-warning block animate-[ring-pulse_1.5s_ease-out_infinite]"})});case"reconnecting":return l.jsx("span",{className:"relative shrink-0 w-2 h-2",children:l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-warning/40 border-t-cc-warning block animate-spin"})});case"idle":return l.jsx("span",{className:"w-2 h-2 rounded-full bg-cc-muted/40 shrink-0"});case"exited":return l.jsx("span",{className:"w-2 h-2 rounded-full border border-cc-muted/25 shrink-0"})}}function J4({type:e}){return e==="codex"?l.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"}):l.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 Td({session:e,isActive:t,isArchived:n,sessionName:i,permCount:a,isRecentlyRenamed:o,onSelect:u,onStartRename:f,onArchive:h,onUnarchive:p,onDelete:g,onClearRecentlyRenamed:x,editingSessionId:b,editingName:y,setEditingName:_,onConfirmRename:j,onCancelRename:N,editInputRef:k}){const A=e.id.slice(0,8),C=i||e.model||A,L=b===e.id,[D,z]=S.useState(!1),q=S.useRef(null),$=S.useRef(null),G=n?"exited":K4(e,a),O=e.cwd||"";S.useEffect(()=>{if(!D)return;function T(J){var W;q.current&&!q.current.contains(J.target)&&$.current&&!$.current.contains(J.target)&&(z(!1),(W=$.current)==null||W.focus())}function ae(J){var W,B,F;if(J.key==="Escape"){z(!1),(W=$.current)==null||W.focus();return}if(J.key==="Tab"){z(!1);return}if((J.key==="ArrowDown"||J.key==="ArrowUp")&&((B=q.current)!=null&&B.contains(document.activeElement)||$.current===document.activeElement)){J.preventDefault();const Y=(F=q.current)==null?void 0:F.querySelectorAll("[role='menuitem']");if(!Y||Y.length===0)return;const xe=document.activeElement,R=Array.from(Y).indexOf(xe);J.key==="ArrowDown"?Y[R<Y.length-1?R+1:0].focus():Y[R>0?R-1:Y.length-1].focus()}}return document.addEventListener("mousedown",T),document.addEventListener("touchstart",T),document.addEventListener("keydown",ae),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("touchstart",T),document.removeEventListener("keydown",ae)}},[D]),S.useEffect(()=>{D&&requestAnimationFrame(()=>{var T,ae;(ae=(T=q.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||ae.focus()})},[D]);const I=S.useCallback(T=>{z(!1),T()},[]);return l.jsxs("div",{className:"relative group",children:[l.jsxs("button",{onClick:()=>u(e.id),onDoubleClick:T=>{T.preventDefault(),f(e.id,C)},onKeyDown:T=>{T.key==="F2"&&!L&&(T.preventDefault(),f(e.id,C))},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:[l.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"}`}),!L&&l.jsx(Z4,{status:G}),L?l.jsx("input",{ref:k,value:y,onChange:T=>_(T.target.value),onKeyDown:T=>{T.key==="Enter"?(T.preventDefault(),j()):T.key==="Escape"&&(T.preventDefault(),N()),T.stopPropagation()},onBlur:j,onClick:T=>T.stopPropagation(),onDoubleClick:T=>T.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"}):l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:`text-[12.5px] font-medium truncate block leading-snug ${t?"text-cc-fg":"text-cc-fg/90"} ${o?"animate-name-appear":""}`,onAnimationEnd:()=>x(e.id),children:C}),O&&l.jsx("span",{className:"text-[10px] text-cc-muted/70 truncate block leading-tight mt-px",children:O})]}),!L&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(J4,{type:e.backendType}),e.isContainerized&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-blue-400/10",title:"Docker",children:l.jsx("img",{src:"/logo-docker.svg",alt:"Docker logo",className:"w-3 h-3"})}),e.cronJobId&&l.jsx("span",{className:"flex items-center px-1 py-0.5 rounded bg-cc-primary/10",title:"Scheduled",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-primary",children:l.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&&!L&&!D&&l.jsx("button",{onClick:T=>{T.stopPropagation(),h(T,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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})}),l.jsx("button",{ref:$,onClick:T=>{T.stopPropagation(),z(!D)},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":D,children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:[l.jsx("circle",{cx:"8",cy:"3",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"8",r:"1.5"}),l.jsx("circle",{cx:"8",cy:"13",r:"1.5"})]})}),D&&l.jsxs("div",{ref:q,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&&l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:()=>I(()=>f(e.id,C)),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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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?l.jsxs(l.Fragment,{children:[l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>p(T,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:[l.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"}),l.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"]}),l.jsx("div",{className:"my-1 mx-2 border-t border-cc-border/50"}),l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>g(T,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:[l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:[l.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"}),l.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"]})]}):l.jsxs("button",{role:"menuitem",tabIndex:-1,onClick:T=>I(()=>h(T,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-muted",children:l.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 eE({group:e,isCollapsed:t,onToggleCollapse:n,currentSessionId:i,sessionNames:a,pendingPermissions:o,recentlyRenamed:u,onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:A,isFirst:C}){const L=t?e.sessions.slice(0,2).map(D=>a.get(D.id)||D.model||D.id.slice(0,8)).join(", ")+(e.sessions.length>2?", ...":""):"";return l.jsxs("div",{className:C?"":"mt-3 pt-3 border-t border-cc-separator",children:[l.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:[l.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:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("span",{className:"text-[11px] font-semibold text-cc-fg/60 truncate uppercase tracking-wide",children:e.label}),l.jsxs("span",{className:"flex items-center gap-1 ml-auto shrink-0",children:[e.runningCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-success",title:`${e.runningCount} running`}),e.permCount>0&&l.jsx("span",{className:"w-1 h-1 rounded-full bg-cc-warning",title:`${e.permCount} waiting`})]}),l.jsx("span",{className:"text-[10px] text-cc-muted/50 tabular-nums shrink-0",children:e.sessions.length})]}),t&&L&&l.jsx("div",{className:"text-[10px] text-cc-muted/70 truncate pl-5 pb-0.5",children:L}),!t&&l.jsx("div",{className:"mt-0.5",children:e.sessions.map(D=>{var q;const z=((q=o.get(D.id))==null?void 0:q.size)??0;return l.jsx(Td,{session:D,isActive:i===D.id,sessionName:a.get(D.id),permCount:z,isRecentlyRenamed:u.has(D.id),onSelect:f,onStartRename:h,onArchive:p,onUnarchive:g,onDelete:x,onClearRecentlyRenamed:b,editingSessionId:y,editingName:_,setEditingName:j,onConfirmRename:N,onCancelRename:k,editInputRef:A},D.id)})})]})}function tE(e,t,n=!1){return(n&&!!t&&(t==="/workspace"||t.startsWith("/workspace/"))?e:t||e).replace(/\/+$/,"")||"/"}function nE(e){if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.length===0?"/":t[t.length-1]}function rE(e){const t=new Map;for(const i of e){const a=tE(i.cwd,i.repoRoot||void 0,i.isContainerized),o=nE(a);t.has(a)||t.set(a,{key:a,label:o,sessions:[],runningCount:0,permCount:0,mostRecentActivity:0});const u=t.get(a);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,a)=>i.label.localeCompare(a.label));for(const i of n)i.sessions.sort((a,o)=>o.createdAt-a.createdAt);return n}const iE=[{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"}],sE=[{id:"dashboard",label:"Dashboard",hash:"#/dashboard",activePages:["dashboard"],viewBox:"0 0 16 16",iconPath:"M1 2.5A1.5 1.5 0 012.5 1h3A1.5 1.5 0 017 2.5v3A1.5 1.5 0 015.5 7h-3A1.5 1.5 0 011 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 2.5A1.5 1.5 0 0110.5 1h3A1.5 1.5 0 0115 2.5v3A1.5 1.5 0 0113.5 7h-3A1.5 1.5 0 019 5.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM1 10.5A1.5 1.5 0 012.5 9h3A1.5 1.5 0 017 10.5v3A1.5 1.5 0 015.5 15h-3A1.5 1.5 0 011 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3zM9 10.5A1.5 1.5 0 0110.5 9h3a1.5 1.5 0 011.5 1.5v3a1.5 1.5 0 01-1.5 1.5h-3A1.5 1.5 0 019 13.5v-3zm1.5-.5a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5h-3z"},{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"}],aE=[{id:"workbench",label:"Workbench",itemIds:["dashboard","prompts","integrations"]},{id:"workspace",label:"Workspace",itemIds:["environments","sandboxes","agents","settings"]}],lE=new Map(sE.map(e=>[e.id,e]));function oE(){var Pr,$r;const[e,t]=S.useState(null),[n,i]=S.useState(""),[a,o]=S.useState(!1),[u,f]=S.useState(null),[h,p]=S.useState(null),[g,x]=S.useState(null),[b,y]=S.useState(!1),[_,j]=S.useState(null),[N,k]=S.useState(!1),[A,C]=S.useState(()=>typeof window<"u"?window.location.hash:""),L=S.useRef(null),D=S.useRef(null),z=X(ne=>ne.sessions),q=X(ne=>ne.sdkSessions),$=X(ne=>ne.currentSessionId),G=X(ne=>ne.cliConnected),O=X(ne=>ne.cliReconnecting),I=X(ne=>ne.sessionStatus),T=X(ne=>ne.removeSession),ae=X(ne=>ne.sessionNames),J=X(ne=>ne.recentlyRenamed),W=X(ne=>ne.clearRecentlyRenamed),B=X(ne=>ne.pendingPermissions),F=X(ne=>ne.linkedLinearIssues),Y=X(ne=>ne.collapsedProjects),xe=X(ne=>ne.toggleProjectCollapse),R=ix(A);S.useEffect(()=>{let ne=!0;async function me(){try{const Xe=await Ne.listSessions();if(ne){const Bt=X.getState();Bt.setSdkSessions(Xe);const ln=X.getState(),Tn=new Set(Xe.map(Pt=>Pt.sessionId));for(const Pt of ln.sessions.keys())!Tn.has(Pt)&&ln.connectionStatus.get(Pt)!=="connected"&&ln.removeSession(Pt);f3(Xe);for(const Pt of Xe)if(Pt.name&&(!Bt.sessionNames.has(Pt.sessionId)||/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(Bt.sessionNames.get(Pt.sessionId)))){const zn=Bt.sessionNames.get(Pt.sessionId),xr=!!zn&&/^[A-Z][a-z]+ [A-Z][a-z]+$/.test(zn);zn!==Pt.name&&(Bt.setSessionName(Pt.sessionId,Pt.name),xr&&Bt.markRecentlyRenamed(Pt.sessionId))}}}catch{}}me();const ve=setInterval(me,5e3);return()=>{ne=!1,clearInterval(ve)}},[]),S.useEffect(()=>{const ne=()=>C(window.location.hash);return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]);function P(ne){sx(ne),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}function Z(){am(),X.getState().newSession(),window.innerWidth<768&&X.getState().setSidebarOpen(!1)}S.useEffect(()=>{e&&L.current&&(L.current.focus(),L.current.select())},[e]);function M(){e&&n.trim()&&(X.getState().setSessionName(e,n.trim()),Ne.renameSession(e,n.trim()).catch(()=>{})),t(null),i("")}function de(){t(null),i("")}function be(ne,me){t(ne),i(me)}const je=S.useCallback((ne,me)=>{ne.stopPropagation(),j(me)},[]),Re=S.useCallback(async ne=>{try{zm(ne),await Ne.deleteSession(ne)}catch{}X.getState().currentSessionId===ne&&am(),T(ne)},[T]),Le=S.useCallback(()=>{_&&(Re(_),j(null))},[_,Re]),Be=S.useCallback(()=>{j(null)},[]),Je=S.useCallback(()=>{k(!0)},[]),it=S.useCallback(async()=>{k(!1);const ne=X.getState(),me=new Set;for(const Xe of ne.sessions.keys())me.add(Xe);for(const Xe of ne.sdkSessions)me.add(Xe.sessionId);const ve=Array.from(me).filter(Xe=>{const Bt=ne.sdkSessions.find(ln=>ln.sessionId===Xe);return(Bt==null?void 0:Bt.archived)??!1});for(const Xe of ve)await Re(Xe)},[Re]),ht=S.useCallback(()=>{k(!1)},[]);S.useEffect(()=>{if(!_&&!N)return;requestAnimationFrame(()=>{var me,ve;(ve=(me=D.current)==null?void 0:me.querySelector("button"))==null||ve.focus()});function ne(me){var ln;if(me.key==="Escape"){N?ht():Be();return}if(me.key!=="Tab")return;const ve=(ln=D.current)==null?void 0:ln.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!ve||ve.length===0)return;const Xe=ve[0],Bt=ve[ve.length-1];me.shiftKey&&document.activeElement===Xe?(me.preventDefault(),Bt.focus()):!me.shiftKey&&document.activeElement===Bt&&(me.preventDefault(),Xe.focus())}return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[_,N,Be,ht]);const Xt=S.useCallback(async(ne,me)=>{ne.stopPropagation();const ve=q.find(zn=>zn.sessionId===me),Xe=z.get(me),Bt=(Xe==null?void 0:Xe.is_containerized)||!!(ve!=null&&ve.containerId)||!1,ln=F.get(me),Tn=((ln==null?void 0:ln.stateType)||"").toLowerCase();if(ln&&!(Tn==="completed"||Tn==="canceled"||Tn==="cancelled"))try{const zn=await Ne.getArchiveInfo(me);if(zn.issueNotDone){p(me),x(zn),y(Bt);return}}catch{}if(Bt){f(me);return}pt(me)},[q,z,F]),pt=S.useCallback(async(ne,me,ve)=>{try{zm(ne);const Xe={};me&&(Xe.force=!0),ve&&ve!=="none"&&(Xe.linearTransition=ve),await Ne.archiveSession(ne,Object.keys(Xe).length>0?Xe:void 0)}catch{}X.getState().currentSessionId===ne&&(am(),X.getState().newSession());try{const Xe=await Ne.listSessions();X.getState().setSdkSessions(Xe)}catch{}},[]),yt=S.useCallback(()=>{u&&(pt(u,!0),f(null))},[u,pt]),kt=S.useCallback(()=>{f(null)},[]),ge=S.useCallback((ne,me)=>{h&&(pt(h,me,ne),p(null),x(null))},[h,pt]),Fe=S.useCallback(()=>{p(null),x(null)},[]),ct=S.useCallback(async(ne,me)=>{ne.stopPropagation();try{await Ne.unarchiveSession(me)}catch{}try{const ve=await Ne.listSessions();X.getState().setSdkSessions(ve)}catch{}},[]),mn=new Set;for(const ne of z.keys())mn.add(ne);for(const ne of q)mn.add(ne.sessionId);const ke=Array.from(mn).map(ne=>{var Xe;const me=z.get(ne),ve=q.find(Bt=>Bt.sessionId===ne);return{id:ne,model:(me==null?void 0:me.model)||(ve==null?void 0:ve.model)||"",cwd:(me==null?void 0:me.cwd)||(ve==null?void 0:ve.cwd)||"",gitBranch:(me==null?void 0:me.git_branch)||(ve==null?void 0:ve.gitBranch)||"",isContainerized:(me==null?void 0:me.is_containerized)||!!(ve!=null&&ve.containerId)||!1,gitAhead:(me==null?void 0:me.git_ahead)||(ve==null?void 0:ve.gitAhead)||0,gitBehind:(me==null?void 0:me.git_behind)||(ve==null?void 0:ve.gitBehind)||0,linesAdded:(me==null?void 0:me.total_lines_added)||(ve==null?void 0:ve.totalLinesAdded)||0,linesRemoved:(me==null?void 0:me.total_lines_removed)||(ve==null?void 0:ve.totalLinesRemoved)||0,isConnected:G.get(ne)??!1,isReconnecting:O.get(ne)??!1,status:I.get(ne)??null,sdkState:(ve==null?void 0:ve.state)??null,createdAt:(ve==null?void 0:ve.createdAt)??0,archived:(ve==null?void 0:ve.archived)??!1,backendType:(me==null?void 0:me.backend_type)||(ve==null?void 0:ve.backendType)||"claude",repoRoot:(me==null?void 0:me.repo_root)||"",permCount:((Xe=B.get(ne))==null?void 0:Xe.size)??0,cronJobId:(me==null?void 0:me.cronJobId)||(ve==null?void 0:ve.cronJobId),cronJobName:(me==null?void 0:me.cronJobName)||(ve==null?void 0:ve.cronJobName),agentId:(me==null?void 0:me.agentId)||(ve==null?void 0:ve.agentId),agentName:(me==null?void 0:me.agentName)||(ve==null?void 0:ve.agentName),userName:ve==null?void 0:ve.userName}}).sort((ne,me)=>me.createdAt-ne.createdAt),ze=S.useMemo(()=>Array.from(new Set(ke.map(ne=>ne.userName).filter(ne=>!!ne))).sort(),[ke]),[mt,Ee]=S.useState("__all__"),Br=ne=>mt==="__all__"?!0:mt==="__none__"?!ne.userName:ne.userName===mt,le=ke.some(ne=>!ne.userName),ye=ke.filter(Br),Q=ye.filter(ne=>!ne.archived&&!ne.cronJobId&&!ne.agentId),he=ye.filter(ne=>!ne.archived&&!!ne.cronJobId),Me=ye.filter(ne=>!ne.archived&&!!ne.agentId),Qe=ye.filter(ne=>ne.archived),nt=$?ke.find(ne=>ne.id===$):null,rt=(nt==null?void 0:nt.backendType)==="codex"?"/logo-codex.svg":"/logo.svg",[wt,gn]=S.useState(!0),[et,rr]=S.useState(!0),En=S.useMemo(()=>rE(Q),[Q]),Xr={onSelect:P,onStartRename:be,onArchive:Xt,onUnarchive:ct,onDelete:je,onClearRecentlyRenamed:W,editingSessionId:e,editingName:n,setEditingName:i,onConfirmRename:M,onCancelRename:de,editInputRef:L};return l.jsxs("aside",{"aria-label":"Session sidebar",className:"w-full md:w-[260px] h-full flex flex-col bg-cc-sidebar",children:[l.jsx("div",{className:"p-3.5 pb-2",children:l.jsxs("div",{className:"flex items-center gap-2.5",children:[l.jsx("img",{src:rt,alt:"",className:"w-6 h-6"}),l.jsx("span",{className:"text-[13px] font-semibold text-cc-fg tracking-tight",children:"The Companion"}),l.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"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})}),l.jsx("button",{onClick:()=>X.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4",children:l.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"})})})]})}),ze.length>0&&l.jsxs("div",{className:"px-3.5 pb-2",children:[l.jsx("label",{className:"sr-only",htmlFor:"sidebar-user-filter",children:"Filter sessions by user"}),l.jsxs("select",{id:"sidebar-user-filter",value:mt,onChange:ne=>Ee(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:[l.jsx("option",{value:"__all__",children:"All users"}),ze.map(ne=>l.jsx("option",{value:ne,children:ne},ne)),le&&l.jsx("option",{value:"__none__",children:"No user data"})]})]}),u&&l.jsx("div",{className:"mx-2 mb-1 p-2.5 rounded-[10px] bg-cc-warning/10 border border-cc-warning/20",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-warning shrink-0 mt-0.5",children:l.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"})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("p",{className:"text-[11px] text-cc-fg leading-snug",children:["Archiving will ",l.jsx("strong",{children:"remove the container"})," and any uncommitted changes."]}),l.jsxs("div",{className:"flex gap-2 mt-2",children:[l.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"}),l.jsx("button",{onClick:yt,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"})]})]})]})}),l.jsx("div",{className:"flex-1 overflow-y-auto px-2.5 pb-2",children:Q.length===0&&he.length===0&&Qe.length===0?l.jsx("p",{className:"px-3 py-8 text-xs text-cc-muted text-center leading-relaxed",children:"No sessions yet."}):l.jsxs(l.Fragment,{children:[En.map((ne,me)=>l.jsx(eE,{group:ne,isCollapsed:Y.has(ne.key),onToggleCollapse:xe,currentSessionId:$,sessionNames:ae,pendingPermissions:B,recentlyRenamed:J,isFirst:me===0,...Xr},ne.key)),he.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>gn(!wt),"aria-expanded":wt,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${wt?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Scheduled Runs (",he.length,")"]}),wt&&l.jsx("div",{className:"mt-0.5",children:he.map(ne=>{var me;return l.jsx(Td,{session:ne,isActive:$===ne.id,sessionName:ae.get(ne.id),permCount:((me=B.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Me.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("button",{onClick:()=>rr(!et),"aria-expanded":et,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${et?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Agent Runs (",Me.length,")"]}),et&&l.jsx("div",{className:"mt-0.5",children:Me.map(ne=>{var me;return l.jsx(Td,{session:ne,isActive:$===ne.id,sessionName:ae.get(ne.id),permCount:((me=B.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]}),Qe.length>0&&l.jsxs("div",{className:"mt-3 pt-3 border-t border-cc-separator",children:[l.jsxs("div",{className:"flex items-center",children:[l.jsxs("button",{onClick:()=>o(!a),"aria-expanded":a,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-2 h-2 text-cc-muted/50 transition-transform duration-150 ${a?"rotate-90":""}`,children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),"Archived (",Qe.length,")"]}),a&&Qe.length>1&&l.jsx("button",{onClick:Je,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"})]}),a&&l.jsx("div",{className:"mt-0.5",children:Qe.map(ne=>{var me;return l.jsx(Td,{session:ne,isActive:$===ne.id,isArchived:!0,sessionName:ae.get(ne.id),permCount:((me=B.get(ne.id))==null?void 0:me.size)??0,isRecentlyRenamed:J.has(ne.id),...Xr},ne.id)})})]})]})}),l.jsx("div",{className:"md:hidden flex justify-end px-4 pb-2",children:l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-5 h-5",children:l.jsx("path",{d:"M8 3v10M3 8h10"})})})}),l.jsxs("div",{className:"px-2 py-1.5 pb-safe bg-cc-sidebar-footer border-t border-cc-border/30",children:[l.jsx("nav",{className:"flex flex-col gap-1.5","aria-label":"Navigation",children:aE.map(ne=>l.jsxs("section",{className:"rounded-lg border border-cc-border/30 bg-cc-card/20 p-0.5",children:[l.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75 block",children:ne.label}),l.jsx("div",{className:"flex flex-col",children:ne.itemIds.map(me=>{const ve=lE.get(me);if(!ve)return null;const Xe=ve.activePages?ve.activePages.some(Bt=>R.page===Bt):R.page===ve.id;return l.jsxs("button",{onClick:()=>{window.location.hash=ve.hash,window.innerWidth<768&&X.getState().setSidebarOpen(!1)},title:ve.label,"aria-current":Xe?"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 ${Xe?"bg-cc-active text-cc-fg":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:[l.jsx("span",{"aria-hidden":!0,className:`h-4 w-0.5 shrink-0 rounded-full transition-colors ${Xe?"bg-cc-primary":"bg-transparent group-hover:bg-cc-border"}`}),l.jsx("svg",{viewBox:ve.viewBox,fill:"currentColor",className:"w-3.5 h-3.5 shrink-0",children:l.jsx("path",{d:ve.iconPath,fillRule:ve.fillRule,clipRule:ve.clipRule})}),l.jsx("span",{className:"min-w-0 flex-1 text-[12px] font-medium leading-tight",children:ve.label})]},ve.id)})})]},ne.id))}),l.jsx("div",{className:"mt-1.5 rounded-lg border border-cc-border/30 bg-cc-card/20 px-1.5 py-0.5",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-[0.14em] text-cc-muted/75",children:"Resources"}),l.jsx("div",{className:"flex items-center gap-0.5",children:iE.map(ne=>l.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:l.jsx("svg",{viewBox:ne.viewBox,fill:"currentColor",className:"w-3.5 h-3.5",children:l.jsx("path",{d:ne.iconPath})})},ne.label))})]})})]}),(_||N)&&l.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:N?ht:Be,children:l.jsxs("div",{ref:D,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:[l.jsx("div",{className:"flex justify-center mb-3",children:l.jsx("div",{className:"w-10 h-10 rounded-full bg-cc-error/10 flex items-center justify-center",children:l.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error",children:[l.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"}),l.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"})]})})}),l.jsx("p",{id:"delete-dialog-title",className:"text-[13px] font-semibold text-cc-fg text-center",children:N?"Delete all archived?":"Delete session?"}),l.jsx("p",{id:"delete-dialog-desc",className:"text-[12px] text-cc-muted text-center mt-1.5 leading-relaxed",children:N?`This will permanently delete ${Qe.length} archived session${Qe.length===1?"":"s"}. This cannot be undone.`:"This will permanently delete this session and its history. This cannot be undone."}),l.jsxs("div",{className:"flex gap-2.5 mt-4",children:[l.jsx("button",{onClick:N?ht:Be,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"}),l.jsx("button",{onClick:N?it: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:N?"Delete all":"Delete"})]})]})}),h&&g&&l.jsx(X4,{issueIdentifier:((Pr=g.issue)==null?void 0:Pr.identifier)||"",issueStateName:(($r=g.issue)==null?void 0:$r.stateName)||"",isContainerized:b,archiveTransitionConfigured:g.archiveTransitionConfigured||!1,archiveTransitionStateName:g.archiveTransitionStateName,hasBacklogState:g.hasBacklogState||!1,onConfirm:ge,onCancel:Fe})]})}function cE(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const uE=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,dE=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,fE={};function Yy(e,t){return(fE.jsx?dE:uE).test(e)}const hE=/[ \t\n\f\r]/g;function pE(e){return typeof e=="object"?e.type==="text"?Wy(e.value):!1:Wy(e)}function Wy(e){return e.replace(hE,"")===""}class Rc{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}Rc.prototype.normal={};Rc.prototype.property={};Rc.prototype.space=void 0;function r2(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new Rc(n,i,t)}function _g(e){return e.toLowerCase()}class nr{constructor(t,n){this.attribute=n,this.property=t}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let mE=0;const Ve=wa(),hn=wa(),wg=wa(),we=wa(),Dt=wa(),xa=wa(),hr=wa();function wa(){return 2**++mE}const Sg=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ve,booleanish:hn,commaOrSpaceSeparated:hr,commaSeparated:xa,number:we,overloadedBoolean:wg,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),lm=Object.keys(Sg);class ax extends nr{constructor(t,n,i,a){let o=-1;if(super(t,n),Qy(this,"space",a),typeof i=="number")for(;++o<lm.length;){const u=lm[o];Qy(this,lm[o],(i&Sg[u])===Sg[u])}}}ax.prototype.defined=!0;function Qy(e,t,n){n&&(e[t]=n)}function zl(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const o=new ax(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),t[i]=o,n[_g(i)]=i,n[_g(o.attribute)]=i}return new Rc(t,n,e.space)}const i2=zl({properties:{ariaActiveDescendant:null,ariaAtomic:hn,ariaAutoComplete:null,ariaBusy:hn,ariaChecked:hn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:hn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:hn,ariaFlowTo:Dt,ariaGrabbed:hn,ariaHasPopup:null,ariaHidden:hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:we,ariaLive:null,ariaModal:hn,ariaMultiLine:hn,ariaMultiSelectable:hn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:hn,ariaReadOnly:hn,ariaRelevant:null,ariaRequired:hn,ariaRoleDescription:Dt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:hn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function s2(e,t){return t in e?e[t]:t}function a2(e,t){return s2(e,t.toLowerCase())}const gE=zl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xa,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:Ve,allowPaymentRequest:Ve,allowUserMedia:Ve,alpha:Ve,alt:null,as:null,async:Ve,autoCapitalize:null,autoComplete:Dt,autoFocus:Ve,autoPlay:Ve,blocking:Dt,capture:null,charSet:null,checked:Ve,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:we,colSpan:we,command:null,commandFor:null,content:null,contentEditable:hn,controls:Ve,controlsList:Dt,coords:we|xa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ve,defer:Ve,dir:null,dirName:null,disabled:Ve,download:wg,draggable:hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ve,formTarget:null,headers:Dt,height:we,hidden:wg,high:we,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:Ve,inputMode:null,integrity:null,is:null,isMap:Ve,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:Ve,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ve,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:Ve,muted:Ve,name:null,nonce:null,noModule:Ve,noValidate:Ve,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:Ve,optimum:we,pattern:null,ping:Dt,placeholder:null,playsInline:Ve,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ve,referrerPolicy:null,rel:Dt,required:Ve,reversed:Ve,rows:we,rowSpan:we,sandbox:Dt,scope:null,scoped:Ve,seamless:Ve,selected:Ve,shadowRootClonable:Ve,shadowRootCustomElementRegistry:Ve,shadowRootDelegatesFocus:Ve,shadowRootMode:null,shadowRootSerializable:Ve,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:Ve,useMap:null,value:hn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ve,declare:Ve,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:Ve,noHref:Ve,noShade:Ve,noWrap:Ve,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:hn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ve,disablePictureInPicture:Ve,disableRemotePlayback:Ve,exportParts:xa,part:Dt,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:a2}),xE=zl({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:hr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Dt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:Ve,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:xa,g2:xa,glyphName:xa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:hr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:hr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:hr,rev:hr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:hr,requiredFeatures:hr,requiredFonts:hr,requiredFormats:hr,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:hr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:hr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:hr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:s2}),l2=zl({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()}}),o2=zl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:a2}),c2=zl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),vE={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"},bE=/[A-Z]/g,Xy=/-[a-z]/g,yE=/^data[-\w.:]+$/i;function _E(e,t){const n=_g(t);let i=t,a=nr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&yE.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Xy,SE);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Xy.test(o)){let u=o.replace(bE,wE);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=ax}return new a(i,t)}function wE(e){return"-"+e.toLowerCase()}function SE(e){return e.charAt(1).toUpperCase()}const kE=r2([i2,gE,l2,o2,c2],"html"),lx=r2([i2,xE,l2,o2,c2],"svg");function jE(e){return e.join(" ").trim()}var ml={},om,Ky;function NE(){if(Ky)return om;Ky=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,h=`
|
|
68
68
|
`,p="/",g="*",x="",b="comment",y="declaration";function _(N,k){if(typeof N!="string")throw new TypeError("First argument must be a string");if(!N)return[];k=k||{};var A=1,C=1;function L(J){var W=J.match(t);W&&(A+=W.length);var B=J.lastIndexOf(h);C=~B?J.length-B:C+J.length}function D(){var J={line:A,column:C};return function(W){return W.position=new z(J),G(),W}}function z(J){this.start=J,this.end={line:A,column:C},this.source=k.source}z.prototype.content=N;function q(J){var W=new Error(k.source+":"+A+":"+C+": "+J);if(W.reason=J,W.filename=k.source,W.line=A,W.column=C,W.source=N,!k.silent)throw W}function $(J){var W=J.exec(N);if(W){var B=W[0];return L(B),N=N.slice(B.length),W}}function G(){$(n)}function O(J){var W;for(J=J||[];W=I();)W!==!1&&J.push(W);return J}function I(){var J=D();if(!(p!=N.charAt(0)||g!=N.charAt(1))){for(var W=2;x!=N.charAt(W)&&(g!=N.charAt(W)||p!=N.charAt(W+1));)++W;if(W+=2,x===N.charAt(W-1))return q("End of comment missing");var B=N.slice(2,W-2);return C+=2,L(B),N=N.slice(W),C+=2,J({type:b,comment:B})}}function T(){var J=D(),W=$(i);if(W){if(I(),!$(a))return q("property missing ':'");var B=$(o),F=J({type:y,property:j(W[0].replace(e,x)),value:B?j(B[0].replace(e,x)):x});return $(u),F}}function ae(){var J=[];O(J);for(var W;W=T();)W!==!1&&(J.push(W),O(J));return J}return G(),ae()}function j(N){return N?N.replace(f,x):x}return om=_,om}var Zy;function CE(){if(Zy)return ml;Zy=1;var e=ml&&ml.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ml,"__esModule",{value:!0}),ml.default=n;const t=e(NE());function n(i,a){let o=null;if(!i||typeof i!="string")return o;const u=(0,t.default)(i),f=typeof a=="function";return u.forEach(h=>{if(h.type!=="declaration")return;const{property:p,value:g}=h;f?a(p,g,h):g&&(o=o||{},o[p]=g)}),o}return ml}var Go={},Jy;function EE(){if(Jy)return Go;Jy=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=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={}),o(p)?p:(p=p.toLowerCase(),g.reactCompat?p=p.replace(a,f):p=p.replace(i,f),p.replace(t,u))};return Go.camelCase=h,Go}var Yo,e_;function TE(){if(e_)return Yo;e_=1;var e=Yo&&Yo.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(CE()),n=EE();function i(a,o){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(f,h){f&&h&&(u[(0,n.camelCase)(f,o)]=h)}),u}return i.default=i,Yo=i,Yo}var AE=TE();const ME=Og(AE),u2=d2("end"),ox=d2("start");function d2(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 RE(e){const t=ox(e),n=u2(e);if(t&&n)return{start:t,end:n}}function fc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?t_(e.position):"start"in e||"end"in e?t_(e):"line"in e||"column"in e?kg(e):""}function kg(e){return n_(e&&e.line)+":"+n_(e&&e.column)}function t_(e){return kg(e&&e.start)+"-"+kg(e&&e.end)}function n_(e){return e&&typeof e=="number"?e:1}class Dn extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?a=t:!o.cause&&t&&(u=!0,a=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof i=="string"){const h=i.indexOf(":");h===-1?o.ruleId=i:(o.source=i.slice(0,h),o.ruleId=i.slice(h+1))}if(!o.place&&o.ancestors&&o.ancestors){const h=o.ancestors[o.ancestors.length-1];h&&(o.place=h.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=f?f.line:void 0,this.name=fc(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Dn.prototype.file="";Dn.prototype.name="";Dn.prototype.reason="";Dn.prototype.message="";Dn.prototype.stack="";Dn.prototype.column=void 0;Dn.prototype.line=void 0;Dn.prototype.ancestors=void 0;Dn.prototype.cause=void 0;Dn.prototype.fatal=void 0;Dn.prototype.place=void 0;Dn.prototype.ruleId=void 0;Dn.prototype.source=void 0;const cx={}.hasOwnProperty,LE=new Map,DE=/[A-Z]/g,zE=new Set(["table","tbody","thead","tfoot","tr"]),OE=new Set(["td","th"]),f2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BE(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=VE(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=qE(n,t.jsx,t.jsxs)}const a={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"?lx:kE,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=h2(a,e,void 0);return o&&typeof o!="string"?o:a.create(e,a.Fragment,{children:o||void 0},void 0)}function h2(e,t,n){if(t.type==="element")return PE(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return $E(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return UE(e,t,n);if(t.type==="mdxjsEsm")return FE(e,t);if(t.type==="root")return HE(e,t,n);if(t.type==="text")return IE(e,t)}function PE(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=lx,e.schema=a),e.ancestors.push(t);const o=m2(e,t.tagName,!1),u=GE(e,t);let f=dx(e,t);return zE.has(t.tagName)&&(f=f.filter(function(h){return typeof h=="string"?!pE(h):!0})),p2(e,u,o,t),ux(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function $E(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)}Cc(e,t.position)}function FE(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cc(e,t.position)}function UE(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=lx,e.schema=a),e.ancestors.push(t);const o=t.name===null?e.Fragment:m2(e,t.name,!0),u=YE(e,t),f=dx(e,t);return p2(e,u,o,t),ux(u,f),e.ancestors.pop(),e.schema=i,e.create(t,o,u,n)}function HE(e,t,n){const i={};return ux(i,dx(e,t)),e.create(t,e.Fragment,i,n)}function IE(e,t){return t.value}function p2(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function ux(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function qE(e,t,n){return i;function i(a,o,u,f){const p=Array.isArray(u.children)?n:t;return f?p(o,u,f):p(o,u)}}function VE(e,t){return n;function n(i,a,o,u){const f=Array.isArray(o.children),h=ox(i);return t(a,o,u,f,{columnNumber:h?h.column-1:void 0,fileName:e,lineNumber:h?h.line:void 0},void 0)}}function GE(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&cx.call(t.properties,a)){const o=WE(e,a,t.properties[a]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&OE.has(t.tagName)?i=f:n[u]=f}}if(i){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function YE(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const o=i.data.estree.body[0];o.type;const u=o.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else Cc(e,t.position);else{const a=i.name;let o;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,o=e.evaluater.evaluateExpression(f.expression)}else Cc(e,t.position);else o=i.value===null?!0:i.value;n[a]=o}return n}function dx(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:LE;for(;++i<t.children.length;){const o=t.children[i];let u;if(e.passKeys){const h=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(h){const p=a.get(h)||0;u=h+"-"+p,a.set(h,p+1)}}const f=h2(e,o,u);f!==void 0&&n.push(f)}return n}function WE(e,t,n){const i=_E(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?cE(n):jE(n)),i.property==="style"){let a=typeof n=="object"?n:QE(e,String(n));return e.stylePropertyNameCase==="css"&&(a=XE(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?vE[i.property]||i.property:i.attribute,n]}}function QE(e,t){try{return ME(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new Dn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=f2+"#cannot-parse-style-attribute",a}}function m2(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let o=-1,u;for(;++o<a.length;){const f=Yy(a[o])?{type:"Identifier",name:a[o]}:{type:"Literal",value:a[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}i=u}else i=Yy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return cx.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Cc(e)}function Cc(e,t){const n=new Dn("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=f2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function XE(e){const t={};let n;for(n in e)cx.call(e,n)&&(t[KE(n)]=e[n]);return t}function KE(e){let t=e.replace(DE,ZE);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ZE(e){return"-"+e.toLowerCase()}const cm={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"]},JE={};function fx(e,t){const n=JE,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return g2(e,i,a)}function g2(e,t,n){if(e6(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 r_(e.children,t,n)}return Array.isArray(e)?r_(e,t,n):""}function r_(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=g2(e[a],t,n);return i.join("")}function e6(e){return!!(e&&typeof e=="object")}const i_=document.createElement("i");function hx(e){const t="&"+e+";";i_.innerHTML=t;const n=i_.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function gr(e,t,n,i){const a=e.length;let o=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a: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);o<i.length;)u=i.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function zr(e,t){return e.length>0?(gr(e,e.length,0,t),e):t}const s_={}.hasOwnProperty;function x2(e){const t={};let n=-1;for(;++n<e.length;)t6(t,e[n]);return t}function t6(e,t){let n;for(n in t){const a=(s_.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){s_.call(a,u)||(a[u]=[]);const f=o[u];n6(a[u],Array.isArray(f)?f:f?[f]:[])}}}function n6(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);gr(e,0,0,i)}function v2(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 Qr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Un=Rs(/[A-Za-z]/),Ln=Rs(/[\dA-Za-z]/),r6=Rs(/[#-'*+\--9=?A-Z^-~]/);function sf(e){return e!==null&&(e<32||e===127)}const jg=Rs(/\d/),i6=Rs(/[\dA-Fa-f]/),s6=Rs(/[!-/:-@[-`{-~]/);function $e(e){return e!==null&&e<-2}function Ot(e){return e!==null&&(e<0||e===32)}function ot(e){return e===-2||e===-1||e===32}const mf=Rs(new RegExp("\\p{P}|\\p{S}","u")),ya=Rs(/\s/);function Rs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ol(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&Ln(e.charCodeAt(n+1))&&Ln(e.charCodeAt(n+2)))a=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),a=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(i,n),encodeURIComponent(u)),i=n+a+1,u=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function xt(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(h){return ot(h)?(e.enter(n),f(h)):t(h)}function f(h){return ot(h)&&o++<a?(e.consume(h),f):(e.exit(n),t(h))}}const a6={tokenize:l6};function l6(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),xt(e,t,"linePrefix")}function a(f){return e.enter("paragraph"),o(f)}function o(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"),o):(e.consume(f),u)}}const o6={tokenize:c6},a_={tokenize:u6};function c6(e){const t=this,n=[];let i=0,a,o,u;return f;function f(C){if(i<n.length){const L=n[i];return t.containerState=L[1],e.attempt(L[0].continuation,h,p)(C)}return p(C)}function h(C){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&A();const L=t.events.length;let D=L,z;for(;D--;)if(t.events[D][0]==="exit"&&t.events[D][1].type==="chunkFlow"){z=t.events[D][1].end;break}k(i);let q=L;for(;q<t.events.length;)t.events[q][1].end={...z},q++;return gr(t.events,D+1,0,t.events.slice(L)),t.events.length=q,p(C)}return f(C)}function p(C){if(i===n.length){if(!a)return b(C);if(a.currentConstruct&&a.currentConstruct.concrete)return _(C);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(a_,g,x)(C)}function g(C){return a&&A(),k(i),b(C)}function x(C){return t.parser.lazy[t.now().line]=i!==n.length,u=t.now().offset,_(C)}function b(C){return t.containerState={},e.attempt(a_,y,_)(C)}function y(C){return i++,n.push([t.currentConstruct,t.containerState]),b(C)}function _(C){if(C===null){a&&A(),k(0),e.consume(C);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:o}),j(C)}function j(C){if(C===null){N(e.exit("chunkFlow"),!0),k(0),e.consume(C);return}return $e(C)?(e.consume(C),N(e.exit("chunkFlow")),i=0,t.interrupt=void 0,f):(e.consume(C),j)}function N(C,L){const D=t.sliceStream(C);if(L&&D.push(null),C.previous=o,o&&(o.next=C),o=C,a.defineSkip(C.start),a.write(D),t.parser.lazy[C.start.line]){let z=a.events.length;for(;z--;)if(a.events[z][1].start.offset<u&&(!a.events[z][1].end||a.events[z][1].end.offset>u))return;const q=t.events.length;let $=q,G,O;for(;$--;)if(t.events[$][0]==="exit"&&t.events[$][1].type==="chunkFlow"){if(G){O=t.events[$][1].end;break}G=!0}for(k(i),z=q;z<t.events.length;)t.events[z][1].end={...O},z++;gr(t.events,$+1,0,t.events.slice(q)),t.events.length=z}}function k(C){let L=n.length;for(;L-- >C;){const D=n[L];t.containerState=D[1],D[0].exit.call(t,e)}n.length=C}function A(){a.write([null]),o=void 0,a=void 0,t.containerState._closeFlow=void 0}}function u6(e,t,n){return xt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rl(e){if(e===null||Ot(e)||ya(e))return 1;if(mf(e))return 2}function gf(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const o=e[a].resolveAll;o&&!i.includes(o)&&(t=o(t,n),i.push(o))}return t}const Ng={name:"attention",resolveAll:d6,tokenize:f6};function d6(e,t){let n=-1,i,a,o,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 x={...e[i][1].end},b={...e[n][1].start};l_(x,-h),l_(b,h),u={type:h>1?"strongSequence":"emphasisSequence",start:x,end:{...e[i][1].end}},f={type:h>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},o={type:h>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={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=zr(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=zr(p,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",o,t]]),p=zr(p,gf(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=zr(p,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(g=2,p=zr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):g=0,gr(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 f6(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Rl(i);let o;return u;function u(h){return o=h,e.enter("attentionSequence"),f(h)}function f(h){if(h===o)return e.consume(h),f;const p=e.exit("attentionSequence"),g=Rl(h),x=!g||g===2&&a||n.includes(h),b=!a||a===2&&g||n.includes(i);return p._open=!!(o===42?x:x&&(a||!b)),p._close=!!(o===42?b:b&&(g||!x)),t(h)}}function l_(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const h6={name:"autolink",tokenize:p6};function p6(e,t,n){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(y){return Un(y)?(e.consume(y),u):y===64?n(y):p(y)}function u(y){return y===43||y===45||y===46||Ln(y)?(i=1,f(y)):p(y)}function f(y){return y===58?(e.consume(y),i=0,h):(y===43||y===45||y===46||Ln(y))&&i++<32?(e.consume(y),f):(i=0,p(y))}function h(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||sf(y)?n(y):(e.consume(y),h)}function p(y){return y===64?(e.consume(y),g):r6(y)?(e.consume(y),p):n(y)}function g(y){return Ln(y)?x(y):n(y)}function x(y){return y===46?(e.consume(y),i=0,g):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):b(y)}function b(y){if((y===45||Ln(y))&&i++<63){const _=y===45?b:x;return e.consume(y),_}return n(y)}}const Lc={partial:!0,tokenize:m6};function m6(e,t,n){return i;function i(o){return ot(o)?xt(e,a,"linePrefix")(o):a(o)}function a(o){return o===null||$e(o)?t(o):n(o)}}const b2={continuation:{tokenize:x6},exit:v6,name:"blockQuote",tokenize:g6};function g6(e,t,n){const i=this;return a;function a(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"),o}return n(u)}function o(u){return ot(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function x6(e,t,n){const i=this;return a;function a(u){return ot(u)?xt(e,o,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(b2,t,n)(u)}}function v6(e){e.exit("blockQuote")}const y2={name:"characterEscape",tokenize:b6};function b6(e,t,n){return i;function i(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),a}function a(o){return s6(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const _2={name:"characterReference",tokenize:y6};function y6(e,t,n){const i=this;let a=0,o,u;return f;function f(x){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),h}function h(x){return x===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(x),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),o=31,u=Ln,g(x))}function p(x){return x===88||x===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(x),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=i6,g):(e.enter("characterReferenceValue"),o=7,u=jg,g(x))}function g(x){if(x===59&&a){const b=e.exit("characterReferenceValue");return u===Ln&&!hx(i.sliceSerialize(b))?n(x):(e.enter("characterReferenceMarker"),e.consume(x),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(x)&&a++<o?(e.consume(x),g):n(x)}}const o_={partial:!0,tokenize:w6},c_={concrete:!0,name:"codeFenced",tokenize:_6};function _6(e,t,n){const i=this,a={partial:!0,tokenize:D};let o=0,u=0,f;return h;function h(z){return p(z)}function p(z){const q=i.events[i.events.length-1];return o=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,f=z,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(z)}function g(z){return z===f?(u++,e.consume(z),g):u<3?n(z):(e.exit("codeFencedFenceSequence"),ot(z)?xt(e,x,"whitespace")(z):x(z))}function x(z){return z===null||$e(z)?(e.exit("codeFencedFence"),i.interrupt?t(z):e.check(o_,j,L)(z)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(z))}function b(z){return z===null||$e(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),x(z)):ot(z)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),xt(e,y,"whitespace")(z)):z===96&&z===f?n(z):(e.consume(z),b)}function y(z){return z===null||$e(z)?x(z):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),_(z))}function _(z){return z===null||$e(z)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),x(z)):z===96&&z===f?n(z):(e.consume(z),_)}function j(z){return e.attempt(a,L,N)(z)}function N(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),k}function k(z){return o>0&&ot(z)?xt(e,A,"linePrefix",o+1)(z):A(z)}function A(z){return z===null||$e(z)?e.check(o_,j,L)(z):(e.enter("codeFlowValue"),C(z))}function C(z){return z===null||$e(z)?(e.exit("codeFlowValue"),A(z)):(e.consume(z),C)}function L(z){return e.exit("codeFenced"),t(z)}function D(z,q,$){let G=0;return O;function O(W){return z.enter("lineEnding"),z.consume(W),z.exit("lineEnding"),I}function I(W){return z.enter("codeFencedFence"),ot(W)?xt(z,T,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):T(W)}function T(W){return W===f?(z.enter("codeFencedFenceSequence"),ae(W)):$(W)}function ae(W){return W===f?(G++,z.consume(W),ae):G>=u?(z.exit("codeFencedFenceSequence"),ot(W)?xt(z,J,"whitespace")(W):J(W)):$(W)}function J(W){return W===null||$e(W)?(z.exit("codeFencedFence"),q(W)):$(W)}}}function w6(e,t,n){const i=this;return a;function a(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}const um={name:"codeIndented",tokenize:k6},S6={partial:!0,tokenize:j6};function k6(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),xt(e,o,"linePrefix",5)(p)}function o(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(S6,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 j6(e,t,n){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?n(u):$e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):xt(e,o,"linePrefix",5)(u)}function o(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)?a(u):n(u)}}const N6={name:"codeText",previous:E6,resolve:C6,tokenize:T6};function C6(e){let t=e.length-4,n=3,i,a;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;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function E6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function T6(e,t,n){let i=0,a,o;return u;function u(x){return e.enter("codeText"),e.enter("codeTextSequence"),f(x)}function f(x){return x===96?(e.consume(x),i++,f):(e.exit("codeTextSequence"),h(x))}function h(x){return x===null?n(x):x===32?(e.enter("space"),e.consume(x),e.exit("space"),h):x===96?(o=e.enter("codeTextSequence"),a=0,g(x)):$e(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),h):(e.enter("codeTextData"),p(x))}function p(x){return x===null||x===32||x===96||$e(x)?(e.exit("codeTextData"),h(x)):(e.consume(x),p)}function g(x){return x===96?(e.consume(x),a++,g):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(x)):(o.type="codeTextData",p(x))}}class A6{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 a=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&Wo(this.left,i),o.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),Wo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Wo(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);Wo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Wo(this.left,n.reverse())}}}function Wo(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 w2(e){const t={};let n=-1,i,a,o,u,f,h,p;const g=new A6(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,o=0,o<h.length&&h[o][1].type==="lineEndingBlank"&&(o+=2),o<h.length&&h[o][1].type==="content"))for(;++o<h.length&&h[o][1].type!=="content";)h[o][1].type==="chunkText"&&(h[o][1]._isInFirstContentOfListItem=!0,o++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,M6(g,n)),n=t[n],p=!0);else if(i[1]._container){for(o=n,a=void 0;o--;)if(u=g.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(g.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...g.get(a)[1].start},f=g.slice(a,n),f.unshift(i),g.splice(a,n-a+1,f))}}return gr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!p}function M6(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const o=[];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,x,b=-1,y=n,_=0,j=0;const N=[j];for(;y;){for(;e.get(++a)[1]!==y;);o.push(a),y._tokenizer||(g=i.sliceStream(y),y.next||g.push(null),x&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(g),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),x=y,y=y.next}for(y=n;++b<f.length;)f[b][0]==="exit"&&f[b-1][0]==="enter"&&f[b][1].type===f[b-1][1].type&&f[b][1].start.line!==f[b][1].end.line&&(j=b+1,N.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):N.pop(),b=N.length;b--;){const k=f.slice(N[b],N[b+1]),A=o.pop();h.push([A,A+k.length-1]),e.splice(A,2,k)}for(h.reverse(),b=-1;++b<h.length;)p[_+h[b][0]]=_+h[b][1],_+=h[b][1]-h[b][0]-1;return p}const R6={resolve:D6,tokenize:z6},L6={partial:!0,tokenize:O6};function D6(e){return w2(e),e}function z6(e,t){let n;return i;function i(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(f)}function a(f){return f===null?o(f):$e(f)?e.check(L6,u,o)(f):(e.consume(f),a)}function o(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,a}}function O6(e,t,n){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),xt(e,o,"linePrefix")}function o(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 S2(e,t,n,i,a,o,u,f,h){const p=h||Number.POSITIVE_INFINITY;let g=0;return x;function x(k){return k===60?(e.enter(i),e.enter(a),e.enter(o),e.consume(k),e.exit(o),b):k===null||k===32||k===41||sf(k)?n(k):(e.enter(i),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),j(k))}function b(k){return k===62?(e.enter(o),e.consume(k),e.exit(o),e.exit(a),e.exit(i),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),y(k))}function y(k){return k===62?(e.exit("chunkString"),e.exit(f),b(k)):k===null||k===60||$e(k)?n(k):(e.consume(k),k===92?_:y)}function _(k){return k===60||k===62||k===92?(e.consume(k),y):y(k)}function j(k){return!g&&(k===null||k===41||Ot(k))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(i),t(k)):g<p&&k===40?(e.consume(k),g++,j):k===41?(e.consume(k),g--,j):k===null||k===32||k===40||sf(k)?n(k):(e.consume(k),k===92?N:j)}function N(k){return k===40||k===41||k===92?(e.consume(k),j):j(k)}}function k2(e,t,n,i,a,o){const u=this;let f=0,h;return p;function p(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(o),g}function g(y){return f>999||y===null||y===91||y===93&&!h||y===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(y):y===93?(e.exit(o),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):$e(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),x(y))}function x(y){return y===null||y===91||y===93||$e(y)||f++>999?(e.exit("chunkString"),g(y)):(e.consume(y),h||(h=!ot(y)),y===92?b:x)}function b(y){return y===91||y===92||y===93?(e.consume(y),f++,x):x(y)}}function j2(e,t,n,i,a,o){let u;return f;function f(b){return b===34||b===39||b===40?(e.enter(i),e.enter(a),e.consume(b),e.exit(a),u=b===40?41:b,h):n(b)}function h(b){return b===u?(e.enter(a),e.consume(b),e.exit(a),e.exit(i),t):(e.enter(o),p(b))}function p(b){return b===u?(e.exit(o),h(u)):b===null?n(b):$e(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),xt(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(b))}function g(b){return b===u||b===null||$e(b)?(e.exit("chunkString"),p(b)):(e.consume(b),b===92?x:g)}function x(b){return b===u||b===92?(e.consume(b),g):g(b)}}function hc(e,t){let n;return i;function i(a){return $e(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):ot(a)?xt(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const B6={name:"definition",tokenize:$6},P6={partial:!0,tokenize:F6};function $6(e,t,n){const i=this;let a;return o;function o(y){return e.enter("definition"),u(y)}function u(y){return k2.call(i,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function f(y){return a=Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),h):n(y)}function h(y){return Ot(y)?hc(e,p)(y):p(y)}function p(y){return S2(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function g(y){return e.attempt(P6,x,x)(y)}function x(y){return ot(y)?xt(e,b,"whitespace")(y):b(y)}function b(y){return y===null||$e(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):n(y)}}function F6(e,t,n){return i;function i(f){return Ot(f)?hc(e,a)(f):n(f)}function a(f){return j2(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return ot(f)?xt(e,u,"whitespace")(f):u(f)}function u(f){return f===null||$e(f)?t(f):n(f)}}const U6={name:"hardBreakEscape",tokenize:H6};function H6(e,t,n){return i;function i(o){return e.enter("hardBreakEscape"),e.consume(o),a}function a(o){return $e(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const I6={name:"headingAtx",resolve:q6,tokenize:V6};function q6(e,t){let n=e.length-2,i=3,a,o;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&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},o={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},gr(e,i,n-i+1,[["enter",a,t],["enter",o,t],["exit",o,t],["exit",a,t]])),e}function V6(e,t,n){let i=0;return a;function a(g){return e.enter("atxHeading"),o(g)}function o(g){return e.enter("atxHeadingSequence"),u(g)}function u(g){return g===35&&i++<6?(e.consume(g),u):g===null||Ot(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)):ot(g)?xt(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||Ot(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),p)}}const G6=["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"],u_=["pre","script","style","textarea"],Y6={concrete:!0,name:"htmlFlow",resolveTo:X6,tokenize:K6},W6={partial:!0,tokenize:J6},Q6={partial:!0,tokenize:Z6};function X6(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 K6(e,t,n){const i=this;let a,o,u,f,h;return p;function p(M){return g(M)}function g(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),x}function x(M){return M===33?(e.consume(M),b):M===47?(e.consume(M),o=!0,j):M===63?(e.consume(M),a=3,i.interrupt?t:R):Un(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function b(M){return M===45?(e.consume(M),a=2,y):M===91?(e.consume(M),a=5,f=0,_):Un(M)?(e.consume(M),a=4,i.interrupt?t:R):n(M)}function y(M){return M===45?(e.consume(M),i.interrupt?t:R):n(M)}function _(M){const de="CDATA[";return M===de.charCodeAt(f++)?(e.consume(M),f===de.length?i.interrupt?t:T:_):n(M)}function j(M){return Un(M)?(e.consume(M),u=String.fromCharCode(M),N):n(M)}function N(M){if(M===null||M===47||M===62||Ot(M)){const de=M===47,be=u.toLowerCase();return!de&&!o&&u_.includes(be)?(a=1,i.interrupt?t(M):T(M)):G6.includes(u.toLowerCase())?(a=6,de?(e.consume(M),k):i.interrupt?t(M):T(M)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(M):o?A(M):C(M))}return M===45||Ln(M)?(e.consume(M),u+=String.fromCharCode(M),N):n(M)}function k(M){return M===62?(e.consume(M),i.interrupt?t:T):n(M)}function A(M){return ot(M)?(e.consume(M),A):O(M)}function C(M){return M===47?(e.consume(M),O):M===58||M===95||Un(M)?(e.consume(M),L):ot(M)?(e.consume(M),C):O(M)}function L(M){return M===45||M===46||M===58||M===95||Ln(M)?(e.consume(M),L):D(M)}function D(M){return M===61?(e.consume(M),z):ot(M)?(e.consume(M),D):C(M)}function z(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),h=M,q):ot(M)?(e.consume(M),z):$(M)}function q(M){return M===h?(e.consume(M),h=null,G):M===null||$e(M)?n(M):(e.consume(M),q)}function $(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Ot(M)?D(M):(e.consume(M),$)}function G(M){return M===47||M===62||ot(M)?C(M):n(M)}function O(M){return M===62?(e.consume(M),I):n(M)}function I(M){return M===null||$e(M)?T(M):ot(M)?(e.consume(M),I):n(M)}function T(M){return M===45&&a===2?(e.consume(M),B):M===60&&a===1?(e.consume(M),F):M===62&&a===4?(e.consume(M),P):M===63&&a===3?(e.consume(M),R):M===93&&a===5?(e.consume(M),xe):$e(M)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(W6,Z,ae)(M)):M===null||$e(M)?(e.exit("htmlFlowData"),ae(M)):(e.consume(M),T)}function ae(M){return e.check(Q6,J,Z)(M)}function J(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),W}function W(M){return M===null||$e(M)?ae(M):(e.enter("htmlFlowData"),T(M))}function B(M){return M===45?(e.consume(M),R):T(M)}function F(M){return M===47?(e.consume(M),u="",Y):T(M)}function Y(M){if(M===62){const de=u.toLowerCase();return u_.includes(de)?(e.consume(M),P):T(M)}return Un(M)&&u.length<8?(e.consume(M),u+=String.fromCharCode(M),Y):T(M)}function xe(M){return M===93?(e.consume(M),R):T(M)}function R(M){return M===62?(e.consume(M),P):M===45&&a===2?(e.consume(M),R):T(M)}function P(M){return M===null||$e(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),P)}function Z(M){return e.exit("htmlFlow"),t(M)}}function Z6(e,t,n){const i=this;return a;function a(u){return $e(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return i.parser.lazy[i.now().line]?n(u):t(u)}}function J6(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Lc,t,n)}}const eT={name:"htmlText",tokenize:tT};function tT(e,t,n){const i=this;let a,o,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),D):R===63?(e.consume(R),C):Un(R)?(e.consume(R),$):n(R)}function p(R){return R===45?(e.consume(R),g):R===91?(e.consume(R),o=0,_):Un(R)?(e.consume(R),A):n(R)}function g(R){return R===45?(e.consume(R),y):n(R)}function x(R){return R===null?n(R):R===45?(e.consume(R),b):$e(R)?(u=x,F(R)):(e.consume(R),x)}function b(R){return R===45?(e.consume(R),y):x(R)}function y(R){return R===62?B(R):R===45?b(R):x(R)}function _(R){const P="CDATA[";return R===P.charCodeAt(o++)?(e.consume(R),o===P.length?j:_):n(R)}function j(R){return R===null?n(R):R===93?(e.consume(R),N):$e(R)?(u=j,F(R)):(e.consume(R),j)}function N(R){return R===93?(e.consume(R),k):j(R)}function k(R){return R===62?B(R):R===93?(e.consume(R),k):j(R)}function A(R){return R===null||R===62?B(R):$e(R)?(u=A,F(R)):(e.consume(R),A)}function C(R){return R===null?n(R):R===63?(e.consume(R),L):$e(R)?(u=C,F(R)):(e.consume(R),C)}function L(R){return R===62?B(R):C(R)}function D(R){return Un(R)?(e.consume(R),z):n(R)}function z(R){return R===45||Ln(R)?(e.consume(R),z):q(R)}function q(R){return $e(R)?(u=q,F(R)):ot(R)?(e.consume(R),q):B(R)}function $(R){return R===45||Ln(R)?(e.consume(R),$):R===47||R===62||Ot(R)?G(R):n(R)}function G(R){return R===47?(e.consume(R),B):R===58||R===95||Un(R)?(e.consume(R),O):$e(R)?(u=G,F(R)):ot(R)?(e.consume(R),G):B(R)}function O(R){return R===45||R===46||R===58||R===95||Ln(R)?(e.consume(R),O):I(R)}function I(R){return R===61?(e.consume(R),T):$e(R)?(u=I,F(R)):ot(R)?(e.consume(R),I):G(R)}function T(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,ae):$e(R)?(u=T,F(R)):ot(R)?(e.consume(R),T):(e.consume(R),J)}function ae(R){return R===a?(e.consume(R),a=void 0,W):R===null?n(R):$e(R)?(u=ae,F(R)):(e.consume(R),ae)}function J(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Ot(R)?G(R):(e.consume(R),J)}function W(R){return R===47||R===62||Ot(R)?G(R):n(R)}function B(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function F(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),Y}function Y(R){return ot(R)?xt(e,xe,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):xe(R)}function xe(R){return e.enter("htmlTextData"),u(R)}}const px={name:"labelEnd",resolveAll:sT,resolveTo:aT,tokenize:lT},nT={tokenize:oT},rT={tokenize:cT},iT={tokenize:uT};function sT(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 a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==n.length&&gr(e,0,e.length,n),e}function aT(e,t){let n=e.length,i=0,a,o,u,f;for(;n--;)if(a=e[n][1],o){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(o=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=n);const h={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},g={type:"labelText",start:{...e[o+i+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",h,t],["enter",p,t]],f=zr(f,e.slice(o+1,o+i+3)),f=zr(f,[["enter",g,t]]),f=zr(f,gf(t.parser.constructs.insideSpan.null,e.slice(o+i+4,u-3),t)),f=zr(f,[["exit",g,t],e[u-2],e[u-1],["exit",p,t]]),f=zr(f,e.slice(u+1)),f=zr(f,[["exit",h,t]]),gr(e,o,e.length,f),e}function lT(e,t,n){const i=this;let a=i.events.length,o,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){o=i.events[a][1];break}return f;function f(b){return o?o._inactive?x(b):(u=i.parser.defined.includes(Qr(i.sliceSerialize({start:o.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),h):n(b)}function h(b){return b===40?e.attempt(nT,g,u?g:x)(b):b===91?e.attempt(rT,g,u?p:x)(b):u?g(b):x(b)}function p(b){return e.attempt(iT,g,x)(b)}function g(b){return t(b)}function x(b){return o._balanced=!0,n(b)}}function oT(e,t,n){return i;function i(x){return e.enter("resource"),e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),a}function a(x){return Ot(x)?hc(e,o)(x):o(x)}function o(x){return x===41?g(x):S2(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(x)}function u(x){return Ot(x)?hc(e,h)(x):g(x)}function f(x){return n(x)}function h(x){return x===34||x===39||x===40?j2(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(x):g(x)}function p(x){return Ot(x)?hc(e,g)(x):g(x)}function g(x){return x===41?(e.enter("resourceMarker"),e.consume(x),e.exit("resourceMarker"),e.exit("resource"),t):n(x)}}function cT(e,t,n){const i=this;return a;function a(f){return k2.call(i,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return i.parser.defined.includes(Qr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function uT(e,t,n){return i;function i(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),a}function a(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const dT={name:"labelStartImage",resolveAll:px.resolveAll,tokenize:fT};function fT(e,t,n){const i=this;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(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 hT={name:"labelStartLink",resolveAll:px.resolveAll,tokenize:pT};function pT(e,t,n){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):t(u)}}const dm={name:"lineEnding",tokenize:mT};function mT(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),xt(e,t,"linePrefix")}}const Ad={name:"thematicBreak",tokenize:gT};function gT(e,t,n){let i=0,a;return o;function o(p){return e.enter("thematicBreak"),u(p)}function u(p){return a=p,f(p)}function f(p){return p===a?(e.enter("thematicBreakSequence"),h(p)):i>=3&&(p===null||$e(p))?(e.exit("thematicBreak"),t(p)):n(p)}function h(p){return p===a?(e.consume(p),i++,h):(e.exit("thematicBreakSequence"),ot(p)?xt(e,f,"whitespace")(p):f(p))}}const Jn={continuation:{tokenize:yT},exit:wT,name:"list",tokenize:bT},xT={partial:!0,tokenize:ST},vT={partial:!0,tokenize:_T};function bT(e,t,n){const i=this,a=i.events[i.events.length-1];let o=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return f;function f(y){const _=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:jg(y)){if(i.containerState.type||(i.containerState.type=_,e.enter(_,{_container:!0})),_==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(Ad,n,p)(y):p(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),h(y)}return n(y)}function h(y){return jg(y)&&++u<10?(e.consume(y),h):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),p(y)):n(y)}function p(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Lc,i.interrupt?n:g,e.attempt(xT,b,x))}function g(y){return i.containerState.initialBlankLine=!0,o++,b(y)}function x(y){return ot(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),b):n(y)}function b(y){return i.containerState.size=o+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function yT(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Lc,a,o);function a(f){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,xt(e,t,"listItemIndent",i.containerState.size+1)(f)}function o(f){return i.containerState.furtherBlankLines||!ot(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(vT,t,u)(f))}function u(f){return i.containerState._closeFlow=!0,i.interrupt=void 0,xt(e,e.attempt(Jn,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function _T(e,t,n){const i=this;return xt(e,a,"listItemIndent",i.containerState.size+1);function a(o){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(o):n(o)}}function wT(e){e.exit(this.containerState.type)}function ST(e,t,n){const i=this;return xt(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(o){const u=i.events[i.events.length-1];return!ot(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const d_={name:"setextUnderline",resolveTo:kT,tokenize:jT};function kT(e,t){let n=e.length,i,a,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",o?(e.splice(a,0,["enter",u,t]),e.splice(o+1,0,["exit",e[i][1],t]),e[i][1].end={...e[o][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function jT(e,t,n){const i=this;let a;return o;function o(p){let g=i.events.length,x;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){x=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||x)?(e.enter("setextHeadingLine"),a=p,u(p)):n(p)}function u(p){return e.enter("setextHeadingLineSequence"),f(p)}function f(p){return p===a?(e.consume(p),f):(e.exit("setextHeadingLineSequence"),ot(p)?xt(e,h,"lineSuffix")(p):h(p))}function h(p){return p===null||$e(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const NT={tokenize:CT};function CT(e){const t=this,n=e.attempt(Lc,i,e.attempt(this.parser.constructs.flowInitial,a,xt(e,e.attempt(this.parser.constructs.flow,a,e.attempt(R6,a)),"linePrefix")));return n;function i(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const ET={resolveAll:C2()},TT=N2("string"),AT=N2("text");function N2(e){return{resolveAll:C2(e==="text"?MT:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],o=n.attempt(a,u,f);return u;function u(g){return p(g)?o(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"),o(g)):(n.consume(g),h)}function p(g){if(g===null)return!0;const x=a[g];let b=-1;if(x)for(;++b<x.length;){const y=x[b];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function C2(e){return t;function t(n,i){let a=-1,o;for(;++a<=n.length;)o===void 0?n[a]&&n[a][1].type==="data"&&(o=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==o+2&&(n[o][1].end=n[a-1][1].end,n.splice(o+2,a-o-2),a=o+2),o=void 0);return e?e(n,i):n}}function MT(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],a=t.sliceStream(i);let o=a.length,u=-1,f=0,h;for(;o--;){const p=a[o];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){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const p={type:n===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:i.start._bufferIndex+u,_index:i.start._index+o,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 RT={42:Jn,43:Jn,45:Jn,48:Jn,49:Jn,50:Jn,51:Jn,52:Jn,53:Jn,54:Jn,55:Jn,56:Jn,57:Jn,62:b2},LT={91:B6},DT={[-2]:um,[-1]:um,32:um},zT={35:I6,42:Ad,45:[d_,Ad],60:Y6,61:d_,95:Ad,96:c_,126:c_},OT={38:_2,92:y2},BT={[-5]:dm,[-4]:dm,[-3]:dm,33:dT,38:_2,42:Ng,60:[h6,eT],91:hT,92:[U6,y2],93:px,95:Ng,96:N6},PT={null:[Ng,ET]},$T={null:[42,95]},FT={null:[]},UT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:$T,contentInitial:LT,disable:FT,document:RT,flow:zT,flowInitial:DT,insideSpan:PT,string:OT,text:BT},Symbol.toStringTag,{value:"Module"}));function HT(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 a={},o=[];let u=[],f=[];const h={attempt:q(D),check:q(z),consume:A,enter:C,exit:L,interrupt:q(z,{interrupt:!0})},p={code:null,containerState:{},defineSkip:j,events:[],now:_,parser:e,previous:null,sliceSerialize:b,sliceStream:y,write:x};let g=t.tokenize.call(p,h);return t.resolveAll&&o.push(t),p;function x(I){return u=zr(u,I),N(),u[u.length-1]!==null?[]:($(t,0),p.events=gf(o,p.events,p),p.events)}function b(I,T){return qT(y(I),T)}function y(I){return IT(u,I)}function _(){const{_bufferIndex:I,_index:T,line:ae,column:J,offset:W}=i;return{_bufferIndex:I,_index:T,line:ae,column:J,offset:W}}function j(I){a[I.line]=I.column,O()}function N(){let I;for(;i._index<u.length;){const T=u[i._index];if(typeof T=="string")for(I=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===I&&i._bufferIndex<T.length;)k(T.charCodeAt(i._bufferIndex));else k(T)}}function k(I){g=g(I)}function A(I){$e(I)?(i.line++,i.column=1,i.offset+=I===-3?2:1,O()):I!==-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=I}function C(I,T){const ae=T||{};return ae.type=I,ae.start=_(),p.events.push(["enter",ae,p]),f.push(ae),ae}function L(I){const T=f.pop();return T.end=_(),p.events.push(["exit",T,p]),T}function D(I,T){$(I,T.from)}function z(I,T){T.restore()}function q(I,T){return ae;function ae(J,W,B){let F,Y,xe,R;return Array.isArray(J)?Z(J):"tokenize"in J?Z([J]):P(J);function P(je){return Re;function Re(Le){const Be=Le!==null&&je[Le],Je=Le!==null&&je.null,it=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(Je)?Je:Je?[Je]:[]];return Z(it)(Le)}}function Z(je){return F=je,Y=0,je.length===0?B:M(je[Y])}function M(je){return Re;function Re(Le){return R=G(),xe=je,je.partial||(p.currentConstruct=je),je.name&&p.parser.constructs.disable.null.includes(je.name)?be():je.tokenize.call(T?Object.assign(Object.create(p),T):p,h,de,be)(Le)}}function de(je){return I(xe,R),W}function be(je){return R.restore(),++Y<F.length?M(F[Y]):B}}}function $(I,T){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&gr(p.events,T,p.events.length-T,I.resolve(p.events.slice(T),p)),I.resolveTo&&(p.events=I.resolveTo(p.events,p))}function G(){const I=_(),T=p.previous,ae=p.currentConstruct,J=p.events.length,W=Array.from(f);return{from:J,restore:B};function B(){i=I,p.previous=T,p.currentConstruct=ae,p.events.length=J,f=W,O()}}function O(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function IT(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,o=t.end._bufferIndex;let u;if(n===a)u=[e[n].slice(i,o)];else{if(u=e.slice(n,a),i>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(i):u.shift()}o>0&&u.push(e[a].slice(0,o))}return u}function qT(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
69
69
|
`;break}case-3:{u=`\r
|
|
70
70
|
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(o)}a=o===-2,i.push(u)}return i.join("")}function VT(e){const i={constructs:x2([UT,...(e||{}).extensions||[]]),content:a(a6),defined:[],document:a(o6),flow:a(NT),lazy:{},string:a(TT),text:a(AT)};return i;function a(o){return u;function u(f){return HT(i,o,f)}}}function GT(e){for(;!w2(e););return e}const f_=/[\0\t\n\r]/g;function YT(){let e=1,t="",n=!0,i;return a;function a(o,u,f){const h=[];let p,g,x,b,y;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),x=0,t="",n&&(o.charCodeAt(0)===65279&&x++,n=void 0);x<o.length;){if(f_.lastIndex=x,p=f_.exec(o),b=p&&p.index!==void 0?p.index:o.length,y=o.charCodeAt(b),!p){t=o.slice(x);break}if(y===10&&x===b&&i)h.push(-3),i=void 0;else switch(i&&(h.push(-5),i=void 0),x<b&&(h.push(o.slice(x,b)),e+=b-x),y){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}x=b+1}return f&&(i&&h.push(-5),t&&h.push(t),h.push(null)),h}}const WT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function QT(e){return e.replace(WT,XT)}function XT(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),o=a===120||a===88;return v2(n.slice(o?2:1),o?16:10)}return hx(n)||e}const E2={}.hasOwnProperty;function KT(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),ZT(n)(GT(VT(n).document().write(YT()(e,t,!0))))}function ZT(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(ct),autolinkProtocol:G,autolinkEmail:G,atxHeading:o(yt),blockQuote:o(Je),characterEscape:G,characterReference:G,codeFenced:o(it),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(it,u),codeText:o(ht,u),codeTextData:G,data:G,codeFlowValue:G,definition:o(Xt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(pt),hardBreakEscape:o(kt),hardBreakTrailing:o(kt),htmlFlow:o(ge,u),htmlFlowData:G,htmlText:o(ge,u),htmlTextData:G,image:o(Fe),label:u,link:o(ct),listItem:o(ke),listItemValue:b,listOrdered:o(mn,x),listUnordered:o(mn),paragraph:o(ze),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(yt),strong:o(mt),thematicBreak:o(Br)},exit:{atxHeading:h(),atxHeadingSequence:D,autolink:h(),autolinkEmail:Be,autolinkProtocol:Le,blockQuote:h(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:je,characterReference:Re,codeFenced:h(N),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:_,codeFlowValue:O,codeIndented:h(k),codeText:h(W),codeTextData:O,data:O,definition:h(),definitionDestinationString:L,definitionLabelString:A,definitionTitleString:C,emphasis:h(),hardBreakEscape:h(T),hardBreakTrailing:h(T),htmlFlow:h(ae),htmlFlowData:O,htmlText:h(J),htmlTextData:O,image:h(F),label:xe,labelText:Y,lineEnding:I,link:h(B),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:de,resourceDestinationString:R,resourceTitleString:P,resource:Z,setextHeading:h($),setextHeadingLineSequence:q,setextHeadingText:z,strong:h(),thematicBreak:h()}};T2(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(le){let ye={type:"root",children:[]};const Q={stack:[ye],tokenStack:[],config:t,enter:f,exit:p,buffer:u,resume:g,data:n},he=[];let Me=-1;for(;++Me<le.length;)if(le[Me][1].type==="listOrdered"||le[Me][1].type==="listUnordered")if(le[Me][0]==="enter")he.push(Me);else{const Qe=he.pop();Me=a(le,Qe,Me)}for(Me=-1;++Me<le.length;){const Qe=t[le[Me][0]];E2.call(Qe,le[Me][1].type)&&Qe[le[Me][1].type].call(Object.assign({sliceSerialize:le[Me][2].sliceSerialize},Q),le[Me][1])}if(Q.tokenStack.length>0){const Qe=Q.tokenStack[Q.tokenStack.length-1];(Qe[1]||h_).call(Q,void 0,Qe[0])}for(ye.position={start:Ss(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Ss(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<t.transforms.length;)ye=t.transforms[Me](ye)||ye;return ye}function a(le,ye,Q){let he=ye-1,Me=-1,Qe=!1,nt,rt,wt,gn;for(;++he<=Q;){const et=le[he];switch(et[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{et[0]==="enter"?Me++:Me--,gn=void 0;break}case"lineEndingBlank":{et[0]==="enter"&&(nt&&!gn&&!Me&&!wt&&(wt=he),gn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:gn=void 0}if(!Me&&et[0]==="enter"&&et[1].type==="listItemPrefix"||Me===-1&&et[0]==="exit"&&(et[1].type==="listUnordered"||et[1].type==="listOrdered")){if(nt){let rr=he;for(rt=void 0;rr--;){const En=le[rr];if(En[1].type==="lineEnding"||En[1].type==="lineEndingBlank"){if(En[0]==="exit")continue;rt&&(le[rt][1].type="lineEndingBlank",Qe=!0),En[1].type="lineEnding",rt=rr}else if(!(En[1].type==="linePrefix"||En[1].type==="blockQuotePrefix"||En[1].type==="blockQuotePrefixWhitespace"||En[1].type==="blockQuoteMarker"||En[1].type==="listItemIndent"))break}wt&&(!rt||wt<rt)&&(nt._spread=!0),nt.end=Object.assign({},rt?le[rt][1].start:et[1].end),le.splice(rt||he,0,["exit",nt,et[2]]),he++,Q++}if(et[1].type==="listItemPrefix"){const rr={type:"listItem",_spread:!1,start:Object.assign({},et[1].start),end:void 0};nt=rr,le.splice(he,0,["enter",rr,et[2]]),he++,Q++,wt=void 0,gn=!0}}}return le[ye][1]._spread=Qe,Q}function o(le,ye){return Q;function Q(he){f.call(this,le(he),he),ye&&ye.call(this,he)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(le,ye,Q){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ye,Q||void 0]),le.position={start:Ss(ye.start),end:void 0}}function h(le){return ye;function ye(Q){le&&le.call(this,Q),p.call(this,Q)}}function p(le,ye){const Q=this.stack.pop(),he=this.tokenStack.pop();if(he)he[0].type!==le.type&&(ye?ye.call(this,le,he[0]):(he[1]||h_).call(this,le,he[0]));else throw new Error("Cannot close `"+le.type+"` ("+fc({start:le.start,end:le.end})+"): it’s not open");Q.position.end=Ss(le.end)}function g(){return fx(this.stack.pop())}function x(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function y(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=le}function _(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=le}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function N(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function k(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le.replace(/(\r?\n|\r)$/g,"")}function A(le){const ye=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ye,Q.identifier=Qr(this.sliceSerialize(le)).toLowerCase()}function C(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.title=le}function L(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.url=le}function D(le){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Q=this.sliceSerialize(le).length;ye.depth=Q}}function z(){this.data.setextHeadingSlurpLineEnding=!0}function q(le){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function $(){this.data.setextHeadingSlurpLineEnding=void 0}function G(le){const Q=this.stack[this.stack.length-1].children;let he=Q[Q.length-1];(!he||he.type!=="text")&&(he=Ee(),he.position={start:Ss(le.start),end:void 0},Q.push(he)),this.stack.push(he)}function O(le){const ye=this.stack.pop();ye.value+=this.sliceSerialize(le),ye.position.end=Ss(le.end)}function I(le){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Q=ye.children[ye.children.length-1];Q.position.end=Ss(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(G.call(this,le),O.call(this,le))}function T(){this.data.atHardBreak=!0}function ae(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function J(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function W(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function B(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ye,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function F(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ye,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function Y(le){const ye=this.sliceSerialize(le),Q=this.stack[this.stack.length-2];Q.label=QT(ye),Q.identifier=Qr(ye).toLowerCase()}function xe(){const le=this.stack[this.stack.length-1],ye=this.resume(),Q=this.stack[this.stack.length-1];if(this.data.inReference=!0,Q.type==="link"){const he=le.children;Q.children=he}else Q.alt=ye}function R(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.url=le}function P(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.title=le}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function de(le){const ye=this.resume(),Q=this.stack[this.stack.length-1];Q.label=ye,Q.identifier=Qr(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function be(le){this.data.characterReferenceType=le.type}function je(le){const ye=this.sliceSerialize(le),Q=this.data.characterReferenceType;let he;Q?(he=v2(ye,Q==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):he=hx(ye);const Me=this.stack[this.stack.length-1];Me.value+=he}function Re(le){const ye=this.stack.pop();ye.position.end=Ss(le.end)}function Le(le){O.call(this,le);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(le)}function Be(le){O.call(this,le);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(le)}function Je(){return{type:"blockquote",children:[]}}function it(){return{type:"code",lang:null,meta:null,value:""}}function ht(){return{type:"inlineCode",value:""}}function Xt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pt(){return{type:"emphasis",children:[]}}function yt(){return{type:"heading",depth:0,children:[]}}function kt(){return{type:"break"}}function ge(){return{type:"html",value:""}}function Fe(){return{type:"image",title:null,url:"",alt:null}}function ct(){return{type:"link",title:null,url:"",children:[]}}function mn(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 ze(){return{type:"paragraph",children:[]}}function mt(){return{type:"strong",children:[]}}function Ee(){return{type:"text",value:""}}function Br(){return{type:"thematicBreak"}}}function Ss(e){return{line:e.line,column:e.column,offset:e.offset}}function T2(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?T2(e,i):JT(e,i)}}function JT(e,t){let n;for(n in t)if(E2.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 h_(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+fc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+fc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+fc({start:t.start,end:t.end})+") is still open")}function eA(e){const t=this;t.parser=n;function n(i){return KT(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function tA(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 nA(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
@@ -104,7 +104,7 @@ Details: ${t}`:`Error: ${t}`}function r3(e,t){const n=xc.get(e)||[];n.push(t),xc
|
|
|
104
104
|
hover:bg-cc-hover/80 hover:border-cc-border/70
|
|
105
105
|
transition-all duration-200 cursor-pointer
|
|
106
106
|
${t?"ring-1 ring-cc-primary/30":""}
|
|
107
|
-
`,"aria-label":`Activity: ${g} agents running, ${b}/${x} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.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&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",x]}),l.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:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function zR({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),i=X(_=>_.clearAiResolvedPermissions),a=X(_=>_.connectionStatus.get(e)??"disconnected"),o=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,o]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const x=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await Ne.relaunchSession(e)}catch(_){As(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),b=S.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.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?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:x,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?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.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"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,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"})]})}),a==="disconnected"&&l.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:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(iR,{sessionId:e}),l.jsx(DR,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(jR,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(hR,{permission:_,sessionId:e},_.request_id))}),l.jsx(dR,{sessionId:e})]})}function OR({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=X(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.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 x=!g,b={[p]:x};X.getState().setSessionAiValidation(e,b),x3(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.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&&l.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:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",o),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:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.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:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.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:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function BR({sessionId:e}){const[t,n]=S.useState(!1),[i,a]=S.useState(null),[o,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=x=>{f.current&&!f.current.contains(x.target)&&n(!1)},g=x=>{x.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=>{a(p),u(!1);try{const{blob:g,filename:x}=await Ne.exportSession(e,p),b=URL.createObjectURL(g),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(g){As(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.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:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.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",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.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",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function PR(){var q;const e=S.useSyncExternalStore($=>(window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)),()=>window.location.hash),t=S.useMemo(()=>ix(e),[e]),n=t.page==="session"||t.page==="home",i=X($=>$.currentSessionId),a=X($=>$.cliConnected),o=X($=>$.sessionStatus),u=X($=>$.sessionNames),f=X($=>$.sdkSessions),h=X($=>$.sidebarOpen),p=X($=>$.setSidebarOpen),g=X($=>$.taskPanelOpen),x=X($=>$.setTaskPanelOpen),b=X($=>$.activeTab),y=X($=>$.setActiveTab),_=X($=>$.markChatTabReentry),j=X($=>i?$.gitChangedFilesCount.get(i)??0:0),N=i?o.get(i)??null:null,k=i?a.get(i)??!1:!1,A=i?(u==null?void 0:u.get(i))||((q=f.find($=>$.sessionId===i))==null?void 0:q.name)||`Session ${i.slice(0,8)}`:null,C=!!(i&&n),L=t.page==="session"&&!!i,D=["chat","diff"],z=$=>{$==="chat"&&b!=="chat"&&i&&_(i),y($)};return S.useEffect(()=>{const $=G=>{if(!(G.metaKey||G.ctrlKey)||G.key.toLowerCase()!=="j"||!C)return;const O=G.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;G.preventDefault();const I=Math.max(0,D.indexOf(b)),T=G.shiftKey?-1:1,ae=(I+T+D.length)%D.length;z(D[ae])};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[C,D,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&l.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:[l.jsxs("button",{onClick:()=>z("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 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:A||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>z("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 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.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:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&i&&l.jsx(OR,{sessionId:i}),C&&i&&l.jsx(BR,{sessionId:i}),l.jsx($R,{}),L&&l.jsx("button",{onClick:()=>x(!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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function $R(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return l.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?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.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"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const kS="cc-recent-dirs";function df(){try{return JSON.parse(localStorage.getItem(kS)||"[]")}catch{return[]}}function jS(e){const t=df().filter(n=>n!==e);t.unshift(e),localStorage.setItem(kS,JSON.stringify(t.slice(0,5)))}function FR(){return!1}function NS({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[a,o]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,x]=S.useState([]),[b,y]=S.useState(""),[_,j]=S.useState(!1),[N,k]=S.useState(""),[A,C]=S.useState([{key:"",value:""}]),[L,D]=S.useState(!1),z=S.useCallback(()=>{Ne.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);S.useEffect(()=>{z()},[z]);function q(W){f(W.slug),p(W.name);const B=Object.entries(W.variables).map(([F,Y])=>({key:F,value:Y}));B.length===0&&B.push({key:"",value:""}),x(B),y("")}function $(){f(null),y("")}async function G(){if(!u)return;const W={};for(const B of g){const F=B.key.trim();F&&(W[F]=B.value)}try{await Ne.updateEnv(u,{name:h.trim()||void 0,variables:W}),f(null),y(""),z()}catch(B){y(B instanceof Error?B.message:String(B))}}async function O(W){try{await Ne.deleteEnv(W),u===W&&f(null),z()}catch(B){y(B instanceof Error?B.message:String(B))}}async function I(){const W=N.trim();if(!W)return;D(!0);const B={};for(const F of A){const Y=F.key.trim();Y&&(B[Y]=F.value)}try{await Ne.createEnv(W,B),k(""),C([{key:"",value:""}]),j(!1),y(""),z()}catch(F){y(F instanceof Error?F.message:String(F))}finally{D(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),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:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.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:[l.jsx("input",{type:"text",value:N,onChange:W=>k(W.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:W=>{W.key==="Enter"&&N.trim()&&I()}}),l.jsx(vd,{rows:A,onChange:C}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(W=>{const B=u===W.slug,F=Object.keys(W.variables).length;return B?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:Y=>p(Y.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(vd,{rows:g,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:$,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"}),l.jsx("button",{onClick:()=>void G(),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"})]})]},W.slug):l.jsx(UR,{env:W,varCount:F,onStartEdit:()=>q(W),onDelete:()=>void O(W.slug)},W.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const T=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:W=>k(W.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:W=>{W.key==="Enter"&&N.trim()&&I()}}),l.jsx(vd,{rows:A,onChange:C}),l.jsx("button",{onClick:I,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),ae=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(W=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:W.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(W.variables).length," var",Object.keys(W.variables).length!==1?"s":""]}),u===W.slug?l.jsx("button",{onClick:$,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>q(W),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>O(W.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===W.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:B=>p(B.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(vd,{rows:g,onChange:x})]})}),l.jsx("button",{onClick:G,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!==W.slug&&Object.keys(W.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(W.variables).map(([B,F])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:B}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:F})]},B))})]},W.slug))}),J=l.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:W=>W.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),ae,T]})]});return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:J}),document.body)}function UR({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.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:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.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:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.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:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.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 vd({rows:e,onChange:t}){function n(o,u,f){const h=[...e];h[o]={...h[o],[u]:f},t(h)}function i(o){const u=e.filter((f,h)=>h!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.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"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.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"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const HR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:NS},Symbol.toStringTag,{value:"Module"}));function IR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function qR({initialPath:e,onSelect:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[x,b]=S.useState(""),[y,_]=S.useState(!1),[j,N]=S.useState(""),[k,A]=S.useState(-1),[C,L]=S.useState(!1),[D,z]=S.useState(()=>df()),q=S.useRef(null),$=S.useRef(null),G=S.useRef(null),O=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return o;const F=j.toLowerCase();return o.filter(Y=>Y.name.toLowerCase().includes(F))},[o,j]),T=S.useCallback(async F=>{h(!0),g(""),N(""),A(-1);try{const Y=await Ne.listDirs(F);a(Y.path),u(Y.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{T(e||void 0)},[]),S.useEffect(()=>{const F=q.current;if(!F)return;function Y(R){if(R.key!=="Tab")return;const P=F.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Z=P[0],M=P[P.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",Y);const xe=setTimeout(()=>{var R;(R=G.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",Y),clearTimeout(xe)}},[]);const ae=S.useCallback(()=>{C||(L(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function F(Y){if(Y.key==="Escape"){if(y)return;ae()}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,ae]),S.useEffect(()=>{function F(Y){var R,P;if(y)return;if(Y.key==="Backspace"&&document.activeElement!==G.current){if(i&&i!=="/"){Y.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";T(Z)}return}const xe=I.length;if(xe!==0){if(Y.key==="ArrowDown"){Y.preventDefault();const Z=k<xe-1?k+1:0;A(Z),(R=O.current.get(Z))==null||R.focus()}else if(Y.key==="ArrowUp"){Y.preventDefault();const Z=k>0?k-1:xe-1;A(Z),(P=O.current.get(Z))==null||P.focus()}}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,I.length,k,i,T]),S.useEffect(()=>{var F;k>=0&&((F=O.current.get(k))==null||F.scrollIntoView({block:"nearest"}))},[k]);function J(F){jS(F),z(df()),t(F),n()}const W=IR(i),B=i.split("/").pop()||"/";return Dl.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:ae,children:l.jsxs("div",{ref:q,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 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:F=>F.stopPropagation(),children:[l.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:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),D.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.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"}),l.jsx("ul",{className:"list-none m-0 p-0",children:D.map(F=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>J(F),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:[l.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:[l.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"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:F.split("/").pop()||F}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:F})]})},F))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:x,onChange:F=>b(F.target.value),onKeyDown:F=>{F.key==="Enter"&&x.trim()&&J(x.trim()),F.key==="Escape"&&(F.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}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:W.map((F,Y)=>{const xe=Y===W.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[Y>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{xe||T(F.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${xe?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":xe?"location":void 0,tabIndex:xe?-1:0,children:F.label})]},F.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.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:l.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"})}),l.jsx("input",{ref:G,type:"text","aria-label":"Filter directories",value:j,onChange:F=>{N(F.target.value),A(-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"})]}),l.jsxs("button",{type:"button",onClick:()=>J(i),"aria-label":`Select ${B}`,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.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"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:B})]})]}),l.jsx("div",{ref:$,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((F,Y)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.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"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+Y*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 ${Y*.1}s infinite`}})]},Y))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.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"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>T(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map((F,Y)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===Y?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:xe=>{xe?O.current.set(Y,xe):O.current.delete(Y)},onClick:()=>T(F.path),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),J(F.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:F.path,"aria-label":`Navigate into ${F.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.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"})}),l.jsx("span",{className:"truncate",children:F.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>J(F.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 ${F.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]},F.path))})}),l.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:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.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 VR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function GR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():VR(e.identifier,e.title)}function mc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.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"}),l.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"}),l.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"}),l.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 YR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,x]=S.useState(0),[b,y]=S.useState(!0),[_,j]=S.useState([]),[N,k]=S.useState(""),[A,C]=S.useState(""),[L,D]=S.useState(!0),[z,q]=S.useState(!1),[$,G]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([T,ae])=>{var W;if(!I)return;j(T.teams),k(ae.viewerId);const J=((W=T.teams[0])==null?void 0:W.id)||"";p(J)}).catch(T=>{I&&G(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{I&&D(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(ae=>ae.id===h),T=I==null?void 0:I.states.find(ae=>ae.type==="backlog");C((T==null?void 0:T.id)||"")},[h,_]);async function O(){if(!(!a.trim()||!h)){q(!0),G("");try{const I=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:A||void 0,connectionId:t});n(I.issue)}catch(I){G(I instanceof Error?I.message:"Failed to create issue")}finally{q(!1)}}}return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),$&&l.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:$}),L?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!z&&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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.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(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>x(Number(I.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:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:I=>y(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.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"}),l.jsx("button",{type:"button",onClick:O,disabled:!a.trim()||!h||z,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:z?"Creating...":"Create Issue"})]})]})]})}),document.body)}function WR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[x,b]=S.useState(!1),[y,_]=S.useState(""),[j,N]=S.useState([]),[k,A]=S.useState(!1),[C,L]=S.useState(!1),[D,z]=S.useState(""),[q,$]=S.useState(!1),[G,O]=S.useState(null),[I,T]=S.useState([]),[ae,J]=S.useState(!1),[W,B]=S.useState(""),[F,Y]=S.useState(!1),[xe,R]=S.useState([]),[P,Z]=S.useState(!1),[M,de]=S.useState(""),[be,je]=S.useState(!1),[Re,Le]=S.useState([]),[Be,Je]=S.useState(!1),[it,ht]=S.useState(!1),Xt=S.useRef(null);S.useEffect(()=>{function ke(ze){Xt.current&&!Xt.current.contains(ze.target)&&(A(!1),Y(!1))}return document.addEventListener("pointerdown",ke),()=>document.removeEventListener("pointerdown",ke)},[]),S.useEffect(()=>{if(!n){h([]),g(null),b(!1),u(null);return}let ke=!0;return Ne.listLinearConnections().then(({connections:ze})=>{ke&&(h(ze),b(!0),ze.length>0?(g(ze[0].id),u(ze[0].id)):(g(null),u(null)))}).catch(()=>{ke&&b(!0)}),()=>{ke=!1}},[n]);const pt=S.useCallback(ke=>{g(ke),u(ke),a(null),N([]),_(""),z(""),Le([]),de(""),R([]),G&&(J(!0),B(""),Ne.getLinearProjectIssues(G.projectId,10,ke).then(({issues:ze})=>{T(ze)}).catch(ze=>{B(ze instanceof Error?ze.message:String(ze))}).finally(()=>{J(!1)}))},[G,u,a]);S.useEffect(()=>{if(!t||!n){O(null),T([]);return}let ke=!0;return J(!0),B(""),(async()=>{try{const{mapping:ze}=await Ne.getLinearProjectMapping(t.repoRoot);if(!ke)return;if(O(ze),ze){const{issues:mt}=await Ne.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!ke)return;T(mt)}else T([])}catch(ze){if(!ke)return;B(ze instanceof Error?ze.message:String(ze))}finally{ke&&J(!1)}})(),()=>{ke=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const ke=y.trim();if(ke.length<2){N([]),z(""),L(!1);return}let ze=!0;L(!0),z("");const mt=setTimeout(()=>{Ne.searchLinearIssues(ke,8,p??void 0).then(Ee=>{ze&&N(Ee.issues)}).catch(Ee=>{ze&&(N([]),z(Ee instanceof Error?Ee.message:String(Ee)))}).finally(()=>{ze&&L(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,y,p]),S.useEffect(()=>{if(!n||!be){Le([]),Je(!1);return}const ke=M.trim();if(ke.length<2){Le([]),Je(!1);return}let ze=!0;Je(!0);const mt=setTimeout(()=>{Ne.searchLinearIssues(ke,10,p??void 0).then(Ee=>{ze&&Le(Ee.issues)}).catch(()=>{ze&&Le([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,be,M,p]);function yt(ke,ze=!1){a(ke),_(`${ke.identifier} - ${ke.title}`);const mt=GR(ke);o(mt,!0),ze&&A(!1)}function kt(){a(null),_(""),N([]),z("")}async function ge(ke){if(t)try{const{mapping:ze}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ke.id,projectName:ke.name});O(ze),Y(!1),J(!0),B("");const{issues:mt}=await Ne.getLinearProjectIssues(ke.id,10,p??void 0);T(mt)}catch(ze){B(ze instanceof Error?ze.message:String(ze))}finally{J(!1)}}async function Fe(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),T([]),a(null),_("")}}function ct(){if(!n){window.location.hash="#/integrations/linear";return}Y(!0),xe.length===0&&(Z(!0),Ne.listLinearProjects(p??void 0).then(({projects:ke})=>R(ke)).catch(()=>{}).finally(()=>Z(!1)))}function mn(ke){ht(!1),yt(ke),G&&(J(!0),Ne.getLinearProjectIssues(G.projectId,10,p??void 0).then(({issues:ze})=>T(ze)).catch(()=>{}).finally(()=>J(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Xt,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&f.length>1&&l.jsx("select",{value:p??"",onChange:ke=>pt(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=>l.jsx("option",{value:ke.id,children:ke.workspaceName||ke.name},ke.id))}),G?l.jsxs(l.Fragment,{children:[l.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:[l.jsx(mc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:G.projectName}),l.jsx("button",{type:"button",onClick:Fe,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]}),l.jsxs("button",{type:"button",onClick:()=>ht(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}A(!k)},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:[l.jsx(mc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:ct,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>ht(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),G&&(()=>{const ke=M.trim().toLowerCase(),ze=!be&&ke?I.filter(Ee=>Ee.identifier.toLowerCase().includes(ke)||Ee.title.toLowerCase().includes(ke)):be?[]:I,mt=be?Re:ze;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:kt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),l.jsx("input",{type:"text",value:M,onChange:Ee=>de(Ee.target.value),placeholder:be?"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?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):W?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:W}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):be&&ke.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):mt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ke?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:mt.map(Ee=>l.jsxs("button",{type:"button",onClick:()=>yt(Ee),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Ee.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Ee.identifier})," ",Ee.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ee.stateName,Ee.priorityLabel].filter(Boolean).join(" - ")})]},Ee.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:be,onChange:Ee=>{je(Ee.target.checked),Ee.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),F&&l.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:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>Y(!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"})]})}),P?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):xe.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:xe.map(ke=>l.jsx("button",{type:"button",onClick:()=>ge(ke),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:ke.name})},ke.id))})]}),k&&n&&l.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:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:ke=>{_(ke.target.value)},onFocus:()=>A(!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"}),l.jsx("button",{type:"button",onClick:()=>{A(!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"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!C&&D&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:D}),y.trim().length>=2&&!C&&!D&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!C&&!D&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(ke=>l.jsxs("button",{type:"button",onClick:()=>yt(ke,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:ke.identifier})," - ",ke.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ke.stateName,ke.teamName].filter(Boolean).join(" • ")})]},ke.id))})]}),l.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:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),q&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{$(!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"})})]}),it&&l.jsx(YR,{defaultProjectId:G==null?void 0:G.projectId,connectionId:p??void 0,onCreated:mn,onClose:()=>ht(!1)})]}):null}function QR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,x]=S.useState(!1),[b,y]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&Ne.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),x(!g),y("")},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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.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"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.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:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.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:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=h.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),k=h.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),A=h.some(L=>L.name.toLowerCase()===j),C=N.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(L=>l.jsxs("button",{onClick:()=>{o(L.name,!1),x(!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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[L.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[L.ahead,"↑"]}),L.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[L.behind,"↓"]}),L.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),L.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},L.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(L=>l.jsxs("button",{onClick:()=>{o(L.name,!1),x(!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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${L.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!A&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.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"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.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"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const XR=336*60*60*1e3,ca=12,KR=24;function Dg(e){return e.split("/").filter(Boolean).pop()||e}function X_(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Dg(e.cwd)}function ZR(e){return e.length>8?e.slice(0,8):e}function JR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function eL(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 a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function tL(){var Ji;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=S.useState([]),[y,_]=S.useState(()=>I_(localStorage.getItem("cc-backend")||"claude")),[j,N]=S.useState(()=>q_(localStorage.getItem("cc-backend")||"claude")),[k,A]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,L]=S.useState(()=>df()[0]||""),[D,z]=S.useState([]),[q,$]=S.useState(null),[G,O]=S.useState(!1),[I,T]=S.useState(""),[ae,J]=S.useState(null),[W,B]=S.useState(!1),[F,Y]=S.useState(null),[xe,R]=S.useState(null),[P,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=ae||yS(p),de=H_(p),be=cR(p),[je,Re]=S.useState([]),[Le,Be]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,it]=S.useState(!1),[ht,Xt]=S.useState(!1),pt=FR(),[yt,kt]=S.useState(()=>pt),[ge,Fe]=S.useState([]),[ct,mn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[ke,ze]=S.useState(!1),mt=S.useRef(null),[Ee,Br]=S.useState(null),le=S.useRef(null),ye=S.useRef(null),[Q,he]=S.useState(!1),[Me,Qe]=S.useState(!1),[nt,rt]=S.useState(!1),[wt,gn]=S.useState(!1),[et,rr]=S.useState(!1),[En,Xr]=S.useState(""),[Pr,$r]=S.useState(!0),[ne,pe]=S.useState([]),[ve,Xe]=S.useState(!1),[Bt,ln]=S.useState(""),[Tn,Pt]=S.useState(!1),[zn,xr]=S.useState(ca),[Sa,Bl]=S.useState(""),[On,Ls]=S.useState(null),[Pl,$l]=S.useState(!1),[vr,Gt]=S.useState(""),[_n,ir]=S.useState(!1),[Fl,yf]=S.useState([]),[Ds,zs]=S.useState(null),[Kr,Gi]=S.useState(!1),[hi,Vn]=S.useState(""),[Os,Zr]=S.useState(0),Kt=S.useRef(null),Gn=S.useRef(null),ka=S.useRef(null),Fr=S.useRef(null),Jr=S.useRef(null),Ul=S.useRef(null),Hl=X(H=>H.currentSessionId),Zt=wS({text:e,caretPos:Os,cwd:C||void 0});S.useEffect(()=>{if(Kt.current===null||!Gn.current)return;const H=Kt.current;Gn.current.setSelectionRange(H,H),Kt.current=null},[e]),S.useEffect(()=>{var fe;window.matchMedia("(min-width: 640px)").matches&&((fe=Gn.current)==null||fe.focus())},[]),S.useEffect(()=>{Ne.getHome().then(({home:H,cwd:fe})=>{C||L(fe||H)}).catch(()=>{}),Ne.listEnvs().then(Re).catch(()=>{}),Ne.listSandboxes().then(Fe).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{B(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function _f(H){g(H),localStorage.setItem("cc-backend",H),J(null),_(I_(H)),N(q_(H)),H!=="claude"&&(rr(!1),pe([]),ln(""),Xe(!1),Pt(!1),xr(ca),Bl(""))}S.useEffect(()=>{if(p!=="codex"){J(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const fe=lR(H);J(fe),fe.some(Ke=>Ke.value===y)||_(fe[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(le.current&&(clearInterval(le.current),le.current=null),Br(null),!yt)return;const H="the-companion:latest",fe=()=>{Ne.getImageStatus(H).then(Ke=>{Br(Ke),Ke.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&le.current&&(clearInterval(le.current),le.current=null)}).catch(()=>{})};return fe(),le.current=setInterval(fe,2e3),()=>{le.current&&(clearInterval(le.current),le.current=null)}},[yt]),S.useEffect(()=>{function H(fe){ka.current&&!ka.current.contains(fe.target)&&he(!1),Fr.current&&!Fr.current.contains(fe.target)&&Qe(!1),Jr.current&&!Jr.current.contains(fe.target)&&rt(!1),Ul.current&&!Ul.current.contains(fe.target)&&it(!1),mt.current&&!mt.current.contains(fe.target)&&ze(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),S.useEffect(()=>{if(!C){Ls(null);return}Ne.getRepoInfo(C).then(H=>{Ls(H),Gt(H.currentBranch),ir(!1)}).catch(()=>{Ls(null),Gt(""),ir(!1)})},[C]);const Bs=M.find(H=>H.value===y)||M[0],ja=de.find(H=>H.value===j)||de[0],Ur=be.find(H=>H.value===k)||be[0],Yn=p==="codex"?"/logo-codex.svg":"/logo.svg",Oc=C?C.split("/").pop()||C:"Select folder",Il=S.useMemo(()=>En.trim(),[En]),Na=p==="claude"&&et&&Il.length>0,ei=S.useMemo(()=>{const H=Date.now()-XR;return ne.filter(fe=>fe.createdAt>=H)},[ne]),Yi=S.useMemo(()=>Tn?ne:ei.length>0?ei:ne,[Tn,ei,ne]),br=S.useMemo(()=>Sa.trim().toLowerCase(),[Sa]),nn=S.useMemo(()=>br?Yi.filter(H=>{const fe=X_(H).toLowerCase(),Ke=Dg(H.cwd).toLowerCase(),gt=(H.gitBranch||"").toLowerCase(),st=H.cwd.toLowerCase(),Ie=H.resumeSessionId.toLowerCase();return fe.includes(br)||Ke.includes(br)||gt.includes(br)||st.includes(br)||Ie.includes(br)}):Yi,[Yi,br]),Ps=S.useMemo(()=>nn.slice(0,zn),[nn,zn]),Bc=zn<nn.length,Ca=Math.max(0,ne.length-ei.length),Wi=!Tn&&ei.length>0,Ea=S.useCallback(async()=>{if(p==="claude"){Xe(!0),ln("");try{const[H,fe]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(Ie=>Ie.sessions)]),Ke=new Map,gt=Ie=>{const Bn=Ke.get(Ie.resumeSessionId);(!Bn||Ie.createdAt>Bn.createdAt)&&Ke.set(Ie.resumeSessionId,Ie)};for(const Ie of H)Ie.backendType!=="codex"&&Ie.cliSessionId&>({resumeSessionId:Ie.cliSessionId,sessionId:Ie.sessionId,name:Ie.name,model:Ie.model,createdAt:Ie.createdAt,cwd:Ie.cwd,gitBranch:Ie.gitBranch,source:"companion"});for(const Ie of fe)gt({resumeSessionId:Ie.sessionId,sessionId:Ie.sessionId,slug:Ie.slug,createdAt:Ie.lastActivityAt,cwd:Ie.cwd,gitBranch:Ie.gitBranch,source:"claude_disk"});const st=Array.from(Ke.values()).sort((Ie,Bn)=>{const xn=C&&Ie.cwd===C?0:1,wr=C&&Bn.cwd===C?0:1;return xn!==wr?xn-wr:Bn.createdAt-Ie.createdAt});pe(st),Pt(!1),xr(ca)}catch(H){const fe=H instanceof Error?H.message:String(H);ln(fe||"Failed to load existing sessions"),pe([]),xr(ca)}finally{Xe(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&et&&Ea()},[p,et,Ea]),S.useEffect(()=>{xr(ca)},[br,Tn]);async function ql(H){if(H.length===0)return;const fe=[],Ke=[];let gt=D.reduce((st,Ie)=>st+Ie.size,0);for(const st of H){if(st.size>cf){Ke.push(`${st.name} is too large (${Ns(st.size)}, max ${Ns(cf)})`);continue}if(gt+st.size>uf){Ke.push(`${st.name} would exceed the per-message limit (${Ns(uf)})`);continue}const{base64:Ie,mediaType:Bn}=await oS(st);fe.push({name:st.name,base64:Ie,mediaType:Bn,size:st.size}),gt+=st.size}fe.length>0&&z(st=>[...st,...fe]),$(Ke.length>0?Ke.join("; "):null)}async function Qi(H){const fe=H.target.files;fe&&(await ql(Array.from(fe)),H.target.value="")}function wf(H){z(fe=>fe.filter((Ke,gt)=>gt!==H))}async function Pc(H){var gt;const fe=(gt=H.clipboardData)==null?void 0:gt.items;if(!fe)return;const Ke=[];for(const st of Array.from(fe)){if(st.kind!=="file")continue;const Ie=st.getAsFile();if(!Ie)continue;const Bn=Ie.name&&Ie.name.length>0?Ie.name:`pasted-${Date.now()}.${(Ie.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([Ie],Bn,{type:Ie.type,lastModified:Ie.lastModified}))}Ke.length>0&&(H.preventDefault(),await ql(Ke))}function $c(H){t(H.target.value),Zr(H.target.selectionStart??H.target.value.length);const fe=H.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Ta(){Gn.current&&Zr(Gn.current.selectionStart??0)}function Fc(H){var Ke;const fe=Zt.selectPrompt(H);Kt.current=fe.nextCursor,t(fe.nextText),Zt.setMentionMenuOpen(!1),Zr(fe.nextCursor),(Ke=Gn.current)==null||Ke.focus(),Gn.current&&(Gn.current.style.height="auto",Gn.current.style.height=Math.min(Gn.current.scrollHeight,200)+"px")}function Sf(H){if(Zt.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),Zt.setMentionMenuOpen(!1);return}if(Zt.mentionMenuOpen&&Zt.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),Zt.setMentionMenuIndex(fe=>(fe+1)%Zt.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),Zt.setMentionMenuIndex(fe=>(fe-1+Zt.filteredPrompts.length)%Zt.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Fc(Zt.filteredPrompts[Zt.mentionMenuIndex]);return}}if(Zt.mentionMenuOpen&&Zt.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const fe=H_(p),gt=(fe.findIndex(st=>st.value===j)+1)%fe.length;N(fe[gt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),yr())}function Aa(H){const fe=i.trim(),Ke=fe?`[${fe}]: ${H}`:H;if(!F)return Ke;const gt=(F.description??"").trim();return`${["Linear issue context:",`- Identifier: ${F.identifier}`,`- Title: ${F.title}`,F.stateName?`- State: ${F.stateName}`:"",F.priorityLabel?`- Priority: ${F.priorityLabel}`:"",F.teamName?`- Team: ${F.teamName}`:"",`- URL: ${F.url}`,gt?`- Description:
|
|
107
|
+
`,"aria-label":`Activity: ${g} agents running, ${b}/${x} tasks`,children:[j?l.jsxs("span",{className:"relative flex h-2 w-2",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-cc-warning opacity-75 animate-ping"}),l.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-cc-warning"})]}):l.jsx("span",{className:"h-2 w-2 rounded-full bg-cc-success"}),u.length>0&&l.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&&o.length>0&&l.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-cc-muted/30"}),o.length>0&&l.jsxs("span",{className:"text-[11px] text-cc-fg/70 tabular-nums",children:[b,"/",x]}),l.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:l.jsx("path",{d:"M4 6l4 4 4-4"})})]})]})}function zR({sessionId:e}){const t=X(_=>_.pendingPermissions.get(e)),n=X(_=>_.aiResolvedPermissions.get(e)),i=X(_=>_.clearAiResolvedPermissions),a=X(_=>_.connectionStatus.get(e)??"disconnected"),o=X(_=>_.cliConnected.get(e)??!1),u=X(_=>_.cliReconnecting.get(e)??!1),f=X(_=>_.setCliReconnecting),[h,p]=S.useState(null),g=S.useRef(void 0);S.useEffect(()=>{p(null),clearTimeout(g.current)},[e,o]),S.useEffect(()=>()=>clearTimeout(g.current),[]);const x=S.useCallback(async()=>{p(null),clearTimeout(g.current),f(e,!0);try{await Ne.relaunchSession(e)}catch(_){As(_),f(e,!1);const j=_ instanceof Error?_.message:"Reconnection failed";p(j),g.current=setTimeout(()=>p(null),4e3)}},[e,f]),b=S.useMemo(()=>t?Array.from(t.values()):[],[t]),y=a==="connected"&&!o;return l.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[y&&l.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?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-error shrink-0"}),l.jsx("span",{className:"text-xs text-cc-error font-medium",children:h}),l.jsx("button",{onClick:x,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?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting…"})]}):l.jsxs(l.Fragment,{children:[l.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"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"CLI disconnected"}),l.jsx("button",{onClick:x,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"})]})}),a==="disconnected"&&l.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:[l.jsx("span",{className:"w-3 h-3 rounded-full border-2 border-cc-warning/30 border-t-cc-warning animate-spin"}),l.jsx("span",{className:"text-xs text-cc-warning font-medium",children:"Reconnecting to session..."})]}),l.jsxs("div",{className:"flex-1 flex flex-col min-h-0 relative",children:[l.jsx(iR,{sessionId:e}),l.jsx(DR,{sessionId:e})]}),n&&n.length>0&&l.jsx("div",{className:"shrink-0 border-t border-cc-border bg-cc-card",children:l.jsx(jR,{entry:n[n.length-1],onDismiss:()=>i(e)})}),b.length>0&&l.jsx("div",{className:"shrink-0 max-h-[60dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:b.map(_=>l.jsx(hR,{permission:_,sessionId:e},_.request_id))}),l.jsx(dR,{sessionId:e})]})}function OR({sessionId:e}){const[t,n]=S.useState(!1),i=S.useRef(null),a=X(p=>p.sessions.get(e)),o=(a==null?void 0:a.aiValidationEnabled)??!1,u=(a==null?void 0:a.aiValidationAutoApprove)??!0,f=(a==null?void 0:a.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 x=!g,b={[p]:x};X.getState().setSessionAiValidation(e,b),x3(e,b)}return l.jsxs("div",{ref:i,className:"relative",children:[l.jsx("button",{onClick:()=>n(!t),className:`flex items-center justify-center w-8 h-8 rounded-md transition-colors cursor-pointer ${o?"text-cc-success hover:bg-cc-hover":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,title:o?"AI Validation: On":"AI Validation: Off","aria-label":"Toggle AI validation settings","aria-expanded":t,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-[15px] h-[15px]",children:l.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&&l.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:[l.jsx("p",{className:"text-[10px] text-cc-muted px-2 pt-1 pb-1",children:"AI Validation for this session"}),l.jsxs("button",{type:"button",onClick:()=>h("aiValidationEnabled",o),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:[l.jsx("span",{className:"text-xs",children:"Enabled"}),l.jsx("span",{className:`text-[10px] font-medium ${o?"text-cc-success":"text-cc-muted"}`,children:o?"On":"Off"})]}),o&&l.jsxs(l.Fragment,{children:[l.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:[l.jsx("span",{className:"text-xs",children:"Auto-approve safe"}),l.jsx("span",{className:`text-[10px] font-medium ${u?"text-cc-success":"text-cc-muted"}`,children:u?"On":"Off"})]}),l.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:[l.jsx("span",{className:"text-xs",children:"Auto-deny dangerous"}),l.jsx("span",{className:`text-[10px] font-medium ${f?"text-cc-success":"text-cc-muted"}`,children:f?"On":"Off"})]})]})]})]})}function BR({sessionId:e}){const[t,n]=S.useState(!1),[i,a]=S.useState(null),[o,u]=S.useState(!1),f=S.useRef(null);S.useEffect(()=>{if(!t)return;const p=x=>{f.current&&!f.current.contains(x.target)&&n(!1)},g=x=>{x.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=>{a(p),u(!1);try{const{blob:g,filename:x}=await Ne.exportSession(e,p),b=URL.createObjectURL(g),y=document.createElement("a");y.href=b,y.download=x,document.body.appendChild(y),y.click(),y.remove(),URL.revokeObjectURL(b),n(!1)}catch(g){As(g),u(!0)}finally{a(null)}},[e]);return l.jsxs("div",{ref:f,className:"relative",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v12m0 0l-4-4m4 4l4-4"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2"})]})}),t&&l.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:[l.jsx("div",{className:"px-3 py-1.5 text-[10px] uppercase tracking-wide text-cc-muted",children:"Export session"}),l.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",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Includes images"})]}),l.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",l.jsx("span",{className:"block text-[10px] text-cc-muted",children:"Plain text, no images"})]}),o&&l.jsx("div",{className:"px-3 py-1.5 text-[11px] text-cc-error",children:"Export failed"})]})]})}function PR(){var q;const e=S.useSyncExternalStore($=>(window.addEventListener("hashchange",$),()=>window.removeEventListener("hashchange",$)),()=>window.location.hash),t=S.useMemo(()=>ix(e),[e]),n=t.page==="session"||t.page==="home",i=X($=>$.currentSessionId),a=X($=>$.cliConnected),o=X($=>$.sessionStatus),u=X($=>$.sessionNames),f=X($=>$.sdkSessions),h=X($=>$.sidebarOpen),p=X($=>$.setSidebarOpen),g=X($=>$.taskPanelOpen),x=X($=>$.setTaskPanelOpen),b=X($=>$.activeTab),y=X($=>$.setActiveTab),_=X($=>$.markChatTabReentry),j=X($=>i?$.gitChangedFilesCount.get(i)??0:0),N=i?o.get(i)??null:null,k=i?a.get(i)??!1:!1,A=i?(u==null?void 0:u.get(i))||((q=f.find($=>$.sessionId===i))==null?void 0:q.name)||`Session ${i.slice(0,8)}`:null,C=!!(i&&n),L=t.page==="session"&&!!i,D=["chat","diff"],z=$=>{$==="chat"&&b!=="chat"&&i&&_(i),y($)};return S.useEffect(()=>{const $=G=>{if(!(G.metaKey||G.ctrlKey)||G.key.toLowerCase()!=="j"||!C)return;const O=G.target;if(O&&(O.tagName==="TEXTAREA"||O.tagName==="INPUT"||O.isContentEditable))return;G.preventDefault();const I=Math.max(0,D.indexOf(b)),T=G.shiftKey?-1:1,ae=(I+T+D.length)%D.length;z(D[ae])};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[C,D,b,y,_,i]),l.jsx("header",{className:"relative shrink-0 h-11 px-4 bg-cc-bg",children:l.jsxs("div",{className:"h-full flex items-center gap-1 min-w-0",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 3v18"})]})}),C&&l.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:[l.jsxs("button",{onClick:()=>z("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 ${b==="chat"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,title:A||"Session","aria-label":"Session tab",children:[l.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${k?N==="running"?"bg-cc-primary":N==="compacting"?"bg-cc-warning":"bg-cc-success":"bg-cc-muted opacity-45"}`}),"Session"]}),l.jsxs("button",{onClick:()=>z("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 ${b==="diff"?"text-cc-fg border-cc-primary":"text-cc-muted hover:text-cc-fg border-transparent"}`,"aria-label":"Diffs tab",children:["Diffs",j>0&&l.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:j})]})]}),l.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[C&&i&&l.jsx(OR,{sessionId:i}),C&&i&&l.jsx(BR,{sessionId:i}),l.jsx($R,{}),L&&l.jsx("button",{onClick:()=>x(!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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3h18v18H3V3z"}),l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 3v18"})]})})]})]})})}function $R(){const e=X(n=>n.darkMode),t=S.useCallback(()=>X.getState().toggleDarkMode(),[]);return l.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?l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:[l.jsx("circle",{cx:"12",cy:"12",r:"4"}),l.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"})]}):l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-[15px] h-[15px]",children:l.jsx("path",{d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})})})}const kS="cc-recent-dirs";function df(){try{return JSON.parse(localStorage.getItem(kS)||"[]")}catch{return[]}}function jS(e){const t=df().filter(n=>n!==e);t.unshift(e),localStorage.setItem(kS,JSON.stringify(t.slice(0,5)))}function FR(){return!1}function NS({onClose:e,embedded:t=!1}){const[n,i]=S.useState([]),[a,o]=S.useState(!0),[u,f]=S.useState(null),[h,p]=S.useState(""),[g,x]=S.useState([]),[b,y]=S.useState(""),[_,j]=S.useState(!1),[N,k]=S.useState(""),[A,C]=S.useState([{key:"",value:""}]),[L,D]=S.useState(!1),z=S.useCallback(()=>{Ne.listEnvs().then(i).catch(()=>{}).finally(()=>o(!1))},[]);S.useEffect(()=>{z()},[z]);function q(W){f(W.slug),p(W.name);const B=Object.entries(W.variables).map(([F,Y])=>({key:F,value:Y}));B.length===0&&B.push({key:"",value:""}),x(B),y("")}function $(){f(null),y("")}async function G(){if(!u)return;const W={};for(const B of g){const F=B.key.trim();F&&(W[F]=B.value)}try{await Ne.updateEnv(u,{name:h.trim()||void 0,variables:W}),f(null),y(""),z()}catch(B){y(B instanceof Error?B.message:String(B))}}async function O(W){try{await Ne.deleteEnv(W),u===W&&f(null),z()}catch(B){y(B instanceof Error?B.message:String(B))}}async function I(){const W=N.trim();if(!W)return;D(!0);const B={};for(const F of A){const Y=F.key.trim();Y&&(B[Y]=F.value)}try{await Ne.createEnv(W,B),k(""),C([{key:"",value:""}]),j(!1),y(""),z()}catch(F){y(F instanceof Error?F.message:String(F))}finally{D(!1)}}if(t)return l.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:l.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[l.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:l.jsxs("div",{className:"min-w-0",children:[l.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Environments"}),l.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Reusable runtime profiles."})]})}),l.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("button",{onClick:()=>j(!_),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:[l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:_?l.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):l.jsx("path",{d:"M12 5v14M5 12h14"})}),l.jsx("span",{className:"hidden sm:inline",children:_?"Cancel":"New Environment"})]})]}),_&&l.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:[l.jsx("input",{type:"text",value:N,onChange:W=>k(W.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:W=>{W.key==="Enter"&&N.trim()&&I()}}),l.jsx(vd,{rows:A,onChange:C}),b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),l.jsxs("div",{className:"flex items-center justify-between pt-1",children:[l.jsxs("p",{className:"text-[11px] text-cc-muted",children:["Stored in ",l.jsx("code",{className:"text-[10px]",children:"~/.companion/envs/"})]}),l.jsx("button",{onClick:I,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]})]}),l.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:l.jsxs("span",{children:[n.length," environment",n.length!==1?"s":""]})}),a?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No environments yet."}):l.jsx("div",{className:"space-y-1",children:n.map(W=>{const B=u===W.slug,F=Object.keys(W.variables).length;return B?l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[l.jsx("input",{type:"text",value:h,onChange:Y=>p(Y.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(vd,{rows:g,onChange:x})]})}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{onClick:$,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"}),l.jsx("button",{onClick:()=>void G(),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"})]})]},W.slug):l.jsx(UR,{env:W,varCount:F,onStartEdit:()=>q(W),onDelete:()=>void O(W.slug)},W.slug)})}),b&&!_&&l.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b})]})});const T=l.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Environment"}),l.jsx("input",{type:"text",value:N,onChange:W=>k(W.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:W=>{W.key==="Enter"&&N.trim()&&I()}}),l.jsx(vd,{rows:A,onChange:C}),l.jsx("button",{onClick:I,disabled:!N.trim()||L,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${N.trim()&&!L?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:L?"Creating...":"Create"})]}),ae=a?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading environments..."}):n.length===0?l.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No environments yet."}):l.jsx("div",{className:"space-y-3",children:n.map(W=>l.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[l.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1",children:W.name}),l.jsxs("span",{className:"text-xs text-cc-muted",children:[Object.keys(W.variables).length," var",Object.keys(W.variables).length!==1?"s":""]}),u===W.slug?l.jsx("button",{onClick:$,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>q(W),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),l.jsx("button",{onClick:()=>O(W.slug),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),u===W.slug&&l.jsxs("div",{className:"px-3 py-3 space-y-2",children:[l.jsx("input",{type:"text",value:h,onChange:B=>p(B.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"}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{children:[l.jsx("div",{className:"text-[11px] font-medium text-cc-muted mb-1.5",children:"Variables"}),l.jsx(vd,{rows:g,onChange:x})]})}),l.jsx("button",{onClick:G,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!==W.slug&&Object.keys(W.variables).length>0&&l.jsx("div",{className:"px-3 py-2.5 space-y-1",children:Object.entries(W.variables).map(([B,F])=>l.jsxs("div",{className:"grid grid-cols-[auto_auto_minmax(0,1fr)] items-start gap-1.5 text-xs leading-5",children:[l.jsx("span",{className:"font-mono-code text-cc-fg break-all",children:B}),l.jsx("span",{className:"text-cc-muted",children:"="}),l.jsx("span",{className:"font-mono-code text-cc-muted break-all whitespace-pre-wrap",children:F})]},B))})]},W.slug))}),J=l.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:W=>W.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Manage Environments"})}),e&&l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[b&&l.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:b}),ae,T]})]});return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:e,children:J}),document.body)}function UR({env:e,varCount:t,onStartEdit:n,onDelete:i}){return l.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:[l.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:l.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:l.jsx("path",{d:"M12 3v18M3 12h18M4.5 6.5l15 0M4.5 17.5h15M6.5 4.5v15M17.5 4.5v15"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:e.name})}),l.jsxs("p",{className:"mt-0.5 text-xs text-cc-muted",children:[t," variable",t!==1?"s":""]})]}),l.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[l.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:l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[l.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),l.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),l.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:l.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:l.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 vd({rows:e,onChange:t}){function n(o,u,f){const h=[...e];h[o]={...h[o],[u]:f},t(h)}function i(o){const u=e.filter((f,h)=>h!==o);u.length===0&&u.push({key:"",value:""}),t(u)}function a(){t([...e,{key:"",value:""}])}return l.jsxs("div",{className:"space-y-1.5",children:[e.map((o,u)=>l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"text",value:o.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"}),l.jsx("span",{className:"text-[10px] text-cc-muted",children:"="}),l.jsx("input",{type:"text",value:o.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"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},u)),l.jsx("button",{onClick:a,className:"text-xs py-2 min-h-[44px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:"+ Add variable"})]})}const HR=Object.freeze(Object.defineProperty({__proto__:null,EnvManager:NS},Symbol.toStringTag,{value:"Module"}));function IR(e){if(!e)return[];const t=e.split("/").filter(Boolean),n=[{label:"/",path:"/"}];let i="";for(const a of t)i+="/"+a,n.push({label:a,path:i});return n}function qR({initialPath:e,onSelect:t,onClose:n}){const[i,a]=S.useState(""),[o,u]=S.useState([]),[f,h]=S.useState(!0),[p,g]=S.useState(""),[x,b]=S.useState(""),[y,_]=S.useState(!1),[j,N]=S.useState(""),[k,A]=S.useState(-1),[C,L]=S.useState(!1),[D,z]=S.useState(()=>df()),q=S.useRef(null),$=S.useRef(null),G=S.useRef(null),O=S.useRef(new Map),I=S.useMemo(()=>{if(!j)return o;const F=j.toLowerCase();return o.filter(Y=>Y.name.toLowerCase().includes(F))},[o,j]),T=S.useCallback(async F=>{h(!0),g(""),N(""),A(-1);try{const Y=await Ne.listDirs(F);a(Y.path),u(Y.dirs)}catch{g("Could not load directory"),u([])}finally{h(!1)}},[]);S.useEffect(()=>{T(e||void 0)},[]),S.useEffect(()=>{const F=q.current;if(!F)return;function Y(R){if(R.key!=="Tab")return;const P=F.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(P.length===0)return;const Z=P[0],M=P[P.length-1];R.shiftKey&&document.activeElement===Z?(R.preventDefault(),M.focus()):!R.shiftKey&&document.activeElement===M&&(R.preventDefault(),Z.focus())}document.addEventListener("keydown",Y);const xe=setTimeout(()=>{var R;(R=G.current)==null||R.focus()},80);return()=>{document.removeEventListener("keydown",Y),clearTimeout(xe)}},[]);const ae=S.useCallback(()=>{C||(L(!0),setTimeout(n,150))},[n,C]);S.useEffect(()=>{function F(Y){if(Y.key==="Escape"){if(y)return;ae()}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,ae]),S.useEffect(()=>{function F(Y){var R,P;if(y)return;if(Y.key==="Backspace"&&document.activeElement!==G.current){if(i&&i!=="/"){Y.preventDefault();const Z=i.split("/").slice(0,-1).join("/")||"/";T(Z)}return}const xe=I.length;if(xe!==0){if(Y.key==="ArrowDown"){Y.preventDefault();const Z=k<xe-1?k+1:0;A(Z),(R=O.current.get(Z))==null||R.focus()}else if(Y.key==="ArrowUp"){Y.preventDefault();const Z=k>0?k-1:xe-1;A(Z),(P=O.current.get(Z))==null||P.focus()}}}return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[y,I.length,k,i,T]),S.useEffect(()=>{var F;k>=0&&((F=O.current.get(k))==null||F.scrollIntoView({block:"nearest"}))},[k]);function J(F){jS(F),z(df()),t(F),n()}const W=IR(i),B=i.split("/").pop()||"/";return Dl.createPortal(l.jsx("div",{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center transition-opacity duration-150 ${C?"opacity-0":"opacity-100"}`,style:{backgroundColor:"rgba(0,0,0,0.5)",backdropFilter:"blur(4px)"},onClick:ae,children:l.jsxs("div",{ref:q,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 ${C?"translate-y-4 sm:translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,style:{animation:"fadeSlideIn 200ms ease-out"},onClick:F=>F.stopPropagation(),children:[l.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:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg font-sans-ui",children:"Select Folder"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:l.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),D.length>0&&l.jsxs("div",{className:"border-b border-cc-border shrink-0",role:"group","aria-label":"Recent directories",children:[l.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"}),l.jsx("ul",{className:"list-none m-0 p-0",children:D.map(F=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>J(F),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:[l.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:[l.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"}),l.jsx("path",{fillRule:"evenodd",d:"M8 16A8 8 0 108 0a8 8 0 000 16zm7-8A7 7 0 111 8a7 7 0 0114 0z"})]}),l.jsx("span",{className:"font-medium truncate",children:F.split("/").pop()||F}),l.jsx("span",{className:"text-cc-muted font-mono-code text-[10px] truncate ml-auto",children:F})]})},F))})]}),l.jsx("div",{className:"px-4 py-2 border-b border-cc-border flex items-center gap-1.5 shrink-0 min-h-[40px]",children:y?l.jsx("input",{type:"text","aria-label":"Type a directory path",value:x,onChange:F=>b(F.target.value),onKeyDown:F=>{F.key==="Enter"&&x.trim()&&J(x.trim()),F.key==="Escape"&&(F.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}):l.jsxs(l.Fragment,{children:[l.jsx("nav",{"aria-label":"Directory breadcrumb",className:"flex-1 min-w-0 flex items-center gap-0.5 overflow-x-auto",children:W.map((F,Y)=>{const xe=Y===W.length-1;return l.jsxs("span",{className:"flex items-center gap-0.5 shrink-0",children:[Y>0&&l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-muted opacity-40 shrink-0",children:l.jsx("path",{d:"M6 4l4 4-4 4"})}),l.jsx("button",{type:"button",onClick:()=>{xe||T(F.path)},className:`text-[11px] font-mono-code px-1 py-0.5 rounded transition-colors whitespace-nowrap ${xe?"text-cc-fg font-medium cursor-default":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover cursor-pointer"}`,"aria-current":xe?"location":void 0,tabIndex:xe?-1:0,children:F.label})]},F.path)})}),l.jsx("button",{type:"button","aria-label":"Type path manually",onClick:()=>{_(!0),b(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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]})}),!y&&l.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-cc-border shrink-0",children:[l.jsxs("div",{className:"flex-1 min-w-0 relative",children:[l.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:l.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"})}),l.jsx("input",{ref:G,type:"text","aria-label":"Filter directories",value:j,onChange:F=>{N(F.target.value),A(-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"})]}),l.jsxs("button",{type:"button",onClick:()=>J(i),"aria-label":`Select ${B}`,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0","aria-hidden":"true",children:l.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"})}),l.jsx("span",{className:"hidden sm:inline","aria-hidden":"true",children:"Select"}),l.jsx("span",{className:"font-mono-code max-w-[100px] truncate","aria-hidden":"true",children:B})]})]}),l.jsx("div",{ref:$,className:"flex-1 min-h-0 overflow-y-auto","aria-label":"Subdirectories",children:f?l.jsx("div",{className:"px-4 py-2 space-y-1","aria-busy":"true","aria-label":"Loading directories",children:Array.from({length:6}).map((F,Y)=>l.jsxs("div",{className:"flex items-center gap-2 py-1.5",children:[l.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"}}),l.jsx("div",{className:"h-3 rounded-sm flex-1",style:{maxWidth:`${50+Y*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 ${Y*.1}s infinite`}})]},Y))}):p?l.jsxs("div",{className:"px-4 py-8 flex flex-col items-center gap-2 text-center",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-5 h-5 text-cc-error/70",children:l.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"})}),l.jsx("p",{className:"text-xs text-cc-muted",children:p}),l.jsx("button",{type:"button",onClick:()=>T(i||void 0),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Retry"})]}):I.length===0?l.jsxs("div",{className:"px-4 py-8 text-center",children:[l.jsx("p",{className:"text-xs text-cc-muted",children:j?"No matching directories":"No subdirectories"}),j&&l.jsx("button",{type:"button",onClick:()=>N(""),className:"mt-1 text-xs text-cc-primary hover:text-cc-primary-hover transition-colors cursor-pointer font-medium",children:"Clear filter"})]}):l.jsx("ul",{className:"list-none m-0 p-0",children:I.map((F,Y)=>l.jsxs("li",{className:`flex items-center transition-colors ${k===Y?"bg-cc-hover":"hover:bg-cc-hover"}`,children:[l.jsxs("button",{type:"button",ref:xe=>{xe?O.current.set(Y,xe):O.current.delete(Y)},onClick:()=>T(F.path),onKeyDown:xe=>{xe.key==="Enter"&&(xe.preventDefault(),J(F.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:F.path,"aria-label":`Navigate into ${F.name}`,children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-40 shrink-0",children:l.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"})}),l.jsx("span",{className:"truncate",children:F.name}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-25 shrink-0 ml-auto",children:l.jsx("path",{d:"M6 4l4 4-4 4"})})]}),l.jsx("button",{type:"button",onClick:()=>J(F.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 ${F.name}`,children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]},F.path))})}),l.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:[l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↑↓"})," navigate"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"↵"})," select"]}),l.jsxs("span",{children:[l.jsx("kbd",{className:"px-1 py-0.5 rounded bg-cc-hover text-cc-muted font-mono-code text-[9px]",children:"⇐"})," parent"]}),l.jsxs("span",{className:"ml-auto",children:[l.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 VR(e,t){const n=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60);return`${e.toLowerCase()}-${n}`}function GR(e){return e.branchName&&e.branchName.trim()?e.branchName.trim():VR(e.identifier,e.title)}function mc({className:e}){return l.jsxs("svg",{viewBox:"0 0 100 104",fill:"none","aria-hidden":"true",className:e,children:[l.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"}),l.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"}),l.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"}),l.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 YR({defaultProjectId:e,connectionId:t,onCreated:n,onClose:i}){const[a,o]=S.useState(""),[u,f]=S.useState(""),[h,p]=S.useState(""),[g,x]=S.useState(0),[b,y]=S.useState(!0),[_,j]=S.useState([]),[N,k]=S.useState(""),[A,C]=S.useState(""),[L,D]=S.useState(!0),[z,q]=S.useState(!1),[$,G]=S.useState("");S.useEffect(()=>{let I=!0;return Promise.all([Ne.getLinearStates(t),Ne.getLinearConnection(t)]).then(([T,ae])=>{var W;if(!I)return;j(T.teams),k(ae.viewerId);const J=((W=T.teams[0])==null?void 0:W.id)||"";p(J)}).catch(T=>{I&&G(T instanceof Error?T.message:"Failed to load teams")}).finally(()=>{I&&D(!1)}),()=>{I=!1}},[t]),S.useEffect(()=>{if(!h||_.length===0){C("");return}const I=_.find(ae=>ae.id===h),T=I==null?void 0:I.states.find(ae=>ae.type==="backlog");C((T==null?void 0:T.id)||"")},[h,_]);async function O(){if(!(!a.trim()||!h)){q(!0),G("");try{const I=await Ne.createLinearIssue({title:a.trim(),description:u.trim()||void 0,teamId:h,priority:g,projectId:e||void 0,assigneeId:b&&N?N:void 0,stateId:A||void 0,connectionId:t});n(I.issue)}catch(I){G(I instanceof Error?I.message:"Failed to create issue")}finally{q(!1)}}}return Dl.createPortal(l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:i,children:l.jsxs("div",{className:"mx-4 w-full max-w-md bg-cc-card border border-cc-border rounded-xl shadow-2xl p-5",onClick:I=>I.stopPropagation(),children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Create Linear Issue"}),l.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:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),$&&l.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:$}),L?l.jsx("div",{className:"py-8 text-xs text-cc-muted text-center",children:"Loading teams..."}):l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-title",className:"text-xs text-cc-muted block mb-1",children:"Title *"}),l.jsx("input",{id:"create-issue-title",type:"text",value:a,onChange:I=>o(I.target.value),onKeyDown:I=>{I.key==="Enter"&&a.trim()&&h&&!z&&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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-desc",className:"text-xs text-cc-muted block mb-1",children:"Description"}),l.jsx("textarea",{id:"create-issue-desc",value:u,onChange:I=>f(I.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"})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-team",className:"text-xs text-cc-muted block mb-1",children:"Team *"}),l.jsx("select",{id:"create-issue-team",value:h,onChange:I=>p(I.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(I=>l.jsxs("option",{value:I.id,children:[I.name," (",I.key,")"]},I.id))})]}),l.jsxs("div",{children:[l.jsx("label",{htmlFor:"create-issue-priority",className:"text-xs text-cc-muted block mb-1",children:"Priority"}),l.jsxs("select",{id:"create-issue-priority",value:g,onChange:I=>x(Number(I.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:[l.jsx("option",{value:0,children:"No priority"}),l.jsx("option",{value:1,children:"Urgent"}),l.jsx("option",{value:2,children:"High"}),l.jsx("option",{value:3,children:"Medium"}),l.jsx("option",{value:4,children:"Low"})]})]}),l.jsxs("label",{htmlFor:"create-issue-assign",className:"flex items-center gap-2 cursor-pointer",children:[l.jsx("input",{id:"create-issue-assign",type:"checkbox",checked:b,onChange:I=>y(I.target.checked),className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-xs text-cc-muted",children:"Assign to me"})]}),l.jsxs("div",{className:"flex gap-2.5 pt-2",children:[l.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"}),l.jsx("button",{type:"button",onClick:O,disabled:!a.trim()||!h||z,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:z?"Creating...":"Create Issue"})]})]})]})}),document.body)}function WR({cwd:e,gitRepoInfo:t,linearConfigured:n,selectedLinearIssue:i,onIssueSelect:a,onBranchFromIssue:o,onConnectionSelect:u}){const[f,h]=S.useState([]),[p,g]=S.useState(null),[x,b]=S.useState(!1),[y,_]=S.useState(""),[j,N]=S.useState([]),[k,A]=S.useState(!1),[C,L]=S.useState(!1),[D,z]=S.useState(""),[q,$]=S.useState(!1),[G,O]=S.useState(null),[I,T]=S.useState([]),[ae,J]=S.useState(!1),[W,B]=S.useState(""),[F,Y]=S.useState(!1),[xe,R]=S.useState([]),[P,Z]=S.useState(!1),[M,de]=S.useState(""),[be,je]=S.useState(!1),[Re,Le]=S.useState([]),[Be,Je]=S.useState(!1),[it,ht]=S.useState(!1),Xt=S.useRef(null);S.useEffect(()=>{function ke(ze){Xt.current&&!Xt.current.contains(ze.target)&&(A(!1),Y(!1))}return document.addEventListener("pointerdown",ke),()=>document.removeEventListener("pointerdown",ke)},[]),S.useEffect(()=>{if(!n){h([]),g(null),b(!1),u(null);return}let ke=!0;return Ne.listLinearConnections().then(({connections:ze})=>{ke&&(h(ze),b(!0),ze.length>0?(g(ze[0].id),u(ze[0].id)):(g(null),u(null)))}).catch(()=>{ke&&b(!0)}),()=>{ke=!1}},[n]);const pt=S.useCallback(ke=>{g(ke),u(ke),a(null),N([]),_(""),z(""),Le([]),de(""),R([]),G&&(J(!0),B(""),Ne.getLinearProjectIssues(G.projectId,10,ke).then(({issues:ze})=>{T(ze)}).catch(ze=>{B(ze instanceof Error?ze.message:String(ze))}).finally(()=>{J(!1)}))},[G,u,a]);S.useEffect(()=>{if(!t||!n){O(null),T([]);return}let ke=!0;return J(!0),B(""),(async()=>{try{const{mapping:ze}=await Ne.getLinearProjectMapping(t.repoRoot);if(!ke)return;if(O(ze),ze){const{issues:mt}=await Ne.getLinearProjectIssues(ze.projectId,10,p??void 0);if(!ke)return;T(mt)}else T([])}catch(ze){if(!ke)return;B(ze instanceof Error?ze.message:String(ze))}finally{ke&&J(!1)}})(),()=>{ke=!1}},[t,n,p]),S.useEffect(()=>{if(!n)return;const ke=y.trim();if(ke.length<2){N([]),z(""),L(!1);return}let ze=!0;L(!0),z("");const mt=setTimeout(()=>{Ne.searchLinearIssues(ke,8,p??void 0).then(Ee=>{ze&&N(Ee.issues)}).catch(Ee=>{ze&&(N([]),z(Ee instanceof Error?Ee.message:String(Ee)))}).finally(()=>{ze&&L(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,y,p]),S.useEffect(()=>{if(!n||!be){Le([]),Je(!1);return}const ke=M.trim();if(ke.length<2){Le([]),Je(!1);return}let ze=!0;Je(!0);const mt=setTimeout(()=>{Ne.searchLinearIssues(ke,10,p??void 0).then(Ee=>{ze&&Le(Ee.issues)}).catch(()=>{ze&&Le([])}).finally(()=>{ze&&Je(!1)})},400);return()=>{ze=!1,clearTimeout(mt)}},[n,be,M,p]);function yt(ke,ze=!1){a(ke),_(`${ke.identifier} - ${ke.title}`);const mt=GR(ke);o(mt,!0),ze&&A(!1)}function kt(){a(null),_(""),N([]),z("")}async function ge(ke){if(t)try{const{mapping:ze}=await Ne.upsertLinearProjectMapping({repoRoot:t.repoRoot,projectId:ke.id,projectName:ke.name});O(ze),Y(!1),J(!0),B("");const{issues:mt}=await Ne.getLinearProjectIssues(ke.id,10,p??void 0);T(mt)}catch(ze){B(ze instanceof Error?ze.message:String(ze))}finally{J(!1)}}async function Fe(){if(t){try{await Ne.removeLinearProjectMapping(t.repoRoot)}catch{}O(null),T([]),a(null),_("")}}function ct(){if(!n){window.location.hash="#/integrations/linear";return}Y(!0),xe.length===0&&(Z(!0),Ne.listLinearProjects(p??void 0).then(({projects:ke})=>R(ke)).catch(()=>{}).finally(()=>Z(!1)))}function mn(ke){ht(!1),yt(ke),G&&(J(!0),Ne.getLinearProjectIssues(G.projectId,10,p??void 0).then(({issues:ze})=>T(ze)).catch(()=>{}).finally(()=>J(!1)))}return n?l.jsxs("aside",{className:"space-y-2 mt-0.5",ref:Xt,children:[l.jsxs("div",{className:"relative rounded-[12px] border border-cc-border bg-cc-card/90 px-2.5 py-2",title:`Repo: ${e}`,children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx("span",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"Context"}),x&&f.length>1&&l.jsx("select",{value:p??"",onChange:ke=>pt(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=>l.jsx("option",{value:ke.id,children:ke.workspaceName||ke.name},ke.id))}),G?l.jsxs(l.Fragment,{children:[l.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:[l.jsx(mc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:G.projectName}),l.jsx("button",{type:"button",onClick:Fe,className:"ml-0.5 hover:text-cc-error transition-colors cursor-pointer",title:"Detach Linear project",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})})})]}),l.jsxs("button",{type:"button",onClick:()=>ht(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button","aria-expanded":k,onClick:()=>{if(!n){window.location.hash="#/integrations/linear";return}A(!k)},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:[l.jsx(mc,{className:"w-3.5 h-3.5"}),l.jsx("span",{children:"Linear"})]}),n&&t&&l.jsxs("button",{type:"button",onClick:ct,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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Attach project"})]}),n&&l.jsxs("button",{type:"button",onClick:()=>ht(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3",children:l.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"})}),l.jsx("span",{children:"Create issue"})]}),!n&&l.jsx("span",{className:"text-[11px] text-amber-600 dark:text-amber-300",children:"Configure Linear to attach an issue."})]})]}),G&&(()=>{const ke=M.trim().toLowerCase(),ze=!be&&ke?I.filter(Ee=>Ee.identifier.toLowerCase().includes(ke)||Ee.title.toLowerCase().includes(ke)):be?[]:I,mt=be?Re:ze;return l.jsxs("div",{className:"mt-2",children:[i&&l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0 text-xs text-cc-primary truncate",children:[l.jsx("span",{className:"font-mono-code",children:i.identifier})," - ",i.title]}),l.jsx("button",{type:"button",onClick:kt,className:"text-cc-muted hover:text-cc-fg transition-colors cursor-pointer shrink-0",title:"Remove issue",children:l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),l.jsx("input",{type:"text",value:M,onChange:Ee=>de(Ee.target.value),placeholder:be?"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?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Loading recent issues..."}):W?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-error",children:W}):Be?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Searching..."}):be&&ke.length<2?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:"Type at least 2 characters to search all projects..."}):mt.length===0?l.jsx("div",{className:"px-1 py-1.5 text-xs text-cc-muted",children:ke?"No matching issues":"No active issues found"}):l.jsx("div",{className:"max-h-56 overflow-y-auto -mx-0.5 mt-1",children:mt.map(Ee=>l.jsxs("button",{type:"button",onClick:()=>yt(Ee),className:`w-full px-2 py-1.5 text-left rounded-md transition-colors cursor-pointer ${(i==null?void 0:i.id)===Ee.id?"bg-cc-primary/10 border border-cc-primary/30":"hover:bg-cc-hover"}`,children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:Ee.identifier})," ",Ee.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[Ee.stateName,Ee.priorityLabel].filter(Boolean).join(" - ")})]},Ee.id))}),l.jsxs("label",{className:"mt-1.5 flex items-center gap-1.5 cursor-pointer",children:[l.jsx("input",{type:"checkbox",checked:be,onChange:Ee=>{je(Ee.target.checked),Ee.target.checked||Le([])},className:"rounded border-cc-border text-cc-primary focus:ring-cc-primary/30 cursor-pointer"}),l.jsx("span",{className:"text-[11px] text-cc-muted",children:"Search all projects"})]})]})})(),F&&l.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:[l.jsx("div",{className:"p-2 border-b border-cc-border",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx("span",{className:"text-xs text-cc-fg font-medium",children:"Attach a Linear project to this repo"}),l.jsx("button",{type:"button",onClick:()=>Y(!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"})]})}),P?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Loading projects..."}):xe.length===0?l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No projects found"}):l.jsx("div",{className:"max-h-48 overflow-y-auto",children:xe.map(ke=>l.jsx("button",{type:"button",onClick:()=>ge(ke),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:l.jsx("div",{className:"text-xs text-cc-fg",children:ke.name})},ke.id))})]}),k&&n&&l.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:[l.jsxs("div",{className:"p-2 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{type:"text",value:y,onChange:ke=>{_(ke.target.value)},onFocus:()=>A(!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"}),l.jsx("button",{type:"button",onClick:()=>{A(!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"})]}),l.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-[11px] text-cc-muted",children:[l.jsx("span",{children:"Attach an issue to this draft"}),l.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},className:"hover:text-cc-fg underline underline-offset-2 cursor-pointer",children:"Settings"})]})]}),y.trim().length<2&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Type at least 2 characters…"}),y.trim().length>=2&&C&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"Searching Linear..."}),y.trim().length>=2&&!C&&D&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-error",children:D}),y.trim().length>=2&&!C&&!D&&j.length===0&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted",children:"No matching issues"}),y.trim().length>=2&&!C&&!D&&l.jsx("div",{className:"max-h-56 overflow-y-auto",children:j.map(ke=>l.jsxs("button",{type:"button",onClick:()=>yt(ke,!0),className:"w-full px-3 py-2 text-left hover:bg-cc-hover transition-colors cursor-pointer",children:[l.jsxs("div",{className:"text-xs text-cc-fg truncate",children:[l.jsx("span",{className:"font-mono-code",children:ke.identifier})," - ",ke.title]}),l.jsx("div",{className:"text-[10px] text-cc-muted truncate",children:[ke.stateName,ke.teamName].filter(Boolean).join(" • ")})]},ke.id))})]}),l.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:l.jsx("svg",{viewBox:"0 0 20 20",fill:"currentColor",className:"w-3.5 h-3.5",children:l.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"})})})]}),q&&l.jsxs("div",{className:"p-3 rounded-[10px] bg-amber-500/10 border border-amber-500/20",children:[l.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 leading-snug",children:"Warning: Linear is not configured. Continue anyway?"}),l.jsx("div",{className:"flex gap-2 mt-2.5",children:l.jsx("button",{type:"button",onClick:()=>{$(!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"})})]}),it&&l.jsx(YR,{defaultProjectId:G==null?void 0:G.projectId,connectionId:p??void 0,onCreated:mn,onClose:()=>ht(!1)})]}):null}function QR({cwd:e,gitRepoInfo:t,selectedBranch:n,isNewBranch:i,useWorktree:a,onBranchChange:o,onWorktreeChange:u,onBranchesLoaded:f}){const[h,p]=S.useState([]),[g,x]=S.useState(!1),[b,y]=S.useState(""),_=S.useRef(null);return S.useEffect(()=>{function j(N){_.current&&!_.current.contains(N.target)&&x(!1)}return document.addEventListener("pointerdown",j),()=>document.removeEventListener("pointerdown",j)},[]),S.useEffect(()=>{t?Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])}):(p([]),f([]))},[t]),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative",ref:_,children:[l.jsxs("button",{"aria-expanded":g,onClick:()=>{!g&&t&&Ne.gitFetch(t.repoRoot).catch(()=>{}).finally(()=>{Ne.listBranches(t.repoRoot).then(j=>{p(j),f(j)}).catch(()=>{p([]),f([])})}),x(!g),y("")},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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-60",children:l.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"})}),l.jsx("span",{className:"max-w-[100px] sm:max-w-[160px] truncate font-mono-code",children:n||t.currentBranch}),l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:l.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&l.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:[l.jsx("div",{className:"px-2 py-2 border-b border-cc-border",children:l.jsx("input",{type:"text",value:b,onChange:j=>y(j.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:j=>{j.key==="Escape"&&x(!1)}})}),l.jsx("div",{className:"max-h-[240px] overflow-y-auto py-1",children:(()=>{const j=b.toLowerCase().trim(),N=h.filter(L=>!L.isRemote&&(!j||L.name.toLowerCase().includes(j))),k=h.filter(L=>L.isRemote&&(!j||L.name.toLowerCase().includes(j))),A=h.some(L=>L.name.toLowerCase()===j),C=N.length>0||k.length>0;return l.jsxs(l.Fragment,{children:[N.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider",children:"Local"}),N.map(L=>l.jsxs("button",{onClick:()=>{o(L.name,!1),x(!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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsxs("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[L.ahead>0&&l.jsxs("span",{className:"text-[9px] text-green-500",children:[L.ahead,"↑"]}),L.behind>0&&l.jsxs("span",{className:"text-[9px] text-amber-500",children:[L.behind,"↓"]}),L.worktreePath&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-blue-500/15 text-blue-600 dark:text-blue-400",children:"wt"}),L.isCurrent&&l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-green-500/15 text-green-600 dark:text-green-400",children:"current"})]})]},L.name))]}),k.length>0&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"px-3 py-1 text-[10px] text-cc-muted uppercase tracking-wider mt-1",children:"Remote"}),k.map(L=>l.jsxs("button",{onClick:()=>{o(L.name,!1),x(!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 ${L.name===n?"text-cc-primary font-medium":"text-cc-fg"}`,children:[l.jsx("span",{className:"truncate font-mono-code",children:L.name}),l.jsx("span",{className:"text-[9px] px-1 py-0.5 rounded bg-cc-hover text-cc-muted ml-auto shrink-0",children:"remote"})]},`remote-${L.name}`))]}),!C&&j&&l.jsx("div",{className:"px-3 py-2 text-xs text-cc-muted text-center",children:"No matching branches"}),j&&!A&&l.jsx("div",{className:"border-t border-cc-border mt-1 pt-1",children:l.jsxs("button",{onClick:()=>{o(b.trim(),!0),x(!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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 shrink-0",children:l.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"})}),l.jsxs("span",{children:["Create ",l.jsx("span",{className:"font-mono-code font-medium",children:b.trim()})]})]})})]})})()})]})]}),l.jsxs("button",{onClick:()=>u(!a),className:`flex items-center gap-1.5 px-2 py-1 text-xs rounded-md transition-colors cursor-pointer ${a?"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:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-70",children:l.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"})}),l.jsx("span",{children:"Worktree"})]})]}):null}const XR=336*60*60*1e3,ca=12,KR=24;function Dg(e){return e.split("/").filter(Boolean).pop()||e}function X_(e){var t,n;return((t=e.name)==null?void 0:t.trim())||((n=e.slug)==null?void 0:n.trim())||Dg(e.cwd)}function ZR(e){return e.length>8?e.slice(0,8):e}function JR(e,t=2){const n=e.split("/").filter(Boolean);return n.length<=t?e:`.../${n.slice(-t).join("/")}`}function eL(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 a=Math.floor(i/24);if(a<14)return`${a}d ago`;const o=Math.floor(a/7);if(o<8)return`${o}w ago`;const u=Math.floor(a/30);return`${Math.max(1,u)}mo ago`}function tL(){var Ji;const[e,t]=S.useState(""),[n]=S.useState(()=>!(localStorage.getItem("cc-user-name")||"").trim()),[i,a]=S.useState(()=>localStorage.getItem("cc-user-name")||""),[o,u]=S.useState(()=>localStorage.getItem("cc-session-prefix")||""),[f,h]=S.useState(""),[p,g]=S.useState(()=>localStorage.getItem("cc-backend")||"claude"),[x,b]=S.useState([]),[y,_]=S.useState(()=>I_(localStorage.getItem("cc-backend")||"claude")),[j,N]=S.useState(()=>q_(localStorage.getItem("cc-backend")||"claude")),[k,A]=S.useState(()=>localStorage.getItem("cc-effort")||""),[C,L]=S.useState(()=>df()[0]||""),[D,z]=S.useState([]),[q,$]=S.useState(null),[G,O]=S.useState(!1),[I,T]=S.useState(""),[ae,J]=S.useState(null),[W,B]=S.useState(!1),[F,Y]=S.useState(null),[xe,R]=S.useState(null),[P,Z]=S.useState(()=>localStorage.getItem("cc-onboarding-dismissed")!=="true"),M=ae||yS(p),de=H_(p),be=cR(p),[je,Re]=S.useState([]),[Le,Be]=S.useState(()=>localStorage.getItem("cc-selected-env")||""),[Je,it]=S.useState(!1),[ht,Xt]=S.useState(!1),pt=FR(),[yt,kt]=S.useState(()=>pt),[ge,Fe]=S.useState([]),[ct,mn]=S.useState(()=>localStorage.getItem("cc-selected-sandbox")||""),[ke,ze]=S.useState(!1),mt=S.useRef(null),[Ee,Br]=S.useState(null),le=S.useRef(null),ye=S.useRef(null),[Q,he]=S.useState(!1),[Me,Qe]=S.useState(!1),[nt,rt]=S.useState(!1),[wt,gn]=S.useState(!1),[et,rr]=S.useState(!1),[En,Xr]=S.useState(""),[Pr,$r]=S.useState(!0),[ne,me]=S.useState([]),[ve,Xe]=S.useState(!1),[Bt,ln]=S.useState(""),[Tn,Pt]=S.useState(!1),[zn,xr]=S.useState(ca),[Sa,Bl]=S.useState(""),[On,Ls]=S.useState(null),[Pl,$l]=S.useState(!1),[vr,Gt]=S.useState(""),[_n,ir]=S.useState(!1),[Fl,yf]=S.useState([]),[Ds,zs]=S.useState(null),[Kr,Gi]=S.useState(!1),[hi,Vn]=S.useState(""),[Os,Zr]=S.useState(0),Kt=S.useRef(null),Gn=S.useRef(null),ka=S.useRef(null),Fr=S.useRef(null),Jr=S.useRef(null),Ul=S.useRef(null),Hl=X(H=>H.currentSessionId),Zt=wS({text:e,caretPos:Os,cwd:C||void 0});S.useEffect(()=>{if(Kt.current===null||!Gn.current)return;const H=Kt.current;Gn.current.setSelectionRange(H,H),Kt.current=null},[e]),S.useEffect(()=>{var fe;window.matchMedia("(min-width: 640px)").matches&&((fe=Gn.current)==null||fe.focus())},[]),S.useEffect(()=>{Ne.getHome().then(({home:H,cwd:fe})=>{C||L(fe||H)}).catch(()=>{}),Ne.listEnvs().then(Re).catch(()=>{}),Ne.listSandboxes().then(Fe).catch(()=>{}),Ne.getBackends().then(b).catch(()=>{}),Ne.getSettings().then(H=>{B(H.linearApiKeyConfigured)}).catch(()=>{})},[]);function _f(H){g(H),localStorage.setItem("cc-backend",H),J(null),_(I_(H)),N(q_(H)),H!=="claude"&&(rr(!1),me([]),ln(""),Xe(!1),Pt(!1),xr(ca),Bl(""))}S.useEffect(()=>{if(p!=="codex"){J(null);return}Ne.getBackendModels(p).then(H=>{if(H.length>0){const fe=lR(H);J(fe),fe.some(Ke=>Ke.value===y)||_(fe[0].value)}}).catch(()=>{})},[p]),S.useEffect(()=>{if(le.current&&(clearInterval(le.current),le.current=null),Br(null),!yt)return;const H="the-companion:latest",fe=()=>{Ne.getImageStatus(H).then(Ke=>{Br(Ke),Ke.status==="idle"&&Ne.pullImage(H).catch(()=>{}),(Ke.status==="ready"||Ke.status==="error")&&le.current&&(clearInterval(le.current),le.current=null)}).catch(()=>{})};return fe(),le.current=setInterval(fe,2e3),()=>{le.current&&(clearInterval(le.current),le.current=null)}},[yt]),S.useEffect(()=>{function H(fe){ka.current&&!ka.current.contains(fe.target)&&he(!1),Fr.current&&!Fr.current.contains(fe.target)&&Qe(!1),Jr.current&&!Jr.current.contains(fe.target)&&rt(!1),Ul.current&&!Ul.current.contains(fe.target)&&it(!1),mt.current&&!mt.current.contains(fe.target)&&ze(!1)}return document.addEventListener("pointerdown",H),()=>document.removeEventListener("pointerdown",H)},[]),S.useEffect(()=>{if(!C){Ls(null);return}Ne.getRepoInfo(C).then(H=>{Ls(H),Gt(H.currentBranch),ir(!1)}).catch(()=>{Ls(null),Gt(""),ir(!1)})},[C]);const Bs=M.find(H=>H.value===y)||M[0],ja=de.find(H=>H.value===j)||de[0],Ur=be.find(H=>H.value===k)||be[0],Yn=p==="codex"?"/logo-codex.svg":"/logo.svg",Oc=C?C.split("/").pop()||C:"Select folder",Il=S.useMemo(()=>En.trim(),[En]),Na=p==="claude"&&et&&Il.length>0,ei=S.useMemo(()=>{const H=Date.now()-XR;return ne.filter(fe=>fe.createdAt>=H)},[ne]),Yi=S.useMemo(()=>Tn?ne:ei.length>0?ei:ne,[Tn,ei,ne]),br=S.useMemo(()=>Sa.trim().toLowerCase(),[Sa]),nn=S.useMemo(()=>br?Yi.filter(H=>{const fe=X_(H).toLowerCase(),Ke=Dg(H.cwd).toLowerCase(),gt=(H.gitBranch||"").toLowerCase(),st=H.cwd.toLowerCase(),Ie=H.resumeSessionId.toLowerCase();return fe.includes(br)||Ke.includes(br)||gt.includes(br)||st.includes(br)||Ie.includes(br)}):Yi,[Yi,br]),Ps=S.useMemo(()=>nn.slice(0,zn),[nn,zn]),Bc=zn<nn.length,Ca=Math.max(0,ne.length-ei.length),Wi=!Tn&&ei.length>0,Ea=S.useCallback(async()=>{if(p==="claude"){Xe(!0),ln("");try{const[H,fe]=await Promise.all([Ne.listSessions(),Ne.discoverClaudeSessions(400).then(Ie=>Ie.sessions)]),Ke=new Map,gt=Ie=>{const Bn=Ke.get(Ie.resumeSessionId);(!Bn||Ie.createdAt>Bn.createdAt)&&Ke.set(Ie.resumeSessionId,Ie)};for(const Ie of H)Ie.backendType!=="codex"&&Ie.cliSessionId&>({resumeSessionId:Ie.cliSessionId,sessionId:Ie.sessionId,name:Ie.name,model:Ie.model,createdAt:Ie.createdAt,cwd:Ie.cwd,gitBranch:Ie.gitBranch,source:"companion"});for(const Ie of fe)gt({resumeSessionId:Ie.sessionId,sessionId:Ie.sessionId,slug:Ie.slug,createdAt:Ie.lastActivityAt,cwd:Ie.cwd,gitBranch:Ie.gitBranch,source:"claude_disk"});const st=Array.from(Ke.values()).sort((Ie,Bn)=>{const xn=C&&Ie.cwd===C?0:1,wr=C&&Bn.cwd===C?0:1;return xn!==wr?xn-wr:Bn.createdAt-Ie.createdAt});me(st),Pt(!1),xr(ca)}catch(H){const fe=H instanceof Error?H.message:String(H);ln(fe||"Failed to load existing sessions"),me([]),xr(ca)}finally{Xe(!1)}}},[p,C]);S.useEffect(()=>{p==="claude"&&et&&Ea()},[p,et,Ea]),S.useEffect(()=>{xr(ca)},[br,Tn]);async function ql(H){if(H.length===0)return;const fe=[],Ke=[];let gt=D.reduce((st,Ie)=>st+Ie.size,0);for(const st of H){if(st.size>cf){Ke.push(`${st.name} is too large (${Ns(st.size)}, max ${Ns(cf)})`);continue}if(gt+st.size>uf){Ke.push(`${st.name} would exceed the per-message limit (${Ns(uf)})`);continue}const{base64:Ie,mediaType:Bn}=await oS(st);fe.push({name:st.name,base64:Ie,mediaType:Bn,size:st.size}),gt+=st.size}fe.length>0&&z(st=>[...st,...fe]),$(Ke.length>0?Ke.join("; "):null)}async function Qi(H){const fe=H.target.files;fe&&(await ql(Array.from(fe)),H.target.value="")}function wf(H){z(fe=>fe.filter((Ke,gt)=>gt!==H))}async function Pc(H){var gt;const fe=(gt=H.clipboardData)==null?void 0:gt.items;if(!fe)return;const Ke=[];for(const st of Array.from(fe)){if(st.kind!=="file")continue;const Ie=st.getAsFile();if(!Ie)continue;const Bn=Ie.name&&Ie.name.length>0?Ie.name:`pasted-${Date.now()}.${(Ie.type.split("/")[1]||"bin").replace(/[^a-zA-Z0-9]/g,"")}`;Ke.push(new File([Ie],Bn,{type:Ie.type,lastModified:Ie.lastModified}))}Ke.length>0&&(H.preventDefault(),await ql(Ke))}function $c(H){t(H.target.value),Zr(H.target.selectionStart??H.target.value.length);const fe=H.target;fe.style.height="auto",fe.style.height=Math.min(fe.scrollHeight,200)+"px"}function Ta(){Gn.current&&Zr(Gn.current.selectionStart??0)}function Fc(H){var Ke;const fe=Zt.selectPrompt(H);Kt.current=fe.nextCursor,t(fe.nextText),Zt.setMentionMenuOpen(!1),Zr(fe.nextCursor),(Ke=Gn.current)==null||Ke.focus(),Gn.current&&(Gn.current.style.height="auto",Gn.current.style.height=Math.min(Gn.current.scrollHeight,200)+"px")}function Sf(H){if(Zt.mentionMenuOpen&&H.key==="Escape"){H.preventDefault(),Zt.setMentionMenuOpen(!1);return}if(Zt.mentionMenuOpen&&Zt.filteredPrompts.length>0){if(H.key==="ArrowDown"){H.preventDefault(),Zt.setMentionMenuIndex(fe=>(fe+1)%Zt.filteredPrompts.length);return}if(H.key==="ArrowUp"){H.preventDefault(),Zt.setMentionMenuIndex(fe=>(fe-1+Zt.filteredPrompts.length)%Zt.filteredPrompts.length);return}if(H.key==="Tab"&&!H.shiftKey||H.key==="Enter"&&!H.shiftKey){H.preventDefault(),Fc(Zt.filteredPrompts[Zt.mentionMenuIndex]);return}}if(Zt.mentionMenuOpen&&Zt.filteredPrompts.length===0&&(H.key==="Enter"&&!H.shiftKey||H.key==="Tab"&&!H.shiftKey)){H.preventDefault();return}if(H.key==="Tab"&&H.shiftKey){H.preventDefault();const fe=H_(p),gt=(fe.findIndex(st=>st.value===j)+1)%fe.length;N(fe[gt].value);return}H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),yr())}function Aa(H){const fe=i.trim(),Ke=fe?`[${fe}]: ${H}`:H;if(!F)return Ke;const gt=(F.description??"").trim();return`${["Linear issue context:",`- Identifier: ${F.identifier}`,`- Title: ${F.title}`,F.stateName?`- State: ${F.stateName}`:"",F.priorityLabel?`- Priority: ${F.priorityLabel}`:"",F.teamName?`- Team: ${F.teamName}`:"",`- URL: ${F.url}`,gt?`- Description:
|
|
108
108
|
${gt}`:""].filter(Boolean).join(`
|
|
109
109
|
`)}
|
|
110
110
|
|
|
@@ -123,7 +123,7 @@ ${H.resumeSessionId}`,children:"Continue"})]})]},`${H.resumeSessionId}-row-${H.s
|
|
|
123
123
|
`)})]}),n==="done"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-success",children:l.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"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-sm text-cc-muted mb-5",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("button",{type:"button",onClick:b,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"&&l.jsxs("div",{className:"p-6",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-4 h-4 text-cc-error",children:l.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"})}),l.jsx("h2",{className:"text-base font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsxs("p",{className:"text-sm text-cc-muted mb-2",children:["Failed to update the Docker image.",(u==null?void 0:u.error)&&l.jsx("span",{className:"block mt-1 text-xs text-cc-error",children:u.error})]}),(u==null?void 0:u.progress)&&u.progress.length>0&&l.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(`
|
|
124
124
|
`)}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("button",{type:"button",onClick:y,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"}),l.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 yD({phase:e}){return l.jsx("div",{className:"relative bg-black/50 rounded-lg overflow-hidden h-[300px] flex items-center justify-center",children:l.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"&&l.jsxs("div",{className:"p-5",children:[l.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-1.5",children:"Update Sandbox Image?"}),l.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?"}),l.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:[l.jsx("span",{children:"Always update automatically"}),l.jsx("span",{className:"relative inline-flex h-4 w-7 rounded-full bg-cc-border",children:l.jsx("span",{className:"inline-block h-3 w-3 rounded-full bg-white shadow translate-x-0 mt-0.5 ml-0.5"})})]}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Skip"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Update"})]})]}),e==="pulling"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[l.jsx("svg",{className:"w-3.5 h-3.5 animate-spin text-cc-primary",viewBox:"0 0 24 24",fill:"none",children:l.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"2.5",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Updating Sandbox Image..."})]}),l.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...
|
|
125
125
|
Layer 1/5: abc123 downloading
|
|
126
|
-
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const Nm=["welcome","claude","codex","done"],n5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function zg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function WL({onComplete:e}){const[t,n]=S.useState("welcome"),[i,a]=S.useState(""),[o,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,N]=S.useState(zg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function T(J){if(J.key==="Escape"){J.preventDefault();return}if(J.key!=="Tab")return;const W=I.querySelectorAll(n5);if(W.length===0)return;const B=W[0],F=W[W.length-1];J.shiftKey?document.activeElement===B&&(J.preventDefault(),F.focus()):document.activeElement===F&&(J.preventDefault(),B.focus())}document.addEventListener("keydown",T);const ae=I.querySelector(n5);return ae==null||ae.focus(),()=>document.removeEventListener("keydown",T)},[t]);const A=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await Ne.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[i]),C=S.useCallback(async()=>{h(!0),g("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await D()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),L=S.useCallback(async()=>{h(!0),g("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await D()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[o]),D=S.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),z=S.useCallback(()=>{e()},[e]),q=S.useCallback(async()=>{await D(),e()},[D,e]),$=S.useCallback(I=>{g(""),n(I)},[]),G=Nm.indexOf(t),O=zg();return Dl.createPortal(l.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:j?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?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"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${G+1} of ${Nm.length-1}`,children:Nm.slice(0,3).map((I,T)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===G?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=G?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=G?1:.5}},I))}),l.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"&&l.jsx(QL,{onSetupClaude:()=>$("claude"),onSetupCodex:()=>$("codex")}),t==="claude"&&l.jsx(XL,{token:i,onTokenChange:a,onSave:A,onSkip:()=>$("codex"),saving:f,error:p}),t==="codex"&&l.jsx(KL,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:L,onSkip:()=>D(),onBack:()=>$("claude"),saving:f,error:p}),t==="done"&&l.jsx(ZL,{claudeConfigured:x,codexConfigured:y,onDone:z})]}),t==="welcome"&&l.jsx("button",{onClick:q,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 QL({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.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."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function XL({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(LS,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.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":o?f:void 0,"aria-invalid":o?!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"})]}),o&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.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"}),l.jsx("button",{onClick:n,disabled:a,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:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function KL({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.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:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(LS,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.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"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,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:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,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"}),l.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 ZL({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=zg(),[o,u]=S.useState(a);return S.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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?l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.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 LS({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 l.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?l.jsxs(l.Fragment,{children:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const JL=S.lazy(()=>qn(()=>import("./Playground-Z8gfp_Pg.js"),[]).then(e=>({default:e.Playground}))),eD=S.lazy(()=>qn(()=>import("./SettingsPage-CFe6_dW9.js"),[]).then(e=>({default:e.SettingsPage}))),tD=S.lazy(()=>qn(()=>import("./IntegrationsPage-ClHcXTNR.js"),[]).then(e=>({default:e.IntegrationsPage}))),nD=S.lazy(()=>qn(()=>import("./LinearSettingsPage-DZbV5ES0.js"),[]).then(e=>({default:e.LinearSettingsPage}))),rD=S.lazy(()=>qn(()=>import("./LinearOAuthSettingsPage-aKHb8Kgv.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),iD=S.lazy(()=>qn(()=>import("./TailscalePage-DPJGhCUO.js"),[]).then(e=>({default:e.TailscalePage}))),sD=S.lazy(()=>qn(()=>import("./PromptsPage-BF5QRCM7.js"),[]).then(e=>({default:e.PromptsPage}))),aD=S.lazy(()=>qn(()=>Promise.resolve().then(()=>HR),void 0).then(e=>({default:e.EnvManager}))),lD=S.lazy(()=>qn(()=>import("./SandboxManager-BNIPWLHz.js"),[]).then(e=>({default:e.SandboxManager}))),oD=S.lazy(()=>qn(()=>import("./CronManager-B1s3pGHK.js"),[]).then(e=>({default:e.CronManager}))),cD=S.lazy(()=>qn(()=>import("./AgentsPage-BBi5x0sS.js"),[]).then(e=>({default:e.AgentsPage}))),uD=S.lazy(()=>qn(()=>import("./RunsPage-Bn7SIAEx.js"),[]).then(e=>({default:e.RunsPage}))),dD=S.lazy(()=>qn(()=>import("./DashboardPage-DFgvPALP.js"),[]).then(e=>({default:e.DashboardPage})));function fr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function fD(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function hD(){const e=X(Y=>Y.isAuthenticated),t=X(Y=>Y.darkMode),n=X(Y=>Y.currentSessionId),i=X(Y=>Y.sidebarOpen),a=X(Y=>Y.taskPanelOpen),o=X(Y=>Y.homeResetKey),u=X(Y=>Y.activeTab),f=X(Y=>Y.sessionCreating),h=X(Y=>Y.sessionCreatingBackend),p=X(Y=>Y.creationProgress),g=X(Y=>Y.creationError),x=X(Y=>Y.updateOverlayActive),b=fD(),y=S.useMemo(()=>ix(b),[b]),_=y.page==="settings",j=y.page==="prompts",N=y.page==="integrations",k=y.page==="integration-linear",A=y.page==="integration-linear-oauth",C=y.page==="integration-tailscale",L=y.page==="environments",D=y.page==="sandboxes",z=y.page==="scheduled",q=y.page==="agents"||y.page==="agent-detail",$=y.page==="runs",G=y.page==="dashboard",O=y.page==="session"||y.page==="home";S.useEffect(()=>{I4(b||"#/")},[b]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const I=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(I.current!==null&&y.page==="home"){sx(I.current,!0),I.current=null;return}if(I.current=null,y.page==="session"){const Y=X.getState();Y.currentSessionId!==y.sessionId&&Y.setCurrentSession(y.sessionId),Ac(y.sessionId)}else if(y.page==="home"){const Y=X.getState();Y.currentSessionId!==null&&Y.setCurrentSession(null)}},[y]);const T=X(Y=>n?Y.changedFilesTick.get(n)??0:0),ae=X(Y=>Y.diffBase),J=X(Y=>Y.setGitChangedFilesCount),W=X(Y=>{var xe,R;return n&&(((xe=Y.sessions.get(n))==null?void 0:xe.cwd)||((R=Y.sdkSessions.find(P=>P.sessionId===n))==null?void 0:R.cwd))||null});S.useEffect(()=>{if(!n||!W)return;let Y=!1;return Ne.getChangedFiles(W,ae).then(({files:xe})=>{if(Y)return;const R=`${W}/`,P=xe.filter(Z=>Z.path===W||Z.path.startsWith(R)).length;J(n,P)}).catch(()=>{}),()=>{Y=!0}},[n,W,ae,T,J]),S.useEffect(()=>{const Y=()=>{Ne.checkForUpdate().then(R=>{X.getState().setUpdateInfo(R)}).catch(()=>{})};Y();const xe=setInterval(Y,300*1e3);return()=>clearInterval(xe)},[]),S.useEffect(()=>{const Y=()=>{Ne.getClaudeCompat().then(R=>{X.getState().setClaudeCompatInfo(R)}).catch(()=>{})};Y();const xe=setInterval(Y,300*1e3);return()=>clearInterval(xe)},[]);const[B,F]=S.useState(!1);return S.useEffect(()=>{e&&Ne.getSettings().then(Y=>{Y.publicUrl&&X.getState().setPublicUrl(Y.publicUrl),Y.onboardingCompleted||F(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?y.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(JL,{})}):l.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&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
126
|
+
Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-success",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-success",children:"Sandbox Image Updated"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"The Docker image has been updated successfully."}),l.jsx("div",{className:"flex justify-end",children:l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Done"})})]}),e==="error"&&l.jsxs("div",{className:"p-5",children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1.5",children:[l.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 text-cc-error",children:l.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"})}),l.jsx("h2",{className:"text-sm font-semibold text-cc-error",children:"Image Update Failed"})]}),l.jsx("p",{className:"text-xs text-cc-muted mb-4",children:"Failed to update the Docker image."}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-hover text-cc-fg",children:"Close"}),l.jsx("span",{className:"px-3 py-1.5 rounded-lg text-xs bg-cc-primary text-white",children:"Retry"})]})]})]})})}const Nm=["welcome","claude","codex","done"],n5='button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])';function zg(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function WL({onComplete:e}){const[t,n]=S.useState("welcome"),[i,a]=S.useState(""),[o,u]=S.useState(""),[f,h]=S.useState(!1),[p,g]=S.useState(""),[x,b]=S.useState(!1),[y,_]=S.useState(!1),[j,N]=S.useState(zg),k=S.useRef(null);S.useEffect(()=>{j||requestAnimationFrame(()=>N(!0))},[j]),S.useEffect(()=>{const I=k.current;if(!I)return;function T(J){if(J.key==="Escape"){J.preventDefault();return}if(J.key!=="Tab")return;const W=I.querySelectorAll(n5);if(W.length===0)return;const B=W[0],F=W[W.length-1];J.shiftKey?document.activeElement===B&&(J.preventDefault(),F.focus()):document.activeElement===F&&(J.preventDefault(),B.focus())}document.addEventListener("keydown",T);const ae=I.querySelector(n5);return ae==null||ae.focus(),()=>document.removeEventListener("keydown",T)},[t]);const A=S.useCallback(async()=>{if(!i.trim()){n("codex");return}h(!0),g("");try{await Ne.updateSettings({claudeCodeOAuthToken:i.trim()}),b(!0),n("codex")}catch(I){g(I instanceof Error?I.message:"Failed to save token")}finally{h(!1)}},[i]),C=S.useCallback(async()=>{h(!0),g("");try{(await Ne.getSettings()).codexDeviceAuthConfigured?(_(!0),await D()):g("No Codex auth found. Run codex --login in your terminal first.")}catch(I){g(I instanceof Error?I.message:"Failed to check auth status")}finally{h(!1)}},[]),L=S.useCallback(async()=>{h(!0),g("");try{await Ne.updateSettings({openaiApiKey:o.trim()}),_(!0),await D()}catch(I){g(I instanceof Error?I.message:"Failed to save API key")}finally{h(!1)}},[o]),D=S.useCallback(async()=>{try{await Ne.updateSettings({onboardingCompleted:!0})}catch{}n("done")},[]),z=S.useCallback(()=>{e()},[e]),q=S.useCallback(async()=>{await D(),e()},[D,e]),$=S.useCallback(I=>{g(""),n(I)},[]),G=Nm.indexOf(t),O=zg();return Dl.createPortal(l.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:j?1:0,transition:O?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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}}),l.jsxs("div",{ref:k,role:"dialog","aria-modal":"true","aria-label":"Provider setup",className:"w-full max-w-[520px] mx-6",style:{transform:j?"translateY(0)":"translateY(12px)",opacity:j?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"&&l.jsx("div",{className:"flex items-center gap-1.5 mb-6 justify-center",role:"status","aria-label":`Step ${G+1} of ${Nm.length-1}`,children:Nm.slice(0,3).map((I,T)=>l.jsx("div",{className:"h-[3px] rounded-full transition-[transform,background,opacity] duration-300",style:{width:32,transform:T===G?"scaleX(1)":"scaleX(0.375)",transformOrigin:"center",background:T<=G?"var(--color-cc-primary)":"var(--color-cc-border)",opacity:T<=G?1:.5}},I))}),l.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"&&l.jsx(QL,{onSetupClaude:()=>$("claude"),onSetupCodex:()=>$("codex")}),t==="claude"&&l.jsx(XL,{token:i,onTokenChange:a,onSave:A,onSkip:()=>$("codex"),saving:f,error:p}),t==="codex"&&l.jsx(KL,{apiKey:o,onApiKeyChange:u,onCheckAuth:C,onSaveApiKey:L,onSkip:()=>D(),onBack:()=>$("claude"),saving:f,error:p}),t==="done"&&l.jsx(ZL,{claudeConfigured:x,codexConfigured:y,onDone:z})]}),t==="welcome"&&l.jsx("button",{onClick:q,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 QL({onSetupClaude:e,onSetupCodex:t}){return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-6",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"First time setup"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Welcome to The Companion"}),l.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."})]}),l.jsxs("div",{className:"space-y-2.5",children:[l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Claude Code"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"Anthropic's coding agent — requires an OAuth token"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]}),l.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:[l.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"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-[13px] font-medium text-cc-fg",children:"Codex"}),l.jsx("div",{className:"text-[11px] text-cc-muted leading-snug mt-0.5",children:"OpenAI's coding agent — log in via ChatGPT"})]}),l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})]})]})]})}function XL({token:e,onTokenChange:t,onSave:n,onSkip:i,saving:a,error:o}){const u=S.useRef(null);S.useEffect(()=>{var h;(h=u.current)==null||h.focus()},[]);const f="claude-token-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 1 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Claude Code"}),l.jsx("p",{className:"text-sm text-cc-muted mt-1.5 leading-relaxed",children:"Generate an OAuth token by running this in your terminal:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(LS,{text:"claude setup-token"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"claude setup-token"})]})})]}),l.jsxs("div",{className:"mb-4",children:[l.jsx("label",{htmlFor:"claude-token",className:"text-xs text-cc-muted block mb-1.5",children:"OAuth Token"}),l.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":o?f:void 0,"aria-invalid":o?!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"})]}),o&&l.jsxs("div",{id:f,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:o})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.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"}),l.jsx("button",{onClick:n,disabled:a,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:a?"none":"0 1px 3px var(--color-cc-primary-btn)"},children:a?"Saving...":e.trim()?"Save & Continue":"Continue"})]})]})}function KL({apiKey:e,onApiKeyChange:t,onCheckAuth:n,onSaveApiKey:i,onSkip:a,onBack:o,saving:u,error:f}){const[h,p]=S.useState(!1),g="codex-auth-error";return l.jsxs("div",{className:"p-7 pb-6",children:[l.jsxs("div",{className:"mb-5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-[0.12em] text-cc-muted font-medium mb-2",children:"Step 2 of 2"}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg leading-tight",children:"Set up Codex"}),l.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:"})]}),l.jsxs("div",{className:"rounded-lg overflow-hidden mb-4 border border-cc-border",style:{background:"var(--color-cc-code-bg)"},children:[l.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-cc-border",children:[l.jsxs("div",{className:"flex items-center gap-1.5","aria-hidden":"true",children:[l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-error opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-warning opacity-60"}),l.jsx("div",{className:"w-[7px] h-[7px] rounded-full bg-cc-success opacity-60"})]}),l.jsx(LS,{text:"codex --login"})]}),l.jsx("div",{className:"px-3.5 py-3",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-cc-muted text-xs font-mono-code select-none","aria-hidden":"true",children:"$"}),l.jsx("code",{className:"text-[13px] font-mono-code text-cc-fg select-all",children:"codex --login"})]})})]}),f&&l.jsxs("div",{id:g,role:"alert",className:"flex items-start gap-2 mb-4 text-xs text-cc-error",children:[l.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:[l.jsx("circle",{cx:"12",cy:"12",r:"10"}),l.jsx("path",{d:"M12 8v4m0 4h.01"})]}),l.jsx("span",{children:f})]}),l.jsxs("div",{className:"mb-4",children:[l.jsxs("button",{onClick:()=>p(!h),className:"text-xs text-cc-muted hover:text-cc-fg transition-colors flex items-center gap-1",children:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}),"Or use an API key instead"]}),l.jsx("div",{className:"accordion-panel","data-open":h?"true":"false",children:l.jsx("div",{className:"accordion-inner",children:l.jsxs("div",{className:"mt-3",children:[l.jsx("label",{htmlFor:"openai-key",className:"text-xs text-cc-muted block mb-1.5",children:"OpenAI API Key"}),l.jsx("input",{id:"openai-key",type:"password",value:e,onChange:x=>t(x.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"})]})})})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[l.jsxs("button",{onClick:o,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:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})}),"Back"]}),l.jsx("div",{className:"flex-1"}),l.jsx("button",{onClick:a,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"}),l.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 ZL({claudeConfigured:e,codexConfigured:t,onDone:n}){const i=!e&&!t,a=zg(),[o,u]=S.useState(a);return S.useEffect(()=>{o||requestAnimationFrame(()=>u(!0))},[o]),l.jsxs("div",{className:"p-7 pb-6 text-center",style:{opacity:o?1:0,transform:o?"translateY(0)":"translateY(8px)",transition:a?"none":"opacity 400ms cubic-bezier(0.16, 1, 0.3, 1), transform 400ms cubic-bezier(0.16, 1, 0.3, 1)"},children:[l.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?l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})}):l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),l.jsx("h2",{className:"text-xl font-semibold text-cc-fg mb-2",children:i?"Setup Skipped":"You're all set!"}),l.jsx("div",{className:"text-sm text-cc-muted leading-relaxed mb-6",children:i?"You can configure providers anytime in Settings.":l.jsxs(l.Fragment,{children:[e&&l.jsx("span",{className:"block",children:"Claude Code is ready."}),t&&l.jsx("span",{className:"block",children:"Codex is ready."}),l.jsx("span",{className:"block mt-1 text-xs",children:"You can update these anytime in Settings."})]})}),l.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 LS({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 l.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?l.jsxs(l.Fragment,{children:[l.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:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),"Copied!"]}):l.jsxs(l.Fragment,{children:[l.jsxs("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",strokeWidth:1.5,viewBox:"0 0 24 24","aria-hidden":"true",children:[l.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),l.jsx("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),"Copy"]})})}const JL=S.lazy(()=>qn(()=>import("./Playground-By14cDox.js"),[]).then(e=>({default:e.Playground}))),eD=S.lazy(()=>qn(()=>import("./SettingsPage-B6pfdIlj.js"),[]).then(e=>({default:e.SettingsPage}))),tD=S.lazy(()=>qn(()=>import("./IntegrationsPage-D4FtQBUj.js"),[]).then(e=>({default:e.IntegrationsPage}))),nD=S.lazy(()=>qn(()=>import("./LinearSettingsPage-g23UlNTx.js"),[]).then(e=>({default:e.LinearSettingsPage}))),rD=S.lazy(()=>qn(()=>import("./LinearOAuthSettingsPage-BSfT0Ulr.js"),[]).then(e=>({default:e.LinearOAuthSettingsPage}))),iD=S.lazy(()=>qn(()=>import("./TailscalePage-B6WlB5tj.js"),[]).then(e=>({default:e.TailscalePage}))),sD=S.lazy(()=>qn(()=>import("./PromptsPage-9YIF_Pkw.js"),[]).then(e=>({default:e.PromptsPage}))),aD=S.lazy(()=>qn(()=>Promise.resolve().then(()=>HR),void 0).then(e=>({default:e.EnvManager}))),lD=S.lazy(()=>qn(()=>import("./SandboxManager-CoHOUMFN.js"),[]).then(e=>({default:e.SandboxManager}))),oD=S.lazy(()=>qn(()=>import("./CronManager-DA1peJy7.js"),[]).then(e=>({default:e.CronManager}))),cD=S.lazy(()=>qn(()=>import("./AgentsPage-DoMIvK5c.js"),[]).then(e=>({default:e.AgentsPage}))),uD=S.lazy(()=>qn(()=>import("./RunsPage-CeuQAzD-.js"),[]).then(e=>({default:e.RunsPage}))),dD=S.lazy(()=>qn(()=>import("./DashboardPage-C4B7XxBJ.js"),[]).then(e=>({default:e.DashboardPage})));function fr(){return l.jsx("div",{className:"flex items-center justify-center h-full",children:l.jsx("div",{className:"text-sm text-cc-muted",children:"Loading..."})})}function fD(){return S.useSyncExternalStore(e=>(window.addEventListener("hashchange",e),()=>window.removeEventListener("hashchange",e)),()=>window.location.hash)}function hD(){const e=X(Y=>Y.isAuthenticated),t=X(Y=>Y.darkMode),n=X(Y=>Y.currentSessionId),i=X(Y=>Y.sidebarOpen),a=X(Y=>Y.taskPanelOpen),o=X(Y=>Y.homeResetKey),u=X(Y=>Y.activeTab),f=X(Y=>Y.sessionCreating),h=X(Y=>Y.sessionCreatingBackend),p=X(Y=>Y.creationProgress),g=X(Y=>Y.creationError),x=X(Y=>Y.updateOverlayActive),b=fD(),y=S.useMemo(()=>ix(b),[b]),_=y.page==="settings",j=y.page==="prompts",N=y.page==="integrations",k=y.page==="integration-linear",A=y.page==="integration-linear-oauth",C=y.page==="integration-tailscale",L=y.page==="environments",D=y.page==="sandboxes",z=y.page==="scheduled",q=y.page==="agents"||y.page==="agent-detail",$=y.page==="runs",G=y.page==="dashboard",O=y.page==="session"||y.page==="home";S.useEffect(()=>{I4(b||"#/")},[b]),S.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]);const I=S.useRef(X.getState().currentSessionId);S.useEffect(()=>{if(I.current!==null&&y.page==="home"){sx(I.current,!0),I.current=null;return}if(I.current=null,y.page==="session"){const Y=X.getState();Y.currentSessionId!==y.sessionId&&Y.setCurrentSession(y.sessionId),Ac(y.sessionId)}else if(y.page==="home"){const Y=X.getState();Y.currentSessionId!==null&&Y.setCurrentSession(null)}},[y]);const T=X(Y=>n?Y.changedFilesTick.get(n)??0:0),ae=X(Y=>Y.diffBase),J=X(Y=>Y.setGitChangedFilesCount),W=X(Y=>{var xe,R;return n&&(((xe=Y.sessions.get(n))==null?void 0:xe.cwd)||((R=Y.sdkSessions.find(P=>P.sessionId===n))==null?void 0:R.cwd))||null});S.useEffect(()=>{if(!n||!W)return;let Y=!1;return Ne.getChangedFiles(W,ae).then(({files:xe})=>{if(Y)return;const R=`${W}/`,P=xe.filter(Z=>Z.path===W||Z.path.startsWith(R)).length;J(n,P)}).catch(()=>{}),()=>{Y=!0}},[n,W,ae,T,J]),S.useEffect(()=>{const Y=()=>{Ne.checkForUpdate().then(R=>{X.getState().setUpdateInfo(R)}).catch(()=>{})};Y();const xe=setInterval(Y,300*1e3);return()=>clearInterval(xe)},[]),S.useEffect(()=>{const Y=()=>{Ne.getClaudeCompat().then(R=>{X.getState().setClaudeCompatInfo(R)}).catch(()=>{})};Y();const xe=setInterval(Y,300*1e3);return()=>clearInterval(xe)},[]);const[B,F]=S.useState(!1);return S.useEffect(()=>{e&&Ne.getSettings().then(Y=>{Y.publicUrl&&X.getState().setPublicUrl(Y.publicUrl),Y.onboardingCompleted||F(!0)}).catch(()=>{})},[e]),S.useEffect(()=>{localStorage.getItem("companion_docker_prompt_pending")==="1"&&localStorage.removeItem("companion_docker_prompt_pending")},[]),e?y.page==="playground"?l.jsx(S.Suspense,{fallback:l.jsx(fr,{}),children:l.jsx(JL,{})}):l.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&&l.jsx("div",{className:"fixed inset-0 bg-black/30 z-30 md:hidden",onClick:()=>X.getState().setSidebarOpen(!1)}),l.jsx("div",{className:`
|
|
127
127
|
fixed inset-y-0 left-0 md:relative md:inset-auto z-40 md:z-auto
|
|
128
128
|
h-full shrink-0 transition-all duration-200 pt-safe md:pt-0
|
|
129
129
|
${i?"w-full md:w-[260px] translate-x-0":"w-0 -translate-x-full md:w-0 md:-translate-x-full"}
|
|
@@ -133,4 +133,4 @@ Layer 2/5: def456 complete`})]}),e==="done"&&l.jsxs("div",{className:"p-5",child
|
|
|
133
133
|
h-full shrink-0 transition-all duration-200 pt-safe lg:pt-0
|
|
134
134
|
${a?"w-full lg:w-[320px] translate-x-0":"w-0 translate-x-full lg:w-0 lg:translate-x-full"}
|
|
135
135
|
overflow-hidden
|
|
136
|
-
`,children:l.jsx(BL,{sessionId:n})})]}),l.jsx(GL,{active:x}),l.jsx(YL,{}),B&&l.jsx(WL,{onComplete:()=>F(!1)})]}):l.jsx(Q4,{})}class pD extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){As(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.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}}H4();Uj.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(pD,{children:l.jsx(hD,{})})}));qn(()=>import("./sw-register-
|
|
136
|
+
`,children:l.jsx(BL,{sessionId:n})})]}),l.jsx(GL,{active:x}),l.jsx(YL,{}),B&&l.jsx(WL,{onComplete:()=>F(!1)})]}):l.jsx(Q4,{})}class pD extends S.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){As(t,{source:"react_error_boundary",componentStack:n.componentStack})}render(){return this.state.hasError?l.jsx("div",{className:"h-[100dvh] flex items-center justify-center bg-cc-bg text-cc-fg px-4",children:l.jsxs("div",{className:"max-w-md w-full rounded-xl border border-cc-border bg-cc-card p-5 shadow-sm",children:[l.jsx("h1",{className:"text-base font-semibold",children:"A runtime error occurred"}),l.jsx("p",{className:"text-sm text-cc-muted mt-2",children:"Reload the page to recover. The error has been reported."}),l.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}}H4();Uj.createRoot(document.getElementById("root")).render(l.jsx(S.StrictMode,{children:l.jsx(pD,{children:l.jsx(hD,{})})}));qn(()=>import("./sw-register-E2OIBgNb.js"),[]).catch(()=>{});export{jR as A,yS as B,zR as C,Ll as D,lR as E,qR as F,jL as G,vD as H,xD as I,mc as L,D7 as M,hR as P,HL as S,d5 as T,UL as U,qn as _,Ne as a,am as b,bD as c,yD as d,nE as e,H7 as f,U4 as g,I7 as h,FR as i,l as j,OR as k,wL as l,SL as m,sx as n,Cs as o,jl as p,gc as q,S as r,gD as s,pL as t,X as u,cL as v,Td as w,Tc as x,Dl as y,I_ as z};
|