@ainyc/canonry 1.31.0 → 1.33.0
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/assets/assets/{index-r6biprHB.css → index-B5Cg2H9M.css} +1 -1
- package/assets/assets/index-BiIPqZJb.js +246 -0
- package/assets/index.html +2 -2
- package/dist/{chunk-YW4IZ34Z.js → chunk-WRNSBFNQ.js} +217 -49
- package/dist/cli.js +221 -114
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/assets/assets/index-DmFB_uXa.js +0 -246
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
function ik(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(a,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function mS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rh={exports:{}},qo={};var Zv;function ak(){if(Zv)return qo;Zv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:c}}return qo.Fragment=t,qo.jsx=n,qo.jsxs=n,qo}var Vv;function rk(){return Vv||(Vv=1,Rh.exports=ak()),Rh.exports}var r=rk(),Ah={exports:{}},Ae={};var Qv;function ok(){if(Qv)return Ae;Qv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),x=Symbol.iterator;function b(T){return T===null||typeof T!="object"?null:(T=x&&T[x]||T["@@iterator"],typeof T=="function"?T:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(T,L,J){this.props=T,this.context=L,this.refs=C,this.updater=J||N}k.prototype.isReactComponent={},k.prototype.setState=function(T,L){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,L,"setState")},k.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function A(){}A.prototype=k.prototype;function R(T,L,J){this.props=T,this.context=L,this.refs=C,this.updater=J||N}var z=R.prototype=new A;z.constructor=R,S(z,k.prototype),z.isPureReactComponent=!0;var $=Array.isArray;function P(){}var E={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function H(T,L,J){var X=J.ref;return{$$typeof:e,type:T,key:L,ref:X!==void 0?X:null,props:J}}function ee(T,L){return H(T.type,L,T.props)}function V(T){return typeof T=="object"&&T!==null&&T.$$typeof===e}function se(T){var L={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(J){return L[J]})}var ue=/\/+/g;function _e(T,L){return typeof T=="object"&&T!==null&&T.key!=null?se(""+T.key):L.toString(36)}function xe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(P,P):(T.status="pending",T.then(function(L){T.status==="pending"&&(T.status="fulfilled",T.value=L)},function(L){T.status==="pending"&&(T.status="rejected",T.reason=L)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function K(T,L,J,X,Y){var he=typeof T;(he==="undefined"||he==="boolean")&&(T=null);var ge=!1;if(T===null)ge=!0;else switch(he){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(T.$$typeof){case e:case t:ge=!0;break;case v:return ge=T._init,K(ge(T._payload),L,J,X,Y)}}if(ge)return Y=Y(T),ge=X===""?"."+_e(T,0):X,$(Y)?(J="",ge!=null&&(J=ge.replace(ue,"$&/")+"/"),K(Y,L,J,"",function(Ie){return Ie})):Y!=null&&(V(Y)&&(Y=ee(Y,J+(Y.key==null||T&&T.key===Y.key?"":(""+Y.key).replace(ue,"$&/")+"/")+ge)),L.push(Y)),1;ge=0;var we=X===""?".":X+":";if($(T))for(var me=0;me<T.length;me++)X=T[me],he=we+_e(X,me),ge+=K(X,L,J,he,Y);else if(me=b(T),typeof me=="function")for(T=me.call(T),me=0;!(X=T.next()).done;)X=X.value,he=we+_e(X,me++),ge+=K(X,L,J,he,Y);else if(he==="object"){if(typeof T.then=="function")return K(xe(T),L,J,X,Y);throw L=String(T),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.")}return ge}function ae(T,L,J){if(T==null)return T;var X=[],Y=0;return K(T,X,"","",function(he){return L.call(J,he,Y++)}),X}function pe(T){if(T._status===-1){var L=T._result;L=L(),L.then(function(J){(T._status===0||T._status===-1)&&(T._status=1,T._result=J)},function(J){(T._status===0||T._status===-1)&&(T._status=2,T._result=J)}),T._status===-1&&(T._status=0,T._result=L)}if(T._status===1)return T._result.default;throw T._result}var de=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var L=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(L))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},U={map:ae,forEach:function(T,L,J){ae(T,function(){L.apply(this,arguments)},J)},count:function(T){var L=0;return ae(T,function(){L++}),L},toArray:function(T){return ae(T,function(L){return L})||[]},only:function(T){if(!V(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ae.Activity=y,Ae.Children=U,Ae.Component=k,Ae.Fragment=n,Ae.Profiler=o,Ae.PureComponent=R,Ae.StrictMode=a,Ae.Suspense=m,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(T){return E.H.useMemoCache(T)}},Ae.cache=function(T){return function(){return T.apply(null,arguments)}},Ae.cacheSignal=function(){return null},Ae.cloneElement=function(T,L,J){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var X=S({},T.props),Y=T.key;if(L!=null)for(he in L.key!==void 0&&(Y=""+L.key),L)!O.call(L,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&L.ref===void 0||(X[he]=L[he]);var he=arguments.length-2;if(he===1)X.children=J;else if(1<he){for(var ge=Array(he),we=0;we<he;we++)ge[we]=arguments[we+2];X.children=ge}return H(T.type,Y,X)},Ae.createContext=function(T){return T={$$typeof:u,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:c,_context:T},T},Ae.createElement=function(T,L,J){var X,Y={},he=null;if(L!=null)for(X in L.key!==void 0&&(he=""+L.key),L)O.call(L,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(Y[X]=L[X]);var ge=arguments.length-2;if(ge===1)Y.children=J;else if(1<ge){for(var we=Array(ge),me=0;me<ge;me++)we[me]=arguments[me+2];Y.children=we}if(T&&T.defaultProps)for(X in ge=T.defaultProps,ge)Y[X]===void 0&&(Y[X]=ge[X]);return H(T,he,Y)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(T){return{$$typeof:f,render:T}},Ae.isValidElement=V,Ae.lazy=function(T){return{$$typeof:v,_payload:{_status:-1,_result:T},_init:pe}},Ae.memo=function(T,L){return{$$typeof:p,type:T,compare:L===void 0?null:L}},Ae.startTransition=function(T){var L=E.T,J={};E.T=J;try{var X=T(),Y=E.S;Y!==null&&Y(J,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(P,de)}catch(he){de(he)}finally{L!==null&&J.types!==null&&(L.types=J.types),E.T=L}},Ae.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},Ae.use=function(T){return E.H.use(T)},Ae.useActionState=function(T,L,J){return E.H.useActionState(T,L,J)},Ae.useCallback=function(T,L){return E.H.useCallback(T,L)},Ae.useContext=function(T){return E.H.useContext(T)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(T,L){return E.H.useDeferredValue(T,L)},Ae.useEffect=function(T,L){return E.H.useEffect(T,L)},Ae.useEffectEvent=function(T){return E.H.useEffectEvent(T)},Ae.useId=function(){return E.H.useId()},Ae.useImperativeHandle=function(T,L,J){return E.H.useImperativeHandle(T,L,J)},Ae.useInsertionEffect=function(T,L){return E.H.useInsertionEffect(T,L)},Ae.useLayoutEffect=function(T,L){return E.H.useLayoutEffect(T,L)},Ae.useMemo=function(T,L){return E.H.useMemo(T,L)},Ae.useOptimistic=function(T,L){return E.H.useOptimistic(T,L)},Ae.useReducer=function(T,L,J){return E.H.useReducer(T,L,J)},Ae.useRef=function(T){return E.H.useRef(T)},Ae.useState=function(T){return E.H.useState(T)},Ae.useSyncExternalStore=function(T,L,J){return E.H.useSyncExternalStore(T,L,J)},Ae.useTransition=function(){return E.H.useTransition()},Ae.version="19.2.4",Ae}var Yv;function ml(){return Yv||(Yv=1,Ah.exports=ok()),Ah.exports}var w=ml();const us=mS(w),tp=ik({__proto__:null,default:us},[w]);var Th={exports:{}},Ko={},Oh={exports:{}},Dh={};var Jv;function lk(){return Jv||(Jv=1,(function(e){function t(K,ae){var pe=K.length;K.push(ae);e:for(;0<pe;){var de=pe-1>>>1,U=K[de];if(0<o(U,ae))K[de]=ae,K[pe]=U,pe=de;else break e}}function n(K){return K.length===0?null:K[0]}function a(K){if(K.length===0)return null;var ae=K[0],pe=K.pop();if(pe!==ae){K[0]=pe;e:for(var de=0,U=K.length,T=U>>>1;de<T;){var L=2*(de+1)-1,J=K[L],X=L+1,Y=K[X];if(0>o(J,pe))X<U&&0>o(Y,J)?(K[de]=Y,K[X]=pe,de=X):(K[de]=J,K[L]=pe,de=L);else if(X<U&&0>o(Y,pe))K[de]=Y,K[X]=pe,de=X;else break e}}return ae}function o(K,ae){var pe=K.sortIndex-ae.sortIndex;return pe!==0?pe:K.id-ae.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],p=[],v=1,y=null,x=3,b=!1,N=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function z(K){for(var ae=n(p);ae!==null;){if(ae.callback===null)a(p);else if(ae.startTime<=K)a(p),ae.sortIndex=ae.expirationTime,t(m,ae);else break;ae=n(p)}}function $(K){if(S=!1,z(K),!N)if(n(m)!==null)N=!0,P||(P=!0,se());else{var ae=n(p);ae!==null&&xe($,ae.startTime-K)}}var P=!1,E=-1,O=5,H=-1;function ee(){return C?!0:!(e.unstable_now()-H<O)}function V(){if(C=!1,P){var K=e.unstable_now();H=K;var ae=!0;try{e:{N=!1,S&&(S=!1,A(E),E=-1),b=!0;var pe=x;try{t:{for(z(K),y=n(m);y!==null&&!(y.expirationTime>K&&ee());){var de=y.callback;if(typeof de=="function"){y.callback=null,x=y.priorityLevel;var U=de(y.expirationTime<=K);if(K=e.unstable_now(),typeof U=="function"){y.callback=U,z(K),ae=!0;break t}y===n(m)&&a(m),z(K)}else a(m);y=n(m)}if(y!==null)ae=!0;else{var T=n(p);T!==null&&xe($,T.startTime-K),ae=!1}}break e}finally{y=null,x=pe,b=!1}ae=void 0}}finally{ae?se():P=!1}}}var se;if(typeof R=="function")se=function(){R(V)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,_e=ue.port2;ue.port1.onmessage=V,se=function(){_e.postMessage(null)}}else se=function(){k(V,0)};function xe(K,ae){E=k(function(){K(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(K){K.callback=null},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(K){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var pe=x;x=ae;try{return K()}finally{x=pe}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(K,ae){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var pe=x;x=K;try{return ae()}finally{x=pe}},e.unstable_scheduleCallback=function(K,ae,pe){var de=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?de+pe:de):pe=de,K){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=pe+U,K={id:v++,callback:ae,priorityLevel:K,startTime:pe,expirationTime:U,sortIndex:-1},pe>de?(K.sortIndex=pe,t(p,K),n(m)===null&&K===n(p)&&(S?(A(E),E=-1):S=!0,xe($,pe-de))):(K.sortIndex=U,t(m,K),N||b||(N=!0,P||(P=!0,se()))),K},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(K){var ae=x;return function(){var pe=x;x=ae;try{return K.apply(this,arguments)}finally{x=pe}}}})(Dh)),Dh}var Xv;function ck(){return Xv||(Xv=1,Oh.exports=lk()),Oh.exports}var Lh={exports:{}},an={};var Wv;function uk(){if(Wv)return an;Wv=1;var e=ml();function t(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,p,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:p,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return an.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,an.createPortal=function(m,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(m,p,null,v)},an.flushSync=function(m){var p=u.T,v=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=p,a.p=v,a.d.f()}},an.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},an.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},an.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var v=p.as,y=f(v,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:x,fetchPriority:b}):v==="script"&&a.d.X(m,{crossOrigin:y,integrity:x,fetchPriority:b,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},an.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=f(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},an.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,y=f(v,p.crossOrigin);a.d.L(m,v,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},an.preloadModule=function(m,p){if(typeof m=="string")if(p){var v=f(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},an.requestFormReset=function(m){a.d.r(m)},an.unstable_batchedUpdates=function(m,p){return m(p)},an.useFormState=function(m,p,v){return u.H.useFormState(m,p,v)},an.useFormStatus=function(){return u.H.useHostTransitionStatus()},an.version="19.2.4",an}var ex;function pS(){if(ex)return Lh.exports;ex=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(),Lh.exports=uk(),Lh.exports}var tx;function dk(){if(tx)return Ko;tx=1;var e=ck(),t=ml(),n=pS();function a(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var i=s,l=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(l=i.return),s=i.return;while(s)}return i.tag===3?l:null}function u(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function f(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function m(s){if(c(s)!==s)throw Error(a(188))}function p(s){var i=s.alternate;if(!i){if(i=c(s),i===null)throw Error(a(188));return i!==s?null:s}for(var l=s,d=i;;){var h=l.return;if(h===null)break;var g=h.alternate;if(g===null){if(d=h.return,d!==null){l=d;continue}break}if(h.child===g.child){for(g=h.child;g;){if(g===l)return m(h),s;if(g===d)return m(h),i;g=g.sibling}throw Error(a(188))}if(l.return!==d.return)l=h,d=g;else{for(var j=!1,_=h.child;_;){if(_===l){j=!0,l=h,d=g;break}if(_===d){j=!0,d=h,l=g;break}_=_.sibling}if(!j){for(_=g.child;_;){if(_===l){j=!0,l=g,d=h;break}if(_===d){j=!0,d=g,l=h;break}_=_.sibling}if(!j)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?s:i}function v(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=v(s),i!==null)return i;s=s.sibling}return null}var y=Object.assign,x=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),A=Symbol.for("react.consumer"),R=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function se(s){return s===null||typeof s!="object"?null:(s=V&&s[V]||s["@@iterator"],typeof s=="function"?s:null)}var ue=Symbol.for("react.client.reference");function _e(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ue?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case P:return"SuspenseList";case H:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case N:return"Portal";case R:return s.displayName||"Context";case A:return(s._context.displayName||"Context")+".Consumer";case z:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case E:return i=s.displayName||null,i!==null?i:_e(s.type)||"Memo";case O:i=s._payload,s=s._init;try{return _e(s(i))}catch{}}return null}var xe=Array.isArray,K=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},de=[],U=-1;function T(s){return{current:s}}function L(s){0>U||(s.current=de[U],de[U]=null,U--)}function J(s,i){U++,de[U]=s.current,s.current=i}var X=T(null),Y=T(null),he=T(null),ge=T(null);function we(s,i){switch(J(he,i),J(Y,s),J(X,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?gv(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=gv(i),s=yv(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}L(X),J(X,s)}function me(){L(X),L(Y),L(he)}function Ie(s){s.memoizedState!==null&&J(ge,s);var i=X.current,l=yv(i,s.type);i!==l&&(J(Y,s),J(X,l))}function Ye(s){Y.current===s&&(L(X),L(Y)),ge.current===s&&(L(ge),Po._currentValue=pe)}var le,Ue;function Qe(s){if(le===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);le=i&&i[1]||"",Ue=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+le+s+Ue}var Vt=!1;function Ut(s,i){if(!s||Vt)return"";Vt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Q){var Z=Q}Reflect.construct(s,[],ie)}else{try{ie.call()}catch(Q){Z=Q}s.call(ie.prototype)}}else{try{throw Error()}catch(Q){Z=Q}(ie=s())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Q){if(Q&&Z&&typeof Q.stack=="string")return[Q.stack,Z.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=d.DetermineComponentFrameRoot(),j=g[0],_=g[1];if(j&&_){var M=j.split(`
|
|
4
|
-
`),F=_.split(`
|
|
5
|
-
`);for(h=d=0;d<M.length&&!M[d].includes("DetermineComponentFrameRoot");)d++;for(;h<F.length&&!F[h].includes("DetermineComponentFrameRoot");)h++;if(d===M.length||h===F.length)for(d=M.length-1,h=F.length-1;1<=d&&0<=h&&M[d]!==F[h];)h--;for(;1<=d&&0<=h;d--,h--)if(M[d]!==F[h]){if(d!==1||h!==1)do if(d--,h--,0>h||M[d]!==F[h]){var W=`
|
|
6
|
-
`+M[d].replace(" at new "," at ");return s.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",s.displayName)),W}while(1<=d&&0<=h);break}}}finally{Vt=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Qe(l):""}function Mn(s,i){switch(s.tag){case 26:case 27:case 5:return Qe(s.type);case 16:return Qe("Lazy");case 13:return s.child!==i&&i!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return Ut(s.type,!1);case 11:return Ut(s.type.render,!1);case 1:return Ut(s.type,!0);case 31:return Qe("Activity");default:return""}}function nn(s){try{var i="",l=null;do i+=Mn(s,l),l=s,s=s.return;while(s);return i}catch(d){return`
|
|
7
|
-
Error generating stack: `+d.message+`
|
|
8
|
-
`+d.stack}}var Et=Object.prototype.hasOwnProperty,re=e.unstable_scheduleCallback,Ze=e.unstable_cancelCallback,gt=e.unstable_shouldYield,Qt=e.unstable_requestPaint,Je=e.unstable_now,Me=e.unstable_getCurrentPriorityLevel,Xe=e.unstable_ImmediatePriority,Nt=e.unstable_UserBlockingPriority,Ke=e.unstable_NormalPriority,Ma=e.unstable_LowPriority,pn=e.unstable_IdlePriority,st=e.log,Xr=e.unstable_setDisableYieldValue,ns=null,ht=null;function gn(s){if(typeof st=="function"&&Xr(s),ht&&typeof ht.setStrictMode=="function")try{ht.setStrictMode(ns,s)}catch{}}var ce=Math.clz32?Math.clz32:Nl,zn=Math.log,$a=Math.LN2;function Nl(s){return s>>>=0,s===0?32:31-(zn(s)/$a|0)|0}var Gi=256,Pa=262144,Cs=4194304;function ms(s){var i=s&42;if(i!==0)return i;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ua(s,i,l){var d=s.pendingLanes;if(d===0)return 0;var h=0,g=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var _=d&134217727;return _!==0?(d=_&~g,d!==0?h=ms(d):(j&=_,j!==0?h=ms(j):l||(l=_&~s,l!==0&&(h=ms(l))))):(_=d&~g,_!==0?h=ms(_):j!==0?h=ms(j):l||(l=d&~s,l!==0&&(h=ms(l)))),h===0?0:i!==0&&i!==h&&(i&g)===0&&(g=h&-h,l=i&-i,g>=l||g===32&&(l&4194048)!==0)?i:h}function Ys(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function Sd(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Cl(){var s=Cs;return Cs<<=1,(Cs&62914560)===0&&(Cs=4194304),s}function Wr(s){for(var i=[],l=0;31>l;l++)i.push(s);return i}function Fi(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function kl(s,i,l,d,h,g){var j=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var _=s.entanglements,M=s.expirationTimes,F=s.hiddenUpdates;for(l=j&~l;0<l;){var W=31-ce(l),ie=1<<W;_[W]=0,M[W]=-1;var Z=F[W];if(Z!==null)for(F[W]=null,W=0;W<Z.length;W++){var Q=Z[W];Q!==null&&(Q.lane&=-536870913)}l&=~ie}d!==0&&B(s,d,0),g!==0&&h===0&&s.tag!==0&&(s.suspendedLanes|=g&~(j&~i))}function B(s,i,l){s.pendingLanes|=i,s.suspendedLanes&=~i;var d=31-ce(i);s.entangledLanes|=i,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function fe(s,i){var l=s.entangledLanes|=i;for(s=s.entanglements;l;){var d=31-ce(l),h=1<<d;h&i|s[d]&i&&(s[d]|=i),l&=~h}}function xt(s,i){var l=i&-i;return l=(l&42)!==0?1:Gt(l),(l&(s.suspendedLanes|i))!==0?0:l}function Gt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function ln(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ia(){var s=ae.p;return s!==0?s:(s=window.event,s===void 0?32:Iv(s.type))}function ps(s,i){var l=ae.p;try{return ae.p=s,i()}finally{ae.p=l}}var cn=Math.random().toString(36).slice(2),it="__reactFiber$"+cn,sn="__reactProps$"+cn,_n="__reactContainer$"+cn,ks="__reactEvents$"+cn,Ba="__reactListeners$"+cn,zl="__reactHandles$"+cn,_l="__reactResources$"+cn,gs="__reactMarker$"+cn;function Js(s){delete s[it],delete s[sn],delete s[ks],delete s[Ba],delete s[zl]}function Xs(s){var i=s[it];if(i)return i;for(var l=s.parentNode;l;){if(i=l[_n]||l[it]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(s=Nv(s);s!==null;){if(l=s[it])return l;s=Nv(s)}return i}s=l,l=s.parentNode}return null}function Ws(s){if(s=s[it]||s[_n]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function $e(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(a(33))}function We(s){var i=s[_l];return i||(i=s[_l]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function at(s){s[gs]=!0}var ss=new Set,Zi={};function ys(s,i){qa(s,i),qa(s+"Capture",i)}function qa(s,i){for(Zi[s]=i,s=0;s<i.length;s++)ss.add(i[s])}var QN=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]*$"),rg={},og={};function YN(s){return Et.call(og,s)?!0:Et.call(rg,s)?!1:QN.test(s)?og[s]=!0:(rg[s]=!0,!1)}function El(s,i,l){if(YN(i))if(l===null)s.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+l)}}function Rl(s,i,l){if(l===null)s.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+l)}}function zs(s,i,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(i,l,""+d)}}function $n(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function lg(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function JN(s,i,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var h=d.get,g=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return h.call(this)},set:function(j){l=""+j,g.call(this,j)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(j){l=""+j},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function jd(s){if(!s._valueTracker){var i=lg(s)?"checked":"value";s._valueTracker=JN(s,i,""+s[i])}}function cg(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return s&&(d=lg(s)?s.checked?"true":"false":s.value),s=d,s!==l?(i.setValue(s),!0):!1}function Al(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var XN=/[\n"\\]/g;function Pn(s){return s.replace(XN,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function wd(s,i,l,d,h,g,j,_){s.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?s.type=j:s.removeAttribute("type"),i!=null?j==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+$n(i)):s.value!==""+$n(i)&&(s.value=""+$n(i)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),i!=null?Nd(s,j,$n(i)):l!=null?Nd(s,j,$n(l)):d!=null&&s.removeAttribute("value"),h==null&&g!=null&&(s.defaultChecked=!!g),h!=null&&(s.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+$n(_):s.removeAttribute("name")}function ug(s,i,l,d,h,g,j,_){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),i!=null||l!=null){if(!(g!=="submit"&&g!=="reset"||i!=null)){jd(s);return}l=l!=null?""+$n(l):"",i=i!=null?""+$n(i):l,_||i===s.value||(s.value=i),s.defaultValue=i}d=d??h,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=_?s.checked:!!d,s.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),jd(s)}function Nd(s,i,l){i==="number"&&Al(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function Ka(s,i,l,d){if(s=s.options,i){i={};for(var h=0;h<l.length;h++)i["$"+l[h]]=!0;for(l=0;l<s.length;l++)h=i.hasOwnProperty("$"+s[l].value),s[l].selected!==h&&(s[l].selected=h),h&&d&&(s[l].defaultSelected=!0)}else{for(l=""+$n(l),i=null,h=0;h<s.length;h++){if(s[h].value===l){s[h].selected=!0,d&&(s[h].defaultSelected=!0);return}i!==null||s[h].disabled||(i=s[h])}i!==null&&(i.selected=!0)}}function dg(s,i,l){if(i!=null&&(i=""+$n(i),i!==s.value&&(s.value=i),l==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=l!=null?""+$n(l):""}function fg(s,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(a(92));if(xe(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=$n(i),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),jd(s)}function Ha(s,i){if(i){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=i;return}}s.textContent=i}var WN=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 hg(s,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":d?s.setProperty(i,l):typeof l!="number"||l===0||WN.has(i)?i==="float"?s.cssFloat=l:s[i]=(""+l).trim():s[i]=l+"px"}function mg(s,i,l){if(i!=null&&typeof i!="object")throw Error(a(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var h in i)d=i[h],i.hasOwnProperty(h)&&l[h]!==d&&hg(s,h,d)}else for(var g in i)i.hasOwnProperty(g)&&hg(s,g,i[g])}function Cd(s){if(s.indexOf("-")===-1)return!1;switch(s){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 e1=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"]]),t1=/^[\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 Tl(s){return t1.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function _s(){}var kd=null;function zd(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ga=null,Fa=null;function pg(s){var i=Ws(s);if(i&&(s=i.stateNode)){var l=s[sn]||null;e:switch(s=i.stateNode,i.type){case"input":if(wd(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Pn(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==s&&d.form===s.form){var h=d[sn]||null;if(!h)throw Error(a(90));wd(d,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===s.form&&cg(d)}break e;case"textarea":dg(s,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&Ka(s,!!l.multiple,i,!1)}}}var _d=!1;function gg(s,i,l){if(_d)return s(i,l);_d=!0;try{var d=s(i);return d}finally{if(_d=!1,(Ga!==null||Fa!==null)&&(xc(),Ga&&(i=Ga,s=Fa,Fa=Ga=null,pg(i),s)))for(i=0;i<s.length;i++)pg(s[i])}}function eo(s,i){var l=s.stateNode;if(l===null)return null;var d=l[sn]||null;if(d===null)return null;l=d[i];e:switch(i){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)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(a(231,i,typeof l));return l}var Es=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(Es)try{var to={};Object.defineProperty(to,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Ed=!1}var ei=null,Rd=null,Ol=null;function yg(){if(Ol)return Ol;var s,i=Rd,l=i.length,d,h="value"in ei?ei.value:ei.textContent,g=h.length;for(s=0;s<l&&i[s]===h[s];s++);var j=l-s;for(d=1;d<=j&&i[l-d]===h[g-d];d++);return Ol=h.slice(s,1<d?1-d:void 0)}function Dl(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Ll(){return!0}function vg(){return!1}function yn(s){function i(l,d,h,g,j){this._reactName=l,this._targetInst=h,this.type=d,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var _ in s)s.hasOwnProperty(_)&&(l=s[_],this[_]=l?l(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Ll:vg,this.isPropagationStopped=vg,this}return y(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ll)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ll)},persist:function(){},isPersistent:Ll}),i}var Vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ml=yn(Vi),no=y({},Vi,{view:0,detail:0}),n1=yn(no),Ad,Td,so,$l=y({},no,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dd,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==so&&(so&&s.type==="mousemove"?(Ad=s.screenX-so.screenX,Td=s.screenY-so.screenY):Td=Ad=0,so=s),Ad)},movementY:function(s){return"movementY"in s?s.movementY:Td}}),xg=yn($l),s1=y({},$l,{dataTransfer:0}),i1=yn(s1),a1=y({},no,{relatedTarget:0}),Od=yn(a1),r1=y({},Vi,{animationName:0,elapsedTime:0,pseudoElement:0}),o1=yn(r1),l1=y({},Vi,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),c1=yn(l1),u1=y({},Vi,{data:0}),bg=yn(u1),d1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},f1={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"},h1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function m1(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=h1[s])?!!i[s]:!1}function Dd(){return m1}var p1=y({},no,{key:function(s){if(s.key){var i=d1[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=Dl(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?f1[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dd,charCode:function(s){return s.type==="keypress"?Dl(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Dl(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),g1=yn(p1),y1=y({},$l,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sg=yn(y1),v1=y({},no,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dd}),x1=yn(v1),b1=y({},Vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),S1=yn(b1),j1=y({},$l,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),w1=yn(j1),N1=y({},Vi,{newState:0,oldState:0}),C1=yn(N1),k1=[9,13,27,32],Ld=Es&&"CompositionEvent"in window,io=null;Es&&"documentMode"in document&&(io=document.documentMode);var z1=Es&&"TextEvent"in window&&!io,jg=Es&&(!Ld||io&&8<io&&11>=io),wg=" ",Ng=!1;function Cg(s,i){switch(s){case"keyup":return k1.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kg(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Za=!1;function _1(s,i){switch(s){case"compositionend":return kg(i);case"keypress":return i.which!==32?null:(Ng=!0,wg);case"textInput":return s=i.data,s===wg&&Ng?null:s;default:return null}}function E1(s,i){if(Za)return s==="compositionend"||!Ld&&Cg(s,i)?(s=yg(),Ol=Rd=ei=null,Za=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return jg&&i.locale!=="ko"?null:i.data;default:return null}}var R1={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 zg(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!R1[s.type]:i==="textarea"}function _g(s,i,l,d){Ga?Fa?Fa.push(d):Fa=[d]:Ga=d,i=kc(i,"onChange"),0<i.length&&(l=new Ml("onChange","change",null,l,d),s.push({event:l,listeners:i}))}var ao=null,ro=null;function A1(s){uv(s,0)}function Pl(s){var i=$e(s);if(cg(i))return s}function Eg(s,i){if(s==="change")return i}var Rg=!1;if(Es){var Md;if(Es){var $d="oninput"in document;if(!$d){var Ag=document.createElement("div");Ag.setAttribute("oninput","return;"),$d=typeof Ag.oninput=="function"}Md=$d}else Md=!1;Rg=Md&&(!document.documentMode||9<document.documentMode)}function Tg(){ao&&(ao.detachEvent("onpropertychange",Og),ro=ao=null)}function Og(s){if(s.propertyName==="value"&&Pl(ro)){var i=[];_g(i,ro,s,zd(s)),gg(A1,i)}}function T1(s,i,l){s==="focusin"?(Tg(),ao=i,ro=l,ao.attachEvent("onpropertychange",Og)):s==="focusout"&&Tg()}function O1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Pl(ro)}function D1(s,i){if(s==="click")return Pl(i)}function L1(s,i){if(s==="input"||s==="change")return Pl(i)}function M1(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var En=typeof Object.is=="function"?Object.is:M1;function oo(s,i){if(En(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var l=Object.keys(s),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var h=l[d];if(!Et.call(i,h)||!En(s[h],i[h]))return!1}return!0}function Dg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Lg(s,i){var l=Dg(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=i&&d>=i)return{node:l,offset:i-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Dg(l)}}function Mg(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Mg(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function $g(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=Al(s.document);i instanceof s.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)s=i.contentWindow;else break;i=Al(s.document)}return i}function Pd(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var $1=Es&&"documentMode"in document&&11>=document.documentMode,Va=null,Ud=null,lo=null,Id=!1;function Pg(s,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Id||Va==null||Va!==Al(d)||(d=Va,"selectionStart"in d&&Pd(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}),lo&&oo(lo,d)||(lo=d,d=kc(Ud,"onSelect"),0<d.length&&(i=new Ml("onSelect","select",null,i,l),s.push({event:i,listeners:d}),i.target=Va)))}function Qi(s,i){var l={};return l[s.toLowerCase()]=i.toLowerCase(),l["Webkit"+s]="webkit"+i,l["Moz"+s]="moz"+i,l}var Qa={animationend:Qi("Animation","AnimationEnd"),animationiteration:Qi("Animation","AnimationIteration"),animationstart:Qi("Animation","AnimationStart"),transitionrun:Qi("Transition","TransitionRun"),transitionstart:Qi("Transition","TransitionStart"),transitioncancel:Qi("Transition","TransitionCancel"),transitionend:Qi("Transition","TransitionEnd")},Bd={},Ug={};Es&&(Ug=document.createElement("div").style,"AnimationEvent"in window||(delete Qa.animationend.animation,delete Qa.animationiteration.animation,delete Qa.animationstart.animation),"TransitionEvent"in window||delete Qa.transitionend.transition);function Yi(s){if(Bd[s])return Bd[s];if(!Qa[s])return s;var i=Qa[s],l;for(l in i)if(i.hasOwnProperty(l)&&l in Ug)return Bd[s]=i[l];return s}var Ig=Yi("animationend"),Bg=Yi("animationiteration"),qg=Yi("animationstart"),P1=Yi("transitionrun"),U1=Yi("transitionstart"),I1=Yi("transitioncancel"),Kg=Yi("transitionend"),Hg=new Map,qd="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(" ");qd.push("scrollEnd");function is(s,i){Hg.set(s,i),ys(i,[s])}var Ul=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Un=[],Ya=0,Kd=0;function Il(){for(var s=Ya,i=Kd=Ya=0;i<s;){var l=Un[i];Un[i++]=null;var d=Un[i];Un[i++]=null;var h=Un[i];Un[i++]=null;var g=Un[i];if(Un[i++]=null,d!==null&&h!==null){var j=d.pending;j===null?h.next=h:(h.next=j.next,j.next=h),d.pending=h}g!==0&&Gg(l,h,g)}}function Bl(s,i,l,d){Un[Ya++]=s,Un[Ya++]=i,Un[Ya++]=l,Un[Ya++]=d,Kd|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Hd(s,i,l,d){return Bl(s,i,l,d),ql(s)}function Ji(s,i){return Bl(s,null,null,i),ql(s)}function Gg(s,i,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var h=!1,g=s.return;g!==null;)g.childLanes|=l,d=g.alternate,d!==null&&(d.childLanes|=l),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(h=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,h&&i!==null&&(h=31-ce(l),s=g.hiddenUpdates,d=s[h],d===null?s[h]=[i]:d.push(i),i.lane=l|536870912),g):null}function ql(s){if(50<Ao)throw Ao=0,eh=null,Error(a(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var Ja={};function B1(s,i,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,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 Rn(s,i,l,d){return new B1(s,i,l,d)}function Gd(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Rs(s,i){var l=s.alternate;return l===null?(l=Rn(s.tag,i,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=i,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,i=s.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function Fg(s,i){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,i=l.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Kl(s,i,l,d,h,g){var j=0;if(d=s,typeof s=="function")Gd(s)&&(j=1);else if(typeof s=="string")j=FC(s,l,X.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case H:return s=Rn(31,l,i,h),s.elementType=H,s.lanes=g,s;case S:return Xi(l.children,h,g,i);case C:j=8,h|=24;break;case k:return s=Rn(12,l,i,h|2),s.elementType=k,s.lanes=g,s;case $:return s=Rn(13,l,i,h),s.elementType=$,s.lanes=g,s;case P:return s=Rn(19,l,i,h),s.elementType=P,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case R:j=10;break e;case A:j=9;break e;case z:j=11;break e;case E:j=14;break e;case O:j=16,d=null;break e}j=29,l=Error(a(130,s===null?"null":typeof s,"")),d=null}return i=Rn(j,l,i,h),i.elementType=s,i.type=d,i.lanes=g,i}function Xi(s,i,l,d){return s=Rn(7,s,d,i),s.lanes=l,s}function Fd(s,i,l){return s=Rn(6,s,null,i),s.lanes=l,s}function Zg(s){var i=Rn(18,null,null,0);return i.stateNode=s,i}function Zd(s,i,l){return i=Rn(4,s.children!==null?s.children:[],s.key,i),i.lanes=l,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var Vg=new WeakMap;function In(s,i){if(typeof s=="object"&&s!==null){var l=Vg.get(s);return l!==void 0?l:(i={value:s,source:i,stack:nn(i)},Vg.set(s,i),i)}return{value:s,source:i,stack:nn(i)}}var Xa=[],Wa=0,Hl=null,co=0,Bn=[],qn=0,ti=null,vs=1,xs="";function As(s,i){Xa[Wa++]=co,Xa[Wa++]=Hl,Hl=s,co=i}function Qg(s,i,l){Bn[qn++]=vs,Bn[qn++]=xs,Bn[qn++]=ti,ti=s;var d=vs;s=xs;var h=32-ce(d)-1;d&=~(1<<h),l+=1;var g=32-ce(i)+h;if(30<g){var j=h-h%5;g=(d&(1<<j)-1).toString(32),d>>=j,h-=j,vs=1<<32-ce(i)+h|l<<h|d,xs=g+s}else vs=1<<g|l<<h|d,xs=s}function Vd(s){s.return!==null&&(As(s,1),Qg(s,1,0))}function Qd(s){for(;s===Hl;)Hl=Xa[--Wa],Xa[Wa]=null,co=Xa[--Wa],Xa[Wa]=null;for(;s===ti;)ti=Bn[--qn],Bn[qn]=null,xs=Bn[--qn],Bn[qn]=null,vs=Bn[--qn],Bn[qn]=null}function Yg(s,i){Bn[qn++]=vs,Bn[qn++]=xs,Bn[qn++]=ti,vs=i.id,xs=i.overflow,ti=s}var Jt=null,yt=null,Ve=!1,ni=null,Kn=!1,Yd=Error(a(519));function si(s){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uo(In(i,s)),Yd}function Jg(s){var i=s.stateNode,l=s.type,d=s.memoizedProps;switch(i[it]=s,i[sn]=d,l){case"dialog":qe("cancel",i),qe("close",i);break;case"iframe":case"object":case"embed":qe("load",i);break;case"video":case"audio":for(l=0;l<Oo.length;l++)qe(Oo[l],i);break;case"source":qe("error",i);break;case"img":case"image":case"link":qe("error",i),qe("load",i);break;case"details":qe("toggle",i);break;case"input":qe("invalid",i),ug(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":qe("invalid",i);break;case"textarea":qe("invalid",i),fg(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||mv(i.textContent,l)?(d.popover!=null&&(qe("beforetoggle",i),qe("toggle",i)),d.onScroll!=null&&qe("scroll",i),d.onScrollEnd!=null&&qe("scrollend",i),d.onClick!=null&&(i.onclick=_s),i=!0):i=!1,i||si(s,!0)}function Xg(s){for(Jt=s.return;Jt;)switch(Jt.tag){case 5:case 31:case 13:Kn=!1;return;case 27:case 3:Kn=!0;return;default:Jt=Jt.return}}function er(s){if(s!==Jt)return!1;if(!Ve)return Xg(s),Ve=!0,!1;var i=s.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||ph(s.type,s.memoizedProps)),l=!l),l&&yt&&si(s),Xg(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));yt=wv(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));yt=wv(s)}else i===27?(i=yt,yi(s.type)?(s=bh,bh=null,yt=s):yt=i):yt=Jt?Gn(s.stateNode.nextSibling):null;return!0}function Wi(){yt=Jt=null,Ve=!1}function Jd(){var s=ni;return s!==null&&(Sn===null?Sn=s:Sn.push.apply(Sn,s),ni=null),s}function uo(s){ni===null?ni=[s]:ni.push(s)}var Xd=T(null),ea=null,Ts=null;function ii(s,i,l){J(Xd,i._currentValue),i._currentValue=l}function Os(s){s._currentValue=Xd.current,L(Xd)}function Wd(s,i,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),s===l)break;s=s.return}}function ef(s,i,l,d){var h=s.child;for(h!==null&&(h.return=s);h!==null;){var g=h.dependencies;if(g!==null){var j=h.child;g=g.firstContext;e:for(;g!==null;){var _=g;g=h;for(var M=0;M<i.length;M++)if(_.context===i[M]){g.lanes|=l,_=g.alternate,_!==null&&(_.lanes|=l),Wd(g.return,l,s),d||(j=null);break e}g=_.next}}else if(h.tag===18){if(j=h.return,j===null)throw Error(a(341));j.lanes|=l,g=j.alternate,g!==null&&(g.lanes|=l),Wd(j,l,s),j=null}else j=h.child;if(j!==null)j.return=h;else for(j=h;j!==null;){if(j===s){j=null;break}if(h=j.sibling,h!==null){h.return=j.return,j=h;break}j=j.return}h=j}}function tr(s,i,l,d){s=null;for(var h=i,g=!1;h!==null;){if(!g){if((h.flags&524288)!==0)g=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var j=h.alternate;if(j===null)throw Error(a(387));if(j=j.memoizedProps,j!==null){var _=h.type;En(h.pendingProps.value,j.value)||(s!==null?s.push(_):s=[_])}}else if(h===ge.current){if(j=h.alternate,j===null)throw Error(a(387));j.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(s!==null?s.push(Po):s=[Po])}h=h.return}s!==null&&ef(i,s,l,d),i.flags|=262144}function Gl(s){for(s=s.firstContext;s!==null;){if(!En(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ta(s){ea=s,Ts=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Xt(s){return Wg(ea,s)}function Fl(s,i){return ea===null&&ta(s),Wg(s,i)}function Wg(s,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Ts===null){if(s===null)throw Error(a(308));Ts=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Ts=Ts.next=i;return l}var q1=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){i.aborted=!0,s.forEach(function(l){return l()})}},K1=e.unstable_scheduleCallback,H1=e.unstable_NormalPriority,It={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tf(){return{controller:new q1,data:new Map,refCount:0}}function fo(s){s.refCount--,s.refCount===0&&K1(H1,function(){s.controller.abort()})}var ho=null,nf=0,nr=0,sr=null;function G1(s,i){if(ho===null){var l=ho=[];nf=0,nr=rh(),sr={status:"pending",value:void 0,then:function(d){l.push(d)}}}return nf++,i.then(ey,ey),i}function ey(){if(--nf===0&&ho!==null){sr!==null&&(sr.status="fulfilled");var s=ho;ho=null,nr=0,sr=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function F1(s,i){var l=[],d={status:"pending",value:null,reason:null,then:function(h){l.push(h)}};return s.then(function(){d.status="fulfilled",d.value=i;for(var h=0;h<l.length;h++)(0,l[h])(i)},function(h){for(d.status="rejected",d.reason=h,h=0;h<l.length;h++)(0,l[h])(void 0)}),d}var ty=K.S;K.S=function(s,i){P0=Je(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&G1(s,i),ty!==null&&ty(s,i)};var na=T(null);function sf(){var s=na.current;return s!==null?s:mt.pooledCache}function Zl(s,i){i===null?J(na,na.current):J(na,i.pool)}function ny(){var s=sf();return s===null?null:{parent:It._currentValue,pool:s}}var ir=Error(a(460)),af=Error(a(474)),Vl=Error(a(542)),Ql={then:function(){}};function sy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function iy(s,i,l){switch(l=s[l],l===void 0?s.push(i):l!==i&&(i.then(_s,_s),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s;default:if(typeof i.status=="string")i.then(_s,_s);else{if(s=mt,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=i,s.status="pending",s.then(function(d){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=d}},function(d){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ry(s),s}throw ia=i,ir}}function sa(s){try{var i=s._init;return i(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ia=l,ir):l}}var ia=null;function ay(){if(ia===null)throw Error(a(459));var s=ia;return ia=null,s}function ry(s){if(s===ir||s===Vl)throw Error(a(483))}var ar=null,mo=0;function Yl(s){var i=mo;return mo+=1,ar===null&&(ar=[]),iy(ar,s,i)}function po(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function Jl(s,i){throw i.$$typeof===x?Error(a(525)):(s=Object.prototype.toString.call(i),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function oy(s){function i(q,I){if(s){var G=q.deletions;G===null?(q.deletions=[I],q.flags|=16):G.push(I)}}function l(q,I){if(!s)return null;for(;I!==null;)i(q,I),I=I.sibling;return null}function d(q){for(var I=new Map;q!==null;)q.key!==null?I.set(q.key,q):I.set(q.index,q),q=q.sibling;return I}function h(q,I){return q=Rs(q,I),q.index=0,q.sibling=null,q}function g(q,I,G){return q.index=G,s?(G=q.alternate,G!==null?(G=G.index,G<I?(q.flags|=67108866,I):G):(q.flags|=67108866,I)):(q.flags|=1048576,I)}function j(q){return s&&q.alternate===null&&(q.flags|=67108866),q}function _(q,I,G,te){return I===null||I.tag!==6?(I=Fd(G,q.mode,te),I.return=q,I):(I=h(I,G),I.return=q,I)}function M(q,I,G,te){var ze=G.type;return ze===S?W(q,I,G.props.children,te,G.key):I!==null&&(I.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===O&&sa(ze)===I.type)?(I=h(I,G.props),po(I,G),I.return=q,I):(I=Kl(G.type,G.key,G.props,null,q.mode,te),po(I,G),I.return=q,I)}function F(q,I,G,te){return I===null||I.tag!==4||I.stateNode.containerInfo!==G.containerInfo||I.stateNode.implementation!==G.implementation?(I=Zd(G,q.mode,te),I.return=q,I):(I=h(I,G.children||[]),I.return=q,I)}function W(q,I,G,te,ze){return I===null||I.tag!==7?(I=Xi(G,q.mode,te,ze),I.return=q,I):(I=h(I,G),I.return=q,I)}function ie(q,I,G){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=Fd(""+I,q.mode,G),I.return=q,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case b:return G=Kl(I.type,I.key,I.props,null,q.mode,G),po(G,I),G.return=q,G;case N:return I=Zd(I,q.mode,G),I.return=q,I;case O:return I=sa(I),ie(q,I,G)}if(xe(I)||se(I))return I=Xi(I,q.mode,G,null),I.return=q,I;if(typeof I.then=="function")return ie(q,Yl(I),G);if(I.$$typeof===R)return ie(q,Fl(q,I),G);Jl(q,I)}return null}function Z(q,I,G,te){var ze=I!==null?I.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return ze!==null?null:_(q,I,""+G,te);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return G.key===ze?M(q,I,G,te):null;case N:return G.key===ze?F(q,I,G,te):null;case O:return G=sa(G),Z(q,I,G,te)}if(xe(G)||se(G))return ze!==null?null:W(q,I,G,te,null);if(typeof G.then=="function")return Z(q,I,Yl(G),te);if(G.$$typeof===R)return Z(q,I,Fl(q,G),te);Jl(q,G)}return null}function Q(q,I,G,te,ze){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return q=q.get(G)||null,_(I,q,""+te,ze);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case b:return q=q.get(te.key===null?G:te.key)||null,M(I,q,te,ze);case N:return q=q.get(te.key===null?G:te.key)||null,F(I,q,te,ze);case O:return te=sa(te),Q(q,I,G,te,ze)}if(xe(te)||se(te))return q=q.get(G)||null,W(I,q,te,ze,null);if(typeof te.then=="function")return Q(q,I,G,Yl(te),ze);if(te.$$typeof===R)return Q(q,I,G,Fl(I,te),ze);Jl(I,te)}return null}function Se(q,I,G,te){for(var ze=null,et=null,Ce=I,Le=I=0,Ge=null;Ce!==null&&Le<G.length;Le++){Ce.index>Le?(Ge=Ce,Ce=null):Ge=Ce.sibling;var tt=Z(q,Ce,G[Le],te);if(tt===null){Ce===null&&(Ce=Ge);break}s&&Ce&&tt.alternate===null&&i(q,Ce),I=g(tt,I,Le),et===null?ze=tt:et.sibling=tt,et=tt,Ce=Ge}if(Le===G.length)return l(q,Ce),Ve&&As(q,Le),ze;if(Ce===null){for(;Le<G.length;Le++)Ce=ie(q,G[Le],te),Ce!==null&&(I=g(Ce,I,Le),et===null?ze=Ce:et.sibling=Ce,et=Ce);return Ve&&As(q,Le),ze}for(Ce=d(Ce);Le<G.length;Le++)Ge=Q(Ce,q,Le,G[Le],te),Ge!==null&&(s&&Ge.alternate!==null&&Ce.delete(Ge.key===null?Le:Ge.key),I=g(Ge,I,Le),et===null?ze=Ge:et.sibling=Ge,et=Ge);return s&&Ce.forEach(function(ji){return i(q,ji)}),Ve&&As(q,Le),ze}function Re(q,I,G,te){if(G==null)throw Error(a(151));for(var ze=null,et=null,Ce=I,Le=I=0,Ge=null,tt=G.next();Ce!==null&&!tt.done;Le++,tt=G.next()){Ce.index>Le?(Ge=Ce,Ce=null):Ge=Ce.sibling;var ji=Z(q,Ce,tt.value,te);if(ji===null){Ce===null&&(Ce=Ge);break}s&&Ce&&ji.alternate===null&&i(q,Ce),I=g(ji,I,Le),et===null?ze=ji:et.sibling=ji,et=ji,Ce=Ge}if(tt.done)return l(q,Ce),Ve&&As(q,Le),ze;if(Ce===null){for(;!tt.done;Le++,tt=G.next())tt=ie(q,tt.value,te),tt!==null&&(I=g(tt,I,Le),et===null?ze=tt:et.sibling=tt,et=tt);return Ve&&As(q,Le),ze}for(Ce=d(Ce);!tt.done;Le++,tt=G.next())tt=Q(Ce,q,Le,tt.value,te),tt!==null&&(s&&tt.alternate!==null&&Ce.delete(tt.key===null?Le:tt.key),I=g(tt,I,Le),et===null?ze=tt:et.sibling=tt,et=tt);return s&&Ce.forEach(function(sk){return i(q,sk)}),Ve&&As(q,Le),ze}function ft(q,I,G,te){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case b:e:{for(var ze=G.key;I!==null;){if(I.key===ze){if(ze=G.type,ze===S){if(I.tag===7){l(q,I.sibling),te=h(I,G.props.children),te.return=q,q=te;break e}}else if(I.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===O&&sa(ze)===I.type){l(q,I.sibling),te=h(I,G.props),po(te,G),te.return=q,q=te;break e}l(q,I);break}else i(q,I);I=I.sibling}G.type===S?(te=Xi(G.props.children,q.mode,te,G.key),te.return=q,q=te):(te=Kl(G.type,G.key,G.props,null,q.mode,te),po(te,G),te.return=q,q=te)}return j(q);case N:e:{for(ze=G.key;I!==null;){if(I.key===ze)if(I.tag===4&&I.stateNode.containerInfo===G.containerInfo&&I.stateNode.implementation===G.implementation){l(q,I.sibling),te=h(I,G.children||[]),te.return=q,q=te;break e}else{l(q,I);break}else i(q,I);I=I.sibling}te=Zd(G,q.mode,te),te.return=q,q=te}return j(q);case O:return G=sa(G),ft(q,I,G,te)}if(xe(G))return Se(q,I,G,te);if(se(G)){if(ze=se(G),typeof ze!="function")throw Error(a(150));return G=ze.call(G),Re(q,I,G,te)}if(typeof G.then=="function")return ft(q,I,Yl(G),te);if(G.$$typeof===R)return ft(q,I,Fl(q,G),te);Jl(q,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,I!==null&&I.tag===6?(l(q,I.sibling),te=h(I,G),te.return=q,q=te):(l(q,I),te=Fd(G,q.mode,te),te.return=q,q=te),j(q)):l(q,I)}return function(q,I,G,te){try{mo=0;var ze=ft(q,I,G,te);return ar=null,ze}catch(Ce){if(Ce===ir||Ce===Vl)throw Ce;var et=Rn(29,Ce,null,q.mode);return et.lanes=te,et.return=q,et}}}var aa=oy(!0),ly=oy(!1),ai=!1;function rf(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function of(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ri(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function oi(s,i,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(nt&2)!==0){var h=d.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),d.pending=i,i=ql(s),Gg(s,null,l),i}return Bl(s,d,i,l),ql(s)}function go(s,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=s.pendingLanes,l|=d,i.lanes=l,fe(s,l)}}function lf(s,i){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var h=null,g=null;if(l=l.firstBaseUpdate,l!==null){do{var j={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};g===null?h=g=j:g=g.next=j,l=l.next}while(l!==null);g===null?h=g=i:g=g.next=i}else h=g=i;l={baseState:d.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=i:s.next=i,l.lastBaseUpdate=i}var cf=!1;function yo(){if(cf){var s=sr;if(s!==null)throw s}}function vo(s,i,l,d){cf=!1;var h=s.updateQueue;ai=!1;var g=h.firstBaseUpdate,j=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var M=_,F=M.next;M.next=null,j===null?g=F:j.next=F,j=M;var W=s.alternate;W!==null&&(W=W.updateQueue,_=W.lastBaseUpdate,_!==j&&(_===null?W.firstBaseUpdate=F:_.next=F,W.lastBaseUpdate=M))}if(g!==null){var ie=h.baseState;j=0,W=F=M=null,_=g;do{var Z=_.lane&-536870913,Q=Z!==_.lane;if(Q?(He&Z)===Z:(d&Z)===Z){Z!==0&&Z===nr&&(cf=!0),W!==null&&(W=W.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Se=s,Re=_;Z=i;var ft=l;switch(Re.tag){case 1:if(Se=Re.payload,typeof Se=="function"){ie=Se.call(ft,ie,Z);break e}ie=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Re.payload,Z=typeof Se=="function"?Se.call(ft,ie,Z):Se,Z==null)break e;ie=y({},ie,Z);break e;case 2:ai=!0}}Z=_.callback,Z!==null&&(s.flags|=64,Q&&(s.flags|=8192),Q=h.callbacks,Q===null?h.callbacks=[Z]:Q.push(Z))}else Q={lane:Z,tag:_.tag,payload:_.payload,callback:_.callback,next:null},W===null?(F=W=Q,M=ie):W=W.next=Q,j|=Z;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;Q=_,_=Q.next,Q.next=null,h.lastBaseUpdate=Q,h.shared.pending=null}}while(!0);W===null&&(M=ie),h.baseState=M,h.firstBaseUpdate=F,h.lastBaseUpdate=W,g===null&&(h.shared.lanes=0),fi|=j,s.lanes=j,s.memoizedState=ie}}function cy(s,i){if(typeof s!="function")throw Error(a(191,s));s.call(i)}function uy(s,i){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)cy(l[s],i)}var rr=T(null),Xl=T(0);function dy(s,i){s=qs,J(Xl,s),J(rr,i),qs=s|i.baseLanes}function uf(){J(Xl,qs),J(rr,rr.current)}function df(){qs=Xl.current,L(rr),L(Xl)}var An=T(null),Hn=null;function li(s){var i=s.alternate;J(Dt,Dt.current&1),J(An,s),Hn===null&&(i===null||rr.current!==null||i.memoizedState!==null)&&(Hn=s)}function ff(s){J(Dt,Dt.current),J(An,s),Hn===null&&(Hn=s)}function fy(s){s.tag===22?(J(Dt,Dt.current),J(An,s),Hn===null&&(Hn=s)):ci()}function ci(){J(Dt,Dt.current),J(An,An.current)}function Tn(s){L(An),Hn===s&&(Hn=null),L(Dt)}var Dt=T(0);function Wl(s){for(var i=s;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||vh(l)||xh(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ds=0,Oe=null,ut=null,Bt=null,ec=!1,or=!1,ra=!1,tc=0,xo=0,lr=null,Z1=0;function Rt(){throw Error(a(321))}function hf(s,i){if(i===null)return!1;for(var l=0;l<i.length&&l<s.length;l++)if(!En(s[l],i[l]))return!1;return!0}function mf(s,i,l,d,h,g){return Ds=g,Oe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,K.H=s===null||s.memoizedState===null?Qy:Ef,ra=!1,g=l(d,h),ra=!1,or&&(g=my(i,l,d,h)),hy(s),g}function hy(s){K.H=jo;var i=ut!==null&&ut.next!==null;if(Ds=0,Bt=ut=Oe=null,ec=!1,xo=0,lr=null,i)throw Error(a(300));s===null||qt||(s=s.dependencies,s!==null&&Gl(s)&&(qt=!0))}function my(s,i,l,d){Oe=s;var h=0;do{if(or&&(lr=null),xo=0,or=!1,25<=h)throw Error(a(301));if(h+=1,Bt=ut=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}K.H=Yy,g=i(l,d)}while(or);return g}function V1(){var s=K.H,i=s.useState()[0];return i=typeof i.then=="function"?bo(i):i,s=s.useState()[0],(ut!==null?ut.memoizedState:null)!==s&&(Oe.flags|=1024),i}function pf(){var s=tc!==0;return tc=0,s}function gf(s,i,l){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~l}function yf(s){if(ec){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}ec=!1}Ds=0,Bt=ut=Oe=null,or=!1,xo=tc=0,lr=null}function un(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Oe.memoizedState=Bt=s:Bt=Bt.next=s,Bt}function Lt(){if(ut===null){var s=Oe.alternate;s=s!==null?s.memoizedState:null}else s=ut.next;var i=Bt===null?Oe.memoizedState:Bt.next;if(i!==null)Bt=i,ut=s;else{if(s===null)throw Oe.alternate===null?Error(a(467)):Error(a(310));ut=s,s={memoizedState:ut.memoizedState,baseState:ut.baseState,baseQueue:ut.baseQueue,queue:ut.queue,next:null},Bt===null?Oe.memoizedState=Bt=s:Bt=Bt.next=s}return Bt}function nc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function bo(s){var i=xo;return xo+=1,lr===null&&(lr=[]),s=iy(lr,s,i),i=Oe,(Bt===null?i.memoizedState:Bt.next)===null&&(i=i.alternate,K.H=i===null||i.memoizedState===null?Qy:Ef),s}function sc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return bo(s);if(s.$$typeof===R)return Xt(s)}throw Error(a(438,String(s)))}function vf(s){var i=null,l=Oe.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=Oe.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=nc(),Oe.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(s),d=0;d<s;d++)l[d]=ee;return i.index++,l}function Ls(s,i){return typeof i=="function"?i(s):i}function ic(s){var i=Lt();return xf(i,ut,s)}function xf(s,i,l){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var h=s.baseQueue,g=d.pending;if(g!==null){if(h!==null){var j=h.next;h.next=g.next,g.next=j}i.baseQueue=h=g,d.pending=null}if(g=s.baseState,h===null)s.memoizedState=g;else{i=h.next;var _=j=null,M=null,F=i,W=!1;do{var ie=F.lane&-536870913;if(ie!==F.lane?(He&ie)===ie:(Ds&ie)===ie){var Z=F.revertLane;if(Z===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ie===nr&&(W=!0);else if((Ds&Z)===Z){F=F.next,Z===nr&&(W=!0);continue}else ie={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(_=M=ie,j=g):M=M.next=ie,Oe.lanes|=Z,fi|=Z;ie=F.action,ra&&l(g,ie),g=F.hasEagerState?F.eagerState:l(g,ie)}else Z={lane:ie,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},M===null?(_=M=Z,j=g):M=M.next=Z,Oe.lanes|=ie,fi|=ie;F=F.next}while(F!==null&&F!==i);if(M===null?j=g:M.next=_,!En(g,s.memoizedState)&&(qt=!0,W&&(l=sr,l!==null)))throw l;s.memoizedState=g,s.baseState=j,s.baseQueue=M,d.lastRenderedState=g}return h===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function bf(s){var i=Lt(),l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=s;var d=l.dispatch,h=l.pending,g=i.memoizedState;if(h!==null){l.pending=null;var j=h=h.next;do g=s(g,j.action),j=j.next;while(j!==h);En(g,i.memoizedState)||(qt=!0),i.memoizedState=g,i.baseQueue===null&&(i.baseState=g),l.lastRenderedState=g}return[g,d]}function py(s,i,l){var d=Oe,h=Lt(),g=Ve;if(g){if(l===void 0)throw Error(a(407));l=l()}else l=i();var j=!En((ut||h).memoizedState,l);if(j&&(h.memoizedState=l,qt=!0),h=h.queue,wf(vy.bind(null,d,h,s),[s]),h.getSnapshot!==i||j||Bt!==null&&Bt.memoizedState.tag&1){if(d.flags|=2048,cr(9,{destroy:void 0},yy.bind(null,d,h,l,i),null),mt===null)throw Error(a(349));g||(Ds&127)!==0||gy(d,i,l)}return l}function gy(s,i,l){s.flags|=16384,s={getSnapshot:i,value:l},i=Oe.updateQueue,i===null?(i=nc(),Oe.updateQueue=i,i.stores=[s]):(l=i.stores,l===null?i.stores=[s]:l.push(s))}function yy(s,i,l,d){i.value=l,i.getSnapshot=d,xy(i)&&by(s)}function vy(s,i,l){return l(function(){xy(i)&&by(s)})}function xy(s){var i=s.getSnapshot;s=s.value;try{var l=i();return!En(s,l)}catch{return!0}}function by(s){var i=Ji(s,2);i!==null&&jn(i,s,2)}function Sf(s){var i=un();if(typeof s=="function"){var l=s;if(s=l(),ra){gn(!0);try{l()}finally{gn(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:s},i}function Sy(s,i,l,d){return s.baseState=l,xf(s,ut,typeof d=="function"?d:Ls)}function Q1(s,i,l,d,h){if(oc(s))throw Error(a(485));if(s=i.action,s!==null){var g={payload:h,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){g.listeners.push(j)}};K.T!==null?l(!0):g.isTransition=!1,d(g),l=i.pending,l===null?(g.next=i.pending=g,jy(i,g)):(g.next=l.next,i.pending=l.next=g)}}function jy(s,i){var l=i.action,d=i.payload,h=s.state;if(i.isTransition){var g=K.T,j={};K.T=j;try{var _=l(h,d),M=K.S;M!==null&&M(j,_),wy(s,i,_)}catch(F){jf(s,i,F)}finally{g!==null&&j.types!==null&&(g.types=j.types),K.T=g}}else try{g=l(h,d),wy(s,i,g)}catch(F){jf(s,i,F)}}function wy(s,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){Ny(s,i,d)},function(d){return jf(s,i,d)}):Ny(s,i,l)}function Ny(s,i,l){i.status="fulfilled",i.value=l,Cy(i),s.state=l,i=s.pending,i!==null&&(l=i.next,l===i?s.pending=null:(l=l.next,i.next=l,jy(s,l)))}function jf(s,i,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,Cy(i),i=i.next;while(i!==d)}s.action=null}function Cy(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function ky(s,i){return i}function zy(s,i){if(Ve){var l=mt.formState;if(l!==null){e:{var d=Oe;if(Ve){if(yt){t:{for(var h=yt,g=Kn;h.nodeType!==8;){if(!g){h=null;break t}if(h=Gn(h.nextSibling),h===null){h=null;break t}}g=h.data,h=g==="F!"||g==="F"?h:null}if(h){yt=Gn(h.nextSibling),d=h.data==="F!";break e}}si(d)}d=!1}d&&(i=l[0])}}return l=un(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ky,lastRenderedState:i},l.queue=d,l=Fy.bind(null,Oe,d),d.dispatch=l,d=Sf(!1),g=_f.bind(null,Oe,!1,d.queue),d=un(),h={state:i,dispatch:null,action:s,pending:null},d.queue=h,l=Q1.bind(null,Oe,h,g,l),h.dispatch=l,d.memoizedState=s,[i,l,!1]}function _y(s){var i=Lt();return Ey(i,ut,s)}function Ey(s,i,l){if(i=xf(s,i,ky)[0],s=ic(Ls)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=bo(i)}catch(j){throw j===ir?Vl:j}else d=i;i=Lt();var h=i.queue,g=h.dispatch;return l!==i.memoizedState&&(Oe.flags|=2048,cr(9,{destroy:void 0},Y1.bind(null,h,l),null)),[d,g,s]}function Y1(s,i){s.action=i}function Ry(s){var i=Lt(),l=ut;if(l!==null)return Ey(i,l,s);Lt(),i=i.memoizedState,l=Lt();var d=l.queue.dispatch;return l.memoizedState=s,[i,d,!1]}function cr(s,i,l,d){return s={tag:s,create:l,deps:d,inst:i,next:null},i=Oe.updateQueue,i===null&&(i=nc(),Oe.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,i.lastEffect=s),s}function Ay(){return Lt().memoizedState}function ac(s,i,l,d){var h=un();Oe.flags|=s,h.memoizedState=cr(1|i,{destroy:void 0},l,d===void 0?null:d)}function rc(s,i,l,d){var h=Lt();d=d===void 0?null:d;var g=h.memoizedState.inst;ut!==null&&d!==null&&hf(d,ut.memoizedState.deps)?h.memoizedState=cr(i,g,l,d):(Oe.flags|=s,h.memoizedState=cr(1|i,g,l,d))}function Ty(s,i){ac(8390656,8,s,i)}function wf(s,i){rc(2048,8,s,i)}function J1(s){Oe.flags|=4;var i=Oe.updateQueue;if(i===null)i=nc(),Oe.updateQueue=i,i.events=[s];else{var l=i.events;l===null?i.events=[s]:l.push(s)}}function Oy(s){var i=Lt().memoizedState;return J1({ref:i,nextImpl:s}),function(){if((nt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function Dy(s,i){return rc(4,2,s,i)}function Ly(s,i){return rc(4,4,s,i)}function My(s,i){if(typeof i=="function"){s=s();var l=i(s);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function $y(s,i,l){l=l!=null?l.concat([s]):null,rc(4,4,My.bind(null,i,s),l)}function Nf(){}function Py(s,i){var l=Lt();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&hf(i,d[1])?d[0]:(l.memoizedState=[s,i],s)}function Uy(s,i){var l=Lt();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&hf(i,d[1]))return d[0];if(d=s(),ra){gn(!0);try{s()}finally{gn(!1)}}return l.memoizedState=[d,i],d}function Cf(s,i,l){return l===void 0||(Ds&1073741824)!==0&&(He&261930)===0?s.memoizedState=i:(s.memoizedState=l,s=I0(),Oe.lanes|=s,fi|=s,l)}function Iy(s,i,l,d){return En(l,i)?l:rr.current!==null?(s=Cf(s,l,d),En(s,i)||(qt=!0),s):(Ds&42)===0||(Ds&1073741824)!==0&&(He&261930)===0?(qt=!0,s.memoizedState=l):(s=I0(),Oe.lanes|=s,fi|=s,i)}function By(s,i,l,d,h){var g=ae.p;ae.p=g!==0&&8>g?g:8;var j=K.T,_={};K.T=_,_f(s,!1,i,l);try{var M=h(),F=K.S;if(F!==null&&F(_,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var W=F1(M,d);So(s,i,W,Ln(s))}else So(s,i,d,Ln(s))}catch(ie){So(s,i,{then:function(){},status:"rejected",reason:ie},Ln())}finally{ae.p=g,j!==null&&_.types!==null&&(j.types=_.types),K.T=j}}function X1(){}function kf(s,i,l,d){if(s.tag!==5)throw Error(a(476));var h=qy(s).queue;By(s,h,i,pe,l===null?X1:function(){return Ky(s),l(d)})}function qy(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:pe},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ls,lastRenderedState:l},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function Ky(s){var i=qy(s);i.next===null&&(i=s.alternate.memoizedState),So(s,i.next.queue,{},Ln())}function zf(){return Xt(Po)}function Hy(){return Lt().memoizedState}function Gy(){return Lt().memoizedState}function W1(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var l=Ln();s=ri(l);var d=oi(i,s,l);d!==null&&(jn(d,i,l),go(d,i,l)),i={cache:tf()},s.payload=i;return}i=i.return}}function eC(s,i,l){var d=Ln();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},oc(s)?Zy(i,l):(l=Hd(s,i,l,d),l!==null&&(jn(l,s,d),Vy(l,i,d)))}function Fy(s,i,l){var d=Ln();So(s,i,l,d)}function So(s,i,l,d){var h={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(oc(s))Zy(i,h);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=i.lastRenderedReducer,g!==null))try{var j=i.lastRenderedState,_=g(j,l);if(h.hasEagerState=!0,h.eagerState=_,En(_,j))return Bl(s,i,h,0),mt===null&&Il(),!1}catch{}if(l=Hd(s,i,h,d),l!==null)return jn(l,s,d),Vy(l,i,d),!0}return!1}function _f(s,i,l,d){if(d={lane:2,revertLane:rh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},oc(s)){if(i)throw Error(a(479))}else i=Hd(s,l,d,2),i!==null&&jn(i,s,2)}function oc(s){var i=s.alternate;return s===Oe||i!==null&&i===Oe}function Zy(s,i){or=ec=!0;var l=s.pending;l===null?i.next=i:(i.next=l.next,l.next=i),s.pending=i}function Vy(s,i,l){if((l&4194048)!==0){var d=i.lanes;d&=s.pendingLanes,l|=d,i.lanes=l,fe(s,l)}}var jo={readContext:Xt,use:sc,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useInsertionEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useSyncExternalStore:Rt,useId:Rt,useHostTransitionStatus:Rt,useFormState:Rt,useActionState:Rt,useOptimistic:Rt,useMemoCache:Rt,useCacheRefresh:Rt};jo.useEffectEvent=Rt;var Qy={readContext:Xt,use:sc,useCallback:function(s,i){return un().memoizedState=[s,i===void 0?null:i],s},useContext:Xt,useEffect:Ty,useImperativeHandle:function(s,i,l){l=l!=null?l.concat([s]):null,ac(4194308,4,My.bind(null,i,s),l)},useLayoutEffect:function(s,i){return ac(4194308,4,s,i)},useInsertionEffect:function(s,i){ac(4,2,s,i)},useMemo:function(s,i){var l=un();i=i===void 0?null:i;var d=s();if(ra){gn(!0);try{s()}finally{gn(!1)}}return l.memoizedState=[d,i],d},useReducer:function(s,i,l){var d=un();if(l!==void 0){var h=l(i);if(ra){gn(!0);try{l(i)}finally{gn(!1)}}}else h=i;return d.memoizedState=d.baseState=h,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:h},d.queue=s,s=s.dispatch=eC.bind(null,Oe,s),[d.memoizedState,s]},useRef:function(s){var i=un();return s={current:s},i.memoizedState=s},useState:function(s){s=Sf(s);var i=s.queue,l=Fy.bind(null,Oe,i);return i.dispatch=l,[s.memoizedState,l]},useDebugValue:Nf,useDeferredValue:function(s,i){var l=un();return Cf(l,s,i)},useTransition:function(){var s=Sf(!1);return s=By.bind(null,Oe,s.queue,!0,!1),un().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,l){var d=Oe,h=un();if(Ve){if(l===void 0)throw Error(a(407));l=l()}else{if(l=i(),mt===null)throw Error(a(349));(He&127)!==0||gy(d,i,l)}h.memoizedState=l;var g={value:l,getSnapshot:i};return h.queue=g,Ty(vy.bind(null,d,g,s),[s]),d.flags|=2048,cr(9,{destroy:void 0},yy.bind(null,d,g,l,i),null),l},useId:function(){var s=un(),i=mt.identifierPrefix;if(Ve){var l=xs,d=vs;l=(d&~(1<<32-ce(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=tc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=Z1++,i="_"+i+"r_"+l.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:zf,useFormState:zy,useActionState:zy,useOptimistic:function(s){var i=un();i.memoizedState=i.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=_f.bind(null,Oe,!0,l),l.dispatch=i,[s,i]},useMemoCache:vf,useCacheRefresh:function(){return un().memoizedState=W1.bind(null,Oe)},useEffectEvent:function(s){var i=un(),l={impl:s};return i.memoizedState=l,function(){if((nt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},Ef={readContext:Xt,use:sc,useCallback:Py,useContext:Xt,useEffect:wf,useImperativeHandle:$y,useInsertionEffect:Dy,useLayoutEffect:Ly,useMemo:Uy,useReducer:ic,useRef:Ay,useState:function(){return ic(Ls)},useDebugValue:Nf,useDeferredValue:function(s,i){var l=Lt();return Iy(l,ut.memoizedState,s,i)},useTransition:function(){var s=ic(Ls)[0],i=Lt().memoizedState;return[typeof s=="boolean"?s:bo(s),i]},useSyncExternalStore:py,useId:Hy,useHostTransitionStatus:zf,useFormState:_y,useActionState:_y,useOptimistic:function(s,i){var l=Lt();return Sy(l,ut,s,i)},useMemoCache:vf,useCacheRefresh:Gy};Ef.useEffectEvent=Oy;var Yy={readContext:Xt,use:sc,useCallback:Py,useContext:Xt,useEffect:wf,useImperativeHandle:$y,useInsertionEffect:Dy,useLayoutEffect:Ly,useMemo:Uy,useReducer:bf,useRef:Ay,useState:function(){return bf(Ls)},useDebugValue:Nf,useDeferredValue:function(s,i){var l=Lt();return ut===null?Cf(l,s,i):Iy(l,ut.memoizedState,s,i)},useTransition:function(){var s=bf(Ls)[0],i=Lt().memoizedState;return[typeof s=="boolean"?s:bo(s),i]},useSyncExternalStore:py,useId:Hy,useHostTransitionStatus:zf,useFormState:Ry,useActionState:Ry,useOptimistic:function(s,i){var l=Lt();return ut!==null?Sy(l,ut,s,i):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:vf,useCacheRefresh:Gy};Yy.useEffectEvent=Oy;function Rf(s,i,l,d){i=s.memoizedState,l=l(d,i),l=l==null?i:y({},i,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Af={enqueueSetState:function(s,i,l){s=s._reactInternals;var d=Ln(),h=ri(d);h.payload=i,l!=null&&(h.callback=l),i=oi(s,h,d),i!==null&&(jn(i,s,d),go(i,s,d))},enqueueReplaceState:function(s,i,l){s=s._reactInternals;var d=Ln(),h=ri(d);h.tag=1,h.payload=i,l!=null&&(h.callback=l),i=oi(s,h,d),i!==null&&(jn(i,s,d),go(i,s,d))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var l=Ln(),d=ri(l);d.tag=2,i!=null&&(d.callback=i),i=oi(s,d,l),i!==null&&(jn(i,s,l),go(i,s,l))}};function Jy(s,i,l,d,h,g,j){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,g,j):i.prototype&&i.prototype.isPureReactComponent?!oo(l,d)||!oo(h,g):!0}function Xy(s,i,l,d){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==s&&Af.enqueueReplaceState(i,i.state,null)}function oa(s,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(s=s.defaultProps){l===i&&(l=y({},l));for(var h in s)l[h]===void 0&&(l[h]=s[h])}return l}function Wy(s){Ul(s)}function e0(s){console.error(s)}function t0(s){Ul(s)}function lc(s,i){try{var l=s.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function n0(s,i,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Tf(s,i,l){return l=ri(l),l.tag=3,l.payload={element:null},l.callback=function(){lc(s,i)},l}function s0(s){return s=ri(s),s.tag=3,s}function i0(s,i,l,d){var h=l.type.getDerivedStateFromError;if(typeof h=="function"){var g=d.value;s.payload=function(){return h(g)},s.callback=function(){n0(i,l,d)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(s.callback=function(){n0(i,l,d),typeof h!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var _=d.stack;this.componentDidCatch(d.value,{componentStack:_!==null?_:""})})}function tC(s,i,l,d,h){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&tr(i,l,h,!0),l=An.current,l!==null){switch(l.tag){case 31:case 13:return Hn===null?bc():l.alternate===null&&At===0&&(At=3),l.flags&=-257,l.flags|=65536,l.lanes=h,d===Ql?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),sh(s,d,h)),!1;case 22:return l.flags|=65536,d===Ql?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),sh(s,d,h)),!1}throw Error(a(435,l.tag))}return sh(s,d,h),bc(),!1}if(Ve)return i=An.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,d!==Yd&&(s=Error(a(422),{cause:d}),uo(In(s,l)))):(d!==Yd&&(i=Error(a(423),{cause:d}),uo(In(i,l))),s=s.current.alternate,s.flags|=65536,h&=-h,s.lanes|=h,d=In(d,l),h=Tf(s.stateNode,d,h),lf(s,h),At!==4&&(At=2)),!1;var g=Error(a(520),{cause:d});if(g=In(g,l),Ro===null?Ro=[g]:Ro.push(g),At!==4&&(At=2),i===null)return!0;d=In(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,s=h&-h,l.lanes|=s,s=Tf(l.stateNode,d,s),lf(l,s),!1;case 1:if(i=l.type,g=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(hi===null||!hi.has(g))))return l.flags|=65536,h&=-h,l.lanes|=h,h=s0(h),i0(h,s,l,d),lf(l,h),!1}l=l.return}while(l!==null);return!1}var Of=Error(a(461)),qt=!1;function Wt(s,i,l,d){i.child=s===null?ly(i,null,l,d):aa(i,s.child,l,d)}function a0(s,i,l,d,h){l=l.render;var g=i.ref;if("ref"in d){var j={};for(var _ in d)_!=="ref"&&(j[_]=d[_])}else j=d;return ta(i),d=mf(s,i,l,j,g,h),_=pf(),s!==null&&!qt?(gf(s,i,h),Ms(s,i,h)):(Ve&&_&&Vd(i),i.flags|=1,Wt(s,i,d,h),i.child)}function r0(s,i,l,d,h){if(s===null){var g=l.type;return typeof g=="function"&&!Gd(g)&&g.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=g,o0(s,i,g,d,h)):(s=Kl(l.type,null,d,i,i.mode,h),s.ref=i.ref,s.return=i,i.child=s)}if(g=s.child,!Bf(s,h)){var j=g.memoizedProps;if(l=l.compare,l=l!==null?l:oo,l(j,d)&&s.ref===i.ref)return Ms(s,i,h)}return i.flags|=1,s=Rs(g,d),s.ref=i.ref,s.return=i,i.child=s}function o0(s,i,l,d,h){if(s!==null){var g=s.memoizedProps;if(oo(g,d)&&s.ref===i.ref)if(qt=!1,i.pendingProps=d=g,Bf(s,h))(s.flags&131072)!==0&&(qt=!0);else return i.lanes=s.lanes,Ms(s,i,h)}return Df(s,i,l,d,h)}function l0(s,i,l,d){var h=d.children,g=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(g=g!==null?g.baseLanes|l:l,s!==null){for(d=i.child=s.child,h=0;d!==null;)h=h|d.lanes|d.childLanes,d=d.sibling;d=h&~g}else d=0,i.child=null;return c0(s,i,g,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Zl(i,g!==null?g.cachePool:null),g!==null?dy(i,g):uf(),fy(i);else return d=i.lanes=536870912,c0(s,i,g!==null?g.baseLanes|l:l,l,d)}else g!==null?(Zl(i,g.cachePool),dy(i,g),ci(),i.memoizedState=null):(s!==null&&Zl(i,null),uf(),ci());return Wt(s,i,h,l),i.child}function wo(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function c0(s,i,l,d,h){var g=sf();return g=g===null?null:{parent:It._currentValue,pool:g},i.memoizedState={baseLanes:l,cachePool:g},s!==null&&Zl(i,null),uf(),fy(i),s!==null&&tr(s,i,d,!0),i.childLanes=h,null}function cc(s,i){return i=dc({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function u0(s,i,l){return aa(i,s.child,null,l),s=cc(i,i.pendingProps),s.flags|=2,Tn(i),i.memoizedState=null,s}function nC(s,i,l){var d=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(Ve){if(d.mode==="hidden")return s=cc(i,d),i.lanes=536870912,wo(null,s);if(ff(i),(s=yt)?(s=jv(s,Kn),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:ti!==null?{id:vs,overflow:xs}:null,retryLane:536870912,hydrationErrors:null},l=Zg(s),l.return=i,i.child=l,Jt=i,yt=null)):s=null,s===null)throw si(i);return i.lanes=536870912,null}return cc(i,d)}var g=s.memoizedState;if(g!==null){var j=g.dehydrated;if(ff(i),h)if(i.flags&256)i.flags&=-257,i=u0(s,i,l);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(a(558));else if(qt||tr(s,i,l,!1),h=(l&s.childLanes)!==0,qt||h){if(d=mt,d!==null&&(j=xt(d,l),j!==0&&j!==g.retryLane))throw g.retryLane=j,Ji(s,j),jn(d,s,j),Of;bc(),i=u0(s,i,l)}else s=g.treeContext,yt=Gn(j.nextSibling),Jt=i,Ve=!0,ni=null,Kn=!1,s!==null&&Yg(i,s),i=cc(i,d),i.flags|=4096;return i}return s=Rs(s.child,{mode:d.mode,children:d.children}),s.ref=i.ref,i.child=s,s.return=i,s}function uc(s,i){var l=i.ref;if(l===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(s===null||s.ref!==l)&&(i.flags|=4194816)}}function Df(s,i,l,d,h){return ta(i),l=mf(s,i,l,d,void 0,h),d=pf(),s!==null&&!qt?(gf(s,i,h),Ms(s,i,h)):(Ve&&d&&Vd(i),i.flags|=1,Wt(s,i,l,h),i.child)}function d0(s,i,l,d,h,g){return ta(i),i.updateQueue=null,l=my(i,d,l,h),hy(s),d=pf(),s!==null&&!qt?(gf(s,i,g),Ms(s,i,g)):(Ve&&d&&Vd(i),i.flags|=1,Wt(s,i,l,g),i.child)}function f0(s,i,l,d,h){if(ta(i),i.stateNode===null){var g=Ja,j=l.contextType;typeof j=="object"&&j!==null&&(g=Xt(j)),g=new l(d,g),i.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Af,i.stateNode=g,g._reactInternals=i,g=i.stateNode,g.props=d,g.state=i.memoizedState,g.refs={},rf(i),j=l.contextType,g.context=typeof j=="object"&&j!==null?Xt(j):Ja,g.state=i.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(Rf(i,l,j,d),g.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(j=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),j!==g.state&&Af.enqueueReplaceState(g,g.state,null),vo(i,d,g,h),yo(),g.state=i.memoizedState),typeof g.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(s===null){g=i.stateNode;var _=i.memoizedProps,M=oa(l,_);g.props=M;var F=g.context,W=l.contextType;j=Ja,typeof W=="object"&&W!==null&&(j=Xt(W));var ie=l.getDerivedStateFromProps;W=typeof ie=="function"||typeof g.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,W||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(_||F!==j)&&Xy(i,g,d,j),ai=!1;var Z=i.memoizedState;g.state=Z,vo(i,d,g,h),yo(),F=i.memoizedState,_||Z!==F||ai?(typeof ie=="function"&&(Rf(i,l,ie,d),F=i.memoizedState),(M=ai||Jy(i,l,M,d,Z,F,j))?(W||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(i.flags|=4194308)):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=F),g.props=d,g.state=F,g.context=j,d=M):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{g=i.stateNode,of(s,i),j=i.memoizedProps,W=oa(l,j),g.props=W,ie=i.pendingProps,Z=g.context,F=l.contextType,M=Ja,typeof F=="object"&&F!==null&&(M=Xt(F)),_=l.getDerivedStateFromProps,(F=typeof _=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j!==ie||Z!==M)&&Xy(i,g,d,M),ai=!1,Z=i.memoizedState,g.state=Z,vo(i,d,g,h),yo();var Q=i.memoizedState;j!==ie||Z!==Q||ai||s!==null&&s.dependencies!==null&&Gl(s.dependencies)?(typeof _=="function"&&(Rf(i,l,_,d),Q=i.memoizedState),(W=ai||Jy(i,l,W,d,Z,Q,M)||s!==null&&s.dependencies!==null&&Gl(s.dependencies))?(F||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(d,Q,M),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(d,Q,M)),typeof g.componentDidUpdate=="function"&&(i.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof g.componentDidUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=Q),g.props=d,g.state=Q,g.context=M,d=W):(typeof g.componentDidUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=1024),d=!1)}return g=d,uc(s,i),d=(i.flags&128)!==0,g||d?(g=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:g.render(),i.flags|=1,s!==null&&d?(i.child=aa(i,s.child,null,h),i.child=aa(i,null,l,h)):Wt(s,i,l,h),i.memoizedState=g.state,s=i.child):s=Ms(s,i,h),s}function h0(s,i,l,d){return Wi(),i.flags|=256,Wt(s,i,l,d),i.child}var Lf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mf(s){return{baseLanes:s,cachePool:ny()}}function $f(s,i,l){return s=s!==null?s.childLanes&~l:0,i&&(s|=Dn),s}function m0(s,i,l){var d=i.pendingProps,h=!1,g=(i.flags&128)!==0,j;if((j=g)||(j=s!==null&&s.memoizedState===null?!1:(Dt.current&2)!==0),j&&(h=!0,i.flags&=-129),j=(i.flags&32)!==0,i.flags&=-33,s===null){if(Ve){if(h?li(i):ci(),(s=yt)?(s=jv(s,Kn),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:ti!==null?{id:vs,overflow:xs}:null,retryLane:536870912,hydrationErrors:null},l=Zg(s),l.return=i,i.child=l,Jt=i,yt=null)):s=null,s===null)throw si(i);return xh(s)?i.lanes=32:i.lanes=536870912,null}var _=d.children;return d=d.fallback,h?(ci(),h=i.mode,_=dc({mode:"hidden",children:_},h),d=Xi(d,h,l,null),_.return=i,d.return=i,_.sibling=d,i.child=_,d=i.child,d.memoizedState=Mf(l),d.childLanes=$f(s,j,l),i.memoizedState=Lf,wo(null,d)):(li(i),Pf(i,_))}var M=s.memoizedState;if(M!==null&&(_=M.dehydrated,_!==null)){if(g)i.flags&256?(li(i),i.flags&=-257,i=Uf(s,i,l)):i.memoizedState!==null?(ci(),i.child=s.child,i.flags|=128,i=null):(ci(),_=d.fallback,h=i.mode,d=dc({mode:"visible",children:d.children},h),_=Xi(_,h,l,null),_.flags|=2,d.return=i,_.return=i,d.sibling=_,i.child=d,aa(i,s.child,null,l),d=i.child,d.memoizedState=Mf(l),d.childLanes=$f(s,j,l),i.memoizedState=Lf,i=wo(null,d));else if(li(i),xh(_)){if(j=_.nextSibling&&_.nextSibling.dataset,j)var F=j.dgst;j=F,d=Error(a(419)),d.stack="",d.digest=j,uo({value:d,source:null,stack:null}),i=Uf(s,i,l)}else if(qt||tr(s,i,l,!1),j=(l&s.childLanes)!==0,qt||j){if(j=mt,j!==null&&(d=xt(j,l),d!==0&&d!==M.retryLane))throw M.retryLane=d,Ji(s,d),jn(j,s,d),Of;vh(_)||bc(),i=Uf(s,i,l)}else vh(_)?(i.flags|=192,i.child=s.child,i=null):(s=M.treeContext,yt=Gn(_.nextSibling),Jt=i,Ve=!0,ni=null,Kn=!1,s!==null&&Yg(i,s),i=Pf(i,d.children),i.flags|=4096);return i}return h?(ci(),_=d.fallback,h=i.mode,M=s.child,F=M.sibling,d=Rs(M,{mode:"hidden",children:d.children}),d.subtreeFlags=M.subtreeFlags&65011712,F!==null?_=Rs(F,_):(_=Xi(_,h,l,null),_.flags|=2),_.return=i,d.return=i,d.sibling=_,i.child=d,wo(null,d),d=i.child,_=s.child.memoizedState,_===null?_=Mf(l):(h=_.cachePool,h!==null?(M=It._currentValue,h=h.parent!==M?{parent:M,pool:M}:h):h=ny(),_={baseLanes:_.baseLanes|l,cachePool:h}),d.memoizedState=_,d.childLanes=$f(s,j,l),i.memoizedState=Lf,wo(s.child,d)):(li(i),l=s.child,s=l.sibling,l=Rs(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,s!==null&&(j=i.deletions,j===null?(i.deletions=[s],i.flags|=16):j.push(s)),i.child=l,i.memoizedState=null,l)}function Pf(s,i){return i=dc({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function dc(s,i){return s=Rn(22,s,null,i),s.lanes=0,s}function Uf(s,i,l){return aa(i,s.child,null,l),s=Pf(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function p0(s,i,l){s.lanes|=i;var d=s.alternate;d!==null&&(d.lanes|=i),Wd(s.return,i,l)}function If(s,i,l,d,h,g){var j=s.memoizedState;j===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:h,treeForkCount:g}:(j.isBackwards=i,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=l,j.tailMode=h,j.treeForkCount=g)}function g0(s,i,l){var d=i.pendingProps,h=d.revealOrder,g=d.tail;d=d.children;var j=Dt.current,_=(j&2)!==0;if(_?(j=j&1|2,i.flags|=128):j&=1,J(Dt,j),Wt(s,i,d,l),d=Ve?co:0,!_&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&p0(s,l,i);else if(s.tag===19)p0(s,l,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(h){case"forwards":for(l=i.child,h=null;l!==null;)s=l.alternate,s!==null&&Wl(s)===null&&(h=l),l=l.sibling;l=h,l===null?(h=i.child,i.child=null):(h=l.sibling,l.sibling=null),If(i,!1,h,l,g,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,h=i.child,i.child=null;h!==null;){if(s=h.alternate,s!==null&&Wl(s)===null){i.child=h;break}s=h.sibling,h.sibling=l,l=h,h=s}If(i,!0,l,null,g,d);break;case"together":If(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ms(s,i,l){if(s!==null&&(i.dependencies=s.dependencies),fi|=i.lanes,(l&i.childLanes)===0)if(s!==null){if(tr(s,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(a(153));if(i.child!==null){for(s=i.child,l=Rs(s,s.pendingProps),i.child=l,l.return=i;s.sibling!==null;)s=s.sibling,l=l.sibling=Rs(s,s.pendingProps),l.return=i;l.sibling=null}return i.child}function Bf(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Gl(s)))}function sC(s,i,l){switch(i.tag){case 3:we(i,i.stateNode.containerInfo),ii(i,It,s.memoizedState.cache),Wi();break;case 27:case 5:Ie(i);break;case 4:we(i,i.stateNode.containerInfo);break;case 10:ii(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,ff(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(li(i),i.flags|=128,null):(l&i.child.childLanes)!==0?m0(s,i,l):(li(i),s=Ms(s,i,l),s!==null?s.sibling:null);li(i);break;case 19:var h=(s.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(tr(s,i,l,!1),d=(l&i.childLanes)!==0),h){if(d)return g0(s,i,l);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),J(Dt,Dt.current),d)break;return null;case 22:return i.lanes=0,l0(s,i,l,i.pendingProps);case 24:ii(i,It,s.memoizedState.cache)}return Ms(s,i,l)}function y0(s,i,l){if(s!==null)if(s.memoizedProps!==i.pendingProps)qt=!0;else{if(!Bf(s,l)&&(i.flags&128)===0)return qt=!1,sC(s,i,l);qt=(s.flags&131072)!==0}else qt=!1,Ve&&(i.flags&1048576)!==0&&Qg(i,co,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(s=sa(i.elementType),i.type=s,typeof s=="function")Gd(s)?(d=oa(s,d),i.tag=1,i=f0(null,i,s,d,l)):(i.tag=0,i=Df(null,i,s,d,l));else{if(s!=null){var h=s.$$typeof;if(h===z){i.tag=11,i=a0(null,i,s,d,l);break e}else if(h===E){i.tag=14,i=r0(null,i,s,d,l);break e}}throw i=_e(s)||s,Error(a(306,i,""))}}return i;case 0:return Df(s,i,i.type,i.pendingProps,l);case 1:return d=i.type,h=oa(d,i.pendingProps),f0(s,i,d,h,l);case 3:e:{if(we(i,i.stateNode.containerInfo),s===null)throw Error(a(387));d=i.pendingProps;var g=i.memoizedState;h=g.element,of(s,i),vo(i,d,null,l);var j=i.memoizedState;if(d=j.cache,ii(i,It,d),d!==g.cache&&ef(i,[It],l,!0),yo(),d=j.element,g.isDehydrated)if(g={element:d,isDehydrated:!1,cache:j.cache},i.updateQueue.baseState=g,i.memoizedState=g,i.flags&256){i=h0(s,i,d,l);break e}else if(d!==h){h=In(Error(a(424)),i),uo(h),i=h0(s,i,d,l);break e}else for(s=i.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,yt=Gn(s.firstChild),Jt=i,Ve=!0,ni=null,Kn=!0,l=ly(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Wi(),d===h){i=Ms(s,i,l);break e}Wt(s,i,d,l)}i=i.child}return i;case 26:return uc(s,i),s===null?(l=_v(i.type,null,i.pendingProps,null))?i.memoizedState=l:Ve||(l=i.type,s=i.pendingProps,d=zc(he.current).createElement(l),d[it]=i,d[sn]=s,en(d,l,s),at(d),i.stateNode=d):i.memoizedState=_v(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return Ie(i),s===null&&Ve&&(d=i.stateNode=Cv(i.type,i.pendingProps,he.current),Jt=i,Kn=!0,h=yt,yi(i.type)?(bh=h,yt=Gn(d.firstChild)):yt=h),Wt(s,i,i.pendingProps.children,l),uc(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&Ve&&((h=d=yt)&&(d=OC(d,i.type,i.pendingProps,Kn),d!==null?(i.stateNode=d,Jt=i,yt=Gn(d.firstChild),Kn=!1,h=!0):h=!1),h||si(i)),Ie(i),h=i.type,g=i.pendingProps,j=s!==null?s.memoizedProps:null,d=g.children,ph(h,g)?d=null:j!==null&&ph(h,j)&&(i.flags|=32),i.memoizedState!==null&&(h=mf(s,i,V1,null,null,l),Po._currentValue=h),uc(s,i),Wt(s,i,d,l),i.child;case 6:return s===null&&Ve&&((s=l=yt)&&(l=DC(l,i.pendingProps,Kn),l!==null?(i.stateNode=l,Jt=i,yt=null,s=!0):s=!1),s||si(i)),null;case 13:return m0(s,i,l);case 4:return we(i,i.stateNode.containerInfo),d=i.pendingProps,s===null?i.child=aa(i,null,d,l):Wt(s,i,d,l),i.child;case 11:return a0(s,i,i.type,i.pendingProps,l);case 7:return Wt(s,i,i.pendingProps,l),i.child;case 8:return Wt(s,i,i.pendingProps.children,l),i.child;case 12:return Wt(s,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,ii(i,i.type,d.value),Wt(s,i,d.children,l),i.child;case 9:return h=i.type._context,d=i.pendingProps.children,ta(i),h=Xt(h),d=d(h),i.flags|=1,Wt(s,i,d,l),i.child;case 14:return r0(s,i,i.type,i.pendingProps,l);case 15:return o0(s,i,i.type,i.pendingProps,l);case 19:return g0(s,i,l);case 31:return nC(s,i,l);case 22:return l0(s,i,l,i.pendingProps);case 24:return ta(i),d=Xt(It),s===null?(h=sf(),h===null&&(h=mt,g=tf(),h.pooledCache=g,g.refCount++,g!==null&&(h.pooledCacheLanes|=l),h=g),i.memoizedState={parent:d,cache:h},rf(i),ii(i,It,h)):((s.lanes&l)!==0&&(of(s,i),vo(i,null,null,l),yo()),h=s.memoizedState,g=i.memoizedState,h.parent!==d?(h={parent:d,cache:d},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),ii(i,It,d)):(d=g.cache,ii(i,It,d),d!==h.cache&&ef(i,[It],l,!0))),Wt(s,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function $s(s){s.flags|=4}function qf(s,i,l,d,h){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(h&335544128)===h)if(s.stateNode.complete)s.flags|=8192;else if(H0())s.flags|=8192;else throw ia=Ql,af}else s.flags&=-16777217}function v0(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Ov(i))if(H0())s.flags|=8192;else throw ia=Ql,af}function fc(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?Cl():536870912,s.lanes|=i,hr|=i)}function No(s,i){if(!Ve)switch(s.tailMode){case"hidden":i=s.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function vt(s){var i=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(i)for(var h=s.child;h!==null;)l|=h.lanes|h.childLanes,d|=h.subtreeFlags&65011712,d|=h.flags&65011712,h.return=s,h=h.sibling;else for(h=s.child;h!==null;)l|=h.lanes|h.childLanes,d|=h.subtreeFlags,d|=h.flags,h.return=s,h=h.sibling;return s.subtreeFlags|=d,s.childLanes=l,i}function iC(s,i,l){var d=i.pendingProps;switch(Qd(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(i),null;case 1:return vt(i),null;case 3:return l=i.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Os(It),me(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(er(i)?$s(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Jd())),vt(i),null;case 26:var h=i.type,g=i.memoizedState;return s===null?($s(i),g!==null?(vt(i),v0(i,g)):(vt(i),qf(i,h,null,d,l))):g?g!==s.memoizedState?($s(i),vt(i),v0(i,g)):(vt(i),i.flags&=-16777217):(s=s.memoizedProps,s!==d&&$s(i),vt(i),qf(i,h,s,d,l)),null;case 27:if(Ye(i),l=he.current,h=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return vt(i),null}s=X.current,er(i)?Jg(i):(s=Cv(h,d,l),i.stateNode=s,$s(i))}return vt(i),null;case 5:if(Ye(i),h=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return vt(i),null}if(g=X.current,er(i))Jg(i);else{var j=zc(he.current);switch(g){case 1:g=j.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:g=j.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":g=j.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":g=j.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":g=j.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?g.multiple=!0:d.size&&(g.size=d.size);break;default:g=typeof d.is=="string"?j.createElement(h,{is:d.is}):j.createElement(h)}}g[it]=i,g[sn]=d;e:for(j=i.child;j!==null;){if(j.tag===5||j.tag===6)g.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===i)break e;for(;j.sibling===null;){if(j.return===null||j.return===i)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}i.stateNode=g;e:switch(en(g,h,d),h){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&$s(i)}}return vt(i),qf(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,l),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(s=he.current,er(i)){if(s=i.stateNode,l=i.memoizedProps,d=null,h=Jt,h!==null)switch(h.tag){case 27:case 5:d=h.memoizedProps}s[it]=i,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||mv(s.nodeValue,l)),s||si(i,!0)}else s=zc(s).createTextNode(d),s[it]=i,i.stateNode=s}return vt(i),null;case 31:if(l=i.memoizedState,s===null||s.memoizedState!==null){if(d=er(i),l!==null){if(s===null){if(!d)throw Error(a(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[it]=i}else Wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),s=!1}else l=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return i.flags&256?(Tn(i),i):(Tn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return vt(i),null;case 13:if(d=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(h=er(i),d!==null&&d.dehydrated!==null){if(s===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[it]=i}else Wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),h=!1}else h=Jd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Tn(i),i):(Tn(i),null)}return Tn(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=i.child,h=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(h=d.alternate.memoizedState.cachePool.pool),g=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(g=d.memoizedState.cachePool.pool),g!==h&&(d.flags|=2048)),l!==s&&l&&(i.child.flags|=8192),fc(i,i.updateQueue),vt(i),null);case 4:return me(),s===null&&uh(i.stateNode.containerInfo),vt(i),null;case 10:return Os(i.type),vt(i),null;case 19:if(L(Dt),d=i.memoizedState,d===null)return vt(i),null;if(h=(i.flags&128)!==0,g=d.rendering,g===null)if(h)No(d,!1);else{if(At!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(g=Wl(s),g!==null){for(i.flags|=128,No(d,!1),s=g.updateQueue,i.updateQueue=s,fc(i,s),i.subtreeFlags=0,s=l,l=i.child;l!==null;)Fg(l,s),l=l.sibling;return J(Dt,Dt.current&1|2),Ve&&As(i,d.treeForkCount),i.child}s=s.sibling}d.tail!==null&&Je()>yc&&(i.flags|=128,h=!0,No(d,!1),i.lanes=4194304)}else{if(!h)if(s=Wl(g),s!==null){if(i.flags|=128,h=!0,s=s.updateQueue,i.updateQueue=s,fc(i,s),No(d,!0),d.tail===null&&d.tailMode==="hidden"&&!g.alternate&&!Ve)return vt(i),null}else 2*Je()-d.renderingStartTime>yc&&l!==536870912&&(i.flags|=128,h=!0,No(d,!1),i.lanes=4194304);d.isBackwards?(g.sibling=i.child,i.child=g):(s=d.last,s!==null?s.sibling=g:i.child=g,d.last=g)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Je(),s.sibling=null,l=Dt.current,J(Dt,h?l&1|2:l&1),Ve&&As(i,d.treeForkCount),s):(vt(i),null);case 22:case 23:return Tn(i),df(),d=i.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(vt(i),i.subtreeFlags&6&&(i.flags|=8192)):vt(i),l=i.updateQueue,l!==null&&fc(i,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),s!==null&&L(na),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),Os(It),vt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function aC(s,i){switch(Qd(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Os(It),me(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Ye(i),null;case 31:if(i.memoizedState!==null){if(Tn(i),i.alternate===null)throw Error(a(340));Wi()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(Tn(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Wi()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return L(Dt),null;case 4:return me(),null;case 10:return Os(i.type),null;case 22:case 23:return Tn(i),df(),s!==null&&L(na),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Os(It),null;case 25:return null;default:return null}}function x0(s,i){switch(Qd(i),i.tag){case 3:Os(It),me();break;case 26:case 27:case 5:Ye(i);break;case 4:me();break;case 31:i.memoizedState!==null&&Tn(i);break;case 13:Tn(i);break;case 19:L(Dt);break;case 10:Os(i.type);break;case 22:case 23:Tn(i),df(),s!==null&&L(na);break;case 24:Os(It)}}function Co(s,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var h=d.next;l=h;do{if((l.tag&s)===s){d=void 0;var g=l.create,j=l.inst;d=g(),j.destroy=d}l=l.next}while(l!==h)}}catch(_){ot(i,i.return,_)}}function ui(s,i,l){try{var d=i.updateQueue,h=d!==null?d.lastEffect:null;if(h!==null){var g=h.next;d=g;do{if((d.tag&s)===s){var j=d.inst,_=j.destroy;if(_!==void 0){j.destroy=void 0,h=i;var M=l,F=_;try{F()}catch(W){ot(h,M,W)}}}d=d.next}while(d!==g)}}catch(W){ot(i,i.return,W)}}function b0(s){var i=s.updateQueue;if(i!==null){var l=s.stateNode;try{uy(i,l)}catch(d){ot(s,s.return,d)}}}function S0(s,i,l){l.props=oa(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){ot(s,i,d)}}function ko(s,i){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(h){ot(s,i,h)}}function bs(s,i){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(h){ot(s,i,h)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(h){ot(s,i,h)}else l.current=null}function j0(s){var i=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(h){ot(s,s.return,h)}}function Kf(s,i,l){try{var d=s.stateNode;zC(d,s.type,l,i),d[sn]=i}catch(h){ot(s,s.return,h)}}function w0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yi(s.type)||s.tag===4}function Hf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||w0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&yi(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Gf(s,i,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(s),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=_s));else if(d!==4&&(d===27&&yi(s.type)&&(l=s.stateNode,i=null),s=s.child,s!==null))for(Gf(s,i,l),s=s.sibling;s!==null;)Gf(s,i,l),s=s.sibling}function hc(s,i,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?l.insertBefore(s,i):l.appendChild(s);else if(d!==4&&(d===27&&yi(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(hc(s,i,l),s=s.sibling;s!==null;)hc(s,i,l),s=s.sibling}function N0(s){var i=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);en(i,d,l),i[it]=s,i[sn]=l}catch(g){ot(s,s.return,g)}}var Ps=!1,Kt=!1,Ff=!1,C0=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function rC(s,i){if(s=s.containerInfo,hh=Dc,s=$g(s),Pd(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var h=d.anchorOffset,g=d.focusNode;d=d.focusOffset;try{l.nodeType,g.nodeType}catch{l=null;break e}var j=0,_=-1,M=-1,F=0,W=0,ie=s,Z=null;t:for(;;){for(var Q;ie!==l||h!==0&&ie.nodeType!==3||(_=j+h),ie!==g||d!==0&&ie.nodeType!==3||(M=j+d),ie.nodeType===3&&(j+=ie.nodeValue.length),(Q=ie.firstChild)!==null;)Z=ie,ie=Q;for(;;){if(ie===s)break t;if(Z===l&&++F===h&&(_=j),Z===g&&++W===d&&(M=j),(Q=ie.nextSibling)!==null)break;ie=Z,Z=ie.parentNode}ie=Q}l=_===-1||M===-1?null:{start:_,end:M}}else l=null}l=l||{start:0,end:0}}else l=null;for(mh={focusedElem:s,selectionRange:l},Dc=!1,Yt=i;Yt!==null;)if(i=Yt,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Yt=s;else for(;Yt!==null;){switch(i=Yt,g=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)h=s[l],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,l=i,h=g.memoizedProps,g=g.memoizedState,d=l.stateNode;try{var Se=oa(l.type,h);s=d.getSnapshotBeforeUpdate(Se,g),d.__reactInternalSnapshotBeforeUpdate=s}catch(Re){ot(l,l.return,Re)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,l=s.nodeType,l===9)yh(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":yh(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(a(163))}if(s=i.sibling,s!==null){s.return=i.return,Yt=s;break}Yt=i.return}}function k0(s,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Is(s,l),d&4&&Co(5,l);break;case 1:if(Is(s,l),d&4)if(s=l.stateNode,i===null)try{s.componentDidMount()}catch(j){ot(l,l.return,j)}else{var h=oa(l.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(h,i,s.__reactInternalSnapshotBeforeUpdate)}catch(j){ot(l,l.return,j)}}d&64&&b0(l),d&512&&ko(l,l.return);break;case 3:if(Is(s,l),d&64&&(s=l.updateQueue,s!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{uy(s,i)}catch(j){ot(l,l.return,j)}}break;case 27:i===null&&d&4&&N0(l);case 26:case 5:Is(s,l),i===null&&d&4&&j0(l),d&512&&ko(l,l.return);break;case 12:Is(s,l);break;case 31:Is(s,l),d&4&&E0(s,l);break;case 13:Is(s,l),d&4&&R0(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=pC.bind(null,l),LC(s,l))));break;case 22:if(d=l.memoizedState!==null||Ps,!d){i=i!==null&&i.memoizedState!==null||Kt,h=Ps;var g=Kt;Ps=d,(Kt=i)&&!g?Bs(s,l,(l.subtreeFlags&8772)!==0):Is(s,l),Ps=h,Kt=g}break;case 30:break;default:Is(s,l)}}function z0(s){var i=s.alternate;i!==null&&(s.alternate=null,z0(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&Js(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var bt=null,vn=!1;function Us(s,i,l){for(l=l.child;l!==null;)_0(s,i,l),l=l.sibling}function _0(s,i,l){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(ns,l)}catch{}switch(l.tag){case 26:Kt||bs(l,i),Us(s,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Kt||bs(l,i);var d=bt,h=vn;yi(l.type)&&(bt=l.stateNode,vn=!1),Us(s,i,l),Lo(l.stateNode),bt=d,vn=h;break;case 5:Kt||bs(l,i);case 6:if(d=bt,h=vn,bt=null,Us(s,i,l),bt=d,vn=h,bt!==null)if(vn)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(l.stateNode)}catch(g){ot(l,i,g)}else try{bt.removeChild(l.stateNode)}catch(g){ot(l,i,g)}break;case 18:bt!==null&&(vn?(s=bt,bv(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Sr(s)):bv(bt,l.stateNode));break;case 4:d=bt,h=vn,bt=l.stateNode.containerInfo,vn=!0,Us(s,i,l),bt=d,vn=h;break;case 0:case 11:case 14:case 15:ui(2,l,i),Kt||ui(4,l,i),Us(s,i,l);break;case 1:Kt||(bs(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&S0(l,i,d)),Us(s,i,l);break;case 21:Us(s,i,l);break;case 22:Kt=(d=Kt)||l.memoizedState!==null,Us(s,i,l),Kt=d;break;default:Us(s,i,l)}}function E0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Sr(s)}catch(l){ot(i,i.return,l)}}}function R0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Sr(s)}catch(l){ot(i,i.return,l)}}function oC(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new C0),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new C0),i;default:throw Error(a(435,s.tag))}}function mc(s,i){var l=oC(s);i.forEach(function(d){if(!l.has(d)){l.add(d);var h=gC.bind(null,s,d);d.then(h,h)}})}function xn(s,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var h=l[d],g=s,j=i,_=j;e:for(;_!==null;){switch(_.tag){case 27:if(yi(_.type)){bt=_.stateNode,vn=!1;break e}break;case 5:bt=_.stateNode,vn=!1;break e;case 3:case 4:bt=_.stateNode.containerInfo,vn=!0;break e}_=_.return}if(bt===null)throw Error(a(160));_0(g,j,h),bt=null,vn=!1,g=h.alternate,g!==null&&(g.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)A0(i,s),i=i.sibling}var as=null;function A0(s,i){var l=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:xn(i,s),bn(s),d&4&&(ui(3,s,s.return),Co(3,s),ui(5,s,s.return));break;case 1:xn(i,s),bn(s),d&512&&(Kt||l===null||bs(l,l.return)),d&64&&Ps&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var h=as;if(xn(i,s),bn(s),d&512&&(Kt||l===null||bs(l,l.return)),d&4){var g=l!==null?l.memoizedState:null;if(d=s.memoizedState,l===null)if(d===null)if(s.stateNode===null){e:{d=s.type,l=s.memoizedProps,h=h.ownerDocument||h;t:switch(d){case"title":g=h.getElementsByTagName("title")[0],(!g||g[gs]||g[it]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=h.createElement(d),h.head.insertBefore(g,h.querySelector("head > title"))),en(g,d,l),g[it]=s,at(g),d=g;break e;case"link":var j=Av("link","href",h).get(d+(l.href||""));if(j){for(var _=0;_<j.length;_++)if(g=j[_],g.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&g.getAttribute("rel")===(l.rel==null?null:l.rel)&&g.getAttribute("title")===(l.title==null?null:l.title)&&g.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(_,1);break t}}g=h.createElement(d),en(g,d,l),h.head.appendChild(g);break;case"meta":if(j=Av("meta","content",h).get(d+(l.content||""))){for(_=0;_<j.length;_++)if(g=j[_],g.getAttribute("content")===(l.content==null?null:""+l.content)&&g.getAttribute("name")===(l.name==null?null:l.name)&&g.getAttribute("property")===(l.property==null?null:l.property)&&g.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&g.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(_,1);break t}}g=h.createElement(d),en(g,d,l),h.head.appendChild(g);break;default:throw Error(a(468,d))}g[it]=s,at(g),d=g}s.stateNode=d}else Tv(h,s.type,s.stateNode);else s.stateNode=Rv(h,d,s.memoizedProps);else g!==d?(g===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):g.count--,d===null?Tv(h,s.type,s.stateNode):Rv(h,d,s.memoizedProps)):d===null&&s.stateNode!==null&&Kf(s,s.memoizedProps,l.memoizedProps)}break;case 27:xn(i,s),bn(s),d&512&&(Kt||l===null||bs(l,l.return)),l!==null&&d&4&&Kf(s,s.memoizedProps,l.memoizedProps);break;case 5:if(xn(i,s),bn(s),d&512&&(Kt||l===null||bs(l,l.return)),s.flags&32){h=s.stateNode;try{Ha(h,"")}catch(Se){ot(s,s.return,Se)}}d&4&&s.stateNode!=null&&(h=s.memoizedProps,Kf(s,h,l!==null?l.memoizedProps:h)),d&1024&&(Ff=!0);break;case 6:if(xn(i,s),bn(s),d&4){if(s.stateNode===null)throw Error(a(162));d=s.memoizedProps,l=s.stateNode;try{l.nodeValue=d}catch(Se){ot(s,s.return,Se)}}break;case 3:if(Rc=null,h=as,as=_c(i.containerInfo),xn(i,s),as=h,bn(s),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Sr(i.containerInfo)}catch(Se){ot(s,s.return,Se)}Ff&&(Ff=!1,T0(s));break;case 4:d=as,as=_c(s.stateNode.containerInfo),xn(i,s),bn(s),as=d;break;case 12:xn(i,s),bn(s);break;case 31:xn(i,s),bn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,mc(s,d)));break;case 13:xn(i,s),bn(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(gc=Je()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,mc(s,d)));break;case 22:h=s.memoizedState!==null;var M=l!==null&&l.memoizedState!==null,F=Ps,W=Kt;if(Ps=F||h,Kt=W||M,xn(i,s),Kt=W,Ps=F,bn(s),d&8192)e:for(i=s.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(l===null||M||Ps||Kt||la(s)),l=null,i=s;;){if(i.tag===5||i.tag===26){if(l===null){M=l=i;try{if(g=M.stateNode,h)j=g.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{_=M.stateNode;var ie=M.memoizedProps.style,Z=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;_.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Se){ot(M,M.return,Se)}}}else if(i.tag===6){if(l===null){M=i;try{M.stateNode.nodeValue=h?"":M.memoizedProps}catch(Se){ot(M,M.return,Se)}}}else if(i.tag===18){if(l===null){M=i;try{var Q=M.stateNode;h?Sv(Q,!0):Sv(M.stateNode,!1)}catch(Se){ot(M,M.return,Se)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=s.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,mc(s,l))));break;case 19:xn(i,s),bn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,mc(s,d)));break;case 30:break;case 21:break;default:xn(i,s),bn(s)}}function bn(s){var i=s.flags;if(i&2){try{for(var l,d=s.return;d!==null;){if(w0(d)){l=d;break}d=d.return}if(l==null)throw Error(a(160));switch(l.tag){case 27:var h=l.stateNode,g=Hf(s);hc(s,g,h);break;case 5:var j=l.stateNode;l.flags&32&&(Ha(j,""),l.flags&=-33);var _=Hf(s);hc(s,_,j);break;case 3:case 4:var M=l.stateNode.containerInfo,F=Hf(s);Gf(s,F,M);break;default:throw Error(a(161))}}catch(W){ot(s,s.return,W)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function T0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;T0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Is(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)k0(s,i.alternate,i),i=i.sibling}function la(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:ui(4,i,i.return),la(i);break;case 1:bs(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&S0(i,i.return,l),la(i);break;case 27:Lo(i.stateNode);case 26:case 5:bs(i,i.return),la(i);break;case 22:i.memoizedState===null&&la(i);break;case 30:la(i);break;default:la(i)}s=s.sibling}}function Bs(s,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,h=s,g=i,j=g.flags;switch(g.tag){case 0:case 11:case 15:Bs(h,g,l),Co(4,g);break;case 1:if(Bs(h,g,l),d=g,h=d.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(F){ot(d,d.return,F)}if(d=g,h=d.updateQueue,h!==null){var _=d.stateNode;try{var M=h.shared.hiddenCallbacks;if(M!==null)for(h.shared.hiddenCallbacks=null,h=0;h<M.length;h++)cy(M[h],_)}catch(F){ot(d,d.return,F)}}l&&j&64&&b0(g),ko(g,g.return);break;case 27:N0(g);case 26:case 5:Bs(h,g,l),l&&d===null&&j&4&&j0(g),ko(g,g.return);break;case 12:Bs(h,g,l);break;case 31:Bs(h,g,l),l&&j&4&&E0(h,g);break;case 13:Bs(h,g,l),l&&j&4&&R0(h,g);break;case 22:g.memoizedState===null&&Bs(h,g,l),ko(g,g.return);break;case 30:break;default:Bs(h,g,l)}i=i.sibling}}function Zf(s,i){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&fo(l))}function Vf(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&fo(s))}function rs(s,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)O0(s,i,l,d),i=i.sibling}function O0(s,i,l,d){var h=i.flags;switch(i.tag){case 0:case 11:case 15:rs(s,i,l,d),h&2048&&Co(9,i);break;case 1:rs(s,i,l,d);break;case 3:rs(s,i,l,d),h&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&fo(s)));break;case 12:if(h&2048){rs(s,i,l,d),s=i.stateNode;try{var g=i.memoizedProps,j=g.id,_=g.onPostCommit;typeof _=="function"&&_(j,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(M){ot(i,i.return,M)}}else rs(s,i,l,d);break;case 31:rs(s,i,l,d);break;case 13:rs(s,i,l,d);break;case 23:break;case 22:g=i.stateNode,j=i.alternate,i.memoizedState!==null?g._visibility&2?rs(s,i,l,d):zo(s,i):g._visibility&2?rs(s,i,l,d):(g._visibility|=2,ur(s,i,l,d,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Zf(j,i);break;case 24:rs(s,i,l,d),h&2048&&Vf(i.alternate,i);break;default:rs(s,i,l,d)}}function ur(s,i,l,d,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var g=s,j=i,_=l,M=d,F=j.flags;switch(j.tag){case 0:case 11:case 15:ur(g,j,_,M,h),Co(8,j);break;case 23:break;case 22:var W=j.stateNode;j.memoizedState!==null?W._visibility&2?ur(g,j,_,M,h):zo(g,j):(W._visibility|=2,ur(g,j,_,M,h)),h&&F&2048&&Zf(j.alternate,j);break;case 24:ur(g,j,_,M,h),h&&F&2048&&Vf(j.alternate,j);break;default:ur(g,j,_,M,h)}i=i.sibling}}function zo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=s,d=i,h=d.flags;switch(d.tag){case 22:zo(l,d),h&2048&&Zf(d.alternate,d);break;case 24:zo(l,d),h&2048&&Vf(d.alternate,d);break;default:zo(l,d)}i=i.sibling}}var _o=8192;function dr(s,i,l){if(s.subtreeFlags&_o)for(s=s.child;s!==null;)D0(s,i,l),s=s.sibling}function D0(s,i,l){switch(s.tag){case 26:dr(s,i,l),s.flags&_o&&s.memoizedState!==null&&ZC(l,as,s.memoizedState,s.memoizedProps);break;case 5:dr(s,i,l);break;case 3:case 4:var d=as;as=_c(s.stateNode.containerInfo),dr(s,i,l),as=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=_o,_o=16777216,dr(s,i,l),_o=d):dr(s,i,l));break;default:dr(s,i,l)}}function L0(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Eo(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Yt=d,$0(d,s)}L0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)M0(s),s=s.sibling}function M0(s){switch(s.tag){case 0:case 11:case 15:Eo(s),s.flags&2048&&ui(9,s,s.return);break;case 3:Eo(s);break;case 12:Eo(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,pc(s)):Eo(s);break;default:Eo(s)}}function pc(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Yt=d,$0(d,s)}L0(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:ui(8,i,i.return),pc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,pc(i));break;default:pc(i)}s=s.sibling}}function $0(s,i){for(;Yt!==null;){var l=Yt;switch(l.tag){case 0:case 11:case 15:ui(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:fo(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,Yt=d;else e:for(l=s;Yt!==null;){d=Yt;var h=d.sibling,g=d.return;if(z0(d),d===l){Yt=null;break e}if(h!==null){h.return=g,Yt=h;break e}Yt=g}}}var lC={getCacheForType:function(s){var i=Xt(It),l=i.data.get(s);return l===void 0&&(l=s(),i.data.set(s,l)),l},cacheSignal:function(){return Xt(It).controller.signal}},cC=typeof WeakMap=="function"?WeakMap:Map,nt=0,mt=null,Be=null,He=0,rt=0,On=null,di=!1,fr=!1,Qf=!1,qs=0,At=0,fi=0,ca=0,Yf=0,Dn=0,hr=0,Ro=null,Sn=null,Jf=!1,gc=0,P0=0,yc=1/0,vc=null,hi=null,Ft=0,mi=null,mr=null,Ks=0,Xf=0,Wf=null,U0=null,Ao=0,eh=null;function Ln(){return(nt&2)!==0&&He!==0?He&-He:K.T!==null?rh():Ia()}function I0(){if(Dn===0)if((He&536870912)===0||Ve){var s=Pa;Pa<<=1,(Pa&3932160)===0&&(Pa=262144),Dn=s}else Dn=536870912;return s=An.current,s!==null&&(s.flags|=32),Dn}function jn(s,i,l){(s===mt&&(rt===2||rt===9)||s.cancelPendingCommit!==null)&&(pr(s,0),pi(s,He,Dn,!1)),Fi(s,l),((nt&2)===0||s!==mt)&&(s===mt&&((nt&2)===0&&(ca|=l),At===4&&pi(s,He,Dn,!1)),Ss(s))}function B0(s,i,l){if((nt&6)!==0)throw Error(a(327));var d=!l&&(i&127)===0&&(i&s.expiredLanes)===0||Ys(s,i),h=d?fC(s,i):nh(s,i,!0),g=d;do{if(h===0){fr&&!d&&pi(s,i,0,!1);break}else{if(l=s.current.alternate,g&&!uC(l)){h=nh(s,i,!1),g=!1;continue}if(h===2){if(g=i,s.errorRecoveryDisabledLanes&g)var j=0;else j=s.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){i=j;e:{var _=s;h=Ro;var M=_.current.memoizedState.isDehydrated;if(M&&(pr(_,j).flags|=256),j=nh(_,j,!1),j!==2){if(Qf&&!M){_.errorRecoveryDisabledLanes|=g,ca|=g,h=4;break e}g=Sn,Sn=h,g!==null&&(Sn===null?Sn=g:Sn.push.apply(Sn,g))}h=j}if(g=!1,h!==2)continue}}if(h===1){pr(s,0),pi(s,i,0,!0);break}e:{switch(d=s,g=h,g){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:pi(d,i,Dn,!di);break e;case 2:Sn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=gc+300-Je(),10<h)){if(pi(d,i,Dn,!di),Ua(d,0,!0)!==0)break e;Ks=i,d.timeoutHandle=vv(q0.bind(null,d,l,Sn,vc,Jf,i,Dn,ca,hr,di,g,"Throttled",-0,0),h);break e}q0(d,l,Sn,vc,Jf,i,Dn,ca,hr,di,g,null,-0,0)}}break}while(!0);Ss(s)}function q0(s,i,l,d,h,g,j,_,M,F,W,ie,Z,Q){if(s.timeoutHandle=-1,ie=i.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_s},D0(i,g,ie);var Se=(g&62914560)===g?gc-Je():(g&4194048)===g?P0-Je():0;if(Se=VC(ie,Se),Se!==null){Ks=g,s.cancelPendingCommit=Se(Y0.bind(null,s,i,g,l,d,h,j,_,M,W,ie,null,Z,Q)),pi(s,g,j,!F);return}}Y0(s,i,g,l,d,h,j,_,M)}function uC(s){for(var i=s;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var h=l[d],g=h.getSnapshot;h=h.value;try{if(!En(g(),h))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function pi(s,i,l,d){i&=~Yf,i&=~ca,s.suspendedLanes|=i,s.pingedLanes&=~i,d&&(s.warmLanes|=i),d=s.expirationTimes;for(var h=i;0<h;){var g=31-ce(h),j=1<<g;d[g]=-1,h&=~j}l!==0&&B(s,l,i)}function xc(){return(nt&6)===0?(To(0),!1):!0}function th(){if(Be!==null){if(rt===0)var s=Be.return;else s=Be,Ts=ea=null,yf(s),ar=null,mo=0,s=Be;for(;s!==null;)x0(s.alternate,s),s=s.return;Be=null}}function pr(s,i){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,RC(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Ks=0,th(),mt=s,Be=l=Rs(s.current,null),He=i,rt=0,On=null,di=!1,fr=Ys(s,i),Qf=!1,hr=Dn=Yf=ca=fi=At=0,Sn=Ro=null,Jf=!1,(i&8)!==0&&(i|=i&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=i;0<d;){var h=31-ce(d),g=1<<h;i|=s[h],d&=~g}return qs=i,Il(),l}function K0(s,i){Oe=null,K.H=jo,i===ir||i===Vl?(i=ay(),rt=3):i===af?(i=ay(),rt=4):rt=i===Of?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,On=i,Be===null&&(At=1,lc(s,In(i,s.current)))}function H0(){var s=An.current;return s===null?!0:(He&4194048)===He?Hn===null:(He&62914560)===He||(He&536870912)!==0?s===Hn:!1}function G0(){var s=K.H;return K.H=jo,s===null?jo:s}function F0(){var s=K.A;return K.A=lC,s}function bc(){At=4,di||(He&4194048)!==He&&An.current!==null||(fr=!0),(fi&134217727)===0&&(ca&134217727)===0||mt===null||pi(mt,He,Dn,!1)}function nh(s,i,l){var d=nt;nt|=2;var h=G0(),g=F0();(mt!==s||He!==i)&&(vc=null,pr(s,i)),i=!1;var j=At;e:do try{if(rt!==0&&Be!==null){var _=Be,M=On;switch(rt){case 8:th(),j=6;break e;case 3:case 2:case 9:case 6:An.current===null&&(i=!0);var F=rt;if(rt=0,On=null,gr(s,_,M,F),l&&fr){j=0;break e}break;default:F=rt,rt=0,On=null,gr(s,_,M,F)}}dC(),j=At;break}catch(W){K0(s,W)}while(!0);return i&&s.shellSuspendCounter++,Ts=ea=null,nt=d,K.H=h,K.A=g,Be===null&&(mt=null,He=0,Il()),j}function dC(){for(;Be!==null;)Z0(Be)}function fC(s,i){var l=nt;nt|=2;var d=G0(),h=F0();mt!==s||He!==i?(vc=null,yc=Je()+500,pr(s,i)):fr=Ys(s,i);e:do try{if(rt!==0&&Be!==null){i=Be;var g=On;t:switch(rt){case 1:rt=0,On=null,gr(s,i,g,1);break;case 2:case 9:if(sy(g)){rt=0,On=null,V0(i);break}i=function(){rt!==2&&rt!==9||mt!==s||(rt=7),Ss(s)},g.then(i,i);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:sy(g)?(rt=0,On=null,V0(i)):(rt=0,On=null,gr(s,i,g,7));break;case 5:var j=null;switch(Be.tag){case 26:j=Be.memoizedState;case 5:case 27:var _=Be;if(j?Ov(j):_.stateNode.complete){rt=0,On=null;var M=_.sibling;if(M!==null)Be=M;else{var F=_.return;F!==null?(Be=F,Sc(F)):Be=null}break t}}rt=0,On=null,gr(s,i,g,5);break;case 6:rt=0,On=null,gr(s,i,g,6);break;case 8:th(),At=6;break e;default:throw Error(a(462))}}hC();break}catch(W){K0(s,W)}while(!0);return Ts=ea=null,K.H=d,K.A=h,nt=l,Be!==null?0:(mt=null,He=0,Il(),At)}function hC(){for(;Be!==null&&!gt();)Z0(Be)}function Z0(s){var i=y0(s.alternate,s,qs);s.memoizedProps=s.pendingProps,i===null?Sc(s):Be=i}function V0(s){var i=s,l=i.alternate;switch(i.tag){case 15:case 0:i=d0(l,i,i.pendingProps,i.type,void 0,He);break;case 11:i=d0(l,i,i.pendingProps,i.type.render,i.ref,He);break;case 5:yf(i);default:x0(l,i),i=Be=Fg(i,qs),i=y0(l,i,qs)}s.memoizedProps=s.pendingProps,i===null?Sc(s):Be=i}function gr(s,i,l,d){Ts=ea=null,yf(i),ar=null,mo=0;var h=i.return;try{if(tC(s,h,i,l,He)){At=1,lc(s,In(l,s.current)),Be=null;return}}catch(g){if(h!==null)throw Be=h,g;At=1,lc(s,In(l,s.current)),Be=null;return}i.flags&32768?(Ve||d===1?s=!0:fr||(He&536870912)!==0?s=!1:(di=s=!0,(d===2||d===9||d===3||d===6)&&(d=An.current,d!==null&&d.tag===13&&(d.flags|=16384))),Q0(i,s)):Sc(i)}function Sc(s){var i=s;do{if((i.flags&32768)!==0){Q0(i,di);return}s=i.return;var l=iC(i.alternate,i,qs);if(l!==null){Be=l;return}if(i=i.sibling,i!==null){Be=i;return}Be=i=s}while(i!==null);At===0&&(At=5)}function Q0(s,i){do{var l=aC(s.alternate,s);if(l!==null){l.flags&=32767,Be=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(s=s.sibling,s!==null)){Be=s;return}Be=s=l}while(s!==null);At=6,Be=null}function Y0(s,i,l,d,h,g,j,_,M){s.cancelPendingCommit=null;do jc();while(Ft!==0);if((nt&6)!==0)throw Error(a(327));if(i!==null){if(i===s.current)throw Error(a(177));if(g=i.lanes|i.childLanes,g|=Kd,kl(s,l,g,j,_,M),s===mt&&(Be=mt=null,He=0),mr=i,mi=s,Ks=l,Xf=g,Wf=h,U0=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,yC(Ke,function(){return tv(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=K.T,K.T=null,h=ae.p,ae.p=2,j=nt,nt|=4;try{rC(s,i,l)}finally{nt=j,ae.p=h,K.T=d}}Ft=1,J0(),X0(),W0()}}function J0(){if(Ft===1){Ft=0;var s=mi,i=mr,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=K.T,K.T=null;var d=ae.p;ae.p=2;var h=nt;nt|=4;try{A0(i,s);var g=mh,j=$g(s.containerInfo),_=g.focusedElem,M=g.selectionRange;if(j!==_&&_&&_.ownerDocument&&Mg(_.ownerDocument.documentElement,_)){if(M!==null&&Pd(_)){var F=M.start,W=M.end;if(W===void 0&&(W=F),"selectionStart"in _)_.selectionStart=F,_.selectionEnd=Math.min(W,_.value.length);else{var ie=_.ownerDocument||document,Z=ie&&ie.defaultView||window;if(Z.getSelection){var Q=Z.getSelection(),Se=_.textContent.length,Re=Math.min(M.start,Se),ft=M.end===void 0?Re:Math.min(M.end,Se);!Q.extend&&Re>ft&&(j=ft,ft=Re,Re=j);var q=Lg(_,Re),I=Lg(_,ft);if(q&&I&&(Q.rangeCount!==1||Q.anchorNode!==q.node||Q.anchorOffset!==q.offset||Q.focusNode!==I.node||Q.focusOffset!==I.offset)){var G=ie.createRange();G.setStart(q.node,q.offset),Q.removeAllRanges(),Re>ft?(Q.addRange(G),Q.extend(I.node,I.offset)):(G.setEnd(I.node,I.offset),Q.addRange(G))}}}}for(ie=[],Q=_;Q=Q.parentNode;)Q.nodeType===1&&ie.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ie.length;_++){var te=ie[_];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Dc=!!hh,mh=hh=null}finally{nt=h,ae.p=d,K.T=l}}s.current=i,Ft=2}}function X0(){if(Ft===2){Ft=0;var s=mi,i=mr,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=K.T,K.T=null;var d=ae.p;ae.p=2;var h=nt;nt|=4;try{k0(s,i.alternate,i)}finally{nt=h,ae.p=d,K.T=l}}Ft=3}}function W0(){if(Ft===4||Ft===3){Ft=0,Qt();var s=mi,i=mr,l=Ks,d=U0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Ft=5:(Ft=0,mr=mi=null,ev(s,s.pendingLanes));var h=s.pendingLanes;if(h===0&&(hi=null),ln(l),i=i.stateNode,ht&&typeof ht.onCommitFiberRoot=="function")try{ht.onCommitFiberRoot(ns,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=K.T,h=ae.p,ae.p=2,K.T=null;try{for(var g=s.onRecoverableError,j=0;j<d.length;j++){var _=d[j];g(_.value,{componentStack:_.stack})}}finally{K.T=i,ae.p=h}}(Ks&3)!==0&&jc(),Ss(s),h=s.pendingLanes,(l&261930)!==0&&(h&42)!==0?s===eh?Ao++:(Ao=0,eh=s):Ao=0,To(0)}}function ev(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,fo(i)))}function jc(){return J0(),X0(),W0(),tv()}function tv(){if(Ft!==5)return!1;var s=mi,i=Xf;Xf=0;var l=ln(Ks),d=K.T,h=ae.p;try{ae.p=32>l?32:l,K.T=null,l=Wf,Wf=null;var g=mi,j=Ks;if(Ft=0,mr=mi=null,Ks=0,(nt&6)!==0)throw Error(a(331));var _=nt;if(nt|=4,M0(g.current),O0(g,g.current,j,l),nt=_,To(0,!1),ht&&typeof ht.onPostCommitFiberRoot=="function")try{ht.onPostCommitFiberRoot(ns,g)}catch{}return!0}finally{ae.p=h,K.T=d,ev(s,i)}}function nv(s,i,l){i=In(l,i),i=Tf(s.stateNode,i,2),s=oi(s,i,2),s!==null&&(Fi(s,2),Ss(s))}function ot(s,i,l){if(s.tag===3)nv(s,s,l);else for(;i!==null;){if(i.tag===3){nv(i,s,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(hi===null||!hi.has(d))){s=In(l,s),l=s0(2),d=oi(i,l,2),d!==null&&(i0(l,d,i,s),Fi(d,2),Ss(d));break}}i=i.return}}function sh(s,i,l){var d=s.pingCache;if(d===null){d=s.pingCache=new cC;var h=new Set;d.set(i,h)}else h=d.get(i),h===void 0&&(h=new Set,d.set(i,h));h.has(l)||(Qf=!0,h.add(l),s=mC.bind(null,s,i,l),i.then(s,s))}function mC(s,i,l){var d=s.pingCache;d!==null&&d.delete(i),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,mt===s&&(He&l)===l&&(At===4||At===3&&(He&62914560)===He&&300>Je()-gc?(nt&2)===0&&pr(s,0):Yf|=l,hr===He&&(hr=0)),Ss(s)}function sv(s,i){i===0&&(i=Cl()),s=Ji(s,i),s!==null&&(Fi(s,i),Ss(s))}function pC(s){var i=s.memoizedState,l=0;i!==null&&(l=i.retryLane),sv(s,l)}function gC(s,i){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,h=s.memoizedState;h!==null&&(l=h.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),sv(s,l)}function yC(s,i){return re(s,i)}var wc=null,yr=null,ih=!1,Nc=!1,ah=!1,gi=0;function Ss(s){s!==yr&&s.next===null&&(yr===null?wc=yr=s:yr=yr.next=s),Nc=!0,ih||(ih=!0,xC())}function To(s,i){if(!ah&&Nc){ah=!0;do for(var l=!1,d=wc;d!==null;){if(s!==0){var h=d.pendingLanes;if(h===0)var g=0;else{var j=d.suspendedLanes,_=d.pingedLanes;g=(1<<31-ce(42|s)+1)-1,g&=h&~(j&~_),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(l=!0,ov(d,g))}else g=He,g=Ua(d,d===mt?g:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(g&3)===0||Ys(d,g)||(l=!0,ov(d,g));d=d.next}while(l);ah=!1}}function vC(){iv()}function iv(){Nc=ih=!1;var s=0;gi!==0&&EC()&&(s=gi);for(var i=Je(),l=null,d=wc;d!==null;){var h=d.next,g=av(d,i);g===0?(d.next=null,l===null?wc=h:l.next=h,h===null&&(yr=l)):(l=d,(s!==0||(g&3)!==0)&&(Nc=!0)),d=h}Ft!==0&&Ft!==5||To(s),gi!==0&&(gi=0)}function av(s,i){for(var l=s.suspendedLanes,d=s.pingedLanes,h=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var j=31-ce(g),_=1<<j,M=h[j];M===-1?((_&l)===0||(_&d)!==0)&&(h[j]=Sd(_,i)):M<=i&&(s.expiredLanes|=_),g&=~_}if(i=mt,l=He,l=Ua(s,s===i?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===i&&(rt===2||rt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&Ze(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||Ys(s,l)){if(i=l&-l,i===s.callbackPriority)return i;switch(d!==null&&Ze(d),ln(l)){case 2:case 8:l=Nt;break;case 32:l=Ke;break;case 268435456:l=pn;break;default:l=Ke}return d=rv.bind(null,s),l=re(l,d),s.callbackPriority=i,s.callbackNode=l,i}return d!==null&&d!==null&&Ze(d),s.callbackPriority=2,s.callbackNode=null,2}function rv(s,i){if(Ft!==0&&Ft!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(jc()&&s.callbackNode!==l)return null;var d=He;return d=Ua(s,s===mt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(B0(s,d,i),av(s,Je()),s.callbackNode!=null&&s.callbackNode===l?rv.bind(null,s):null)}function ov(s,i){if(jc())return null;B0(s,i,!0)}function xC(){AC(function(){(nt&6)!==0?re(Xe,vC):iv()})}function rh(){if(gi===0){var s=nr;s===0&&(s=Gi,Gi<<=1,(Gi&261888)===0&&(Gi=256)),gi=s}return gi}function lv(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Tl(""+s)}function cv(s,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,s.id&&l.setAttribute("form",s.id),i.parentNode.insertBefore(l,i),s=new FormData(s),l.parentNode.removeChild(l),s}function bC(s,i,l,d,h){if(i==="submit"&&l&&l.stateNode===h){var g=lv((h[sn]||null).action),j=d.submitter;j&&(i=(i=j[sn]||null)?lv(i.formAction):j.getAttribute("formAction"),i!==null&&(g=i,j=null));var _=new Ml("action","action",null,d,h);s.push({event:_,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(gi!==0){var M=j?cv(h,j):new FormData(h);kf(l,{pending:!0,data:M,method:h.method,action:g},null,M)}}else typeof g=="function"&&(_.preventDefault(),M=j?cv(h,j):new FormData(h),kf(l,{pending:!0,data:M,method:h.method,action:g},g,M))},currentTarget:h}]})}}for(var oh=0;oh<qd.length;oh++){var lh=qd[oh],SC=lh.toLowerCase(),jC=lh[0].toUpperCase()+lh.slice(1);is(SC,"on"+jC)}is(Ig,"onAnimationEnd"),is(Bg,"onAnimationIteration"),is(qg,"onAnimationStart"),is("dblclick","onDoubleClick"),is("focusin","onFocus"),is("focusout","onBlur"),is(P1,"onTransitionRun"),is(U1,"onTransitionStart"),is(I1,"onTransitionCancel"),is(Kg,"onTransitionEnd"),qa("onMouseEnter",["mouseout","mouseover"]),qa("onMouseLeave",["mouseout","mouseover"]),qa("onPointerEnter",["pointerout","pointerover"]),qa("onPointerLeave",["pointerout","pointerover"]),ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ys("onBeforeInput",["compositionend","keypress","textInput","paste"]),ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="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(" "),wC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oo));function uv(s,i){i=(i&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],h=d.event;d=d.listeners;e:{var g=void 0;if(i)for(var j=d.length-1;0<=j;j--){var _=d[j],M=_.instance,F=_.currentTarget;if(_=_.listener,M!==g&&h.isPropagationStopped())break e;g=_,h.currentTarget=F;try{g(h)}catch(W){Ul(W)}h.currentTarget=null,g=M}else for(j=0;j<d.length;j++){if(_=d[j],M=_.instance,F=_.currentTarget,_=_.listener,M!==g&&h.isPropagationStopped())break e;g=_,h.currentTarget=F;try{g(h)}catch(W){Ul(W)}h.currentTarget=null,g=M}}}}function qe(s,i){var l=i[ks];l===void 0&&(l=i[ks]=new Set);var d=s+"__bubble";l.has(d)||(dv(i,s,2,!1),l.add(d))}function ch(s,i,l){var d=0;i&&(d|=4),dv(l,s,d,i)}var Cc="_reactListening"+Math.random().toString(36).slice(2);function uh(s){if(!s[Cc]){s[Cc]=!0,ss.forEach(function(l){l!=="selectionchange"&&(wC.has(l)||ch(l,!1,s),ch(l,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[Cc]||(i[Cc]=!0,ch("selectionchange",!1,i))}}function dv(s,i,l,d){switch(Iv(i)){case 2:var h=JC;break;case 8:h=XC;break;default:h=Ch}l=h.bind(null,i,l,s),h=void 0,!Ed||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),d?h!==void 0?s.addEventListener(i,l,{capture:!0,passive:h}):s.addEventListener(i,l,!0):h!==void 0?s.addEventListener(i,l,{passive:h}):s.addEventListener(i,l,!1)}function dh(s,i,l,d,h){var g=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var _=d.stateNode.containerInfo;if(_===h)break;if(j===4)for(j=d.return;j!==null;){var M=j.tag;if((M===3||M===4)&&j.stateNode.containerInfo===h)return;j=j.return}for(;_!==null;){if(j=Xs(_),j===null)return;if(M=j.tag,M===5||M===6||M===26||M===27){d=g=j;continue e}_=_.parentNode}}d=d.return}gg(function(){var F=g,W=zd(l),ie=[];e:{var Z=Hg.get(s);if(Z!==void 0){var Q=Ml,Se=s;switch(s){case"keypress":if(Dl(l)===0)break e;case"keydown":case"keyup":Q=g1;break;case"focusin":Se="focus",Q=Od;break;case"focusout":Se="blur",Q=Od;break;case"beforeblur":case"afterblur":Q=Od;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=xg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=i1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=x1;break;case Ig:case Bg:case qg:Q=o1;break;case Kg:Q=S1;break;case"scroll":case"scrollend":Q=n1;break;case"wheel":Q=w1;break;case"copy":case"cut":case"paste":Q=c1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Sg;break;case"toggle":case"beforetoggle":Q=C1}var Re=(i&4)!==0,ft=!Re&&(s==="scroll"||s==="scrollend"),q=Re?Z!==null?Z+"Capture":null:Z;Re=[];for(var I=F,G;I!==null;){var te=I;if(G=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||G===null||q===null||(te=eo(I,q),te!=null&&Re.push(Do(I,te,G))),ft)break;I=I.return}0<Re.length&&(Z=new Q(Z,Se,null,l,W),ie.push({event:Z,listeners:Re}))}}if((i&7)===0){e:{if(Z=s==="mouseover"||s==="pointerover",Q=s==="mouseout"||s==="pointerout",Z&&l!==kd&&(Se=l.relatedTarget||l.fromElement)&&(Xs(Se)||Se[_n]))break e;if((Q||Z)&&(Z=W.window===W?W:(Z=W.ownerDocument)?Z.defaultView||Z.parentWindow:window,Q?(Se=l.relatedTarget||l.toElement,Q=F,Se=Se?Xs(Se):null,Se!==null&&(ft=c(Se),Re=Se.tag,Se!==ft||Re!==5&&Re!==27&&Re!==6)&&(Se=null)):(Q=null,Se=F),Q!==Se)){if(Re=xg,te="onMouseLeave",q="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(Re=Sg,te="onPointerLeave",q="onPointerEnter",I="pointer"),ft=Q==null?Z:$e(Q),G=Se==null?Z:$e(Se),Z=new Re(te,I+"leave",Q,l,W),Z.target=ft,Z.relatedTarget=G,te=null,Xs(W)===F&&(Re=new Re(q,I+"enter",Se,l,W),Re.target=G,Re.relatedTarget=ft,te=Re),ft=te,Q&&Se)t:{for(Re=NC,q=Q,I=Se,G=0,te=q;te;te=Re(te))G++;te=0;for(var ze=I;ze;ze=Re(ze))te++;for(;0<G-te;)q=Re(q),G--;for(;0<te-G;)I=Re(I),te--;for(;G--;){if(q===I||I!==null&&q===I.alternate){Re=q;break t}q=Re(q),I=Re(I)}Re=null}else Re=null;Q!==null&&fv(ie,Z,Q,Re,!1),Se!==null&&ft!==null&&fv(ie,ft,Se,Re,!0)}}e:{if(Z=F?$e(F):window,Q=Z.nodeName&&Z.nodeName.toLowerCase(),Q==="select"||Q==="input"&&Z.type==="file")var et=Eg;else if(zg(Z))if(Rg)et=L1;else{et=O1;var Ce=T1}else Q=Z.nodeName,!Q||Q.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?F&&Cd(F.elementType)&&(et=Eg):et=D1;if(et&&(et=et(s,F))){_g(ie,et,l,W);break e}Ce&&Ce(s,Z,F),s==="focusout"&&F&&Z.type==="number"&&F.memoizedProps.value!=null&&Nd(Z,"number",Z.value)}switch(Ce=F?$e(F):window,s){case"focusin":(zg(Ce)||Ce.contentEditable==="true")&&(Va=Ce,Ud=F,lo=null);break;case"focusout":lo=Ud=Va=null;break;case"mousedown":Id=!0;break;case"contextmenu":case"mouseup":case"dragend":Id=!1,Pg(ie,l,W);break;case"selectionchange":if($1)break;case"keydown":case"keyup":Pg(ie,l,W)}var Le;if(Ld)e:{switch(s){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else Za?Cg(s,l)&&(Ge="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ge="onCompositionStart");Ge&&(jg&&l.locale!=="ko"&&(Za||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&Za&&(Le=yg()):(ei=W,Rd="value"in ei?ei.value:ei.textContent,Za=!0)),Ce=kc(F,Ge),0<Ce.length&&(Ge=new bg(Ge,s,null,l,W),ie.push({event:Ge,listeners:Ce}),Le?Ge.data=Le:(Le=kg(l),Le!==null&&(Ge.data=Le)))),(Le=z1?_1(s,l):E1(s,l))&&(Ge=kc(F,"onBeforeInput"),0<Ge.length&&(Ce=new bg("onBeforeInput","beforeinput",null,l,W),ie.push({event:Ce,listeners:Ge}),Ce.data=Le)),bC(ie,s,F,l,W)}uv(ie,i)})}function Do(s,i,l){return{instance:s,listener:i,currentTarget:l}}function kc(s,i){for(var l=i+"Capture",d=[];s!==null;){var h=s,g=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||g===null||(h=eo(s,l),h!=null&&d.unshift(Do(s,h,g)),h=eo(s,i),h!=null&&d.push(Do(s,h,g))),s.tag===3)return d;s=s.return}return[]}function NC(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function fv(s,i,l,d,h){for(var g=i._reactName,j=[];l!==null&&l!==d;){var _=l,M=_.alternate,F=_.stateNode;if(_=_.tag,M!==null&&M===d)break;_!==5&&_!==26&&_!==27||F===null||(M=F,h?(F=eo(l,g),F!=null&&j.unshift(Do(l,F,M))):h||(F=eo(l,g),F!=null&&j.push(Do(l,F,M)))),l=l.return}j.length!==0&&s.push({event:i,listeners:j})}var CC=/\r\n?/g,kC=/\u0000|\uFFFD/g;function hv(s){return(typeof s=="string"?s:""+s).replace(CC,`
|
|
9
|
-
`).replace(kC,"")}function mv(s,i){return i=hv(i),hv(s)===i}function dt(s,i,l,d,h,g){switch(l){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Ha(s,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Ha(s,""+d);break;case"className":Rl(s,"class",d);break;case"tabIndex":Rl(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Rl(s,l,d);break;case"style":mg(s,d,g);break;case"data":if(i!=="object"){Rl(s,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Tl(""+d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"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 g=="function"&&(l==="formAction"?(i!=="input"&&dt(s,i,"name",h.name,h,null),dt(s,i,"formEncType",h.formEncType,h,null),dt(s,i,"formMethod",h.formMethod,h,null),dt(s,i,"formTarget",h.formTarget,h,null)):(dt(s,i,"encType",h.encType,h,null),dt(s,i,"method",h.method,h,null),dt(s,i,"target",h.target,h,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Tl(""+d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=_s);break;case"onScroll":d!=null&&qe("scroll",s);break;case"onScrollEnd":d!=null&&qe("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(h.children!=null)throw Error(a(60));s.innerHTML=l}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.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"){s.removeAttribute("xlink:href");break}l=Tl(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);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"?s.setAttribute(l,""+d):s.removeAttribute(l);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"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":qe("beforetoggle",s),qe("toggle",s),El(s,"popover",d);break;case"xlinkActuate":zs(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":zs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":zs(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":zs(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":zs(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":zs(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":zs(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":zs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":zs(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":El(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=e1.get(l)||l,El(s,l,d))}}function fh(s,i,l,d,h,g){switch(l){case"style":mg(s,d,g);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(h.children!=null)throw Error(a(60));s.innerHTML=l}}break;case"children":typeof d=="string"?Ha(s,d):(typeof d=="number"||typeof d=="bigint")&&Ha(s,""+d);break;case"onScroll":d!=null&&qe("scroll",s);break;case"onScrollEnd":d!=null&&qe("scrollend",s);break;case"onClick":d!=null&&(s.onclick=_s);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zi.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(h=l.endsWith("Capture"),i=l.slice(2,h?l.length-7:void 0),g=s[sn]||null,g=g!=null?g[l]:null,typeof g=="function"&&s.removeEventListener(i,g,h),typeof d=="function")){typeof g!="function"&&g!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(i,d,h);break e}l in s?s[l]=d:d===!0?s.setAttribute(l,""):El(s,l,d)}}}function en(s,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",s),qe("load",s);var d=!1,h=!1,g;for(g in l)if(l.hasOwnProperty(g)){var j=l[g];if(j!=null)switch(g){case"src":d=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(s,i,g,j,l,null)}}h&&dt(s,i,"srcSet",l.srcSet,l,null),d&&dt(s,i,"src",l.src,l,null);return;case"input":qe("invalid",s);var _=g=j=h=null,M=null,F=null;for(d in l)if(l.hasOwnProperty(d)){var W=l[d];if(W!=null)switch(d){case"name":h=W;break;case"type":j=W;break;case"checked":M=W;break;case"defaultChecked":F=W;break;case"value":g=W;break;case"defaultValue":_=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(a(137,i));break;default:dt(s,i,d,W,l,null)}}ug(s,g,_,M,F,j,h,!1);return;case"select":qe("invalid",s),d=j=g=null;for(h in l)if(l.hasOwnProperty(h)&&(_=l[h],_!=null))switch(h){case"value":g=_;break;case"defaultValue":j=_;break;case"multiple":d=_;default:dt(s,i,h,_,l,null)}i=g,l=j,s.multiple=!!d,i!=null?Ka(s,!!d,i,!1):l!=null&&Ka(s,!!d,l,!0);return;case"textarea":qe("invalid",s),g=h=d=null;for(j in l)if(l.hasOwnProperty(j)&&(_=l[j],_!=null))switch(j){case"value":d=_;break;case"defaultValue":h=_;break;case"children":g=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:dt(s,i,j,_,l,null)}fg(s,d,h,g);return;case"option":for(M in l)l.hasOwnProperty(M)&&(d=l[M],d!=null)&&(M==="selected"?s.selected=d&&typeof d!="function"&&typeof d!="symbol":dt(s,i,M,d,l,null));return;case"dialog":qe("beforetoggle",s),qe("toggle",s),qe("cancel",s),qe("close",s);break;case"iframe":case"object":qe("load",s);break;case"video":case"audio":for(d=0;d<Oo.length;d++)qe(Oo[d],s);break;case"image":qe("error",s),qe("load",s);break;case"details":qe("toggle",s);break;case"embed":case"source":case"link":qe("error",s),qe("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in l)if(l.hasOwnProperty(F)&&(d=l[F],d!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:dt(s,i,F,d,l,null)}return;default:if(Cd(i)){for(W in l)l.hasOwnProperty(W)&&(d=l[W],d!==void 0&&fh(s,i,W,d,l,void 0));return}}for(_ in l)l.hasOwnProperty(_)&&(d=l[_],d!=null&&dt(s,i,_,d,l,null))}function zC(s,i,l,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,g=null,j=null,_=null,M=null,F=null,W=null;for(Q in l){var ie=l[Q];if(l.hasOwnProperty(Q)&&ie!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":M=ie;default:d.hasOwnProperty(Q)||dt(s,i,Q,null,d,ie)}}for(var Z in d){var Q=d[Z];if(ie=l[Z],d.hasOwnProperty(Z)&&(Q!=null||ie!=null))switch(Z){case"type":g=Q;break;case"name":h=Q;break;case"checked":F=Q;break;case"defaultChecked":W=Q;break;case"value":j=Q;break;case"defaultValue":_=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(a(137,i));break;default:Q!==ie&&dt(s,i,Z,Q,d,ie)}}wd(s,j,_,M,F,W,g,h);return;case"select":Q=j=_=Z=null;for(g in l)if(M=l[g],l.hasOwnProperty(g)&&M!=null)switch(g){case"value":break;case"multiple":Q=M;default:d.hasOwnProperty(g)||dt(s,i,g,null,d,M)}for(h in d)if(g=d[h],M=l[h],d.hasOwnProperty(h)&&(g!=null||M!=null))switch(h){case"value":Z=g;break;case"defaultValue":_=g;break;case"multiple":j=g;default:g!==M&&dt(s,i,h,g,d,M)}i=_,l=j,d=Q,Z!=null?Ka(s,!!l,Z,!1):!!d!=!!l&&(i!=null?Ka(s,!!l,i,!0):Ka(s,!!l,l?[]:"",!1));return;case"textarea":Q=Z=null;for(_ in l)if(h=l[_],l.hasOwnProperty(_)&&h!=null&&!d.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:dt(s,i,_,null,d,h)}for(j in d)if(h=d[j],g=l[j],d.hasOwnProperty(j)&&(h!=null||g!=null))switch(j){case"value":Z=h;break;case"defaultValue":Q=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==g&&dt(s,i,j,h,d,g)}dg(s,Z,Q);return;case"option":for(var Se in l)Z=l[Se],l.hasOwnProperty(Se)&&Z!=null&&!d.hasOwnProperty(Se)&&(Se==="selected"?s.selected=!1:dt(s,i,Se,null,d,Z));for(M in d)Z=d[M],Q=l[M],d.hasOwnProperty(M)&&Z!==Q&&(Z!=null||Q!=null)&&(M==="selected"?s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":dt(s,i,M,Z,d,Q));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 Re in l)Z=l[Re],l.hasOwnProperty(Re)&&Z!=null&&!d.hasOwnProperty(Re)&&dt(s,i,Re,null,d,Z);for(F in d)if(Z=d[F],Q=l[F],d.hasOwnProperty(F)&&Z!==Q&&(Z!=null||Q!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,i));break;default:dt(s,i,F,Z,d,Q)}return;default:if(Cd(i)){for(var ft in l)Z=l[ft],l.hasOwnProperty(ft)&&Z!==void 0&&!d.hasOwnProperty(ft)&&fh(s,i,ft,void 0,d,Z);for(W in d)Z=d[W],Q=l[W],!d.hasOwnProperty(W)||Z===Q||Z===void 0&&Q===void 0||fh(s,i,W,Z,d,Q);return}}for(var q in l)Z=l[q],l.hasOwnProperty(q)&&Z!=null&&!d.hasOwnProperty(q)&&dt(s,i,q,null,d,Z);for(ie in d)Z=d[ie],Q=l[ie],!d.hasOwnProperty(ie)||Z===Q||Z==null&&Q==null||dt(s,i,ie,Z,d,Q)}function pv(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function _C(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var h=l[d],g=h.transferSize,j=h.initiatorType,_=h.duration;if(g&&_&&pv(j)){for(j=0,_=h.responseEnd,d+=1;d<l.length;d++){var M=l[d],F=M.startTime;if(F>_)break;var W=M.transferSize,ie=M.initiatorType;W&&pv(ie)&&(M=M.responseEnd,j+=W*(M<_?1:(_-F)/(M-F)))}if(--d,i+=8*(g+j)/(h.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var hh=null,mh=null;function zc(s){return s.nodeType===9?s:s.ownerDocument}function gv(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function yv(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function ph(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var gh=null;function EC(){var s=window.event;return s&&s.type==="popstate"?s===gh?!1:(gh=s,!0):(gh=null,!1)}var vv=typeof setTimeout=="function"?setTimeout:void 0,RC=typeof clearTimeout=="function"?clearTimeout:void 0,xv=typeof Promise=="function"?Promise:void 0,AC=typeof queueMicrotask=="function"?queueMicrotask:typeof xv<"u"?function(s){return xv.resolve(null).then(s).catch(TC)}:vv;function TC(s){setTimeout(function(){throw s})}function yi(s){return s==="head"}function bv(s,i){var l=i,d=0;do{var h=l.nextSibling;if(s.removeChild(l),h&&h.nodeType===8)if(l=h.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(h),Sr(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")Lo(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Lo(l);for(var g=l.firstChild;g;){var j=g.nextSibling,_=g.nodeName;g[gs]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&g.rel.toLowerCase()==="stylesheet"||l.removeChild(g),g=j}}else l==="body"&&Lo(s.ownerDocument.body);l=h}while(l);Sr(i)}function Sv(s,i){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function yh(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":yh(l),Js(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function OC(s,i,l,d){for(;s.nodeType===1;){var h=l;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[gs])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==h.rel||s.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||s.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||s.getAttribute("title")!==(h.title==null?null:h.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(h.src==null?null:h.src)||s.getAttribute("type")!==(h.type==null?null:h.type)||s.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var g=h.name==null?null:""+h.name;if(h.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=Gn(s.nextSibling),s===null)break}return null}function DC(s,i,l){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Gn(s.nextSibling),s===null))return null;return s}function jv(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=Gn(s.nextSibling),s===null))return null;return s}function vh(s){return s.data==="$?"||s.data==="$~"}function xh(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function LC(s,i){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Gn(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var bh=null;function wv(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(i===0)return Gn(s.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}s=s.nextSibling}return null}function Nv(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return s;i--}else l!=="/$"&&l!=="/&"||i++}s=s.previousSibling}return null}function Cv(s,i,l){switch(i=zc(l),s){case"html":if(s=i.documentElement,!s)throw Error(a(452));return s;case"head":if(s=i.head,!s)throw Error(a(453));return s;case"body":if(s=i.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function Lo(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);Js(s)}var Fn=new Map,kv=new Set;function _c(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Hs=ae.d;ae.d={f:MC,r:$C,D:PC,C:UC,L:IC,m:BC,X:KC,S:qC,M:HC};function MC(){var s=Hs.f(),i=xc();return s||i}function $C(s){var i=Ws(s);i!==null&&i.tag===5&&i.type==="form"?Ky(i):Hs.r(s)}var vr=typeof document>"u"?null:document;function zv(s,i,l){var d=vr;if(d&&typeof i=="string"&&i){var h=Pn(i);h='link[rel="'+s+'"][href="'+h+'"]',typeof l=="string"&&(h+='[crossorigin="'+l+'"]'),kv.has(h)||(kv.add(h),s={rel:s,crossOrigin:l,href:i},d.querySelector(h)===null&&(i=d.createElement("link"),en(i,"link",s),at(i),d.head.appendChild(i)))}}function PC(s){Hs.D(s),zv("dns-prefetch",s,null)}function UC(s,i){Hs.C(s,i),zv("preconnect",s,i)}function IC(s,i,l){Hs.L(s,i,l);var d=vr;if(d&&s&&i){var h='link[rel="preload"][as="'+Pn(i)+'"]';i==="image"&&l&&l.imageSrcSet?(h+='[imagesrcset="'+Pn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(h+='[imagesizes="'+Pn(l.imageSizes)+'"]')):h+='[href="'+Pn(s)+'"]';var g=h;switch(i){case"style":g=xr(s);break;case"script":g=br(s)}Fn.has(g)||(s=y({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:s,as:i},l),Fn.set(g,s),d.querySelector(h)!==null||i==="style"&&d.querySelector(Mo(g))||i==="script"&&d.querySelector($o(g))||(i=d.createElement("link"),en(i,"link",s),at(i),d.head.appendChild(i)))}}function BC(s,i){Hs.m(s,i);var l=vr;if(l&&s){var d=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Pn(d)+'"][href="'+Pn(s)+'"]',g=h;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=br(s)}if(!Fn.has(g)&&(s=y({rel:"modulepreload",href:s},i),Fn.set(g,s),l.querySelector(h)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector($o(g)))return}d=l.createElement("link"),en(d,"link",s),at(d),l.head.appendChild(d)}}}function qC(s,i,l){Hs.S(s,i,l);var d=vr;if(d&&s){var h=We(d).hoistableStyles,g=xr(s);i=i||"default";var j=h.get(g);if(!j){var _={loading:0,preload:null};if(j=d.querySelector(Mo(g)))_.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":i},l),(l=Fn.get(g))&&Sh(s,l);var M=j=d.createElement("link");at(M),en(M,"link",s),M._p=new Promise(function(F,W){M.onload=F,M.onerror=W}),M.addEventListener("load",function(){_.loading|=1}),M.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Ec(j,i,d)}j={type:"stylesheet",instance:j,count:1,state:_},h.set(g,j)}}}function KC(s,i){Hs.X(s,i);var l=vr;if(l&&s){var d=We(l).hoistableScripts,h=br(s),g=d.get(h);g||(g=l.querySelector($o(h)),g||(s=y({src:s,async:!0},i),(i=Fn.get(h))&&jh(s,i),g=l.createElement("script"),at(g),en(g,"link",s),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(h,g))}}function HC(s,i){Hs.M(s,i);var l=vr;if(l&&s){var d=We(l).hoistableScripts,h=br(s),g=d.get(h);g||(g=l.querySelector($o(h)),g||(s=y({src:s,async:!0,type:"module"},i),(i=Fn.get(h))&&jh(s,i),g=l.createElement("script"),at(g),en(g,"link",s),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(h,g))}}function _v(s,i,l,d){var h=(h=he.current)?_c(h):null;if(!h)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=xr(l.href),l=We(h).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=xr(l.href);var g=We(h).hoistableStyles,j=g.get(s);if(j||(h=h.ownerDocument||h,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,j),(g=h.querySelector(Mo(s)))&&!g._p&&(j.instance=g,j.state.loading=5),Fn.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Fn.set(s,l),g||GC(h,s,l,j.state))),i&&d===null)throw Error(a(528,""));return j}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=br(l),l=We(h).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function xr(s){return'href="'+Pn(s)+'"'}function Mo(s){return'link[rel="stylesheet"]['+s+"]"}function Ev(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function GC(s,i,l,d){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=s.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),en(i,"link",l),at(i),s.head.appendChild(i))}function br(s){return'[src="'+Pn(s)+'"]'}function $o(s){return"script[async]"+s}function Rv(s,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=s.querySelector('style[data-href~="'+Pn(l.href)+'"]');if(d)return i.instance=d,at(d),d;var h=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),at(d),en(d,"style",h),Ec(d,l.precedence,s),i.instance=d;case"stylesheet":h=xr(l.href);var g=s.querySelector(Mo(h));if(g)return i.state.loading|=4,i.instance=g,at(g),g;d=Ev(l),(h=Fn.get(h))&&Sh(d,h),g=(s.ownerDocument||s).createElement("link"),at(g);var j=g;return j._p=new Promise(function(_,M){j.onload=_,j.onerror=M}),en(g,"link",d),i.state.loading|=4,Ec(g,l.precedence,s),i.instance=g;case"script":return g=br(l.src),(h=s.querySelector($o(g)))?(i.instance=h,at(h),h):(d=l,(h=Fn.get(g))&&(d=y({},l),jh(d,h)),s=s.ownerDocument||s,h=s.createElement("script"),at(h),en(h,"link",d),s.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Ec(d,l.precedence,s));return i.instance}function Ec(s,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=d.length?d[d.length-1]:null,g=h,j=0;j<d.length;j++){var _=d[j];if(_.dataset.precedence===i)g=_;else if(g!==h)break}g?g.parentNode.insertBefore(s,g.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(s,i.firstChild))}function Sh(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function jh(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var Rc=null;function Av(s,i,l){if(Rc===null){var d=new Map,h=Rc=new Map;h.set(l,d)}else h=Rc,d=h.get(l),d||(d=new Map,h.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),h=0;h<l.length;h++){var g=l[h];if(!(g[gs]||g[it]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var j=g.getAttribute(i)||"";j=s+j;var _=d.get(j);_?_.push(g):d.set(j,[g])}}return d}function Tv(s,i,l){s=s.ownerDocument||s,s.head.insertBefore(l,i==="title"?s.querySelector("head > title"):null)}function FC(s,i,l){if(l===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(s=i.disabled,typeof i.precedence=="string"&&s==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Ov(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function ZC(s,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var h=xr(d.href),g=i.querySelector(Mo(h));if(g){i=g._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=Ac.bind(s),i.then(s,s)),l.state.loading|=4,l.instance=g,at(g);return}g=i.ownerDocument||i,d=Ev(d),(h=Fn.get(h))&&Sh(d,h),g=g.createElement("link"),at(g);var j=g;j._p=new Promise(function(_,M){j.onload=_,j.onerror=M}),en(g,"link",d),l.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Ac.bind(s),i.addEventListener("load",l),i.addEventListener("error",l))}}var wh=0;function VC(s,i){return s.stylesheets&&s.count===0&&Oc(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&Oc(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+i);0<s.imgBytes&&wh===0&&(wh=62500*_C());var h=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Oc(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>wh?50:800)+i);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(h)}}:null}function Ac(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Oc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Tc=null;function Oc(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Tc=new Map,i.forEach(QC,s),Tc=null,Ac.call(s))}function QC(s,i){if(!(i.state.loading&4)){var l=Tc.get(s);if(l)var d=l.get(null);else{l=new Map,Tc.set(s,l);for(var h=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<h.length;g++){var j=h[g];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(l.set(j.dataset.precedence,j),d=j)}d&&l.set(null,d)}h=i.instance,j=h.getAttribute("data-precedence"),g=l.get(j)||d,g===d&&l.set(null,h),l.set(j,h),this.count++,d=Ac.bind(this),h.addEventListener("load",d),h.addEventListener("error",d),g?g.parentNode.insertBefore(h,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(h,s.firstChild)),i.state.loading|=4}}var Po={$$typeof:R,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function YC(s,i,l,d,h,g,j,_,M){this.tag=1,this.containerInfo=s,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=Wr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wr(0),this.hiddenUpdates=Wr(null),this.identifierPrefix=d,this.onUncaughtError=h,this.onCaughtError=g,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Dv(s,i,l,d,h,g,j,_,M,F,W,ie){return s=new YC(s,i,l,j,M,F,W,ie,_),i=1,g===!0&&(i|=24),g=Rn(3,null,null,i),s.current=g,g.stateNode=s,i=tf(),i.refCount++,s.pooledCache=i,i.refCount++,g.memoizedState={element:d,isDehydrated:l,cache:i},rf(g),s}function Lv(s){return s?(s=Ja,s):Ja}function Mv(s,i,l,d,h,g){h=Lv(h),d.context===null?d.context=h:d.pendingContext=h,d=ri(i),d.payload={element:l},g=g===void 0?null:g,g!==null&&(d.callback=g),l=oi(s,d,i),l!==null&&(jn(l,s,i),go(l,s,i))}function $v(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<i?l:i}}function Nh(s,i){$v(s,i),(s=s.alternate)&&$v(s,i)}function Pv(s){if(s.tag===13||s.tag===31){var i=Ji(s,67108864);i!==null&&jn(i,s,67108864),Nh(s,67108864)}}function Uv(s){if(s.tag===13||s.tag===31){var i=Ln();i=Gt(i);var l=Ji(s,i);l!==null&&jn(l,s,i),Nh(s,i)}}var Dc=!0;function JC(s,i,l,d){var h=K.T;K.T=null;var g=ae.p;try{ae.p=2,Ch(s,i,l,d)}finally{ae.p=g,K.T=h}}function XC(s,i,l,d){var h=K.T;K.T=null;var g=ae.p;try{ae.p=8,Ch(s,i,l,d)}finally{ae.p=g,K.T=h}}function Ch(s,i,l,d){if(Dc){var h=kh(d);if(h===null)dh(s,i,d,Lc,l),Bv(s,d);else if(ek(h,s,i,l,d))d.stopPropagation();else if(Bv(s,d),i&4&&-1<WC.indexOf(s)){for(;h!==null;){var g=Ws(h);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var j=ms(g.pendingLanes);if(j!==0){var _=g;for(_.pendingLanes|=2,_.entangledLanes|=2;j;){var M=1<<31-ce(j);_.entanglements[1]|=M,j&=~M}Ss(g),(nt&6)===0&&(yc=Je()+500,To(0))}}break;case 31:case 13:_=Ji(g,2),_!==null&&jn(_,g,2),xc(),Nh(g,2)}if(g=kh(d),g===null&&dh(s,i,d,Lc,l),g===h)break;h=g}h!==null&&d.stopPropagation()}else dh(s,i,d,null,l)}}function kh(s){return s=zd(s),zh(s)}var Lc=null;function zh(s){if(Lc=null,s=Xs(s),s!==null){var i=c(s);if(i===null)s=null;else{var l=i.tag;if(l===13){if(s=u(i),s!==null)return s;s=null}else if(l===31){if(s=f(i),s!==null)return s;s=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return Lc=s,null}function Iv(s){switch(s){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(Me()){case Xe:return 2;case Nt:return 8;case Ke:case Ma:return 32;case pn:return 268435456;default:return 32}default:return 32}}var _h=!1,vi=null,xi=null,bi=null,Uo=new Map,Io=new Map,Si=[],WC="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 Bv(s,i){switch(s){case"focusin":case"focusout":vi=null;break;case"dragenter":case"dragleave":xi=null;break;case"mouseover":case"mouseout":bi=null;break;case"pointerover":case"pointerout":Uo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Io.delete(i.pointerId)}}function Bo(s,i,l,d,h,g){return s===null||s.nativeEvent!==g?(s={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:g,targetContainers:[h]},i!==null&&(i=Ws(i),i!==null&&Pv(i)),s):(s.eventSystemFlags|=d,i=s.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),s)}function ek(s,i,l,d,h){switch(i){case"focusin":return vi=Bo(vi,s,i,l,d,h),!0;case"dragenter":return xi=Bo(xi,s,i,l,d,h),!0;case"mouseover":return bi=Bo(bi,s,i,l,d,h),!0;case"pointerover":var g=h.pointerId;return Uo.set(g,Bo(Uo.get(g)||null,s,i,l,d,h)),!0;case"gotpointercapture":return g=h.pointerId,Io.set(g,Bo(Io.get(g)||null,s,i,l,d,h)),!0}return!1}function qv(s){var i=Xs(s.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){s.blockedOn=i,ps(s.priority,function(){Uv(l)});return}}else if(i===31){if(i=f(l),i!==null){s.blockedOn=i,ps(s.priority,function(){Uv(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Mc(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var l=kh(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);kd=d,l.target.dispatchEvent(d),kd=null}else return i=Ws(l),i!==null&&Pv(i),s.blockedOn=l,!1;i.shift()}return!0}function Kv(s,i,l){Mc(s)&&l.delete(i)}function tk(){_h=!1,vi!==null&&Mc(vi)&&(vi=null),xi!==null&&Mc(xi)&&(xi=null),bi!==null&&Mc(bi)&&(bi=null),Uo.forEach(Kv),Io.forEach(Kv)}function $c(s,i){s.blockedOn===i&&(s.blockedOn=null,_h||(_h=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,tk)))}var Pc=null;function Hv(s){Pc!==s&&(Pc=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Pc===s&&(Pc=null);for(var i=0;i<s.length;i+=3){var l=s[i],d=s[i+1],h=s[i+2];if(typeof d!="function"){if(zh(d||l)===null)continue;break}var g=Ws(l);g!==null&&(s.splice(i,3),i-=3,kf(g,{pending:!0,data:h,method:l.method,action:d},d,h))}}))}function Sr(s){function i(M){return $c(M,s)}vi!==null&&$c(vi,s),xi!==null&&$c(xi,s),bi!==null&&$c(bi,s),Uo.forEach(i),Io.forEach(i);for(var l=0;l<Si.length;l++){var d=Si[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Si.length&&(l=Si[0],l.blockedOn===null);)qv(l),l.blockedOn===null&&Si.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var h=l[d],g=l[d+1],j=h[sn]||null;if(typeof g=="function")j||Hv(l);else if(j){var _=null;if(g&&g.hasAttribute("formAction")){if(h=g,j=g[sn]||null)_=j.formAction;else if(zh(h)!==null)continue}else _=j.action;typeof _=="function"?l[d+1]=_:(l.splice(d,3),d-=3),Hv(l)}}}function Gv(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(j){return h=j})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,h=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Eh(s){this._internalRoot=s}Uc.prototype.render=Eh.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(a(409));var l=i.current,d=Ln();Mv(l,d,s,i,null,null)},Uc.prototype.unmount=Eh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Mv(s.current,2,null,s,null,null),xc(),i[_n]=null}};function Uc(s){this._internalRoot=s}Uc.prototype.unstable_scheduleHydration=function(s){if(s){var i=Ia();s={blockedOn:null,target:s,priority:i};for(var l=0;l<Si.length&&i!==0&&i<Si[l].priority;l++);Si.splice(l,0,s),l===0&&qv(s)}};var Fv=t.version;if(Fv!=="19.2.4")throw Error(a(527,Fv,"19.2.4"));ae.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=p(i),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var nk={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:K,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ic.isDisabled&&Ic.supportsFiber)try{ns=Ic.inject(nk),ht=Ic}catch{}}return Ko.createRoot=function(s,i){if(!o(s))throw Error(a(299));var l=!1,d="",h=Wy,g=e0,j=t0;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(g=i.onCaughtError),i.onRecoverableError!==void 0&&(j=i.onRecoverableError)),i=Dv(s,1,!1,null,null,l,d,null,h,g,j,Gv),s[_n]=i.current,uh(s),new Eh(i)},Ko.hydrateRoot=function(s,i,l){if(!o(s))throw Error(a(299));var d=!1,h="",g=Wy,j=e0,_=t0,M=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(g=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(_=l.onRecoverableError),l.formState!==void 0&&(M=l.formState)),i=Dv(s,1,!0,i,l??null,d,h,M,g,j,_,Gv),i.context=Lv(null),l=i.current,d=Ln(),d=Gt(d),h=ri(d),h.callback=null,oi(l,h,d),l=d,i.current.lanes=l,Fi(i,l),Ss(i),s[_n]=i.current,uh(s),new Uc(i)},Ko.version="19.2.4",Ko}var nx;function fk(){if(nx)return Th.exports;nx=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(),Th.exports=dk(),Th.exports}var hk=fk(),Ra=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},mk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},pk=class{#t=mk;#e=!1;setTimeoutProvider(e){this.#t=e}setTimeout(e,t){return this.#t.setTimeout(e,t)}clearTimeout(e){this.#t.clearTimeout(e)}setInterval(e,t){return this.#t.setInterval(e,t)}clearInterval(e){this.#t.clearInterval(e)}},ma=new pk;function gk(e){setTimeout(e,0)}var Ca=typeof window>"u"||"Deno"in globalThis;function rn(){}function yk(e,t){return typeof e=="function"?e(t):e}function gm(e){return typeof e=="number"&&e>=0&&e!==1/0}function gS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ai(e,t){return typeof e=="function"?e(t):e}function Zn(e,t){return typeof e=="function"?e(t):e}function sx(e,t){const{type:n="all",exact:a,fetchStatus:o,predicate:c,queryKey:u,stale:f}=e;if(u){if(a){if(t.queryHash!==np(u,t.options))return!1}else if(!nl(t.queryKey,u))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||o&&o!==t.state.fetchStatus||c&&!c(t))}function ix(e,t){const{exact:n,status:a,predicate:o,mutationKey:c}=e;if(c){if(!t.options.mutationKey)return!1;if(n){if(ka(t.options.mutationKey)!==ka(c))return!1}else if(!nl(t.options.mutationKey,c))return!1}return!(a&&t.state.status!==a||o&&!o(t))}function np(e,t){return(t?.queryKeyHashFn||ka)(e)}function ka(e){return JSON.stringify(e,(t,n)=>ym(n)?Object.keys(n).sort().reduce((a,o)=>(a[o]=n[o],a),{}):n)}function nl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>nl(e[n],t[n])):!1}var vk=Object.prototype.hasOwnProperty;function sp(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=ax(e)&&ax(t);if(!a&&!(ym(e)&&ym(t)))return t;const c=(a?e:Object.keys(e)).length,u=a?t:Object.keys(t),f=u.length,m=a?new Array(f):{};let p=0;for(let v=0;v<f;v++){const y=a?v:u[v],x=e[y],b=t[y];if(x===b){m[y]=x,(a?v<c:vk.call(e,y))&&p++;continue}if(x===null||b===null||typeof x!="object"||typeof b!="object"){m[y]=b;continue}const N=sp(x,b,n+1);m[y]=N,N===x&&p++}return c===f&&p===c?e:m}function sl(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ax(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function ym(e){if(!rx(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!rx(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function rx(e){return Object.prototype.toString.call(e)==="[object Object]"}function xk(e){return new Promise(t=>{ma.setTimeout(t,e)})}function vm(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?sp(e,t):t}function bk(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function Sk(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var ip=Symbol();function yS(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ip?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function ap(e,t){return typeof e=="function"?e(...t):!!e}function jk(e,t,n){let a=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),a||(a=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var wk=class extends Ra{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Ca&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},rp=new wk;function xm(){let e,t;const n=new Promise((o,c)=>{e=o,t=c});n.status="pending",n.catch(()=>{});function a(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{a({status:"fulfilled",value:o}),e(o)},n.reject=o=>{a({status:"rejected",reason:o}),t(o)},n}var Nk=gk;function Ck(){let e=[],t=0,n=f=>{f()},a=f=>{f()},o=Nk;const c=f=>{t?e.push(f):o(()=>{n(f)})},u=()=>{const f=e;e=[],f.length&&o(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||u()}return m},batchCalls:f=>(...m)=>{c(()=>{f(...m)})},schedule:c,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{o=f}}}var Ot=Ck(),kk=class extends Ra{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Ca&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},xu=new kk;function zk(e){return Math.min(1e3*2**e,3e4)}function vS(e){return(e??"online")==="online"?xu.isOnline():!0}var bm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function xS(e){let t=!1,n=0,a;const o=xm(),c=()=>o.status!=="pending",u=S=>{if(!c()){const C=new bm(S);x(C),e.onCancel?.(C)}},f=()=>{t=!0},m=()=>{t=!1},p=()=>rp.isFocused()&&(e.networkMode==="always"||xu.isOnline())&&e.canRun(),v=()=>vS(e.networkMode)&&e.canRun(),y=S=>{c()||(a?.(),o.resolve(S))},x=S=>{c()||(a?.(),o.reject(S))},b=()=>new Promise(S=>{a=C=>{(c()||p())&&S(C)},e.onPause?.()}).then(()=>{a=void 0,c()||e.onContinue?.()}),N=()=>{if(c())return;let S;const C=n===0?e.initialPromise:void 0;try{S=C??e.fn()}catch(k){S=Promise.reject(k)}Promise.resolve(S).then(y).catch(k=>{if(c())return;const A=e.retry??(Ca?0:3),R=e.retryDelay??zk,z=typeof R=="function"?R(n,k):R,$=A===!0||typeof A=="number"&&n<A||typeof A=="function"&&A(n,k);if(t||!$){x(k);return}n++,e.onFail?.(n,k),xk(z).then(()=>p()?void 0:b()).then(()=>{t?x(k):N()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(a?.(),o),cancelRetry:f,continueRetry:m,canStart:v,start:()=>(v()?N():b().then(N),o)}}var bS=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gm(this.gcTime)&&(this.#t=ma.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ca?1/0:300*1e3))}clearGcTimeout(){this.#t&&(ma.clearTimeout(this.#t),this.#t=void 0)}},_k=class extends bS{#t;#e;#n;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=lx(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=lx(this.options);t.data!==void 0&&(this.setState(ox(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=vm(this.state.data,e,this.options);return this.#r({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#r({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>Zn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ip||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ai(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!gS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,a=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},o=()=>{const f=yS(this.options,t),p=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return a(v),v})();return this.#o=!1,this.options.persister?this.options.persister(f,p,this):f(p)},u=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return a(f),f})();this.options.behavior?.onFetch(u,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#r({type:"fetch",meta:u.fetchOptions?.meta}),this.#s=xS({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:f=>{f instanceof bm&&f.revert&&this.setState({...this.#e,fetchStatus:"idle"}),n.abort()},onFail:(f,m)=>{this.#r({type:"failed",failureCount:f,error:m})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const f=await this.#s.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#n.config.onSuccess?.(f,this),this.#n.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof bm){if(f.silent)return this.#s.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#r({type:"error",error:f}),this.#n.config.onError?.(f,this),this.#n.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...SS(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...ox(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?a:void 0,a;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Ot.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function SS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ox(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function lx(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var op=class extends Ra{constructor(e,t){super(),this.options=t,this.#t=e,this.#r=null,this.#o=xm(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#i=void 0;#s;#a;#o;#r;#m;#d;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),cx(this.#e,this.options)?this.#p():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Sm(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Sm(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#S(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zn(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!sl(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const a=this.hasListeners();a&&ux(this.#e,n,this.options,t)&&this.#p(),this.updateResult(),a&&(this.#e!==n||Zn(this.options.enabled,this.#e)!==Zn(t.enabled,this.#e)||Ai(this.options.staleTime,this.#e)!==Ai(t.staleTime,this.#e))&&this.#g();const o=this.#y();a&&(this.#e!==n||Zn(this.options.enabled,this.#e)!==Zn(t.enabled,this.#e)||o!==this.#l)&&this.#v(o)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return Rk(this,n)&&(this.#i=n,this.#a=this.options,this.#s=this.#e.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,a)=>(this.trackProp(a),t?.(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#p(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(rn)),t}#g(){this.#b();const e=Ai(this.options.staleTime,this.#e);if(Ca||this.#i.isStale||!gm(e))return;const n=gS(this.#i.dataUpdatedAt,e)+1;this.#c=ma.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#S(),this.#l=e,!(Ca||Zn(this.options.enabled,this.#e)===!1||!gm(this.#l)||this.#l===0)&&(this.#u=ma.setInterval(()=>{(this.options.refetchIntervalInBackground||rp.isFocused())&&this.#p()},this.#l))}#x(){this.#g(),this.#v(this.#y())}#b(){this.#c&&(ma.clearTimeout(this.#c),this.#c=void 0)}#S(){this.#u&&(ma.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#e,a=this.options,o=this.#i,c=this.#s,u=this.#a,m=e!==n?e.state:this.#n,{state:p}=e;let v={...p},y=!1,x;if(t._optimisticResults){const O=this.hasListeners(),H=!O&&cx(e,t),ee=O&&ux(e,n,t,a);(H||ee)&&(v={...v,...SS(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:b,errorUpdatedAt:N,status:S}=v;x=v.data;let C=!1;if(t.placeholderData!==void 0&&x===void 0&&S==="pending"){let O;o?.isPlaceholderData&&t.placeholderData===u?.placeholderData?(O=o.data,C=!0):O=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,O!==void 0&&(S="success",x=vm(o?.data,O,t),y=!0)}if(t.select&&x!==void 0&&!C)if(o&&x===c?.data&&t.select===this.#m)x=this.#d;else try{this.#m=t.select,x=t.select(x),x=vm(o?.data,x,t),this.#d=x,this.#r=null}catch(O){this.#r=O}this.#r&&(b=this.#r,x=this.#d,N=Date.now(),S="error");const k=v.fetchStatus==="fetching",A=S==="pending",R=S==="error",z=A&&k,$=x!==void 0,E={status:S,fetchStatus:v.fetchStatus,isPending:A,isSuccess:S==="success",isError:R,isInitialLoading:z,isLoading:z,data:x,dataUpdatedAt:v.dataUpdatedAt,error:b,errorUpdatedAt:N,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!A,isLoadingError:R&&!$,isPaused:v.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:R&&$,isStale:lp(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Zn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=E.data!==void 0,H=E.status==="error"&&!O,ee=ue=>{H?ue.reject(E.error):O&&ue.resolve(E.data)},V=()=>{const ue=this.#o=E.promise=xm();ee(ue)},se=this.#o;switch(se.status){case"pending":e.queryHash===n.queryHash&&ee(se);break;case"fulfilled":(H||E.data!==se.value)&&V();break;case"rejected":(!H||E.error!==se.reason)&&V();break}}return E}updateResult(){const e=this.#i,t=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#a=this.options,this.#s.data!==void 0&&(this.#f=this.#e),sl(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!this.#h.size)return!0;const c=new Set(o??this.#h);return this.options.throwOnError&&c.add("error"),Object.keys(this.#i).some(u=>{const f=u;return this.#i[f]!==e[f]&&c.has(f)})};this.#w({listeners:n()})}#j(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#w(e){Ot.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Ek(e,t){return Zn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function cx(e,t){return Ek(e,t)||e.state.data!==void 0&&Sm(e,t,t.refetchOnMount)}function Sm(e,t,n){if(Zn(t.enabled,e)!==!1&&Ai(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&lp(e,t)}return!1}function ux(e,t,n,a){return(e!==t||Zn(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&lp(e,n)}function lp(e,t){return Zn(t.enabled,e)!==!1&&e.isStaleByTime(Ai(t.staleTime,e))}function Rk(e,t){return!sl(e.getCurrentResult(),t)}function dx(e){return{onFetch:(t,n)=>{const a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,c=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const p=async()=>{let v=!1;const y=N=>{jk(N,()=>t.signal,()=>v=!0)},x=yS(t.options,t.fetchOptions),b=async(N,S,C)=>{if(v)return Promise.reject();if(S==null&&N.pages.length)return Promise.resolve(N);const A=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return y(P),P})(),R=await x(A),{maxPages:z}=t.options,$=C?Sk:bk;return{pages:$(N.pages,R,z),pageParams:$(N.pageParams,S,z)}};if(o&&c.length){const N=o==="backward",S=N?Ak:fx,C={pages:c,pageParams:u},k=S(a,C);f=await b(C,k,N)}else{const N=e??c.length;do{const S=m===0?u[0]??a.initialPageParam:fx(a,f);if(m>0&&S==null)break;f=await b(f,S),m++}while(m<N)}return f};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=p}}}function fx(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function Ak(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Tk=class extends bS{#t;#e;#n;#i;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#e=[],this.state=e.state||jS(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=xS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(c,u)=>{this.#s({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const a=this.state.status==="pending",o=!this.#i.canStart();try{if(a)t();else{this.#s({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#s({type:"pending",context:u,variables:e,isPaused:o})}const c=await this.#i.start();return await this.#n.config.onSuccess?.(c,e,this.state.context,this,n),await this.options.onSuccess?.(c,e,this.state.context,n),await this.#n.config.onSettled?.(c,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(c,null,e,this.state.context,n),this.#s({type:"success",data:c}),c}catch(c){try{await this.#n.config.onError?.(c,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(c,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,c,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,c,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#s({type:"error",error:c}),c}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Ot.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function jS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var wS=class extends Ra{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const a=new Tk({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(a),a}add(e){this.#t.add(e);const t=Bc(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=Bc(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Bc(e);if(typeof t=="string"){const a=this.#e.get(t)?.find(o=>o.state.status==="pending");return!a||a===e}else return!0}runNext(e){const t=Bc(e);return typeof t=="string"?this.#e.get(t)?.find(a=>a!==e&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ot.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ix(t,n))}findAll(e={}){return this.getAll().filter(t=>ix(e,t))}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Ot.batch(()=>Promise.all(e.map(t=>t.continue().catch(rn))))}};function Bc(e){return e.options.scope?.id}var Ok=class extends Ra{#t;#e=void 0;#n;#i;constructor(t,n){super(),this.#t=t,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#t.defaultMutationOptions(t),sl(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ka(n.mutationKey)!==ka(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#a()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#s(){const t=this.#n?.state??jS();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Ot.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#e.variables,a=this.#e.context,o={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#i.onSuccess?.(t.data,n,a,o)}catch(c){Promise.reject(c)}try{this.#i.onSettled?.(t.data,null,n,a,o)}catch(c){Promise.reject(c)}}else if(t?.type==="error"){try{this.#i.onError?.(t.error,n,a,o)}catch(c){Promise.reject(c)}try{this.#i.onSettled?.(void 0,t.error,n,a,o)}catch(c){Promise.reject(c)}}}this.listeners.forEach(n=>{n(this.#e)})})}};function hx(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function Dk(e,t,n){const a=e.slice(0);return a[t]=n,a}var Lk=class extends Ra{#t;#e;#n;#i;#s;#a;#o;#r;#m;#d=[];constructor(e,t,n){super(),this.#t=e,this.#i=n,this.#n=[],this.#s=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(e=>{e.subscribe(t=>{this.#l(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#i=t,Ot.batch(()=>{const n=this.#s,a=this.#u(this.#n);a.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const o=a.map(v=>v.observer),c=o.map(v=>v.getCurrentResult()),u=n.length!==o.length,f=o.some((v,y)=>v!==n[y]),m=u||f,p=m?!0:c.some((v,y)=>{const x=this.#e[y];return!x||!sl(v,x)});!m&&!p||(m&&(this.#d=a,this.#s=o),this.#e=c,this.hasListeners()&&(m&&(hx(n,o).forEach(v=>{v.destroy()}),hx(o,n).forEach(v=>{v.subscribe(y=>{this.#l(v,y)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(e=>e.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(e,t){const n=this.#u(e),a=n.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=n.map(c=>c.defaultedQueryOptions.queryHash);return[a,c=>this.#c(c??a,t,o),()=>this.#f(a,n)]}#f(e,t){return t.map((n,a)=>{const o=e[a];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,c=>{t.forEach(u=>{u.observer.trackProp(c)})})})}#c(e,t,n){if(t){const a=this.#m,o=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((c,u)=>c!==a[u]));return(!this.#a||this.#e!==this.#r||o||t!==this.#o)&&(this.#o=t,this.#r=this.#e,n!==void 0&&(this.#m=n),this.#a=sp(this.#a,t(e))),this.#a}return e}#u(e){const t=new Map;this.#s.forEach(a=>{const o=a.options.queryHash;if(!o)return;const c=t.get(o);c?c.push(a):t.set(o,[a])});const n=[];return e.forEach(a=>{const o=this.#t.defaultQueryOptions(a),u=t.get(o.queryHash)?.shift()??new op(this.#t,o);n.push({defaultedQueryOptions:o,observer:u})}),n}#l(e,t){const n=this.#s.indexOf(e);n!==-1&&(this.#e=Dk(this.#e,n,t),this.#h())}#h(){if(this.hasListeners()){const e=this.#a,t=this.#f(this.#e,this.#d),n=this.#c(t,this.#i?.combine);e!==n&&Ot.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}},Mk=class extends Ra{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const a=t.queryKey,o=t.queryHash??np(a,t);let c=this.get(o);return c||(c=new _k({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(c)),c}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ot.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>sx(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>sx(e,n)):t}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$k=class{#t;#e;#n;#i;#s;#a;#o;#r;constructor(e={}){this.#t=e.queryCache||new Mk,this.#e=e.mutationCache||new wS,this.#n=e.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=rp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#r=xu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#r?.(),this.#r=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ai(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),c=this.#t.get(a.queryHash)?.state.data,u=yk(t,c);if(u!==void 0)return this.#t.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return Ot.batch(()=>this.#t.findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;Ot.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return Ot.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=Ot.batch(()=>this.#t.findAll(e).map(o=>o.cancel(n)));return Promise.all(a).then(rn).catch(rn)}invalidateQueries(e,t={}){return Ot.batch(()=>(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=Ot.batch(()=>this.#t.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,n);return n.throwOnError||(c=c.catch(rn)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(a).then(rn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(Ai(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e.behavior=dx(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=dx(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xu.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(ka(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(a=>{nl(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(ka(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(a=>{nl(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=np(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ip&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},NS=w.createContext(void 0),Ui=e=>{const t=w.useContext(NS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Pk=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(NS.Provider,{value:e,children:t})),CS=w.createContext(!1),kS=()=>w.useContext(CS);CS.Provider;function Uk(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Ik=w.createContext(Uk()),zS=()=>w.useContext(Ik),_S=(e,t,n)=>{const a=n?.state.error&&typeof e.throwOnError=="function"?ap(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},ES=e=>{w.useEffect(()=>{e.clearReset()},[e])},RS=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(o&&e.data===void 0||ap(n,[e.error,a])),AS=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...o)=>n(a(...o)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Bk=(e,t)=>e.isLoading&&e.isFetching&&!t,jm=(e,t)=>e?.suspense&&t.isPending,wm=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qk({queries:e,...t},n){const a=Ui(),o=kS(),c=zS(),u=w.useMemo(()=>e.map(S=>{const C=a.defaultQueryOptions(S);return C._optimisticResults=o?"isRestoring":"optimistic",C}),[e,a,o]);u.forEach(S=>{AS(S);const C=a.getQueryCache().get(S.queryHash);_S(S,c,C)}),ES(c);const[f]=w.useState(()=>new Lk(a,u,t)),[m,p,v]=f.getOptimisticResult(u,t.combine),y=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(S=>y?f.subscribe(Ot.batchCalls(S)):rn,[f,y]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setQueries(u,t)},[u,t,f]);const b=m.some((S,C)=>jm(u[C],S))?m.flatMap((S,C)=>{const k=u[C];if(k&&jm(k,S)){const A=new op(a,k);return wm(k,A,c)}return[]}):[];if(b.length>0)throw Promise.all(b);const N=m.find((S,C)=>{const k=u[C];return k&&RS({result:S,errorResetBoundary:c,throwOnError:k.throwOnError,query:a.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(N?.error)throw N.error;return p(v())}function Kk(e,t,n){const a=kS(),o=zS(),c=Ui(),u=c.defaultQueryOptions(e);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const f=c.getQueryCache().get(u.queryHash);u._optimisticResults=a?"isRestoring":"optimistic",AS(u),_S(u,o,f),ES(o);const m=!c.getQueryCache().get(u.queryHash),[p]=w.useState(()=>new t(c,u)),v=p.getOptimisticResult(u),y=!a&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(x=>{const b=y?p.subscribe(Ot.batchCalls(x)):rn;return p.updateResult(),b},[p,y]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),w.useEffect(()=>{p.setOptions(u)},[u,p]),jm(u,v))throw wm(u,p,o);if(RS({result:v,errorResetBoundary:o,throwOnError:u.throwOnError,query:f,suspense:u.suspense}))throw v.error;return c.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!Ca&&Bk(v,a)&&(m?wm(u,p,o):f?.promise)?.catch(rn).finally(()=>{p.updateResult()}),u.notifyOnChangeProps?v:p.trackResult(v)}function ba(e,t){return Kk(e,op)}function pl(e,t){const n=Ui(),[a]=w.useState(()=>new Ok(n,e));w.useEffect(()=>{a.setOptions(e)},[a,e]);const o=w.useSyncExternalStore(w.useCallback(u=>a.subscribe(Ot.batchCalls(u)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=w.useCallback((u,f)=>{a.mutate(u,f).catch(rn)},[a]);if(o.error&&ap(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}var qc=typeof window<"u"?w.useLayoutEffect:w.useEffect;function Mh(e){const t=w.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Hk(e,t,n={},a={}){w.useEffect(()=>{if(!e.current||a.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([c])=>{t(c)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,a.disabled,e])}function Gk(e){const t=w.useRef(null);return w.useImperativeHandle(e,()=>t.current,[]),t}var Fk=!1;function il(e){return e[e.length-1]}function Zk(e){return typeof e=="function"}function Ei(e,t){return Zk(e)?e(t):e}var Vk=Object.prototype.hasOwnProperty,mx=Object.prototype.propertyIsEnumerable,Qk=()=>Object.create(null),ua=(e,t)=>pa(e,t,Qk);function pa(e,t,n=()=>({}),a=0){if(e===t)return e;if(a>500)return t;const o=t,c=yx(e)&&yx(o);if(!c&&!(bu(e)&&bu(o)))return o;const u=c?e:px(e);if(!u)return o;const f=c?o:px(o);if(!f)return o;const m=u.length,p=f.length,v=c?new Array(p):n();let y=0;for(let x=0;x<p;x++){const b=c?x:f[x],N=e[b],S=o[b];if(N===S){v[b]=N,(c?x<m:Vk.call(e,b))&&y++;continue}if(N===null||S===null||typeof N!="object"||typeof S!="object"){v[b]=S;continue}const C=pa(N,S,n,a+1);v[b]=C,C===N&&y++}return m===p&&y===m?e:v}function px(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!mx.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const a=t;for(const o of n){if(!mx.call(e,o))return!1;a.push(o)}return a}function bu(e){if(!gx(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!gx(n)||!n.hasOwnProperty("isPrototypeOf"))}function gx(e){return Object.prototype.toString.call(e)==="[object Object]"}function yx(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sa(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let a=0,o=e.length;a<o;a++)if(!Sa(e[a],t[a],n))return!1;return!0}if(bu(e)&&bu(t)){const a=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!a||t[u]!==void 0)&&!Sa(e[u],t[u],n))return!1;return!0}let o=0;if(!a)o=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&o++;let c=0;for(const u in t)if((!a||t[u]!==void 0)&&(c++,c>o||!Sa(e[u],t[u],n)))return!1;return o===c}return!1}function Pr(e){let t,n;const a=new Promise((o,c)=>{t=o,n=c});return a.status="pending",a.resolve=o=>{a.status="resolved",a.value=o,t(o),e?.(o)},a.reject=o=>{a.status="rejected",n(o)},a}function al(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function Yk(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function vx(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return Yk(t)}var Jk=["http:","https:","mailto:","tel:"];function Su(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ho(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,a="",o;for(;(o=t.exec(e))!==null;)a+=vx(e.slice(n,o.index))+o[0],n=t.lastIndex;a=a+vx(n?e.slice(n):e);let c=!1;return a.startsWith("//")&&(c=!0,a="/"+a.replace(/^\/+/,"")),{path:a,handledProtocolRelativeURL:c}}function Xk(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function ju(e){const t=new Map;let n,a;const o=c=>{c.next&&(c.prev?(c.prev.next=c.next,c.next.prev=c.prev,c.next=void 0,a&&(a.next=c,c.prev=a)):(c.next.prev=void 0,n=c.next,c.next=void 0,a&&(c.prev=a,a.next=c)),a=c)};return{get(c){const u=t.get(c);if(u)return o(u),u.value},set(c,u){if(t.size>=e&&n){const m=n;t.delete(m.key),m.next&&(n=m.next,m.next.prev=void 0),m===a&&(a=void 0)}const f=t.get(c);if(f)f.value=u,o(f);else{const m={key:c,value:u,prev:a};a&&(a.next=m),a=m,n||(n=m),t.set(c,m)}},clear(){t.clear(),n=void 0,a=void 0}}}var Wk="Invariant failed";function Mi(e,t){if(!e)throw new Error(Wk)}var ga=4,TS=5;function ez(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function cp(e,t,n=new Uint16Array(6)){const a=e.indexOf("/",t),o=a===-1?e.length:a,c=e.substring(t,o);if(!c||!c.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(c==="$"){const f=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=f,n[4]=f,n[5]=f,n}if(c.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const u=ez(c);if(u){const[f,m]=u,p=c.charCodeAt(f+1);if(p===45){if(f+2<c.length&&c.charCodeAt(f+2)===36){const v=f+3,y=m;if(v<y)return n[0]=3,n[1]=t+f,n[2]=t+v,n[3]=t+y,n[4]=t+m+1,n[5]=o,n}}else if(p===36){const v=f+1,y=f+2;return y===m?(n[0]=2,n[1]=t+f,n[2]=t+v,n[3]=t+y,n[4]=t+m+1,n[5]=e.length,n):(n[0]=1,n[1]=t+f,n[2]=t+y,n[3]=t+m,n[4]=t+m+1,n[5]=o,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function Bu(e,t,n,a,o,c,u){u?.(n);let f=a;{const m=n.fullPath??n.from,p=m.length,v=n.options?.caseSensitive??e,y=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;f<p;){const b=cp(m,f,t);let N;const S=f,C=b[5];switch(f=C+1,c++,b[0]){case 0:{const k=m.substring(b[2],b[3]);if(v){const A=o.static?.get(k);if(A)N=A;else{o.static??=new Map;const R=ya(n.fullPath??n.from);R.parent=o,R.depth=c,N=R,o.static.set(k,R)}}else{const A=k.toLowerCase(),R=o.staticInsensitive?.get(A);if(R)N=R;else{o.staticInsensitive??=new Map;const z=ya(n.fullPath??n.from);z.parent=o,z.depth=c,N=z,o.staticInsensitive.set(A,z)}}break}case 1:{const k=m.substring(S,b[1]),A=m.substring(b[4],C),R=v&&!!(k||A),z=k?R?k:k.toLowerCase():void 0,$=A?R?A:A.toLowerCase():void 0,P=!y&&o.dynamic?.find(E=>!E.skipOnParamError&&E.caseSensitive===R&&E.prefix===z&&E.suffix===$);if(P)N=P;else{const E=Ph(1,n.fullPath??n.from,R,z,$);N=E,E.depth=c,E.parent=o,o.dynamic??=[],o.dynamic.push(E)}break}case 3:{const k=m.substring(S,b[1]),A=m.substring(b[4],C),R=v&&!!(k||A),z=k?R?k:k.toLowerCase():void 0,$=A?R?A:A.toLowerCase():void 0,P=!y&&o.optional?.find(E=>!E.skipOnParamError&&E.caseSensitive===R&&E.prefix===z&&E.suffix===$);if(P)N=P;else{const E=Ph(3,n.fullPath??n.from,R,z,$);N=E,E.parent=o,E.depth=c,o.optional??=[],o.optional.push(E)}break}case 2:{const k=m.substring(S,b[1]),A=m.substring(b[4],C),R=v&&!!(k||A),z=k?R?k:k.toLowerCase():void 0,$=A?R?A:A.toLowerCase():void 0,P=Ph(2,n.fullPath??n.from,R,z,$);N=P,P.parent=o,P.depth=c,o.wildcard??=[],o.wildcard.push(P)}}o=N}if(y&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const b=ya(n.fullPath??n.from);b.kind=TS,b.parent=o,c++,b.depth=c,o.pathless??=[],o.pathless.push(b),o=b}const x=(n.path||!n.children)&&!n.isRoot;if(x&&m.endsWith("/")){const b=ya(n.fullPath??n.from);b.kind=ga,b.parent=o,c++,b.depth=c,o.index=b,o=b}o.parse=n.options?.params?.parse??null,o.skipOnParamError=y,o.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,x&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const m of n.children)Bu(e,t,m,f,o,c,u)}function $h(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function zi(e){if(e.pathless)for(const t of e.pathless)zi(t);if(e.static)for(const t of e.static.values())zi(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())zi(t);if(e.dynamic?.length){e.dynamic.sort($h);for(const t of e.dynamic)zi(t)}if(e.optional?.length){e.optional.sort($h);for(const t of e.optional)zi(t)}if(e.wildcard?.length){e.wildcard.sort($h);for(const t of e.wildcard)zi(t)}}function ya(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Ph(e,t,n,a,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:a,suffix:o}}function tz(e,t){const n=ya("/"),a=new Uint16Array(6);for(const o of e)Bu(!1,a,o,1,n,0);zi(n),t.masksTree=n,t.flatCache=ju(1e3)}function nz(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const a=up(e,t.masksTree);return t.flatCache.set(e,a),a}function sz(e,t,n,a,o){e||="/",a||="/";const c=t?`case\0${e}`:e;let u=o.singleCache.get(c);return u||(u=ya("/"),Bu(t,new Uint16Array(6),{from:e},1,u,0),o.singleCache.set(c,u)),up(a,u,n)}function iz(e,t,n=!1){const a=n?e:`nofuzz\0${e}`,o=t.matchCache.get(a);if(o!==void 0)return o;e||="/";let c;try{c=up(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)c=null;else throw u}return c&&(c.branch=oz(c.route)),t.matchCache.set(a,c),c}function az(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function rz(e,t=!1,n){const a=ya(e.fullPath),o=new Uint16Array(6),c={},u={};let f=0;return Bu(t,o,e,1,a,0,m=>{if(n?.(m,f),Mi(!(m.id in c),`Duplicate routes found with id: ${String(m.id)}`),c[m.id]=m,f!==0&&m.path){const p=az(m.fullPath);(!u[p]||m.fullPath.endsWith("/"))&&(u[p]=m)}f++}),zi(a),{processedTree:{segmentTree:a,singleCache:ju(1e3),matchCache:ju(1e3),flatCache:null,masksTree:null},routesById:c,routesByPath:u}}function up(e,t,n=!1){const a=e.split("/"),o=cz(e,a,t,n);if(!o)return null;const[c]=OS(e,a,o);return{route:o.node.route,rawParams:c,parsedParams:o.parsedParams}}function OS(e,t,n){const a=lz(n.node);let o=null;const c=Object.create(null);let u=n.extract?.part??0,f=n.extract?.node??0,m=n.extract?.path??0,p=n.extract?.segment??0;for(;f<a.length;u++,f++,m++,p++){const v=a[f];if(v.kind===ga)break;if(v.kind===TS){p--,u--,m--;continue}const y=t[u],x=m;if(y&&(m+=y.length),v.kind===1){o??=n.node.fullPath.split("/");const b=o[p],N=v.prefix?.length??0;if(b.charCodeAt(N)===123){const S=v.suffix?.length??0,C=b.substring(N+2,b.length-S-1),k=y.substring(N,y.length-S);c[C]=decodeURIComponent(k)}else{const S=b.substring(1);c[S]=decodeURIComponent(y)}}else if(v.kind===3){if(n.skipped&1<<f){u--,m=x-1;continue}o??=n.node.fullPath.split("/");const b=o[p],N=v.prefix?.length??0,S=v.suffix?.length??0,C=b.substring(N+3,b.length-S-1),k=v.suffix||v.prefix?y.substring(N,y.length-S):y;k&&(c[C]=decodeURIComponent(k))}else if(v.kind===2){const b=v,N=e.substring(x+(b.prefix?.length??0),e.length-(b.suffix?.length??0)),S=decodeURIComponent(N);c["*"]=S,c._splat=S;break}}return n.rawParams&&Object.assign(c,n.rawParams),[c,{part:u,node:f,path:m,segment:p}]}function oz(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function lz(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function cz(e,t,n,a){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!il(t),c=o&&e!=="/",u=t.length-(o?1:0),f=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let m=null,p=null,v=null;for(;f.length;){const y=f.pop(),{node:x,index:b,skipped:N,depth:S,statics:C,dynamics:k,optionals:A}=y;let{extract:R,rawParams:z,parsedParams:$}=y;if(x.skipOnParamError){if(!Uh(e,t,y))continue;z=y.rawParams,R=y.extract,$=y.parsedParams}a&&x.route&&x.kind!==ga&&Go(p,y)&&(p=y);const P=b===u;if(P&&(x.route&&!c&&Go(v,y)&&(v=y),!x.optional&&!x.wildcard&&!x.index&&!x.pathless))continue;const E=P?void 0:t[b];let O;if(P&&x.index){const H={node:x.index,index:b,skipped:N,depth:S+1,statics:C,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$};let ee=!0;if(x.index.skipOnParamError&&(Uh(e,t,H)||(ee=!1)),ee){if(C===u&&!k&&!A&&!N)return H;Go(v,H)&&(v=H)}}if(x.wildcard&&Go(m,y))for(const H of x.wildcard){const{prefix:ee,suffix:V}=H;if(ee&&(P||!(H.caseSensitive?E:O??=E.toLowerCase()).startsWith(ee)))continue;if(V){if(P)continue;const ue=t.slice(b).join("/").slice(-V.length);if((H.caseSensitive?ue:ue.toLowerCase())!==V)continue}const se={node:H,index:u,skipped:N,depth:S,statics:C,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$};if(!(H.skipOnParamError&&!Uh(e,t,se))){m=se;break}}if(x.optional){const H=N|1<<S,ee=S+1;for(let V=x.optional.length-1;V>=0;V--){const se=x.optional[V];f.push({node:se,index:b,skipped:H,depth:ee,statics:C,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$})}if(!P)for(let V=x.optional.length-1;V>=0;V--){const se=x.optional[V],{prefix:ue,suffix:_e}=se;if(ue||_e){const xe=se.caseSensitive?E:O??=E.toLowerCase();if(ue&&!xe.startsWith(ue)||_e&&!xe.endsWith(_e))continue}f.push({node:se,index:b+1,skipped:N,depth:ee,statics:C,dynamics:k,optionals:A+1,extract:R,rawParams:z,parsedParams:$})}}if(!P&&x.dynamic&&E)for(let H=x.dynamic.length-1;H>=0;H--){const ee=x.dynamic[H],{prefix:V,suffix:se}=ee;if(V||se){const ue=ee.caseSensitive?E:O??=E.toLowerCase();if(V&&!ue.startsWith(V)||se&&!ue.endsWith(se))continue}f.push({node:ee,index:b+1,skipped:N,depth:S+1,statics:C,dynamics:k+1,optionals:A,extract:R,rawParams:z,parsedParams:$})}if(!P&&x.staticInsensitive){const H=x.staticInsensitive.get(O??=E.toLowerCase());H&&f.push({node:H,index:b+1,skipped:N,depth:S+1,statics:C+1,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$})}if(!P&&x.static){const H=x.static.get(E);H&&f.push({node:H,index:b+1,skipped:N,depth:S+1,statics:C+1,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$})}if(x.pathless){const H=S+1;for(let ee=x.pathless.length-1;ee>=0;ee--){const V=x.pathless[ee];f.push({node:V,index:b,skipped:N,depth:H,statics:C,dynamics:k,optionals:A,extract:R,rawParams:z,parsedParams:$})}}}if(v&&m)return Go(m,v)?v:m;if(v)return v;if(m)return m;if(a&&p){let y=p.index;for(let b=0;b<p.index;b++)y+=t[b].length;const x=y===e.length?"/":e.slice(y);return p.rawParams??=Object.create(null),p.rawParams["**"]=decodeURIComponent(x),p}return null}function Uh(e,t,n){try{const[a,o]=OS(e,t,n);n.rawParams=a,n.extract=o;const c=n.node.parse(a);return n.parsedParams=Object.assign(Object.create(null),n.parsedParams,c),!0}catch{return null}}function Go(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ga)>(e.node.kind===ga)||t.node.kind===ga==(e.node.kind===ga)&&t.depth>e.depth))):!0}function cu(e){return dp(e.filter(t=>t!==void 0).join("/"))}function dp(e){return e.replace(/\/{2,}/g,"/")}function DS(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ti(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function LS(e){return Ti(DS(e))}function wu(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function uz(e,t,n){return wu(e,n)===wu(t,n)}function dz({base:e,to:t,trailingSlash:n="never",cache:a}){const o=t.startsWith("/"),c=!o&&t===".";let u;if(a){u=o?t:c?e:e+"\0"+t;const y=a.get(u);if(y)return y}let f;if(c)f=e.split("/");else if(o)f=t.split("/");else{for(f=e.split("/");f.length>1&&il(f)==="";)f.pop();const y=t.split("/");for(let x=0,b=y.length;x<b;x++){const N=y[x];N===""?x?x===b-1&&f.push(N):f=[N]:N===".."?f.pop():N==="."||f.push(N)}}f.length>1&&(il(f)===""?n==="never"&&f.pop():n==="always"&&f.push(""));let m,p="";for(let y=0;y<f.length;y++){y>0&&(p+="/");const x=f[y];if(!x)continue;m=cp(x,0,m);const b=m[0];if(b===0){p+=x;continue}const N=m[5],S=x.substring(0,m[1]),C=x.substring(m[4],N),k=x.substring(m[2],m[3]);b===1?p+=S||C?`${S}{$${k}}${C}`:`$${k}`:b===2?p+=S||C?`${S}{$}${C}`:"$":p+=`${S}{-$${k}}${C}`}p=dp(p);const v=p||"/";return u&&a&&a.set(u,v),v}function fz(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),a=new RegExp(n,"g");return o=>o.replace(a,c=>t.get(c)??c)}function Ih(e,t,n){const a=t[e];return typeof a!="string"?a:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(a)?a:a.split("/").map(o=>bx(o,n)).join("/"):bx(a,n)}function xx({path:e,params:t,decoder:n,...a}){let o=!1;const c=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:c,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:c,isMissingParams:o};const u=e.length;let f=0,m,p="";for(;f<u;){const v=f;m=cp(e,v,m);const y=m[5];if(f=y+1,v===y)continue;const x=m[0];if(x===0){p+="/"+e.substring(v,y);continue}if(x===2){const b=t._splat;c._splat=b,c["*"]=b;const N=e.substring(v,m[1]),S=e.substring(m[4],y);if(!b){o=!0,(N||S)&&(p+="/"+N+S);continue}const C=Ih("_splat",t,n);p+="/"+N+C+S;continue}if(x===1){const b=e.substring(m[2],m[3]);!o&&!(b in t)&&(o=!0),c[b]=t[b];const N=e.substring(v,m[1]),S=e.substring(m[4],y),C=Ih(b,t,n)??"undefined";p+="/"+N+C+S;continue}if(x===3){const b=e.substring(m[2],m[3]),N=t[b];if(N==null)continue;c[b]=N;const S=e.substring(v,m[1]),C=e.substring(m[4],y),k=Ih(b,t,n)??"";p+="/"+S+k+C;continue}}return e.endsWith("/")&&(p+="/"),{usedParams:c,interpolatedPath:p||"/",isMissingParams:o}}function bx(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function hn(e){return!!e?.isNotFound}function hz(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var Nm="tsr-scroll-restoration-v1_3",mz=(e,t)=>{let n;return(...a)=>{n||(n=setTimeout(()=>{e(...a),n=null},t))}};function pz(){const e=hz();if(!e)return null;const t=e.getItem(Nm);let n=t?JSON.parse(t):{};return{state:n,set:a=>{n=Ei(a,n)||n;try{e.setItem(Nm,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var Kc=pz(),gz=e=>e.state.__TSR_key||e.href;function yz(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}var Nu=!1;function vz({storageKey:e,key:t,behavior:n,shouldScrollRestoration:a,scrollToTopSelectors:o,location:c}){let u;try{u=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(p){console.error(p);return}const f=t||window.history.state?.__TSR_key,m=u[f];Nu=!0;e:{if(a&&m&&Object.keys(m).length>0){for(const y in m){const x=m[y];if(y==="window")window.scrollTo({top:x.scrollY,left:x.scrollX,behavior:n});else if(y){const b=document.querySelector(y);b&&(b.scrollLeft=x.scrollX,b.scrollTop=x.scrollY)}}break e}const p=(c??window.location).hash.split("#",2)[1];if(p){const y=window.history.state?.__hashScrollIntoViewOptions??!0;if(y){const x=document.getElementById(p);x&&x.scrollIntoView(y)}break e}const v={top:0,left:0,behavior:n};if(window.scrollTo(v),o)for(const y of o){if(y==="window")continue;const x=typeof y=="function"?y():document.querySelector(y);x&&x.scrollTo(v)}}Nu=!1}function xz(e,t){if(!Kc||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Kc))return;e.isScrollRestorationSetup=!0,Nu=!1;const n=e.options.getScrollRestorationKey||gz;window.history.scrollRestoration="manual";const a=o=>{if(Nu||!e.isScrollRestoring)return;let c="";if(o.target===document||o.target===window)c="window";else{const f=o.target.getAttribute("data-scroll-restoration-id");f?c=`[data-scroll-restoration-id="${f}"]`:c=yz(o.target)}const u=n(e.state.location);Kc.set(f=>{const m=f[u]||={},p=m[c]||={};if(c==="window")p.scrollX=window.scrollX||0,p.scrollY=window.scrollY||0;else if(c){const v=document.querySelector(c);v&&(p.scrollX=v.scrollLeft||0,p.scrollY=v.scrollTop||0)}return f})};typeof document<"u"&&document.addEventListener("scroll",mz(a,100),!0),e.subscribe("onRendered",o=>{const c=n(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(vz({storageKey:Nm,key:c,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Kc.set(u=>(u[c]||={},u)))})}function bz(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function Sz(e,t=String){const n=new URLSearchParams;for(const a in e){const o=e[a];o!==void 0&&n.set(a,t(o))}return n.toString()}function Bh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function jz(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[a,o]of t.entries()){const c=n[a];c==null?n[a]=Bh(o):Array.isArray(c)?c.push(Bh(o)):n[a]=[c,Bh(o)]}return n}var wz=Cz(JSON.parse),Nz=kz(JSON.stringify,JSON.parse);function Cz(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=jz(t);for(const a in n){const o=n[a];if(typeof o=="string")try{n[a]=e(o)}catch{}}return n}}function kz(e,t){const n=typeof t=="function";function a(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const c=Sz(o,a);return c?`?${c}`:""}}var ja="__root__";function fp(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function wn(e){return e instanceof Response&&!!e.options}function zz(e){return{input:({url:t})=>{for(const n of e)t=Cm(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=MS(e[n],t);return t}}}function _z(e){const t=LS(e.basepath),n=`/${t}`,a=`${n}/`,o=e.caseSensitive?n:n.toLowerCase(),c=e.caseSensitive?a:a.toLowerCase();return{input:({url:u})=>{const f=e.caseSensitive?u.pathname:u.pathname.toLowerCase();return f===o?u.pathname="/":f.startsWith(c)&&(u.pathname=u.pathname.slice(n.length)),u},output:({url:u})=>(u.pathname=cu(["/",t,u.pathname]),u)}}function Cm(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function MS(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}var jt=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(jt||{});function $S({update:e,notify:t,unwatched:n}){return{link:a,unlink:o,propagate:c,checkDirty:u,shallowPropagate:f};function a(p,v,y){const x=v.depsTail;if(x!==void 0&&x.dep===p)return;const b=x!==void 0?x.nextDep:v.deps;if(b!==void 0&&b.dep===p){b.version=y,v.depsTail=b;return}const N=p.subsTail;if(N!==void 0&&N.version===y&&N.sub===v)return;const S=v.depsTail=p.subsTail={version:y,dep:p,sub:v,prevDep:x,nextDep:b,prevSub:N,nextSub:void 0};b!==void 0&&(b.prevDep=S),x!==void 0?x.nextDep=S:v.deps=S,N!==void 0?N.nextSub=S:p.subs=S}function o(p,v=p.sub){const y=p.dep,x=p.prevDep,b=p.nextDep,N=p.nextSub,S=p.prevSub;return b!==void 0?b.prevDep=x:v.depsTail=x,x!==void 0?x.nextDep=b:v.deps=b,N!==void 0?N.prevSub=S:y.subsTail=S,S!==void 0?S.nextSub=N:(y.subs=N)===void 0&&n(y),b}function c(p){let v=p.nextSub,y;e:do{const x=p.sub;let b=x.flags;if(b&60?b&12?b&4?!(b&48)&&m(p,x)?(x.flags=b|40,b&=1):b=0:x.flags=b&-9|32:b=0:x.flags=b|32,b&2&&t(x),b&1){const N=x.subs;if(N!==void 0){const S=(p=N).nextSub;S!==void 0&&(y={value:v,prev:y},v=S);continue}}if((p=v)!==void 0){v=p.nextSub;continue}for(;y!==void 0;)if(p=y.value,y=y.prev,p!==void 0){v=p.nextSub;continue e}break}while(!0)}function u(p,v){let y,x=0,b=!1;e:do{const N=p.dep,S=N.flags;if(v.flags&16)b=!0;else if((S&17)===17){if(e(N)){const C=N.subs;C.nextSub!==void 0&&f(C),b=!0}}else if((S&33)===33){(p.nextSub!==void 0||p.prevSub!==void 0)&&(y={value:p,prev:y}),p=N.deps,v=N,++x;continue}if(!b){const C=p.nextDep;if(C!==void 0){p=C;continue}}for(;x--;){const C=v.subs,k=C.nextSub!==void 0;if(k?(p=y.value,y=y.prev):p=C,b){if(e(v)){k&&f(C),v=p.sub;continue}b=!1}else v.flags&=-33;v=p.sub;const A=p.nextDep;if(A!==void 0){p=A;continue e}}return b}while(!0)}function f(p){do{const v=p.sub,y=v.flags;(y&48)===32&&(v.flags=y|16,(y&6)===2&&t(v))}while((p=p.nextSub)!==void 0)}function m(p,v){let y=v.depsTail;for(;y!==void 0;){if(y===p)return!0;y=y.prevDep}return!1}}let hp=0,da=0,Xo=0;const Fs=[],{link:uP,unlink:PS,propagate:dP,checkDirty:Ez,shallowPropagate:fP}=$S({update(e){return e.depsTail!==void 0?Oz(e):Dz(e)},notify(e){let t=Xo,n=t;do if(Fs[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(Xo=t;n<--t;){const a=Fs[n];Fs[n++]=Fs[t],Fs[t]=a}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,qu(e)):$z.call(e)}});function Rz(){return hp}function Az(){++hp}function Tz(){--hp||Mz()}function Oz(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,qu(e)}}function Dz(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function Lz(e){const t=e.flags;if(t&16||t&32&&Ez(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,qu(e)}}else e.flags=2}function Mz(){try{for(;da<Xo;){const e=Fs[da];Fs[da++]=void 0,Lz(e)}}finally{for(;da<Xo;){const e=Fs[da];Fs[da++]=void 0,e.flags|=10}da=0,Xo=0}}function $z(){this.depsTail=void 0,this.flags=0,qu(this);const e=this.subs;e!==void 0&&PS(e)}function qu(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=PS(n,e)}function mp(e,t,n){const a=typeof e=="object",o=a?e:void 0;return{next:(a?e.next:e)?.bind(o),error:(a?e.error:t)?.bind(o),complete:(a?e.complete:n)?.bind(o)}}const km=[];let uu=0;const{link:Sx,unlink:Pz,propagate:Uz,checkDirty:US,shallowPropagate:jx}=$S({update(e){return e._update()},notify(e){km[zm++]=e,e.flags&=~jt.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=jt.Mutable|jt.Dirty,Cu(e))}});let Hc=0,zm=0,js;function Cu(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=Pz(n,e)}function IS(){if(!(Rz()>0)){for(;Hc<zm;){const e=km[Hc];km[Hc++]=void 0,e.notify()}Hc=0,zm=0}}function BS(e,t){const n=typeof e=="function",a=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?jt.None:jt.Mutable,get(){return js!==void 0&&Sx(o,js,uu),o._snapshot},subscribe(c){const u=mp(c),f={current:!1},m=Iz(()=>{o.get(),f.current?u.next?.(o._snapshot):f.current=!0});return{unsubscribe:()=>{m.stop()}}},_update(c){const u=js,f=Object.is;if(n)js=o,++uu,o.depsTail=void 0;else if(c===void 0)return!1;n&&(o.flags=jt.Mutable|jt.RecursedCheck);try{const m=o._snapshot,p=typeof c=="function"?c(m):c===void 0&&n?a(m):c;return m===void 0||!f(m,p)?(o._snapshot=p,!0):!1}finally{js=u,n&&(o.flags&=~jt.RecursedCheck),Cu(o)}}};return n?(o.flags=jt.Mutable|jt.Dirty,o.get=function(){const c=o.flags;if(c&jt.Dirty||c&jt.Pending&&US(o.deps,o)){if(o._update()){const u=o.subs;u!==void 0&&jx(u)}}else c&jt.Pending&&(o.flags=c&~jt.Pending);return js!==void 0&&Sx(o,js,uu),o._snapshot}):o.set=function(c){if(o._update(c)){const u=o.subs;u!==void 0&&(Uz(u),jx(u),IS())}},o}function Iz(e){const t=()=>{const a=js;js=n,++uu,n.depsTail=void 0,n.flags=jt.Watching|jt.RecursedCheck;try{return e()}finally{js=a,n.flags&=~jt.RecursedCheck,Cu(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:jt.Watching|jt.RecursedCheck,notify(){const a=this.flags;a&jt.Dirty||a&jt.Pending&&US(this.deps,this)?t():this.flags=jt.Watching},stop(){this.flags=jt.None,this.depsTail=void 0,Cu(this)}};return t(),n}class Bz{constructor(t){this.atom=BS(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(mp(t))}}class qz{constructor(t){this.atom=BS(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(mp(t))}}function Kz(e){return typeof e=="function"?new qz(e):new Bz(e)}function Hz(e){try{Az(),e()}finally{Tz(),IS()}}function Wo(e){let t;return Hz(()=>{t=e()}),t}var _m=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Ku=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),wa=(e,t,n=!0)=>{const a={...e.router.options.context??{}},o=n?t:t-1;for(let c=0;c<=o;c++){const u=e.matches[c];if(!u)continue;const f=e.router.getMatch(u.id);f&&Object.assign(a,f.__routeContext,f.__beforeLoadContext)}return a},wx=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,a=e.matches.findIndex(u=>u.routeId===e.router.routeTree.id),o=a>=0?a:0;let c=n?e.matches.findIndex(u=>u.routeId===n):e.firstBadMatchIndex??e.matches.length-1;c<0&&(c=o);for(let u=c;u>=0;u--){const f=e.matches[u];if(e.router.looseRoutesById[f.routeId].options.notFoundComponent)return u}return n?c:o},Ri=(e,t,n)=>{if(!(!wn(n)&&!hn(n)))throw wn(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,a=>({...a,status:wn(n)?"redirected":a.status==="pending"?"success":a.status,context:wa(e,t.index),isFetching:!1,error:n})),hn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),wn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},qS=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Nx=(e,t,n)=>{const a=wa(e,n);e.updateMatch(t,o=>({...o,context:a}))},Fo=(e,t,n,a)=>{const{id:o,routeId:c}=e.matches[t],u=e.router.looseRoutesById[c];if(n instanceof Promise)throw n;n.routerCode=a,e.firstBadMatchIndex??=t,Ri(e,e.router.getMatch(o),n);try{u.options.onError?.(n)}catch(f){n=f,Ri(e,e.router.getMatch(o),n)}e.updateMatch(o,f=>(f._nonReactive.beforeLoadPromise?.resolve(),f._nonReactive.beforeLoadPromise=void 0,f._nonReactive.loadPromise?.resolve(),{...f,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!wn(n)&&!hn(n)&&(e.serialError??=n)},KS=(e,t,n,a)=>{if(a._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Ku(e,t)&&(n.options.loader||n.options.beforeLoad||GS(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const c=setTimeout(()=>{_m(e)},o);a._nonReactive.pendingTimeout=c}},Gz=(e,t,n)=>{const a=e.router.getMatch(t);if(!a._nonReactive.beforeLoadPromise&&!a._nonReactive.loaderPromise)return;KS(e,t,n,a);const o=()=>{const c=e.router.getMatch(t);c.preload&&(c.status==="redirected"||c.status==="notFound")&&Ri(e,c,c.error)};return a._nonReactive.beforeLoadPromise?a._nonReactive.beforeLoadPromise.then(o):o()},Fz=(e,t,n,a)=>{const o=e.router.getMatch(t);let c=o._nonReactive.loadPromise;o._nonReactive.loadPromise=Pr(()=>{c?.resolve(),c=void 0});const{paramsError:u,searchError:f}=o;u&&Fo(e,n,u,"PARSE_PARAMS"),f&&Fo(e,n,f,"VALIDATE_SEARCH"),KS(e,t,a,o);const m=new AbortController;let p=!1;const v=()=>{p||(p=!0,e.updateMatch(t,z=>({...z,isFetching:"beforeLoad",fetchCount:z.fetchCount+1,abortController:m})))},y=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,z=>({...z,isFetching:!1}))};if(!a.options.beforeLoad){Wo(()=>{v(),y()});return}o._nonReactive.beforeLoadPromise=Pr();const x={...wa(e,n,!1),...o.__routeContext},{search:b,params:N,cause:S}=o,C=Ku(e,t),k={search:b,abortController:m,params:N,preload:C,context:x,location:e.location,navigate:z=>e.router.navigate({...z,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:C?"preload":S,matches:e.matches,routeId:a.id,...e.router.options.additionalContext},A=z=>{if(z===void 0){Wo(()=>{v(),y()});return}(wn(z)||hn(z))&&(v(),Fo(e,n,z,"BEFORE_LOAD")),Wo(()=>{v(),e.updateMatch(t,$=>({...$,__beforeLoadContext:z})),y()})};let R;try{if(R=a.options.beforeLoad(k),al(R))return v(),R.catch(z=>{Fo(e,n,z,"BEFORE_LOAD")}).then(A)}catch(z){v(),Fo(e,n,z,"BEFORE_LOAD")}A(R)},Zz=(e,t)=>{const{id:n,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a],c=()=>f(),u=()=>Fz(e,n,t,o),f=()=>{if(qS(e,n))return;const m=Gz(e,n,o);return al(m)?m.then(u):u()};return c()},Vz=(e,t,n)=>{const a=e.router.getMatch(t);if(!a||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:a,params:a.params,loaderData:a.loaderData};return Promise.all([n.options.head?.(o),n.options.scripts?.(o),n.options.headers?.(o)]).then(([c,u,f])=>({meta:c?.meta,links:c?.links,headScripts:c?.scripts,headers:f,scripts:u,styles:c?.styles}))},HS=(e,t,n,a,o)=>{const c=t[a-1],{params:u,loaderDeps:f,abortController:m,cause:p}=e.router.getMatch(n),v=wa(e,a),y=Ku(e,n);return{params:u,deps:f,preload:!!y,parentMatchPromise:c,abortController:m,context:v,location:e.location,navigate:x=>e.router.navigate({...x,_fromLocation:e.location}),cause:y?"preload":p,route:o,...e.router.options.additionalContext}},Cx=async(e,t,n,a,o)=>{try{const c=e.router.getMatch(n);try{(!(Fk??e.router.isServer)||c.ssr===!0)&&rl(o);const u=o.options.loader,f=typeof u=="function"?u:u?.handler,m=f?.(HS(e,t,n,a,o)),p=!!f&&al(m);if((p||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||c._nonReactive.minPendingPromise)&&e.updateMatch(n,y=>({...y,isFetching:"loader"})),f){const y=p?await m:m;Ri(e,e.router.getMatch(n),y),y!==void 0&&e.updateMatch(n,x=>({...x,loaderData:y}))}o._lazyPromise&&await o._lazyPromise;const v=c._nonReactive.minPendingPromise;v&&await v,o._componentsPromise&&await o._componentsPromise,e.updateMatch(n,y=>({...y,error:void 0,context:wa(e,a),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(u){let f=u;if(f?.name==="AbortError"){if(c.abortController.signal.aborted){c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,p=>({...p,status:p.status==="pending"?"success":p.status,isFetching:!1,context:wa(e,a)}));return}const m=c._nonReactive.minPendingPromise;m&&await m,hn(u)&&await o.options.notFoundComponent?.preload?.(),Ri(e,e.router.getMatch(n),u);try{o.options.onError?.(u)}catch(p){f=p,Ri(e,e.router.getMatch(n),p)}!wn(f)&&!hn(f)&&await rl(o,["errorComponent"]),e.updateMatch(n,p=>({...p,error:f,context:wa(e,a),status:"error",isFetching:!1}))}}catch(c){const u=e.router.getMatch(n);u&&(u._nonReactive.loaderPromise=void 0),Ri(e,u,c)}},Qz=async(e,t,n)=>{async function a(b,N,S,C,k){const A=Date.now()-N.updatedAt,R=b?k.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:k.options.staleTime??e.router.options.defaultStaleTime??0,z=k.options.shouldReload,$=typeof z=="function"?z(HS(e,t,o,n,k)):z,{status:P,invalid:E}=C,O=A>R&&(!!e.forceStaleReload||C.cause==="enter"||S!==void 0&&S!==C.id);u=P==="success"&&(E||($??O)),b&&k.options.preload===!1||(u&&!e.sync&&v?(f=!0,(async()=>{try{await Cx(e,t,o,n,k);const H=e.router.getMatch(o);H._nonReactive.loaderPromise?.resolve(),H._nonReactive.loadPromise?.resolve(),H._nonReactive.loaderPromise=void 0,H._nonReactive.loadPromise=void 0}catch(H){wn(H)&&await e.router.navigate(H.options)}})()):P!=="success"||u?await Cx(e,t,o,n,k):Nx(e,o,n))}const{id:o,routeId:c}=e.matches[n];let u=!1,f=!1;const m=e.router.looseRoutesById[c],p=m.options.loader,v=((typeof p=="function"?void 0:p?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(qS(e,o)){if(!e.router.getMatch(o))return e.matches[n];Nx(e,o,n)}else{const b=e.router.getMatch(o),N=e.router.state.matches[n]?.routeId===c?e.router.state.matches[n].id:e.router.state.matches.find(C=>C.routeId===c)?.id,S=Ku(e,o);if(b._nonReactive.loaderPromise){if(b.status==="success"&&!e.sync&&!b.preload&&v)return b;await b._nonReactive.loaderPromise;const C=e.router.getMatch(o),k=C._nonReactive.error||C.error;k&&Ri(e,C,k),C.status==="pending"&&await a(S,b,N,C,m)}else{const C=S&&!e.router.state.matches.some(A=>A.id===o),k=e.router.getMatch(o);k._nonReactive.loaderPromise=Pr(),C!==k.preload&&e.updateMatch(o,A=>({...A,preload:C})),await a(S,b,N,k,m)}}const y=e.router.getMatch(o);f||(y._nonReactive.loaderPromise?.resolve(),y._nonReactive.loadPromise?.resolve(),y._nonReactive.loadPromise=void 0),clearTimeout(y._nonReactive.pendingTimeout),y._nonReactive.pendingTimeout=void 0,f||(y._nonReactive.loaderPromise=void 0),y._nonReactive.dehydrated=void 0;const x=f?y.isFetching:!1;return x!==y.isFetching||y.invalid!==!1?(e.updateMatch(o,b=>({...b,isFetching:x,invalid:!1})),e.router.getMatch(o)):y};async function kx(e){const t=e,n=[];t.router.state.matches.some(x=>x._forcePending)&&_m(t);let a;for(let x=0;x<t.matches.length;x++){try{const b=Zz(t,x);al(b)&&await b}catch(b){if(wn(b))throw b;if(hn(b))a=b;else if(!t.preload)throw b;break}if(t.serialError)break}const o=t.firstBadMatchIndex??t.matches.length,c=a&&!t.preload?wx(t,a):void 0,u=a&&t.preload?0:c!==void 0?Math.min(c+1,o):o;let f,m;for(let x=0;x<u;x++)n.push(Qz(t,n,x));try{await Promise.all(n)}catch{const x=await Promise.allSettled(n);for(const b of x){if(b.status!=="rejected")continue;const N=b.reason;if(wn(N))throw N;hn(N)?f??=N:m??=N}if(m!==void 0)throw m}const p=f??(a&&!t.preload?a:void 0);let v=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!p&&a&&t.preload)return t.matches;if(p){const x=wx(t,p);Mi(x!==void 0);const b=t.matches[x],N=t.router.looseRoutesById[b.routeId],S=t.router.options?.defaultNotFoundComponent;!N.options.notFoundComponent&&S&&(N.options.notFoundComponent=S),p.routeId=b.routeId;const C=b.routeId===t.router.routeTree.id;t.updateMatch(b.id,k=>({...k,...C?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:p},isFetching:!1})),v=x,await rl(N,["notFoundComponent"])}else if(!t.preload){const x=t.matches[0];x.globalNotFound||t.router.getMatch(x.id)?.globalNotFound&&t.updateMatch(x.id,b=>({...b,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const x=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await rl(x,["errorComponent"])}for(let x=0;x<=v;x++){const{id:b,routeId:N}=t.matches[x],S=t.router.looseRoutesById[N];try{const C=Vz(t,b,S);if(C){const k=await C;t.updateMatch(b,A=>({...A,...k}))}}catch(C){console.error(`Error executing head for route ${N}:`,C)}}const y=_m(t);if(al(y)&&await y,p)throw p;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function zx(e,t){const n=t.map(a=>e.options[a]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function rl(e,t=du){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(a=>{const{id:o,...c}=a.options;Object.assign(e.options,c),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===du?(()=>{if(e._componentsPromise===void 0){const a=zx(e,du);a?e._componentsPromise=a.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():zx(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function GS(e){for(const t of du)if(e.options[t]?.preload)return!0;return!1}var du=["component","errorComponent","pendingComponent","notFoundComponent"],Oi="__TSR_index",_x="popstate",Ex="beforeunload";function Yz(e){let t=e.getLocation();const n=new Set,a=u=>{t=e.getLocation(),n.forEach(f=>f({location:t,action:u}))},o=u=>{e.notifyOnIndexChange??!0?a(u):t=e.getLocation()},c=async({task:u,navigateOpts:f,...m})=>{if(f?.ignoreBlocker??!1){u();return}const p=e.getBlockers?.()??[],v=m.type==="PUSH"||m.type==="REPLACE";if(typeof document<"u"&&p.length&&v)for(const y of p){const x=ku(m.path,m.state);if(await y.blockerFn({currentLocation:t,nextLocation:x,action:m.type})){e.onBlocked?.();return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,f,m)=>{const p=t.state[Oi];f=Rx(p+1,f),c({task:()=>{e.pushState(u,f),a({type:"PUSH"})},navigateOpts:m,type:"PUSH",path:u,state:f})},replace:(u,f,m)=>{const p=t.state[Oi];f=Rx(p,f),c({task:()=>{e.replaceState(u,f),a({type:"REPLACE"})},navigateOpts:m,type:"REPLACE",path:u,state:f})},go:(u,f)=>{c({task:()=>{e.go(u),o({type:"GO",index:u})},navigateOpts:f,type:"GO"})},back:u=>{c({task:()=>{e.back(u?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{c({task:()=>{e.forward(u?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[Oi]!==0,createHref:u=>e.createHref(u),block:u=>{if(!e.setBlockers)return()=>{};const f=e.getBlockers?.()??[];return e.setBlockers([...f,u]),()=>{const m=e.getBlockers?.()??[];e.setBlockers?.(m.filter(p=>p!==u))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:a}}function Rx(e,t){t||(t={});const n=pp();return{...t,key:n,__TSR_key:n,[Oi]:e}}function Jz(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,a=t.history.replaceState;let o=[];const c=()=>o,u=O=>o=O,f=(O=>O),m=(()=>ku(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const O=pp();t.history.replaceState({[Oi]:0,key:O,__TSR_key:O},"")}let p=m(),v,y=!1,x=!1,b=!1,N=!1;const S=()=>p;let C,k;const A=()=>{C&&(E._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),E._ignoreSubscribers=!1,C=void 0,k=void 0,v=void 0)},R=(O,H,ee)=>{const V=f(H);k||(v=p),p=ku(H,ee),C={href:V,state:ee,isPush:C?.isPush||O==="push"},k||(k=Promise.resolve().then(()=>A()))},z=O=>{p=m(),E.notify({type:O})},$=async()=>{if(x){x=!1;return}const O=m(),H=O.state[Oi]-p.state[Oi],ee=H===1,V=H===-1,se=!ee&&!V||y;y=!1;const ue=se?"GO":V?"BACK":"FORWARD",_e=se?{type:"GO",index:H}:{type:V?"BACK":"FORWARD"};if(b)b=!1;else{const xe=c();if(typeof document<"u"&&xe.length){for(const K of xe)if(await K.blockerFn({currentLocation:p,nextLocation:O,action:ue})){x=!0,t.history.go(1),E.notify(_e);return}}}p=m(),E.notify(_e)},P=O=>{if(N){N=!1;return}let H=!1;const ee=c();if(typeof document<"u"&&ee.length)for(const V of ee){const se=V.enableBeforeUnload??!0;if(se===!0){H=!0;break}if(typeof se=="function"&&se()===!0){H=!0;break}}if(H)return O.preventDefault(),O.returnValue=""},E=Yz({getLocation:S,getLength:()=>t.history.length,pushState:(O,H)=>R("push",O,H),replaceState:(O,H)=>R("replace",O,H),back:O=>(O&&(b=!0),N=!0,t.history.back()),forward:O=>{O&&(b=!0),N=!0,t.history.forward()},go:O=>{y=!0,t.history.go(O)},createHref:O=>f(O),flush:A,destroy:()=>{t.history.pushState=n,t.history.replaceState=a,t.removeEventListener(Ex,P,{capture:!0}),t.removeEventListener(_x,$)},onBlocked:()=>{v&&p!==v&&(p=v)},getBlockers:c,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(Ex,P,{capture:!0}),t.addEventListener(_x,$),t.history.pushState=function(...O){const H=n.apply(t.history,O);return E._ignoreSubscribers||z("PUSH"),H},t.history.replaceState=function(...O){const H=a.apply(t.history,O);return E._ignoreSubscribers||z("REPLACE"),H},E}function Xz(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function ku(e,t){const n=Xz(e),a=n.indexOf("#"),o=n.indexOf("?"),c=pp();return{href:n,pathname:n.substring(0,a>0?o>0?Math.min(a,o):a:o>0?o:n.length),hash:a>-1?n.substring(a):"",search:o>-1?n.slice(o,a===-1?void 0:a):"",state:t||{[Oi]:0,key:c,__TSR_key:c}}}function pp(){return(Math.random()+1).toString(36).substring(7)}function Na(e){const t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}function Wz(e){const t=e.filter(n=>n.status!=="redirected");return t.length===e.length?e:t}var e_=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{const n=this.options,a=this.basepath??n?.basepath??"/",o=this.basepath===void 0,c=n?.rewrite;if(this.options={...n,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=fz(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Jz()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;this.resolvePathCache=ju(1e3),p=this.buildRouteTree(),this.setRoutes(p)}!this.__store&&this.latestLocation&&(this.__store=Kz(n_(this.latestLocation)),xz(this));let u=!1;const f=this.options.basepath??"/",m=this.options.rewrite;if(o||a!==f||c!==m){this.basepath=f;const p=[],v=LS(f);v&&v!=="/"&&p.push(_z({basepath:f})),m&&p.push(m),this.rewrite=p.length===0?void 0:p.length===1?p[0]:zz(p),this.history&&this.updateLatestLocation(),u=!0}u&&this.__store&&this.__store.setState(p=>({...p,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=rz(this.routeTree,this.options.caseSensitive,(n,a)=>{n.init({originalIndex:a})});return this.options.routeMasks&&tz(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,n)=>{const a={eventType:t,fn:n};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=t=>{this.subscribers.forEach(n=>{n.eventType===t.type&&n.fn(t)})},this.parseLocation=(t,n)=>{const a=({pathname:f,search:m,hash:p,href:v,state:y})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(f)){const C=this.options.parseSearch(m),k=this.options.stringifySearch(C);return{href:f+k+p,publicHref:v,pathname:Ho(f).path,external:!1,searchStr:k,search:ua(n?.search,C),hash:Ho(p.slice(1)).path,state:pa(n?.state,y)}}const x=new URL(v,this.origin),b=Cm(this.rewrite,x),N=this.options.parseSearch(b.search),S=this.options.stringifySearch(N);return b.search=S,{href:b.href.replace(b.origin,""),publicHref:v,pathname:Ho(b.pathname).path,external:!!this.rewrite&&b.origin!==this.origin,searchStr:S,search:ua(n?.search,N),hash:Ho(b.hash.slice(1)).path,state:pa(n?.state,y)}},o=a(t),{__tempLocation:c,__tempKey:u}=o.state;if(c&&(!u||u===this.tempLocationKey)){const f=a(c);return f.state.key=o.state.key,f.state.__TSR_key=o.state.__TSR_key,delete f.state.__tempLocation,{...f,maskedLocation:o}}return o},this.resolvePathWithBase=(t,n)=>dz({base:t,to:dp(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,n,a)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:n},a):this.matchRoutesInternal(t,n),this.getMatchedRoutes=t=>s_({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const n=this.getMatch(t);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(a=>a.status==="pending"),n=this.state.matches.filter(a=>a.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...n]).forEach(a=>{this.cancelMatch(a.id)})},this.buildLocation=t=>{const n=(o={})=>{const c=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutesLightweight(c);o.from;const f=o.unsafeRelative==="path"?c.pathname:o.from??u.fullPath,m=this.resolvePathWithBase(f,"."),p=u.search,v=Object.assign(Object.create(null),u.params),y=o.to?this.resolvePathWithBase(m,`${o.to}`):this.resolvePathWithBase(m,"."),x=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?v:Object.assign(v,Ei(o.params,v)),b=this.getMatchedRoutes(y);let N=b.matchedRoutes;if((!b.foundRoute||b.foundRoute.path!=="/"&&b.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(x).length>0)for(const H of N){const ee=H.options.params?.stringify??H.options.stringifyParams;if(ee)try{Object.assign(x,ee(x))}catch{}}const S=t.leaveParams?y:Ho(xx({path:y,params:x,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=p;if(t._includeValidateSearch&&this.options.search?.strict){const H={};N.forEach(ee=>{if(ee.options.validateSearch)try{Object.assign(H,fu(ee.options.validateSearch,{...H,...C}))}catch{}}),C=H}C=i_({search:C,dest:o,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=ua(p,C);const k=this.options.stringifySearch(C),A=o.hash===!0?c.hash:o.hash?Ei(o.hash,c.hash):void 0,R=A?`#${A}`:"";let z=o.state===!0?c.state:o.state?Ei(o.state,c.state):{};z=pa(c.state,z);const $=`${S}${k}${R}`;let P,E,O=!1;if(this.rewrite){const H=new URL($,this.origin),ee=MS(this.rewrite,H);P=H.href.replace(H.origin,""),ee.origin!==this.origin?(E=ee.href,O=!0):E=ee.pathname+ee.search+ee.hash}else P=Xk($),E=P;return{publicHref:E,href:P,pathname:S,search:C,searchStr:k,state:z,hash:A??"",external:O,unmaskOnReload:o.unmaskOnReload}},a=(o={},c)=>{const u=n(o);let f=c?n(c):void 0;if(!f){const m=Object.create(null);if(this.options.routeMasks){const p=nz(u.pathname,this.processedTree);if(p){Object.assign(m,p.rawParams);const{from:v,params:y,...x}=p.route,b=y===!1||y===null?Object.create(null):(y??!0)===!0?m:Object.assign(m,Ei(y,m));c={from:t.from,...x,params:b},f=n(c)}}}return f&&(u.maskedLocation=f),u};return t.mask?a(t,{from:t.from,...t.mask}):a(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:n,...a})=>{const o=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(p=>{a.state[p]=this.latestLocation.state[p]});const m=Sa(a.state,this.latestLocation.state);return f.forEach(p=>{delete a.state[p]}),m},c=Ti(this.latestLocation.href)===Ti(a.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=Pr(()=>{u?.resolve(),u=void 0}),c&&o())this.load();else{let{maskedLocation:f,hashScrollIntoView:m,...p}=a;f&&(p={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=m??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[a.replace?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:n})}return this.resetNextScroll=a.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:n,hashScrollIntoView:a,viewTransition:o,ignoreBlocker:c,href:u,...f}={})=>{if(u){const v=this.history.location.state.__TSR_index,y=ku(u,{__TSR_index:t?v:v+1}),x=new URL(y.pathname,this.origin);f.to=Cm(this.rewrite,x).pathname,f.search=this.options.parseSearch(y.search),f.hash=y.hash.slice(1)}const m=this.buildLocation({...f,_includeValidateSearch:!0});this.pendingBuiltLocation=m;const p=this.commitLocation({...m,viewTransition:o,replace:t,resetScroll:n,hashScrollIntoView:a,ignoreBlocker:c});return Promise.resolve().then(()=>{this.pendingBuiltLocation===m&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:t,reloadDocument:n,href:a,publicHref:o,...c})=>{let u=!1;if(a)try{new URL(`${a}`),u=!0}catch{}if(u&&!n&&(n=!0),n){if(t!==void 0||!a){const m=this.buildLocation({to:t,...c});a=a??m.publicHref,o=o??m.publicHref}const f=!u&&o?o:a;if(Su(f,this.protocolAllowlist))return Promise.resolve();if(!c.ignoreBlocker){const m=this.history.getBlockers?.()??[];for(const p of m)if(p?.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return c.replace?window.location.replace(f):window.location.href=f,Promise.resolve()}return this.buildAndCommitLocation({...c,href:a,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:n.cachedMatches.filter(a=>!t.some(o=>o.id===a.id))}))},this.load=async t=>{let n,a,o;const c=this.state.resolvedLocation??this.state.location;for(o=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad();const m=this.latestLocation,p=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Na({resolvedLocation:p,location:m})}),this.emit({type:"onBeforeLoad",...Na({resolvedLocation:p,location:m})}),await kx({router:this,sync:t?.sync,forceStaleReload:c.href===m.href,matches:this.state.pendingMatches,location:m,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let v=[],y=[],x=[],b=[];Wo(()=>{this.__store.setState(N=>{const S=N.matches,C=N.pendingMatches||N.matches;return v=S.filter(k=>!C.some(A=>A.id===k.id)),y=S.filter(k=>!C.some(A=>A.routeId===k.routeId)),x=C.filter(k=>!S.some(A=>A.routeId===k.routeId)),b=C.filter(k=>S.some(A=>A.routeId===k.routeId)),{...N,isLoading:!1,loadedAt:Date.now(),matches:C,pendingMatches:void 0,cachedMatches:[...N.cachedMatches,...v.filter(k=>k.status!=="error"&&k.status!=="notFound"&&k.status!=="redirected")]}}),this.clearExpiredCache()}),[[y,"onLeave"],[x,"onEnter"],[b,"onStay"]].forEach(([N,S])=>{N.forEach(C=>{this.looseRoutesById[C.routeId].options[S]?.(C)})})})})}})}catch(m){wn(m)?(n=m,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):hn(m)&&(a=m),this.__store.setState(p=>({...p,statusCode:n?n.status:a?404:p.matches.some(v=>v.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===o&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.__store.state.matches.some(f=>f.status==="error")&&(u=500),u!==void 0&&this.__store.setState(f=>({...f,statusCode:u}))},this.startViewTransition=t=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,c=this.state.resolvedLocation,u=typeof n.types=="function"?n.types(Na({resolvedLocation:c,location:o})):n.types;if(u===!1){t();return}a={update:t,types:u}}else a=t;document.startViewTransition(a)}else t()},this.updateMatch=(t,n)=>{this.startTransition(()=>{const a=this.state.pendingMatches?.some(o=>o.id===t)?"pendingMatches":this.state.matches.some(o=>o.id===t)?"matches":this.state.cachedMatches.some(o=>o.id===t)?"cachedMatches":"";a&&(a==="cachedMatches"?this.__store.setState(o=>({...o,cachedMatches:Wz(o.cachedMatches.map(c=>c.id===t?n(c):c))})):this.__store.setState(o=>({...o,[a]:o[a]?.map(c=>c.id===t?n(c):c)})))})},this.getMatch=t=>{const n=a=>a.id===t;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=t=>{const n=a=>t?.filter?.(a)??!0?{...a,invalid:!0,...t?.forcePending||a.status==="error"||a.status==="notFound"?{status:"pending",error:void 0}:void 0}:a;return this.__store.setState(a=>({...a,matches:a.matches.map(n),cachedMatches:a.cachedMatches.map(n),pendingMatches:a.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:t?.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const n=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const a=t.options._builtLocation??this.buildLocation(t.options),o=this.getParsedLocationHref(a);t.options.href=o,t.headers.set("Location",o)}else if(n)try{const a=new URL(n);if(this.origin&&a.origin===this.origin){const o=a.pathname+a.search+a.hash;t.options.href=o,t.headers.set("Location",o)}}catch{}if(t.options.href&&!t.options._builtLocation&&Su(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const n=t?.filter;n!==void 0?this.__store.setState(a=>({...a,cachedMatches:a.cachedMatches.filter(o=>!n(o))})):this.__store.setState(a=>({...a,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=n=>{const a=this.looseRoutesById[n.routeId];if(!a.options.loader)return!0;const o=(n.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=o};this.clearCache({filter:t})},this.loadRouteChunk=rl,this.preloadRoute=async t=>{const n=t._builtLocation??this.buildLocation(t);let a=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:t});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(u=>u.id)),c=new Set([...o,...this.state.cachedMatches.map(u=>u.id)]);Wo(()=>{a.forEach(u=>{c.has(u.id)||this.__store.setState(f=>({...f,cachedMatches:[...f.cachedMatches,u]}))})});try{return a=await kx({router:this,matches:a,location:n,preload:!0,updateMatch:(u,f)=>{o.has(u)?a=a.map(m=>m.id===u?f(m):m):this.updateMatch(u,f)}}),a}catch(u){if(wn(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:n});hn(u)||console.error(u);return}},this.matchRoute=(t,n)=>{const a={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},o=this.buildLocation(a);if(n?.pending&&this.state.status!=="pending")return!1;const c=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,u=sz(o.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,c.pathname,this.processedTree);return!u||t.params&&!Sa(u.rawParams,t.params,{partial:!0})?!1:n?.includeSearch??!0?Sa(c.search,o.search,{partial:!0})?u.rawParams:!1:u.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??Nz,parseSearch:e.parseSearch??wz,protocolAllowlist:e.protocolAllowlist??Jk}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const a=this.options.notFoundRoute;a&&(a.init({originalIndex:99999999999}),this.routesById[a.id]=a)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const n=this.getMatchedRoutes(e.pathname),{foundRoute:a,routeParams:o,parsedParams:c}=n;let{matchedRoutes:u}=n,f=!1;(a?a.path!=="/"&&o["**"]:Ti(e.pathname))&&(this.options.notFoundRoute?u=[...u,this.options.notFoundRoute]:f=!0);const m=f?r_(this.options.notFoundMode,u):void 0,p=new Array(u.length),v=new Map(this.state.matches.map(y=>[y.routeId,y]));for(let y=0;y<u.length;y++){const x=u[y],b=p[y-1];let N,S,C;{const ue=b?.search??e.search,_e=b?._strictSearch??void 0;try{const xe=fu(x.options.validateSearch,{...ue})??void 0;N={...ue,...xe},S={..._e,...xe},C=void 0}catch(xe){let K=xe;if(xe instanceof zu||(K=new zu(xe.message,{cause:xe})),t?.throwOnError)throw K;N=ue,S={},C=K}}const k=x.options.loaderDeps?.({search:N})??"",A=k?JSON.stringify(k):"",{interpolatedPath:R,usedParams:z}=xx({path:x.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),$=x.id+R+A,P=this.getMatch($),E=v.get(x.id),O=P?._strictParams??z;let H;if(!P)try{Ax(x,z,c,O)}catch(ue){if(hn(ue)||wn(ue)?H=ue:H=new t_(ue.message,{cause:ue}),t?.throwOnError)throw H}Object.assign(o,O);const ee=E?"stay":"enter";let V;if(P)V={...P,cause:ee,params:E?.params??o,_strictParams:O,search:ua(E?E.search:P.search,N),_strictSearch:S};else{const ue=x.options.loader||x.options.beforeLoad||x.lazyFn||GS(x)?"pending":"success";V={id:$,ssr:x.options.ssr,index:y,routeId:x.id,params:E?.params??o,_strictParams:O,pathname:R,updatedAt:Date.now(),search:E?ua(E.search,N):N,_strictSearch:S,searchError:void 0,status:ue,isFetching:!1,error:void 0,paramsError:H,__routeContext:void 0,_nonReactive:{loadPromise:Pr()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:ee,loaderDeps:E?pa(E.loaderDeps,k):k,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:x.options.staticData||{},fullPath:x.fullPath}}t?.preload||(V.globalNotFound=m===x.id),V.searchError=C;const se=this.getParentContext(b);V.context={...se,...V.__routeContext,...V.__beforeLoadContext},p[y]=V}for(let y=0;y<p.length;y++){const x=p[y],b=this.looseRoutesById[x.routeId],N=this.getMatch(x.id),S=v.get(x.routeId);if(x.params=S?ua(S.params,o):o,!N){const C=p[y-1],k=this.getParentContext(C);if(b.options.context){const A={deps:x.loaderDeps,params:x.params,context:k??{},location:e,navigate:R=>this.navigate({...R,_fromLocation:e}),buildLocation:this.buildLocation,cause:x.cause,abortController:x.abortController,preload:!!x.preload,matches:p,routeId:b.id};x.__routeContext=b.options.context(A)??void 0}x.context={...k,...x.__routeContext,...x.__beforeLoadContext}}}return p}matchRoutesLightweight(e){const{matchedRoutes:t,routeParams:n,parsedParams:a}=this.getMatchedRoutes(e.pathname),o=il(t),c={...e.search};for(const p of t)try{Object.assign(c,fu(p.options.validateSearch,c))}catch{}const u=il(this.state.matches),f=u&&u.routeId===o.id&&e.pathname===this.state.location.pathname;let m;if(f)m=u.params;else{const p=Object.assign(Object.create(null),n);for(const v of t)try{Ax(v,n,a??{},p)}catch{}m=p}return{matchedRoutes:t,fullPath:o.fullPath,search:c,params:m}}},zu=class extends Error{},t_=class extends Error{};function n_(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function fu(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new zu("Async validation not supported");if(n.issues)throw new zu(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function s_({pathname:e,routesById:t,processedTree:n}){const a=Object.create(null),o=Ti(e);let c,u;const f=iz(o,n,!0);return f&&(c=f.route,Object.assign(a,f.rawParams),u=Object.assign(Object.create(null),f.parsedParams)),{matchedRoutes:f?.branch||[t.__root__],routeParams:a,foundRoute:c,parsedParams:u}}function i_({search:e,dest:t,destRoutes:n,_includeValidateSearch:a}){return a_(n)(e,t,a??!1)}function a_(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)o.options.search?.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const c=({search:u,next:f})=>{let m=u;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(m=o.options.preSearchFilters.reduce((v,y)=>y(v),u));const p=f(m);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((v,y)=>y(v),p):p};t.middlewares.push(c)}if(o.options.validateSearch){const c=({search:u,next:f})=>{const m=f(u);if(!t._includeValidateSearch)return m;try{return{...m,...fu(o.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(c)}}const n=({search:o})=>{const c=t.dest;return c.search?c.search===!0?o:Ei(c.search,o):{}};t.middlewares.push(n);const a=(o,c,u)=>{if(o>=u.length)return c;const f=u[o];return f({search:c,next:p=>a(o+1,p,u)})};return function(c,u,f){return t.dest=u,t._includeValidateSearch=f,a(0,c,t.middlewares)}}function r_(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const a=t[n];if(a.children)return a.id}return ja}function Ax(e,t,n,a){const o=e.options.params?.parse??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const c in t)c in n&&(a[c]=n[c]);else{const c=o(a);Object.assign(a,c)}}var o_="Error preloading route! ☝️",FS=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,a=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=ja:this.parentRoute||Mi(!1);let o=a?ja:n?.path;o&&o!=="/"&&(o=DS(o));const c=n?.id||o;let u=a?ja:cu([this.parentRoute.id==="__root__"?"":this.parentRoute.id,c]);o==="__root__"&&(o="/"),u!=="__root__"&&(u=cu(["/",u]));const f=u==="__root__"?"/":cu([this.parentRoute.fullPath,o]);this._path=o,this._id=u,this._fullPath=f,this._to=Ti(f)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>fp({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},l_=class extends FS{constructor(e){super(e)}};function gp(e){const t=e.errorComponent??yp;return r.jsx(c_,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:a})=>n?w.createElement(t,{error:n,reset:a}):e.children})}var c_=class extends w.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function yp({error:e}){const[t,n]=w.useState(!1);return r.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[r.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),r.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(a=>!a),children:t?"Hide Error":"Show Error"})]}),r.jsx("div",{style:{height:".25rem"}}),t?r.jsx("div",{children:r.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?r.jsx("code",{children:e.message}):null})}):null]})}function u_({children:e,fallback:t=null}){return ZS()?r.jsx(us.Fragment,{children:e}):r.jsx(us.Fragment,{children:t})}function ZS(){return us.useSyncExternalStore(d_,()=>!0,()=>!1)}function d_(){return()=>{}}var VS=w.createContext(null);function Xn(e){const t=w.useContext(VS);return e?.warn,t}var qh={exports:{}},Kh={},Hh={exports:{}},Gh={};var Tx;function f_(){if(Tx)return Gh;Tx=1;var e=ml();function t(y,x){return y===x&&(y!==0||1/y===1/x)||y!==y&&x!==x}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(y,x){var b=x(),N=a({inst:{value:b,getSnapshot:x}}),S=N[0].inst,C=N[1];return c(function(){S.value=b,S.getSnapshot=x,m(S)&&C({inst:S})},[y,b,x]),o(function(){return m(S)&&C({inst:S}),y(function(){m(S)&&C({inst:S})})},[y]),u(b),b}function m(y){var x=y.getSnapshot;y=y.value;try{var b=x();return!n(y,b)}catch{return!0}}function p(y,x){return x()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return Gh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Gh}var Ox;function h_(){return Ox||(Ox=1,Hh.exports=f_()),Hh.exports}var Dx;function m_(){if(Dx)return Kh;Dx=1;var e=ml(),t=h_();function n(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var a=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Kh.useSyncExternalStoreWithSelector=function(p,v,y,x,b){var N=c(null);if(N.current===null){var S={hasValue:!1,value:null};N.current=S}else S=N.current;N=f(function(){function k(P){if(!A){if(A=!0,R=P,P=x(P),b!==void 0&&S.hasValue){var E=S.value;if(b(E,P))return z=E}return z=P}if(E=z,a(R,P))return E;var O=x(P);return b!==void 0&&b(E,O)?(R=P,E):(R=P,z=O)}var A=!1,R,z,$=y===void 0?null:y;return[function(){return k(v())},$===null?void 0:function(){return k($())}]},[v,y,x,b]);var C=o(p,N[0],N[1]);return u(function(){S.hasValue=!0,S.value=C},[C]),m(C),C},Kh}var Lx;function p_(){return Lx||(Lx=1,qh.exports=m_()),qh.exports}var g_=p_();function y_(e,t){return e===t}function v_(e,t,n=y_){const a=w.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:f}=e.subscribe(u);return f},[e]),o=w.useCallback(()=>e?.get(),[e]);return g_.useSyncExternalStoreWithSelector(a,o,o,t,n)}function Cn(e){const t=Xn({warn:e?.router===void 0}),n=e?.router||t,a=w.useRef(void 0);return v_(n.__store,o=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const c=pa(a.current,e.select(o));return a.current=c,c}return e.select(o)}return o})}var Hu=w.createContext(void 0),x_=w.createContext(void 0);function Ii(e){const t=w.useContext(e.from?x_:Hu);return Cn({select:n=>{const a=n.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(Mi(!((e.shouldThrow??!0)&&!a),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),a!==void 0)return e.select?e.select(a):a},structuralSharing:e.structuralSharing})}function vp(e){return Ii({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function xp(e){const{select:t,...n}=e;return Ii({...n,select:a=>t?t(a.loaderDeps):a.loaderDeps})}function Gu(e){return Ii({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Fu(e){return Ii({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Bi(e){const t=Xn();return w.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function bp(e){return Ii({...e,select:t=>e.select?e.select(t.context):t.context})}var Sp=pS();const b_=mS(Sp);function S_(e,t){const n=Xn(),a=Gk(t),{activeProps:o,inactiveProps:c,activeOptions:u,to:f,preload:m,preloadDelay:p,hashScrollIntoView:v,replace:y,startTransition:x,resetScroll:b,viewTransition:N,children:S,target:C,disabled:k,style:A,className:R,onClick:z,onBlur:$,onFocus:P,onMouseEnter:E,onMouseLeave:O,onTouchStart:H,ignoreBlocker:ee,params:V,search:se,hash:ue,state:_e,mask:xe,reloadDocument:K,unsafeRelative:ae,from:pe,_fromLocation:de,...U}=e,T=ZS(),L=Cn({select:Me=>{const Xe=Me.matches[Me.matches.length-1];return{search:Xe?.search,hash:Me.location.hash,path:Xe?.pathname}},structuralSharing:!0}),J=e.from,X=w.useMemo(()=>({...e,from:J}),[n,L,J,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Y=w.useMemo(()=>n.buildLocation({...X}),[n,X]),he=Y.maskedLocation?Y.maskedLocation.publicHref:Y.publicHref,ge=Y.maskedLocation?Y.maskedLocation.external:Y.external,we=w.useMemo(()=>z_(he,ge,n.history,k),[k,ge,he,n.history]),me=w.useMemo(()=>{if(we?.external)return Su(we.href,n.protocolAllowlist)?void 0:we.href;if(!__(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Su(f,n.protocolAllowlist)?void 0:f}catch{}},[f,we,n.protocolAllowlist]),Ie=Cn({select:Me=>{if(me)return!1;if(u?.exact){if(!uz(Me.location.pathname,Y.pathname,n.basepath))return!1}else{const Xe=wu(Me.location.pathname,n.basepath),Nt=wu(Y.pathname,n.basepath);if(!(Xe.startsWith(Nt)&&(Xe.length===Nt.length||Xe[Nt.length]==="/")))return!1}return(u?.includeSearch??!0)&&!Sa(Me.location.search,Y.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?T&&Me.location.hash===Y.hash:!0}}),Ye=Ie?Ei(o,{})??j_:Fh,le=Ie?Fh:Ei(c,{})??Fh,Ue=[R,Ye.className,le.className].filter(Boolean).join(" "),Qe=(A||Ye.style||le.style)&&{...A,...Ye.style,...le.style},[Vt,Ut]=w.useState(!1),Mn=w.useRef(!1),nn=e.reloadDocument||me?!1:m??n.options.defaultPreload,Et=p??n.options.defaultPreloadDelay??0,re=w.useCallback(()=>{n.preloadRoute({...X,_builtLocation:Y}).catch(Me=>{console.warn(Me),console.warn(o_)})},[n,X,Y]);Hk(a,w.useCallback(Me=>{Me?.isIntersecting&&re()},[re]),k_,{disabled:!!k||nn!=="viewport"}),w.useEffect(()=>{Mn.current||!k&&nn==="render"&&(re(),Mn.current=!0)},[k,re,nn]);const Ze=Me=>{const Xe=Me.currentTarget.getAttribute("target"),Nt=C!==void 0?C:Xe;if(!k&&!E_(Me)&&!Me.defaultPrevented&&(!Nt||Nt==="_self")&&Me.button===0){Me.preventDefault(),Sp.flushSync(()=>{Ut(!0)});const Ke=n.subscribe("onResolved",()=>{Ke(),Ut(!1)});n.navigate({...X,replace:y,resetScroll:b,hashScrollIntoView:v,startTransition:x,viewTransition:N,ignoreBlocker:ee})}};if(me)return{...U,ref:a,href:me,...S&&{children:S},...C&&{target:C},...k&&{disabled:k},...A&&{style:A},...R&&{className:R},...z&&{onClick:z},...$&&{onBlur:$},...P&&{onFocus:P},...E&&{onMouseEnter:E},...O&&{onMouseLeave:O},...H&&{onTouchStart:H}};const gt=Me=>{if(k||nn!=="intent")return;if(!Et){re();return}const Xe=Me.currentTarget;if(Zo.has(Xe))return;const Nt=setTimeout(()=>{Zo.delete(Xe),re()},Et);Zo.set(Xe,Nt)},Qt=Me=>{k||nn!=="intent"||re()},Je=Me=>{if(k||!nn||!Et)return;const Xe=Me.currentTarget,Nt=Zo.get(Xe);Nt&&(clearTimeout(Nt),Zo.delete(Xe))};return{...U,...Ye,...le,href:we?.href,ref:a,onClick:jr([z,Ze]),onBlur:jr([$,Je]),onFocus:jr([P,gt]),onMouseEnter:jr([E,gt]),onMouseLeave:jr([O,Je]),onTouchStart:jr([H,Qt]),disabled:!!k,target:C,...Qe&&{style:Qe},...Ue&&{className:Ue},...k&&w_,...Ie&&N_,...T&&Vt&&C_}}var Fh={},j_={className:"active"},w_={role:"link","aria-disabled":!0},N_={"data-status":"active","aria-current":"page"},C_={"data-transitioning":"transitioning"},Zo=new WeakMap,k_={rootMargin:"100px"},jr=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function z_(e,t,n,a){if(!a)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function __(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var St=w.forwardRef((e,t)=>{const{_asChild:n,...a}=e,{type:o,...c}=S_(a,t),u=typeof a.children=="function"?a.children({isActive:c["data-status"]==="active"}):a.children;if(!n){const{disabled:f,...m}=c;return w.createElement("a",m,u)}return w.createElement(n,c,u)});function E_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var R_=class extends FS{constructor(e){super(e),this.useMatch=t=>Ii({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>bp({...t,from:this.id}),this.useSearch=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Gu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>xp({...t,from:this.id}),this.useLoaderData=t=>vp({...t,from:this.id}),this.useNavigate=()=>Bi({from:this.fullPath}),this.Link=us.forwardRef((t,n)=>r.jsx(St,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function Wn(e){return new R_(e)}function A_(){return e=>O_(e)}var T_=class extends l_{constructor(e){super(e),this.useMatch=t=>Ii({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>bp({...t,from:this.id}),this.useSearch=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Gu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>xp({...t,from:this.id}),this.useLoaderData=t=>vp({...t,from:this.id}),this.useNavigate=()=>Bi({from:this.fullPath}),this.Link=us.forwardRef((t,n)=>r.jsx(St,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function O_(e){return new T_(e)}function Mx(e){return typeof e=="object"?new $x(e,{silent:!0}).createRoute(e):new $x(e,{silent:!0}).createRoute}var $x=class{constructor(e,t){this.path=e,this.createRoute=n=>{const a=Wn(n);return a.isRoot=!1,a},this.silent=t?.silent}},Px=class{constructor(e){this.useMatch=t=>Ii({select:t?.select,from:this.options.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>bp({...t,from:this.options.id}),this.useSearch=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useParams=t=>Gu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>xp({...t,from:this.options.id}),this.useLoaderData=t=>vp({...t,from:this.options.id}),this.useNavigate=()=>Bi({from:Xn().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}};function Ux(e){return typeof e=="object"?new Px(e):t=>new Px({id:e,...t})}function D_(e){const t=Cn({select:n=>`not-found-${n.location.pathname}-${n.status}`});return r.jsx(gp,{getResetKey:()=>t,onCatch:(n,a)=>{if(hn(n))e.onCatch?.(n,a);else throw n},errorComponent:({error:n})=>{if(hn(n))return e.fallback?.(n);throw n},children:e.children})}function L_(){return r.jsx("p",{children:"Not Found"})}function _r(e){return r.jsx(r.Fragment,{children:e.children})}function QS(e,t,n){return t.options.notFoundComponent?r.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?r.jsx(e.options.defaultNotFoundComponent,{...n}):r.jsx(L_,{})}function M_(){return Xn().isScrollRestoring,null}var YS=w.memo(function({matchId:t}){const n=Xn(),a=Cn({select:N=>{const S=N.matches.findIndex(k=>k.id===t),C=N.matches[S];return Mi(C),{routeId:C.routeId,ssr:C.ssr,_displayPending:C._displayPending,resetKey:N.loadedAt,parentRouteId:N.matches[S-1]?.routeId}},structuralSharing:!0}),o=n.routesById[a.routeId],c=o.options.pendingComponent??n.options.defaultPendingComponent,u=c?r.jsx(c,{}):null,f=o.options.errorComponent??n.options.defaultErrorComponent,m=o.options.onCatch??n.options.defaultOnCatch,p=o.isRoot?o.options.notFoundComponent??n.options.notFoundRoute?.options.component:o.options.notFoundComponent,v=a.ssr===!1||a.ssr==="data-only",y=(!o.isRoot||o.options.wrapInSuspense||v)&&(o.options.wrapInSuspense??c??(o.options.errorComponent?.preload||v))?w.Suspense:_r,x=f?gp:_r,b=p?D_:_r;return r.jsxs(o.isRoot?o.options.shellComponent??_r:_r,{children:[r.jsx(Hu.Provider,{value:t,children:r.jsx(y,{fallback:u,children:r.jsx(x,{getResetKey:()=>a.resetKey,errorComponent:f||yp,onCatch:(N,S)=>{if(hn(N))throw N;m?.(N,S)},children:r.jsx(b,{fallback:N=>{if(!p||N.routeId&&N.routeId!==a.routeId||!N.routeId&&!o.isRoot)throw N;return w.createElement(p,N)},children:v||a._displayPending?r.jsx(u_,{fallback:u,children:r.jsx(Ix,{matchId:t})}):r.jsx(Ix,{matchId:t})})})})}),a.parentRouteId===ja&&n.options.scrollRestoration?r.jsxs(r.Fragment,{children:[r.jsx($_,{}),r.jsx(M_,{})]}):null]})});function $_(){const e=Xn(),t=w.useRef(void 0);return r.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Na(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var Ix=w.memo(function({matchId:t}){const n=Xn(),{match:a,key:o,routeId:c}=Cn({select:m=>{const p=m.matches.find(x=>x.id===t),v=p.routeId,y=(n.routesById[v].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:v,loaderDeps:p.loaderDeps,params:p._strictParams,search:p._strictSearch});return{key:y?JSON.stringify(y):void 0,routeId:v,match:{id:p.id,status:p.status,error:p.error,_forcePending:p._forcePending,_displayPending:p._displayPending}}},structuralSharing:!0}),u=n.routesById[c],f=w.useMemo(()=>{const m=u.options.component??n.options.defaultComponent;return m?r.jsx(m,{},o):r.jsx(jp,{})},[o,u.options.component,n.options.defaultComponent]);if(a._displayPending)throw n.getMatch(a.id)?._nonReactive.displayPendingPromise;if(a._forcePending)throw n.getMatch(a.id)?._nonReactive.minPendingPromise;if(a.status==="pending"){const m=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(m){const p=n.getMatch(a.id);if(p&&!p._nonReactive.minPendingPromise){const v=Pr();p._nonReactive.minPendingPromise=v,setTimeout(()=>{v.resolve(),p._nonReactive.minPendingPromise=void 0},m)}}throw n.getMatch(a.id)?._nonReactive.loadPromise}if(a.status==="notFound")return Mi(hn(a.error)),QS(n,u,a.error);if(a.status==="redirected")throw Mi(wn(a.error)),n.getMatch(a.id)?._nonReactive.loadPromise;if(a.status==="error")throw a.error;return f}),jp=w.memo(function(){const t=Xn(),n=w.useContext(Hu),a=Cn({select:p=>p.matches.find(v=>v.id===n)?.routeId}),o=t.routesById[a],c=Cn({select:p=>{const v=p.matches.find(y=>y.id===n);return Mi(v),v.globalNotFound}}),u=Cn({select:p=>{const v=p.matches;return v[v.findIndex(y=>y.id===n)+1]?.id}}),f=t.options.defaultPendingComponent?r.jsx(t.options.defaultPendingComponent,{}):null;if(c)return QS(t,o,void 0);if(!u)return null;const m=r.jsx(YS,{matchId:u});return a===ja?r.jsx(w.Suspense,{fallback:f,children:m}):m});function P_(){const e=Xn(),t=w.useRef({router:e,mounted:!1}),[n,a]=w.useState(!1),{hasPendingMatches:o,isLoading:c}=Cn({select:y=>({isLoading:y.isLoading,hasPendingMatches:y.matches.some(x=>x.status==="pending")}),structuralSharing:!0}),u=Mh(c),f=c||n||o,m=Mh(f),p=c||o,v=Mh(p);return e.startTransition=y=>{a(!0),w.startTransition(()=>{y(),a(!1)})},w.useEffect(()=>{const y=e.history.subscribe(e.load),x=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ti(e.latestLocation.publicHref)!==Ti(x.publicHref)&&e.commitLocation({...x,replace:!0}),()=>{y()}},[e,e.history]),qc(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(x){console.error(x)}})()},[e]),qc(()=>{u&&!c&&e.emit({type:"onLoad",...Na(e.state)})},[u,e,c]),qc(()=>{v&&!p&&e.emit({type:"onBeforeRouteMount",...Na(e.state)})},[p,v,e]),qc(()=>{if(m&&!f){const y=Na(e.state);e.emit({type:"onResolved",...y}),e.__store.setState(x=>({...x,status:"idle",resolvedLocation:x.location})),y.hrefChanged&&bz(e)}},[f,m,e]),null}function U_(){const e=Xn(),t=e.routesById[ja].options.pendingComponent??e.options.defaultPendingComponent,n=t?r.jsx(t,{}):null,a=r.jsxs(typeof document<"u"&&e.ssr?_r:w.Suspense,{fallback:n,children:[r.jsx(P_,{}),r.jsx(I_,{})]});return e.options.InnerWrap?r.jsx(e.options.InnerWrap,{children:a}):a}function I_(){const e=Xn(),t=Cn({select:o=>o.matches[0]?.id}),n=Cn({select:o=>o.loadedAt}),a=t?r.jsx(YS,{matchId:t}):null;return r.jsx(Hu.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?a:r.jsx(gp,{getResetKey:()=>n,errorComponent:yp,onCatch:void 0,children:a})})}var B_=e=>new q_(e),q_=class extends e_{constructor(e){super(e)}};typeof globalThis<"u"?(globalThis.createFileRoute=Mx,globalThis.createLazyFileRoute=Ux):typeof window<"u"&&(window.createFileRoute=Mx,window.createLazyFileRoute=Ux);function K_({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const a=r.jsx(VS.Provider,{value:e,children:t});return e.options.Wrap?r.jsx(e.options.Wrap,{children:a}):a}function H_({router:e,...t}){return r.jsx(K_,{router:e,...t,children:r.jsx(U_,{})})}function G_(e){return Cn({select:t=>t.location})}class _u extends Error{code;statusCode;constructor(t,n,a){super(t),this.name="ApiError",this.code=a??"UNKNOWN",this.statusCode=n}}function F_(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,"")+"/api/v1":"/api/v1"}const Z_=F_();function V_(){return""}function Bx(){return!!V_()}async function ye(e,t){const n=await fetch(`${Z_}${e}`,{...t,credentials:t?.credentials??"same-origin",headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const a=await n.text();let o=`API ${n.status}: ${n.statusText}`,c;if(a)try{const u=JSON.parse(a);typeof u.error=="string"?o=u.error:u.error?.message?(o=u.error.message,c=u.error.code):u.message&&(o=u.message)}catch{o=a}throw new _u(o,n.status,c)}if(n.status!==204)return n.json()}function JS(){return ye("/projects")}function XS(e){return ye(`/projects/${encodeURIComponent(e)}`)}function WS(){return ye("/runs")}function Ur(e){return ye(`/runs/${encodeURIComponent(e)}`)}function Q_(e){return ye(`/projects/${encodeURIComponent(e)}/keywords`)}function ej(e){return ye(`/projects/${encodeURIComponent(e)}/competitors`)}function tj(e,t){const n=new URLSearchParams;t!==void 0&&n.set("location",t);const a=n.toString();return ye(`/projects/${encodeURIComponent(e)}/timeline${a?`?${a}`:""}`)}function Zu(e,t){return ye(`/projects/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function Y_(e,t){return ye(`/projects/${encodeURIComponent(e)}/keywords`,{method:"PUT",body:JSON.stringify({keywords:t})})}function J_(e,t){return ye(`/projects/${encodeURIComponent(e)}/keywords`,{method:"POST",body:JSON.stringify({keywords:t})})}function nj(e,t){return ye(`/projects/${encodeURIComponent(e)}/competitors`,{method:"PUT",body:JSON.stringify({competitors:t})})}async function qx(e,t){const n=await XS(e);return Zu(e,{displayName:n.displayName,canonicalDomain:n.canonicalDomain,ownedDomains:t,country:n.country,language:n.language,tags:n.tags,labels:n.labels,providers:n.providers,locations:n.locations,defaultLocation:n.defaultLocation})}async function X_(e,t){const n=await XS(e);return Zu(e,{displayName:t.displayName??n.displayName,canonicalDomain:t.canonicalDomain??n.canonicalDomain,ownedDomains:t.ownedDomains??n.ownedDomains,country:t.country??n.country,language:t.language??n.language,tags:n.tags,labels:n.labels,providers:n.providers,locations:t.locations??n.locations,defaultLocation:t.defaultLocation!==void 0?t.defaultLocation:n.defaultLocation})}function W_(e,t){const n={};return t?.location&&(n.location=t.location),t?.allLocations&&(n.allLocations=!0),t?.noLocation&&(n.noLocation=!0),ye(`/projects/${encodeURIComponent(e)}/runs`,{method:"POST",body:JSON.stringify(n)})}function e2(e,t){return ye(`/projects/${encodeURIComponent(e)}/locations`,{method:"POST",body:JSON.stringify(t)})}async function t2(e,t){await ye(`/projects/${encodeURIComponent(e)}/locations/${encodeURIComponent(t)}`,{method:"DELETE"})}function n2(e,t){return ye(`/projects/${encodeURIComponent(e)}/locations/default`,{method:"PUT",body:JSON.stringify({label:t})})}async function s2(e){await ye(`/projects/${encodeURIComponent(e)}`,{method:"DELETE",body:"{}"})}function i2(e){return ye(`/projects/${encodeURIComponent(e)}/export`)}function wp(){return ye("/settings")}function a2(){return ye("/session")}function r2(e){return ye("/session/setup",{method:"POST",body:JSON.stringify({password:e})})}function o2(e){return ye("/session",{method:"POST",body:JSON.stringify({password:e})})}function l2(e,t){return ye(`/settings/providers/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function c2(e){return ye("/settings/google",{method:"PUT",body:JSON.stringify(e)})}async function u2(e){try{return await ye(`/projects/${encodeURIComponent(e)}/schedule`)}catch(t){if(t instanceof Error&&t.message.includes("404"))return null;throw t}}function Kx(e,t){return ye(`/projects/${encodeURIComponent(e)}/schedule`,{method:"PUT",body:JSON.stringify(t)})}async function d2(e){await ye(`/projects/${encodeURIComponent(e)}/schedule`,{method:"DELETE",body:"{}"})}function f2(e){return ye(`/projects/${encodeURIComponent(e)}/notifications`)}function h2(e,t){return ye(`/projects/${encodeURIComponent(e)}/notifications`,{method:"POST",body:JSON.stringify(t)})}async function m2(e,t){await ye(`/projects/${encodeURIComponent(e)}/notifications/${encodeURIComponent(t)}`,{method:"DELETE",body:"{}"})}function p2(e,t){return ye(`/projects/${encodeURIComponent(e)}/notifications/${encodeURIComponent(t)}/test`,{method:"POST",body:"{}"})}function g2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/keywords/generate`,{method:"POST",body:JSON.stringify({provider:t,count:n})})}function y2(e){return ye("/apply",{method:"POST",body:JSON.stringify(e)})}function v2(e){return ye("/runs",{method:"POST",body:JSON.stringify(e??{})})}function sj(e){return ye(`/projects/${encodeURIComponent(e)}/google/connections`)}function x2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/connect`,{method:"POST",body:JSON.stringify({type:t})})}function b2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}`,{method:"DELETE",body:"{}"})}function S2(e){return ye(`/projects/${encodeURIComponent(e)}/google/properties`)}function j2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}/property`,{method:"PUT",body:JSON.stringify({propertyId:n})})}function w2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}/sitemap`,{method:"PUT",body:JSON.stringify({sitemapUrl:n})})}function ij(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/sync`,{method:"POST",body:JSON.stringify(t??{})})}function N2(e,t){const n=new URLSearchParams;t?.startDate&&n.set("startDate",t.startDate),t?.endDate&&n.set("endDate",t.endDate),t?.query&&n.set("query",t.query),t?.page&&n.set("page",t.page),t?.limit!==void 0&&n.set("limit",String(t.limit));const a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/performance${a}`)}function C2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspect`,{method:"POST",body:JSON.stringify({url:t})})}function k2(e,t){const n=new URLSearchParams;t?.url&&n.set("url",t.url),n.set("limit",String(t.limit));const a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspections${a}`)}function z2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/deindexed`)}function Np(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/coverage`)}function _2(e,t){const n=new URLSearchParams,a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/coverage/history${a}`)}function E2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspect-sitemap`,{method:"POST",body:JSON.stringify(t??{})})}function R2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/sitemaps`)}function A2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/discover-sitemaps`,{method:"POST",body:"{}"})}function Hx(){return ye("/cdp/status")}function T2(e,t){return ye("/settings/cdp",{method:"PUT",body:JSON.stringify({host:e,port:t})})}function Gx(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/indexing/request`,{method:"POST",body:JSON.stringify(t)})}function aj(e){return ye(`/projects/${encodeURIComponent(e)}/bing/status`)}function O2(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/connect`,{method:"POST",body:JSON.stringify({apiKey:t})})}function D2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/disconnect`,{method:"DELETE",body:"{}"})}function L2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/sites`)}function M2(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/set-site`,{method:"POST",body:JSON.stringify({siteUrl:t})})}function Cp(e){return ye(`/projects/${encodeURIComponent(e)}/bing/coverage`)}function rj(e,t){const n=new URLSearchParams,a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/bing/inspections${a}`)}function oj(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/inspect-url`,{method:"POST",body:JSON.stringify({url:t})})}function Fx(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/request-indexing`,{method:"POST",body:JSON.stringify(t)})}function $2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/performance`)}function P2(e){return ye("/settings/bing",{method:"PUT",body:JSON.stringify({apiKey:e})})}function U2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/metrics${n}`)}function I2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/gaps${n}`)}function B2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/sources${n}`)}function Zx(e){return ye(`/projects/${encodeURIComponent(e)}/ga/status`)}function Vx(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/traffic`)}function lj(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/sync`,{method:"POST",body:JSON.stringify({})})}function q2(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/connect`,{method:"POST",body:JSON.stringify(t)})}function K2(e){return ye(`/projects/${encodeURIComponent(e)}/ga/disconnect`,{method:"DELETE",body:"{}"})}async function H2(e,t){try{const n=await fetch(e);if(!n.ok)return{label:t,state:"error",detail:`HTTP ${n.status}`};const a=await n.json(),o=typeof a.version=="string"?a.version:"unknown",c=typeof a.databaseUrlConfigured=="boolean"?a.databaseUrlConfigured:void 0,u=typeof a.lastHeartbeatAt=="string"?a.lastHeartbeatAt:void 0,f=[o,c===!1?"database not configured":"database configured",u?`heartbeat ${u}`:void 0].filter(Boolean).join(" · ");return{label:t,state:"ok",detail:f,version:o,databaseConfigured:c,lastHeartbeatAt:u}}catch(n){return{label:t,state:"error",detail:n instanceof Error?n.message:"unreachable"}}}const G2=6e3,F2=5,Z2=180;let on=[],V2=0;const Em=new Set,Rm=new Map,Am=new Map;function Eu(){const e=[...on];for(const t of Em)t(e)}function kp(e){const t=Rm.get(e);t&&(clearTimeout(t),Rm.delete(e));const n=Am.get(e);n&&(clearTimeout(n),Am.delete(e))}function cj(e){kp(e);const t=on.length;on=on.filter(n=>n.id!==e),on.length!==t&&Eu()}function Qx(e){kp(e.id),Rm.set(e.id,setTimeout(()=>{Tm(e.id)},e.durationMs))}function Q2(e,t,n){return typeof e=="string"?{title:e,tone:t,durationMs:n}:e}function Fe(e,t="negative",n=G2){const a=Q2(e,t,n),o={id:String(++V2),title:a.title,detail:a.detail,tone:a.tone??t,durationMs:a.durationMs??n,dedupeKey:a.dedupeKey,cta:a.cta,state:"open"};if(a.dedupeKey){const c=on.find(u=>u.dedupeKey===a.dedupeKey);if(c){if((a.dedupeMode??"drop")==="drop")return c.id;const u={...c,title:o.title,detail:o.detail,tone:o.tone,durationMs:o.durationMs,cta:o.cta,state:"open"};return on=on.map(f=>f.id===c.id?u:f),Eu(),Qx(u),c.id}}return on.length>=F2&&cj(on[0].id),on=[...on,o],Eu(),Qx(o),o.id}function Tm(e){const t=on.find(n=>n.id===e);!t||t.state==="closing"||(kp(e),on=on.map(n=>n.id===e?{...n,state:"closing"}:n),Eu(),Am.set(e,setTimeout(()=>{cj(e)},Z2)))}function Y2(e){return Em.add(e),()=>{Em.delete(e)}}function Yx(){return on}function J2(){return new $k({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}},mutationCache:new wS({onError:(e,t,n,a)=>{a.meta?.skipGlobalErrorToast||Fe({title:e instanceof Error?e.message:"An unexpected error occurred",tone:"negative"})}})})}const X2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),Jx=e=>{const t=W2(e);return t.charAt(0).toUpperCase()+t.slice(1)},uj=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),eE=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var tE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const nE=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:c,iconNode:u,...f},m)=>w.createElement("svg",{ref:m,...tE,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:uj("lucide",o),...!c&&!eE(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,v])=>w.createElement(p,v)),...Array.isArray(c)?c:[c]]));const tn=(e,t)=>{const n=w.forwardRef(({className:a,...o},c)=>w.createElement(nE,{ref:c,iconNode:t,className:uj(`lucide-${X2(Jx(e))}`,`lucide-${e}`,a),...o}));return n.displayName=Jx(e),n};const sE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vu=tn("chevron-right",sE);const iE=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],aE=tn("download",iE);const rE=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],oE=tn("github",rE);const lE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],cE=tn("globe",lE);const uE=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],dE=tn("layout-dashboard",uE);const fE=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],hE=tn("menu",fE);const mE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],pE=tn("play",mE);const gE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Xx=tn("plus",gE);const yE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Wx=tn("refresh-cw",yE);const vE=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],xE=tn("rocket",vE);const bE=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],SE=tn("rotate-ccw",bE);const jE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wE=tn("settings",jE);const NE=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],CE=tn("trash-2",NE);const kE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],zE=tn("triangle-alert",kE);const _E=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],EE=tn("unplug",_E);const RE=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],AE=tn("upload",RE);const TE=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Qu=tn("x",TE);function OE(e){const t=e.match(/^(\[.*?\])\s*(.+)/);if(t){const n=t[1],a=t[2],o=a.indexOf("{");if(o>=0){const c=a.slice(0,o).trim(),u=a.slice(o);try{const f=JSON.parse(u);return`${n} ${c}
|
|
10
|
-
|
|
11
|
-
${JSON.stringify(f,null,2)}`}catch{}}return`${n}
|
|
12
|
-
${a}`}try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return e}}function Yu(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function cs(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return e}}function eb(e){return e===null?"Unknown":e?"Pass":"Fail"}function Om(e){return e===0?"12:00 AM":e<12?`${e}:00 AM`:e===12?"12:00 PM":`${e-12}:00 PM`}function DE(e,t){return e==="twice-daily"?"twice-daily":e.startsWith("weekly@")?`${e}@${t}`:`daily@${t}`}function LE(e,t){if(!e)return{freq:"custom",hour:6,customCron:t};if(e==="twice-daily")return{freq:"twice-daily",hour:6,customCron:""};const n=e.match(/^daily(?:@(\d+))?$/);if(n)return{freq:"daily",hour:n[1]?parseInt(n[1]):6,customCron:""};const a=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return a?{freq:a[1],hour:a[2]?parseInt(a[2]):6,customCron:""}:{freq:"custom",hour:6,customCron:t}}function Zh(e,t,n){const a=n==="UTC"?"UTC":n.split("/").pop()?.replace(/_/g," ")??n;if(!e)return`Custom: ${t} · ${a}`;if(e==="twice-daily")return`Twice a day (6am & 6pm) · ${a}`;const o=e.match(/^daily(?:@(\d+))?$/);if(o){const u=o[1]?parseInt(o[1]):6;return`Every day at ${Om(u)} · ${a}`}const c=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(c){const u={mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday",sun:"Sunday"},f=c[2]?parseInt(c[2]):6;return`Every ${u[c[1]]} at ${Om(f)} · ${a}`}return`${e} · ${a}`}const dj="canonry.run-tracker",Dm=new Set;let tb=!1,ME=0,Ju={runs:{},batches:{}};function $E(){const e=za();for(const t of Dm)t(e)}function PE(e){if(!e)return{runs:{},batches:{}};try{const t=JSON.parse(e);return{runs:t.runs??{},batches:t.batches??{}}}catch{return{runs:{},batches:{}}}}function UE(){typeof window>"u"||window.sessionStorage.setItem(dj,JSON.stringify(Ju))}function fj(){tb||(tb=!0,!(typeof window>"u")&&(Ju=PE(window.sessionStorage.getItem(dj))))}function Xu(e){Ju=e,UE(),$E()}function za(){return fj(),Ju}function IE(e){return fj(),Dm.add(e),()=>{Dm.delete(e)}}function hj(e){const t=za();Xu({...t,runs:{...t.runs,[e.id]:{runId:e.id,projectId:e.projectId,projectLabel:e.projectLabel,kind:e.kind,sourceAction:e.sourceAction,lastAnnouncedStatus:e.lastAnnouncedStatus??"queued"}}})}function nb(e){const t=za();if(!t.runs[e])return;const{[e]:n,...a}=t.runs;Xu({...t,runs:a})}function BE(e){const t=za(),n=`batch_${Date.now()}_${++ME}`;return Xu({...t,batches:{...t.batches,[n]:{batchId:n,runIds:e.runIds,queuedCount:e.queuedCount,skippedCount:e.skippedCount}}}),n}function qE(e){const t=za();if(!t.batches[e])return;const{[e]:n,...a}=t.batches;Xu({...t,batches:a})}function KE(e){return e==="completed"||e==="partial"||e==="failed"||e==="cancelled"}function HE(e,t){let n=0,a=0,o=0,c=0,u=0;for(const f of e){const m=t[f]?.status;m==="completed"?n+=1:m==="partial"?a+=1:m==="failed"?o+=1:m==="cancelled"?c+=1:u+=1}return{completed:n,partial:a,failed:o,cancelled:c,pending:u,finished:u===0}}function sb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function zp(...e){return t=>{let n=!1;const a=e.map(o=>{const c=sb(o,t);return!n&&typeof c=="function"&&(n=!0),c});if(n)return()=>{for(let o=0;o<a.length;o++){const c=a[o];typeof c=="function"?c():sb(e[o],null)}}}}function Aa(...e){return w.useCallback(zp(...e),e)}var GE=Symbol.for("react.lazy"),Ru=tp[" use ".trim().toString()];function FE(e){return typeof e=="object"&&e!==null&&"then"in e}function mj(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===GE&&"_payload"in e&&FE(e._payload)}function ZE(e){const t=QE(e),n=w.forwardRef((a,o)=>{let{children:c,...u}=a;mj(c)&&typeof Ru=="function"&&(c=Ru(c._payload));const f=w.Children.toArray(c),m=f.find(JE);if(m){const p=m.props.children,v=f.map(y=>y===m?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...u,ref:o,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return r.jsx(t,{...u,ref:o,children:c})});return n.displayName=`${e}.Slot`,n}var VE=ZE("Slot");function QE(e){const t=w.forwardRef((n,a)=>{let{children:o,...c}=n;if(mj(o)&&typeof Ru=="function"&&(o=Ru(o._payload)),w.isValidElement(o)){const u=WE(o),f=XE(c,o.props);return o.type!==w.Fragment&&(f.ref=a?zp(a,u):u),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var YE=Symbol("radix.slottable");function JE(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===YE}function XE(e,t){const n={...t};for(const a in t){const o=e[a],c=t[a];/^on[A-Z]/.test(a)?o&&c?n[a]=(...f)=>{const m=c(...f);return o(...f),m}:o&&(n[a]=o):a==="style"?n[a]={...o,...c}:a==="className"&&(n[a]=[o,c].filter(Boolean).join(" "))}return{...e,...n}}function WE(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pj(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=pj(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function gj(){for(var e,t,n=0,a="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=pj(e))&&(a&&(a+=" "),a+=t);return a}const ib=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ab=gj,yj=(e,t)=>n=>{var a;if(t?.variants==null)return ab(e,n?.class,n?.className);const{variants:o,defaultVariants:c}=t,u=Object.keys(o).map(p=>{const v=n?.[p],y=c?.[p];if(v===null)return null;const x=ib(v)||ib(y);return o[p][x]}),f=n&&Object.entries(n).reduce((p,v)=>{let[y,x]=v;return x===void 0||(p[y]=x),p},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((p,v)=>{let{class:y,className:x,...b}=v;return Object.entries(b).every(N=>{let[S,C]=N;return Array.isArray(C)?C.includes({...c,...f}[S]):{...c,...f}[S]===C})?[...p,y,x]:p},[]);return ab(e,u,m,n?.class,n?.className)},eR=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},tR=(e,t)=>({classGroupId:e,validator:t}),vj=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Au="-",rb=[],nR="arbitrary..",sR=e=>{const t=aR(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return iR(u);const f=u.split(Au),m=f[0]===""&&f.length>1?1:0;return xj(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],p=n[u];return m?p?eR(p,m):m:p||rb}return n[u]||rb}}},xj=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],c=n.nextPart.get(o);if(c){const p=xj(e,t+1,c);if(p)return p}const u=n.validators;if(u===null)return;const f=t===0?e.join(Au):e.slice(t).join(Au),m=u.length;for(let p=0;p<m;p++){const v=u[p];if(v.validator(f))return v.classGroupId}},iR=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?nR+a:void 0})(),aR=e=>{const{theme:t,classGroups:n}=e;return rR(n,t)},rR=(e,t)=>{const n=vj();for(const a in e){const o=e[a];_p(o,n,a,t)}return n},_p=(e,t,n,a)=>{const o=e.length;for(let c=0;c<o;c++){const u=e[c];oR(u,t,n,a)}},oR=(e,t,n,a)=>{if(typeof e=="string"){lR(e,t,n);return}if(typeof e=="function"){cR(e,t,n,a);return}uR(e,t,n,a)},lR=(e,t,n)=>{const a=e===""?t:bj(t,e);a.classGroupId=n},cR=(e,t,n,a)=>{if(dR(e)){_p(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(tR(n,e))},uR=(e,t,n,a)=>{const o=Object.entries(e),c=o.length;for(let u=0;u<c;u++){const[f,m]=o[u];_p(m,bj(t,f),n,a)}},bj=(e,t)=>{let n=e;const a=t.split(Au),o=a.length;for(let c=0;c<o;c++){const u=a[c];let f=n.nextPart.get(u);f||(f=vj(),n.nextPart.set(u,f)),n=f}return n},dR=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const o=(c,u)=>{n[c]=u,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(c){let u=n[c];if(u!==void 0)return u;if((u=a[c])!==void 0)return o(c,u),u},set(c,u){c in n?n[c]=u:o(c,u)}}},Lm="!",ob=":",hR=[],lb=(e,t,n,a,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:o}),mR=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=o=>{const c=[];let u=0,f=0,m=0,p;const v=o.length;for(let S=0;S<v;S++){const C=o[S];if(u===0&&f===0){if(C===ob){c.push(o.slice(m,S)),m=S+1;continue}if(C==="/"){p=S;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const y=c.length===0?o:o.slice(m);let x=y,b=!1;y.endsWith(Lm)?(x=y.slice(0,-1),b=!0):y.startsWith(Lm)&&(x=y.slice(1),b=!0);const N=p&&p>m?p-m:void 0;return lb(c,b,x,N)};if(t){const o=t+ob,c=a;a=u=>u.startsWith(o)?c(u.slice(o.length)):lb(hR,!1,u,void 0,!0)}if(n){const o=a;a=c=>n({className:c,parseClassName:o})}return a},pR=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let o=[];for(let c=0;c<n.length;c++){const u=n[c],f=u[0]==="[",m=t.has(u);f||m?(o.length>0&&(o.sort(),a.push(...o),o=[]),a.push(u)):o.push(u)}return o.length>0&&(o.sort(),a.push(...o)),a}},gR=e=>({cache:fR(e.cacheSize),parseClassName:mR(e),sortModifiers:pR(e),...sR(e)}),yR=/\s+/,vR=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:o,sortModifiers:c}=t,u=[],f=e.trim().split(yR);let m="";for(let p=f.length-1;p>=0;p-=1){const v=f[p],{isExternal:y,modifiers:x,hasImportantModifier:b,baseClassName:N,maybePostfixModifierPosition:S}=n(v);if(y){m=v+(m.length>0?" "+m:m);continue}let C=!!S,k=a(C?N.substring(0,S):N);if(!k){if(!C){m=v+(m.length>0?" "+m:m);continue}if(k=a(N),!k){m=v+(m.length>0?" "+m:m);continue}C=!1}const A=x.length===0?"":x.length===1?x[0]:c(x).join(":"),R=b?A+Lm:A,z=R+k;if(u.indexOf(z)>-1)continue;u.push(z);const $=o(k,C);for(let P=0;P<$.length;++P){const E=$[P];u.push(R+E)}m=v+(m.length>0?" "+m:m)}return m},xR=(...e)=>{let t=0,n,a,o="";for(;t<e.length;)(n=e[t++])&&(a=Sj(n))&&(o&&(o+=" "),o+=a);return o},Sj=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=Sj(e[a]))&&(n&&(n+=" "),n+=t);return n},bR=(e,...t)=>{let n,a,o,c;const u=m=>{const p=t.reduce((v,y)=>y(v),e());return n=gR(p),a=n.cache.get,o=n.cache.set,c=f,f(m)},f=m=>{const p=a(m);if(p)return p;const v=vR(m,n);return o(m,v),v};return c=u,(...m)=>c(xR(...m))},SR=[],Zt=e=>{const t=n=>n[e]||SR;return t.isThemeGetter=!0,t},jj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jR=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,wR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,NR=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,CR=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wi=e=>jR.test(e),Pe=e=>!!e&&!Number.isNaN(Number(e)),Ni=e=>!!e&&Number.isInteger(Number(e)),Vh=e=>e.endsWith("%")&&Pe(e.slice(0,-1)),Gs=e=>wR.test(e),Nj=()=>!0,_R=e=>NR.test(e)&&!CR.test(e),Ep=()=>!1,ER=e=>kR.test(e),RR=e=>zR.test(e),AR=e=>!je(e)&&!Ne(e),TR=e=>qi(e,zj,Ep),je=e=>jj.test(e),fa=e=>qi(e,_j,_R),cb=e=>qi(e,IR,Pe),OR=e=>qi(e,Rj,Nj),DR=e=>qi(e,Ej,Ep),ub=e=>qi(e,Cj,Ep),LR=e=>qi(e,kj,RR),Gc=e=>qi(e,Aj,ER),Ne=e=>wj.test(e),Vo=e=>Ta(e,_j),MR=e=>Ta(e,Ej),db=e=>Ta(e,Cj),$R=e=>Ta(e,zj),PR=e=>Ta(e,kj),Fc=e=>Ta(e,Aj,!0),UR=e=>Ta(e,Rj,!0),qi=(e,t,n)=>{const a=jj.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Ta=(e,t,n=!1)=>{const a=wj.exec(e);return a?a[1]?t(a[1]):n:!1},Cj=e=>e==="position"||e==="percentage",kj=e=>e==="image"||e==="url",zj=e=>e==="length"||e==="size"||e==="bg-size",_j=e=>e==="length",IR=e=>e==="number",Ej=e=>e==="family-name",Rj=e=>e==="number"||e==="weight",Aj=e=>e==="shadow",BR=()=>{const e=Zt("color"),t=Zt("font"),n=Zt("text"),a=Zt("font-weight"),o=Zt("tracking"),c=Zt("leading"),u=Zt("breakpoint"),f=Zt("container"),m=Zt("spacing"),p=Zt("radius"),v=Zt("shadow"),y=Zt("inset-shadow"),x=Zt("text-shadow"),b=Zt("drop-shadow"),N=Zt("blur"),S=Zt("perspective"),C=Zt("aspect"),k=Zt("ease"),A=Zt("animate"),R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],$=()=>[...z(),Ne,je],P=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],O=()=>[Ne,je,m],H=()=>[wi,"full","auto",...O()],ee=()=>[Ni,"none","subgrid",Ne,je],V=()=>["auto",{span:["full",Ni,Ne,je]},Ni,Ne,je],se=()=>[Ni,"auto",Ne,je],ue=()=>["auto","min","max","fr",Ne,je],_e=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],xe=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...O()],ae=()=>[wi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],pe=()=>[wi,"screen","full","dvw","lvw","svw","min","max","fit",...O()],de=()=>[wi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],U=()=>[e,Ne,je],T=()=>[...z(),db,ub,{position:[Ne,je]}],L=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",$R,TR,{size:[Ne,je]}],X=()=>[Vh,Vo,fa],Y=()=>["","none","full",p,Ne,je],he=()=>["",Pe,Vo,fa],ge=()=>["solid","dashed","dotted","double"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],me=()=>[Pe,Vh,db,ub],Ie=()=>["","none",N,Ne,je],Ye=()=>["none",Pe,Ne,je],le=()=>["none",Pe,Ne,je],Ue=()=>[Pe,Ne,je],Qe=()=>[wi,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gs],breakpoint:[Gs],color:[Nj],container:[Gs],"drop-shadow":[Gs],ease:["in","out","in-out"],font:[AR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gs],shadow:[Gs],spacing:["px",Pe],text:[Gs],"text-shadow":[Gs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wi,je,Ne,C]}],container:["container"],columns:[{columns:[Pe,je,Ne,f]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:$()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{"inset-s":H(),start:H()}],end:[{"inset-e":H(),end:H()}],"inset-bs":[{"inset-bs":H()}],"inset-be":[{"inset-be":H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[Ni,"auto",Ne,je]}],basis:[{basis:[wi,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pe,wi,"auto","initial","none",je]}],grow:[{grow:["",Pe,Ne,je]}],shrink:[{shrink:["",Pe,Ne,je]}],order:[{order:[Ni,"first","last","none",Ne,je]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[..._e(),"normal"]}],"justify-items":[{"justify-items":[...xe(),"normal"]}],"justify-self":[{"justify-self":["auto",...xe()]}],"align-content":[{content:["normal",..._e()]}],"align-items":[{items:[...xe(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...xe(),{baseline:["","last"]}]}],"place-content":[{"place-content":_e()}],"place-items":[{"place-items":[...xe(),"baseline"]}],"place-self":[{"place-self":["auto",...xe()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],"inline-size":[{inline:["auto",...pe()]}],"min-inline-size":[{"min-inline":["auto",...pe()]}],"max-inline-size":[{"max-inline":["none",...pe()]}],"block-size":[{block:["auto",...de()]}],"min-block-size":[{"min-block":["auto",...de()]}],"max-block-size":[{"max-block":["none",...de()]}],w:[{w:[f,"screen",...ae()]}],"min-w":[{"min-w":[f,"screen","none",...ae()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Vo,fa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,UR,OR]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Vh,je]}],"font-family":[{font:[MR,DR,t]}],"font-features":[{"font-features":[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Ne,je]}],"line-clamp":[{"line-clamp":[Pe,"none",Ne,cb]}],leading:[{leading:[c,...O()]}],"list-image":[{"list-image":["none",Ne,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ne,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pe,"from-font","auto",Ne,fa]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Pe,"auto",Ne,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ne,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ne,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ni,Ne,je],radial:["",Ne,je],conic:[Ni,Ne,je]},PR,LR]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:X()}],"gradient-via-pos":[{via:X()}],"gradient-to-pos":[{to:X()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pe,Ne,je]}],"outline-w":[{outline:["",Pe,Vo,fa]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",v,Fc,Gc]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",y,Fc,Gc]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Pe,fa]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",x,Fc,Gc]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Pe,Ne,je]}],"mix-blend":[{"mix-blend":[...we(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":we()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":me()}],"mask-image-linear-to-pos":[{"mask-linear-to":me()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":me()}],"mask-image-t-to-pos":[{"mask-t-to":me()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":me()}],"mask-image-r-to-pos":[{"mask-r-to":me()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":me()}],"mask-image-b-to-pos":[{"mask-b-to":me()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":me()}],"mask-image-l-to-pos":[{"mask-l-to":me()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":me()}],"mask-image-x-to-pos":[{"mask-x-to":me()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":me()}],"mask-image-y-to-pos":[{"mask-y-to":me()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Ne,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":me()}],"mask-image-radial-to-pos":[{"mask-radial-to":me()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[Pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":me()}],"mask-image-conic-to-pos":[{"mask-conic-to":me()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ne,je]}],filter:[{filter:["","none",Ne,je]}],blur:[{blur:Ie()}],brightness:[{brightness:[Pe,Ne,je]}],contrast:[{contrast:[Pe,Ne,je]}],"drop-shadow":[{"drop-shadow":["","none",b,Fc,Gc]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Pe,Ne,je]}],"hue-rotate":[{"hue-rotate":[Pe,Ne,je]}],invert:[{invert:["",Pe,Ne,je]}],saturate:[{saturate:[Pe,Ne,je]}],sepia:[{sepia:["",Pe,Ne,je]}],"backdrop-filter":[{"backdrop-filter":["","none",Ne,je]}],"backdrop-blur":[{"backdrop-blur":Ie()}],"backdrop-brightness":[{"backdrop-brightness":[Pe,Ne,je]}],"backdrop-contrast":[{"backdrop-contrast":[Pe,Ne,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pe,Ne,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pe,Ne,je]}],"backdrop-invert":[{"backdrop-invert":["",Pe,Ne,je]}],"backdrop-opacity":[{"backdrop-opacity":[Pe,Ne,je]}],"backdrop-saturate":[{"backdrop-saturate":[Pe,Ne,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Pe,Ne,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ne,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pe,"initial",Ne,je]}],ease:[{ease:["linear","initial",k,Ne,je]}],delay:[{delay:[Pe,Ne,je]}],animate:[{animate:["none",A,Ne,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ne,je]}],"perspective-origin":[{"perspective-origin":$()}],rotate:[{rotate:Ye()}],"rotate-x":[{"rotate-x":Ye()}],"rotate-y":[{"rotate-y":Ye()}],"rotate-z":[{"rotate-z":Ye()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[Ne,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:$()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ne,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ne,je]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Pe,Vo,fa,cb]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},qR=bR(BR);function es(...e){return qR(gj(e))}const KR=yj("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:ring-offset-2 focus-visible:ring-offset-black disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-zinc-50 text-black hover:bg-zinc-200",secondary:"border border-zinc-800 bg-zinc-950 text-zinc-100 hover:bg-zinc-900",ghost:"text-zinc-400 hover:bg-zinc-900 hover:text-zinc-50",outline:"border border-zinc-800 bg-transparent text-zinc-100 hover:bg-zinc-900",destructive:"bg-rose-600 text-white hover:bg-rose-700"},size:{default:"h-9 px-4",sm:"h-8 px-3 text-xs",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),oe=w.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...o},c)=>{const u=a?VE:"button";return r.jsx(u,{ref:c,className:es(KR({variant:t,size:n,className:e})),...o})});oe.displayName="Button";const HR=yj("inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium tracking-wide",{variants:{variant:{neutral:"border-zinc-800 bg-zinc-950 text-zinc-300",success:"border-emerald-500/25 bg-emerald-500/10 text-emerald-300",warning:"border-amber-500/25 bg-amber-500/10 text-amber-300",destructive:"border-rose-500/25 bg-rose-500/10 text-rose-300"}},defaultVariants:{variant:"neutral"}});function Tj({className:e,variant:t,...n}){return r.jsx("div",{className:es(HR({variant:t}),e),...n})}function fb({compact:e=!1}){return r.jsxs(St,{to:"/",className:`brand-lockup ${e?"brand-lockup-compact":""}`,"aria-label":"Canonry home",children:[r.jsx("img",{className:"brand-icon",src:"./favicon.svg",alt:"","aria-hidden":"true"}),r.jsxs("span",{className:"brand-copy",children:[r.jsx("span",{className:"brand-mark",children:"Canonry"}),e?null:r.jsx("span",{className:"brand-subtitle",children:"AEO Monitor"})]})]})}function ol({provider:e}){const t={gemini:"border-blue-800/50 bg-blue-950/40 text-blue-300",openai:"border-green-800/50 bg-green-950/40 text-green-300",claude:"border-amber-800/50 bg-amber-950/40 text-amber-300",perplexity:"border-teal-800/50 bg-teal-950/40 text-teal-300",local:"border-purple-800/50 bg-purple-950/40 text-purple-300"};return r.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${t[e]??"border-zinc-700 bg-zinc-800 text-zinc-300"}`,children:e})}function Tu(e){return e.state==="ok"?"positive":e.state==="checking"?"neutral":"negative"}function Oj(e){switch(e){case"completed":return"positive";case"partial":return"caution";case"failed":return"negative";case"cancelled":return"caution";case"queued":case"running":return"neutral";default:return"neutral"}}function GR(e){switch(e){case"cited":return"positive";case"emerging":return"caution";case"not-cited":return"caution";case"lost":return"negative";case"pending":return"neutral";default:return"neutral"}}function FR(e){return e==="High"?"negative":e==="Moderate"?"caution":"neutral"}function lt({tone:e,children:t}){const n=e==="positive"?"success":e==="caution"?"warning":e==="negative"?"destructive":"neutral";return r.jsx(Tj,{variant:n,children:t})}function Wu({status:e}){return r.jsx(lt,{tone:Oj(e),children:Yu(e)})}function Di(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function ZR(e,t){const n=w.createContext(t),a=c=>{const{children:u,...f}=c,m=w.useMemo(()=>f,Object.values(f));return r.jsx(n.Provider,{value:m,children:u})};a.displayName=e+"Provider";function o(c){const u=w.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[a,o]}function VR(e,t=[]){let n=[];function a(c,u){const f=w.createContext(u),m=n.length;n=[...n,u];const p=y=>{const{scope:x,children:b,...N}=y,S=x?.[e]?.[m]||f,C=w.useMemo(()=>N,Object.values(N));return r.jsx(S.Provider,{value:C,children:b})};p.displayName=c+"Provider";function v(y,x){const b=x?.[e]?.[m]||f,N=w.useContext(b);if(N)return N;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${c}\``)}return[p,v]}const o=()=>{const c=n.map(u=>w.createContext(u));return function(f){const m=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return o.scopeName=e,[a,QR(o,...t)]}function QR(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(c){const u=a.reduce((f,{useScope:m,scopeName:p})=>{const y=m(c)[`__scope${p}`];return{...f,...y}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var ll=globalThis?.document?w.useLayoutEffect:()=>{},YR=tp[" useId ".trim().toString()]||(()=>{}),JR=0;function Qh(e){const[t,n]=w.useState(YR());return ll(()=>{n(a=>a??String(JR++))},[e]),e||(t?`radix-${t}`:"")}var XR=tp[" useInsertionEffect ".trim().toString()]||ll;function WR({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[o,c,u]=eA({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:o;{const v=w.useRef(e!==void 0);w.useEffect(()=>{const y=v.current;y!==f&&console.warn(`${a} is changing from ${y?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=f},[f,a])}const p=w.useCallback(v=>{if(f){const y=tA(v)?v(e):v;y!==e&&u.current?.(y)}else c(v)},[f,e,c,u]);return[m,p]}function eA({defaultProp:e,onChange:t}){const[n,a]=w.useState(e),o=w.useRef(n),c=w.useRef(t);return XR(()=>{c.current=t},[t]),w.useEffect(()=>{o.current!==n&&(c.current?.(n),o.current=n)},[n,o]),[n,a,c]}function tA(e){return typeof e=="function"}function Dj(e){const t=nA(e),n=w.forwardRef((a,o)=>{const{children:c,...u}=a,f=w.Children.toArray(c),m=f.find(iA);if(m){const p=m.props.children,v=f.map(y=>y===m?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...u,ref:o,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return r.jsx(t,{...u,ref:o,children:c})});return n.displayName=`${e}.Slot`,n}function nA(e){const t=w.forwardRef((n,a)=>{const{children:o,...c}=n;if(w.isValidElement(o)){const u=rA(o),f=aA(c,o.props);return o.type!==w.Fragment&&(f.ref=a?zp(a,u):u),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var sA=Symbol("radix.slottable");function iA(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===sA}function aA(e,t){const n={...t};for(const a in t){const o=e[a],c=t[a];/^on[A-Z]/.test(a)?o&&c?n[a]=(...f)=>{const m=c(...f);return o(...f),m}:o&&(n[a]=o):a==="style"?n[a]={...o,...c}:a==="className"&&(n[a]=[o,c].filter(Boolean).join(" "))}return{...e,...n}}function rA(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qs=oA.reduce((e,t)=>{const n=Dj(`Primitive.${t}`),a=w.forwardRef((o,c)=>{const{asChild:u,...f}=o,m=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...f,ref:c})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function lA(e,t){e&&Sp.flushSync(()=>e.dispatchEvent(t))}function cl(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>t.current?.(...n),[])}function cA(e,t=globalThis?.document){const n=cl(e);w.useEffect(()=>{const a=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var uA="DismissableLayer",Mm="dismissableLayer.update",dA="dismissableLayer.pointerDownOutside",fA="dismissableLayer.focusOutside",hb,Lj=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mj=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...m}=e,p=w.useContext(Lj),[v,y]=w.useState(null),x=v?.ownerDocument??globalThis?.document,[,b]=w.useState({}),N=Aa(t,E=>y(E)),S=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),A=v?S.indexOf(v):-1,R=p.layersWithOutsidePointerEventsDisabled.size>0,z=A>=k,$=pA(E=>{const O=E.target,H=[...p.branches].some(ee=>ee.contains(O));!z||H||(o?.(E),u?.(E),E.defaultPrevented||f?.())},x),P=gA(E=>{const O=E.target;[...p.branches].some(ee=>ee.contains(O))||(c?.(E),u?.(E),E.defaultPrevented||f?.())},x);return cA(E=>{A===p.layers.size-1&&(a?.(E),!E.defaultPrevented&&f&&(E.preventDefault(),f()))},x),w.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(hb=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),mb(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=hb)}},[v,x,n,p]),w.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),mb())},[v,p]),w.useEffect(()=>{const E=()=>b({});return document.addEventListener(Mm,E),()=>document.removeEventListener(Mm,E)},[]),r.jsx(Qs.div,{...m,ref:N,style:{pointerEvents:R?z?"auto":"none":void 0,...e.style},onFocusCapture:Di(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Di(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Di(e.onPointerDownCapture,$.onPointerDownCapture)})});Mj.displayName=uA;var hA="DismissableLayerBranch",mA=w.forwardRef((e,t)=>{const n=w.useContext(Lj),a=w.useRef(null),o=Aa(t,a);return w.useEffect(()=>{const c=a.current;if(c)return n.branches.add(c),()=>{n.branches.delete(c)}},[n.branches]),r.jsx(Qs.div,{...e,ref:o})});mA.displayName=hA;function pA(e,t=globalThis?.document){const n=cl(e),a=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const c=f=>{if(f.target&&!a.current){let m=function(){$j(dA,n,p,{discrete:!0})};const p={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);a.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function gA(e,t=globalThis?.document){const n=cl(e),a=w.useRef(!1);return w.useEffect(()=>{const o=c=>{c.target&&!a.current&&$j(fA,n,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function mb(){const e=new CustomEvent(Mm);document.dispatchEvent(e)}function $j(e,t,n,{discrete:a}){const o=n.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),a?lA(o,c):o.dispatchEvent(c)}var Yh="focusScope.autoFocusOnMount",Jh="focusScope.autoFocusOnUnmount",pb={bubbles:!1,cancelable:!0},yA="FocusScope",Pj=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:c,...u}=e,[f,m]=w.useState(null),p=cl(o),v=cl(c),y=w.useRef(null),x=Aa(t,S=>m(S)),b=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(a){let S=function(R){if(b.paused||!f)return;const z=R.target;f.contains(z)?y.current=z:ki(y.current,{select:!0})},C=function(R){if(b.paused||!f)return;const z=R.relatedTarget;z!==null&&(f.contains(z)||ki(y.current,{select:!0}))},k=function(R){if(document.activeElement===document.body)for(const $ of R)$.removedNodes.length>0&&ki(f)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const A=new MutationObserver(k);return f&&A.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),A.disconnect()}}},[a,f,b.paused]),w.useEffect(()=>{if(f){yb.add(b);const S=document.activeElement;if(!f.contains(S)){const k=new CustomEvent(Yh,pb);f.addEventListener(Yh,p),f.dispatchEvent(k),k.defaultPrevented||(vA(wA(Uj(f)),{select:!0}),document.activeElement===S&&ki(f))}return()=>{f.removeEventListener(Yh,p),setTimeout(()=>{const k=new CustomEvent(Jh,pb);f.addEventListener(Jh,v),f.dispatchEvent(k),k.defaultPrevented||ki(S??document.body,{select:!0}),f.removeEventListener(Jh,v),yb.remove(b)},0)}}},[f,p,v,b]);const N=w.useCallback(S=>{if(!n&&!a||b.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const A=S.currentTarget,[R,z]=xA(A);R&&z?!S.shiftKey&&k===z?(S.preventDefault(),n&&ki(R,{select:!0})):S.shiftKey&&k===R&&(S.preventDefault(),n&&ki(z,{select:!0})):k===A&&S.preventDefault()}},[n,a,b.paused]);return r.jsx(Qs.div,{tabIndex:-1,...u,ref:x,onKeyDown:N})});Pj.displayName=yA;function vA(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ki(a,{select:t}),document.activeElement!==n)return}function xA(e){const t=Uj(e),n=gb(t,e),a=gb(t.reverse(),e);return[n,a]}function Uj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const o=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||o?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function gb(e,t){for(const n of e)if(!bA(n,{upTo:t}))return n}function bA(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function SA(e){return e instanceof HTMLInputElement&&"select"in e}function ki(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&SA(e)&&t&&e.select()}}var yb=jA();function jA(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=vb(e,t),e.unshift(t)},remove(t){e=vb(e,t),e[0]?.resume()}}}function vb(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function wA(e){return e.filter(t=>t.tagName!=="A")}var NA="Portal",Ij=w.forwardRef((e,t)=>{const{container:n,...a}=e,[o,c]=w.useState(!1);ll(()=>c(!0),[]);const u=n||o&&globalThis?.document?.body;return u?b_.createPortal(r.jsx(Qs.div,{...a,ref:t}),u):null});Ij.displayName=NA;function CA(e,t){return w.useReducer((n,a)=>t[n][a]??n,e)}var ed=e=>{const{present:t,children:n}=e,a=kA(t),o=typeof n=="function"?n({present:a.isPresent}):w.Children.only(n),c=Aa(a.ref,zA(o));return typeof n=="function"||a.isPresent?w.cloneElement(o,{ref:c}):null};ed.displayName="Presence";function kA(e){const[t,n]=w.useState(),a=w.useRef(null),o=w.useRef(e),c=w.useRef("none"),u=e?"mounted":"unmounted",[f,m]=CA(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=Zc(a.current);c.current=f==="mounted"?p:"none"},[f]),ll(()=>{const p=a.current,v=o.current;if(v!==e){const x=c.current,b=Zc(p);e?m("MOUNT"):b==="none"||p?.display==="none"?m("UNMOUNT"):m(v&&x!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),ll(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,y=b=>{const S=Zc(a.current).includes(CSS.escape(b.animationName));if(b.target===t&&S&&(m("ANIMATION_END"),!o.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},x=b=>{b.target===t&&(c.current=Zc(a.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{v.clearTimeout(p),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(p=>{a.current=p?getComputedStyle(p):null,n(p)},[])}}function Zc(e){return e?.animationName||"none"}function zA(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xh=0;function _A(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??xb()),document.body.insertAdjacentElement("beforeend",e[1]??xb()),Xh++,()=>{Xh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xh--}},[])}function xb(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ws=function(){return ws=Object.assign||function(t){for(var n,a=1,o=arguments.length;a<o;a++){n=arguments[a];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(t[c]=n[c])}return t},ws.apply(this,arguments)};function Bj(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n}function EA(e,t,n){if(n||arguments.length===2)for(var a=0,o=t.length,c;a<o;a++)(c||!(a in t))&&(c||(c=Array.prototype.slice.call(t,0,a)),c[a]=t[a]);return e.concat(c||Array.prototype.slice.call(t))}var hu="right-scroll-bar-position",mu="width-before-scroll-bar",RA="with-scroll-bars-hidden",AA="--removed-body-scroll-bar-size";function Wh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function TA(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var o=n.value;o!==a&&(n.value=a,n.callback(a,o))}}}})[0];return n.callback=t,n.facade}var OA=typeof window<"u"?w.useLayoutEffect:w.useEffect,bb=new WeakMap;function DA(e,t){var n=TA(null,function(a){return e.forEach(function(o){return Wh(o,a)})});return OA(function(){var a=bb.get(n);if(a){var o=new Set(a),c=new Set(e),u=n.current;o.forEach(function(f){c.has(f)||Wh(f,null)}),c.forEach(function(f){o.has(f)||Wh(f,u)})}bb.set(n,e)},[e]),n}function LA(e){return e}function MA(e,t){t===void 0&&(t=LA);var n=[],a=!1,o={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(c){var u=t(c,a);return n.push(u),function(){n=n.filter(function(f){return f!==u})}},assignSyncMedium:function(c){for(a=!0;n.length;){var u=n;n=[],u.forEach(c)}n={push:function(f){return c(f)},filter:function(){return n}}},assignMedium:function(c){a=!0;var u=[];if(n.length){var f=n;n=[],f.forEach(c),u=n}var m=function(){var v=u;u=[],v.forEach(c)},p=function(){return Promise.resolve().then(m)};p(),n={push:function(v){u.push(v),p()},filter:function(v){return u=u.filter(v),n}}}};return o}function $A(e){e===void 0&&(e={});var t=MA(null);return t.options=ws({async:!0,ssr:!1},e),t}var qj=function(e){var t=e.sideCar,n=Bj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return w.createElement(a,ws({},n))};qj.isSideCarExport=!0;function PA(e,t){return e.useMedium(t),qj}var Kj=$A(),em=function(){},td=w.forwardRef(function(e,t){var n=w.useRef(null),a=w.useState({onScrollCapture:em,onWheelCapture:em,onTouchMoveCapture:em}),o=a[0],c=a[1],u=e.forwardProps,f=e.children,m=e.className,p=e.removeScrollBar,v=e.enabled,y=e.shards,x=e.sideCar,b=e.noRelative,N=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,A=k===void 0?"div":k,R=e.gapMode,z=Bj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),$=x,P=DA([n,t]),E=ws(ws({},z),o);return w.createElement(w.Fragment,null,v&&w.createElement($,{sideCar:Kj,removeScrollBar:p,shards:y,noRelative:b,noIsolation:N,inert:S,setCallbacks:c,allowPinchZoom:!!C,lockRef:n,gapMode:R}),u?w.cloneElement(w.Children.only(f),ws(ws({},E),{ref:P})):w.createElement(A,ws({},E,{className:m,ref:P}),f))});td.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};td.classNames={fullWidth:mu,zeroRight:hu};var UA=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function IA(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=UA();return t&&e.setAttribute("nonce",t),e}function BA(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function qA(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var KA=function(){var e=0,t=null;return{add:function(n){e==0&&(t=IA())&&(BA(t,n),qA(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},HA=function(){var e=KA();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hj=function(){var e=HA(),t=function(n){var a=n.styles,o=n.dynamic;return e(a,o),null};return t},GA={left:0,top:0,right:0,gap:0},tm=function(e){return parseInt(e||"",10)||0},FA=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[tm(n),tm(a),tm(o)]},ZA=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return GA;var t=FA(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},VA=Hj(),Dr="data-scroll-locked",QA=function(e,t,n,a){var o=e.left,c=e.top,u=e.right,f=e.gap;return n===void 0&&(n="margin"),`
|
|
13
|
-
.`.concat(RA,` {
|
|
14
|
-
overflow: hidden `).concat(a,`;
|
|
15
|
-
padding-right: `).concat(f,"px ").concat(a,`;
|
|
16
|
-
}
|
|
17
|
-
body[`).concat(Dr,`] {
|
|
18
|
-
overflow: hidden `).concat(a,`;
|
|
19
|
-
overscroll-behavior: contain;
|
|
20
|
-
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
21
|
-
padding-left: `.concat(o,`px;
|
|
22
|
-
padding-top: `).concat(c,`px;
|
|
23
|
-
padding-right: `).concat(u,`px;
|
|
24
|
-
margin-left:0;
|
|
25
|
-
margin-top:0;
|
|
26
|
-
margin-right: `).concat(f,"px ").concat(a,`;
|
|
27
|
-
`),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.`).concat(hu,` {
|
|
31
|
-
right: `).concat(f,"px ").concat(a,`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.`).concat(mu,` {
|
|
35
|
-
margin-right: `).concat(f,"px ").concat(a,`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.`).concat(hu," .").concat(hu,` {
|
|
39
|
-
right: 0 `).concat(a,`;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.`).concat(mu," .").concat(mu,` {
|
|
43
|
-
margin-right: 0 `).concat(a,`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
body[`).concat(Dr,`] {
|
|
47
|
-
`).concat(AA,": ").concat(f,`px;
|
|
48
|
-
}
|
|
49
|
-
`)},Sb=function(){var e=parseInt(document.body.getAttribute(Dr)||"0",10);return isFinite(e)?e:0},YA=function(){w.useEffect(function(){return document.body.setAttribute(Dr,(Sb()+1).toString()),function(){var e=Sb()-1;e<=0?document.body.removeAttribute(Dr):document.body.setAttribute(Dr,e.toString())}},[])},JA=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,o=a===void 0?"margin":a;YA();var c=w.useMemo(function(){return ZA(o)},[o]);return w.createElement(VA,{styles:QA(c,!t,o,n?"":"!important")})},$m=!1;if(typeof window<"u")try{var Vc=Object.defineProperty({},"passive",{get:function(){return $m=!0,!0}});window.addEventListener("test",Vc,Vc),window.removeEventListener("test",Vc,Vc)}catch{$m=!1}var wr=$m?{passive:!1}:!1,XA=function(e){return e.tagName==="TEXTAREA"},Gj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!XA(e)&&n[t]==="visible")},WA=function(e){return Gj(e,"overflowY")},eT=function(e){return Gj(e,"overflowX")},jb=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var o=Fj(e,a);if(o){var c=Zj(e,a),u=c[1],f=c[2];if(u>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},tT=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},nT=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},Fj=function(e,t){return e==="v"?WA(t):eT(t)},Zj=function(e,t){return e==="v"?tT(t):nT(t)},sT=function(e,t){return e==="h"&&t==="rtl"?-1:1},iT=function(e,t,n,a,o){var c=sT(e,window.getComputedStyle(t).direction),u=c*a,f=n.target,m=t.contains(f),p=!1,v=u>0,y=0,x=0;do{if(!f)break;var b=Zj(e,f),N=b[0],S=b[1],C=b[2],k=S-C-c*N;(N||k)&&Fj(e,f)&&(y+=k,x+=N);var A=f.parentNode;f=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(v&&Math.abs(y)<1||!v&&Math.abs(x)<1)&&(p=!0),p},Qc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wb=function(e){return[e.deltaX,e.deltaY]},Nb=function(e){return e&&"current"in e?e.current:e},aT=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rT=function(e){return`
|
|
50
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
51
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
52
|
-
`)},oT=0,Nr=[];function lT(e){var t=w.useRef([]),n=w.useRef([0,0]),a=w.useRef(),o=w.useState(oT++)[0],c=w.useState(Hj)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=EA([e.lockRef.current],(e.shards||[]).map(Nb),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var f=w.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var k=Qc(S),A=n.current,R="deltaX"in S?S.deltaX:A[0]-k[0],z="deltaY"in S?S.deltaY:A[1]-k[1],$,P=S.target,E=Math.abs(R)>Math.abs(z)?"h":"v";if("touches"in S&&E==="h"&&P.type==="range")return!1;var O=window.getSelection(),H=O&&O.anchorNode,ee=H?H===P||H.contains(P):!1;if(ee)return!1;var V=jb(E,P);if(!V)return!0;if(V?$=E:($=E==="v"?"h":"v",V=jb(E,P)),!V)return!1;if(!a.current&&"changedTouches"in S&&(R||z)&&(a.current=$),!$)return!0;var se=a.current||$;return iT(se,C,S,se==="h"?R:z)},[]),m=w.useCallback(function(S){var C=S;if(!(!Nr.length||Nr[Nr.length-1]!==c)){var k="deltaY"in C?wb(C):Qc(C),A=t.current.filter(function($){return $.name===C.type&&($.target===C.target||C.target===$.shadowParent)&&aT($.delta,k)})[0];if(A&&A.should){C.cancelable&&C.preventDefault();return}if(!A){var R=(u.current.shards||[]).map(Nb).filter(Boolean).filter(function($){return $.contains(C.target)}),z=R.length>0?f(C,R[0]):!u.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),p=w.useCallback(function(S,C,k,A){var R={name:S,delta:C,target:k,should:A,shadowParent:cT(k)};t.current.push(R),setTimeout(function(){t.current=t.current.filter(function(z){return z!==R})},1)},[]),v=w.useCallback(function(S){n.current=Qc(S),a.current=void 0},[]),y=w.useCallback(function(S){p(S.type,wb(S),S.target,f(S,e.lockRef.current))},[]),x=w.useCallback(function(S){p(S.type,Qc(S),S.target,f(S,e.lockRef.current))},[]);w.useEffect(function(){return Nr.push(c),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:x}),document.addEventListener("wheel",m,wr),document.addEventListener("touchmove",m,wr),document.addEventListener("touchstart",v,wr),function(){Nr=Nr.filter(function(S){return S!==c}),document.removeEventListener("wheel",m,wr),document.removeEventListener("touchmove",m,wr),document.removeEventListener("touchstart",v,wr)}},[]);var b=e.removeScrollBar,N=e.inert;return w.createElement(w.Fragment,null,N?w.createElement(c,{styles:rT(o)}):null,b?w.createElement(JA,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function cT(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const uT=PA(Kj,lT);var Vj=w.forwardRef(function(e,t){return w.createElement(td,ws({},e,{ref:t,sideCar:uT}))});Vj.classNames=td.classNames;var dT=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cr=new WeakMap,Yc=new WeakMap,Jc={},nm=0,Qj=function(e){return e&&(e.host||Qj(e.parentNode))},fT=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=Qj(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},hT=function(e,t,n,a){var o=fT(t,Array.isArray(e)?e:[e]);Jc[n]||(Jc[n]=new WeakMap);var c=Jc[n],u=[],f=new Set,m=new Set(o),p=function(y){!y||f.has(y)||(f.add(y),p(y.parentNode))};o.forEach(p);var v=function(y){!y||m.has(y)||Array.prototype.forEach.call(y.children,function(x){if(f.has(x))v(x);else try{var b=x.getAttribute(a),N=b!==null&&b!=="false",S=(Cr.get(x)||0)+1,C=(c.get(x)||0)+1;Cr.set(x,S),c.set(x,C),u.push(x),S===1&&N&&Yc.set(x,!0),C===1&&x.setAttribute(n,"true"),N||x.setAttribute(a,"true")}catch(k){console.error("aria-hidden: cannot operate on ",x,k)}})};return v(t),f.clear(),nm++,function(){u.forEach(function(y){var x=Cr.get(y)-1,b=c.get(y)-1;Cr.set(y,x),c.set(y,b),x||(Yc.has(y)||y.removeAttribute(a),Yc.delete(y)),b||y.removeAttribute(n)}),nm--,nm||(Cr=new WeakMap,Cr=new WeakMap,Yc=new WeakMap,Jc={})}},mT=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),o=dT(e);return o?(a.push.apply(a,Array.from(o.querySelectorAll("[aria-live], script"))),hT(a,o,n,"aria-hidden")):function(){return null}},nd="Dialog",[Yj]=VR(nd),[pT,fs]=Yj(nd),Jj=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:o,onOpenChange:c,modal:u=!0}=e,f=w.useRef(null),m=w.useRef(null),[p,v]=WR({prop:a,defaultProp:o??!1,onChange:c,caller:nd});return r.jsx(pT,{scope:t,triggerRef:f,contentRef:m,contentId:Qh(),titleId:Qh(),descriptionId:Qh(),open:p,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(y=>!y),[v]),modal:u,children:n})};Jj.displayName=nd;var Xj="DialogTrigger",gT=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(Xj,n),c=Aa(t,o.triggerRef);return r.jsx(Qs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Tp(o.open),...a,ref:c,onClick:Di(e.onClick,o.onOpenToggle)})});gT.displayName=Xj;var Rp="DialogPortal",[yT,Wj]=Yj(Rp,{forceMount:void 0}),ew=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:o}=e,c=fs(Rp,t);return r.jsx(yT,{scope:t,forceMount:n,children:w.Children.map(a,u=>r.jsx(ed,{present:n||c.open,children:r.jsx(Ij,{asChild:!0,container:o,children:u})}))})};ew.displayName=Rp;var Ou="DialogOverlay",tw=w.forwardRef((e,t)=>{const n=Wj(Ou,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,c=fs(Ou,e.__scopeDialog);return c.modal?r.jsx(ed,{present:a||c.open,children:r.jsx(xT,{...o,ref:t})}):null});tw.displayName=Ou;var vT=Dj("DialogOverlay.RemoveScroll"),xT=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(Ou,n);return r.jsx(Vj,{as:vT,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(Qs.div,{"data-state":Tp(o.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),_a="DialogContent",nw=w.forwardRef((e,t)=>{const n=Wj(_a,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,c=fs(_a,e.__scopeDialog);return r.jsx(ed,{present:a||c.open,children:c.modal?r.jsx(bT,{...o,ref:t}):r.jsx(ST,{...o,ref:t})})});nw.displayName=_a;var bT=w.forwardRef((e,t)=>{const n=fs(_a,e.__scopeDialog),a=w.useRef(null),o=Aa(t,n.contentRef,a);return w.useEffect(()=>{const c=a.current;if(c)return mT(c)},[]),r.jsx(sw,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Di(e.onCloseAutoFocus,c=>{c.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Di(e.onPointerDownOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&c.preventDefault()}),onFocusOutside:Di(e.onFocusOutside,c=>c.preventDefault())})}),ST=w.forwardRef((e,t)=>{const n=fs(_a,e.__scopeDialog),a=w.useRef(!1),o=w.useRef(!1);return r.jsx(sw,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||n.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=c.target;n.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&o.current&&c.preventDefault()}})}),sw=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:c,...u}=e,f=fs(_a,n),m=w.useRef(null),p=Aa(t,m);return _A(),r.jsxs(r.Fragment,{children:[r.jsx(Pj,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:c,children:r.jsx(Mj,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Tp(f.open),...u,ref:p,onDismiss:()=>f.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(jT,{titleId:f.titleId}),r.jsx(NT,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Ap="DialogTitle",iw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(Ap,n);return r.jsx(Qs.h2,{id:o.titleId,...a,ref:t})});iw.displayName=Ap;var aw="DialogDescription",rw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(aw,n);return r.jsx(Qs.p,{id:o.descriptionId,...a,ref:t})});rw.displayName=aw;var ow="DialogClose",lw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(ow,n);return r.jsx(Qs.button,{type:"button",...a,ref:t,onClick:Di(e.onClick,()=>o.onOpenChange(!1))})});lw.displayName=ow;function Tp(e){return e?"open":"closed"}var cw="DialogTitleWarning",[hP,uw]=ZR(cw,{contentName:_a,titleName:Ap,docsSlug:"dialog"}),jT=({titleId:e})=>{const t=uw(cw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
53
|
-
|
|
54
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
55
|
-
|
|
56
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},wT="DialogDescriptionWarning",NT=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${uw(wT).contentName}}.`;return w.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},dw=Jj,fw=ew,Op=tw,Dp=nw,Lp=iw,hw=rw,mw=lw;const CT=dw,kT=fw,pw=w.forwardRef(({className:e,...t},n)=>r.jsx(Op,{ref:n,className:es("fixed inset-0 z-50 bg-black/70 backdrop-blur-sm",e),...t}));pw.displayName=Op.displayName;const zT=400,_T=1200,ET=720,gw=w.forwardRef(({className:e,children:t,...n},a)=>{const[o,c]=w.useState(ET),u=w.useRef(!1),f=w.useRef(0),m=w.useRef(0),p=w.useCallback(x=>{u.current=!0,f.current=x.clientX,m.current=o,x.target.setPointerCapture(x.pointerId),x.preventDefault()},[o]),v=w.useCallback(x=>{if(!u.current)return;const b=f.current-x.clientX,N=Math.min(_T,Math.max(zT,m.current+b));c(N)},[]),y=w.useCallback(()=>{u.current=!1},[]);return r.jsxs(kT,{children:[r.jsx(pw,{}),r.jsxs(Dp,{ref:a,className:es("fixed z-50 flex flex-col bg-zinc-950 px-5 py-4 shadow-2xl overflow-hidden","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-t-2xl max-md:border-t","md:inset-y-0 md:right-0 md:h-full md:border-l","border-zinc-800",e),style:{width:`min(${o}px, 100vw)`},...n,children:[r.jsx("div",{className:"absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-zinc-700/50 active:bg-zinc-600/50 transition-colors max-md:hidden",onPointerDown:p,onPointerMove:v,onPointerUp:y}),t,r.jsxs(mw,{className:"absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-900 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:[r.jsx(Qu,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});gw.displayName=Dp.displayName;const RT=({className:e,...t})=>r.jsx("div",{className:es("flex flex-col gap-1.5 pr-10",e),...t}),yw=w.forwardRef(({className:e,...t},n)=>r.jsx(Lp,{ref:n,className:es("text-lg font-medium text-zinc-50",e),...t}));yw.displayName=Lp.displayName;const vw=w.forwardRef(({className:e,...t},n)=>r.jsx(hw,{ref:n,className:es("text-sm text-zinc-500",e),...t}));vw.displayName=hw.displayName;function AT({title:e,subtitle:t,children:n,open:a,onClose:o}){return r.jsx(CT,{open:a,onOpenChange:c=>c?void 0:o(),children:r.jsxs(gw,{children:[r.jsxs(RT,{className:"drawer-head",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:t}),r.jsx(yw,{id:"drawer-title",children:e}),r.jsx(vw,{className:"sr-only",children:t})]}),r.jsx("div",{className:"drawer-body",children:n})]})})}function ne(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const p=u.prototype,v=Object.keys(p);for(let y=0;y<v.length;y++){const x=v[y];x in f||(f[x]=p[x].bind(f))}}const o=n?.Parent??Object;class c extends o{}Object.defineProperty(c,"name",{value:e});function u(f){var m;const p=n?.Parent?new c:this;a(p,f),(m=p._zod).deferred??(m.deferred=[]);for(const v of p._zod.deferred)v();return p}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Lr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class xw extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const bw={};function $i(e){return bw}function Sw(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,o])=>t.indexOf(+a)===-1).map(([a,o])=>o)}function Pm(e,t){return typeof t=="bigint"?t.toString():t}function Mp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $p(e){return e==null}function Pp(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function TT(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let o=(a.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m?.[1]&&(o=Number.parseInt(m[1]))}const c=n>o?n:o,u=Number.parseInt(e.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}const Cb=Symbol("evaluating");function ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==Cb)return a===void 0&&(a=Cb,a=n()),a},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Oa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ki(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function kb(e){return JSON.stringify(e)}function OT(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const jw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Du(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const DT=Mp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ir(e){if(Du(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Du(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ww(e){return Ir(e)?{...e}:Array.isArray(e)?[...e]:e}const LT=new Set(["string","number","symbol"]);function Br(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hi(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function MT(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const $T={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function PT(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=Ki(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=n.shape[f])}return Oa(this,"shape",u),u},checks:[]});return Hi(e,c)}function UT(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=Ki(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Oa(this,"shape",u),u},checks:[]});return Hi(e,c)}function IT(e,t){if(!Ir(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const c=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(c,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Ki(e._zod.def,{get shape(){const c={...e._zod.def.shape,...t};return Oa(this,"shape",c),c}});return Hi(e,o)}function BT(e,t){if(!Ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ki(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return Oa(this,"shape",a),a}});return Hi(e,n)}function qT(e,t){const n=Ki(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Oa(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Hi(e,n)}function KT(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ki(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const p in n){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(m[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)m[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return Oa(this,"shape",m),m},checks:[]});return Hi(t,u)}function HT(e,t,n){const a=Ki(t._zod.def,{get shape(){const o=t._zod.def.shape,c={...o};if(n)for(const u in n){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)c[u]=new e({type:"nonoptional",innerType:o[u]});return Oa(this,"shape",c),c}});return Hi(t,a)}function Er(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Rr(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function Xc(e){return typeof e=="string"?e:e?.message}function Pi(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const o=Xc(e.inst?._zod.def?.error?.(e))??Xc(t?.error?.(e))??Xc(n.customError?.(e))??Xc(n.localeError?.(e))??"Invalid input";a.message=o}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function Up(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ul(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const Nw=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Pm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Cw=ne("$ZodError",Nw),kw=ne("$ZodError",Nw,{Parent:Error});function GT(e,t=n=>n.message){const n={},a=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):a.push(t(o));return{formErrors:a,fieldErrors:n}}function FT(e,t=n=>n.message){const n={_errors:[]},a=o=>{for(const c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>a({issues:u}));else if(c.code==="invalid_key")a({issues:c.issues});else if(c.code==="invalid_element")a({issues:c.issues});else if(c.path.length===0)n._errors.push(t(c));else{let u=n,f=0;for(;f<c.path.length;){const m=c.path[f];f===c.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(c))):u[m]=u[m]||{_errors:[]},u=u[m],f++}}};return a(e),n}const Ip=e=>(t,n,a,o)=>{const c=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new Lr;if(u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>Pi(m,c,$i())));throw jw(f,o?.callee),f}return u.value},Bp=e=>async(t,n,a,o)=>{const c=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>Pi(m,c,$i())));throw jw(f,o?.callee),f}return u.value},sd=e=>(t,n,a)=>{const o=a?{...a,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new Lr;return c.issues.length?{success:!1,error:new(e??Cw)(c.issues.map(u=>Pi(u,o,$i())))}:{success:!0,data:c.value}},ZT=sd(kw),id=e=>async(t,n,a)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Pi(u,o,$i())))}:{success:!0,data:c.value}},VT=id(kw),QT=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ip(e)(t,n,o)},YT=e=>(t,n,a)=>Ip(e)(t,n,a),JT=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Bp(e)(t,n,o)},XT=e=>async(t,n,a)=>Bp(e)(t,n,a),WT=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return sd(e)(t,n,o)},eO=e=>(t,n,a)=>sd(e)(t,n,a),tO=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return id(e)(t,n,o)},nO=e=>async(t,n,a)=>id(e)(t,n,a),sO=/^[cC][^\s-]{8,}$/,iO=/^[0-9a-z]+$/,aO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rO=/^[0-9a-vA-V]{20}$/,oO=/^[A-Za-z0-9]{27}$/,lO=/^[a-zA-Z0-9_-]{21}$/,cO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,zb=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,dO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function hO(){return new RegExp(fO,"u")}const mO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,gO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,yO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zw=/^[A-Za-z0-9_-]*$/,xO=/^\+[1-9]\d{6,14}$/,_w="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",bO=new RegExp(`^${_w}$`);function Ew(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function SO(e){return new RegExp(`^${Ew(e)}$`)}function jO(e){const t=Ew({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${_w}T(?:${a})$`)}const wO=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},NO=/^-?\d+$/,Rw=/^-?\d+(?:\.\d+)?$/,CO=/^(?:true|false)$/i,kO=/^[^A-Z]*$/,zO=/^[^a-z]*$/,kn=ne("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Aw={number:"number",bigint:"bigint",object:"date"},Tw=ne("$ZodCheckLessThan",(e,t)=>{kn.init(e,t);const n=Aw[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,c=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ow=ne("$ZodCheckGreaterThan",(e,t)=>{kn.init(e,t);const n=Aw[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,c=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_O=ne("$ZodCheckMultipleOf",(e,t)=>{kn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):TT(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),EO=ne("$ZodCheckNumberFormat",(e,t)=>{kn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[o,c]=$T[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=o,f.maximum=c,n&&(f.pattern=NO)}),e._zod.check=u=>{const f=u.value;if(n){if(!Number.isInteger(f)){u.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}f<o&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),f>c&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!t.abort})}}),RO=ne("$ZodCheckMaxLength",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!$p(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const o=a.value;if(o.length<=t.maximum)return;const u=Up(o);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),AO=ne("$ZodCheckMinLength",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!$p(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const o=a.value;if(o.length>=t.minimum)return;const u=Up(o);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),TO=ne("$ZodCheckLengthEquals",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!$p(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=a=>{const o=a.value,c=o.length;if(c===t.length)return;const u=Up(o),f=c>t.length;a.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),ad=ne("$ZodCheckStringFormat",(e,t)=>{var n,a;kn.init(e,t),e._zod.onattach.push(o=>{const c=o._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),OO=ne("$ZodCheckRegex",(e,t)=>{ad.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),DO=ne("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kO),ad.init(e,t)}),LO=ne("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zO),ad.init(e,t)}),MO=ne("$ZodCheckIncludes",(e,t)=>{kn.init(e,t);const n=Br(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(o=>{const c=o._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(a)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),$O=ne("$ZodCheckStartsWith",(e,t)=>{kn.init(e,t);const n=new RegExp(`^${Br(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),PO=ne("$ZodCheckEndsWith",(e,t)=>{kn.init(e,t);const n=new RegExp(`.*${Br(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),UO=ne("$ZodCheckOverwrite",(e,t)=>{kn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class IO{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
|
|
57
|
-
`).filter(u=>u),o=Math.min(...a.map(u=>u.length-u.trimStart().length)),c=a.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(c=>` ${c}`)];return new t(...n,o.join(`
|
|
58
|
-
`))}}const BO={major:4,minor:3,patch:6},kt=ne("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=BO;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,f,m)=>{let p=Er(u),v;for(const y of f){if(y._zod.def.when){if(!y._zod.def.when(u))continue}else if(p)continue;const x=u.issues.length,b=y._zod.check(u);if(b instanceof Promise&&m?.async===!1)throw new Lr;if(v||b instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await b,u.issues.length!==x&&(p||(p=Er(u,x)))});else{if(u.issues.length===x)continue;p||(p=Er(u,x))}}return v?v.then(()=>u):u},c=(u,f,m)=>{if(Er(u))return u.aborted=!0,u;const p=o(f,a,m);if(p instanceof Promise){if(m.async===!1)throw new Lr;return p.then(v=>e._zod.parse(v,m))}return e._zod.parse(p,m)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return p instanceof Promise?p.then(v=>c(v,u,f)):c(p,u,f)}const m=e._zod.parse(u,f);if(m instanceof Promise){if(f.async===!1)throw new Lr;return m.then(p=>o(p,a,f))}return o(m,a,f)}}ct(e,"~standard",()=>({validate:o=>{try{const c=ZT(e,o);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return VT(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),qp=ne("$ZodString",(e,t)=>{kt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wO(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),wt=ne("$ZodStringFormat",(e,t)=>{ad.init(e,t),qp.init(e,t)}),qO=ne("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uO),wt.init(e,t)}),KO=ne("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=zb(a))}else t.pattern??(t.pattern=zb());wt.init(e,t)}),HO=ne("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dO),wt.init(e,t)}),GO=ne("$ZodURL",(e,t)=>{wt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),o=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),FO=ne("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=hO()),wt.init(e,t)}),ZO=ne("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=lO),wt.init(e,t)}),VO=ne("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=sO),wt.init(e,t)}),QO=ne("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=iO),wt.init(e,t)}),YO=ne("$ZodULID",(e,t)=>{t.pattern??(t.pattern=aO),wt.init(e,t)}),JO=ne("$ZodXID",(e,t)=>{t.pattern??(t.pattern=rO),wt.init(e,t)}),XO=ne("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=oO),wt.init(e,t)}),WO=ne("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jO(t)),wt.init(e,t)}),eD=ne("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bO),wt.init(e,t)}),tD=ne("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=SO(t)),wt.init(e,t)}),nD=ne("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cO),wt.init(e,t)}),sD=ne("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=mO),wt.init(e,t),e._zod.bag.format="ipv4"}),iD=ne("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pO),wt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),aD=ne("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gO),wt.init(e,t)}),rD=ne("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=yO),wt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[o,c]=a;if(!c)throw new Error;const u=Number(c);if(`${u}`!==c)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Dw(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const oD=ne("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=vO),wt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Dw(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function lD(e){if(!zw.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dw(n)}const cD=ne("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=zw),wt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{lD(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),uD=ne("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xO),wt.init(e,t)});function dD(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const o=JSON.parse(atob(a));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const fD=ne("$ZodJWT",(e,t)=>{wt.init(e,t),e._zod.check=n=>{dD(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Lw=ne("$ZodNumber",(e,t)=>{kt.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rw,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const c=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...c?{received:c}:{}}),n}}),hD=ne("$ZodNumberFormat",(e,t)=>{EO.init(e,t),Lw.init(e,t)}),mD=ne("$ZodBoolean",(e,t)=>{kt.init(e,t),e._zod.pattern=CO,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),pD=ne("$ZodUnknown",(e,t)=>{kt.init(e,t),e._zod.parse=n=>n}),gD=ne("$ZodNever",(e,t)=>{kt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function _b(e,t,n){e.issues.length&&t.issues.push(...Rr(n,e.issues)),t.value[n]=e.value}const yD=ne("$ZodArray",(e,t)=>{kt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const c=[];for(let u=0;u<o.length;u++){const f=o[u],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?c.push(m.then(p=>_b(p,n,u))):_b(m,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function Lu(e,t,n,a,o){if(e.issues.length){if(o&&!(n in a))return;t.issues.push(...Rr(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function Mw(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=MT(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function $w(e,t,n,a,o,c){const u=[],f=o.keySet,m=o.catchall._zod,p=m.def.type,v=m.optout==="optional";for(const y in t){if(f.has(y))continue;if(p==="never"){u.push(y);continue}const x=m.run({value:t[y],issues:[]},a);x instanceof Promise?e.push(x.then(b=>Lu(b,n,y,t,v))):Lu(x,n,y,t,v)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:c}),e.length?Promise.all(e).then(()=>n):n}const vD=ne("$ZodObject",(e,t)=>{if(kt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=Mp(()=>Mw(t));ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const p in f){const v=f[p]._zod;if(v.values){m[p]??(m[p]=new Set);for(const y of v.values)m[p].add(y)}}return m});const o=Du,c=t.catchall;let u;e._zod.parse=(f,m)=>{u??(u=a.value);const p=f.value;if(!o(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const v=[],y=u.shape;for(const x of u.keys){const b=y[x],N=b._zod.optout==="optional",S=b._zod.run({value:p[x],issues:[]},m);S instanceof Promise?v.push(S.then(C=>Lu(C,f,x,p,N))):Lu(S,f,x,p,N)}return c?$w(v,p,f,m,a.value,e):v.length?Promise.all(v).then(()=>f):f}}),xD=ne("$ZodObjectJIT",(e,t)=>{vD.init(e,t);const n=e._zod.parse,a=Mp(()=>Mw(t)),o=x=>{const b=new IO(["shape","payload","ctx"]),N=a.value,S=R=>{const z=kb(R);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};b.write("const input = payload.value;");const C=Object.create(null);let k=0;for(const R of N.keys)C[R]=`key_${k++}`;b.write("const newResult = {};");for(const R of N.keys){const z=C[R],$=kb(R),E=x[R]?._zod?.optout==="optional";b.write(`const ${z} = ${S(R)};`),E?b.write(`
|
|
59
|
-
if (${z}.issues.length) {
|
|
60
|
-
if (${$} in input) {
|
|
61
|
-
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
62
|
-
...iss,
|
|
63
|
-
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
64
|
-
})));
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (${z}.value === undefined) {
|
|
69
|
-
if (${$} in input) {
|
|
70
|
-
newResult[${$}] = undefined;
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
newResult[${$}] = ${z}.value;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
`):b.write(`
|
|
77
|
-
if (${z}.issues.length) {
|
|
78
|
-
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
79
|
-
...iss,
|
|
80
|
-
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
81
|
-
})));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (${z}.value === undefined) {
|
|
85
|
-
if (${$} in input) {
|
|
86
|
-
newResult[${$}] = undefined;
|
|
87
|
-
}
|
|
88
|
-
} else {
|
|
89
|
-
newResult[${$}] = ${z}.value;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
`)}b.write("payload.value = newResult;"),b.write("return payload;");const A=b.compile();return(R,z)=>A(x,R,z)};let c;const u=Du,f=!bw.jitless,p=f&&DT.value,v=t.catchall;let y;e._zod.parse=(x,b)=>{y??(y=a.value);const N=x.value;return u(N)?f&&p&&b?.async===!1&&b.jitless!==!0?(c||(c=o(t.shape)),x=c(x,b),v?$w([],N,x,b,y,e):x):n(x,b):(x.issues.push({expected:"object",code:"invalid_type",input:N,inst:e}),x)}});function Eb(e,t,n,a){for(const c of e)if(c.issues.length===0)return t.value=c.value,t;const o=e.filter(c=>!Er(c));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(c=>c.issues.map(u=>Pi(u,a,$i())))}),t)}const bD=ne("$ZodUnion",(e,t)=>{kt.init(e,t),ct(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ct(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ct(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ct(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${o.map(c=>Pp(c.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(o,c)=>{if(n)return a(o,c);let u=!1;const f=[];for(const m of t.options){const p=m._zod.run({value:o.value,issues:[]},c);if(p instanceof Promise)f.push(p),u=!0;else{if(p.issues.length===0)return p;f.push(p)}}return u?Promise.all(f).then(m=>Eb(m,o,e,c)):Eb(f,o,e,c)}}),SD=ne("$ZodIntersection",(e,t)=>{kt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value,c=t.left._zod.run({value:o,issues:[]},a),u=t.right._zod.run({value:o,issues:[]},a);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([m,p])=>Rb(n,m,p)):Rb(n,c,u)}});function Um(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ir(e)&&Ir(t)){const n=Object.keys(t),a=Object.keys(e).filter(c=>n.indexOf(c)!==-1),o={...e,...t};for(const c of a){const u=Um(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};o[c]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const o=e[a],c=t[a],u=Um(o,c);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Rb(e,t,n){const a=new Map;let o;for(const f of t.issues)if(f.code==="unrecognized_keys"){o??(o=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const c=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(c.length&&o&&e.issues.push({...o,keys:c}),Er(e))return e;const u=Um(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const jD=ne("$ZodRecord",(e,t)=>{kt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Ir(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const c=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const p of u)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){f.add(typeof p=="number"?p.toString():p);const v=t.valueType._zod.run({value:o[p],issues:[]},a);v instanceof Promise?c.push(v.then(y=>{y.issues.length&&n.issues.push(...Rr(p,y.issues)),n.value[p]=y.value})):(v.issues.length&&n.issues.push(...Rr(p,v.issues)),n.value[p]=v.value)}let m;for(const p in o)f.has(p)||(m=m??[],m.push(p));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(o)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&Rw.test(f)&&m.issues.length){const y=t.keyType._zod.run({value:Number(f),issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(m=y)}if(m.issues.length){t.mode==="loose"?n.value[f]=o[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(y=>Pi(y,a,$i())),input:f,path:[f],inst:e});continue}const v=t.valueType._zod.run({value:o[f],issues:[]},a);v instanceof Promise?c.push(v.then(y=>{y.issues.length&&n.issues.push(...Rr(f,y.issues)),n.value[m.value]=y.value})):(v.issues.length&&n.issues.push(...Rr(f,v.issues)),n.value[m.value]=v.value)}}return c.length?Promise.all(c).then(()=>n):n}}),wD=ne("$ZodEnum",(e,t)=>{kt.init(e,t);const n=Sw(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(o=>LT.has(typeof o)).map(o=>typeof o=="string"?Br(o):o.toString()).join("|")})$`),e._zod.parse=(o,c)=>{const u=o.value;return a.has(u)||o.issues.push({code:"invalid_value",values:n,input:u,inst:e}),o}}),ND=ne("$ZodLiteral",(e,t)=>{if(kt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Br(a):a?Br(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,o)=>{const c=a.value;return n.has(c)||a.issues.push({code:"invalid_value",values:t.values,input:c,inst:e}),a}}),CD=ne("$ZodTransform",(e,t)=>{kt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new xw(e.constructor.name);const o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(n.value=u,n));if(o instanceof Promise)throw new Lr;return n.value=o,n}});function Ab(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Pw=ne("$ZodOptional",(e,t)=>{kt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pp(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Ab(c,n.value)):Ab(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),kD=ne("$ZodExactOptional",(e,t)=>{Pw.init(e,t),ct(e._zod,"values",()=>t.innerType._zod.values),ct(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),zD=ne("$ZodNullable",(e,t)=>{kt.init(e,t),ct(e._zod,"optin",()=>t.innerType._zod.optin),ct(e._zod,"optout",()=>t.innerType._zod.optout),ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pp(n.source)}|null)$`):void 0}),ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),_D=ne("$ZodDefault",(e,t)=>{kt.init(e,t),e._zod.optin="optional",ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Tb(c,t)):Tb(o,t)}});function Tb(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ED=ne("$ZodPrefault",(e,t)=>{kt.init(e,t),e._zod.optin="optional",ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),RD=ne("$ZodNonOptional",(e,t)=>{kt.init(e,t),ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Ob(c,e)):Ob(o,e)}});function Ob(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const AD=ne("$ZodCatch",(e,t)=>{kt.init(e,t),ct(e._zod,"optin",()=>t.innerType._zod.optin),ct(e._zod,"optout",()=>t.innerType._zod.optout),ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>(n.value=c.value,c.issues.length&&(n.value=t.catchValue({...n,error:{issues:c.issues.map(u=>Pi(u,a,$i()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>Pi(c,a,$i()))},input:n.value}),n.issues=[]),n)}}),TD=ne("$ZodPipe",(e,t)=>{kt.init(e,t),ct(e._zod,"values",()=>t.in._zod.values),ct(e._zod,"optin",()=>t.in._zod.optin),ct(e._zod,"optout",()=>t.out._zod.optout),ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const c=t.out._zod.run(n,a);return c instanceof Promise?c.then(u=>Wc(u,t.in,a)):Wc(c,t.in,a)}const o=t.in._zod.run(n,a);return o instanceof Promise?o.then(c=>Wc(c,t.out,a)):Wc(o,t.out,a)}});function Wc(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const OD=ne("$ZodReadonly",(e,t)=>{kt.init(e,t),ct(e._zod,"propValues",()=>t.innerType._zod.propValues),ct(e._zod,"values",()=>t.innerType._zod.values),ct(e._zod,"optin",()=>t.innerType?._zod?.optin),ct(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(Db):Db(o)}});function Db(e){return e.value=Object.freeze(e.value),e}const DD=ne("$ZodCustom",(e,t)=>{kn.init(e,t),kt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,o=t.fn(a);if(o instanceof Promise)return o.then(c=>Lb(c,n,a,e));Lb(o,n,a,e)}});function Lb(e,t,n,a){if(!e){const o={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(o.params=a._zod.def.params),t.issues.push(ul(o))}}var Mb;class LD{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const o={...a,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function MD(){return new LD}(Mb=globalThis).__zod_globalRegistry??(Mb.__zod_globalRegistry=MD());const Yo=globalThis.__zod_globalRegistry;function $D(e,t){return new e({type:"string",...ke(t)})}function PD(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ke(t)})}function $b(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ke(t)})}function UD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(t)})}function ID(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(t)})}function BD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(t)})}function qD(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(t)})}function KD(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ke(t)})}function HD(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(t)})}function GD(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(t)})}function FD(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(t)})}function ZD(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(t)})}function VD(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(t)})}function QD(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ke(t)})}function YD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(t)})}function JD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(t)})}function XD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(t)})}function WD(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(t)})}function eL(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(t)})}function tL(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ke(t)})}function nL(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(t)})}function sL(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ke(t)})}function iL(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(t)})}function aL(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(t)})}function rL(e,t){return new e({type:"string",format:"date",check:"string_format",...ke(t)})}function oL(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ke(t)})}function lL(e,t){return new e({type:"string",format:"duration",check:"string_format",...ke(t)})}function cL(e,t){return new e({type:"number",checks:[],...ke(t)})}function uL(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ke(t)})}function dL(e,t){return new e({type:"boolean",...ke(t)})}function fL(e){return new e({type:"unknown"})}function hL(e,t){return new e({type:"never",...ke(t)})}function Pb(e,t){return new Tw({check:"less_than",...ke(t),value:e,inclusive:!1})}function sm(e,t){return new Tw({check:"less_than",...ke(t),value:e,inclusive:!0})}function Ub(e,t){return new Ow({check:"greater_than",...ke(t),value:e,inclusive:!1})}function im(e,t){return new Ow({check:"greater_than",...ke(t),value:e,inclusive:!0})}function Ib(e,t){return new _O({check:"multiple_of",...ke(t),value:e})}function Uw(e,t){return new RO({check:"max_length",...ke(t),maximum:e})}function Mu(e,t){return new AO({check:"min_length",...ke(t),minimum:e})}function Iw(e,t){return new TO({check:"length_equals",...ke(t),length:e})}function mL(e,t){return new OO({check:"string_format",format:"regex",...ke(t),pattern:e})}function pL(e){return new DO({check:"string_format",format:"lowercase",...ke(e)})}function gL(e){return new LO({check:"string_format",format:"uppercase",...ke(e)})}function yL(e,t){return new MO({check:"string_format",format:"includes",...ke(t),includes:e})}function vL(e,t){return new $O({check:"string_format",format:"starts_with",...ke(t),prefix:e})}function xL(e,t){return new PO({check:"string_format",format:"ends_with",...ke(t),suffix:e})}function Hr(e){return new UO({check:"overwrite",tx:e})}function bL(e){return Hr(t=>t.normalize(e))}function SL(){return Hr(e=>e.trim())}function jL(){return Hr(e=>e.toLowerCase())}function wL(){return Hr(e=>e.toUpperCase())}function NL(){return Hr(e=>OT(e))}function CL(e,t,n){return new e({type:"array",element:t,...ke(n)})}function kL(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ke(n)})}function zL(e){const t=_L(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(ul(a,n.value,t._zod.def));else{const o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(ul(o))}},e(n.value,n)));return t}function _L(e,t){const n=new kn({check:"custom",...ke(t)});return n._zod.check=e,n}function Bw(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Yo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ht(e,t,n={path:[],schemaPath:[]}){var a;const o=e._zod.def,c=t.seen.get(e);if(c)return c.count++,n.schemaPath.includes(e)&&(c.cycle=n.path),c.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const v={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,v);else{const x=u.schema,b=t.processors[o.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);b(e,t,x,v)}const y=e._zod.parent;y&&(u.ref||(u.ref=y),Ht(y,t,v),t.seen.get(y).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&dn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((a=u.schema).default??(a.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function qw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const m=a.get(f);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,u[0])}}const o=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(u[0])?.id,x=e.external.uri??(N=>N);if(y)return{ref:x(y)};const b=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=b,{defId:b,ref:`${x("__shared")}#/${f}/${b}`}}if(u[1]===n)return{ref:"#"};const p=`#/${f}/`,v=u[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:p+v}},c=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:m,defId:p}=o(u);f.def={...f.schema},p&&(f.defId=p);const v=f.schema;for(const y in v)delete v[y];v.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
93
|
-
|
|
94
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(t===u[0]){c(u);continue}if(e.external){const p=e.external.registry.get(u[0])?.id;if(t!==u[0]&&p){c(u);continue}}if(e.metadataRegistry.get(u[0])?.id){c(u);continue}if(f.cycle){c(u);continue}if(f.count>1&&e.reused==="ref"){c(u);continue}}}function Kw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,p={...m},v=f.ref;if(f.ref=null,v){a(v);const x=e.seen.get(v),b=x.schema;if(b.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(b)):Object.assign(m,b),Object.assign(m,p),u._zod.parent===v)for(const S in m)S==="$ref"||S==="allOf"||S in p||delete m[S];if(b.$ref&&x.def)for(const S in m)S==="$ref"||S==="allOf"||S in x.def&&JSON.stringify(m[S])===JSON.stringify(x.def[S])&&delete m[S]}const y=u._zod.parent;if(y&&y!==v){a(y);const x=e.seen.get(y);if(x?.schema.$ref&&(m.$ref=x.schema.$ref,x.def))for(const b in m)b==="$ref"||b==="allOf"||b in x.def&&JSON.stringify(m[b])===JSON.stringify(x.def[b])&&delete m[b]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())a(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const c=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(c[f.defId]=f.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:$u(t,"input",e.processors),output:$u(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return dn(a.element,n);if(a.type==="set")return dn(a.valueType,n);if(a.type==="lazy")return dn(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return dn(a.innerType,n);if(a.type==="intersection")return dn(a.left,n)||dn(a.right,n);if(a.type==="record"||a.type==="map")return dn(a.keyType,n)||dn(a.valueType,n);if(a.type==="pipe")return dn(a.in,n)||dn(a.out,n);if(a.type==="object"){for(const o in a.shape)if(dn(a.shape[o],n))return!0;return!1}if(a.type==="union"){for(const o of a.options)if(dn(o,n))return!0;return!1}if(a.type==="tuple"){for(const o of a.items)if(dn(o,n))return!0;return!!(a.rest&&dn(a.rest,n))}return!1}const EL=(e,t={})=>n=>{const a=Bw({...n,processors:t});return Ht(e,a),qw(a,e),Kw(a,e)},$u=(e,t,n={})=>a=>{const{libraryOptions:o,target:c}=a??{},u=Bw({...o??{},target:c,io:t,processors:n});return Ht(e,u),qw(u,e),Kw(u,e)},RL={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},AL=(e,t,n,a)=>{const o=n;o.type="string";const{minimum:c,maximum:u,format:f,patterns:m,contentEncoding:p}=e._zod.bag;if(typeof c=="number"&&(o.minLength=c),typeof u=="number"&&(o.maxLength=u),f&&(o.format=RL[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),m&&m.size>0){const v=[...m];v.length===1?o.pattern=v[0].source:v.length>1&&(o.allOf=[...v.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},TL=(e,t,n,a)=>{const o=n,{minimum:c,maximum:u,format:f,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:v}=e._zod.bag;typeof f=="string"&&f.includes("int")?o.type="integer":o.type="number",typeof v=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=v,o.exclusiveMinimum=!0):o.exclusiveMinimum=v),typeof c=="number"&&(o.minimum=c,typeof v=="number"&&t.target!=="draft-04"&&(v>=c?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof u=="number"&&(o.maximum=u,typeof p=="number"&&t.target!=="draft-04"&&(p<=u?delete o.maximum:delete o.exclusiveMaximum)),typeof m=="number"&&(o.multipleOf=m)},OL=(e,t,n,a)=>{n.type="boolean"},DL=(e,t,n,a)=>{n.not={}},LL=(e,t,n,a)=>{},ML=(e,t,n,a)=>{const o=e._zod.def,c=Sw(o.entries);c.every(u=>typeof u=="number")&&(n.type="number"),c.every(u=>typeof u=="string")&&(n.type="string"),n.enum=c},$L=(e,t,n,a)=>{const o=e._zod.def,c=[];for(const u of o.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");c.push(Number(u))}else c.push(u);if(c.length!==0)if(c.length===1){const u=c[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else c.every(u=>typeof u=="number")&&(n.type="number"),c.every(u=>typeof u=="string")&&(n.type="string"),c.every(u=>typeof u=="boolean")&&(n.type="boolean"),c.every(u=>u===null)&&(n.type="null"),n.enum=c},PL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},UL=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},IL=(e,t,n,a)=>{const o=n,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=Ht(c.element,t,{...a,path:[...a.path,"items"]})},BL=(e,t,n,a)=>{const o=n,c=e._zod.def;o.type="object",o.properties={};const u=c.shape;for(const p in u)o.properties[p]=Ht(u[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(p=>{const v=c.shape[p]._zod;return t.io==="input"?v.optin===void 0:v.optout===void 0}));m.size>0&&(o.required=Array.from(m)),c.catchall?._zod.def.type==="never"?o.additionalProperties=!1:c.catchall?c.catchall&&(o.additionalProperties=Ht(c.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},qL=(e,t,n,a)=>{const o=e._zod.def,c=o.inclusive===!1,u=o.options.map((f,m)=>Ht(f,t,{...a,path:[...a.path,c?"oneOf":"anyOf",m]}));c?n.oneOf=u:n.anyOf=u},KL=(e,t,n,a)=>{const o=e._zod.def,c=Ht(o.left,t,{...a,path:[...a.path,"allOf",0]}),u=Ht(o.right,t,{...a,path:[...a.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,m=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];n.allOf=m},HL=(e,t,n,a)=>{const o=n,c=e._zod.def;o.type="object";const u=c.keyType,m=u._zod.bag?.patterns;if(c.mode==="loose"&&m&&m.size>0){const v=Ht(c.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});o.patternProperties={};for(const y of m)o.patternProperties[y.source]=v}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ht(c.keyType,t,{...a,path:[...a.path,"propertyNames"]})),o.additionalProperties=Ht(c.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const p=u._zod.values;if(p){const v=[...p].filter(y=>typeof y=="string"||typeof y=="number");v.length>0&&(o.required=v)}},GL=(e,t,n,a)=>{const o=e._zod.def,c=Ht(o.innerType,t,a),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,n.nullable=!0):n.anyOf=[c,{type:"null"}]},FL=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType},ZL=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},VL=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},QL=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},YL=(e,t,n,a)=>{const o=e._zod.def,c=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ht(c,t,a);const u=t.seen.get(e);u.ref=c},JL=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,n.readOnly=!0},Hw=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType},XL=ne("ZodISODateTime",(e,t)=>{WO.init(e,t),_t.init(e,t)});function WL(e){return aL(XL,e)}const e5=ne("ZodISODate",(e,t)=>{eD.init(e,t),_t.init(e,t)});function t5(e){return rL(e5,e)}const n5=ne("ZodISOTime",(e,t)=>{tD.init(e,t),_t.init(e,t)});function s5(e){return oL(n5,e)}const i5=ne("ZodISODuration",(e,t)=>{nD.init(e,t),_t.init(e,t)});function a5(e){return lL(i5,e)}const r5=(e,t)=>{Cw.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>FT(e,n)},flatten:{value:n=>GT(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Pm,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Pm,2)}},isEmpty:{get(){return e.issues.length===0}}})},ts=ne("ZodError",r5,{Parent:Error}),o5=Ip(ts),l5=Bp(ts),c5=sd(ts),u5=id(ts),d5=QT(ts),f5=YT(ts),h5=JT(ts),m5=XT(ts),p5=WT(ts),g5=eO(ts),y5=tO(ts),v5=nO(ts),zt=ne("ZodType",(e,t)=>(kt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:$u(e,"input"),output:$u(e,"output")}}),e.toJSONSchema=EL(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ki(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>Hi(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>o5(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>c5(e,n,a),e.parseAsync=async(n,a)=>l5(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>u5(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>d5(e,n,a),e.decode=(n,a)=>f5(e,n,a),e.encodeAsync=async(n,a)=>h5(e,n,a),e.decodeAsync=async(n,a)=>m5(e,n,a),e.safeEncode=(n,a)=>p5(e,n,a),e.safeDecode=(n,a)=>g5(e,n,a),e.safeEncodeAsync=async(n,a)=>y5(e,n,a),e.safeDecodeAsync=async(n,a)=>v5(e,n,a),e.refine=(n,a)=>e.check(fM(n,a)),e.superRefine=n=>e.check(hM(n)),e.overwrite=n=>e.check(Hr(n)),e.optional=()=>Kb(e),e.exactOptional=()=>W5(e),e.nullable=()=>Hb(e),e.nullish=()=>Kb(Hb(e)),e.nonoptional=n=>aM(e,n),e.array=()=>be(e),e.or=n=>G5([e,n]),e.and=n=>Z5(e,n),e.transform=n=>Gb(e,J5(n)),e.default=n=>nM(e,n),e.prefault=n=>iM(e,n),e.catch=n=>oM(e,n),e.pipe=n=>Gb(e,n),e.readonly=()=>uM(e),e.describe=n=>{const a=e.clone();return Yo.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){return Yo.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Yo.get(e);const a=e.clone();return Yo.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Gw=ne("_ZodString",(e,t)=>{qp.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,c)=>AL(e,a,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(mL(...a)),e.includes=(...a)=>e.check(yL(...a)),e.startsWith=(...a)=>e.check(vL(...a)),e.endsWith=(...a)=>e.check(xL(...a)),e.min=(...a)=>e.check(Mu(...a)),e.max=(...a)=>e.check(Uw(...a)),e.length=(...a)=>e.check(Iw(...a)),e.nonempty=(...a)=>e.check(Mu(1,...a)),e.lowercase=a=>e.check(pL(a)),e.uppercase=a=>e.check(gL(a)),e.trim=()=>e.check(SL()),e.normalize=(...a)=>e.check(bL(...a)),e.toLowerCase=()=>e.check(jL()),e.toUpperCase=()=>e.check(wL()),e.slugify=()=>e.check(NL())}),x5=ne("ZodString",(e,t)=>{qp.init(e,t),Gw.init(e,t),e.email=n=>e.check(PD(b5,n)),e.url=n=>e.check(KD(S5,n)),e.jwt=n=>e.check(iL(M5,n)),e.emoji=n=>e.check(HD(j5,n)),e.guid=n=>e.check($b(Bb,n)),e.uuid=n=>e.check(UD(eu,n)),e.uuidv4=n=>e.check(ID(eu,n)),e.uuidv6=n=>e.check(BD(eu,n)),e.uuidv7=n=>e.check(qD(eu,n)),e.nanoid=n=>e.check(GD(w5,n)),e.guid=n=>e.check($b(Bb,n)),e.cuid=n=>e.check(FD(N5,n)),e.cuid2=n=>e.check(ZD(C5,n)),e.ulid=n=>e.check(VD(k5,n)),e.base64=n=>e.check(tL(O5,n)),e.base64url=n=>e.check(nL(D5,n)),e.xid=n=>e.check(QD(z5,n)),e.ksuid=n=>e.check(YD(_5,n)),e.ipv4=n=>e.check(JD(E5,n)),e.ipv6=n=>e.check(XD(R5,n)),e.cidrv4=n=>e.check(WD(A5,n)),e.cidrv6=n=>e.check(eL(T5,n)),e.e164=n=>e.check(sL(L5,n)),e.datetime=n=>e.check(WL(n)),e.date=n=>e.check(t5(n)),e.time=n=>e.check(s5(n)),e.duration=n=>e.check(a5(n))});function D(e){return $D(x5,e)}const _t=ne("ZodStringFormat",(e,t)=>{wt.init(e,t),Gw.init(e,t)}),b5=ne("ZodEmail",(e,t)=>{HO.init(e,t),_t.init(e,t)}),Bb=ne("ZodGUID",(e,t)=>{qO.init(e,t),_t.init(e,t)}),eu=ne("ZodUUID",(e,t)=>{KO.init(e,t),_t.init(e,t)}),S5=ne("ZodURL",(e,t)=>{GO.init(e,t),_t.init(e,t)}),j5=ne("ZodEmoji",(e,t)=>{FO.init(e,t),_t.init(e,t)}),w5=ne("ZodNanoID",(e,t)=>{ZO.init(e,t),_t.init(e,t)}),N5=ne("ZodCUID",(e,t)=>{VO.init(e,t),_t.init(e,t)}),C5=ne("ZodCUID2",(e,t)=>{QO.init(e,t),_t.init(e,t)}),k5=ne("ZodULID",(e,t)=>{YO.init(e,t),_t.init(e,t)}),z5=ne("ZodXID",(e,t)=>{JO.init(e,t),_t.init(e,t)}),_5=ne("ZodKSUID",(e,t)=>{XO.init(e,t),_t.init(e,t)}),E5=ne("ZodIPv4",(e,t)=>{sD.init(e,t),_t.init(e,t)}),R5=ne("ZodIPv6",(e,t)=>{iD.init(e,t),_t.init(e,t)}),A5=ne("ZodCIDRv4",(e,t)=>{aD.init(e,t),_t.init(e,t)}),T5=ne("ZodCIDRv6",(e,t)=>{rD.init(e,t),_t.init(e,t)}),O5=ne("ZodBase64",(e,t)=>{oD.init(e,t),_t.init(e,t)}),D5=ne("ZodBase64URL",(e,t)=>{cD.init(e,t),_t.init(e,t)}),L5=ne("ZodE164",(e,t)=>{uD.init(e,t),_t.init(e,t)}),M5=ne("ZodJWT",(e,t)=>{fD.init(e,t),_t.init(e,t)}),Fw=ne("ZodNumber",(e,t)=>{Lw.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,c)=>TL(e,a,o),e.gt=(a,o)=>e.check(Ub(a,o)),e.gte=(a,o)=>e.check(im(a,o)),e.min=(a,o)=>e.check(im(a,o)),e.lt=(a,o)=>e.check(Pb(a,o)),e.lte=(a,o)=>e.check(sm(a,o)),e.max=(a,o)=>e.check(sm(a,o)),e.int=a=>e.check(qb(a)),e.safe=a=>e.check(qb(a)),e.positive=a=>e.check(Ub(0,a)),e.nonnegative=a=>e.check(im(0,a)),e.negative=a=>e.check(Pb(0,a)),e.nonpositive=a=>e.check(sm(0,a)),e.multipleOf=(a,o)=>e.check(Ib(a,o)),e.step=(a,o)=>e.check(Ib(a,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ee(e){return cL(Fw,e)}const $5=ne("ZodNumberFormat",(e,t)=>{hD.init(e,t),Fw.init(e,t)});function qb(e){return uL($5,e)}const P5=ne("ZodBoolean",(e,t)=>{mD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>OL(e,n,a)});function Tt(e){return dL(P5,e)}const U5=ne("ZodUnknown",(e,t)=>{pD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>LL()});function Pu(){return fL(U5)}const I5=ne("ZodNever",(e,t)=>{gD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>DL(e,n,a)});function B5(e){return hL(I5,e)}const q5=ne("ZodArray",(e,t)=>{yD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>IL(e,n,a,o),e.element=t.element,e.min=(n,a)=>e.check(Mu(n,a)),e.nonempty=n=>e.check(Mu(1,n)),e.max=(n,a)=>e.check(Uw(n,a)),e.length=(n,a)=>e.check(Iw(n,a)),e.unwrap=()=>e.element});function be(e,t){return CL(q5,e,t)}const K5=ne("ZodObject",(e,t)=>{xD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>BL(e,n,a,o),ct(e,"shape",()=>t.shape),e.keyof=()=>Ct(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Pu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Pu()}),e.strict=()=>e.clone({...e._zod.def,catchall:B5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>IT(e,n),e.safeExtend=n=>BT(e,n),e.merge=n=>qT(e,n),e.pick=n=>PT(e,n),e.omit=n=>UT(e,n),e.partial=(...n)=>KT(Zw,e,n[0]),e.required=(...n)=>HT(Vw,e,n[0])});function ve(e,t){const n={type:"object",shape:e??{},...ke(t)};return new K5(n)}const H5=ne("ZodUnion",(e,t)=>{bD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>qL(e,n,a,o),e.options=t.options});function G5(e,t){return new H5({type:"union",options:e,...ke(t)})}const F5=ne("ZodIntersection",(e,t)=>{SD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>KL(e,n,a,o)});function Z5(e,t){return new F5({type:"intersection",left:e,right:t})}const V5=ne("ZodRecord",(e,t)=>{jD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>HL(e,n,a,o),e.keyType=t.keyType,e.valueType=t.valueType});function gl(e,t,n){return new V5({type:"record",keyType:e,valueType:t,...ke(n)})}const Im=ne("ZodEnum",(e,t)=>{wD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(a,o,c)=>ML(e,a,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,o)=>{const c={};for(const u of a)if(n.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Im({...t,checks:[],...ke(o),entries:c})},e.exclude=(a,o)=>{const c={...t.entries};for(const u of a)if(n.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new Im({...t,checks:[],...ke(o),entries:c})}});function Ct(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Im({type:"enum",entries:n,...ke(t)})}const Q5=ne("ZodLiteral",(e,t)=>{ND.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>$L(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function dl(e,t){return new Q5({type:"literal",values:Array.isArray(e)?e:[e],...ke(t)})}const Y5=ne("ZodTransform",(e,t)=>{CD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>UL(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new xw(e.constructor.name);n.addIssue=c=>{if(typeof c=="string")n.issues.push(ul(c,n.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(ul(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(c=>(n.value=c,n)):(n.value=o,n)}});function J5(e){return new Y5({type:"transform",transform:e})}const Zw=ne("ZodOptional",(e,t)=>{Pw.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Hw(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function Kb(e){return new Zw({type:"optional",innerType:e})}const X5=ne("ZodExactOptional",(e,t)=>{kD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Hw(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function W5(e){return new X5({type:"optional",innerType:e})}const eM=ne("ZodNullable",(e,t)=>{zD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>GL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function Hb(e){return new eM({type:"nullable",innerType:e})}const tM=ne("ZodDefault",(e,t)=>{_D.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>ZL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nM(e,t){return new tM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ww(t)}})}const sM=ne("ZodPrefault",(e,t)=>{ED.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>VL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function iM(e,t){return new sM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ww(t)}})}const Vw=ne("ZodNonOptional",(e,t)=>{RD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>FL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function aM(e,t){return new Vw({type:"nonoptional",innerType:e,...ke(t)})}const rM=ne("ZodCatch",(e,t)=>{AD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>QL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function oM(e,t){return new rM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lM=ne("ZodPipe",(e,t)=>{TD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>YL(e,n,a,o),e.in=t.in,e.out=t.out});function Gb(e,t){return new lM({type:"pipe",in:e,out:t})}const cM=ne("ZodReadonly",(e,t)=>{OD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>JL(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function uM(e){return new cM({type:"readonly",innerType:e})}const dM=ne("ZodCustom",(e,t)=>{DD.init(e,t),zt.init(e,t),e._zod.processJSONSchema=(n,a,o)=>PL(e,n)});function fM(e,t={}){return kL(dM,e,t)}function hM(e){return zL(e)}ve({maxConcurrency:Ee().int().positive(),maxRequestsPerMinute:Ee().int().positive(),maxRequestsPerDay:Ee().int().positive()});const Gr=D().min(1);D().min(1);const Kp=ve({label:D().min(1),city:D().min(1),region:D().min(1),country:D().length(2),timezone:D().optional()}),Qw=Ct(["citation.lost","citation.gained","run.completed","run.failed"]);ve({id:D(),projectId:D(),channel:dl("webhook"),url:D().url(),urlDisplay:D(),urlHost:D(),events:be(Qw),enabled:Tt().default(!0),webhookSecret:D().optional(),createdAt:D(),updatedAt:D()});const Yw=Ct(["cli","api","config-file"]);function mM(e){const t=new Set,n=new Set;for(const a of e){if(t.has(a.label)){n.add(a.label);continue}t.add(a.label)}return[...n]}function pM(e,t){return t?e.some(n=>n.label===t):!0}ve({displayName:D().min(1),canonicalDomain:D().min(1),ownedDomains:be(D().min(1)).optional(),country:D().length(2),language:D().min(2),tags:be(D()).optional(),labels:gl(D(),D()).optional(),providers:be(Gr).optional(),locations:be(Kp).optional(),defaultLocation:D().nullable().optional(),configSource:Yw.optional()});ve({id:D(),name:D(),displayName:D().optional(),canonicalDomain:D(),ownedDomains:be(D()).default([]),country:D().length(2),language:D().min(2),tags:be(D()).default([]),labels:gl(D(),D()).default({}),locations:be(Kp).default([]),defaultLocation:D().nullable().optional(),configSource:Yw.default("cli"),configRevision:Ee().int().positive().default(1),createdAt:D().optional(),updatedAt:D().optional()});function Bm(e){let t=e.trim().toLowerCase();try{t.includes("://")&&(t=new URL(t).hostname.toLowerCase())}catch{}return t.replace(/^www\./,"")}function gM(e){const t=[e.canonicalDomain,...e.ownedDomains??[]],n=new Set,a=[];for(const o of t){const c=o.trim();if(!c)continue;const u=Bm(c);n.has(u)||(n.add(u),a.push(c))}return a}const yM=ve({name:D().min(1).max(63).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,{message:"Name must be a lowercase slug (letters, numbers, hyphens)"}),labels:gl(D(),D()).optional().default({})}),vM=ve({preset:D().optional(),cron:D().optional(),timezone:D().optional().default("UTC"),providers:be(Gr).optional().default([])}).refine(e=>e.preset&&!e.cron||!e.preset&&e.cron,{message:'Exactly one of "preset" or "cron" must be provided'}).optional(),xM=ve({channel:dl("webhook"),url:D().url(),events:be(Qw).min(1)}),bM=ve({gsc:ve({propertyUrl:D()}).optional(),syncSchedule:ve({preset:D().optional(),cron:D().optional()}).optional()}).optional(),SM=ve({displayName:D().min(1),canonicalDomain:D().min(1),ownedDomains:be(D().min(1)).optional().default([]),country:D().length(2),language:D().min(2),keywords:be(D().min(1)).optional().default([]),competitors:be(D().min(1)).optional().default([]),providers:be(Gr).optional().default([]),locations:be(Kp).optional().default([]),defaultLocation:D().optional(),schedule:vM,notifications:be(xM).optional().default([]),google:bM}).superRefine((e,t)=>{const n=mM(e.locations);n.length>0&&t.addIssue({code:"custom",message:`Duplicate location labels are not allowed: ${n.join(", ")}`,path:["locations"]}),pM(e.locations,e.defaultLocation)||t.addIssue({code:"custom",message:`defaultLocation "${e.defaultLocation}" must match a configured location label`,path:["defaultLocation"]})});ve({apiVersion:dl("canonry/v1"),kind:dl("Project"),metadata:yM,spec:SM});const jM=Ct(["gsc","ga4"]);ve({id:D(),domain:D(),connectionType:jM,propertyId:D().nullable().optional(),sitemapUrl:D().nullable().optional(),scopes:be(D()).default([]),createdAt:D(),updatedAt:D()});ve({date:D(),query:D(),page:D(),country:D().nullable().optional(),device:D().nullable().optional(),clicks:Ee(),impressions:Ee(),ctr:Ee(),position:Ee()});const qm=ve({id:D(),url:D(),indexingState:D().nullable().optional(),verdict:D().nullable().optional(),coverageState:D().nullable().optional(),pageFetchState:D().nullable().optional(),robotsTxtState:D().nullable().optional(),crawlTime:D().nullable().optional(),lastCrawlResult:D().nullable().optional(),isMobileFriendly:Tt().nullable().optional(),richResults:be(D()).default([]),inspectedAt:D()});Ct(["stable","reindexed","deindexed","still-missing","new"]);const wM=ve({url:D(),previousState:D().nullable(),currentState:D().nullable(),transitionDate:D()}),NM=ve({reason:D(),count:Ee(),urls:be(qm).default([])});ve({summary:ve({total:Ee(),indexed:Ee(),notIndexed:Ee(),deindexed:Ee(),percentage:Ee()}),lastInspectedAt:D().nullable(),indexed:be(qm).default([]),notIndexed:be(qm).default([]),deindexed:be(wM).default([]),reasonGroups:be(NM).default([])});ve({url:D(),type:Ct(["URL_UPDATED","URL_DELETED"]),notifiedAt:D()});ve({url:D(),type:Ct(["URL_UPDATED","URL_DELETED"]),notifiedAt:D(),status:Ct(["success","error"]),error:D().optional()});ve({date:D(),indexed:Ee(),notIndexed:Ee(),reasonBreakdown:gl(D(),Ee()).default({})});ve({id:D(),domain:D(),siteUrl:D().nullable().optional(),createdAt:D(),updatedAt:D()});const am=ve({id:D(),url:D(),httpCode:Ee().nullable().optional(),inIndex:Tt().nullable().optional(),lastCrawledDate:D().nullable().optional(),inIndexDate:D().nullable().optional(),inspectedAt:D(),documentSize:Ee().nullable().optional(),anchorCount:Ee().nullable().optional(),discoveryDate:D().nullable().optional()});ve({summary:ve({total:Ee(),indexed:Ee(),notIndexed:Ee(),unknown:Ee().optional(),percentage:Ee()}),lastInspectedAt:D().nullable(),indexed:be(am).default([]),notIndexed:be(am).default([]),unknown:be(am).default([]).optional()});ve({query:D(),impressions:Ee(),clicks:Ee(),ctr:Ee(),averagePosition:Ee()});ve({url:D(),status:Ct(["success","error"]),submittedAt:D(),error:D().optional()});const Fr=Ct(["live","staging"]);ve({projectName:D(),url:D(),stagingUrl:D().optional(),username:D(),defaultEnv:Fr,createdAt:D(),updatedAt:D()});const Fb=ve({url:D(),reachable:Tt(),pageCount:Ee().nullable().optional(),version:D().nullable().optional(),error:D().nullable().optional(),plugins:be(D()).optional(),authenticatedUser:ve({id:Ee(),slug:D()}).nullable().optional()});ve({connected:Tt(),projectName:D(),defaultEnv:Fr,live:Fb.nullable(),staging:Fb.nullable(),adminUrl:D().nullable().optional()});const CM=ve({id:Ee(),slug:D(),title:D(),status:D(),modifiedAt:D().nullable().optional(),link:D().nullable().optional()}),Jw=ve({title:D().nullable(),description:D().nullable(),noindex:Tt().nullable(),writable:Tt().default(!1),writeTargets:be(D()).default([])}),kM=ve({type:D(),json:gl(D(),Pu())}),zM=CM.extend({env:Fr,content:D(),seo:Jw,schemaBlocks:be(kM).default([])}),Zb=zM.extend({contentHash:D(),contentSnippet:D()}),Xw=ve({manualRequired:dl(!0),targetUrl:D(),adminUrl:D().nullable().optional(),content:D(),nextSteps:be(D()).default([])}),_M=ve({slug:D(),severity:Ct(["high","medium","low"]),code:Ct(["noindex","missing-seo-title","missing-meta-description","missing-schema","thin-content"]),message:D()});ve({slug:D(),title:D(),status:D(),wordCount:Ee(),seo:Jw,schemaPresent:Tt(),issues:be(_M).default([])});const EM=ve({slug:D(),status:Ct(["applied","skipped","manual"]),error:D().optional(),manualAssist:Xw.optional()});ve({env:Fr,strategy:Ct(["plugin","manual"]),results:be(EM)});const RM=ve({slug:D(),status:Ct(["deployed","stripped","skipped","failed"]),schemasInjected:be(D()).optional(),manualAssist:Xw.optional(),error:D().optional()});ve({env:Fr,results:be(RM)});const AM=ve({slug:D(),title:D(),canonrySchemas:be(D()),thirdPartySchemas:be(D()),hasCanonrySchema:Tt()});ve({env:Fr,pages:be(AM)});const TM=ve({name:D(),status:Ct(["completed","skipped","failed"]),summary:D().optional(),error:D().optional()});ve({projectName:D(),steps:be(TM)});ve({slug:D(),live:Zb,staging:Zb,hasDifferences:Tt(),differences:ve({title:Tt(),slug:Tt(),content:Tt(),seoTitle:Tt(),seoDescription:Tt(),noindex:Tt(),schema:Tt()})});const OM=Ct(["queued","running","completed","partial","failed","cancelled"]),DM=Ct(["answer-visibility","site-audit","gsc-sync","inspect-sitemap"]),LM=Ct(["manual","scheduled","config-apply"]),MM=Ct(["cited","not-cited"]),$M=Ct(["new","cited","lost","emerging","not-cited"]);ve({id:D(),projectId:D(),kind:DM,status:OM,trigger:LM.default("manual"),location:D().nullable().optional(),startedAt:D().nullable().optional(),finishedAt:D().nullable().optional(),error:D().nullable().optional(),createdAt:D()});const Ww=ve({uri:D(),title:D()});ve({id:D(),runId:D(),keywordId:D(),keyword:D().optional(),provider:Gr,citationState:MM,transition:$M.optional(),answerText:D().nullable().optional(),citedDomains:be(D()).default([]),competitorOverlap:be(D()).default([]),recommendedCompetitors:be(D()).default([]),groundingSources:be(Ww).default([]),searchQueries:be(D()).default([]),model:D().nullable().optional(),location:D().nullable().optional(),createdAt:D()});ve({id:D(),projectId:D().nullable().optional(),actor:D(),action:D(),entityType:D(),entityId:D().nullable().optional(),diff:Pu().optional(),createdAt:D()});const PM=Ct(["yes","no","unknown","not-mentioned"]);ve({companyName:D().min(1),domain:D().min(1),phrases:be(D().min(1)).optional().default([]),competitors:be(D().min(1)).optional().default([])});const UM=ve({name:D(),count:Ee().int().nonnegative()}),IM=ve({id:D(),name:D(),weight:Ee(),score:Ee(),grade:D(),status:Ct(["pass","partial","fail"]),findings:be(ve({type:D(),message:D()})).default([]),recommendations:be(D()).default([])}),BM=ve({url:D(),finalUrl:D(),auditedAt:D(),overallScore:Ee(),overallGrade:D(),summary:D(),factors:be(IM).default([])}),qM=ve({industry:D(),summary:D(),services:be(D()).default([]),categoryTerms:be(D()).default([])}),KM=ve({provider:D(),displayName:D(),model:D().nullable().optional(),mentioned:Tt(),cited:Tt(),describedAccurately:PM,accuracyNotes:D().nullable().optional(),incorrectClaims:be(D()).default([]),recommendedCompetitors:be(D()).default([]),citedDomains:be(D()).default([]),groundingSources:be(Ww).default([]),searchQueries:be(D()).default([]),answerText:D(),error:D().nullable().optional()}),HM=ve({phrase:D(),providerResults:be(KM).default([])}),GM=ve({totalQueries:Ee().int().nonnegative(),totalProviders:Ee().int().nonnegative(),totalComparisons:Ee().int().nonnegative(),mentionCount:Ee().int().nonnegative(),citationCount:Ee().int().nonnegative(),topCompetitors:be(UM).default([]),visibilityGap:D(),whatThisMeans:be(D()).default([]),recommendedActions:be(D()).default([])});ve({companyName:D(),domain:D(),homepageUrl:D(),generatedAt:D(),phrases:be(D()).default([]),competitors:be(D()).default([]),profile:qM,audit:BM,queryResults:be(HM).default([]),summary:GM});ve({id:D(),projectId:D(),cronExpr:D(),preset:D().nullable().optional(),timezone:D().default("UTC"),enabled:Tt().default(!0),providers:be(Gr).default([]),lastRunAt:D().nullable().optional(),nextRunAt:D().nullable().optional(),createdAt:D(),updatedAt:D()});ve({preset:D().optional(),cron:D().optional(),timezone:D().optional().default("UTC"),enabled:Tt().optional().default(!0),providers:be(Gr).optional().default([])}).refine(e=>e.preset&&!e.cron||!e.preset&&e.cron,{message:'Exactly one of "preset" or "cron" must be provided'});ve({id:D(),projectId:D(),propertyId:D(),clientEmail:D(),connected:Tt(),createdAt:D(),updatedAt:D()});ve({date:D(),landingPage:D(),sessions:Ee(),organicSessions:Ee(),users:Ee()});const FM=ve({source:D(),medium:D(),sessions:Ee(),users:Ee()});ve({totalSessions:Ee(),totalOrganicSessions:Ee(),totalUsers:Ee(),topPages:be(ve({landingPage:D(),sessions:Ee(),organicSessions:Ee(),users:Ee()})),aiReferrals:be(FM),lastSyncedAt:D().nullable()});function Km({state:e}){return r.jsx(lt,{tone:GR(e),children:Yu(e)})}function Nn({text:e}){return r.jsxs("span",{className:"info-tooltip-wrapper",children:[r.jsxs("svg",{className:"info-tooltip-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 7v4M8 5.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),r.jsx("span",{className:"info-tooltip-bubble",role:"tooltip",children:e})]})}function Vb(e,t){const n=t.filter(u=>u.trim().length>1),a=e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(u=>u.startsWith("**")&&u.endsWith("**")?{type:"bold",value:u.slice(2,-2)}:{type:"text",value:u});if(n.length===0)return a.map((u,f)=>u.type==="bold"?us.createElement("strong",{key:`b-${f}`,className:"text-zinc-200 font-semibold"},u.value):u.value).filter(Boolean);const o=n.map(u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),c=new RegExp(`(${o.join("|")})`,"gi");return a.flatMap((u,f)=>u.value.split(c).map((p,v)=>p?v%2===1?u.type==="bold"?us.createElement("mark",{key:`hl-${f}-${v}`,className:"answer-highlight"},us.createElement("strong",{className:"text-zinc-200 font-semibold"},p)):us.createElement("mark",{key:`hl-${f}-${v}`,className:"answer-highlight"},p):u.type==="bold"?us.createElement("strong",{key:`b-${f}-${v}`,className:"text-zinc-200 font-semibold"},p):p:null)).filter(Boolean)}function ZM({evidence:e,project:t,onClose:n}){const[a,o]=w.useState(!1),[c,u]=w.useState("citations"),[f,m]=w.useState(-1),[p,v]=w.useState(null),[y,x]=w.useState(!1),[b,N]=w.useState({}),S=gM(t.project),C=new Set(S.map(Bm)),k=e.runHistory,A=k.length>1,[R,z]=w.useState(null),$=w.useRef(!1);w.useEffect(()=>{if($.current||e.answerSnippet)return;const L=k.at(-1);L&&($.current=!0,Ur(L.runId).then(J=>{const X=J.snapshots.find(Y=>Y.keyword===e.keyword&&Y.provider===e.provider);X?.answerText&&z({citationState:e.citationState,provider:e.provider,model:X.model??e.model,answerSnippet:X.answerText,citedDomains:X.citedDomains??e.citedDomains,competitorDomains:X.competitorOverlap??e.competitorDomains,recommendedCompetitors:X.recommendedCompetitors??e.recommendedCompetitors??[],groundingSources:X.groundingSources??e.groundingSources,evidenceUrls:[],changeLabel:e.changeLabel,summary:e.summary})}).catch(()=>{}))},[e,k]);const P=f>=0&&p!==null,E=P?p:R||{citationState:e.citationState,provider:e.provider,model:e.model,answerSnippet:e.answerSnippet,citedDomains:e.citedDomains,competitorDomains:e.competitorDomains,recommendedCompetitors:e.recommendedCompetitors??[],groundingSources:e.groundingSources,evidenceUrls:e.evidenceUrls,changeLabel:e.changeLabel,summary:e.summary},O=E.citationState==="cited"||E.citationState==="emerging",ee=E.citedDomains.findIndex(L=>C.has(L.toLowerCase().replace(/^www\./,"")))+1,V=E.citedDomains.length,se=t.project.displayName||t.project.name,ue=[...S.map(Bm),se,se.split(" ").slice(0,2).join(" ")].filter(L=>L.trim().length>2),_e=O?"cited":E.citationState==="lost"?"lost":E.citationState==="pending"?"pending":"not-cited",xe=w.useRef(0),K=w.useCallback(async L=>{const J=++xe.current;if(L===-1||L===k.length-1){m(-1),v(null),o(!1);return}m(L),o(!1);const X=k[L],Y=`${X.runId}::${e.keyword}::${e.provider}`;if(b[Y]){v(b[Y]);return}x(!0);try{const he=await Ur(X.runId);if(J!==xe.current)return;const ge=he.snapshots.find(me=>me.keyword===e.keyword&&me.provider===e.provider)??he.snapshots.find(me=>me.keyword===e.keyword),we=ge?{citationState:ge.citationState,provider:ge.provider,model:ge.model??null,answerSnippet:ge.answerText??"",citedDomains:ge.citedDomains,competitorDomains:ge.competitorOverlap,recommendedCompetitors:ge.recommendedCompetitors??[],groundingSources:ge.groundingSources,evidenceUrls:[],changeLabel:X.citationState,summary:""}:{citationState:X.citationState,provider:e.provider,model:X.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],groundingSources:[],evidenceUrls:[],changeLabel:X.citationState,summary:"Snapshot data not available for this run."};N(me=>({...me,[Y]:we})),v(we)}catch{if(J!==xe.current)return;v({citationState:X.citationState,provider:e.provider,model:X.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],groundingSources:[],evidenceUrls:[],changeLabel:X.citationState,summary:"Failed to load historical run data."})}finally{J===xe.current&&x(!1)}},[k,e.keyword,e.provider,b]),pe=(P||e.historyScope!=="provider")&&E.model?`${E.provider} (${E.model}) · ${E.changeLabel.toLowerCase()}`:`${E.provider} · ${E.changeLabel.toLowerCase()}`,de=!P&&e.historyScope==="provider"?[e.model?`Current model: ${e.model}`:null,e.modelsSeen&&e.modelsSeen.length>1?`History spans ${e.modelsSeen.length} models`:null].filter(Boolean).join(" · "):"",U=O&&ee>0?{label:"Citation confirmed",title:`Cited #${ee} of ${V} domain${V!==1?"s":""}`,meta:pe}:O?{label:"Citation confirmed",title:"Cited in this answer",meta:pe}:E.citationState==="lost"?{label:"Citation lost",title:V>0?`${V} domain${V!==1?"s":""} cited instead`:"No longer appearing in this answer",meta:pe}:E.citationState==="pending"?{label:"Pending",title:"Awaiting first visibility run",meta:"No provider data yet"}:{label:"Not in this answer",title:V>0?`${V} domain${V!==1?"s":""} cited instead`:"No domains cited for this query",meta:pe},T=()=>{if(!E.answerSnippet)return null;const L=E.answerSnippet.split(`
|
|
95
|
-
`),J=[];let X=[],Y=0;const he=()=>{if(X.length===0)return;const ge=X.join(" ").trim();ge&&J.push(r.jsx("p",{className:J.length>0?"mt-2.5":"",children:Vb(ge,ue)},Y++)),X=[]};for(const ge of L){const we=ge.trim();if(/^[-\u2013\u2014]{3,}$/.test(we)){he(),J.push(r.jsx("hr",{className:"border-zinc-800/60 my-3"},Y++));continue}const me=we.match(/^(#{1,3})\s+(.+)$/);if(me){he();const Ie=me[1].length,Ye=me[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s#]+/u,"").trim()||me[2],le=Ie===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":Ie===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";J.push(r.jsx("p",{className:le,children:Vb(Ye,ue)},Y++));continue}if(we===""){he();continue}X.push(we)}return he(),J};return r.jsx(dw,{open:!0,onOpenChange:L=>{L||n()},children:r.jsxs(fw,{children:[r.jsx(Op,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),r.jsxs(Dp,{className:"evidence-modal","aria-describedby":void 0,children:[r.jsxs("div",{className:"evidence-modal-header",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("p",{className:"eyebrow eyebrow-soft",children:[t.project.name," ","·"," ",E.provider||"All providers"]}),r.jsx(Lp,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.keyword})]}),r.jsxs(mw,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[r.jsx(Qu,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]}),A&&r.jsxs("div",{className:"evidence-modal-timeline",children:[r.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),r.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:k.map((L,J)=>{const X=f===-1&&J===k.length-1||f===J,Y=L.citationState==="cited"?"bg-emerald-400":L.citationState==="emerging"?"bg-amber-400":L.citationState==="lost"?"bg-rose-400":"bg-zinc-600",ge=new Date(L.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),we=!!(L.model&&J>0&&k[J-1]?.model&&k[J-1].model!==L.model);return r.jsxs("button",{type:"button",className:`evidence-run-dot ${X?"evidence-run-dot--selected":""}`,onClick:()=>K(J===k.length-1?-1:J),"aria-label":[`Run ${ge}: ${L.citationState}`,L.model?`model ${L.model}`:null,we?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":X,children:[r.jsx("span",{className:`size-2 rounded-full ${Y} ${we?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),r.jsx("span",{className:"text-[10px] text-zinc-500",children:ge})]},J)})}),f>=0&&f<k.length&&r.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(k[f].createdAt).toLocaleString()," ","—"," ",r.jsx("span",{className:"capitalize",children:k[f].citationState}),r.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>K(-1),children:["←"," Back to latest"]})]}),!P&&(e.modelTransitions?.length??0)>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(L=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${L.fromModel??"unknown"} -> ${L.toModel??"unknown"} on ${new Date(L.createdAt).toLocaleDateString()}`},`${L.runId}:${L.toModel??"unknown"}`))})]}),r.jsxs("div",{className:"evidence-modal-body",children:[y&&r.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!y&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"evidence-modal-main",children:[r.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${_e}`,children:[r.jsx("p",{className:`evidence-position-label evidence-position-label--${_e}`,children:U.label}),r.jsx("p",{className:`evidence-position-title evidence-position-title--${_e}`,children:U.title}),r.jsx("p",{className:"evidence-position-meta",children:U.meta}),de&&r.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:de})]}),E.answerSnippet&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),r.jsx("div",{className:`answer-snippet-block ${a?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:T()}),E.answerSnippet.length>280&&r.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>o(!a),children:a?"↑ Collapse":"↓ Show full answer"})]}),!E.answerSnippet&&!y&&r.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!P&&e.relatedTechnicalSignals.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:O?"Why you're cited":"What to fix"}),r.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((L,J)=>r.jsxs("div",{className:"action-item",children:[r.jsx("svg",{className:`action-item-icon ${O?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:O?r.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),r.jsx("span",{className:"action-item-text",children:L})]},J))})]}),E.summary&&r.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:E.summary})]}),r.jsxs("div",{className:"evidence-modal-sidebar",children:[(E.citedDomains.length>0||E.recommendedCompetitors.length>0||E.groundingSources.length>0||E.evidenceUrls.length>0)&&r.jsxs("div",{className:"sidebar-tabs",children:[r.jsx("button",{className:`sidebar-tab ${c==="citations"?"sidebar-tab--active":""}`,onClick:()=>u("citations"),type:"button",title:"Domains Canonry identified as cited in the model response. This is the primary visibility signal.",children:"Citations"}),r.jsx("button",{className:`sidebar-tab ${c==="sources"?"sidebar-tab--active":""}`,onClick:()=>u("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the cited-domain ranking.",children:"Sources"})]}),c==="citations"&&r.jsxs(r.Fragment,{children:[E.recommendedCompetitors.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsx("span",{children:"Company names mentioned"}),r.jsx(Nn,{text:"Best-effort company names extracted from the answer text. This is supplementary context and does not replace the cited-domain list below."})]}),r.jsx("div",{className:"citation-leaderboard",children:E.recommendedCompetitors.map((L,J)=>r.jsxs("div",{className:"citation-leaderboard-item citation-leaderboard-item--competitor",children:[r.jsxs("span",{className:"citation-leaderboard-rank",children:["#",J+1]}),r.jsx("span",{className:"citation-leaderboard-domain",children:L})]},L))})]}),E.citedDomains.length>0?r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsx("span",{children:"Domains cited in answer"}),r.jsx(Nn,{text:"Domains Canonry identified as actually cited in the model response. This is the canonical evidence used for citation state and ranking."})]}),r.jsxs("div",{className:"citation-leaderboard",children:[E.citedDomains.map((L,J)=>{const X=L.toLowerCase().replace(/^www\./,""),Y=C.has(X),he=!Y&&E.competitorDomains.some(we=>we.toLowerCase().replace(/^www\./,"")===X),ge=Y?"you":he?"competitor":"other";return r.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${ge}`,children:[r.jsxs("span",{className:"citation-leaderboard-rank",children:["#",J+1]}),r.jsx("span",{className:"citation-leaderboard-domain",children:L}),Y&&r.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),he&&r.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},L)}),!O&&r.jsxs("div",{className:"citation-leaderboard-item citation-leaderboard-item--not-cited border-dashed",children:[r.jsx("span",{className:"citation-leaderboard-rank text-zinc-600",children:"—"}),r.jsx("span",{className:"citation-leaderboard-domain text-zinc-600",children:t.project.canonicalDomain}),r.jsx("span",{className:"citation-leaderboard-tag text-zinc-600",children:"Not cited"})]})]})]}):E.recommendedCompetitors.length===0?r.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No citation data ",P?"for this run":"yet"]}):null]}),c==="sources"&&r.jsxs(r.Fragment,{children:[E.groundingSources.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsxs("span",{children:["Grounding source links (",E.groundingSources.length,")"]}),r.jsx(Nn,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as the cited-domain ranking."})]}),r.jsx("ul",{className:"grid gap-0.5",children:E.groundingSources.map((L,J)=>r.jsx("li",{className:"truncate text-sm",children:r.jsx("a",{href:L.uri,target:"_blank",rel:"noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:L.title||L.uri})},J))})]}),E.evidenceUrls.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),r.jsx("ul",{className:"grid gap-1",children:E.evidenceUrls.map(L=>r.jsx("li",{className:"truncate text-sm",children:r.jsx("a",{href:L,target:"_blank",rel:"noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:L})},L))})]}),E.groundingSources.length===0&&E.evidenceUrls.length===0&&r.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",P?"for this run":"yet"]})]}),E.citedDomains.length===0&&E.recommendedCompetitors.length===0&&E.groundingSources.length===0&&E.evidenceUrls.length===0&&r.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No citation data ",P?"for this run":"yet"]})]})]})]})]})]})})}function ls(e){const t=new Date("2026-02-20");return e.map((n,a)=>({runId:`run_mock_${a+1}`,citationState:n,createdAt:new Date(t.getTime()+a*2*24*60*60*1e3).toISOString()}))}const rm=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],country:"US",language:"en",tags:["lead gen"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],country:"US",language:"en",tags:["multi-location"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1}];function rd(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const VM=rd({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),QM=rd({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),YM=rd({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),JM=rd({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),XM=[{id:"evidence_citypoint_emergency_gemini",keyword:"emergency dentist brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:ls(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",keyword:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:ls(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",keyword:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",keyword:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",keyword:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:ls(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",keyword:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",keyword:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",keyword:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",keyword:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];rm[0],rm[1],ls(["cited","cited","cited","cited","cited"]),rm[2],2/7,ls(["not-cited","not-cited","not-cited","cited"]);function WM(e,t){return e.projects.find(n=>n.project.id===t)}function e4(e,t){return e.runs.find(n=>n.id===t)}function t4(e,t){for(const n of e.projects){const a=n.visibilityEvidence.find(o=>o.id===t);if(a)return{project:n,evidence:a}}}function eN(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,locations:e.locations??[],defaultLocation:e.defaultLocation??null,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function Qb(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function n4(e,t){if(!e)return"Waiting";if(!t)return"Running";const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return"<1s";const a=Math.floor(n/1e3);if(a<60)return`${a}s`;const o=Math.floor(a/60),c=a%60;return`${o}m ${c}s`}function tN(e){return e==="answer-visibility"?"Answer visibility sweep":e}function s4(e){return e==="manual"?"Manual":e==="scheduled"?"Scheduled":e==="config-apply"?"Config apply":e}function Hp(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:tN(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?Qb(e.startedAt):Qb(e.createdAt),duration:n4(e.startedAt,e.finishedAt),statusDetail:e.error?nN(e.error):i4(e),summary:a4(e),triggerLabel:s4(e.trigger)}}function nN(e){try{const n=JSON.parse(e);if(typeof n=="object"&&n!==null){const a=n.message??n.error?.message??n[0]?.error?.message;if(typeof a=="string"&&a.length>0)return a.length>200?a.slice(0,200)+"…":a}}catch{}const t=e.match(/\[.*?\]\s*(.+)/);if(t){const n=t[1];return n.length>200?n.slice(0,200)+"…":n}return e.length>200?e.slice(0,200)+"…":e}function i4(e){switch(e.status){case"queued":return"Waiting for execution slot.";case"running":return"Provider queries in progress.";case"completed":return"All key phrases checked.";case"partial":return"Run completed with some key phrases skipped.";case"failed":return e.error?nN(e.error):"Run failed.";default:return""}}function a4(e){switch(e.status){case"queued":return"Queued for execution";case"running":return"In progress";case"completed":return"Visibility sweep completed";case"partial":return"Partial completion";case"failed":return"Run failed";default:return e.status}}function sN(e){if(e.length===0)return{score:0,citedCount:0,totalCount:0};const t=new Map;for(const c of e){const u=c.keyword??c.id;t.has(u)||t.set(u,!1),c.citationState==="cited"&&t.set(u,!0)}const n=t.size,a=[...t.values()].filter(Boolean).length;return{score:n>0?Math.round(a/n*100):0,citedCount:a,totalCount:n}}function r4(e){return e>=70?"positive":e>=40?"caution":"negative"}function o4(e){return e==="High"?"negative":e==="Moderate"?"caution":"neutral"}function l4(e,t){return e===0?"positive":(t>0?e/t:0)>=.3?"negative":"caution"}function c4(e){if(e.length===0)return{label:"Gap Key Phrases",value:"No data",delta:"Run a sweep first",tone:"neutral",description:"Run a visibility sweep to identify key phrases where competitors are cited and your domain is not.",tooltip:"Tracked key phrases where a competitor is cited in the latest run but your domain is not.",trend:[]};const t=new Map;for(const c of e){const u=c.keywordId,f=t.get(u)??{cited:!1,competitorOverlap:new Set};c.citationState==="cited"&&(f.cited=!0);for(const m of c.competitorOverlap)f.competitorOverlap.add(m);t.set(u,f)}const n=t.size,a=[...t.values()].filter(c=>!c.cited&&c.competitorOverlap.size>0).length,o=a===1?"key phrase":"key phrases";return{label:"Gap Key Phrases",value:`${a}`,delta:`${a} of ${n} key phrases at risk`,tone:l4(a,n),description:a>0?`${a} tracked ${o} currently cite competitors without citing your domain.`:"No competitive key phrase gaps detected in the latest visibility run.",tooltip:"Tracked key phrases where a competitor is cited in the latest run but your domain is not.",trend:[],progress:n>0?a/n:0}}function u4(e,t){return e&&e.summary.total>0?{provider:"Google",...e.summary}:t&&t.summary.total>0?{provider:"Bing",...t.summary,deindexed:0}:e?{provider:"Google",...e.summary}:t?{provider:"Bing",...t.summary,deindexed:0}:null}function d4(e){return e.provider==="Google"&&e.deindexed>0?"negative":e.percentage>=90?"positive":e.percentage>=70?"caution":"negative"}function f4(e,t){const n=u4(e,t);if(!n||n.total===0)return{label:"Index Coverage",value:"No data",delta:"Connect GSC or Bing",tone:"neutral",description:"Connect Google Search Console or Bing Webmaster Tools and inspect your sitemap to populate coverage.",tooltip:"Percentage of inspected URLs currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used.",trend:[]};const a=n.notIndexed===1?"URL is":"URLs are",o=n.deindexed===1?"URL":"URLs";return{label:"Index Coverage",value:`${Math.round(n.percentage)}`,delta:`${n.provider} · ${n.indexed} of ${n.total} indexed`,tone:d4(n),description:n.provider==="Google"&&n.deindexed>0?`${n.deindexed} deindexed ${o} detected in the latest Google Search Console inspection.`:`${n.notIndexed} ${a} not indexed in ${n.provider==="Google"?"Google Search Console":"Bing Webmaster Tools"}.`,tooltip:"Percentage of inspected URLs currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used.",trend:[]}}function iN(e,t){if(e.length===0||t.length===0)return{label:"None",count:0};const n=new Set(t);let a=0;for(const c of e)c.competitorOverlap.some(u=>n.has(u))&&a++;const o=a/e.length;return o>=.5?{label:"High",count:a}:o>=.2?{label:"Moderate",count:a}:{label:"Low",count:a}}function h4(e,t,n,a){const o=[];let c=0;const u=new Set;if(n){const f=new Map;for(const x of n.snapshots)if(x.keyword){const b=`${x.keyword}::${x.provider}`;f.set(b,x)}const m=new Set(n.snapshots.map(x=>x.provider)),p=new Set(t.flatMap(x=>Object.keys(x.providerRuns??{}))),v=[...new Set([...m,...p])].sort(),y=v.length>0?v:["gemini"];for(const x of t){if(x.runs.length===0)continue;u.add(x.keyword);const N=x.runs.at(-1)?.transition??"not-cited";for(const S of y){const C=f.get(`${x.keyword}::${S}`),k=(x.providerRuns?.[S]?.length??0)>0;if(!C&&!k)continue;const A=C?.model??null,R=A?`${S}:${A}`:null,z=R?x.modelRuns?.[R]:void 0,$=x.providerRuns?.[S],P=($?.length?$:null)??(z?.length?z:null),E=$?.length?"provider":z?.length?"model":"keyword",O=P?P.at(-1).transition:N,H=P?.at(-1)?.citationState,ee=C?O==="lost"?"lost":O==="emerging"?"emerging":C.citationState==="cited"?"cited":"not-cited":H==="cited"?"cited":"not-cited",V=Hm(P||x.runs),se=m4(x,S),ue=(P??x.runs).map(ae=>({runId:ae.runId,citationState:ae.citationState,createdAt:ae.createdAt,model:se.get(ae.runId)??null})),_e=p4(ue),xe=E==="provider"&&_e.length<=1?"model":E,K=g4(ue);o.push({id:`evidence_${e}_${c++}`,keyword:x.keyword,provider:C?.provider??S,model:C?.model??null,location:C?.location??null,citationState:ee,changeLabel:y4(O,V),answerSnippet:C?.answerText??"",citedDomains:C?.citedDomains??[],evidenceUrls:[],competitorDomains:C?.competitorOverlap??[],recommendedCompetitors:C?.recommendedCompetitors??[],relatedTechnicalSignals:[],groundingSources:C?.groundingSources??[],summary:v4(ee,x.keyword),runHistory:ue,historyScope:xe,modelsSeen:_e,modelTransitions:K})}}}for(const f of a)u.has(f.keyword)||o.push({id:`evidence_${e}_${c++}`,keyword:f.keyword,provider:"",model:null,location:null,citationState:"pending",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${f.keyword}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"keyword",modelsSeen:[],modelTransitions:[]});return o}function m4(e,t){const n=new Map,a=`${t}:`;for(const[o,c]of Object.entries(e.modelRuns??{})){if(!o.startsWith(a))continue;const u=o.slice(a.length),f=u==="unknown"?null:u;for(const m of c)n.set(m.runId,f)}return n}function p4(e){const t=new Set;for(const n of e)n.model&&t.add(n.model);return[...t]}function g4(e){const t=[];let n=null;for(const a of e){const o=a.model??null;o!==n&&n!==null&&t.push({runId:a.runId,createdAt:a.createdAt,fromModel:n,toModel:o}),n=o}return t}function Hm(e){if(e.length===0)return 0;const t=e[e.length-1].citationState;let n=0;for(let a=e.length-1;a>=0&&e[a].citationState===t;a--)n++;return n}function y4(e,t){switch(e){case"new":return"First observation";case"cited":return t<=1?"Cited in latest run":`Cited for ${t} runs`;case"lost":return"Lost since last run";case"emerging":return"First citation";case"not-cited":return t<=1?"Not cited in latest run":`Not cited across ${t} runs`;default:return e}}function v4(e,t){switch(e){case"cited":return`Your domain is cited in AI answers for "${t}".`;case"lost":return`Citation was lost for "${t}". Competitors may have gained ground.`;case"emerging":return`Your domain is starting to appear in answers for "${t}".`;case"not-cited":return`No citation detected for "${t}".`;case"pending":return`"${t}" has been added but no visibility run has been triggered yet.`}}function Yb(e,t){const n=new Set(t),a=new Map;for(const o of e)if(o.keyword)for(const c of o.competitorOverlap){if(!n.has(c))continue;const u=a.get(c)??new Set;u.add(o.keyword),a.set(c,u)}return a}const om=3;function x4(e){const{evidence:t,timeline:n,latestSnapshots:a,previousSnapshots:o,trackedCompetitors:c}=e,u=[],f=[],m=new Set;for(const k of t)k.citationState==="lost"&&(m.has(k.keyword)||(m.add(k.keyword),f.push({keyword:k.keyword,evidenceId:k.id,provider:k.provider,citationState:"lost"})));f.length>0&&u.push({id:"insight_lost",tone:"negative",title:`Lost citation on ${f.length} key phrase${f.length>1?"s":""}`,detail:"Citations dropped since the last run.",actionLabel:"Lost",affectedPhrases:f});const p=Yb(a,c),v=Yb(o,c);for(const k of c){const A=p.get(k)??new Set,R=v.get(k)??new Set,z=[...A].filter($=>!R.has($));z.length>0&&u.push({id:`insight_comp_gained_${k}`,tone:"negative",title:`${k} appeared on ${z.length} key phrase${z.length>1?"s":""}`,detail:"A tracked competitor gained new citations.",actionLabel:"Competitor",affectedPhrases:z.map($=>{const P=t.find(E=>E.keyword===$);return{keyword:$,evidenceId:P?.id??"",citationState:"cited"}})})}const y=new Map;for(const k of n){const A=k.runs.at(-1);A&&y.set(k.keyword,{transition:A.transition,citationState:A.citationState})}const x=[],b=[],N=new Set;for(const[k,{transition:A,citationState:R}]of y){if(!(A==="emerging"||A==="new"&&R==="cited"))continue;N.add(k);const $=t.find(P=>P.keyword===k&&(P.citationState==="emerging"||P.citationState==="cited"));x.push({keyword:k,evidenceId:$?.id??"",provider:$?.provider,citationState:"emerging"})}for(const k of t)k.citationState==="emerging"&&(N.has(k.keyword)||b.push({keyword:k.keyword,evidenceId:k.id,provider:k.provider,citationState:"emerging"}));if(b.length>0){const k=new Set(b.map(A=>A.keyword)).size;u.push({id:"insight_provider_pickup",tone:"positive",title:`Picked up by new provider on ${k} key phrase${k>1?"s":""}`,detail:"Your domain started appearing on additional providers.",actionLabel:"Pickup",affectedPhrases:b})}x.length>0&&u.push({id:"insight_first_citation",tone:"positive",title:`First citation on ${N.size} key phrase${N.size>1?"s":""}`,detail:"Your domain appeared in AI answers for the first time.",actionLabel:"New",affectedPhrases:x});const S=new Set(t.map(k=>k.keyword)),C=[];for(const k of n){if(!S.has(k.keyword)||k.runs.length<om||k.runs.at(-1)?.citationState!=="not-cited")continue;if(Hm(k.runs)>=om){const z=t.find($=>$.keyword===k.keyword);C.push({keyword:k.keyword,evidenceId:z?.id??"",citationState:"not-cited"})}}C.length>0&&u.push({id:"insight_persistent_gap",tone:"caution",title:`${C.length} key phrase${C.length>1?"s":""} uncited for ${om}+ runs`,detail:"These key phrases have not been cited by any provider across multiple consecutive runs.",actionLabel:"Gap",affectedPhrases:C});for(const k of c){const A=p.get(k)??new Set,z=[...v.get(k)??new Set].filter($=>!A.has($));z.length>0&&u.push({id:`insight_comp_lost_${k}`,tone:"neutral",title:`${k} dropped from ${z.length} key phrase${z.length>1?"s":""}`,detail:"A tracked competitor lost citations.",actionLabel:"Competitor",affectedPhrases:z.map($=>{const P=t.find(E=>E.keyword===$);return{keyword:$,evidenceId:P?.id??"",citationState:"not-cited"}})})}return u.length===0&&u.push({id:"insight_stable",tone:"neutral",title:"No significant changes",detail:"Citation state is stable across all tracked key phrases.",actionLabel:"Stable",affectedPhrases:[]}),u}function b4(e,t){if(t.length===0){const m=new Set(e.filter(p=>p.citationState==="cited").map(p=>p.keyword)).size;return{gained:m,lost:0,tone:m>0?"positive":"neutral",hasPreviousRun:!1}}const n=m=>{const p=new Set;for(const v of m)v.citationState==="cited"&&v.keyword&&p.add(v.keyword);return p},a=n(e),o=n(t);let c=0,u=0;for(const m of a)o.has(m)||c++;for(const m of o)a.has(m)||u++;const f=u>c?"negative":c>u?"positive":"neutral";return{gained:c,lost:u,tone:f,hasPreviousRun:!0}}function S4(e){const t=e[0];if(!t)return{label:"Run Status",value:"None",delta:"No runs yet",tone:"neutral",description:"Trigger a visibility sweep to start tracking.",tooltip:"Current execution state of visibility sweeps. Shows the status of the most recent run and total run count.",trend:[]};const n=t.status==="completed"?"Healthy":t.status==="running"?"Running":t.status==="queued"?"Queued":t.status==="partial"?"Partial":"Failed",a=t.status==="completed"?"positive":t.status==="failed"?"negative":t.status==="partial"?"caution":"neutral";return{label:"Run Status",value:n,delta:`${e.length} total runs`,tone:a,description:`Latest: ${tN(t.kind)} — ${t.status}`,tooltip:"Current execution state of visibility sweeps. Shows the status of the most recent run and total run count.",trend:[]}}function j4(e){const t=eN(e.project),n=h4(t.name,e.timeline,e.latestRunDetail,e.keywords),a=e.latestRunDetail?.snapshots??[],o=sN(a),c=c4(a),u=f4(e.gscCoverage,e.bingCoverage),f=iN(a,e.competitors.map(b=>b.domain)),m=x4({evidence:n,timeline:e.timeline,latestSnapshots:e.latestRunDetail?.snapshots??[],previousSnapshots:e.previousRunDetail?.snapshots??[],trackedCompetitors:e.competitors.map(b=>b.domain)}),p=[...e.runs].sort((b,N)=>N.createdAt.localeCompare(b.createdAt)),v=p.map(b=>Hp(b,e.project.displayName||e.project.name)),y=new Map;for(const b of a){const N=b.provider||"gemini",S=b.model??null,C=`${N}::${S??"unknown"}`,k=y.get(C)??{provider:N,model:S,cited:0,total:0};k.total++,b.citationState==="cited"&&k.cited++,y.set(C,k)}const x=[...y.values()].sort((b,N)=>b.provider.localeCompare(N.provider)||(b.model??"").localeCompare(N.model??"")).map(({provider:b,model:N,cited:S,total:C})=>({provider:b,model:N,score:C>0?Math.round(S/C*100):0,cited:S,total:C}));return{project:t,dateRangeLabel:"All time",contextLabel:`${t.country} / ${t.language.toUpperCase()}`,visibilitySummary:{label:"Answer Visibility",value:a.length>0?`${o.score}`:"No data",delta:a.length>0?`${o.citedCount} of ${o.totalCount} key phrases visible`:"Run a sweep first",tone:a.length>0?r4(o.score):"neutral",description:a.length>0?`${o.citedCount} of ${o.totalCount} tracked key phrases found your domain in at least one AI answer engine.`:"No visibility data yet. Trigger a run to start tracking.",tooltip:'Percentage of tracked key phrases where your domain is cited by at least one AI answer engine. A key phrase is "visible" if any configured provider includes your site in its response.',trend:[]},keywordCounts:{cited:o.citedCount,total:o.totalCount},gapKeyPhrases:c,indexCoverage:u,providerScores:x,competitorPressure:{label:"Competitor Pressure",value:f.label,delta:f.count>0?`${f.count} overlapping citations`:"No overlap detected",tone:o4(f.label),description:e.competitors.length>0?`${e.competitors.length} competitor${e.competitors.length>1?"s":""} tracked.`:"No competitors configured.",tooltip:"How often competitor domains appear alongside yours in AI answers. High pressure means competitors are frequently cited for the same key phrases.",trend:[]},runStatus:S4(p),movementSummary:b4(e.latestRunDetail?.snapshots??[],e.previousRunDetail?.snapshots??[]),insights:m,visibilityEvidence:n,competitors:e.competitors.map((b,N)=>{const S=new Set;for(const z of a)(z.competitorOverlap.includes(b.domain)||z.citedDomains.includes(b.domain))&&z.keyword&&S.add(z.keyword);const C=[...S],k=new Set(a.map(z=>z.keyword).filter(Boolean)),A=k.size>0?C.length/k.size:0,R=A>=.5?"High":A>=.2?"Moderate":C.length>0?"Low":"None";return{id:b.id||`comp_${N}`,domain:b.domain,citationCount:C.length,totalKeywords:k.size,pressureLabel:R,citedKeywords:C,movement:"",notes:""}}),recentRuns:v.slice(0,5)}}function w4(e){const t=eN(e.project),n=e.latestRunDetail?.snapshots??[],a=sN(n),o=iN(n,e.competitors.map(m=>m.domain)),u=[...e.runs].sort((m,p)=>p.createdAt.localeCompare(m.createdAt))[0],f=u?Hp(u,e.project.displayName||e.project.name):{id:"none",projectId:e.project.id,projectName:e.project.displayName||e.project.name,kind:"answer-visibility",kindLabel:"No runs yet",status:"queued",trigger:"manual",createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""};return{project:t,visibilityScore:a.score,visibilityDelta:n.length>0?`${a.citedCount} of ${a.totalCount} key phrases`:"No data",lastRun:f,insight:n.length>0?`${a.citedCount} of ${a.totalCount} key phrases visible across ${new Set(n.map(m=>m.provider)).size} provider${new Set(n.map(m=>m.provider)).size>1?"s":""}.`:"No runs completed yet.",trend:[],competitorPressureLabel:o.label}}function N4(e,t){const n=[],a=[],o=[];for(const u of e){a.push(j4(u)),o.push(w4(u));const f=[...u.runs].sort((m,p)=>p.createdAt.localeCompare(m.createdAt));for(const m of f)n.push(Hp(m,u.project.displayName||u.project.name))}n.sort((u,f)=>f.createdAt.localeCompare(u.createdAt));const c=e.length>0;return{portfolioOverview:{projects:o,attentionItems:c?C4(a):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:n.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...c?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small key phrase set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:a,runs:n,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},keywordImportState:{mode:"paste",keywordCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:c,ctaLabel:c?"Trigger run":"Create a project first",summary:c?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(t?.providers??[]).map(u=>({name:u.name,displayName:u.displayName,keyUrl:u.keyUrl,modelHint:u.modelHint,model:u.model,state:u.configured?"ready":"needs-config",detail:u.configured?"Provider is configured.":"API key is missing.",quota:u.quota})),google:{state:t?.google?.configured?"ready":"needs-config",detail:t?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:t?.bing?.configured?"ready":"needs-config",detail:t?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function C4(e){const t=[];for(const n of e){const a=n.visibilityEvidence.filter(c=>c.citationState==="lost");a.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:"negative",title:`${n.project.displayName||n.project.name} lost citations`,detail:`${a.length} key phrase${a.length>1?"s":""} lost citation.`,actionLabel:"Open project",href:`/projects/${n.project.id}`});const o=n.recentRuns.filter(c=>c.status==="running"||c.status==="queued");o.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:"neutral",title:`${n.project.displayName||n.project.name} has active runs`,detail:`${o.length} run${o.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return t.length===0&&t.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag.",actionLabel:"View portfolio",href:"/"}),t}const Qn={projects:{all:["projects"],detail:(e,t)=>["projects",e,t],keywords:e=>["projects",e,"keywords"],competitors:e=>["projects",e,"competitors"],timeline:(e,t)=>["projects",e,"timeline",t]},runs:{all:["runs"],detail:e=>["runs",e]},settings:["settings"],health:["health"]},aN=w.createContext(null);aN.Provider;function yl(){return w.useContext(aN)}function Da(e){const n=yl()?.dashboard??null,a=ba({queryKey:Qn.projects.all,queryFn:JS,enabled:!n}),o=ba({queryKey:Qn.runs.all,queryFn:WS,enabled:!n,refetchInterval:N=>N.state.data?.some(k=>k.status==="running"||k.status==="queued")?3e3:!1}),c=ba({queryKey:Qn.settings,queryFn:()=>wp().catch(()=>null),enabled:!n}),u=a.data??[],f=o.data??[],m=qk({queries:u.map(N=>{const S=f.filter(k=>k.projectId===N.id),C=S.filter(k=>(k.status==="completed"||k.status==="partial")&&k.kind==="answer-visibility").sort((k,A)=>A.createdAt.localeCompare(k.createdAt));return{queryKey:Qn.projects.detail(N.id,C[0]?.id),queryFn:async()=>{const[k,A,R,z,$,P,E]=await Promise.all([Q_(N.name).catch(()=>[]),ej(N.name).catch(()=>[]),tj(N.name).catch(()=>[]),C[0]?Ur(C[0].id).catch(()=>null):Promise.resolve(null),C[1]?Ur(C[1].id).catch(()=>null):Promise.resolve(null),Np(N.name).catch(()=>null),Cp(N.name).catch(()=>null)]);return{project:N,runs:S,keywords:k,competitors:A,timeline:R,latestRunDetail:z,previousRunDetail:$,gscCoverage:P,bingCoverage:E}},enabled:!n&&a.isSuccess&&o.isSuccess}})}),p=m.every(N=>N.isSuccess),v=w.useMemo(()=>{if(n)return n;if(!a.data||!o.data||u.length>0&&!p)return null;const N=m.map(S=>S.data).filter(S=>S!=null);return N4(N,c.data??null)},[n,a.data,o.data,c.data,p,m,u.length]),y=!n&&(a.isError||o.isError),x=!n&&!v&&!y,b=w.useCallback(async()=>{await Promise.all([a.refetch(),o.refetch(),c.refetch()])},[a.refetch,o.refetch,c.refetch]);return{dashboard:v,isLoading:x,isError:y,refetch:b}}function k4(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const Jb=k4(),Gm=Jb==="/"?"":Jb.replace(/\/$/,"");async function z4(){const e=Gm?`${Gm}/health`:"/health",t=await H2(e,"API"),n=t.state==="ok"?{label:"Runner",state:"ok",detail:"In-process job runner"}:{label:"Runner",state:t.state,detail:"Depends on API"};return{apiStatus:t,workerStatus:n}}function od(e,t){return ba({queryKey:Qn.health,queryFn:z4,enabled:e,refetchInterval:15e3,initialData:t})}function _4(e){return ba({queryKey:Qn.runs.detail(e??""),queryFn:()=>Ur(e),enabled:!!e,refetchInterval:t=>{const n=t.state.data?.status;return n==="running"||n==="queued"?3e3:!1}})}function Zr(){const e=Bi(),t=Fu({strict:!1}),n=Cn({select:m=>m.location.pathname}),a=t.runId??null,o=t.evidenceId??null;return{runId:a,evidenceId:o,openRun:m=>e({to:n,from:ds.to,search:p=>({...p,runId:m,evidenceId:void 0})}),openEvidence:m=>e({to:n,from:ds.to,search:p=>({...p,evidenceId:m,runId:void 0})}),closeDrawer:()=>e({to:n,from:ds.to,search:m=>({...m,runId:void 0,evidenceId:void 0})})}}const E4={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function R4(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function A4(){const e=w.useSyncExternalStore(Y2,Yx,Yx),t=Bi(),{openRun:n}=Zr(),a=w.useCallback(c=>{Tm(c)},[]),o=w.useCallback(c=>{c.cta&&(c.cta.intent==="open-run-drawer"?n(c.cta.runId):t({to:"/runs"}),Tm(c.id))},[t,n]);return e.length===0?null:r.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(c=>r.jsxs("section",{role:c.tone==="negative"?"alert":"status","aria-live":c.tone==="negative"?"assertive":"polite","data-state":c.state,className:`toast-card ${E4[c.tone]}`,children:[r.jsxs("div",{className:"toast-copy",children:[r.jsx("p",{className:"toast-title",children:c.title}),c.detail?r.jsx("p",{className:"toast-detail",children:c.detail}):null,c.cta?r.jsx("button",{type:"button",className:"toast-action",onClick:()=>o(c),"aria-label":R4(c),children:c.cta.label}):null]}),r.jsx("button",{type:"button",onClick:()=>a(c.id),className:"toast-dismiss","aria-label":"Dismiss",children:r.jsx(Qu,{className:"size-3.5"})})]},c.id))})}const Xb=[{label:"Architecture",href:"https://github.com/AINYC/canonry/blob/main/docs/architecture.md"},{label:"Testing Guide",href:"https://github.com/AINYC/canonry/blob/main/docs/testing.md"}],Wb=e=>({label:e,state:"checking",detail:"Checking service health"}),T4={apiStatus:Wb("API"),workerStatus:Wb("Worker")};function O4(e){return e==="gsc-sync"?"GSC sync":e==="inspect-sitemap"?"Sitemap inspection":"Visibility sweep"}function D4(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function L4(e){const t=O4(e.kind);return e.status==="completed"?`${t} completed`:e.status==="partial"?`${t} completed with partial results`:e.status==="cancelled"?`${t} cancelled`:`${t} failed`}function M4(e,t){return e.error?`${t}: ${e.error}`:e.location?`${t} · ${e.location}`:t}function $4(e,t,n){if(t)return t;const a=n.find(o=>o.id===e);return a?.displayName||a?.name||e}function P4(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(", ")}function U4(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function I4(){const e=w.useSyncExternalStore(IE,za,za),t=Object.keys(e.runs).length>0||Object.keys(e.batches).length>0,n=ba({queryKey:Qn.runs.all,queryFn:WS,enabled:t}),a=ba({queryKey:Qn.projects.all,queryFn:JS,enabled:t}),o=w.useRef({}),c=w.useCallback(()=>{n.refetch()},[n.refetch]);return w.useEffect(()=>{t&&c()},[t,c]),w.useEffect(()=>{if(!t||typeof window>"u")return;const u=()=>{document.visibilityState==="visible"&&c()};return window.addEventListener("focus",c),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",u)}},[t,c]),w.useEffect(()=>{const u=n.data??[],f=a.data??[],m=Object.fromEntries(u.map(v=>[v.id,v])),p=Object.fromEntries(u.map(v=>[v.id,v.status]));for(const v of Object.values(e.runs)){const y=m[v.runId];if(!y||!KE(y.status)||(o.current[y.id]??v.lastAnnouncedStatus)===y.status)continue;if(v.sourceAction==="run-all"){nb(y.id);continue}const b=$4(y.projectId,v.projectLabel,f);Fe({title:L4(y),detail:M4(y,b),tone:D4(y.status),dedupeKey:`run:${y.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:y.id}}),nb(y.id)}for(const v of Object.values(e.batches)){const y=HE(v.runIds,m);y.finished&&(Fe({title:"Run-all batch finished",detail:P4(y,v.skippedCount),tone:U4(y),dedupeKey:`batch:${v.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),qE(v.batchId))}o.current=p},[a.data,n.data,e]),null}function B4(){const e=yl(),{dashboard:t,isLoading:n,refetch:a}=Da(),u=od(!e,e?.health).data??e?.health??T4,f=G_(),{runId:m,evidenceId:p,closeDrawer:v}=Zr(),[y,x]=w.useState(!1),b=_4(m),N=b.data??null,S=b.isLoading;w.useEffect(()=>{N&&N.status!=="running"&&N.status!=="queued"&&a()},[N?.status,a]),w.useEffect(()=>{x(!1)},[f.pathname]),w.useEffect(()=>{if(typeof window>"u"||!m&&!p)return;const z=$=>{$.key==="Escape"&&v()};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}},[m,p,v]);const C=t??e?.dashboard??null,k=m&&C?e4(C,m):void 0,A=p&&C?t4(C,p):void 0,R=(()=>{const z=f.pathname;if(z==="/")return"Portfolio";if(z==="/projects")return"Projects";if(z==="/runs")return"Runs";if(z==="/settings")return"Settings";if(z==="/setup")return"Setup";if(z.startsWith("/projects/")){const P=z.split("/").filter(Boolean)[1];if(P&&C){const E=C.projects.find(O=>O.project.id===P);if(E)return E.project.name}return"Project"}return"Not found"})();return r.jsxs("div",{className:"app-shell",children:[r.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),r.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[r.jsx("div",{className:"sidebar-brand",children:r.jsx(fb,{})}),r.jsxs("nav",{className:"sidebar-nav",children:[r.jsxs(St,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(dE,{className:"sidebar-icon"}),r.jsx("span",{children:"Overview"})]}),r.jsxs(St,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[r.jsx(cE,{className:"sidebar-icon"}),r.jsx("span",{children:"Projects"})]}),r.jsxs(St,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(pE,{className:"sidebar-icon"}),r.jsx("span",{children:"Runs"})]}),r.jsxs(St,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(wE,{className:"sidebar-icon"}),r.jsx("span",{children:"Settings"})]}),n?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(z=>r.jsxs("div",{className:"sidebar-skeleton-item",children:[r.jsx("span",{className:"skeleton-circle size-2"}),r.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+z*15}%`}})]},z))]}):C&&C.projects.length>0?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Projects"}),C.projects.map(z=>{const $=z.visibilitySummary.tone;return r.jsxs(St,{to:"/projects/$projectId",params:{projectId:z.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[r.jsx("span",{className:`sidebar-dot sidebar-dot-${$}`}),r.jsx("span",{children:z.project.name})]},z.project.id)})]}):n?null:r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Resources"}),r.jsxs(St,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(xE,{className:"sidebar-icon"}),r.jsx("span",{children:"Setup"})]})]})]}),r.jsx("div",{className:"sidebar-footer",children:Xb.map(z=>r.jsx("a",{className:"sidebar-footer-link",href:z.href,target:"_blank",rel:"noreferrer",children:z.label},z.href))})]}),r.jsxs("div",{className:"main-area",children:[r.jsxs("header",{className:"topbar",children:[r.jsxs("div",{className:"topbar-left",children:[r.jsx("div",{className:"topbar-brand-mobile",children:r.jsx(fb,{compact:!0})}),r.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[r.jsx(St,{to:"/",children:"Home"}),r.jsx(Vu,{className:"breadcrumb-sep size-3"}),r.jsx("span",{className:"breadcrumb-current",children:R})]})]}),r.jsxs("div",{className:"topbar-actions",children:[r.jsxs("div",{className:"health-pill-row",children:[r.jsxs("span",{className:`health-pill health-pill-${u.apiStatus.state}`,children:["API ",u.apiStatus.state==="ok"?"ok":u.apiStatus.state]}),r.jsxs("span",{className:`health-pill health-pill-${u.workerStatus.state}`,children:["Worker ",u.workerStatus.state==="ok"?"ok":u.workerStatus.state]})]}),r.jsxs(oe,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":y,"aria-controls":"mobile-nav",onClick:()=>x(z=>!z),children:[r.jsx(hE,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),r.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${y?"mobile-nav-open":""}`,children:[r.jsxs(oe,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>x(!1),children:[r.jsx(Qu,{className:"size-5"}),r.jsx("span",{className:"sr-only",children:"Close navigation"})]}),r.jsx(St,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),r.jsx(St,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),r.jsx(St,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),r.jsx(St,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),C&&C.projects.length>0?r.jsxs("div",{className:"mobile-nav-section",children:[r.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),C.projects.map(z=>r.jsx(St,{to:"/projects/$projectId",params:{projectId:z.project.id},className:"mobile-nav-link",children:z.project.name},z.project.id))]}):null]}),r.jsx("main",{id:"content",className:"page-shell",children:n&&!e?r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-40"}),r.jsx("div",{className:"skeleton-text-sm w-72"})]}),r.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(z=>r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton-text w-full"}),r.jsx("div",{className:"skeleton-text-sm w-3/4"})]},z))}),r.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(z=>r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-20"}),r.jsx("div",{className:"space-y-2",children:[1,2,3].map($=>r.jsx("div",{className:"skeleton-text-sm w-full"},$))})]},z))})]}):r.jsx(jp,{})}),r.jsxs("footer",{className:"footer",children:[r.jsxs("a",{href:"https://github.com/AINYC/canonry",target:"_blank",rel:"noreferrer",className:"footer-brand",children:[r.jsx(oE,{className:"size-3.5"}),r.jsx("span",{children:"Canonry"})]}),r.jsx("div",{className:"footer-links",children:Xb.map(z=>r.jsx("a",{href:z.href,target:"_blank",rel:"noreferrer",children:z.label},z.href))})]})]}),k?r.jsxs(AT,{open:k!==void 0,title:k.summary,subtitle:`${k.projectName} · ${k.kindLabel}`,onClose:v,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[r.jsx(Wu,{status:k.status}),r.jsx("span",{className:"text-zinc-400",children:k.startedAt}),r.jsx("span",{className:"text-zinc-500",children:k.duration}),r.jsx("span",{className:"text-zinc-600",children:k.triggerLabel})]}),k.status==="failed"&&k.statusDetail&&r.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:k.statusDetail}),r.jsxs("div",{className:"mt-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),S?r.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):N&&N.snapshots.length>0?r.jsxs("div",{className:"space-y-2",children:[N.snapshots.map(z=>r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:z.keyword??"Unknown key phrase"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ol,{provider:z.provider}),r.jsx(Tj,{variant:z.citationState==="cited"?"success":"neutral",children:z.citationState})]})]}),z.model&&r.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:z.model}),z.citedDomains.length>0&&r.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[r.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",z.citedDomains.join(", ")]}),z.competitorOverlap.length>0&&r.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",z.competitorOverlap.join(", ")]}),z.groundingSources&&z.groundingSources.length>0&&r.jsxs("details",{className:"mt-2",children:[r.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[z.groundingSources.length," grounding source",z.groundingSources.length!==1?"s":""]}),r.jsx("ul",{className:"mt-1 space-y-0.5",children:z.groundingSources.map(($,P)=>r.jsx("li",{className:"text-xs text-zinc-500 truncate",children:r.jsx("a",{href:$.uri,target:"_blank",rel:"noreferrer",className:"hover:text-zinc-300",children:$.title||$.uri})},P))})]}),z.answerText&&r.jsxs("details",{className:"mt-1",children:[r.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:z.answerText})]})]},z.id)),N.status==="running"&&r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Querying remaining key phrases..."]})]}):N&&N.status==="running"?r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first key phrase result..."]}):N&&N.status==="queued"?r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):N&&N.error?r.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[r.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),r.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:OE(N.error)})]}):r.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,A?r.jsx(ZM,{evidence:A.evidence,project:A.project,onClose:v}):null,r.jsx(I4,{}),r.jsx(A4,{})]})}class q4 extends w.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary]",t,n.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?r.jsx("div",{className:"page-container",children:r.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[r.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:r.jsx(zE,{className:"size-6 text-rose-400"})}),r.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),r.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),r.jsxs("div",{className:"flex gap-3 mt-2",children:[r.jsxs(oe,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[r.jsx(SE,{className:"size-3.5 mr-1.5"}),"Try again"]}),r.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>{window.location.href="/"},children:"Go home"})]})]})}):this.props.children}}const De=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)] backdrop-blur",e),...t}));De.displayName="Card";const Fm=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("flex flex-col gap-1.5 p-5",e),...t}));Fm.displayName="CardHeader";const Zm=w.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:es("font-medium tracking-tight text-zinc-50",e),...t}));Zm.displayName="CardTitle";const Vm=w.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:es("text-sm text-zinc-500",e),...t}));Vm.displayName="CardDescription";const pu=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("p-5 pt-0",e),...t}));pu.displayName="CardContent";function K4({points:e,tone:t}){const n=w.useId();if(e.length===0)return null;const a=42,o=132,c=5,u=Math.min(...e),m=Math.max(...e)-u||1,p=o-c*2,v=a-c*2,y=e.map((x,b)=>{const N=c+b/Math.max(e.length-1,1)*p,S=c+(1-(x-u)/m)*v;return`${N},${S}`}).join(" ");return r.jsxs("svg",{className:`sparkline sparkline-${t}`,viewBox:`0 0 ${o} ${a}`,"aria-hidden":"true",children:[r.jsx("defs",{children:r.jsx("clipPath",{id:n,children:r.jsx("rect",{x:c,y:c,width:p,height:v,rx:"8"})})}),r.jsx("line",{className:"sparkline-guide",x1:c,x2:o-c,y1:a-c,y2:a-c}),r.jsx("polyline",{clipPath:`url(#${n})`,points:y,vectorEffect:"non-scaling-stroke"})]})}function H4(e){return e.displayName??e.name.charAt(0).toUpperCase()+e.name.slice(1)}function G4(e,t,n){return e.map(a=>{if(a.id==="api")return{...a,tone:Tu(t.apiStatus),detail:t.apiStatus.state==="ok"?"Healthy":"Needs attention",meta:t.apiStatus.detail};if(a.id==="worker")return{...a,tone:Tu(t.workerStatus),detail:t.workerStatus.state==="ok"?"Healthy":"Needs attention",meta:t.workerStatus.detail};const o=n.providerStatuses.filter(m=>m.state==="ready").length,c=n.providerStatuses.length,u=o>0,f=n.providerStatuses.filter(m=>m.state==="ready").map(m=>H4(m)).join(" · ");return{...a,label:"Providers",tone:u?"positive":"caution",detail:`${o} of ${c} configured`,meta:f||"None configured"}})}function F4(e,t){if(e.apiStatus.state!=="ok")return"Launch is blocked until the API responds cleanly.";if(e.apiStatus.databaseConfigured===!1)return"Launch is blocked until the API has a database connection configured.";if(e.workerStatus.state!=="ok")return"Launch is blocked until the worker is healthy and heartbeats are current.";if(!t.providerStatuses.some(n=>n.state==="ready"))return"Launch is blocked until at least one provider is configured."}function Z4(e,t,n){const a=F4(t,n),o=structuredClone(e);return o.healthChecks=o.healthChecks.map(c=>{if(c.id==="api")return{...c,detail:t.apiStatus.detail,state:t.apiStatus.state==="ok"?"ready":"attention"};if(c.id==="worker")return{...c,detail:t.workerStatus.detail,state:t.workerStatus.state==="ok"?"ready":"attention"};const u=n.providerStatuses.some(f=>f.state==="ready");return{...c,detail:u?"At least one provider configured.":"No providers configured.",state:u?"ready":"attention"}}),o.launchState.enabled=a===void 0,o.launchState.blockedReason=a,o.launchState.summary=a??"Queue a visibility sweep first, then follow with a site audit to explain movement.",o}function V4({project:e}){return r.jsxs(St,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[r.jsxs("div",{className:"project-row-primary",children:[r.jsxs("div",{children:[r.jsx("p",{className:"project-name",children:e.project.name}),r.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),r.jsx("p",{className:"project-insight",children:e.insight})]}),r.jsx("div",{className:"project-row-stat",children:r.jsxs("div",{className:"metric-inline-block",children:[r.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),r.jsx("p",{className:"metric-inline-value",children:e.visibilityScore}),r.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta})]})}),r.jsx("div",{className:"project-row-stat",children:r.jsxs("div",{className:"metric-inline-block",children:[r.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),r.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),r.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",Yu(e.lastRun.status)]})]})}),r.jsx("div",{className:"project-row-chart",children:r.jsx(K4,{points:e.trend,tone:Oj(e.lastRun.status)})}),r.jsx("span",{className:"project-row-link",children:r.jsx(Vu,{className:"h-4 w-4 text-zinc-500"})})]})}function Q4(){const e=yl(),{dashboard:t,isLoading:n}=Da(),a=t??e?.dashboard;if(!a||n)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-32"}),r.jsx("div",{className:"skeleton-text-sm w-64"})]}),r.jsx("div",{className:"space-y-3",children:[1,2,3].map(v=>r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"skeleton-text w-36"}),r.jsx("div",{className:"skeleton-text-sm w-48"})]}),r.jsx("div",{className:"skeleton-text w-16"}),r.jsx("div",{className:"skeleton-text w-16"}),r.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},v))})]});const o=a.portfolioOverview,f=od(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},m=G4(o.systemHealth,f,a.settings),{openRun:p}=Zr();return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Portfolio"}),r.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),r.jsx("div",{className:"page-header-right",children:r.jsx("p",{className:"text-[11px] text-zinc-600",children:o.lastUpdatedAt})})]}),o.projects.length>0?r.jsx("div",{className:"project-list project-list-scrollable",children:o.projects.map(v=>r.jsx(V4,{project:v},v.project.id))}):r.jsxs(De,{className:"surface-card empty-card",children:[r.jsx("h3",{children:o.emptyState?.title??"No projects yet"}),r.jsx("p",{className:"supporting-copy",children:o.emptyState?.detail}),r.jsx(oe,{size:"sm",asChild:!0,children:r.jsx(St,{to:o.emptyState?.ctaHref==="/setup"||!o.emptyState?.ctaHref?"/setup":"/",children:o.emptyState?.ctaLabel??"Launch setup"})})]}),r.jsxs("div",{className:"overview-secondary-grid",children:[o.attentionItems.length>0&&r.jsxs("section",{className:"overview-secondary-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),r.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),r.jsx("div",{className:"attention-list attention-list-scrollable",children:o.attentionItems.map(v=>r.jsxs(St,{to:v.href,className:`attention-item attention-item-${v.tone}`,children:[r.jsxs("div",{children:[r.jsx("p",{className:"attention-title",children:v.title}),r.jsx("p",{className:"attention-detail",children:v.detail})]}),r.jsx("span",{className:"attention-action",children:v.actionLabel})]},v.id))})]}),r.jsxs("section",{className:"overview-secondary-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),r.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),r.jsx("div",{className:"compact-stack compact-stack-scrollable",children:o.recentRuns.length>0?o.recentRuns.map(v=>r.jsxs("button",{className:"compact-run",type:"button",onClick:()=>p(v.id),children:[r.jsxs("div",{children:[r.jsx("p",{className:"compact-run-title",children:v.projectName}),r.jsx("p",{className:"compact-run-detail",children:v.summary})]}),r.jsx(Wu,{status:v.status})]},v.id)):r.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),r.jsxs("section",{className:"page-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),r.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),r.jsx("div",{className:"health-grid",children:m.map(v=>r.jsxs(De,{className:"surface-card compact-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:v.label}),r.jsx("h3",{children:v.detail})]}),r.jsx(lt,{tone:v.tone,children:v.label})]}),r.jsx("p",{className:"supporting-copy",children:v.meta})]},v.id))})]})]})}const Gp=Symbol.for("yaml.alias"),Qm=Symbol.for("yaml.document"),Li=Symbol.for("yaml.map"),rN=Symbol.for("yaml.pair"),Ns=Symbol.for("yaml.scalar"),Vr=Symbol.for("yaml.seq"),Jn=Symbol.for("yaml.node.type"),La=e=>!!e&&typeof e=="object"&&e[Jn]===Gp,ld=e=>!!e&&typeof e=="object"&&e[Jn]===Qm,vl=e=>!!e&&typeof e=="object"&&e[Jn]===Li,Pt=e=>!!e&&typeof e=="object"&&e[Jn]===rN,pt=e=>!!e&&typeof e=="object"&&e[Jn]===Ns,xl=e=>!!e&&typeof e=="object"&&e[Jn]===Vr;function Mt(e){if(e&&typeof e=="object")switch(e[Jn]){case Li:case Vr:return!0}return!1}function $t(e){if(e&&typeof e=="object")switch(e[Jn]){case Gp:case Li:case Ns:case Vr:return!0}return!1}const oN=e=>(pt(e)||Mt(e))&&!!e.anchor,ha=Symbol("break visit"),Y4=Symbol("skip children"),el=Symbol("remove node");function Qr(e,t){const n=J4(t);ld(e)?Ar(null,e.contents,n,Object.freeze([e]))===el&&(e.contents=null):Ar(null,e,n,Object.freeze([]))}Qr.BREAK=ha;Qr.SKIP=Y4;Qr.REMOVE=el;function Ar(e,t,n,a){const o=X4(e,t,n,a);if($t(o)||Pt(o))return W4(e,a,o),Ar(e,o,n,a);if(typeof o!="symbol"){if(Mt(t)){a=Object.freeze(a.concat(t));for(let c=0;c<t.items.length;++c){const u=Ar(c,t.items[c],n,a);if(typeof u=="number")c=u-1;else{if(u===ha)return ha;u===el&&(t.items.splice(c,1),c-=1)}}}else if(Pt(t)){a=Object.freeze(a.concat(t));const c=Ar("key",t.key,n,a);if(c===ha)return ha;c===el&&(t.key=null);const u=Ar("value",t.value,n,a);if(u===ha)return ha;u===el&&(t.value=null)}}return o}function J4(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function X4(e,t,n,a){if(typeof n=="function")return n(e,t,a);if(vl(t))return n.Map?.(e,t,a);if(xl(t))return n.Seq?.(e,t,a);if(Pt(t))return n.Pair?.(e,t,a);if(pt(t))return n.Scalar?.(e,t,a);if(La(t))return n.Alias?.(e,t,a)}function W4(e,t,n){const a=t[t.length-1];if(Mt(a))a.items[e]=n;else if(Pt(a))e==="key"?a.key=n:a.value=n;else if(ld(a))a.contents=n;else{const o=La(a)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}const e3={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},t3=e=>e.replace(/[!,[\]{}]/g,t=>e3[t]);class fn{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},fn.defaultYaml,t),this.tags=Object.assign({},fn.defaultTags,n)}clone(){const t=new fn(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new fn(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:fn.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},fn.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:fn.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},fn.defaultTags),this.atNextDocument=!1);const a=t.trim().split(/[ \t]+/),o=a.shift();switch(o){case"%TAG":{if(a.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),a.length<2))return!1;const[c,u]=a;return this.tags[c]=u,!0}case"%YAML":{if(this.yaml.explicit=!0,a.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[c]=a;if(c==="1.1"||c==="1.2")return this.yaml.version=c,!0;{const u=/^\d+\.\d+$/.test(c);return n(6,`Unsupported YAML version ${c}`,u),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const u=t.slice(2,-1);return u==="!"||u==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),u)}const[,a,o]=t.match(/^(.*!)([^!]*)$/s);o||n(`The ${t} tag has no suffix`);const c=this.tags[a];if(c)try{return c+decodeURIComponent(o)}catch(u){return n(String(u)),null}return a==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,a]of Object.entries(this.tags))if(t.startsWith(a))return n+t3(t.substring(a.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],a=Object.entries(this.tags);let o;if(t&&a.length>0&&$t(t.contents)){const c={};Qr(t.contents,(u,f)=>{$t(f)&&f.tag&&(c[f.tag]=!0)}),o=Object.keys(c)}else o=[];for(const[c,u]of a)c==="!!"&&u==="tag:yaml.org,2002:"||(!t||o.some(f=>f.startsWith(u)))&&n.push(`%TAG ${c} ${u}`);return n.join(`
|
|
96
|
-
`)}}fn.defaultYaml={explicit:!1,version:"1.2"};fn.defaultTags={"!!":"tag:yaml.org,2002:"};function lN(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function cN(e){const t=new Set;return Qr(e,{Value(n,a){a.anchor&&t.add(a.anchor)}}),t}function uN(e,t){for(let n=1;;++n){const a=`${e}${n}`;if(!t.has(a))return a}}function n3(e,t){const n=[],a=new Map;let o=null;return{onAnchor:c=>{n.push(c),o??(o=cN(e));const u=uN(t,o);return o.add(u),u},setAnchors:()=>{for(const c of n){const u=a.get(c);if(typeof u=="object"&&u.anchor&&(pt(u.node)||Mt(u.node)))u.node.anchor=u.anchor;else{const f=new Error("Failed to resolve repeated object (this should not happen)");throw f.source=c,f}}},sourceObjects:a}}function Tr(e,t,n,a){if(a&&typeof a=="object")if(Array.isArray(a))for(let o=0,c=a.length;o<c;++o){const u=a[o],f=Tr(e,a,String(o),u);f===void 0?delete a[o]:f!==u&&(a[o]=f)}else if(a instanceof Map)for(const o of Array.from(a.keys())){const c=a.get(o),u=Tr(e,a,o,c);u===void 0?a.delete(o):u!==c&&a.set(o,u)}else if(a instanceof Set)for(const o of Array.from(a)){const c=Tr(e,a,o,o);c===void 0?a.delete(o):c!==o&&(a.delete(o),a.add(c))}else for(const[o,c]of Object.entries(a)){const u=Tr(e,a,o,c);u===void 0?delete a[o]:u!==c&&(a[o]=u)}return e.call(t,n,a)}function Yn(e,t,n){if(Array.isArray(e))return e.map((a,o)=>Yn(a,String(o),n));if(e&&typeof e.toJSON=="function"){if(!n||!oN(e))return e.toJSON(t,n);const a={aliasCount:0,count:1,res:void 0};n.anchors.set(e,a),n.onCreate=c=>{a.res=c,delete n.onCreate};const o=e.toJSON(t,n);return n.onCreate&&n.onCreate(o),o}return typeof e=="bigint"&&!n?.keep?Number(e):e}class Fp{constructor(t){Object.defineProperty(this,Jn,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:a,onAnchor:o,reviver:c}={}){if(!ld(t))throw new TypeError("A document argument is required");const u={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof a=="number"?a:100},f=Yn(this,"",u);if(typeof o=="function")for(const{count:m,res:p}of u.anchors.values())o(p,m);return typeof c=="function"?Tr(c,{"":f},"",f):f}}class Zp extends Fp{constructor(t){super(Gp),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let a;n?.aliasResolveCache?a=n.aliasResolveCache:(a=[],Qr(t,{Node:(c,u)=>{(La(u)||oN(u))&&a.push(u)}}),n&&(n.aliasResolveCache=a));let o;for(const c of a){if(c===this)break;c.anchor===this.source&&(o=c)}return o}toJSON(t,n){if(!n)return{source:this.source};const{anchors:a,doc:o,maxAliasCount:c}=n,u=this.resolve(o,n);if(!u){const m=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(m)}let f=a.get(u);if(f||(Yn(u,null,n),f=a.get(u)),f?.res===void 0){const m="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(m)}if(c>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=gu(o,u,a)),f.count*f.aliasCount>c)){const m="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(m)}return f.res}toString(t,n,a){const o=`*${this.source}`;if(t){if(lN(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(c)}if(t.implicitKey)return`${o} `}return o}}function gu(e,t,n){if(La(t)){const a=t.resolve(e),o=n&&a&&n.get(a);return o?o.count*o.aliasCount:0}else if(Mt(t)){let a=0;for(const o of t.items){const c=gu(e,o,n);c>a&&(a=c)}return a}else if(Pt(t)){const a=gu(e,t.key,n),o=gu(e,t.value,n);return Math.max(a,o)}return 1}const dN=e=>!e||typeof e!="function"&&typeof e!="object";class Te extends Fp{constructor(t){super(Ns),this.value=t}toJSON(t,n){return n?.keep?this.value:Yn(this.value,t,n)}toString(){return String(this.value)}}Te.BLOCK_FOLDED="BLOCK_FOLDED";Te.BLOCK_LITERAL="BLOCK_LITERAL";Te.PLAIN="PLAIN";Te.QUOTE_DOUBLE="QUOTE_DOUBLE";Te.QUOTE_SINGLE="QUOTE_SINGLE";const s3="tag:yaml.org,2002:";function i3(e,t,n){if(t){const a=n.filter(c=>c.tag===t),o=a.find(c=>!c.format)??a[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return n.find(a=>a.identify?.(e)&&!a.format)}function fl(e,t,n){if(ld(e)&&(e=e.contents),$t(e))return e;if(Pt(e)){const y=n.schema[Li].createNode?.(n.schema,null,n);return y.items.push(e),y}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:a,onAnchor:o,onTagObj:c,schema:u,sourceObjects:f}=n;let m;if(a&&e&&typeof e=="object"){if(m=f.get(e),m)return m.anchor??(m.anchor=o(e)),new Zp(m.anchor);m={anchor:null,node:null},f.set(e,m)}t?.startsWith("!!")&&(t=s3+t.slice(2));let p=i3(e,t,u.tags);if(!p){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const y=new Te(e);return m&&(m.node=y),y}p=e instanceof Map?u[Li]:Symbol.iterator in Object(e)?u[Vr]:u[Li]}c&&(c(p),delete n.onTagObj);const v=p?.createNode?p.createNode(n.schema,e,n):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(n.schema,e,n):new Te(e);return t?v.tag=t:p.default||(v.tag=p.tag),m&&(m.node=v),v}function Uu(e,t,n){let a=n;for(let o=t.length-1;o>=0;--o){const c=t[o];if(typeof c=="number"&&Number.isInteger(c)&&c>=0){const u=[];u[c]=a,a=u}else a=new Map([[c,a]])}return fl(a,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Jo=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class fN extends Fp{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(a=>$t(a)||Pt(a)?a.clone(t):a),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Jo(t))this.add(n);else{const[a,...o]=t,c=this.get(a,!0);if(Mt(c))c.addIn(o,n);else if(c===void 0&&this.schema)this.set(a,Uu(this.schema,o,n));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${o}`)}}deleteIn(t){const[n,...a]=t;if(a.length===0)return this.delete(n);const o=this.get(n,!0);if(Mt(o))return o.deleteIn(a);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${a}`)}getIn(t,n){const[a,...o]=t,c=this.get(a,!0);return o.length===0?!n&&pt(c)?c.value:c:Mt(c)?c.getIn(o,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Pt(n))return!1;const a=n.value;return a==null||t&&pt(a)&&a.value==null&&!a.commentBefore&&!a.comment&&!a.tag})}hasIn(t){const[n,...a]=t;if(a.length===0)return this.has(n);const o=this.get(n,!0);return Mt(o)?o.hasIn(a):!1}setIn(t,n){const[a,...o]=t;if(o.length===0)this.set(a,n);else{const c=this.get(a,!0);if(Mt(c))c.setIn(o,n);else if(c===void 0&&this.schema)this.set(a,Uu(this.schema,o,n));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${o}`)}}}const a3=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Zs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const va=(e,t,n)=>e.endsWith(`
|
|
97
|
-
`)?Zs(n,t):n.includes(`
|
|
98
|
-
`)?`
|
|
99
|
-
`+Zs(n,t):(e.endsWith(" ")?"":" ")+n,hN="flow",Ym="block",yu="quoted";function cd(e,t,n="flow",{indentAtStart:a,lineWidth:o=80,minContentWidth:c=20,onFold:u,onOverflow:f}={}){if(!o||o<0)return e;o<c&&(c=0);const m=Math.max(1+c,1+o-t.length);if(e.length<=m)return e;const p=[],v={};let y=o-t.length;typeof a=="number"&&(a>o-Math.max(2,c)?p.push(0):y=o-a);let x,b,N=!1,S=-1,C=-1,k=-1;n===Ym&&(S=eS(e,S,t.length),S!==-1&&(y=S+m));for(let R;R=e[S+=1];){if(n===yu&&R==="\\"){switch(C=S,e[S+1]){case"x":S+=3;break;case"u":S+=5;break;case"U":S+=9;break;default:S+=1}k=S}if(R===`
|
|
100
|
-
`)n===Ym&&(S=eS(e,S,t.length)),y=S+t.length+m,x=void 0;else{if(R===" "&&b&&b!==" "&&b!==`
|
|
101
|
-
`&&b!==" "){const z=e[S+1];z&&z!==" "&&z!==`
|
|
102
|
-
`&&z!==" "&&(x=S)}if(S>=y)if(x)p.push(x),y=x+m,x=void 0;else if(n===yu){for(;b===" "||b===" ";)b=R,R=e[S+=1],N=!0;const z=S>k+1?S-2:C-1;if(v[z])return e;p.push(z),v[z]=!0,y=z+m,x=void 0}else N=!0}b=R}if(N&&f&&f(),p.length===0)return e;u&&u();let A=e.slice(0,p[0]);for(let R=0;R<p.length;++R){const z=p[R],$=p[R+1]||e.length;z===0?A=`
|
|
103
|
-
${t}${e.slice(0,$)}`:(n===yu&&v[z]&&(A+=`${e[z]}\\`),A+=`
|
|
104
|
-
${t}${e.slice(z+1,$)}`)}return A}function eS(e,t,n){let a=t,o=t+1,c=e[o];for(;c===" "||c===" ";)if(t<o+n)c=e[++t];else{do c=e[++t];while(c&&c!==`
|
|
105
|
-
`);a=t,o=t+1,c=e[o]}return a}const ud=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),dd=e=>/^(%|---|\.\.\.)/m.test(e);function r3(e,t,n){if(!t||t<0)return!1;const a=t-n,o=e.length;if(o<=a)return!1;for(let c=0,u=0;c<o;++c)if(e[c]===`
|
|
106
|
-
`){if(c-u>a)return!0;if(u=c+1,o-u<=a)return!1}return!0}function tl(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:a}=t,o=t.options.doubleQuotedMinMultiLineLength,c=t.indent||(dd(e)?" ":"");let u="",f=0;for(let m=0,p=n[m];p;p=n[++m])if(p===" "&&n[m+1]==="\\"&&n[m+2]==="n"&&(u+=n.slice(f,m)+"\\ ",m+=1,f=m,p="\\"),p==="\\")switch(n[m+1]){case"u":{u+=n.slice(f,m);const v=n.substr(m+2,4);switch(v){case"0000":u+="\\0";break;case"0007":u+="\\a";break;case"000b":u+="\\v";break;case"001b":u+="\\e";break;case"0085":u+="\\N";break;case"00a0":u+="\\_";break;case"2028":u+="\\L";break;case"2029":u+="\\P";break;default:v.substr(0,2)==="00"?u+="\\x"+v.substr(2):u+=n.substr(m,6)}m+=5,f=m+1}break;case"n":if(a||n[m+2]==='"'||n.length<o)m+=1;else{for(u+=n.slice(f,m)+`
|
|
107
|
-
|
|
108
|
-
`;n[m+2]==="\\"&&n[m+3]==="n"&&n[m+4]!=='"';)u+=`
|
|
109
|
-
`,m+=2;u+=c,n[m+2]===" "&&(u+="\\"),m+=1,f=m+1}break;default:m+=1}return u=f?u+n.slice(f):n,a?u:cd(u,c,yu,ud(t,!1))}function Jm(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
110
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return tl(e,t);const n=t.indent||(dd(e)?" ":""),a="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
111
|
-
${n}`)+"'";return t.implicitKey?a:cd(a,n,hN,ud(t,!1))}function Or(e,t){const{singleQuote:n}=t.options;let a;if(n===!1)a=tl;else{const o=e.includes('"'),c=e.includes("'");o&&!c?a=Jm:c&&!o?a=tl:a=n?Jm:tl}return a(e,t)}let Xm;try{Xm=new RegExp(`(^|(?<!
|
|
112
|
-
))
|
|
113
|
-
+(?!
|
|
114
|
-
|$)`,"g")}catch{Xm=/\n+(?!\n|$)/g}function vu({comment:e,type:t,value:n},a,o,c){const{blockQuote:u,commentString:f,lineWidth:m}=a.options;if(!u||/\n[\t ]+$/.test(n))return Or(n,a);const p=a.indent||(a.forceBlockIndent||dd(n)?" ":""),v=u==="literal"?!0:u==="folded"||t===Te.BLOCK_FOLDED?!1:t===Te.BLOCK_LITERAL?!0:!r3(n,m,p.length);if(!n)return v?`|
|
|
115
|
-
`:`>
|
|
116
|
-
`;let y,x;for(x=n.length;x>0;--x){const $=n[x-1];if($!==`
|
|
117
|
-
`&&$!==" "&&$!==" ")break}let b=n.substring(x);const N=b.indexOf(`
|
|
118
|
-
`);N===-1?y="-":n===b||N!==b.length-1?(y="+",c&&c()):y="",b&&(n=n.slice(0,-b.length),b[b.length-1]===`
|
|
119
|
-
`&&(b=b.slice(0,-1)),b=b.replace(Xm,`$&${p}`));let S=!1,C,k=-1;for(C=0;C<n.length;++C){const $=n[C];if($===" ")S=!0;else if($===`
|
|
120
|
-
`)k=C;else break}let A=n.substring(0,k<C?k+1:C);A&&(n=n.substring(A.length),A=A.replace(/\n+/g,`$&${p}`));let z=(S?p?"2":"1":"")+y;if(e&&(z+=" "+f(e.replace(/ ?[\r\n]+/g," ")),o&&o()),!v){const $=n.replace(/\n+/g,`
|
|
121
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`);let P=!1;const E=ud(a,!0);u!=="folded"&&t!==Te.BLOCK_FOLDED&&(E.onOverflow=()=>{P=!0});const O=cd(`${A}${$}${b}`,p,Ym,E);if(!P)return`>${z}
|
|
122
|
-
${p}${O}`}return n=n.replace(/\n+/g,`$&${p}`),`|${z}
|
|
123
|
-
${p}${A}${n}${b}`}function o3(e,t,n,a){const{type:o,value:c}=e,{actualString:u,implicitKey:f,indent:m,indentStep:p,inFlow:v}=t;if(f&&c.includes(`
|
|
124
|
-
`)||v&&/[[\]{},]/.test(c))return Or(c,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(c))return f||v||!c.includes(`
|
|
125
|
-
`)?Or(c,t):vu(e,t,n,a);if(!f&&!v&&o!==Te.PLAIN&&c.includes(`
|
|
126
|
-
`))return vu(e,t,n,a);if(dd(c)){if(m==="")return t.forceBlockIndent=!0,vu(e,t,n,a);if(f&&m===p)return Or(c,t)}const y=c.replace(/\n+/g,`$&
|
|
127
|
-
${m}`);if(u){const x=S=>S.default&&S.tag!=="tag:yaml.org,2002:str"&&S.test?.test(y),{compat:b,tags:N}=t.doc.schema;if(N.some(x)||b?.some(x))return Or(c,t)}return f?y:cd(y,m,hN,ud(t,!1))}function Vp(e,t,n,a){const{implicitKey:o,inFlow:c}=t,u=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:f}=e;f!==Te.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(u.value)&&(f=Te.QUOTE_DOUBLE);const m=v=>{switch(v){case Te.BLOCK_FOLDED:case Te.BLOCK_LITERAL:return o||c?Or(u.value,t):vu(u,t,n,a);case Te.QUOTE_DOUBLE:return tl(u.value,t);case Te.QUOTE_SINGLE:return Jm(u.value,t);case Te.PLAIN:return o3(u,t,n,a);default:return null}};let p=m(f);if(p===null){const{defaultKeyType:v,defaultStringType:y}=t.options,x=o&&v||y;if(p=m(x),p===null)throw new Error(`Unsupported default string type ${x}`)}return p}function mN(e,t){const n=Object.assign({blockQuote:!0,commentString:a3,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let a;switch(n.collectionStyle){case"block":a=!1;break;case"flow":a=!0;break;default:a=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:a,options:n}}function l3(e,t){if(t.tag){const o=e.filter(c=>c.tag===t.tag);if(o.length>0)return o.find(c=>c.format===t.format)??o[0]}let n,a;if(pt(t)){a=t.value;let o=e.filter(c=>c.identify?.(a));if(o.length>1){const c=o.filter(u=>u.test);c.length>0&&(o=c)}n=o.find(c=>c.format===t.format)??o.find(c=>!c.format)}else a=t,n=e.find(o=>o.nodeClass&&a instanceof o.nodeClass);if(!n){const o=a?.constructor?.name??(a===null?"null":typeof a);throw new Error(`Tag not resolved for ${o} value`)}return n}function c3(e,t,{anchors:n,doc:a}){if(!a.directives)return"";const o=[],c=(pt(e)||Mt(e))&&e.anchor;c&&lN(c)&&(n.add(c),o.push(`&${c}`));const u=e.tag??(t.default?null:t.tag);return u&&o.push(a.directives.tagString(u)),o.join(" ")}function qr(e,t,n,a){if(Pt(e))return e.toString(t,n,a);if(La(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o;const c=$t(e)?e:t.doc.createNode(e,{onTagObj:m=>o=m});o??(o=l3(t.doc.schema.tags,c));const u=c3(c,o,t);u.length>0&&(t.indentAtStart=(t.indentAtStart??0)+u.length+1);const f=typeof o.stringify=="function"?o.stringify(c,t,n,a):pt(c)?Vp(c,t,n,a):c.toString(t,n,a);return u?pt(c)||f[0]==="{"||f[0]==="["?`${u} ${f}`:`${u}
|
|
128
|
-
${t.indent}${f}`:f}function u3({key:e,value:t},n,a,o){const{allNullValues:c,doc:u,indent:f,indentStep:m,options:{commentString:p,indentSeq:v,simpleKeys:y}}=n;let x=$t(e)&&e.comment||null;if(y){if(x)throw new Error("With simple keys, key nodes cannot have comments");if(Mt(e)||!$t(e)&&typeof e=="object"){const E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let b=!y&&(!e||x&&t==null&&!n.inFlow||Mt(e)||(pt(e)?e.type===Te.BLOCK_FOLDED||e.type===Te.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!b&&(y||!c),indent:f+m});let N=!1,S=!1,C=qr(e,n,()=>N=!0,()=>S=!0);if(!b&&!n.inFlow&&C.length>1024){if(y)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");b=!0}if(n.inFlow){if(c||t==null)return N&&a&&a(),C===""?"?":b?`? ${C}`:C}else if(c&&!y||t==null&&b)return C=`? ${C}`,x&&!N?C+=va(C,n.indent,p(x)):S&&o&&o(),C;N&&(x=null),b?(x&&(C+=va(C,n.indent,p(x))),C=`? ${C}
|
|
129
|
-
${f}:`):(C=`${C}:`,x&&(C+=va(C,n.indent,p(x))));let k,A,R;$t(t)?(k=!!t.spaceBefore,A=t.commentBefore,R=t.comment):(k=!1,A=null,R=null,t&&typeof t=="object"&&(t=u.createNode(t))),n.implicitKey=!1,!b&&!x&&pt(t)&&(n.indentAtStart=C.length+1),S=!1,!v&&m.length>=2&&!n.inFlow&&!b&&xl(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let z=!1;const $=qr(t,n,()=>z=!0,()=>S=!0);let P=" ";if(x||k||A){if(P=k?`
|
|
130
|
-
`:"",A){const E=p(A);P+=`
|
|
131
|
-
${Zs(E,n.indent)}`}$===""&&!n.inFlow?P===`
|
|
132
|
-
`&&R&&(P=`
|
|
133
|
-
|
|
134
|
-
`):P+=`
|
|
135
|
-
${n.indent}`}else if(!b&&Mt(t)){const E=$[0],O=$.indexOf(`
|
|
136
|
-
`),H=O!==-1,ee=n.inFlow??t.flow??t.items.length===0;if(H||!ee){let V=!1;if(H&&(E==="&"||E==="!")){let se=$.indexOf(" ");E==="&"&&se!==-1&&se<O&&$[se+1]==="!"&&(se=$.indexOf(" ",se+1)),(se===-1||O<se)&&(V=!0)}V||(P=`
|
|
137
|
-
${n.indent}`)}}else($===""||$[0]===`
|
|
138
|
-
`)&&(P="");return C+=P+$,n.inFlow?z&&a&&a():R&&!z?C+=va(C,n.indent,p(R)):S&&o&&o(),C}function d3(e,t){(e==="debug"||e==="warn")&&console.warn(t)}const tu="<<",Vs={identify:e=>e===tu||typeof e=="symbol"&&e.description===tu,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Te(Symbol(tu)),{addToJSMap:pN}),stringify:()=>tu},f3=(e,t)=>(Vs.identify(t)||pt(t)&&(!t.type||t.type===Te.PLAIN)&&Vs.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===Vs.tag&&n.default);function pN(e,t,n){if(n=e&&La(n)?n.resolve(e.doc):n,xl(n))for(const a of n.items)lm(e,t,a);else if(Array.isArray(n))for(const a of n)lm(e,t,a);else lm(e,t,n)}function lm(e,t,n){const a=e&&La(n)?n.resolve(e.doc):n;if(!vl(a))throw new Error("Merge sources must be maps or map aliases");const o=a.toJSON(null,e,Map);for(const[c,u]of o)t instanceof Map?t.has(c)||t.set(c,u):t instanceof Set?t.add(c):Object.prototype.hasOwnProperty.call(t,c)||Object.defineProperty(t,c,{value:u,writable:!0,enumerable:!0,configurable:!0});return t}function gN(e,t,{key:n,value:a}){if($t(n)&&n.addToJSMap)n.addToJSMap(e,t,a);else if(f3(e,n))pN(e,t,a);else{const o=Yn(n,"",e);if(t instanceof Map)t.set(o,Yn(a,o,e));else if(t instanceof Set)t.add(o);else{const c=h3(n,o,e),u=Yn(a,c,e);c in t?Object.defineProperty(t,c,{value:u,writable:!0,enumerable:!0,configurable:!0}):t[c]=u}}return t}function h3(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if($t(e)&&n?.doc){const a=mN(n.doc,{});a.anchors=new Set;for(const c of n.anchors.keys())a.anchors.add(c.anchor);a.inFlow=!0,a.inStringifyKey=!0;const o=e.toString(a);if(!n.mapKeyWarned){let c=JSON.stringify(o);c.length>40&&(c=c.substring(0,36)+'..."'),d3(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${c}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(t)}function Qp(e,t,n){const a=fl(e,void 0,n),o=fl(t,void 0,n);return new mn(a,o)}class mn{constructor(t,n=null){Object.defineProperty(this,Jn,{value:rN}),this.key=t,this.value=n}clone(t){let{key:n,value:a}=this;return $t(n)&&(n=n.clone(t)),$t(a)&&(a=a.clone(t)),new mn(n,a)}toJSON(t,n){const a=n?.mapAsMap?new Map:{};return gN(n,a,this)}toString(t,n,a){return t?.doc?u3(this,t,n,a):JSON.stringify(this)}}function yN(e,t,n){return(t.inFlow??e.flow?p3:m3)(e,t,n)}function m3({comment:e,items:t},n,{blockItemPrefix:a,flowChars:o,itemIndent:c,onChompKeep:u,onComment:f}){const{indent:m,options:{commentString:p}}=n,v=Object.assign({},n,{indent:c,type:null});let y=!1;const x=[];for(let N=0;N<t.length;++N){const S=t[N];let C=null;if($t(S))!y&&S.spaceBefore&&x.push(""),Iu(n,x,S.commentBefore,y),S.comment&&(C=S.comment);else if(Pt(S)){const A=$t(S.key)?S.key:null;A&&(!y&&A.spaceBefore&&x.push(""),Iu(n,x,A.commentBefore,y))}y=!1;let k=qr(S,v,()=>C=null,()=>y=!0);C&&(k+=va(k,c,p(C))),y&&C&&(y=!1),x.push(a+k)}let b;if(x.length===0)b=o.start+o.end;else{b=x[0];for(let N=1;N<x.length;++N){const S=x[N];b+=S?`
|
|
139
|
-
${m}${S}`:`
|
|
140
|
-
`}}return e?(b+=`
|
|
141
|
-
`+Zs(p(e),m),f&&f()):y&&u&&u(),b}function p3({items:e},t,{flowChars:n,itemIndent:a}){const{indent:o,indentStep:c,flowCollectionPadding:u,options:{commentString:f}}=t;a+=c;const m=Object.assign({},t,{indent:a,inFlow:!0,type:null});let p=!1,v=0;const y=[];for(let N=0;N<e.length;++N){const S=e[N];let C=null;if($t(S))S.spaceBefore&&y.push(""),Iu(t,y,S.commentBefore,!1),S.comment&&(C=S.comment);else if(Pt(S)){const A=$t(S.key)?S.key:null;A&&(A.spaceBefore&&y.push(""),Iu(t,y,A.commentBefore,!1),A.comment&&(p=!0));const R=$t(S.value)?S.value:null;R?(R.comment&&(C=R.comment),R.commentBefore&&(p=!0)):S.value==null&&A?.comment&&(C=A.comment)}C&&(p=!0);let k=qr(S,m,()=>C=null);N<e.length-1&&(k+=","),C&&(k+=va(k,a,f(C))),!p&&(y.length>v||k.includes(`
|
|
142
|
-
`))&&(p=!0),y.push(k),v=y.length}const{start:x,end:b}=n;if(y.length===0)return x+b;if(!p){const N=y.reduce((S,C)=>S+C.length+2,2);p=t.options.lineWidth>0&&N>t.options.lineWidth}if(p){let N=x;for(const S of y)N+=S?`
|
|
143
|
-
${c}${o}${S}`:`
|
|
144
|
-
`;return`${N}
|
|
145
|
-
${o}${b}`}else return`${x}${u}${y.join(" ")}${u}${b}`}function Iu({indent:e,options:{commentString:t}},n,a,o){if(a&&o&&(a=a.replace(/^\n+/,"")),a){const c=Zs(t(a),e);n.push(c.trimStart())}}function xa(e,t){const n=pt(t)?t.value:t;for(const a of e)if(Pt(a)&&(a.key===t||a.key===n||pt(a.key)&&a.key.value===n))return a}class Vn extends fN{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Li,t),this.items=[]}static from(t,n,a){const{keepUndefined:o,replacer:c}=a,u=new this(t),f=(m,p)=>{if(typeof c=="function")p=c.call(n,m,p);else if(Array.isArray(c)&&!c.includes(m))return;(p!==void 0||o)&&u.items.push(Qp(m,p,a))};if(n instanceof Map)for(const[m,p]of n)f(m,p);else if(n&&typeof n=="object")for(const m of Object.keys(n))f(m,n[m]);return typeof t.sortMapEntries=="function"&&u.items.sort(t.sortMapEntries),u}add(t,n){let a;Pt(t)?a=t:!t||typeof t!="object"||!("key"in t)?a=new mn(t,t?.value):a=new mn(t.key,t.value);const o=xa(this.items,a.key),c=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${a.key} already set`);pt(o.value)&&dN(a.value)?o.value.value=a.value:o.value=a.value}else if(c){const u=this.items.findIndex(f=>c(a,f)<0);u===-1?this.items.push(a):this.items.splice(u,0,a)}else this.items.push(a)}delete(t){const n=xa(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const o=xa(this.items,t)?.value;return(!n&&pt(o)?o.value:o)??void 0}has(t){return!!xa(this.items,t)}set(t,n){this.add(new mn(t,n),!0)}toJSON(t,n,a){const o=a?new a:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(const c of this.items)gN(n,o,c);return o}toString(t,n,a){if(!t)return JSON.stringify(this);for(const o of this.items)if(!Pt(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),yN(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:a,onComment:n})}}const Yr={collection:"map",default:!0,nodeClass:Vn,tag:"tag:yaml.org,2002:map",resolve(e,t){return vl(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Vn.from(e,t,n)};class Ea extends fN{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Vr,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=nu(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const a=nu(t);if(typeof a!="number")return;const o=this.items[a];return!n&&pt(o)?o.value:o}has(t){const n=nu(t);return typeof n=="number"&&n<this.items.length}set(t,n){const a=nu(t);if(typeof a!="number")throw new Error(`Expected a valid index, not ${t}.`);const o=this.items[a];pt(o)&&dN(n)?o.value=n:this.items[a]=n}toJSON(t,n){const a=[];n?.onCreate&&n.onCreate(a);let o=0;for(const c of this.items)a.push(Yn(c,String(o++),n));return a}toString(t,n,a){return t?yN(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:a,onComment:n}):JSON.stringify(this)}static from(t,n,a){const{replacer:o}=a,c=new this(t);if(n&&Symbol.iterator in Object(n)){let u=0;for(let f of n){if(typeof o=="function"){const m=n instanceof Set?f:String(u++);f=o.call(n,m,f)}c.items.push(fl(f,void 0,a))}}return c}}function nu(e){let t=pt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}const Jr={collection:"seq",default:!0,nodeClass:Ea,tag:"tag:yaml.org,2002:seq",resolve(e,t){return xl(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ea.from(e,t,n)},fd={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,a){return t=Object.assign({actualString:!0},t),Vp(e,t,n,a)}},hd={identify:e=>e==null,createNode:()=>new Te(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Te(null),stringify:({source:e},t)=>typeof e=="string"&&hd.test.test(e)?e:t.options.nullStr},Yp={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Te(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Yp.test.test(e)){const a=e[0]==="t"||e[0]==="T";if(t===a)return e}return t?n.options.trueStr:n.options.falseStr}};function hs({format:e,minFractionDigits:t,tag:n,value:a}){if(typeof a=="bigint")return String(a);const o=typeof a=="number"?a:Number(a);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let c=Object.is(a,-0)?"-0":JSON.stringify(a);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(c)){let u=c.indexOf(".");u<0&&(u=c.length,c+=".");let f=t-(c.length-u-1);for(;f-- >0;)c+="0"}return c}const vN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hs},xN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():hs(e)}},bN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Te(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:hs},md=e=>typeof e=="bigint"||Number.isInteger(e),Jp=(e,t,n,{intAsBigInt:a})=>a?BigInt(e):parseInt(e.substring(t),n);function SN(e,t,n){const{value:a}=e;return md(a)&&a>=0?n+a.toString(t):hs(e)}const jN={identify:e=>md(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Jp(e,2,8,n),stringify:e=>SN(e,8,"0o")},wN={identify:md,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Jp(e,0,10,n),stringify:hs},NN={identify:e=>md(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Jp(e,2,16,n),stringify:e=>SN(e,16,"0x")},g3=[Yr,Jr,fd,hd,Yp,jN,wN,NN,vN,xN,bN];function tS(e){return typeof e=="bigint"||Number.isInteger(e)}const su=({value:e})=>JSON.stringify(e),y3=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:su},{identify:e=>e==null,createNode:()=>new Te(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:su},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:su},{identify:tS,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>tS(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:su}],v3={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},x3=[Yr,Jr].concat(y3,v3),Xp={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),a=new Uint8Array(n.length);for(let o=0;o<n.length;++o)a[o]=n.charCodeAt(o);return a}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},a,o,c){if(!n)return"";const u=n;let f;if(typeof btoa=="function"){let m="";for(let p=0;p<u.length;++p)m+=String.fromCharCode(u[p]);f=btoa(m)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Te.BLOCK_LITERAL),t!==Te.QUOTE_DOUBLE){const m=Math.max(a.options.lineWidth-a.indent.length,a.options.minContentWidth),p=Math.ceil(f.length/m),v=new Array(p);for(let y=0,x=0;y<p;++y,x+=m)v[y]=f.substr(x,m);f=v.join(t===Te.BLOCK_LITERAL?`
|
|
146
|
-
`:" ")}return Vp({comment:e,type:t,value:f},a,o,c)}};function CN(e,t){if(xl(e))for(let n=0;n<e.items.length;++n){let a=e.items[n];if(!Pt(a)){if(vl(a)){a.items.length>1&&t("Each pair must have its own sequence indicator");const o=a.items[0]||new mn(new Te(null));if(a.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${a.commentBefore}
|
|
147
|
-
${o.key.commentBefore}`:a.commentBefore),a.comment){const c=o.value??o.key;c.comment=c.comment?`${a.comment}
|
|
148
|
-
${c.comment}`:a.comment}a=o}e.items[n]=Pt(a)?a:new mn(a)}}else t("Expected a sequence for this tag");return e}function kN(e,t,n){const{replacer:a}=n,o=new Ea(e);o.tag="tag:yaml.org,2002:pairs";let c=0;if(t&&Symbol.iterator in Object(t))for(let u of t){typeof a=="function"&&(u=a.call(t,String(c++),u));let f,m;if(Array.isArray(u))if(u.length===2)f=u[0],m=u[1];else throw new TypeError(`Expected [key, value] tuple: ${u}`);else if(u&&u instanceof Object){const p=Object.keys(u);if(p.length===1)f=p[0],m=u[f];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else f=u;o.items.push(Qp(f,m,n))}return o}const Wp={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:CN,createNode:kN};class Mr extends Ea{constructor(){super(),this.add=Vn.prototype.add.bind(this),this.delete=Vn.prototype.delete.bind(this),this.get=Vn.prototype.get.bind(this),this.has=Vn.prototype.has.bind(this),this.set=Vn.prototype.set.bind(this),this.tag=Mr.tag}toJSON(t,n){if(!n)return super.toJSON(t);const a=new Map;n?.onCreate&&n.onCreate(a);for(const o of this.items){let c,u;if(Pt(o)?(c=Yn(o.key,"",n),u=Yn(o.value,c,n)):c=Yn(o,"",n),a.has(c))throw new Error("Ordered maps must not include duplicate keys");a.set(c,u)}return a}static from(t,n,a){const o=kN(t,n,a),c=new this;return c.items=o.items,c}}Mr.tag="tag:yaml.org,2002:omap";const eg={collection:"seq",identify:e=>e instanceof Map,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=CN(e,t),a=[];for(const{key:o}of n.items)pt(o)&&(a.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):a.push(o.value));return Object.assign(new Mr,n)},createNode:(e,t,n)=>Mr.from(e,t,n)};function zN({value:e,source:t},n){return t&&(e?_N:EN).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const _N={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Te(!0),stringify:zN},EN={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Te(!1),stringify:zN},b3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hs},S3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():hs(e)}},j3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Te(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const a=e.substring(n+1).replace(/_/g,"");a[a.length-1]==="0"&&(t.minFractionDigits=a.length)}return t},stringify:hs},bl=e=>typeof e=="bigint"||Number.isInteger(e);function pd(e,t,n,{intAsBigInt:a}){const o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),a){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const u=BigInt(e);return o==="-"?BigInt(-1)*u:u}const c=parseInt(e,n);return o==="-"?-1*c:c}function tg(e,t,n){const{value:a}=e;if(bl(a)){const o=a.toString(t);return a<0?"-"+n+o.substr(1):n+o}return hs(e)}const w3={identify:bl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>pd(e,2,2,n),stringify:e=>tg(e,2,"0b")},N3={identify:bl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>pd(e,1,8,n),stringify:e=>tg(e,8,"0")},C3={identify:bl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>pd(e,0,10,n),stringify:hs},k3={identify:bl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>pd(e,2,16,n),stringify:e=>tg(e,16,"0x")};class $r extends Vn{constructor(t){super(t),this.tag=$r.tag}add(t){let n;Pt(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new mn(t.key,null):n=new mn(t,null),xa(this.items,n.key)||this.items.push(n)}get(t,n){const a=xa(this.items,t);return!n&&Pt(a)?pt(a.key)?a.key.value:a.key:a}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const a=xa(this.items,t);a&&!n?this.items.splice(this.items.indexOf(a),1):!a&&n&&this.items.push(new mn(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,a){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,a);throw new Error("Set items must all have null values")}static from(t,n,a){const{replacer:o}=a,c=new this(t);if(n&&Symbol.iterator in Object(n))for(let u of n)typeof o=="function"&&(u=o.call(n,u,u)),c.items.push(Qp(u,null,a));return c}}$r.tag="tag:yaml.org,2002:set";const ng={collection:"map",identify:e=>e instanceof Set,nodeClass:$r,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>$r.from(e,t,n),resolve(e,t){if(vl(e)){if(e.hasAllNullValues(!0))return Object.assign(new $r,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function sg(e,t){const n=e[0],a=n==="-"||n==="+"?e.substring(1):e,o=u=>t?BigInt(u):Number(u),c=a.replace(/_/g,"").split(":").reduce((u,f)=>u*o(60)+o(f),o(0));return n==="-"?o(-1)*c:c}function RN(e){let{value:t}=e,n=u=>u;if(typeof t=="bigint")n=u=>BigInt(u);else if(isNaN(t)||!isFinite(t))return hs(e);let a="";t<0&&(a="-",t*=n(-1));const o=n(60),c=[t%o];return t<60?c.unshift(0):(t=(t-c[0])/o,c.unshift(t%o),t>=60&&(t=(t-c[0])/o,c.unshift(t))),a+c.map(u=>String(u).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const AN={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>sg(e,n),stringify:RN},TN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>sg(e,!1),stringify:RN},gd={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(gd.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,a,o,c,u,f]=t.map(Number),m=t[7]?Number((t[7]+"00").substr(1,3)):0;let p=Date.UTC(n,a-1,o,c||0,u||0,f||0,m);const v=t[8];if(v&&v!=="Z"){let y=sg(v,!1);Math.abs(y)<30&&(y*=60),p-=6e4*y}return new Date(p)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},nS=[Yr,Jr,fd,hd,_N,EN,w3,N3,C3,k3,b3,S3,j3,Xp,Vs,eg,Wp,ng,AN,TN,gd],sS=new Map([["core",g3],["failsafe",[Yr,Jr,fd]],["json",x3],["yaml11",nS],["yaml-1.1",nS]]),iS={binary:Xp,bool:Yp,float:bN,floatExp:xN,floatNaN:vN,floatTime:TN,int:wN,intHex:NN,intOct:jN,intTime:AN,map:Yr,merge:Vs,null:hd,omap:eg,pairs:Wp,seq:Jr,set:ng,timestamp:gd},z3={"tag:yaml.org,2002:binary":Xp,"tag:yaml.org,2002:merge":Vs,"tag:yaml.org,2002:omap":eg,"tag:yaml.org,2002:pairs":Wp,"tag:yaml.org,2002:set":ng,"tag:yaml.org,2002:timestamp":gd};function cm(e,t,n){const a=sS.get(t);if(a&&!e)return n&&!a.includes(Vs)?a.concat(Vs):a.slice();let o=a;if(!o)if(Array.isArray(e))o=[];else{const c=Array.from(sS.keys()).filter(u=>u!=="yaml11").map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${c} or define customTags array`)}if(Array.isArray(e))for(const c of e)o=o.concat(c);else typeof e=="function"&&(o=e(o.slice()));return n&&(o=o.concat(Vs)),o.reduce((c,u)=>{const f=typeof u=="string"?iS[u]:u;if(!f){const m=JSON.stringify(u),p=Object.keys(iS).map(v=>JSON.stringify(v)).join(", ");throw new Error(`Unknown custom tag ${m}; use one of ${p}`)}return c.includes(f)||c.push(f),c},[])}const _3=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class ig{constructor({compat:t,customTags:n,merge:a,resolveKnownTags:o,schema:c,sortMapEntries:u,toStringDefaults:f}){this.compat=Array.isArray(t)?cm(t,"compat"):t?cm(null,t):null,this.name=typeof c=="string"&&c||"core",this.knownTags=o?z3:{},this.tags=cm(n,this.name,a),this.toStringOptions=f??null,Object.defineProperty(this,Li,{value:Yr}),Object.defineProperty(this,Ns,{value:fd}),Object.defineProperty(this,Vr,{value:Jr}),this.sortMapEntries=typeof u=="function"?u:u===!0?_3:null}clone(){const t=Object.create(ig.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function E3(e,t){const n=[];let a=t.directives===!0;if(t.directives!==!1&&e.directives){const m=e.directives.toString(e);m?(n.push(m),a=!0):e.directives.docStart&&(a=!0)}a&&n.push("---");const o=mN(e,t),{commentString:c}=o.options;if(e.commentBefore){n.length!==1&&n.unshift("");const m=c(e.commentBefore);n.unshift(Zs(m,""))}let u=!1,f=null;if(e.contents){if($t(e.contents)){if(e.contents.spaceBefore&&a&&n.push(""),e.contents.commentBefore){const v=c(e.contents.commentBefore);n.push(Zs(v,""))}o.forceBlockIndent=!!e.comment,f=e.contents.comment}const m=f?void 0:()=>u=!0;let p=qr(e.contents,o,()=>f=null,m);f&&(p+=va(p,"",c(f))),(p[0]==="|"||p[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${p}`:n.push(p)}else n.push(qr(e.contents,o));if(e.directives?.docEnd)if(e.comment){const m=c(e.comment);m.includes(`
|
|
149
|
-
`)?(n.push("..."),n.push(Zs(m,""))):n.push(`... ${m}`)}else n.push("...");else{let m=e.comment;m&&u&&(m=m.replace(/^\n+/,"")),m&&((!u||f)&&n[n.length-1]!==""&&n.push(""),n.push(Zs(c(m),"")))}return n.join(`
|
|
150
|
-
`)+`
|
|
151
|
-
`}class yd{constructor(t,n,a){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jn,{value:Qm});let o=null;typeof n=="function"||Array.isArray(n)?o=n:a===void 0&&n&&(a=n,n=void 0);const c=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},a);this.options=c;let{version:u}=c;a?._directives?(this.directives=a._directives.atDocument(),this.directives.yaml.explicit&&(u=this.directives.yaml.version)):this.directives=new fn({version:u}),this.setSchema(u,a),this.contents=t===void 0?null:this.createNode(t,o,a)}clone(){const t=Object.create(yd.prototype,{[Jn]:{value:Qm}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=$t(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){kr(this.contents)&&this.contents.add(t)}addIn(t,n){kr(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const a=cN(this);t.anchor=!n||a.has(n)?uN(n||"a",a):n}return new Zp(t.anchor)}createNode(t,n,a){let o;if(typeof n=="function")t=n.call({"":t},"",t),o=n;else if(Array.isArray(n)){const C=A=>typeof A=="number"||A instanceof String||A instanceof Number,k=n.filter(C).map(String);k.length>0&&(n=n.concat(k)),o=n}else a===void 0&&n&&(a=n,n=void 0);const{aliasDuplicateObjects:c,anchorPrefix:u,flow:f,keepUndefined:m,onTagObj:p,tag:v}=a??{},{onAnchor:y,setAnchors:x,sourceObjects:b}=n3(this,u||"a"),N={aliasDuplicateObjects:c??!0,keepUndefined:m??!1,onAnchor:y,onTagObj:p,replacer:o,schema:this.schema,sourceObjects:b},S=fl(t,v,N);return f&&Mt(S)&&(S.flow=!0),x(),S}createPair(t,n,a={}){const o=this.createNode(t,null,a),c=this.createNode(n,null,a);return new mn(o,c)}delete(t){return kr(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Jo(t)?this.contents==null?!1:(this.contents=null,!0):kr(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Mt(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Jo(t)?!n&&pt(this.contents)?this.contents.value:this.contents:Mt(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Mt(this.contents)?this.contents.has(t):!1}hasIn(t){return Jo(t)?this.contents!==void 0:Mt(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Uu(this.schema,[t],n):kr(this.contents)&&this.contents.set(t,n)}setIn(t,n){Jo(t)?this.contents=n:this.contents==null?this.contents=Uu(this.schema,Array.from(t),n):kr(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let a;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fn({version:"1.1"}),a={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new fn({version:t}),a={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,a=null;break;default:{const o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(a)this.schema=new ig(Object.assign(a,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:a,maxAliasCount:o,onAnchor:c,reviver:u}={}){const f={anchors:new Map,doc:this,keep:!t,mapAsMap:a===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},m=Yn(this.contents,n??"",f);if(typeof c=="function")for(const{count:p,res:v}of f.anchors.values())c(v,p);return typeof u=="function"?Tr(u,{"":m},"",m):m}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return E3(this,t)}}function kr(e){if(Mt(e))return!0;throw new Error("Expected a YAML collection as document contents")}class ON extends Error{constructor(t,n,a,o){super(),this.name=t,this.code=a,this.message=o,this.pos=n}}class iu extends ON{constructor(t,n,a){super("YAMLParseError",t,n,a)}}class R3 extends ON{constructor(t,n,a){super("YAMLWarning",t,n,a)}}const aS=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(f=>t.linePos(f));const{line:a,col:o}=n.linePos[0];n.message+=` at line ${a}, column ${o}`;let c=o-1,u=e.substring(t.lineStarts[a-1],t.lineStarts[a]).replace(/[\n\r]+$/,"");if(c>=60&&u.length>80){const f=Math.min(c-39,u.length-79);u="…"+u.substring(f),c-=f-1}if(u.length>80&&(u=u.substring(0,79)+"…"),a>1&&/^ *$/.test(u.substring(0,c))){let f=e.substring(t.lineStarts[a-2],t.lineStarts[a-1]);f.length>80&&(f=f.substring(0,79)+`…
|
|
152
|
-
`),u=f+u}if(/[^ ]/.test(u)){let f=1;const m=n.linePos[1];m?.line===a&&m.col>o&&(f=Math.max(1,Math.min(m.col-o,80-c)));const p=" ".repeat(c)+"^".repeat(f);n.message+=`:
|
|
153
|
-
|
|
154
|
-
${u}
|
|
155
|
-
${p}
|
|
156
|
-
`}};function Kr(e,{flow:t,indicator:n,next:a,offset:o,onError:c,parentIndent:u,startOnNewline:f}){let m=!1,p=f,v=f,y="",x="",b=!1,N=!1,S=null,C=null,k=null,A=null,R=null,z=null,$=null;for(const O of e)switch(N&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&c(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),N=!1),S&&(p&&O.type!=="comment"&&O.type!=="newline"&&c(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),S=null),O.type){case"space":!t&&(n!=="doc-start"||a?.type!=="flow-collection")&&O.source.includes(" ")&&(S=O),v=!0;break;case"comment":{v||c(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const H=O.source.substring(1)||" ";y?y+=x+H:y=H,x="",p=!1;break}case"newline":p?y?y+=O.source:(!z||n!=="seq-item-ind")&&(m=!0):x+=O.source,p=!0,b=!0,(C||k)&&(A=O),v=!0;break;case"anchor":C&&c(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&c(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),C=O,$??($=O.offset),p=!1,v=!1,N=!0;break;case"tag":{k&&c(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,$??($=O.offset),p=!1,v=!1,N=!0;break}case n:(C||k)&&c(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),z&&c(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${t??"collection"}`),z=O,p=n==="seq-item-ind"||n==="explicit-key-ind",v=!1;break;case"comma":if(t){R&&c(O,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),R=O,p=!1,v=!1;break}default:c(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,v=!1}const P=e[e.length-1],E=P?P.offset+P.source.length:o;return N&&a&&a.type!=="space"&&a.type!=="newline"&&a.type!=="comma"&&(a.type!=="scalar"||a.source!=="")&&c(a.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),S&&(p&&S.indent<=u||a?.type==="block-map"||a?.type==="block-seq")&&c(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:R,found:z,spaceBefore:m,comment:y,hasNewline:b,anchor:C,tag:k,newlineAfterProp:A,end:E,start:$??E}}function hl(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
157
|
-
`))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(hl(t.key)||hl(t.value))return!0}return!1;default:return!0}}function Wm(e,t,n){if(t?.type==="flow-collection"){const a=t.end[0];a.indent===e&&(a.source==="]"||a.source==="}")&&hl(t)&&n(a,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function DN(e,t,n){const{uniqueKeys:a}=e.options;if(a===!1)return!1;const o=typeof a=="function"?a:(c,u)=>c===u||pt(c)&&pt(u)&&c.value===u.value;return t.some(c=>o(c.key,n))}const rS="All mapping items must start at the same column";function A3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=c?.nodeClass??Vn,f=new u(n.schema);n.atRoot&&(n.atRoot=!1);let m=a.offset,p=null;for(const v of a.items){const{start:y,key:x,sep:b,value:N}=v,S=Kr(y,{indicator:"explicit-key-ind",next:x??b?.[0],offset:m,onError:o,parentIndent:a.indent,startOnNewline:!0}),C=!S.found;if(C){if(x&&(x.type==="block-seq"?o(m,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in x&&x.indent!==a.indent&&o(m,"BAD_INDENT",rS)),!S.anchor&&!S.tag&&!b){p=S.end,S.comment&&(f.comment?f.comment+=`
|
|
158
|
-
`+S.comment:f.comment=S.comment);continue}(S.newlineAfterProp||hl(x))&&o(x??y[y.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else S.found?.indent!==a.indent&&o(m,"BAD_INDENT",rS);n.atKey=!0;const k=S.end,A=x?e(n,x,S,o):t(n,k,y,null,S,o);n.schema.compat&&Wm(a.indent,x,o),n.atKey=!1,DN(n,f.items,A)&&o(k,"DUPLICATE_KEY","Map keys must be unique");const R=Kr(b??[],{indicator:"map-value-ind",next:N,offset:A.range[2],onError:o,parentIndent:a.indent,startOnNewline:!x||x.type==="block-scalar"});if(m=R.end,R.found){C&&(N?.type==="block-map"&&!R.hasNewline&&o(m,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&S.start<R.found.offset-1024&&o(A.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const z=N?e(n,N,R,o):t(n,m,b,null,R,o);n.schema.compat&&Wm(a.indent,N,o),m=z.range[2];const $=new mn(A,z);n.options.keepSourceTokens&&($.srcToken=v),f.items.push($)}else{C&&o(A.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),R.comment&&(A.comment?A.comment+=`
|
|
159
|
-
`+R.comment:A.comment=R.comment);const z=new mn(A);n.options.keepSourceTokens&&(z.srcToken=v),f.items.push(z)}}return p&&p<m&&o(p,"IMPOSSIBLE","Map comment with trailing content"),f.range=[a.offset,m,p??m],f}function T3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=c?.nodeClass??Ea,f=new u(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=a.offset,p=null;for(const{start:v,value:y}of a.items){const x=Kr(v,{indicator:"seq-item-ind",next:y,offset:m,onError:o,parentIndent:a.indent,startOnNewline:!0});if(!x.found)if(x.anchor||x.tag||y)y?.type==="block-seq"?o(x.end,"BAD_INDENT","All sequence items must start at the same column"):o(m,"MISSING_CHAR","Sequence item without - indicator");else{p=x.end,x.comment&&(f.comment=x.comment);continue}const b=y?e(n,y,x,o):t(n,x.end,v,null,x,o);n.schema.compat&&Wm(a.indent,y,o),m=b.range[2],f.items.push(b)}return f.range=[a.offset,m,p??m],f}function Sl(e,t,n,a){let o="";if(e){let c=!1,u="";for(const f of e){const{source:m,type:p}=f;switch(p){case"space":c=!0;break;case"comment":{n&&!c&&a(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const v=m.substring(1)||" ";o?o+=u+v:o=v,u="";break}case"newline":o&&(u+=m),c=!0;break;default:a(f,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}t+=m.length}}return{comment:o,offset:t}}const um="Block collections are not allowed within flow collections",dm=e=>e&&(e.type==="block-map"||e.type==="block-seq");function O3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=a.start.source==="{",f=u?"flow map":"flow sequence",m=c?.nodeClass??(u?Vn:Ea),p=new m(n.schema);p.flow=!0;const v=n.atRoot;v&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let y=a.offset+a.start.source.length;for(let C=0;C<a.items.length;++C){const k=a.items[C],{start:A,key:R,sep:z,value:$}=k,P=Kr(A,{flow:f,indicator:"explicit-key-ind",next:R??z?.[0],offset:y,onError:o,parentIndent:a.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!z&&!$){C===0&&P.comma?o(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`):C<a.items.length-1&&o(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${f}`),P.comment&&(p.comment?p.comment+=`
|
|
160
|
-
`+P.comment:p.comment=P.comment),y=P.end;continue}!u&&n.options.strict&&hl(R)&&o(R,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(C===0)P.comma&&o(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`);else if(P.comma||o(P.start,"MISSING_CHAR",`Missing , between ${f} items`),P.comment){let E="";e:for(const O of A)switch(O.type){case"comma":case"space":break;case"comment":E=O.source.substring(1);break e;default:break e}if(E){let O=p.items[p.items.length-1];Pt(O)&&(O=O.value??O.key),O.comment?O.comment+=`
|
|
161
|
-
`+E:O.comment=E,P.comment=P.comment.substring(E.length+1)}}if(!u&&!z&&!P.found){const E=$?e(n,$,P,o):t(n,P.end,z,null,P,o);p.items.push(E),y=E.range[2],dm($)&&o(E.range,"BLOCK_IN_FLOW",um)}else{n.atKey=!0;const E=P.end,O=R?e(n,R,P,o):t(n,E,A,null,P,o);dm(R)&&o(O.range,"BLOCK_IN_FLOW",um),n.atKey=!1;const H=Kr(z??[],{flow:f,indicator:"map-value-ind",next:$,offset:O.range[2],onError:o,parentIndent:a.indent,startOnNewline:!1});if(H.found){if(!u&&!P.found&&n.options.strict){if(z)for(const se of z){if(se===H.found)break;if(se.type==="newline"){o(se,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<H.found.offset-1024&&o(H.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else $&&("source"in $&&$.source?.[0]===":"?o($,"MISSING_CHAR",`Missing space after : in ${f}`):o(H.start,"MISSING_CHAR",`Missing , or : between ${f} items`));const ee=$?e(n,$,H,o):H.found?t(n,H.end,z,null,H,o):null;ee?dm($)&&o(ee.range,"BLOCK_IN_FLOW",um):H.comment&&(O.comment?O.comment+=`
|
|
162
|
-
`+H.comment:O.comment=H.comment);const V=new mn(O,ee);if(n.options.keepSourceTokens&&(V.srcToken=k),u){const se=p;DN(n,se.items,O)&&o(E,"DUPLICATE_KEY","Map keys must be unique"),se.items.push(V)}else{const se=new Vn(n.schema);se.flow=!0,se.items.push(V);const ue=(ee??O).range;se.range=[O.range[0],ue[1],ue[2]],p.items.push(se)}y=ee?ee.range[2]:H.end}}const x=u?"}":"]",[b,...N]=a.end;let S=y;if(b?.source===x)S=b.offset+b.source.length;else{const C=f[0].toUpperCase()+f.substring(1),k=v?`${C} must end with a ${x}`:`${C} in block collection must be sufficiently indented and end with a ${x}`;o(y,v?"MISSING_CHAR":"BAD_INDENT",k),b&&b.source.length!==1&&N.unshift(b)}if(N.length>0){const C=Sl(N,S,n.options.strict,o);C.comment&&(p.comment?p.comment+=`
|
|
163
|
-
`+C.comment:p.comment=C.comment),p.range=[a.offset,S,C.offset]}else p.range=[a.offset,S,S];return p}function fm(e,t,n,a,o,c){const u=n.type==="block-map"?A3(e,t,n,a,c):n.type==="block-seq"?T3(e,t,n,a,c):O3(e,t,n,a,c),f=u.constructor;return o==="!"||o===f.tagName?(u.tag=f.tagName,u):(o&&(u.tag=o),u)}function D3(e,t,n,a,o){const c=a.tag,u=c?t.directives.tagName(c.source,x=>o(c,"TAG_RESOLVE_FAILED",x)):null;if(n.type==="block-seq"){const{anchor:x,newlineAfterProp:b}=a,N=x&&c?x.offset>c.offset?x:c:x??c;N&&(!b||b.offset<N.offset)&&o(N,"MISSING_CHAR","Missing newline after block sequence props")}const f=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!c||!u||u==="!"||u===Vn.tagName&&f==="map"||u===Ea.tagName&&f==="seq")return fm(e,t,n,o,u);let m=t.schema.tags.find(x=>x.tag===u&&x.collection===f);if(!m){const x=t.schema.knownTags[u];if(x?.collection===f)t.schema.tags.push(Object.assign({},x,{default:!1})),m=x;else return x?o(c,"BAD_COLLECTION_TYPE",`${x.tag} used for ${f} collection, but expects ${x.collection??"scalar"}`,!0):o(c,"TAG_RESOLVE_FAILED",`Unresolved tag: ${u}`,!0),fm(e,t,n,o,u)}const p=fm(e,t,n,o,u,m),v=m.resolve?.(p,x=>o(c,"TAG_RESOLVE_FAILED",x),t.options)??p,y=$t(v)?v:new Te(v);return y.range=p.range,y.tag=u,m?.format&&(y.format=m.format),y}function L3(e,t,n){const a=t.offset,o=M3(t,e.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[a,a,a]};const c=o.mode===">"?Te.BLOCK_FOLDED:Te.BLOCK_LITERAL,u=t.source?$3(t.source):[];let f=u.length;for(let S=u.length-1;S>=0;--S){const C=u[S][1];if(C===""||C==="\r")f=S;else break}if(f===0){const S=o.chomp==="+"&&u.length>0?`
|
|
164
|
-
`.repeat(Math.max(1,u.length-1)):"";let C=a+o.length;return t.source&&(C+=t.source.length),{value:S,type:c,comment:o.comment,range:[a,C,C]}}let m=t.indent+o.indent,p=t.offset+o.length,v=0;for(let S=0;S<f;++S){const[C,k]=u[S];if(k===""||k==="\r")o.indent===0&&C.length>m&&(m=C.length);else{C.length<m&&n(p+C.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(m=C.length),v=S,m===0&&!e.atRoot&&n(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=C.length+k.length+1}for(let S=u.length-1;S>=f;--S)u[S][0].length>m&&(f=S+1);let y="",x="",b=!1;for(let S=0;S<v;++S)y+=u[S][0].slice(m)+`
|
|
165
|
-
`;for(let S=v;S<f;++S){let[C,k]=u[S];p+=C.length+k.length+1;const A=k[k.length-1]==="\r";if(A&&(k=k.slice(0,-1)),k&&C.length<m){const z=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(p-k.length-(A?2:1),"BAD_INDENT",z),C=""}c===Te.BLOCK_LITERAL?(y+=x+C.slice(m)+k,x=`
|
|
166
|
-
`):C.length>m||k[0]===" "?(x===" "?x=`
|
|
167
|
-
`:!b&&x===`
|
|
168
|
-
`&&(x=`
|
|
169
|
-
|
|
170
|
-
`),y+=x+C.slice(m)+k,x=`
|
|
171
|
-
`,b=!0):k===""?x===`
|
|
172
|
-
`?y+=`
|
|
173
|
-
`:x=`
|
|
174
|
-
`:(y+=x+k,x=" ",b=!1)}switch(o.chomp){case"-":break;case"+":for(let S=f;S<u.length;++S)y+=`
|
|
175
|
-
`+u[S][0].slice(m);y[y.length-1]!==`
|
|
176
|
-
`&&(y+=`
|
|
177
|
-
`);break;default:y+=`
|
|
178
|
-
`}const N=a+o.length+t.source.length;return{value:y,type:c,comment:o.comment,range:[a,N,N]}}function M3({offset:e,props:t},n,a){if(t[0].type!=="block-scalar-header")return a(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:o}=t[0],c=o[0];let u=0,f="",m=-1;for(let x=1;x<o.length;++x){const b=o[x];if(!f&&(b==="-"||b==="+"))f=b;else{const N=Number(b);!u&&N?u=N:m===-1&&(m=e+x)}}m!==-1&&a(m,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let p=!1,v="",y=o.length;for(let x=1;x<t.length;++x){const b=t[x];switch(b.type){case"space":p=!0;case"newline":y+=b.source.length;break;case"comment":n&&!p&&a(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),y+=b.source.length,v=b.source.substring(1);break;case"error":a(b,"UNEXPECTED_TOKEN",b.message),y+=b.source.length;break;default:{const N=`Unexpected token in block scalar header: ${b.type}`;a(b,"UNEXPECTED_TOKEN",N);const S=b.source;S&&typeof S=="string"&&(y+=S.length)}}}return{mode:c,indent:u,chomp:f,comment:v,length:y}}function $3(e){const t=e.split(/\n( *)/),n=t[0],a=n.match(/^( *)/),c=[a?.[1]?[a[1],n.slice(a[1].length)]:["",n]];for(let u=1;u<t.length;u+=2)c.push([t[u],t[u+1]]);return c}function P3(e,t,n){const{offset:a,type:o,source:c,end:u}=e;let f,m;const p=(x,b,N)=>n(a+x,b,N);switch(o){case"scalar":f=Te.PLAIN,m=U3(c,p);break;case"single-quoted-scalar":f=Te.QUOTE_SINGLE,m=I3(c,p);break;case"double-quoted-scalar":f=Te.QUOTE_DOUBLE,m=B3(c,p);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[a,a+c.length,a+c.length]}}const v=a+c.length,y=Sl(u,v,t,n);return{value:m,type:f,comment:y.comment,range:[a,v,y.offset]}}function U3(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),LN(e)}function I3(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),LN(e.slice(1,-1)).replace(/''/g,"'")}function LN(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
179
|
-
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
180
|
-
`,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let a=t.exec(e);if(!a)return e;let o=a[1],c=" ",u=t.lastIndex;for(n.lastIndex=u;a=n.exec(e);)a[1]===""?c===`
|
|
181
|
-
`?o+=c:c=`
|
|
182
|
-
`:(o+=c+a[1],c=" "),u=n.lastIndex;const f=/[ \t]*(.*)/sy;return f.lastIndex=u,a=f.exec(e),o+c+(a?.[1]??"")}function B3(e,t){let n="";for(let a=1;a<e.length-1;++a){const o=e[a];if(!(o==="\r"&&e[a+1]===`
|
|
183
|
-
`))if(o===`
|
|
184
|
-
`){const{fold:c,offset:u}=q3(e,a);n+=c,a=u}else if(o==="\\"){let c=e[++a];const u=K3[c];if(u)n+=u;else if(c===`
|
|
185
|
-
`)for(c=e[a+1];c===" "||c===" ";)c=e[++a+1];else if(c==="\r"&&e[a+1]===`
|
|
186
|
-
`)for(c=e[++a+1];c===" "||c===" ";)c=e[++a+1];else if(c==="x"||c==="u"||c==="U"){const f={x:2,u:4,U:8}[c];n+=H3(e,a+1,f,t),a+=f}else{const f=e.substr(a-1,2);t(a-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${f}`),n+=f}}else if(o===" "||o===" "){const c=a;let u=e[a+1];for(;u===" "||u===" ";)u=e[++a+1];u!==`
|
|
187
|
-
`&&!(u==="\r"&&e[a+2]===`
|
|
188
|
-
`)&&(n+=a>c?e.slice(c,a+1):o)}else n+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function q3(e,t){let n="",a=e[t+1];for(;(a===" "||a===" "||a===`
|
|
189
|
-
`||a==="\r")&&!(a==="\r"&&e[t+2]!==`
|
|
190
|
-
`);)a===`
|
|
191
|
-
`&&(n+=`
|
|
192
|
-
`),t+=1,a=e[t+1];return n||(n=" "),{fold:n,offset:t}}const K3={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
193
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function H3(e,t,n,a){const o=e.substr(t,n),u=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;if(isNaN(u)){const f=e.substr(t-2,n+2);return a(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${f}`),f}return String.fromCodePoint(u)}function MN(e,t,n,a){const{value:o,type:c,comment:u,range:f}=t.type==="block-scalar"?L3(e,t,a):P3(t,e.options.strict,a),m=n?e.directives.tagName(n.source,y=>a(n,"TAG_RESOLVE_FAILED",y)):null;let p;e.options.stringKeys&&e.atKey?p=e.schema[Ns]:m?p=G3(e.schema,o,m,n,a):t.type==="scalar"?p=F3(e,o,t,a):p=e.schema[Ns];let v;try{const y=p.resolve(o,x=>a(n??t,"TAG_RESOLVE_FAILED",x),e.options);v=pt(y)?y:new Te(y)}catch(y){const x=y instanceof Error?y.message:String(y);a(n??t,"TAG_RESOLVE_FAILED",x),v=new Te(o)}return v.range=f,v.source=o,c&&(v.type=c),m&&(v.tag=m),p.format&&(v.format=p.format),u&&(v.comment=u),v}function G3(e,t,n,a,o){if(n==="!")return e[Ns];const c=[];for(const f of e.tags)if(!f.collection&&f.tag===n)if(f.default&&f.test)c.push(f);else return f;for(const f of c)if(f.test?.test(t))return f;const u=e.knownTags[n];return u&&!u.collection?(e.tags.push(Object.assign({},u,{default:!1,test:void 0})),u):(o(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ns])}function F3({atKey:e,directives:t,schema:n},a,o,c){const u=n.tags.find(f=>(f.default===!0||e&&f.default==="key")&&f.test?.test(a))||n[Ns];if(n.compat){const f=n.compat.find(m=>m.default&&m.test?.test(a))??n[Ns];if(u.tag!==f.tag){const m=t.tagString(u.tag),p=t.tagString(f.tag),v=`Value may be parsed as either ${m} or ${p}`;c(o,"TAG_RESOLVE_FAILED",v,!0)}}return u}function Z3(e,t,n){if(t){n??(n=t.length);for(let a=n-1;a>=0;--a){let o=t[a];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++a];o?.type==="space";)e+=o.source.length,o=t[++a];break}}return e}const V3={composeNode:$N,composeEmptyNode:ag};function $N(e,t,n,a){const o=e.atKey,{spaceBefore:c,comment:u,anchor:f,tag:m}=n;let p,v=!0;switch(t.type){case"alias":p=Q3(e,t,a),(f||m)&&a(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=MN(e,t,m,a),f&&(p.anchor=f.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":p=D3(V3,e,t,n,a),f&&(p.anchor=f.source.substring(1));break;default:{const y=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;a(t,"UNEXPECTED_TOKEN",y),p=ag(e,t.offset,void 0,null,n,a),v=!1}}return f&&p.anchor===""&&a(f,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!pt(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&a(m??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),c&&(p.spaceBefore=!0),u&&(t.type==="scalar"&&t.source===""?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&v&&(p.srcToken=t),p}function ag(e,t,n,a,{spaceBefore:o,comment:c,anchor:u,tag:f,end:m},p){const v={type:"scalar",offset:Z3(t,n,a),indent:-1,source:""},y=MN(e,v,f,p);return u&&(y.anchor=u.source.substring(1),y.anchor===""&&p(u,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(y.spaceBefore=!0),c&&(y.comment=c,y.range[2]=m),y}function Q3({options:e},{offset:t,source:n,end:a},o){const c=new Zp(n.substring(1));c.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),c.source.endsWith(":")&&o(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const u=t+n.length,f=Sl(a,u,e.strict,o);return c.range=[t,u,f.offset],f.comment&&(c.comment=f.comment),c}function Y3(e,t,{offset:n,start:a,value:o,end:c},u){const f=Object.assign({_directives:t},e),m=new yd(void 0,f),p={atKey:!1,atRoot:!0,directives:m.directives,options:m.options,schema:m.schema},v=Kr(a,{indicator:"doc-start",next:o??c?.[0],offset:n,onError:u,parentIndent:0,startOnNewline:!0});v.found&&(m.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!v.hasNewline&&u(v.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),m.contents=o?$N(p,o,v,u):ag(p,v.end,a,null,v,u);const y=m.contents.range[2],x=Sl(c,y,!1,u);return x.comment&&(m.comment=x.comment),m.range=[n,y,x.offset],m}function Qo(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function oS(e){let t="",n=!1,a=!1;for(let o=0;o<e.length;++o){const c=e[o];switch(c[0]){case"#":t+=(t===""?"":a?`
|
|
194
|
-
|
|
195
|
-
`:`
|
|
196
|
-
`)+(c.substring(1)||" "),n=!0,a=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(a=!0),n=!1}}return{comment:t,afterEmptyLine:a}}class J3{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,a,o,c)=>{const u=Qo(n);c?this.warnings.push(new R3(u,a,o)):this.errors.push(new iu(u,a,o))},this.directives=new fn({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:a,afterEmptyLine:o}=oS(this.prelude);if(a){const c=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
197
|
-
${a}`:a;else if(o||t.directives.docStart||!c)t.commentBefore=a;else if(Mt(c)&&!c.flow&&c.items.length>0){let u=c.items[0];Pt(u)&&(u=u.key);const f=u.commentBefore;u.commentBefore=f?`${a}
|
|
198
|
-
${f}`:a}else{const u=c.commentBefore;c.commentBefore=u?`${a}
|
|
199
|
-
${u}`:a}}n?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:oS(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,a=-1){for(const o of t)yield*this.next(o);yield*this.end(n,a)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,a,o)=>{const c=Qo(t);c[0]+=n,this.onError(c,"BAD_DIRECTIVE",a,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=Y3(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,a=new iu(Qo(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(a):this.doc.errors.push(a);break}case"doc-end":{if(!this.doc){const a="Unexpected doc-end without preceding document";this.errors.push(new iu(Qo(t),"UNEXPECTED_TOKEN",a));break}this.doc.directives.docEnd=!0;const n=Sl(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const a=this.doc.comment;this.doc.comment=a?`${a}
|
|
200
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new iu(Qo(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const a=Object.assign({_directives:this.directives},this.options),o=new yd(void 0,a);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}}const PN="\uFEFF",UN="",IN="",ep="";function X3(e){switch(e){case PN:return"byte-order-mark";case UN:return"doc-mode";case IN:return"flow-error-end";case ep:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
201
|
-
`:case`\r
|
|
202
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function os(e){switch(e){case void 0:case" ":case`
|
|
203
|
-
`:case"\r":case" ":return!0;default:return!1}}const lS=new Set("0123456789ABCDEFabcdef"),W3=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),au=new Set(",[]{}"),e$=new Set(` ,[]{}
|
|
204
|
-
\r `),hm=e=>!e||e$.has(e);class t${constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let a=this.next??"stream";for(;a&&(n||this.hasChars(1));)a=yield*this.parseNext(a)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
205
|
-
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
206
|
-
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let a=0;for(;n===" ";)n=this.buffer[++a+t];if(n==="\r"){const o=this.buffer[a+t+1];if(o===`
|
|
207
|
-
`||!o&&!this.atEnd)return t+a+1}return n===`
|
|
208
|
-
`||a>=this.indentNext||!n&&!this.atEnd?t+a:-1}if(n==="-"||n==="."){const a=this.buffer.substr(t,3);if((a==="---"||a==="...")&&os(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
209
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===PN&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,a=t.indexOf("#");for(;a!==-1;){const c=t[a-1];if(c===" "||c===" "){n=a-1;break}else a=t.indexOf("#",a+1)}for(;;){const c=t[n-1];if(c===" "||c===" ")n-=1;else break}const o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield UN,yield*this.parseLineStart()}*parseLineStart(){const t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&os(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!os(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&os(n)){const a=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=a,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(hm),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,a=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=a=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const o=this.getLine();if(o===null)return this.setNext("flow");if((a!==-1&&a<this.indentNext&&o[0]!=="#"||a===0&&(o.startsWith("---")||o.startsWith("..."))&&os(o[3]))&&!(a===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield IN,yield*this.parseLineStart();let c=0;for(;o[c]===",";)c+=yield*this.pushCount(1),c+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(c+=yield*this.pushIndicators(),o[c]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-c),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(hm),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const u=this.charAt(1);if(this.flowKey||os(u)||u===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const t=this.charAt(0);let n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let c=0;for(;this.buffer[n-1-c]==="\\";)c+=1;if(c%2===0)break;n=this.buffer.indexOf('"',n+1)}const a=this.buffer.substring(0,n);let o=a.indexOf(`
|
|
210
|
-
`,this.pos);if(o!==-1){for(;o!==-1;){const c=this.continueScalar(o+1);if(c===-1)break;o=a.indexOf(`
|
|
211
|
-
`,c)}o!==-1&&(n=o-(a[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>os(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,a;e:for(let c=this.pos;a=this.buffer[c];++c)switch(a){case" ":n+=1;break;case`
|
|
212
|
-
`:t=c,n=0;break;case"\r":{const u=this.buffer[c+1];if(!u&&!this.atEnd)return this.setNext("block-scalar");if(u===`
|
|
213
|
-
`)break}default:break e}if(!a&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const c=this.continueScalar(t+1);if(c===-1)break;t=this.buffer.indexOf(`
|
|
214
|
-
`,c)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let o=t+1;for(a=this.buffer[o];a===" ";)a=this.buffer[++o];if(a===" "){for(;a===" "||a===" "||a==="\r"||a===`
|
|
215
|
-
`;)a=this.buffer[++o];t=o-1}else if(!this.blockScalarKeep)do{let c=t-1,u=this.buffer[c];u==="\r"&&(u=this.buffer[--c]);const f=c;for(;u===" ";)u=this.buffer[--c];if(u===`
|
|
216
|
-
`&&c>=this.pos&&c+1+n>f)t=c;else break}while(!0);return yield ep,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,a=this.pos-1,o;for(;o=this.buffer[++a];)if(o===":"){const c=this.buffer[a+1];if(os(c)||t&&au.has(c))break;n=a}else if(os(o)){let c=this.buffer[a+1];if(o==="\r"&&(c===`
|
|
217
|
-
`?(a+=1,o=`
|
|
218
|
-
`,c=this.buffer[a+1]):n=a),c==="#"||t&&au.has(c))break;if(o===`
|
|
219
|
-
`){const u=this.continueScalar(a+1);if(u===-1)break;a=Math.max(a,u-2)}}else{if(t&&au.has(o))break;n=a}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield ep,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const a=this.buffer.slice(this.pos,t);return a?(yield a,this.pos+=a.length,a.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(hm))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(os(n)||t&&au.has(n))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!os(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(W3.has(n))n=this.buffer[++t];else if(n==="%"&&lS.has(this.buffer[t+1])&&lS.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===`
|
|
220
|
-
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
221
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,a;do a=this.buffer[++n];while(a===" "||t&&a===" ");const o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(t){let n=this.pos,a=this.buffer[n];for(;!t(a);)a=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class n${constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,a=this.lineStarts.length;for(;n<a;){const c=n+a>>1;this.lineStarts[c]<t?n=c+1:a=c}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};const o=this.lineStarts[n-1];return{line:n,col:t-o+1}}}}function _i(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function cS(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function BN(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ru(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function zr(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function uS(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!_i(t.start,"explicit-key-ind")&&!_i(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,BN(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class s${constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new t$,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const a of this.lexer.lex(t,n))yield*this.next(a);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}const n=X3(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const a=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:a,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const a=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in a?a.indent:0:n.type==="flow-collection"&&a.type==="document"&&(n.indent=0),n.type==="flow-collection"&&uS(n),a.type){case"document":a.value=n;break;case"block-scalar":a.props.push(n);break;case"block-map":{const o=a.items[a.items.length-1];if(o.value){a.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{const o=a.items[a.items.length-1];o.value?a.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{const o=a.items[a.items.length-1];!o||o.value?a.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((a.type==="document"||a.type==="block-map"||a.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&cS(o.start)===-1&&(n.indent===0||o.start.every(c=>c.type!=="comment"||c.indent<n.indent))&&(a.type==="document"?a.end=o.start:a.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{cS(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){const n=ru(this.peek(2)),a=zr(n);let o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];const c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
222
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
223
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const a="end"in n.value?n.value.end:void 0;(Array.isArray(a)?a[a.length-1]:void 0)?.type==="comment"?a?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const a=!this.onKeyLine&&this.indent===t.indent,o=a&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let c=[];if(o&&n.sep&&!n.value){const u=[];for(let f=0;f<n.sep.length;++f){const m=n.sep[f];switch(m.type){case"newline":u.push(f);break;case"space":break;case"comment":m.indent>t.indent&&(u.length=0);break;default:u.length=0}}u.length>=2&&(c=n.sep.splice(u[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(c.push(this.sourceToken),t.items.push({start:c}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(c.push(this.sourceToken),t.items.push({start:c,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_i(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:c,key:null,sep:[this.sourceToken]}]});else if(BN(n.key)&&!_i(n.sep,"newline")){const u=zr(n.start),f=n.key,m=n.sep;m.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:f,sep:m}]})}else c.length>0?n.sep=n.sep.concat(c,this.sourceToken):n.sep.push(this.sourceToken);else if(_i(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const u=zr(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?t.items.push({start:c,key:null,sep:[this.sourceToken]}):_i(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const u=this.flowScalar(this.type);o||n.value?(t.items.push({start:c,key:u,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(u):(Object.assign(n,{key:u,sep:[]}),this.onKeyLine=!0);return}default:{const u=this.startBlockValue(t);if(u){if(u.type==="block-seq"){if(!n.explicitKey&&n.sep&&!_i(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else a&&t.items.push({start:c});this.stack.push(u);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const a="end"in n.value?n.value.end:void 0;(Array.isArray(a)?a[a.length-1]:void 0)?.type==="comment"?a?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||_i(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const a=this.startBlockValue(t);if(a){this.stack.push(a);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let a;do yield*this.pop(),a=this.peek(1);while(a?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const a=this.startBlockValue(t);a?this.stack.push(a):(yield*this.pop(),yield*this.step())}else{const a=this.peek(2);if(a.type==="block-map"&&(this.type==="map-value-ind"&&a.indent===t.indent||this.type==="newline"&&!a.items[a.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&a.type!=="flow-collection"){const o=ru(a),c=zr(o);uS(t);const u=t.end.splice(1,t.end.length);u.push(this.sourceToken);const f={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:c,key:t,sep:u}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=f}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
224
|
-
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
225
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=ru(t),a=zr(n);return a.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=ru(t),a=zr(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(a=>a.type==="newline"||a.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function i$(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new n$||null,prettyErrors:t}}function a$(e,t={}){const{lineCounter:n,prettyErrors:a}=i$(t),o=new s$(n?.addNewLine),c=new J3(t),u=Array.from(c.compose(o.parse(e)));if(a&&n)for(const f of u)f.errors.forEach(aS(e,n)),f.warnings.forEach(aS(e,n));return u.length>0?u:Object.assign([],{empty:!0},c.streamInfo())}function r$({onApplied:e}){const[t,n]=w.useState(""),[a,o]=w.useState(!1),[c,u]=w.useState([]),[f,m]=w.useState([]),p=async()=>{if(!t.trim())return;o(!0),u([]),m([]);const v=a$(t),y=[],x=[];for(let b=0;b<v.length;b++){const N=v[b];if(N.errors.length>0){y.push(`Document ${b+1}: ${N.errors[0]?.message}`);continue}const S=N.toJSON();if(!(!S||typeof S!="object"))try{const C=await y2(S);x.push(`Applied "${C.displayName||C.name}" (revision ${C.configRevision})`)}catch(C){y.push(`Document ${b+1}: ${C instanceof Error?C.message:String(C)}`)}}u(x),m(y),o(!1),x.length>0&&(Fe({title:"YAML applied",detail:`Applied ${x.length} document${x.length===1?"":"s"} successfully.`,tone:y.length>0?"caution":"positive",dedupeKey:"yaml:apply",dedupeMode:"replace"}),e())};return r.jsxs("section",{className:"mt-8",children:[r.jsx("div",{className:"page-section-divider"}),r.jsx("div",{className:"section-head mt-6",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Config as code"}),r.jsx("h2",{className:"text-sm font-medium text-zinc-200",children:"Apply YAML"})]})}),r.jsxs("p",{className:"text-zinc-500 text-sm mb-3",children:["Paste a ",r.jsx("code",{className:"text-zinc-400",children:"canonry.yaml"})," config (multi-document YAML with ",r.jsx("code",{className:"text-zinc-400",children:"---"})," separators supported)."]}),r.jsx("textarea",{className:"setup-input w-full font-mono text-xs",rows:10,placeholder:`apiVersion: canonry/v1
|
|
226
|
-
kind: Project
|
|
227
|
-
metadata:
|
|
228
|
-
name: my-project
|
|
229
|
-
spec:
|
|
230
|
-
canonicalDomain: example.com
|
|
231
|
-
country: US
|
|
232
|
-
language: en
|
|
233
|
-
keywords: []`,value:t,onChange:v=>n(v.target.value)}),c.length>0&&r.jsx("ul",{className:"mt-2 space-y-1",children:c.map((v,y)=>r.jsx("li",{className:"text-emerald-400 text-sm",children:v},y))}),f.length>0&&r.jsx("ul",{className:"mt-2 space-y-1",children:f.map((v,y)=>r.jsx("li",{className:"text-rose-400 text-sm",children:v},y))}),r.jsx("div",{className:"mt-3",children:r.jsx(oe,{type:"button",disabled:!t.trim()||a,onClick:p,children:a?"Applying...":"Apply"})})]})}function o$(){const{dashboard:e,isLoading:t,refetch:n}=Da();if(!e||t)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-28"}),r.jsx("div",{className:"skeleton-text-sm w-40"})]}),r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 overflow-hidden",children:[r.jsx("div",{className:"p-3 border-b border-zinc-800/60 flex gap-8",children:["Name","Domain","Visibility","Last run","Country"].map(E=>r.jsx("div",{className:"skeleton-text-sm w-16"},E))}),[1,2,3].map(E=>r.jsxs("div",{className:"p-3 border-b border-zinc-800/40 flex gap-8 items-center",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("div",{className:"skeleton-text w-28"}),r.jsx("div",{className:"skeleton-text-sm w-16"})]}),r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton h-5 w-14 rounded-full"}),r.jsx("div",{className:"skeleton h-5 w-16 rounded-full"}),r.jsx("div",{className:"skeleton-text-sm w-8"})]},E))]})]});const a=e.projects,o=Bi(),[c,u]=w.useState(!1),[f,m]=w.useState(""),[p,v]=w.useState(""),[y,x]=w.useState(""),[b,N]=w.useState("US"),[S,C]=w.useState("en"),[k,A]=w.useState(!1),[R,z]=w.useState(null),$=f.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),P=async()=>{if(!(!$||!y)){A(!0),z(null);try{const E=await Zu($,{displayName:p||f,canonicalDomain:y,country:b,language:S});Fe({title:"Project created",detail:`${E.displayName||E.name} is ready to configure.`,tone:"positive",dedupeKey:`project:create:${E.name}`,dedupeMode:"drop"}),n(),m(""),v(""),x(""),N("US"),C("en"),u(!1),o({to:"/projects/$projectId",params:{projectId:E.id}})}catch(E){z(E instanceof Error?E.message:"Failed to create project")}finally{A(!1)}}};return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Projects"}),r.jsxs("p",{className:"page-subtitle",children:[a.length," project",a.length!==1?"s":""," tracked"]})]}),r.jsx("div",{className:"page-header-right",children:r.jsxs(oe,{type:"button",onClick:()=>u(E=>!E),children:[r.jsx(Xx,{className:"size-4 mr-1.5"}),"Add project"]})})]}),c?r.jsxs(De,{className:"surface-card mb-6",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"New project"}),r.jsx("h2",{className:"text-sm font-medium text-zinc-200",children:"Create a new monitoring project"})]})}),r.jsxs("div",{className:"compact-stack mt-4",children:[r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-project-name",children:"Project name"}),r.jsx("input",{id:"new-project-name",className:"setup-input",type:"text",placeholder:"my-project",value:f,onChange:E=>m(E.target.value)}),$&&$!==f?r.jsxs("p",{className:"supporting-copy",children:["Slug: ",$]}):null]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-display-name",children:"Display name"}),r.jsx("input",{id:"new-display-name",className:"setup-input",type:"text",placeholder:"My Project",value:p,onChange:E=>v(E.target.value)})]})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-domain",children:"Canonical domain"}),r.jsx("input",{id:"new-domain",className:"setup-input",type:"text",placeholder:"example.com",value:y,onChange:E=>x(E.target.value)})]}),r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-country",children:"Country"}),r.jsx("input",{id:"new-country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:b,onChange:E=>N(E.target.value.toUpperCase())})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-language",children:"Language"}),r.jsx("input",{id:"new-language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:S,onChange:E=>C(E.target.value.toLowerCase())})]})]})]}),R?r.jsx("p",{className:"text-rose-400 text-sm mt-3",children:R}):null,r.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[r.jsx(oe,{type:"button",disabled:!$||!y||k,onClick:P,children:k?"Creating...":"Create project"}),r.jsx(oe,{type:"button",variant:"ghost",onClick:()=>u(!1),children:"Cancel"})]})]}):null,a.length>0?r.jsx("div",{className:"data-table-wrapper",children:r.jsxs("table",{className:"data-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Name"}),r.jsx("th",{children:"Domain"}),r.jsx("th",{children:"Visibility"}),r.jsx("th",{children:"Last run"}),r.jsx("th",{className:"text-right",children:"Country"})]})}),r.jsx("tbody",{children:a.map(E=>{const O=E.recentRuns[0];return r.jsxs("tr",{className:"cursor-pointer",onClick:()=>o({to:"/projects/$projectId",params:{projectId:E.project.id}}),children:[r.jsxs("td",{children:[r.jsx(St,{to:"/projects/$projectId",params:{projectId:E.project.id},className:"text-zinc-100 font-medium hover:underline",onClick:H=>H.stopPropagation(),children:E.project.displayName||E.project.name}),r.jsx("p",{className:"text-[11px] text-zinc-500",children:E.project.name})]}),r.jsx("td",{className:"text-zinc-400",children:E.project.canonicalDomain}),r.jsx("td",{children:r.jsx(lt,{tone:E.visibilitySummary.tone,children:E.visibilitySummary.value})}),r.jsx("td",{className:"text-zinc-500 text-sm",children:O?r.jsx(Wu,{status:O.status}):r.jsx("span",{className:"text-zinc-600",children:"No runs"})}),r.jsx("td",{className:"text-right text-zinc-500",children:E.project.country})]},E.project.id)})})]})}):c?null:r.jsxs(De,{className:"surface-card empty-card",children:[r.jsx("h3",{children:"No projects yet"}),r.jsx("p",{className:"supporting-copy",children:"Create your first monitoring project to start tracking AI visibility."}),r.jsxs(oe,{type:"button",onClick:()=>u(!0),children:[r.jsx(Xx,{className:"size-4 mr-1.5"}),"Add project"]})]}),r.jsx(r$,{onApplied:()=>{n()}})]})}function qN({run:e}){const{openRun:t}=Zr();return r.jsxs("article",{className:"run-row",children:[r.jsxs("div",{className:"run-row-main",children:[r.jsxs("div",{className:"run-row-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:e.summary}),r.jsxs("p",{className:"run-row-subtitle",children:[e.projectName,e.location?` · ${e.location}`:""," · ",e.kindLabel]})]}),r.jsx(Wu,{status:e.status})]}),r.jsx("p",{className:"run-row-detail",children:e.statusDetail})]}),r.jsxs("dl",{className:"run-row-meta",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Started"}),r.jsx("dd",{children:e.startedAt})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Duration"}),r.jsx("dd",{children:e.duration})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Trigger"}),r.jsx("dd",{children:e.triggerLabel})]})]}),r.jsx(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>t(e.id),children:"View run"})]})}function KN({value:e,label:t,delta:n,tone:a,description:o,tooltip:c,isNumeric:u=!0,progress:f}){const v=2*Math.PI*48,y=Number.parseInt(e,10),x=typeof f=="number"&&Number.isFinite(f)?Math.min(Math.max(f,0),1):u&&!Number.isNaN(y)?Math.min(y/100,1):.5,b=v*(1-x);return r.jsxs("div",{className:"score-gauge",children:[r.jsxs("div",{className:"gauge-ring-wrapper",children:[r.jsxs("svg",{className:"gauge-ring",viewBox:"0 0 120 120","aria-hidden":"true",children:[r.jsx("circle",{className:"gauge-bg",cx:"60",cy:"60",r:48,strokeWidth:6}),r.jsx("circle",{className:`gauge-fill gauge-fill-${a}`,cx:"60",cy:"60",r:48,strokeWidth:6,strokeDasharray:v,strokeDashoffset:b,transform:"rotate(-90 60 60)"})]}),r.jsx("div",{className:"gauge-center",children:r.jsx("span",{className:u?"gauge-value":"gauge-value-text",children:e.split(" / ")[0]})})]}),r.jsxs("p",{className:"gauge-label",children:[t,c&&r.jsx(Nn,{text:c})]}),r.jsx("p",{className:"gauge-delta",children:n}),r.jsx("p",{className:"gauge-description",children:o})]})}function dS({history:e,maxDots:t=12}){const n=e.slice(-t);if(n.length===0)return r.jsx("span",{className:"text-[11px] text-zinc-600",children:"No data"});const a={cited:"bg-emerald-400","not-cited":"bg-zinc-600",lost:"bg-rose-400",emerging:"bg-amber-400 ring-1 ring-amber-300/60"},o=new Date(n[0].createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),c=new Date(n[n.length-1].createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"});return r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-[9px] text-zinc-600 shrink-0",children:o}),r.jsx("div",{className:"flex items-center gap-[3px]",title:`${n.length} runs`,children:n.map((u,f)=>r.jsx("div",{className:`h-2.5 w-2.5 rounded-sm ${a[u.citationState]??"bg-zinc-700"} ${u.model&&f>0&&n[f-1]?.model&&n[f-1].model!==u.model?"ring-1 ring-amber-300/80 ring-offset-1 ring-offset-zinc-950":""}`,title:[u.citationState,new Date(u.createdAt).toLocaleDateString(),u.model?`model ${u.model}`:null,u.model&&f>0&&n[f-1]?.model&&n[f-1].model!==u.model?"model changed":null].filter(Boolean).join(" — ")},f))}),r.jsx("span",{className:"text-[9px] text-zinc-600 shrink-0",children:c})]})}function l$(e){const t=new Map;for(const a of e)for(const o of a.runHistory){const c=t.get(o.createdAt);c?c.states.push(o.citationState):t.set(o.createdAt,{states:[o.citationState],runId:o.runId})}return[...t.entries()].sort(([a],[o])=>a.localeCompare(o)).map(([a,{states:o,runId:c}])=>({runId:c,createdAt:a,citationState:o.includes("cited")?"cited":o.includes("emerging")?"emerging":"not-cited"}))}function c$({evidence:e}){const{openEvidence:t}=Zr(),[n,a]=w.useState(new Set),o=w.useMemo(()=>{const u=new Map;for(const f of e){const m=u.get(f.keyword)??[];u.set(f.keyword,[...m,f])}return[...u.entries()].map(([f,m])=>({phrase:f,items:m}))},[e]),c=u=>{a(f=>{const m=new Set(f);return m.has(u)?m.delete(u):m.add(u),m})};return r.jsx("div",{className:"evidence-table-wrap",children:r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"2rem"}}),r.jsx("th",{children:"Key Phrase"}),r.jsx("th",{children:"Status"}),r.jsx("th",{children:"Citation History"}),r.jsx("th",{children:"Change"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:o.map(({phrase:u,items:f})=>{const m=n.has(u),p=f.map(N=>N.citationState),v=p.includes("cited")?"cited":p.includes("emerging")?"emerging":p.includes("lost")?"lost":p.every(N=>N==="pending")?"pending":"not-cited",y=l$(f),x=f.filter(N=>N.citationState==="cited"||N.citationState==="emerging").length,b=(()=>{if(y.length===0)return"Awaiting first run";if(y.length===1)return"First observation";const N=y[y.length-1].citationState,S=y[y.length-2].citationState;if(S!=="cited"&&N==="cited")return"Newly cited";if(S==="cited"&&N!=="cited")return"Lost since last run";let C=0;for(let k=y.length-1;k>=0&&y[k].citationState===N;k--)C++;return N==="cited"?C<=1?"Cited in latest run":`Cited for ${C} runs`:C<=1?"Not cited in latest run":`Not cited across ${C} runs`})();return r.jsxs(w.Fragment,{children:[r.jsxs("tr",{className:"evidence-phrase-row cursor-pointer hover:bg-zinc-800/40",onClick:()=>c(u),"aria-expanded":m,children:[r.jsx("td",{children:r.jsx(Vu,{size:14,className:`transition-transform duration-150 text-zinc-500 ${m?"rotate-90":""}`})}),r.jsx("td",{className:"evidence-keyword-cell",children:r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-zinc-100",children:u}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:f.map(N=>r.jsx(ol,{provider:N.provider},N.id))})]})}),r.jsx("td",{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Km,{state:v}),r.jsxs("span",{className:"text-[11px] text-zinc-500",children:[x,"/",f.length]})]})}),r.jsx("td",{children:r.jsx(dS,{history:y})}),r.jsx("td",{className:"evidence-change-cell",children:b}),r.jsx("td",{})]}),m&&f.map(N=>r.jsxs("tr",{className:"bg-zinc-900/30",children:[r.jsx("td",{}),r.jsx("td",{className:"evidence-keyword-cell pl-5",children:r.jsx(ol,{provider:N.provider})}),r.jsx("td",{children:r.jsx(Km,{state:N.citationState})}),r.jsx("td",{children:r.jsx(dS,{history:N.runHistory})}),r.jsx("td",{className:"evidence-change-cell",children:N.changeLabel}),r.jsx("td",{children:r.jsx(oe,{variant:"ghost",size:"sm",type:"button",onClick:S=>{S.stopPropagation(),t(N.id)},children:"View"})})]},N.id))]},u)})})]})})}function u$({competitors:e}){return e.length===0?r.jsx("p",{className:"text-sm text-zinc-500",children:"No competitors configured. Add competitors to track overlap."}):r.jsx("div",{className:"competitor-table-wrap",children:r.jsxs("table",{className:"competitor-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Domain"}),r.jsx("th",{children:"Pressure"}),r.jsx("th",{children:"Citations"}),r.jsx("th",{children:"Key Phrases"})]})}),r.jsx("tbody",{children:e.map(t=>r.jsxs("tr",{children:[r.jsx("td",{className:"font-medium text-zinc-100",children:t.domain}),r.jsx("td",{children:r.jsx(lt,{tone:FR(t.pressureLabel),children:t.pressureLabel})}),r.jsx("td",{className:"text-zinc-300 tabular-nums",children:t.totalKeywords>0?`${t.citationCount} / ${t.totalKeywords}`:"—"}),r.jsx("td",{className:"text-zinc-500 text-xs",children:t.citedKeywords.length>0?t.citedKeywords.join(", "):"Not cited"})]},t.id))})]})})}const d$=["7d","30d","90d","all"],f$=["gap","cited","uncited"],HN={forum:"bg-amber-500",social:"bg-blue-500",news:"bg-zinc-400",reference:"bg-purple-500",blog:"bg-emerald-500",ecommerce:"bg-orange-500",video:"bg-red-500",academic:"bg-cyan-500",other:"bg-zinc-600"};function h$({projectName:e}){const[t,n]=w.useState("30d"),[a,o]=w.useState(null),[c,u]=w.useState(null),[f,m]=w.useState(null),[p,v]=w.useState(null),[y,x]=w.useState(!0);return w.useEffect(()=>{let b=!1;return x(!0),Promise.all([U2(e,t),I2(e,t),B2(e,t)]).then(([N,S,C])=>{b||(o(N),u(S),m(C),x(!1))}).catch(()=>{b||x(!1)}),()=>{b=!0}},[e,t]),y&&!a?r.jsx("p",{className:"text-sm text-zinc-500 py-8 text-center",children:"Loading analytics…"}):r.jsxs(r.Fragment,{children:[r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Citation Metrics"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Citation Rate Trends ",r.jsx(Nn,{text:"Citation rate over time across all runs within the selected window. Each data point represents the percentage of queries where your brand was cited by AI providers."})]})]}),r.jsx("div",{className:"flex gap-1",children:d$.map(b=>r.jsx("button",{type:"button",className:`px-3 py-1 text-xs rounded-full border transition-colors ${t===b?"bg-zinc-700 border-zinc-600 text-zinc-50":"border-zinc-800 text-zinc-400 hover:border-zinc-700 hover:text-zinc-300"}`,onClick:()=>n(b),children:b==="all"?"All":b},b))})]}),a&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx(KN,{value:`${Math.round(a.overall.citationRate*100)}`,label:"Citation Rate",delta:`${a.overall.cited} / ${a.overall.total}`,tone:a.trend==="improving"?"positive":a.trend==="declining"?"negative":"neutral",description:`Trend: ${a.trend}`,isNumeric:!0}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-zinc-500",children:"Trend"}),r.jsx(lt,{tone:a.trend==="improving"?"positive":a.trend==="declining"?"negative":"neutral",children:a.trend})]}),Object.keys(a.byProvider).length>0&&r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Provider"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Rate"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Cited / Total"})]})}),r.jsx("tbody",{children:Object.entries(a.byProvider).map(([b,N])=>r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-300",children:b}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-200",children:[(N.citationRate*100).toFixed(1),"%"]}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400",children:[N.cited," / ",N.total]})]},b))})]})]})]}),a.buckets.length>=1&&r.jsx(m$,{buckets:a.buckets,keywordChanges:a.keywordChanges??[]})]})]}),r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Opportunity Analysis"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Brand Gap Analysis ",r.jsx(Nn,{text:"Classification based on the most recent completed run. Cited: your brand appeared in the AI answer. Gap: a competitor was cited but you were not. Not Cited: neither mentioned. Consistency shows how often each key phrase was cited across all runs in the selected window."})]})]})}),c&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex gap-1 mb-4",children:f$.map(b=>{const N=b==="cited"?c.cited.length:b==="gap"?c.gap.length:c.uncited.length,S=p===b;return r.jsxs("button",{type:"button",className:`px-3 py-1 text-xs rounded-full border transition-colors ${S?b==="gap"?"bg-amber-900/40 border-amber-700/60 text-amber-300":b==="cited"?"bg-emerald-900/40 border-emerald-700/60 text-emerald-300":"bg-zinc-800/40 border-zinc-700 text-zinc-300":"border-zinc-800 text-zinc-400 hover:border-zinc-700"}`,onClick:()=>v(S?null:b),children:[b==="gap"?"Gap":b==="cited"?"Cited":"Not Cited"," (",N,")"]},b)})}),r.jsx(p$,{gaps:c,filter:p})]})]}),r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Source Intelligence"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Source Origin Breakdown ",r.jsx(Nn,{text:"Aggregated across all runs in the selected window. Shows what types of websites AI engines cite as grounding sources. More runs = more statistically meaningful breakdown."})]})]}),f&&f.overall.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(g$,{categories:f.overall}),r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Category"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Count"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"%"}),r.jsx("th",{className:"text-left py-1 pl-4 font-medium",children:"Top Sources"})]})}),r.jsx("tbody",{children:f.overall.map(b=>r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsxs("td",{className:"py-1.5 text-zinc-300 flex items-center gap-2",children:[r.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${HN[b.category]??"bg-zinc-600"}`}),b.label]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200",children:b.count}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400",children:[(b.percentage*100).toFixed(1),"%"]}),r.jsx("td",{className:"py-1.5 pl-4 text-zinc-500 text-xs truncate max-w-[200px]",children:b.topDomains.slice(0,3).map(N=>N.domain).join(", ")})]},b.category))})]})]}),f&&f.overall.length===0&&r.jsx("p",{className:"text-sm text-zinc-500 py-4",children:"No source data available. Run a visibility sweep first."})]})]})}function m$({buckets:e,keywordChanges:t}){const[n,a]=w.useState(null),o=600,c=140,u={top:30,right:10,bottom:20,left:40},f=o-u.left-u.right,m=c-u.top-u.bottom,p=1,v=e.map((b,N)=>{const S=u.left+(e.length>1?N/(e.length-1)*f:f/2),C=u.top+m-b.citationRate/p*m;return{x:S,y:C}}),y=w.useMemo(()=>{if(!t||t.length===0||e.length<2)return[];const b=new Date(e[0].startDate).getTime(),S=new Date(e[e.length-1].startDate).getTime()-b;return S<=0?[]:t.map(C=>{const A=(new Date(C.date).getTime()-b)/S;return A<0||A>1?null:{...C,x:u.left+A*f}}).filter(C=>C!==null)},[e,t,u.left,f]),x=v.map(b=>`${b.x},${b.y}`).join(" ");return r.jsxs("div",{className:"surface-card rounded-lg p-3 border border-zinc-800/60",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 mb-1 flex items-center gap-1",children:"kp = key phrases tracked in this window"}),r.jsxs("svg",{viewBox:`0 0 ${o} ${c}`,className:"w-full h-auto","aria-label":"Citation rate trend chart",onMouseLeave:()=>a(null),children:[r.jsxs("text",{x:u.left-4,y:u.top+4,textAnchor:"end",className:"fill-zinc-500",fontSize:"9",children:[(p*100).toFixed(0),"%"]}),r.jsx("text",{x:u.left-4,y:u.top+m+4,textAnchor:"end",className:"fill-zinc-500",fontSize:"9",children:"0%"}),r.jsx("line",{x1:u.left,y1:u.top+m,x2:u.left+f,y2:u.top+m,stroke:"currentColor",className:"text-zinc-800",strokeWidth:"0.5"}),r.jsx("polyline",{fill:"none",stroke:"currentColor",className:"text-emerald-500",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:x}),y.map((b,N)=>r.jsxs("g",{children:[r.jsx("line",{x1:b.x,y1:u.top,x2:b.x,y2:u.top+m,stroke:"currentColor",className:"text-zinc-600",strokeWidth:"0.5",strokeDasharray:"4 2"}),r.jsx("text",{x:b.x,y:u.top-6,textAnchor:"middle",className:"fill-zinc-500",fontSize:"7",fontWeight:"500",children:b.label})]},`kw-change-${N}`)),n!==null&&r.jsx("line",{x1:v[n].x,y1:u.top,x2:v[n].x,y2:u.top+m,stroke:"currentColor",className:"text-zinc-600",strokeWidth:"0.5",strokeDasharray:"3 2"}),e.map((b,N)=>{const{x:S,y:C}=v[N],k=n===N;return r.jsxs("g",{children:[r.jsx("circle",{cx:S,cy:C,r:"10",fill:"transparent",onMouseEnter:()=>a(N),style:{cursor:"pointer"}}),r.jsx("circle",{cx:S,cy:C,r:k?5:3,className:k?"fill-emerald-400":"fill-emerald-500"})]},N)}),n!==null&&(()=>{const b=e[n],{x:N,y:S}=v[n],C=`${(b.citationRate*100).toFixed(1)}%`,k=b.keywordCount?`${b.keywordCount} kp`:"",A=56,R=30,z=Math.max(u.left,Math.min(N-A/2,o-u.right-A)),$=S-R-8;return r.jsxs("g",{children:[r.jsx("rect",{x:z,y:$,width:A,height:R,rx:"4",className:"fill-zinc-800",stroke:"currentColor",strokeWidth:"0.5"}),r.jsx("text",{x:z+A/2,y:$+13,textAnchor:"middle",className:"fill-zinc-50",fontSize:"11",fontWeight:"600",children:C}),k&&r.jsx("text",{x:z+A/2,y:$+24,textAnchor:"middle",className:"fill-zinc-400",fontSize:"8",children:k})]})})(),e.map((b,N)=>({b,i:N})).filter(({i:b})=>b===0||b===e.length-1||e.length<=7).map(({b,i:N})=>{const S=v[N].x;return r.jsx("text",{x:S,y:c-2,textAnchor:"middle",className:"fill-zinc-500",fontSize:"8",children:b.startDate.slice(5,10)},N)})]})]})}function p$({gaps:e,filter:t}){const n=w.useMemo(()=>{const a=[...e.gap.map(o=>({...o,_sort:0})),...e.cited.map(o=>({...o,_sort:1})),...e.uncited.map(o=>({...o,_sort:2}))];return t?a.filter(o=>o.category===t):a.sort((o,c)=>o._sort-c._sort)},[e,t]);return n.length===0?r.jsxs("p",{className:"text-sm text-zinc-500 py-4",children:["No key phrases found",t?` with status "${t}"`:"","."]}):r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Keyword"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Status"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Providers Citing"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Competitors Citing"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Consistency"})]})}),r.jsx("tbody",{children:n.map(a=>{const o=a.category==="cited"?"positive":a.category==="gap"?"caution":"neutral";return r.jsxs("tr",{className:`border-t border-zinc-800/40 ${a.category==="gap"?"border-l-2 border-l-amber-600/60":""}`,children:[r.jsx("td",{className:"py-1.5 text-zinc-200",children:a.keyword}),r.jsx("td",{className:"py-1.5",children:r.jsx(lt,{tone:o,children:a.category==="gap"?"Gap":a.category==="cited"?"Cited":"Not Cited"})}),r.jsx("td",{className:"py-1.5 text-zinc-400 text-xs",children:a.providers.length>0?a.providers.join(", "):"—"}),r.jsx("td",{className:"py-1.5 text-zinc-400 text-xs",children:a.competitorsCiting.length>0?a.competitorsCiting.join(", "):"—"}),r.jsx("td",{className:"py-1.5 text-right text-zinc-400 text-xs",children:a.consistency.totalRuns>0?`${a.consistency.citedRuns}/${a.consistency.totalRuns} runs`:"—"})]},a.keywordId)})})]})}function g$({categories:e}){const t=e.reduce((n,a)=>n+a.count,0);return t===0?null:r.jsx("div",{className:"flex rounded-full overflow-hidden h-3 bg-zinc-800","aria-label":"Source category distribution",children:e.map(n=>{const a=n.count/t*100;return a<.5?null:r.jsx("div",{className:`${HN[n.category]??"bg-zinc-600"} transition-all`,style:{width:`${a}%`},title:`${n.label}: ${(n.percentage*100).toFixed(1)}%`},n.category)})})}function ou(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function y$(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function v$({projectName:e}){const[t,n]=w.useState(null),[a,o]=w.useState(null),[c,u]=w.useState(!0),[f,m]=w.useState(!1),[p,v]=w.useState(!1),[y,x]=w.useState(null),[b,N]=w.useState(null),[S,C]=w.useState("sessions"),[k,A]=w.useState("desc"),[R,z]=w.useState("sessions"),[$,P]=w.useState("desc");function E(de){u(!0),Zx(e).then(U=>{if(!de.current)return n(U),U.connected?Vx(e):null}).then(U=>{de.current||(o(U??null),u(!1))}).catch(U=>{de.current||(x(U instanceof Error?U.message:"Failed to load GA4 data"),u(!1))})}w.useEffect(()=>{const de={current:!1};return E(de),()=>{de.current=!0}},[e]);async function O(){m(!0),x(null),N(null);try{const de=await lj(e);N(`Synced ${de.rowCount.toLocaleString()} page rows and ${de.aiReferralCount.toLocaleString()} AI referral rows (${de.days} days)`);const U=await Vx(e);o(U);const T=await Zx(e);n(T)}catch(de){x(de instanceof Error?de.message:"Sync failed")}finally{m(!1)}}async function H(){v(!0),x(null),N(null);try{await K2(e),n({connected:!1,propertyId:null,clientEmail:null,lastSyncedAt:null,createdAt:null,updatedAt:null}),o(null),N("GA4 disconnected")}catch(de){x(de instanceof Error?de.message:"Disconnect failed")}finally{v(!1)}}function ee(de){S===de?A(U=>U==="desc"?"asc":"desc"):(C(de),A("desc"))}function V(de){R===de?P(U=>U==="desc"?"asc":"desc"):(z(de),P("desc"))}const se=w.useMemo(()=>a?.topPages?[...a.topPages].sort((de,U)=>{const T=de[S],L=U[S];return typeof T=="string"&&typeof L=="string"?k==="asc"?T.localeCompare(L):L.localeCompare(T):k==="asc"?T-L:L-T}):[],[a?.topPages,S,k]),ue=w.useMemo(()=>a?.aiReferrals?[...a.aiReferrals].sort((de,U)=>{const T=de[R],L=U[R];return typeof T=="string"&&typeof L=="string"?$==="asc"?T.localeCompare(L):L.localeCompare(T):$==="asc"?T-L:L-T}):[],[a?.aiReferrals,R,$]);if(c&&!t)return r.jsx("p",{className:"text-sm text-zinc-500 py-8 text-center",children:"Loading traffic data…"});if(!t?.connected)return r.jsx(x$,{projectName:e,onConnected:()=>E({current:!1})});const _e=a&&a.totalSessions>0?Math.round(a.totalOrganicSessions/a.totalSessions*100):0,xe=a?.aiReferrals.reduce((de,U)=>de+U.sessions,0)??0,K=a&&a.totalSessions>0?Math.round(xe/a.totalSessions*100):0,ae=a?new Set(a.aiReferrals.map(de=>de.source.toLowerCase())).size:0,pe=ue[0]??null;return r.jsxs(r.Fragment,{children:[y&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-rose-900/20 border border-rose-800/60 text-sm text-rose-300",children:y}),b&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-emerald-900/20 border border-emerald-800/60 text-sm text-emerald-300",children:b}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Property ",r.jsx("span",{className:"text-zinc-300",children:t.propertyId}),t.clientEmail&&r.jsxs(r.Fragment,{children:[" · ",r.jsx("span",{className:"text-zinc-500",children:t.clientEmail})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(oe,{variant:"outline",size:"sm",disabled:f,onClick:O,children:[r.jsx(Wx,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),f?"Syncing…":"Sync"]}),r.jsxs(oe,{variant:"ghost",size:"sm",className:"text-rose-400 hover:text-rose-300",disabled:p,onClick:H,children:[r.jsx(EE,{className:"w-3.5 h-3.5 mr-1.5"}),"Disconnect"]})]})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Traffic Overview"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Site Traffic",r.jsx(Nn,{text:"Aggregated traffic metrics from Google Analytics 4. Sessions and users are summed across all synced dates. Organic sessions are Google organic search sessions specifically."})]})]}),a?r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsx(mm,{value:ou(a.totalSessions),label:"Total Sessions",subtitle:a.totalSessions.toLocaleString(),tone:"neutral"}),r.jsx(mm,{value:ou(a.totalOrganicSessions),label:"Organic Sessions",subtitle:`${_e}% of total`,tone:"positive"}),r.jsx(mm,{value:ou(a.totalUsers),label:"Total Users",subtitle:a.totalUsers.toLocaleString(),tone:"neutral"})]}):r.jsxs("div",{className:"surface-card rounded-lg p-6 text-center border border-zinc-800/60",children:[r.jsx("p",{className:"text-sm text-zinc-400 mb-3",children:"No traffic data yet."}),r.jsxs(oe,{variant:"outline",size:"sm",disabled:f,onClick:O,children:[r.jsx(Wx,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),"Sync from GA4"]})]})]}),a&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"AI Attribution"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["AI Referral Sources",r.jsx(Nn,{text:"Counts explicit AI referrers detected in GA4 sessionSource values, such as ChatGPT, Claude, Gemini, Perplexity, OpenAI, and Copilot. Generic search-engine sources like plain Bing are intentionally excluded to avoid false positives."})]})]}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.5fr)]",children:[r.jsxs(De,{className:"surface-card p-5",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Summary"}),r.jsx("h3",{className:"text-sm font-semibold text-zinc-100",children:"Attributable AI visits"})]}),a.aiReferrals.length>0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[r.jsx(pm,{label:"AI Sessions",value:ou(xe),hint:`${xe.toLocaleString()} sessions`,tone:"positive"}),r.jsx(pm,{label:"Share of Traffic",value:`${K}%`,hint:"of total sessions",tone:"neutral"}),r.jsx(pm,{label:"Tracked Sources",value:String(ae),hint:`${a.aiReferrals.length} source rows`,tone:"neutral"})]}),r.jsx("div",{className:"mt-4 rounded-lg border border-emerald-800/40 bg-emerald-500/6 px-4 py-3 text-sm text-emerald-100",children:pe?`Top explicit AI referrer: ${pe.source} via ${pe.medium}, accounting for ${pe.sessions.toLocaleString()} sessions in the current sync window.`:"Explicit AI referrers detected in the current sync window."})]}):r.jsx("div",{className:"rounded-lg border border-amber-800/40 bg-amber-500/6 px-4 py-4 text-sm text-amber-100",children:"No explicit AI referrers were detected in the current sync window. This view intentionally favors precision over broad matching, so unattributed traffic hidden inside generic search sources is excluded."})]}),r.jsxs(De,{className:"surface-card p-5",children:[r.jsxs("div",{className:"mb-4 flex items-end justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Breakdown"}),r.jsx("h3",{className:"text-sm font-semibold text-zinc-100",children:"Source / medium"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:a.aiReferrals.length>0?`${a.aiReferrals.length} rows`:"No source rows"})]}),a.aiReferrals.length>0?r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx(Ci,{label:"Source",sortKey:"source",current:R,dir:$,onSort:V,align:"left"}),r.jsx(Ci,{label:"Medium",sortKey:"medium",current:R,dir:$,onSort:V,align:"left"}),r.jsx(Ci,{label:"Sessions",sortKey:"sessions",current:R,dir:$,onSort:V,align:"right"}),r.jsx("th",{className:"py-1 font-medium text-right",children:"Share"}),r.jsx(Ci,{label:"Users",sortKey:"users",current:R,dir:$,onSort:V,align:"right"})]})}),r.jsx("tbody",{children:ue.map(de=>r.jsx(S$,{referral:de,totalSessions:xe},`${de.source}:${de.medium}`))})]})}):r.jsx("div",{className:"rounded-lg border border-dashed border-zinc-800/60 bg-zinc-950/40 px-4 py-6 text-sm text-zinc-500",children:"Connect GA4 and sync traffic to monitor explicit AI referral sources here."})]})]})]})]}),a&&a.topPages.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Page Performance"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Top Landing Pages",r.jsx(Nn,{text:"Landing pages ranked by session volume. Click column headers to sort. Organic % shows the share of sessions coming from Google organic search."})]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx(Ci,{label:"Landing Page",sortKey:"landingPage",current:S,dir:k,onSort:ee,align:"left"}),r.jsx(Ci,{label:"Sessions",sortKey:"sessions",current:S,dir:k,onSort:ee,align:"right"}),r.jsx(Ci,{label:"Organic",sortKey:"organicSessions",current:S,dir:k,onSort:ee,align:"right"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Organic %"}),r.jsx(Ci,{label:"Users",sortKey:"users",current:S,dir:k,onSort:ee,align:"right"})]})}),r.jsx("tbody",{children:se.map(de=>r.jsx(b$,{page:de},de.landingPage))})]})})]})]}),r.jsxs("div",{className:"mt-6 flex items-center justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:a?.lastSyncedAt?`Last synced ${y$(a.lastSyncedAt)}`:"Never synced"}),r.jsx("span",{children:a?`${a.topPages.length} pages · ${a.aiReferrals.length} AI rows`:""})]})]})}function x$({projectName:e,onConnected:t}){const[n,a]=w.useState(""),[o,c]=w.useState(null),[u,f]=w.useState(null),[m,p]=w.useState(!1),[v,y]=w.useState(null),x=w.useRef(null),b=w.useCallback(S=>{const C=S.target.files?.[0];if(!C)return;y(null),c(C.name);const k=new FileReader;k.onload=()=>{const A=k.result;try{const R=JSON.parse(A);if(!R.client_email||!R.private_key){y("JSON file is missing required fields: client_email and private_key. Make sure you downloaded a service account key (not an OAuth client)."),f(null);return}f(A)}catch{y("File is not valid JSON. Please upload a service account key file (.json) downloaded from Google Cloud Console."),f(null)}},k.onerror=()=>{y("Failed to read file."),f(null)},k.readAsText(C)},[]);async function N(){if(y(null),!n.trim()){y("Property ID is required.");return}if(!u){y("Please upload a service account key file.");return}p(!0);try{await q2(e,{propertyId:n.trim(),keyJson:u});try{await lj(e)}catch{}t()}catch(S){y(S instanceof Error?S.message:"Failed to connect GA4")}finally{p(!1)}}return r.jsxs(De,{className:"surface-card p-6",children:[r.jsx("h3",{className:"text-base font-semibold text-zinc-50 mb-1",children:"Connect Google Analytics 4"}),r.jsx("p",{className:"text-sm text-zinc-400 mb-5",children:"Connect a GA4 property to see traffic data for this project. You'll need a service account key file from Google Cloud Console."}),v&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-rose-900/20 border border-rose-800/60 text-sm text-rose-300",children:v}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{htmlFor:"ga4-property-id",className:"block text-xs font-medium text-zinc-400 mb-1.5",children:"GA4 Property ID"}),r.jsx("input",{id:"ga4-property-id",type:"text",placeholder:"e.g. 123456789",value:n,onChange:S=>a(S.target.value),className:"w-full rounded-lg bg-zinc-900/60 border border-zinc-800/60 px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:ring-1 focus:ring-zinc-600"}),r.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:"Find this in GA4 → Admin → Property Settings. It's a numeric ID, not the Measurement ID (G-XXXXXX)."})]}),r.jsxs("div",{className:"mb-5",children:[r.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1.5",children:"Service Account Key File"}),r.jsx("input",{ref:x,type:"file",accept:".json,application/json",onChange:b,className:"hidden"}),r.jsxs("button",{type:"button",onClick:()=>x.current?.click(),className:"flex items-center gap-2 w-full rounded-lg bg-zinc-900/60 border border-zinc-800/60 border-dashed px-4 py-3 text-sm text-zinc-400 hover:border-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[r.jsx(AE,{className:"w-4 h-4 shrink-0"}),o?r.jsx("span",{className:"text-zinc-200 truncate",children:o}):r.jsx("span",{children:"Upload .json key file"})]}),r.jsxs("p",{className:"mt-1 text-[11px] text-zinc-500",children:["Download from Google Cloud Console → IAM & Admin → Service Accounts → Keys → Add Key → JSON. The service account must have ",r.jsx("span",{className:"text-zinc-400",children:"Viewer"})," access on the GA4 property."]})]}),r.jsx(oe,{variant:"default",size:"sm",disabled:m||!n.trim()||!u,onClick:N,children:m?"Connecting & syncing…":"Connect GA4"})]})}function Ci({label:e,sortKey:t,current:n,dir:a,onSort:o,align:c}){const u=n===t;return r.jsxs("th",{className:`py-1 font-medium cursor-pointer select-none hover:text-zinc-300 transition-colors ${c==="right"?"text-right":"text-left"}`,onClick:()=>o(t),children:[e,u&&r.jsx("span",{className:"ml-0.5",children:a==="asc"?"↑":"↓"})]})}const GN={positive:"text-emerald-400",caution:"text-amber-400",negative:"text-rose-400",neutral:"text-zinc-50"};function mm({value:e,label:t,subtitle:n,tone:a}){return r.jsxs("div",{className:"rounded-lg bg-zinc-900/30 border border-zinc-800/60 px-5 py-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:t}),r.jsx("p",{className:`text-2xl font-bold tabular-nums ${GN[a]}`,children:e}),r.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function pm({value:e,label:t,hint:n,tone:a}){return r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-950/40 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:t}),r.jsx("p",{className:`text-xl font-semibold tabular-nums ${GN[a]}`,children:e}),r.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function b$({page:e}){const t=e.sessions>0?(e.organicSessions/e.sessions*100).toFixed(1):"0.0";return r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-300 max-w-[400px] truncate",title:e.landingPage,children:e.landingPage}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.sessions.toLocaleString()}),r.jsx("td",{className:"py-1.5 text-right text-emerald-400 tabular-nums",children:e.organicSessions.toLocaleString()}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400 tabular-nums",children:[t,"%"]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.users.toLocaleString()})]})}function S$({referral:e,totalSessions:t}){const n=t>0?(e.sessions/t*100).toFixed(1):"0.0";return r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-200 max-w-[220px] truncate",title:e.source,children:e.source}),r.jsx("td",{className:"py-1.5 text-zinc-500 max-w-[180px] truncate",title:e.medium,children:e.medium}),r.jsx("td",{className:"py-1.5 text-right text-emerald-400 tabular-nums",children:e.sessions.toLocaleString()}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400 tabular-nums",children:[n,"%"]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.users.toLocaleString()})]})}function jl(e){e.invalidateQueries({queryKey:Qn.runs.all}),e.invalidateQueries({queryKey:Qn.projects.all})}function j$(e){return e==="gsc-sync"?"GSC sync queued":e==="inspect-sitemap"?"Sitemap inspection queued":"Visibility sweep queued"}function w$(e,t){const n=e??"Project";return t==="gsc-sync"?`${n} will refresh after the sync completes.`:t==="inspect-sitemap"?`${n} will notify you when sitemap inspection finishes.`:`${n} will notify you when the run finishes.`}function vd(e,t){hj({id:e.id,projectId:e.projectId,kind:e.kind,projectLabel:t.projectLabel,sourceAction:t.sourceAction,lastAnnouncedStatus:"queued"}),Fe({title:j$(e.kind),detail:w$(t.projectLabel,e.kind),tone:"neutral",dedupeKey:`run:${e.id}`,dedupeMode:"replace"})}function N$(e){const t=e.filter(o=>o.status!=="conflict"),n=e.filter(o=>o.status==="conflict");if(t.length===0){Fe({title:"No runs queued",detail:n.length>0?`${n.length} project${n.length===1?"":"s"} already had a run in progress.`:"No projects were available to queue.",tone:"caution",durationMs:8e3,dedupeKey:"run-all:conflict",dedupeMode:"replace"});return}for(const o of t)hj({id:o.id,projectId:o.projectId,kind:o.kind,projectLabel:o.projectName,sourceAction:"run-all",lastAnnouncedStatus:"queued"});const a=BE({runIds:t.map(o=>o.id),queuedCount:t.length,skippedCount:n.length});Fe({title:"Run-all batch queued",detail:n.length>0?`${t.length} project${t.length===1?"":"s"} queued, ${n.length} skipped because a run is already active.`:`${t.length} project${t.length===1?"":"s"} queued.`,tone:n.length>0?"caution":"neutral",dedupeKey:`batch:${a}`,dedupeMode:"replace"})}function xd(e,t){if(e instanceof _u&&e.code==="RUN_IN_PROGRESS"){Fe({title:"Run already in progress",detail:t?.projectLabel?`${t.projectLabel} already has an active run. Wait for it to finish, then retry.`:"This project already has an active run. Wait for it to finish, then retry.",tone:"caution",durationMs:8e3,dedupeKey:`run-in-progress:${t?.projectKey??"project"}:${t?.sourceAction??"run"}`,dedupeMode:"replace"});return}Fe({title:e instanceof Error?e.message:"Failed to queue run",tone:"negative"})}function FN(){const e=Ui();return pl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>W_(t,n),onSuccess:(t,n)=>{jl(e),vd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:n.sourceAction})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:n.sourceAction})}})}function C$(){const e=Ui();return pl({meta:{skipGlobalErrorToast:!0},mutationFn:t=>v2(t),onSuccess:t=>{jl(e),N$(t)},onError:t=>{Fe({title:t instanceof Error?t.message:"Failed to queue runs",tone:"negative"})}})}function k$(){const e=Ui();return pl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>ij(t,n),onSuccess:(t,n)=>{jl(e),vd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:"gsc-sync"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"gsc-sync"})}})}function z$(){const e=Ui();return pl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t})=>A2(t),onSuccess:(t,n)=>{jl(e),vd(t.run,{projectLabel:n.projectLabel??n.projectName,sourceAction:"discover-sitemaps"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"discover-sitemaps"})}})}function _$(){const e=Ui();return pl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>E2(t,n),onSuccess:(t,n)=>{jl(e),vd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:"inspect-sitemap"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"inspect-sitemap"})}})}function E$({projectName:e}){const[t,n]=w.useState(!1),[a,o]=w.useState([]),[c,u]=w.useState([]),[f,m]=w.useState([]),[p,v]=w.useState([]),[y,x]=w.useState([]),[b,N]=w.useState(null),[S,C]=w.useState(""),[k,A]=w.useState(""),[R,z]=w.useState("30"),[$,P]=w.useState(!1),[E,O]=w.useState({startDate:"",endDate:"",query:"",page:"",limit:"20"}),[H,ee]=w.useState(""),[V,se]=w.useState(!0),[ue,_e]=w.useState(!1),[xe,K]=w.useState(!1),[ae,pe]=w.useState(!1),[de,U]=w.useState(!1),[T,L]=w.useState(!1),[J,X]=w.useState(!1),[Y,he]=w.useState(null),[ge,we]=w.useState(!1),[me,Ie]=w.useState(!1),[Ye,le]=w.useState(null),[Ue,Qe]=w.useState(""),[Vt,Ut]=w.useState(!1),[Mn,nn]=w.useState(!1),[Et,re]=w.useState("indexed"),[Ze,gt]=w.useState([]),[Qt,Je]=w.useState(null),[Me,Xe]=w.useState(!1),[Nt,Ke]=w.useState(null),[Ma,pn]=w.useState(null),st=a.find(B=>B.connectionType==="gsc"),Xr=f.length>0||p.length>0||y.length>0,ns=k$(),ht=z$(),gn=_$();async function ce(B){if(!B){u([]),C("");return}K(!0);try{const{sites:fe}=await S2(e);u(fe),C(B.propertyId??fe[0]?.siteUrl??"")}catch(fe){u([]),Ke(fe instanceof Error?fe.message:"Failed to load Search Console properties")}finally{K(!1)}}async function zn(){U(!0);try{const B=await N2(e,{startDate:E.startDate||void 0,endDate:E.endDate||void 0,query:E.query||void 0,page:E.page||void 0,limit:parseInt(E.limit,10)||20});m(B)}catch(B){m([]),Ke(B instanceof Error?B.message:"Failed to load GSC performance data")}finally{U(!1)}}async function $a(){L(!0);try{const[B,fe]=await Promise.all([k2(e,{url:H.trim()||void 0,limit:20}),z2(e)]);v(B),x(fe)}catch(B){v([]),x([]),Ke(B instanceof Error?B.message:"Failed to load GSC inspection history")}finally{L(!1)}}async function Nl(){we(!0);try{const[B,fe]=await Promise.all([Np(e),_2(e).catch(()=>[])]);he(B),gt(fe)}catch(B){he(null),gt([]),Ke(B instanceof Error?B.message:"Failed to load coverage data")}finally{we(!1)}}async function Gi(B){Xe(!0),Ke(null);try{const fe=await Gx(e,{urls:B}),{succeeded:xt,failed:Gt,total:ln}=fe.summary;Fe({title:"Indexing requested",detail:Gt===0?`${xt} URL${xt!==1?"s":""} submitted for indexing.`:`${xt}/${ln} submitted successfully, ${Gt} failed.`,tone:Gt===0?"positive":"caution",dedupeKey:`gsc:indexing:${e}`,dedupeMode:"replace"})}catch(fe){Ke(fe instanceof Error?fe.message:"Failed to request indexing")}finally{Xe(!1)}}async function Pa(){Xe(!0),Ke(null);try{const B=await Gx(e,{urls:[],allUnindexed:!0}),{succeeded:fe,failed:xt,total:Gt}=B.summary;Fe({title:"Indexing requested",detail:xt===0?`${fe} unindexed URL${fe!==1?"s":""} submitted for indexing.`:`${fe}/${Gt} submitted successfully, ${xt} failed.`,tone:xt===0?"positive":"caution",dedupeKey:`gsc:indexing-all:${e}`,dedupeMode:"replace"})}catch(B){Ke(B instanceof Error?B.message:"Failed to request indexing")}finally{Xe(!1)}}async function Cs(){if(Ue.trim()){Ut(!0),Ke(null);try{await w2(e,"gsc",Ue.trim()),o(B=>B.map(fe=>fe.connectionType==="gsc"?{...fe,sitemapUrl:Ue.trim()}:fe)),Fe({title:"Sitemap URL saved",detail:`${e} will use the updated sitemap URL.`,tone:"positive",dedupeKey:`gsc:sitemap:${e}`,dedupeMode:"drop"}),Qe("")}catch(B){Ke(B instanceof Error?B.message:"Failed to save sitemap URL")}finally{Ut(!1)}}}async function ms(){Ke(null);try{const B=await ht.mutateAsync({projectName:e,projectLabel:e});le(B.sitemaps),o(fe=>fe.map(xt=>xt.connectionType==="gsc"?{...xt,sitemapUrl:B.primarySitemapUrl}:xt))}catch{}}async function Ua(){Ie(!0),Ke(null);try{const B=await R2(e);le(B.sitemaps),B.sitemaps.length===0&&pn("No sitemaps found in this GSC property. Submit a sitemap in Google Search Console first.")}catch(B){Ke(B instanceof Error?B.message:"Failed to list sitemaps")}finally{Ie(!1)}}async function Ys(){se(!0),Ke(null);try{const[B,fe]=await Promise.all([wp().catch(()=>null),sj(e).catch(()=>[])]);n(!!B?.google?.configured),o(fe);const xt=fe.find(Gt=>Gt.connectionType==="gsc");await Promise.all([ce(xt),zn(),$a(),Nl()])}finally{se(!1)}}w.useEffect(()=>{Ys()},[e]);async function Sd(){if(!t){Ke("Google OAuth app credentials are not configured yet. Set them on the Settings page first.");return}_e(!0),Ke(null),pn(null);try{const{authUrl:B}=await x2(e,"gsc");if(!B.startsWith("https://accounts.google.com/")){Ke("Unexpected OAuth redirect URL. Please try again.");return}const fe=window.open(B,"_blank","width=600,height=700");if(!fe){window.location.assign(B);return}pn("Finish the Google consent flow in the popup, then close it to refresh this project.");const xt=window.setInterval(()=>{fe.closed&&(window.clearInterval(xt),pn(null),Ys())},1e3)}catch(B){Ke(B instanceof Error?B.message:"Failed to start OAuth flow")}finally{_e(!1)}}async function Cl(){Ke(null),pn(null);try{await b2(e,"gsc"),o(B=>B.filter(fe=>fe.connectionType!=="gsc")),u([]),C("")}catch(B){Ke(B instanceof Error?B.message:"Failed to disconnect")}}async function Wr(){if(S){pe(!0),Ke(null);try{await j2(e,"gsc",S),o(B=>B.map(fe=>fe.connectionType==="gsc"?{...fe,propertyId:S}:fe)),Fe({title:"GSC property updated",detail:`${e} is now linked to ${S}.`,tone:"positive",dedupeKey:`gsc:property:${e}`,dedupeMode:"drop"})}catch(B){Ke(B instanceof Error?B.message:"Failed to save GSC property")}finally{pe(!1)}}}async function Fi(){Ke(null),pn(null);try{await ns.mutateAsync({projectName:e,projectLabel:e,opts:{days:parseInt(R,10)||void 0,full:$||void 0}})}catch{}}async function kl(){if(k.trim()){X(!0),Ke(null),pn(null);try{const B=await C2(e,k.trim());N(B),A(""),await $a()}catch(B){Ke(B instanceof Error?B.message:"Failed to inspect URL")}finally{X(!1)}}}return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search Console"}),r.jsx("h2",{children:"Google Search Console"})]}),r.jsx("div",{className:"flex items-center gap-2",children:st&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:de,onClick:()=>{zn()},children:de?"Refreshing…":"Refresh data"})})]}),Nt&&r.jsxs("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:[Nt,r.jsx("button",{type:"button",className:"ml-2 text-rose-400 hover:text-rose-200",onClick:()=>Ke(null),children:"×"})]}),Ma&&r.jsxs("div",{className:"mb-3 rounded-lg border border-emerald-800/40 bg-emerald-950/20 px-3 py-2 text-sm text-emerald-300",children:[Ma,r.jsx("button",{type:"button",className:"ml-2 text-emerald-400 hover:text-emerald-200",onClick:()=>pn(null),children:"×"})]}),V?r.jsx("p",{className:"text-sm text-zinc-500",children:"Loading…"}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsx(lt,{tone:st?"positive":t?"caution":"negative",children:st?"Connected":t?"Ready to connect":"App credentials missing"})]}),st?r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:st.domain}),r.jsx("button",{type:"button",className:"ml-auto text-xs text-zinc-500 hover:text-rose-400 transition-colors",onClick:Cl,children:"Disconnect"})]}),r.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:["Canonry stores OAuth tokens per canonical domain. This project currently maps to ",r.jsx("code",{children:st.domain}),"."]})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Selected property"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:st.propertyId??"No property selected yet"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:cs(st.updatedAt)})]})]})]}):r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-5",children:[r.jsx("p",{className:"text-sm text-zinc-300",children:t?"Generate a Google OAuth link for this project and have the client sign in with a Google account that already has access to the correct Search Console property.":"Set Google OAuth client credentials first. Once configured, you can generate a consent link for this project domain."}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t?r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:ue,onClick:Sd,children:ue?"Opening…":"Connect Google Search Console"}):r.jsx(oe,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsx(St,{to:"/settings",children:"Open Settings"})}),!t&&r.jsx("p",{className:"text-xs text-zinc-500",children:"The same Google OAuth app credentials are shared across all projects."})]})]})]}),st&&!st.sitemapUrl&&r.jsx("div",{className:"rounded-lg border border-amber-800/40 bg-amber-950/20 px-4 py-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"mt-0.5 text-amber-400",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-5 w-5","aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 6a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 6zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Set your sitemap URL"}),r.jsx("p",{className:"mt-1 text-xs text-amber-400/70",children:"Canonry uses your sitemap to discover URLs for index coverage inspection. Auto-discover from GSC or enter it manually."}),r.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx(oe,{type:"button",size:"sm",disabled:ht.isPending||!st.propertyId,onClick:ms,children:ht.isPending?"Discovering…":"Auto-discover from GSC"}),r.jsx("span",{className:"self-center text-xs text-amber-400/60",children:"or enter manually:"})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-amber-800/40 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-500 focus:border-amber-600 focus:outline-none",type:"url",placeholder:"https://example.com/sitemap.xml",value:Ue,onChange:B=>Qe(B.target.value),onKeyDown:B=>B.key==="Enter"&&void Cs()}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:Vt||!Ue.trim(),onClick:Cs,children:Vt?"Saving…":"Save sitemap URL"})]})]})]})]})}),(st||Xr)&&r.jsxs(r.Fragment,{children:[r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Coverage"}),r.jsx("h3",{children:"Index coverage"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Y&&Y.notIndexed.length>0&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:Me,onClick:()=>{Pa()},children:Me?"Requesting…":`Request indexing (${Y.notIndexed.length})`}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:ge,onClick:()=>{Nl()},children:ge?"Loading…":"Refresh coverage"})]})]}),Y&&Y.summary.total>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mt-6 flex flex-col items-center",children:(()=>{const B=Y.summary.indexed+Y.summary.notIndexed,fe=B>0?Y.summary.indexed/B:0,xt=B>0?Y.summary.notIndexed/B:0,Gt=54,ln=2*Math.PI*Gt,Ia=ln*(1-fe),ps=ln*xt,cn=ln*fe;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative h-48 w-48",children:[r.jsxs("svg",{viewBox:"0 0 128 128",className:"h-full w-full","aria-hidden":"true",children:[r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"rgba(255,255,255,0.04)",strokeWidth:"14"}),r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"#10b981",strokeWidth:"14",strokeDasharray:ln,strokeDashoffset:Ia,strokeLinecap:"round",transform:"rotate(-90 64 64)",style:{transition:"stroke-dashoffset 0.6s ease"}}),Y.summary.notIndexed>0&&r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"#52525b",strokeWidth:"14",strokeDasharray:`${ps} ${ln-ps}`,strokeDashoffset:-cn,transform:"rotate(-90 64 64)",style:{transition:"stroke-dasharray 0.6s ease, stroke-dashoffset 0.6s ease"}})]}),r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[r.jsxs("span",{className:"text-3xl font-bold tabular-nums text-zinc-50",children:[(fe*100).toFixed(0),"%"]}),r.jsx("span",{className:"text-xs uppercase tracking-widest text-zinc-500 mt-0.5",children:"Indexed"})]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-center gap-8",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Y.summary.indexed.toLocaleString()}),r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:"Indexed"})]})]}),r.jsx("div",{className:"h-8 w-px bg-zinc-800"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-zinc-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Y.summary.notIndexed.toLocaleString()}),r.jsxs("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:["Not indexed",(Y.reasonGroups??[]).length>0&&r.jsxs("span",{className:"ml-1 text-zinc-600",children:["· ",(Y.reasonGroups??[]).length," ",(Y.reasonGroups??[]).length===1?"reason":"reasons"]})]})]})]}),Y.summary.deindexed>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-px bg-zinc-800"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-rose-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Y.summary.deindexed.toLocaleString()}),r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:"Deindexed"})]})]})]})]})]})})()}),r.jsx("div",{className:"mt-3 flex gap-1",children:["indexed","notIndexed","deindexed"].map(B=>{const fe=B==="indexed"?Y.indexed.length:B==="notIndexed"?Y.notIndexed.length:Y.deindexed.length,xt=B==="indexed"?"Indexed":B==="notIndexed"?"Not Indexed":"Deindexed";return r.jsxs("button",{type:"button",className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${Et===B?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,onClick:()=>{re(B),Je(null)},children:[xt," (",fe,")"]},B)})}),r.jsxs("div",{className:"mt-3 overflow-x-auto",children:[Et==="indexed"&&Y.indexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Verdict"}),r.jsx("th",{className:"text-left",children:"Last Crawl"}),r.jsx("th",{className:"text-left",children:"Mobile"})]})}),r.jsx("tbody",{children:Y.indexed.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.verdict??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.crawlTime?B.crawlTime.split("T")[0]:"—"}),r.jsx("td",{className:"text-zinc-400",children:B.isMobileFriendly===!0?"Yes":B.isMobileFriendly===!1?"No":"—"})]},B.id))})]}),Et==="notIndexed"&&!Qt&&(Y.reasonGroups??[]).length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"Reason"}),r.jsx("th",{className:"text-right",children:"Pages"})]})}),r.jsx("tbody",{children:(Y.reasonGroups??[]).map(B=>r.jsxs("tr",{className:"cursor-pointer hover:bg-zinc-800/40",onClick:()=>Je(B.reason),children:[r.jsx("td",{className:"text-zinc-200",children:B.reason}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.count})]},B.reason))})]}),Et==="notIndexed"&&!Qt&&(Y.reasonGroups??[]).length===0&&Y.notIndexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Indexing State"}),r.jsx("th",{className:"text-left",children:"Coverage"})]})}),r.jsx("tbody",{children:Y.notIndexed.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.indexingState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.coverageState??"Unknown"})]},B.id))})]}),Et==="notIndexed"&&Qt&&(()=>{const B=(Y.reasonGroups??[]).find(fe=>fe.reason===Qt);return B?r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 transition-colors",onClick:()=>Je(null),children:["←"," Back to reasons"]})}),r.jsxs("div",{className:"mb-3 flex items-center justify-between rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200",children:B.reason}),r.jsxs("p",{className:"mt-1 text-xs text-zinc-500",children:[B.count," affected page",B.count!==1?"s":""]})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:Me,onClick:()=>{Gi(B.urls.map(fe=>fe.url))},children:Me?"Requesting…":`Request indexing (${B.count})`})]}),r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Last Crawl"}),r.jsx("th",{className:"w-8"})]})}),r.jsx("tbody",{children:B.urls.map(fe=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:fe.url}),r.jsx("td",{className:"text-zinc-400",children:fe.crawlTime?fe.crawlTime.split("T")[0]:"—"}),r.jsx("td",{children:r.jsx("button",{type:"button",className:"text-xs text-zinc-500 hover:text-zinc-200 transition-colors",disabled:Me,onClick:()=>{Gi([fe.url])},title:"Request indexing",children:"Index"})})]},fe.id))})]})]}):null})(),Et==="deindexed"&&Y.deindexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Previous"}),r.jsx("th",{className:"text-left",children:"Current"}),r.jsx("th",{className:"text-left",children:"Detected"})]})}),r.jsx("tbody",{children:Y.deindexed.map((B,fe)=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.previousState}),r.jsx("td",{className:"text-zinc-400",children:B.currentState}),r.jsx("td",{className:"text-zinc-400",children:B.transitionDate.split("T")[0]})]},`${B.url}-${fe}`))})]}),(Et==="indexed"&&Y.indexed.length===0||Et==="notIndexed"&&!Qt&&Y.notIndexed.length===0||Et==="deindexed"&&Y.deindexed.length===0)&&r.jsx("p",{className:"text-sm text-zinc-500",children:"No URLs in this category."})]})]}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:ge?"Loading coverage data…":"No coverage data yet. Inspect your sitemap to populate this view."})]}),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Performance"}),r.jsx("h3",{children:"Search performance"})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:de,onClick:()=>{zn()},children:de?"Loading…":"Apply filters"})]}),f.length>0&&(()=>{const B=new Map;for(const $e of f){const We=B.get($e.date);We?(We.clicks+=$e.clicks,We.impressions+=$e.impressions):B.set($e.date,{clicks:$e.clicks,impressions:$e.impressions})}const fe=[...B.entries()].sort(([$e],[We])=>$e.localeCompare(We));if(fe.length===0)return null;const xt=Math.max(...fe.map(([,$e])=>$e.impressions),1),Gt=fe.reduce(($e,[,We])=>$e+We.clicks,0),ln=fe.reduce(($e,[,We])=>$e+We.impressions,0),Ia=ln>0?(Gt/ln*100).toFixed(1):"0.0",ps=700,cn=220,it={top:12,bottom:36,left:48,right:12},sn=ps-it.left-it.right,_n=cn-it.top-it.bottom,ks=sn/fe.length,Ba=Math.max(Math.min(ks*.35,24),4),zl=Math.max(Ba*.15,1),_l=$e=>{if($e<=0)return 1;const We=Math.pow(10,Math.floor(Math.log10($e))),at=$e/We,ss=at<=1.5?1.5:at<=3?3:at<=5?5:10;return Math.ceil(ss*We)},gs=4,Js=Math.ceil(_l(xt)/gs)*gs,Xs=Array.from({length:gs+1},($e,We)=>Js/gs*We),Ws=$e=>$e>=1e3?`${($e/1e3).toFixed($e>=1e4?0:1)}k`:String($e);return r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center gap-5 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-emerald-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Clicks ",r.jsx("span",{className:"text-zinc-200 tabular-nums font-medium",children:Gt.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-blue-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Impressions ",r.jsx("span",{className:"text-zinc-200 tabular-nums font-medium",children:ln.toLocaleString()})]})]}),r.jsxs("span",{className:"text-xs text-zinc-500",children:["CTR ",r.jsxs("span",{className:"text-amber-400 tabular-nums font-medium",children:[Ia,"%"]})]})]}),r.jsx("div",{className:"relative w-full",style:{aspectRatio:`${ps} / ${cn}`},children:r.jsxs("svg",{viewBox:`0 0 ${ps} ${cn}`,className:"h-full w-full",children:[Xs.map(($e,We)=>{const at=it.top+_n-$e/Js*_n;return r.jsxs("g",{children:[r.jsx("line",{x1:it.left,y1:at,x2:ps-it.right,y2:at,stroke:"rgba(255,255,255,0.06)",strokeWidth:"1"}),r.jsx("text",{x:it.left-6,y:at+3.5,textAnchor:"end",fill:"#a1a1aa",fontSize:"10",fontFamily:"inherit",children:Ws($e)})]},`t-${We}`)}),fe.map(([$e,We],at)=>{const ss=it.left+ks*at+ks/2,Zi=We.impressions/Js*_n,ys=We.clicks/Js*_n;return r.jsxs("g",{children:[r.jsx("title",{children:`${$e}
|
|
234
|
-
Clicks: ${We.clicks}
|
|
235
|
-
Impressions: ${We.impressions}
|
|
236
|
-
CTR: ${We.impressions>0?(We.clicks/We.impressions*100).toFixed(1):0}%`}),r.jsx("rect",{x:ss-Ba-zl/2,y:it.top+_n-Zi,width:Ba,height:Math.max(Zi,1),rx:2,fill:"#3b82f6",opacity:.85}),r.jsx("rect",{x:ss+zl/2,y:it.top+_n-ys,width:Ba,height:Math.max(ys,1),rx:2,fill:"#10b981",opacity:.85})]},$e)}),(()=>{const $e=Math.min(fe.length,7);return Array.from({length:$e},(We,at)=>{const ss=fe.length===1?0:Math.round(at/($e-1)*(fe.length-1)),Zi=it.left+ks*ss+ks/2;return r.jsx("text",{x:Zi,y:cn-8,textAnchor:"middle",fill:"#71717a",fontSize:"10",fontFamily:"inherit",children:fe[ss][0].slice(5)},`xl-${ss}`)})})()]})})]})})(),r.jsxs("div",{className:"mt-3 grid gap-2 lg:grid-cols-5",children:[r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"date",value:E.startDate,onChange:B=>O(fe=>({...fe,startDate:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"date",value:E.endDate,onChange:B=>O(fe=>({...fe,endDate:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter query",value:E.query,onChange:B=>O(fe=>({...fe,query:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter page",value:E.page,onChange:B=>O(fe=>({...fe,page:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"number",min:"1",placeholder:"Limit",value:E.limit,onChange:B=>O(fe=>({...fe,limit:B.target.value}))})]}),f.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"Date"}),r.jsx("th",{className:"text-left",children:"Query"}),r.jsx("th",{className:"text-left",children:"Page"}),r.jsx("th",{className:"text-right",children:"Clicks"}),r.jsx("th",{className:"text-right",children:"Impressions"}),r.jsx("th",{className:"text-right",children:"CTR"}),r.jsx("th",{className:"text-right",children:"Position"})]})}),r.jsx("tbody",{children:f.map((B,fe)=>r.jsxs("tr",{children:[r.jsx("td",{className:"text-zinc-400",children:B.date}),r.jsx("td",{className:"max-w-xs truncate text-zinc-200",children:B.query}),r.jsx("td",{className:"max-w-xs truncate text-zinc-400",children:B.page}),r.jsx("td",{className:"text-right tabular-nums text-zinc-300",children:B.clicks.toLocaleString()}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.impressions.toLocaleString()}),r.jsxs("td",{className:"text-right tabular-nums text-zinc-400",children:[(Number.isFinite(B.ctr)?B.ctr*100:0).toFixed(1),"%"]}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.position.toFixed(1)})]},`${B.date}:${B.query}:${B.page}:${fe}`))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No performance rows match the current filters yet."})]}),r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Inspection"}),r.jsx("h3",{children:"Inspect a URL"})]})}),r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"https://example.com/page",value:k,onChange:B=>A(B.target.value),onKeyDown:B=>B.key==="Enter"&&void kl()}),r.jsx(oe,{type:"button",size:"sm",disabled:J||!st?.propertyId||!k.trim(),onClick:kl,children:J?"Inspecting…":"Inspect URL"})]}),b&&r.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Indexing state"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:b.indexingState??"Unknown"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Verdict"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:b.verdict??"Unknown"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Mobile friendly"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:eb(b.isMobileFriendly)})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last crawl"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:cs(b.crawlTime)})]})]})]}),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"History"}),r.jsx("h3",{children:"Inspection log"})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:T,onClick:()=>{$a()},children:T?"Loading…":"Refresh history"})]}),r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter exact URL",value:H,onChange:B=>ee(B.target.value)}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:T,onClick:()=>{$a()},children:"Apply filter"})]}),p.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Indexing"}),r.jsx("th",{className:"text-left",children:"Verdict"}),r.jsx("th",{className:"text-left",children:"Coverage"}),r.jsx("th",{className:"text-left",children:"Mobile"}),r.jsx("th",{className:"text-left",children:"Inspected"})]})}),r.jsx("tbody",{children:p.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-300",children:B.indexingState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.verdict??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.coverageState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:eb(B.isMobileFriendly)}),r.jsx("td",{className:"text-zinc-400",children:cs(B.inspectedAt)})]},B.id))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No inspection history yet."})]}),r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Deindexed"}),r.jsx("h3",{children:"Recent indexing losses"})]})}),y.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Previous"}),r.jsx("th",{className:"text-left",children:"Current"}),r.jsx("th",{className:"text-left",children:"Changed at"})]})}),r.jsx("tbody",{children:y.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.previousState??"Unknown"}),r.jsx("td",{className:"text-zinc-300",children:B.currentState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:cs(B.transitionDate)})]},`${B.url}:${B.transitionDate}`))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No deindexed transitions recorded."})]})]}),st&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border-t border-zinc-800/60 pt-3",children:r.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>nn(B=>!B),children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-zinc-500 transition-transform ${Mn?"rotate-90":""}`,"aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),r.jsx("span",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Setup & Configuration"})]})}),Mn&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Property"}),r.jsx("h3",{children:"Pick the Search Console property"})]})}),r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`gsc-property-${e}`,children:"Property URL"}),r.jsx("select",{id:`gsc-property-${e}`,className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:S,disabled:xe||c.length===0,onChange:B=>C(B.target.value),children:c.length===0?r.jsx("option",{value:"",children:xe?"Loading properties…":"No properties available"}):c.map(B=>r.jsxs("option",{value:B.siteUrl,children:[B.siteUrl," · ",B.permissionLevel]},B.siteUrl))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:xe,onClick:()=>{ce(st)},children:xe?"Refreshing…":"Refresh properties"}),r.jsx(oe,{type:"button",size:"sm",disabled:!S||ae,onClick:Wr,children:ae?"Saving…":"Save property"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"The selected property is used for future syncs and URL inspections for this project."})]})]}),r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Sync"}),r.jsx("h3",{children:"Import GSC performance data"})]})}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-[160px_1fr]",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`gsc-sync-days-${e}`,children:"Days"}),r.jsx("input",{id:`gsc-sync-days-${e}`,type:"number",min:"1",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",value:R,onChange:B=>z(B.target.value)})]}),r.jsxs("label",{className:"flex items-center gap-2 rounded border border-zinc-800/60 bg-zinc-900/20 px-3 py-2 text-sm text-zinc-300",children:[r.jsx("input",{type:"checkbox",checked:$,onChange:B=>P(B.target.checked)}),"Replace existing imported rows for the requested range"]})]}),r.jsx(oe,{type:"button",size:"sm",disabled:ns.isPending||!st.propertyId,onClick:Fi,children:ns.isPending?"Queueing…":"Queue sync"}),!st.propertyId&&r.jsx("p",{className:"text-xs text-amber-400",children:"Select a Search Console property before queueing a sync."})]})]})]}),r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Sitemap"}),r.jsx("h3",{children:"Sitemap configuration"})]})}),r.jsxs("div",{className:"mt-3 space-y-3",children:[st.sitemapUrl&&r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Current sitemap URL"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200 break-all",children:st.sitemapUrl})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:me||!st.propertyId,onClick:()=>{Ua()},children:me?"Loading…":"Browse sitemaps from GSC"}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:ht.isPending||!st.propertyId,onClick:ms,children:ht.isPending?"Discovering…":"Auto-discover and queue inspection"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Browse lists available sitemaps without queueing a run. Auto-discover saves the primary sitemap and queues an inspection."}),Ye&&Ye.length>0&&r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3 space-y-2",children:[r.jsxs("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:["Sitemaps (",Ye.length,")"]}),Ye.map(B=>{const fe=B.contents?.[0];return r.jsxs("div",{className:"flex items-start justify-between gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-zinc-200 break-all",children:B.path}),B.lastSubmitted&&r.jsxs("p",{className:"text-zinc-500",children:["Submitted: ",B.lastSubmitted.split("T")[0]]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[fe&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-zinc-300",children:[fe.indexed," / ",fe.submitted]}),r.jsx("p",{className:"text-zinc-500",children:"indexed"})]}),r.jsx("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 transition-colors",onClick:()=>Qe(B.path),children:"Use"})]})]},B.path)})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:st.sitemapUrl?"Update sitemap URL…":"https://example.com/sitemap.xml",value:Ue,onChange:B=>Qe(B.target.value),onKeyDown:B=>B.key==="Enter"&&Ue.trim()&&void Cs()}),r.jsx(oe,{type:"button",size:"sm",disabled:Vt||!Ue.trim(),onClick:Cs,children:Vt?"Saving…":st.sitemapUrl?"Update":"Save"})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"Sitemap URL for inspection (leave empty for saved default)",id:`gsc-sitemap-inspect-${e}`}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:gn.isPending||!st.propertyId,onClick:async()=>{const fe=document.getElementById(`gsc-sitemap-inspect-${e}`)?.value?.trim()||st.sitemapUrl||void 0;Ke(null),pn(null);try{await gn.mutateAsync({projectName:e,projectLabel:e,opts:{sitemapUrl:fe}})}catch{}},children:gn.isPending?"Queueing…":"Inspect sitemap"})]}),!st.propertyId&&r.jsx("p",{className:"text-xs text-amber-400",children:"Select a Search Console property first."})]})]})]})]})]})]})}function R$({project:e,onUpdateProject:t,onRefresh:n}){const[a,o]=w.useState(!1),[c,u]=w.useState(!1),[f,m]=w.useState(null),[p,v]=w.useState(e.displayName),[y,x]=w.useState(e.canonicalDomain),[b,N]=w.useState(e.country),[S,C]=w.useState(e.language),[k,A]=w.useState(e.ownedDomains??[]),[R,z]=w.useState(""),[$,P]=w.useState(null),[E,O]=w.useState(!1),[H,ee]=w.useState(!1),[V,se]=w.useState(""),[ue,_e]=w.useState(""),[xe,K]=w.useState(""),[ae,pe]=w.useState(""),[de,U]=w.useState("");w.useEffect(()=>{a||(v(e.displayName),x(e.canonicalDomain),N(e.country),C(e.language),A(e.ownedDomains??[]))},[e,a]);function T(){o(!1),m(null),v(e.displayName),x(e.canonicalDomain),N(e.country),C(e.language),A(e.ownedDomains??[]),z("")}function L(){const le=R.trim();le&&(k.includes(le)||A([...k,le]),z(""))}function J(le){A(k.filter(Ue=>Ue!==le))}async function X(){if(!(!p.trim()||!y.trim()||!b.trim()||!S.trim())){u(!0),m(null);try{await t(e.name,{displayName:p.trim(),canonicalDomain:y.trim(),ownedDomains:k,country:b.trim(),language:S.trim()}),o(!1),Fe({title:"Project settings saved",detail:`${p.trim()} was updated.`,tone:"positive",dedupeKey:`project:update:${e.name}`,dedupeMode:"replace"})}catch(le){m(le instanceof Error?le.message:"Failed to save")}finally{u(!1)}}}async function Y(){const le=V.trim(),Ue=ue.trim(),Qe=xe.trim(),Vt=ae.trim();if(!(!le||!Ue||!Qe||!Vt)){O(!0),P(null);try{const Ut={label:le,city:Ue,region:Qe,country:Vt};de.trim()&&(Ut.timezone=de.trim()),await e2(e.name,Ut),n(),se(""),_e(""),K(""),pe(""),U(""),ee(!1),Fe({title:"Location added",detail:`${le} is now available for ${e.name}.`,tone:"positive",dedupeKey:`project:location:add:${e.name}:${le}`,dedupeMode:"drop"})}catch(Ut){P(Ut instanceof Error?Ut.message:"Failed to add location")}finally{O(!1)}}}async function he(le){O(!0),P(null);try{await t2(e.name,le),n(),Fe({title:"Location removed",detail:`${le} was removed from ${e.name}.`,tone:"positive",dedupeKey:`project:location:remove:${e.name}:${le}`,dedupeMode:"drop"})}catch(Ue){P(Ue instanceof Error?Ue.message:"Failed to remove location")}finally{O(!1)}}async function ge(le){O(!0),P(null);try{await n2(e.name,le),n(),Fe({title:"Default location updated",detail:`${le} is now the default for ${e.name}.`,tone:"positive",dedupeKey:`project:location:default:${e.name}`,dedupeMode:"replace"})}catch(Ue){P(Ue instanceof Error?Ue.message:"Failed to set default location")}finally{O(!1)}}const we=p!==e.displayName||y!==e.canonicalDomain||b!==e.country||S!==e.language||JSON.stringify(k)!==JSON.stringify(e.ownedDomains??[]),me="w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",Ie="block text-xs font-medium text-zinc-400 mb-1",Ye=V.trim()&&ue.trim()&&xe.trim()&&ae.trim();return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Configuration"}),r.jsx("h2",{children:"Project settings"})]}),!a&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),children:"Edit settings"})]}),f&&r.jsxs("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:[f,r.jsx("button",{type:"button",className:"ml-2 text-rose-400 hover:text-rose-200",onClick:()=>m(null),children:"×"})]}),a?r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:Ie,children:"Display name"}),r.jsx("input",{className:me,type:"text",value:p,onChange:le=>v(le.target.value),placeholder:"My Project"})]}),r.jsxs("div",{children:[r.jsx("label",{className:Ie,children:"Canonical domain"}),r.jsx("input",{className:me,type:"text",value:y,onChange:le=>x(le.target.value),placeholder:"example.com"})]}),r.jsxs("div",{children:[r.jsx("label",{className:Ie,children:"Country"}),r.jsx("input",{className:me,type:"text",value:b,onChange:le=>N(le.target.value),placeholder:"US",maxLength:2})]}),r.jsxs("div",{children:[r.jsx("label",{className:Ie,children:"Language"}),r.jsx("input",{className:me,type:"text",value:S,onChange:le=>C(le.target.value),placeholder:"en"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:Ie,children:"Owned domains"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.map(le=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:[le,r.jsx("button",{type:"button",className:"ml-0.5 text-zinc-500 hover:text-zinc-200 transition-colors",onClick:()=>J(le),"aria-label":`Remove ${le}`,children:"×"})]},le))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:`${me} flex-1`,type:"text",placeholder:"docs.example.com",value:R,onChange:le=>z(le.target.value),onKeyDown:le=>le.key==="Enter"&&(le.preventDefault(),L())}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:!R.trim(),onClick:L,children:"Add"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-zinc-800/60",children:[r.jsx(oe,{type:"button",disabled:c||!we||!p.trim()||!y.trim(),onClick:X,children:c?"Saving...":"Save changes"}),r.jsx(oe,{type:"button",variant:"outline",disabled:c,onClick:T,children:"Cancel"})]})]}):r.jsx("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 overflow-hidden",children:r.jsx("table",{className:"w-full text-sm",children:r.jsxs("tbody",{children:[r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium w-40",children:"Display name"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.displayName||"—"})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Canonical domain"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.canonicalDomain})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Owned domains"}),r.jsx("td",{className:"px-4 py-2.5",children:(e.ownedDomains??[]).length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.ownedDomains.map(le=>r.jsx("span",{className:"rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:le},le))}):r.jsx("span",{className:"text-zinc-500",children:"—"})})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Country"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.country})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Language"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.language})]}),r.jsxs("tr",{children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium align-top pt-3",children:"Locations"}),r.jsxs("td",{className:"px-4 py-2.5",children:[$&&r.jsxs("div",{className:"mb-2 rounded border border-rose-800/40 bg-rose-950/20 px-2 py-1 text-xs text-rose-300",children:[$,r.jsx("button",{type:"button",className:"ml-1 text-rose-400 hover:text-rose-200",onClick:()=>P(null),children:"×"})]}),(e.locations??[]).length>0?r.jsxs("table",{className:"w-full text-xs mb-2",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-zinc-600",children:[r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Label"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"City"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Region"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Country"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Timezone"}),r.jsx("th",{className:"pb-1"})]})}),r.jsx("tbody",{children:e.locations.map(le=>r.jsxs("tr",{className:"border-t border-zinc-800/30",children:[r.jsx("td",{className:"py-1.5 pr-3",children:r.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${le.label===e.defaultLocation?"border-emerald-700/60 bg-emerald-950/30 text-emerald-300":"border-zinc-700/60 bg-zinc-800/40 text-zinc-300"}`,children:[le.label,le.label===e.defaultLocation?" ★":""]})}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.city}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.region}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.country}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-500",children:le.timezone??"—"}),r.jsx("td",{className:"py-1.5",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[le.label!==e.defaultLocation&&r.jsx("button",{type:"button",disabled:E,onClick:()=>ge(le.label),className:"text-[10px] text-zinc-500 hover:text-emerald-400 transition-colors disabled:opacity-40","aria-label":`Set ${le.label} as default location`,children:"Set default"}),r.jsx("button",{type:"button",disabled:E,onClick:()=>he(le.label),className:"text-[10px] text-zinc-500 hover:text-rose-400 transition-colors disabled:opacity-40","aria-label":`Remove location ${le.label}`,children:"Remove"})]})})]},le.label))})]}):r.jsx("p",{className:"text-zinc-500 text-xs mb-2",children:"No locations configured"}),H?r.jsxs("div",{className:"mt-2 rounded border border-zinc-800 bg-zinc-900/50 p-3 space-y-2",children:[r.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-zinc-500",children:"Add location"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Label *"}),r.jsx("input",{className:me,type:"text",value:V,onChange:le=>se(le.target.value),placeholder:"nyc"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"City *"}),r.jsx("input",{className:me,type:"text",value:ue,onChange:le=>_e(le.target.value),placeholder:"New York"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Region *"}),r.jsx("input",{className:me,type:"text",value:xe,onChange:le=>K(le.target.value),placeholder:"NY"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Country *"}),r.jsx("input",{className:me,type:"text",value:ae,onChange:le=>pe(le.target.value),placeholder:"US",maxLength:2})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Timezone (optional)"}),r.jsx("input",{className:me,type:"text",value:de,onChange:le=>U(le.target.value),placeholder:"America/New_York"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[r.jsx(oe,{type:"button",size:"sm",disabled:E||!Ye,onClick:Y,children:E?"Adding...":"Add location"}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:E,onClick:()=>{ee(!1),P(null)},children:"Cancel"})]})]}):r.jsx(oe,{type:"button",size:"sm",variant:"outline",onClick:()=>ee(!0),children:"+ Add location"})]})]})]})})})]})}const A$=[{value:"daily",label:"Every day"},{value:"weekly@mon",label:"Every Monday"},{value:"weekly@wed",label:"Every Wednesday"},{value:"weekly@fri",label:"Every Friday"},{value:"twice-daily",label:"Twice a day (6am & 6pm)"},{value:"custom",label:"Custom cron expression"}],fS=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","America/Vancouver","Europe/London","Europe/Paris","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function T$({projectName:e}){const[t,n]=w.useState("loading"),[a,o]=w.useState(!1),[c,u]=w.useState("daily"),[f,m]=w.useState(6),[p,v]=w.useState(""),[y,x]=w.useState("UTC"),[b,N]=w.useState(!1),[S,C]=w.useState(""),[k,A]=w.useState(!1),[R,z]=w.useState(!1),[$,P]=w.useState(null);w.useEffect(()=>{u2(e).then(n).catch(()=>n(null))},[e]);const E=()=>{if(t&&t!=="loading"){const V=LE(t.preset??null,t.cronExpr);u(V.freq),m(V.hour),v(V.customCron);const se=fS.includes(t.timezone);x(se?t.timezone:"Other"),N(!se),C(se?"":t.timezone)}else u("daily"),m(6),v(""),x("UTC"),N(!1),C("");P(null),o(!0)},O=async()=>{A(!0),P(null);try{const se={timezone:b?S.trim()||"UTC":y};c==="custom"?se.cron=p.trim():se.preset=DE(c,f);const ue=await Kx(e,se);n(ue),o(!1),Fe({title:"Schedule saved",detail:Zh(ue.preset??null,ue.cronExpr,ue.timezone),tone:"positive",dedupeKey:`schedule:${e}`,dedupeMode:"replace"})}catch(V){P(V instanceof Error?V.message:"Failed to save schedule")}finally{A(!1)}},H=async()=>{if(!(!t||t==="loading")){A(!0),P(null);try{const V={timezone:t.timezone,enabled:!t.enabled};t.preset?V.preset=t.preset:V.cron=t.cronExpr;const se=await Kx(e,V);n(se),Fe({title:se.enabled?"Schedule resumed":"Schedule paused",detail:Zh(se.preset??null,se.cronExpr,se.timezone),tone:"positive",dedupeKey:`schedule:toggle:${e}`,dedupeMode:"replace"})}catch(V){P(V instanceof Error?V.message:"Failed to update schedule")}finally{A(!1)}}},ee=async()=>{z(!0),P(null);try{await d2(e),n(null),o(!1),Fe({title:"Schedule removed",detail:`${e} will no longer run automatically.`,tone:"positive",dedupeKey:`schedule:remove:${e}`,dedupeMode:"drop"})}catch(V){P(V instanceof Error?V.message:"Failed to remove schedule")}finally{z(!1)}};return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Automation"}),r.jsx("h2",{children:"Scheduled runs"})]}),t!=="loading"&&!a&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:E,children:t?"Edit schedule":"+ Set schedule"})]}),t==="loading"&&r.jsx("p",{className:"supporting-copy",children:"Loading..."}),t!=="loading"&&!a&&t===null&&r.jsx(De,{className:"surface-card compact-card",children:r.jsx("p",{className:"supporting-copy",children:"No schedule configured. Set one to automatically trigger visibility sweeps."})}),t!=="loading"&&!a&&t!==null&&r.jsxs(De,{className:"surface-card compact-card",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200",children:Zh(t.preset??null,t.cronExpr,t.timezone)}),r.jsxs("p",{className:"text-xs text-zinc-500",children:["Cron: ",r.jsx("span",{className:"font-mono",children:t.cronExpr})]}),t.nextRunAt&&r.jsxs("p",{className:"text-xs text-zinc-500",children:["Next run: ",new Date(t.nextRunAt).toLocaleString()]}),t.lastRunAt&&r.jsxs("p",{className:"text-xs text-zinc-500",children:["Last run: ",new Date(t.lastRunAt).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(lt,{tone:t.enabled?"positive":"neutral",children:t.enabled?"Active":"Paused"}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:H,children:t.enabled?"Pause":"Resume"}),r.jsx(oe,{type:"button",variant:"ghost",size:"sm",disabled:R,onClick:ee,children:R?"Removing...":"Remove"})]})]}),$&&r.jsx("p",{className:"text-rose-400 text-sm mt-2",children:$})]}),a&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Frequency"}),r.jsx("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:c,onChange:V=>u(V.target.value),children:A$.map(V=>r.jsx("option",{value:V.value,children:V.label},V.value))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Time"}),r.jsx("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none disabled:opacity-40",value:f,disabled:c==="twice-daily"||c==="custom",onChange:V=>m(parseInt(V.target.value)),children:Array.from({length:24},(V,se)=>r.jsx("option",{value:se,children:Om(se)},se))})]})]}),c==="custom"&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Cron expression"}),r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 font-mono focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"0 9 * * 1-5",value:p,onChange:V=>v(V.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Timezone"}),r.jsxs("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:b?"Other":y,onChange:V=>{V.target.value==="Other"?(N(!0),x("Other")):(N(!1),x(V.target.value))},children:[fS.map(V=>r.jsx("option",{value:V,children:V},V)),r.jsxs("option",{value:"Other",children:["Other (enter manually)","…"]})]}),b&&r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"e.g. America/New_York",value:S,onChange:V=>C(V.target.value)})]}),$&&r.jsx("p",{className:"text-rose-400 text-sm",children:$}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!1),P(null)},children:"Cancel"}),r.jsx(oe,{type:"button",size:"sm",disabled:k||c==="custom"&&!p.trim(),onClick:O,children:k?"Saving...":"Save schedule"})]})]})]})}const O$=[{value:"citation.lost",label:"Citation lost"},{value:"citation.gained",label:"Citation gained"},{value:"run.completed",label:"Run completed"},{value:"run.failed",label:"Run failed"}];function D$({projectName:e}){const[t,n]=w.useState("loading"),[a,o]=w.useState(!1),[c,u]=w.useState(""),[f,m]=w.useState(["citation.lost","citation.gained"]),[p,v]=w.useState(!1),[y,x]=w.useState(null),[b,N]=w.useState({});w.useEffect(()=>{f2(e).then(n).catch(()=>n([]))},[e]);const S=R=>{m(z=>z.includes(R)?z.filter($=>$!==R):[...z,R])},C=async()=>{if(!(!c.trim()||f.length===0)){v(!0),x(null);try{const R=await h2(e,{channel:"webhook",url:c.trim(),events:f});n(z=>z==="loading"?[R]:[...z,R]),u(""),m(["citation.lost","citation.gained"]),o(!1),Fe({title:"Webhook added",detail:`Notifications will be sent to ${R.url}.`,tone:"positive",dedupeKey:`notification:add:${e}`,dedupeMode:"drop"})}catch(R){x(R instanceof Error?R.message:"Failed to add webhook")}finally{v(!1)}}},k=async R=>{try{await m2(e,R),n(z=>z==="loading"?z:z.filter($=>$.id!==R)),Fe({title:"Webhook removed",detail:`${e} no longer sends notifications to this endpoint.`,tone:"positive",dedupeKey:`notification:remove:${e}:${R}`,dedupeMode:"drop"})}catch(z){x(z instanceof Error?z.message:"Failed to remove webhook")}},A=async R=>{N(z=>({...z,[R]:{state:"testing"}}));try{const z=await p2(e,R);N($=>({...$,[R]:{state:z.ok?"ok":"fail",status:z.status}})),z.ok&&Fe({title:"Test notification sent",detail:`Webhook returned status ${z.status}.`,tone:"positive",dedupeKey:`notification:test:${e}:${R}`,dedupeMode:"replace"})}catch{N(z=>({...z,[R]:{state:"fail"}}))}};return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Automation"}),r.jsx("h2",{children:"Notifications"})]}),t!=="loading"&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!a),x(null)},children:a?"Cancel":"+ Add webhook"})]}),a&&r.jsxs("div",{className:"mb-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Webhook URL"}),r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"https://hooks.example.com/canonry",value:c,onChange:R=>u(R.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Trigger on"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:O$.map(R=>r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",className:"rounded border-zinc-600 bg-zinc-800",checked:f.includes(R.value),onChange:()=>S(R.value)}),r.jsx("span",{className:"text-sm text-zinc-300",children:R.label})]},R.value))})]}),y&&r.jsx("p",{className:"text-rose-400 text-sm",children:y}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!1),x(null)},children:"Cancel"}),r.jsx(oe,{type:"button",size:"sm",disabled:p||!c.trim()||f.length===0,onClick:C,children:p?"Adding...":"Add webhook"})]})]}),t==="loading"&&r.jsx("p",{className:"supporting-copy",children:"Loading..."}),t!=="loading"&&t.length===0&&!a&&r.jsx(De,{className:"surface-card compact-card",children:r.jsx("p",{className:"supporting-copy",children:"No webhooks configured. Add one to get alerted when citations change or runs complete."})}),t!=="loading"&&t.length>0&&r.jsxs("div",{className:"evidence-table-wrap",children:[r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Endpoint"}),r.jsx("th",{children:"Events"}),r.jsx("th",{children:"Status"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:t.map(R=>r.jsxs("tr",{children:[r.jsx("td",{className:"evidence-keyword-cell",children:r.jsx("span",{className:"font-mono text-xs text-zinc-300 break-all",title:R.urlHost,children:R.urlDisplay??R.url})}),r.jsx("td",{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:R.events.map(z=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-zinc-700 bg-zinc-800/60 px-2 py-0.5 text-[10px] font-medium text-zinc-400 uppercase tracking-wide",children:z.replace("."," ")},z))})}),r.jsx("td",{children:r.jsx(lt,{tone:R.enabled?"positive":"neutral",children:R.enabled?"Active":"Paused"})}),r.jsx("td",{children:r.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[b[R.id]&&(()=>{const z=b[R.id],$=z.state==="testing"?"Sending…":z.state==="ok"?`Delivered${z.status?` (${z.status})`:""}`:`Failed${z.status?` (${z.status})`:""}`;return r.jsx(lt,{tone:z.state==="ok"?"positive":z.state==="fail"?"negative":"neutral",children:$})})(),r.jsx(oe,{variant:"ghost",size:"sm",type:"button",disabled:b[R.id]?.state==="testing",onClick:()=>A(R.id),children:"Test"}),r.jsx(oe,{variant:"ghost",size:"sm",type:"button",onClick:()=>k(R.id),children:"Remove"})]})})]},R.id))})]}),y&&r.jsx("p",{className:"text-rose-400 text-sm mt-2",children:y})]})]})}function hS({eyebrow:e,title:t,status:n,tone:a,targetLabel:o,targetValue:c,coverageValue:u,note:f,updatedAt:m,active:p,onClick:v}){return r.jsxs("button",{type:"button",onClick:v,className:`surface-card w-full text-left transition-colors ${p?"border-zinc-200 bg-zinc-900/50":"hover:border-zinc-700 hover:bg-zinc-900/40"}`,children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:e}),r.jsx("h3",{children:t})]}),r.jsx(lt,{tone:a,children:n})]}),r.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:o}),r.jsx("p",{className:"mt-1 truncate text-sm text-zinc-200",children:c})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Coverage"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:u})]})]}),r.jsxs("div",{className:"mt-3 flex flex-col gap-1 text-xs text-zinc-500 sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("span",{children:f}),r.jsx("span",{children:m?`Updated ${cs(m)}`:"No recent sync yet"})]})]})}function lu({label:e,value:t,tone:n}){const a=n==="positive"?"text-emerald-400":n==="negative"?"text-rose-400":"text-zinc-200";return r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:e}),r.jsx("p",{className:`mt-2 text-2xl font-semibold ${a}`,children:t})]})}function L$({projectName:e,refreshNonce:t}){const[n,a]=w.useState(null),[o,c]=w.useState([]),[u,f]=w.useState(null),[m,p]=w.useState([]),[v,y]=w.useState([]),[x,b]=w.useState(null),[N,S]=w.useState(""),[C,k]=w.useState(""),[A,R]=w.useState(""),[z,$]=w.useState(!0),[P,E]=w.useState(!1),[O,H]=w.useState(null),[ee,V]=w.useState("coverage");w.useEffect(()=>{se()},[e,t]);async function se(){$(!0),H(null);try{const U=await aj(e);if(a(U),U.connected){const[T,L,J,X]=await Promise.all([Cp(e).catch(()=>null),rj(e).catch(()=>[]),$2(e).catch(()=>[]),U.siteUrl?Promise.resolve([]):L2(e).then(Y=>Y.sites).catch(()=>[])]);f(T),p(L),y(J),c(X)}else f(null),p([]),y([]),c([])}catch(U){H(U instanceof Error?U.message:"Failed to load Bing data")}finally{$(!1)}}async function ue(){if(C.trim()){H(null);try{const U=await O2(e,C.trim());k(""),U.availableSites.length>0&&c(U.availableSites),await se()}catch(U){H(U instanceof Error?U.message:"Failed to connect")}}}async function _e(){try{await D2(e),a(null),c([]),f(null),p([]),y([]),b(null),R(""),H(null)}catch(U){H(U instanceof Error?U.message:"Failed to disconnect")}}async function xe(){if(A)try{await M2(e,A),await se()}catch(U){H(U instanceof Error?U.message:"Failed to set site")}}async function K(){if(N.trim())try{const U=await oj(e,N.trim());b(U),p(T=>[U,...T])}catch(U){H(U instanceof Error?U.message:"Inspection failed")}}async function ae(U){E(!0),H(null);try{const T=await Fx(e,{urls:[U]}),{succeeded:L,failed:J,total:X}=T.summary;Fe({title:"Bing submission requested",detail:J===0?`${L} URL submitted to Bing.`:`${L}/${X} submitted successfully, ${J} failed.`,tone:J===0?"positive":"caution",dedupeKey:`bing:indexing:${e}:${U}`,dedupeMode:"replace"})}catch(T){const L=T instanceof Error?T.message:"Submission failed";H(L),Fe({title:"Bing submission failed",detail:L,tone:"negative",dedupeKey:`bing:indexing:${e}:${U}`,dedupeMode:"replace"})}finally{E(!1)}}async function pe(){E(!0),H(null),Fe({title:"Submitting URLs to Bing",detail:"Requesting indexing for all currently unindexed URLs.",tone:"neutral",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"});try{const U=await Fx(e,{allUnindexed:!0}),{succeeded:T,failed:L,total:J}=U.summary;Fe({title:"Bing submissions requested",detail:L===0?`${T}/${J} URL${J!==1?"s":""} submitted to Bing.`:`${T}/${J} submitted successfully, ${L} failed.`,tone:L===0?"positive":"caution",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"})}catch(U){const T=U instanceof Error?U.message:"Batch submission failed";H(T),Fe({title:"Bing submissions failed",detail:T,tone:"negative",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"})}finally{E(!1)}}if(z)return r.jsx(De,{className:"surface-card",children:r.jsx("div",{className:"text-sm text-zinc-400",children:"Loading Bing data..."})});if(!n?.connected)return r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsx(lt,{tone:"caution",children:"Not connected"})]}),r.jsx("p",{className:"text-sm text-zinc-300",children:"Connect Bing Webmaster Tools to inspect URLs, monitor index coverage, and submit pages for indexing."}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"bing-api-key",children:"API Key"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("input",{id:"bing-api-key",type:"password",className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:C,onChange:U=>k(U.target.value),onKeyDown:U=>U.key==="Enter"&&ue()}),r.jsx(oe,{size:"sm",disabled:!C.trim(),onClick:ue,children:"Connect"})]}),r.jsxs("p",{className:"mt-1 text-[11px] text-zinc-500",children:["Get your API key from"," ",r.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-300 underline underline-offset-2",children:"Bing Webmaster Tools"})]})]}),O&&r.jsx("p",{className:"mt-3 text-xs text-rose-400",children:O})]});if(!n.siteUrl)return r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{tone:"positive",children:"Connected"}),r.jsx(oe,{size:"sm",variant:"ghost",onClick:_e,children:"Disconnect"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:n.domain})]}),r.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"The API key is connected, but no Bing site is selected yet. Pick the verified site that should receive inspections and indexing requests."})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Registered domain"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.domain})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.updatedAt?cs(n.updatedAt):"—"})]})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Select site"}),o.length>0?r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsxs("select",{className:"flex-1 rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:A,onChange:U=>R(U.target.value),children:[r.jsx("option",{value:"",children:"Select a site..."}),o.map(U=>r.jsxs("option",{value:U.url,children:[U.url,U.verified?" (verified)":""]},U.url))]}),r.jsx(oe,{size:"sm",disabled:!A,onClick:xe,children:"Set Site"})]}):r.jsx("p",{className:"mt-3 text-xs text-zinc-500",children:"No verified Bing sites are available yet. Verify the domain in Bing Webmaster Tools, then use the page-level refresh to reload everything."})]})]}),O&&r.jsx("p",{className:"mt-3 text-xs text-rose-400",children:O})]});const de=[{key:"coverage",label:"Coverage"},{key:"inspections",label:"Inspections"},{key:"performance",label:"Performance"}];return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{tone:"positive",children:"Connected"}),r.jsx(oe,{size:"sm",variant:"ghost",onClick:_e,children:"Disconnect"})]})]}),O&&r.jsx("p",{className:"mb-3 text-xs text-rose-400",children:O}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:n.domain})]}),r.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:["Canonry stores Bing connections per canonical domain. This project is currently mapped to ",r.jsx("code",{children:n.siteUrl}),"."]})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Selected site"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.siteUrl})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.updatedAt?cs(n.updatedAt):"—"})]})]})]})]}),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Coverage"}),r.jsx("h3",{children:"Index monitoring"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:u?.lastInspectedAt?`Last inspected ${cs(u.lastInspectedAt)}`:"No inspection history yet"})]}),r.jsx("div",{className:"flex gap-1 border-b border-zinc-800",children:de.map(U=>r.jsx("button",{className:`px-3 py-1.5 text-xs font-medium border-b-2 transition-colors ${ee===U.key?"border-zinc-200 text-zinc-200":"border-transparent text-zinc-500 hover:text-zinc-300"}`,onClick:()=>V(U.key),children:U.label},U.key))}),ee==="coverage"&&u&&r.jsxs("div",{className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-4",children:[r.jsx(lu,{label:"Indexed",value:u.summary.indexed,tone:"positive"}),r.jsx(lu,{label:"Not in index",value:u.summary.notIndexed+(u.summary.unknown??0),tone:"negative"}),r.jsx(lu,{label:"Status unknown",value:u.summary.unknown??0,tone:"neutral"}),r.jsx(lu,{label:"Coverage",value:`${u.summary.percentage}%`,tone:"neutral"})]}),u.notIndexed.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsxs("h4",{className:"text-xs font-medium text-zinc-400",children:["Not Indexed (",u.notIndexed.length,")"]}),r.jsx(oe,{size:"sm",variant:"ghost",disabled:P,onClick:pe,children:P?"Submitting…":"Submit all to Bing"})]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-16",children:"HTTP"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-20",children:"Action"})]})}),r.jsx("tbody",{children:u.notIndexed.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.httpCode??"—"}),r.jsx("td",{className:"py-1.5 px-3 text-right",children:r.jsx("button",{className:"text-[10px] text-zinc-400 hover:text-zinc-200 underline underline-offset-2",disabled:P,onClick:()=>ae(U.url),children:"Submit"})})]},U.id))})]})})]}),(u.unknown??[]).length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsxs("h4",{className:"text-xs font-medium text-zinc-400",children:["Unknown — not yet confirmed (",(u.unknown??[]).length,")"]}),r.jsx(oe,{size:"sm",variant:"ghost",disabled:P,onClick:pe,children:P?"Submitting…":"Submit all to Bing"})]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Last Crawled"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-20",children:"Action"})]})}),r.jsx("tbody",{children:(u.unknown??[]).map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.lastCrawledDate?cs(U.lastCrawledDate):"—"}),r.jsx("td",{className:"py-1.5 px-3 text-right",children:r.jsx("button",{className:"text-[10px] text-zinc-400 hover:text-zinc-200 underline underline-offset-2",disabled:P,onClick:()=>ae(U.url),children:"Submit"})})]},U.id))})]})})]}),u.indexed.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"mb-2 text-xs font-medium text-zinc-400",children:["Indexed (",u.indexed.length,")"]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Last Crawled"})]})}),r.jsx("tbody",{children:u.indexed.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.lastCrawledDate?cs(U.lastCrawledDate):"—"})]},U.id))})]})})]})]}),ee==="coverage"&&!u&&r.jsx("p",{className:"mt-4 text-xs text-zinc-500",children:"No coverage data yet. Inspect URLs to build coverage data."}),ee==="inspections"&&r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{type:"text",className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"URL to inspect",value:N,onChange:U=>S(U.target.value),onKeyDown:U=>U.key==="Enter"&&K()}),r.jsx(oe,{size:"sm",disabled:!N.trim(),onClick:K,children:"Inspect"})]}),x&&r.jsxs("div",{className:"rounded border border-zinc-800 bg-zinc-900/40 p-3 text-xs space-y-1",children:[r.jsx("div",{className:"font-medium text-zinc-200",children:x.url}),r.jsxs("div",{className:"text-zinc-400",children:["In Index: ",r.jsx("span",{className:x.inIndex?"text-emerald-400":"text-rose-400",children:x.inIndex?"Yes":"No"})," · ","HTTP: ",x.httpCode??"—"," · ","Crawled: ",x.lastCrawledDate??"—"]})]}),m.length>0&&r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Index"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-14",children:"HTTP"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Inspected"})]})}),r.jsx("tbody",{children:m.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3",children:r.jsx(lt,{tone:U.inIndex?"positive":"negative",children:U.inIndex?"Yes":"No"})}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.httpCode??"—"}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:cs(U.inspectedAt)})]},U.id))})]})})]}),ee==="performance"&&r.jsx("div",{className:"mt-4",children:v.length===0?r.jsx("p",{className:"text-xs text-zinc-500",children:"No Bing performance data available."}):r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"Query"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Clicks"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Impr"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-14",children:"CTR"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-14",children:"Pos"})]})}),r.jsx("tbody",{children:v.map((U,T)=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.query}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-200",children:U.clicks}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:U.impressions}),r.jsxs("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:[(Number.isFinite(U.ctr)?U.ctr*100:0).toFixed(1),"%"]}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:U.averagePosition.toFixed(1)})]},T))})]})})})]})]})}function M$({projectName:e}){const[t,n]=w.useState("google"),[a,o]=w.useState(!0),[c,u]=w.useState("idle"),[f,m]=w.useState(null),p=w.useRef(null),[v,y]=w.useState(!1),[x,b]=w.useState(null),[N,S]=w.useState(null),[C,k]=w.useState(!1),[A,R]=w.useState(null),[z,$]=w.useState(null),[P,E]=w.useState(0);async function O(T=!1){T||o(!0),m(null);try{const[L,J,X]=await Promise.all([wp().catch(()=>null),sj(e).catch(()=>[]),aj(e).catch(()=>null)]),Y=J.find(we=>we.connectionType==="gsc")??null;y(!!L?.google?.configured),k(!!L?.bing?.configured),b(Y),R(X);const[he,ge]=await Promise.all([Y?Np(e).catch(()=>null):Promise.resolve(null),X?.connected?Cp(e).catch(()=>null):Promise.resolve(null)]);S(he),$(ge)}catch(L){m(L instanceof Error?L.message:"Failed to load search console overview")}finally{o(!1)}}async function H(){if(c!=="idle")return;p.current?.abort();const T=new AbortController;p.current=T;const L=T.signal;u("syncing"),m(null);const J=[];try{async function X(){if(!x)return;const we=await ij(e);if(!we?.id)return;const me=2e3,Ye=Date.now()+12e4;for(;Date.now()<Ye;){if(L.aborted||(await new Promise(Ue=>setTimeout(Ue,me)),L.aborted))return;const le=await Ur(we.id).catch(()=>null);if(!le)break;if(["completed","failed","cancelled"].includes(le.status)){le.status!=="completed"&&J.push(`Google sync ${le.status}`);break}}}const Y=10;async function he(){if(!A?.connected)return;const we=await rj(e).catch(()=>[]),me=[...new Set(we.map(Ie=>Ie.url))];if(me.length!==0)for(let Ie=0;Ie<me.length;Ie+=Y){if(L.aborted)return;const Ye=me.slice(Ie,Ie+Y),Ue=(await Promise.allSettled(Ye.map(Qe=>oj(e,Qe)))).filter(Qe=>Qe.status==="rejected").length;Ue>0&&J.push(`${Ue} Bing inspection(s) failed`)}}const ge=await Promise.allSettled([X(),he()]);for(const we of ge)we.status==="rejected"&&J.push(we.reason instanceof Error?we.reason.message:"Sync failed");if(L.aborted)return;u("reloading"),await O(!0),E(we=>we+1),J.length>0&&m(`Partial refresh: ${J.join("; ")}`)}catch(X){L.aborted||m(X instanceof Error?X.message:"Refresh failed")}finally{L.aborted||u("idle")}}w.useEffect(()=>(O(),()=>{p.current?.abort()}),[e]);const ee=x?"positive":v?"caution":"negative",V=x?"Connected":v?"Ready to connect":"Needs setup",se=N?`${N.summary.percentage}% indexed`:x?"Awaiting coverage":"No coverage data",ue=N?`${N.summary.notIndexed} not indexed${N.summary.deindexed>0?` · ${N.summary.deindexed} deindexed`:""}`:x?"Run sitemap inspection to populate coverage":v?"Connect Search Console for this domain":"Add Google OAuth credentials in Settings",_e=N?.lastInspectedAt??x?.updatedAt??null,xe=A?.connected?"positive":C?"caution":"negative",K=A?.connected?"Connected":C?"Ready to connect":"Needs setup",ae=z?`${z.summary.percentage}% indexed`:A?.connected?"Awaiting coverage":"No coverage data",pe=z?z.summary.notIndexed+(z.summary.unknown??0):0,de=z?`${pe} not in index`:A?.connected?"Inspect URLs to populate coverage":C?"Connect Bing Webmaster Tools for this domain":"Add a Bing API key in Settings",U=z?.lastInspectedAt??A?.updatedAt??null;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search console"}),r.jsx("h2",{children:"Search Engine Intelligence"}),r.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-zinc-500",children:"Scan both engines at a glance, then open the Google or Bing workspace when you need to inspect coverage or take action."})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:a||c!=="idle",onClick:()=>{H()},children:a?"Loading…":c==="syncing"?"Refreshing Google & Bing…":c==="reloading"?"Reloading workspaces…":"Refresh all"})]}),f&&r.jsx("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:f}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(hS,{eyebrow:"Google",title:"Google Search Console",status:a?"Loading…":V,tone:a?"neutral":ee,targetLabel:"Selected property",targetValue:x?.propertyId??"No property selected",coverageValue:a?"Loading…":se,note:a?"Loading overview…":ue,updatedAt:_e,active:t==="google",onClick:()=>n("google")}),r.jsx(hS,{eyebrow:"Bing",title:"Bing Webmaster Tools",status:a?"Loading…":K,tone:a?"neutral":xe,targetLabel:"Selected site",targetValue:A?.siteUrl??"No site selected",coverageValue:a?"Loading…":ae,note:a?"Loading overview…":de,updatedAt:U,active:t==="bing",onClick:()=>n("bing")})]})]}),r.jsx("div",{className:"flex flex-wrap gap-2",role:"tablist","aria-label":"Search engine workspaces",children:[["google","Google"],["bing","Bing"]].map(([T,L])=>r.jsx("button",{type:"button",role:"tab","aria-selected":t===T,className:`project-subnav-link ${t===T?"project-subnav-link-active":""}`,onClick:()=>n(T),children:L},T))}),t==="google"&&r.jsx(E$,{projectName:e}),t==="bing"&&r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search engine"}),r.jsx("h2",{children:"Bing Webmaster Tools"})]})}),r.jsx(L$,{projectName:e,refreshNonce:P})]})]})}function $$({insights:e}){const{openEvidence:t}=Zr(),[n,a]=w.useState(null);return r.jsx("div",{className:"insight-list",children:e.map(o=>{const c=n===o.id,u=o.affectedPhrases.length>0;return r.jsxs("div",{children:[r.jsxs("div",{className:`insight-row insight-row-${o.tone} ${u?"cursor-pointer":""}`,onClick:u?()=>a(c?null:o.id):void 0,children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u&&r.jsx(Vu,{size:12,className:`shrink-0 text-zinc-500 transition-transform duration-150 ${c?"rotate-90":""}`}),r.jsx(lt,{tone:o.tone,children:o.actionLabel}),r.jsx("span",{className:"text-sm font-medium text-zinc-100 truncate",children:o.title}),r.jsx("span",{className:"hidden sm:inline text-xs text-zinc-500 truncate",children:o.detail})]}),u&&r.jsxs("span",{className:"text-[11px] text-zinc-600 whitespace-nowrap",children:[o.affectedPhrases.length," phrase",o.affectedPhrases.length>1?"s":""]})]}),c&&r.jsx("div",{className:"divide-y divide-zinc-800/20",children:o.affectedPhrases.map(f=>r.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2 pl-9 bg-zinc-900/40",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Km,{state:f.citationState}),r.jsx("span",{className:"text-sm text-zinc-200 truncate",children:f.keyword}),r.jsx("div",{className:"hidden sm:flex gap-1",children:f.provider&&r.jsx(ol,{provider:f.provider})})]}),r.jsx("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 whitespace-nowrap transition-colors",onClick:m=>{m.stopPropagation(),t(f.evidenceId)},children:"View →"})]},f.evidenceId))})]},o.id)})})}function bd({tab:e}){const{projectId:t}=Gu({from:"/projects/$projectId"}),n=Bi(),{dashboard:a,isLoading:o,refetch:c}=Da();if(!a||o)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-48"}),r.jsx("div",{className:"skeleton-text-sm w-32"})]}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(re=>r.jsxs("div",{className:"page-skeleton-card flex flex-col items-center",children:[r.jsx("div",{className:"skeleton-circle size-20"}),r.jsx("div",{className:"skeleton-text w-16 mt-3"})]},re))}),r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-28"}),r.jsx("div",{className:"space-y-2 mt-2",children:[1,2,3,4].map(re=>r.jsx("div",{className:"skeleton-text-sm w-full"},re))})]})]});const u=WM(a,t),[f,m]=w.useState(!1),[p,v]=w.useState(!1),[y,x]=w.useState(!1),[b,N]=w.useState(""),[S,C]=w.useState(!1),[k,A]=w.useState(!1),[R,z]=w.useState(""),[$,P]=w.useState(!1),[E,O]=w.useState(!1),[H,ee]=w.useState(""),[V,se]=w.useState(!1),[ue,_e]=w.useState(void 0),[xe,K]=w.useState(!1),[ae,pe]=w.useState(null),[de,U]=w.useState(!1),T=u?.visibilityEvidence??[],L=u?.project.name??"",J=u?.project.displayName||u?.project.name||L,X=FN(),Y=w.useMemo(()=>new Set(T.map(re=>re.location??"")),[T]),he=Y.has(""),ge=w.useMemo(()=>[...Y].filter(Boolean),[Y]);w.useEffect(()=>{if(ue===void 0||ue===""||!L){pe(null),U(!1);return}U(!0),tj(L,ue).then(re=>{pe(re),U(!1)}).catch(()=>{pe(null),U(!1)})},[ue,L]);const we=w.useMemo(()=>{if(!ae)return null;const re=new Map;for(const Ze of ae){for(const[gt,Qt]of Object.entries(Ze.providerRuns??{}))re.set(`${Ze.keyword}::${gt}`,Qt.map(Je=>({runId:Je.runId,citationState:Je.citationState,createdAt:Je.createdAt})));(!Ze.providerRuns||Object.keys(Ze.providerRuns).length===0)&&re.set(`${Ze.keyword}::`,Ze.runs.map(gt=>({runId:gt.runId,citationState:gt.citationState,createdAt:gt.createdAt})))}return re},[ae]),me=w.useMemo(()=>{const re=ue!==void 0?T.filter(Ze=>ue===""?!Ze.location:Ze.location===ue):T;return we?re.map(Ze=>{const gt=we.get(`${Ze.keyword}::${Ze.provider}`)??we.get(`${Ze.keyword}::`);return gt?{...Ze,runHistory:gt}:Ze}):re},[T,ue,we]);if(!u)return r.jsx("div",{className:"page-container",children:r.jsxs(De,{className:"surface-card empty-card",children:[r.jsx("h1",{children:"Project not found"}),r.jsxs("p",{children:['Could not find a project with ID "',t,'".']}),r.jsx(oe,{asChild:!0,children:r.jsx(St,{to:"/",children:"Return to overview"})})]})});async function Ie(){try{await X.mutateAsync({projectName:L,projectLabel:J,sourceAction:"project-run"}),c()}catch{}}async function Ye(){v(!0);try{await s2(L),Fe({title:"Project deleted",detail:`${J} was removed.`,tone:"positive",dedupeKey:`project:delete:${L}`,dedupeMode:"drop"}),n({to:"/"}),c()}catch(re){console.error("Failed to delete project:",re)}finally{v(!1)}}async function le(){const re=await i2(L),Ze=typeof re=="string"?re:JSON.stringify(re,null,2),gt=new Blob([Ze],{type:"text/yaml"}),Qt=URL.createObjectURL(gt),Je=document.createElement("a");Je.href=Qt,Je.download=`${L}.yaml`,Je.click()}async function Ue(){const re=b.split(`
|
|
237
|
-
`).map(Ze=>Ze.trim()).filter(Boolean);if(re.length!==0){C(!0);try{await J_(L,re),c(),N(""),x(!1)}finally{C(!1)}}}async function Qe(){const re=R.trim();if(re){P(!0);try{const gt=(await ej(L)).map(Je=>Je.domain),Qt=[...new Set([...gt,re])];await nj(L,Qt),c(),z(""),A(!1)}finally{P(!1)}}}async function Vt(){const re=H.trim();if(re){se(!0);try{const Ze=u?.project.ownedDomains??[];await qx(L,[...Ze,re]),c(),ee(""),O(!1)}finally{se(!1)}}}async function Ut(re){se(!0);try{const Ze=u?.project.ownedDomains??[];await qx(L,Ze.filter(gt=>gt!==re)),c()}finally{se(!1)}}async function Mn(re,Ze){await X_(re,Ze),c()}const nn=re=>!Number.isNaN(Number.parseInt(re,10)),Et=[{key:"overview",label:"Overview",href:`/projects/${u.project.id}`},{key:"search-console",label:"Search Engine Intelligence",href:`/projects/${u.project.id}/search-console`},{key:"traffic",label:"Traffic",href:`/projects/${u.project.id}/traffic`},{key:"analytics",label:"Visibility",href:`/projects/${u.project.id}/analytics`}];return r.jsxs("div",{className:"page-container",children:[f?r.jsxs(De,{className:"surface-card p-6 mb-6 border-rose-800/60",children:[r.jsx("h3",{className:"text-base font-semibold text-rose-400 mb-2",children:"Delete project?"}),r.jsxs("p",{className:"text-sm text-zinc-400 mb-4",children:["This will permanently delete ",r.jsx("strong",{className:"text-zinc-200",children:u.project.displayName||u.project.name})," and all its key phrases, competitors, runs, and snapshots. This cannot be undone."]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(oe,{type:"button",variant:"destructive",disabled:p,onClick:Ye,children:p?"Deleting...":"Yes, delete project"}),r.jsx(oe,{type:"button",variant:"outline",disabled:p,onClick:()=>m(!1),children:"Cancel"})]})]}):null,r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:u.project.displayName||u.project.name}),r.jsxs("p",{className:"page-subtitle",children:[u.project.canonicalDomain,(u.project.ownedDomains??[]).length===0&&!E&&r.jsx("button",{type:"button",className:"ml-2 text-[10px] uppercase tracking-wide text-zinc-600 hover:text-zinc-400 transition-colors",onClick:()=>O(!0),children:"+ add domain"})," "," · ",u.contextLabel]}),r.jsxs("div",{className:"tag-row",children:[r.jsx("span",{className:"tag",children:u.project.country}),r.jsx("span",{className:"tag",children:u.project.language.toUpperCase()}),u.project.tags.map(re=>r.jsx("span",{className:"tag",children:re},re))]}),((u.project.ownedDomains??[]).length>0||E)&&r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mr-1",children:"Also tracking"}),(u.project.ownedDomains??[]).map(re=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:[re,r.jsx("button",{type:"button",className:"ml-0.5 text-zinc-500 hover:text-zinc-200 transition-colors",disabled:V,onClick:()=>Ut(re),"aria-label":`Remove ${re}`,children:"×"})]},re)),E?r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-1.5 py-0.5 text-xs text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none w-40",type:"text",placeholder:"docs.example.com",value:H,onChange:re=>ee(re.target.value),onKeyDown:re=>re.key==="Enter"&&Vt(),autoFocus:!0}),r.jsx(oe,{type:"button",size:"sm",disabled:!H.trim()||V,onClick:Vt,children:V?"...":"Add"}),r.jsx("button",{type:"button",className:"text-xs text-zinc-500 hover:text-zinc-300",onClick:()=>{O(!1),ee("")},children:"Cancel"})]}):r.jsx("button",{type:"button",className:"rounded-full border border-dashed border-zinc-700 px-2 py-0.5 text-[10px] uppercase tracking-wide text-zinc-500 hover:text-zinc-300 hover:border-zinc-500 transition-colors",onClick:()=>O(!0),children:"+ domain"})]})]}),r.jsxs("div",{className:"page-header-right",children:[r.jsx("p",{className:"text-sm text-zinc-500",children:u.dateRangeLabel}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oe,{type:"button",variant:"outline",size:"icon",onClick:le,"aria-label":"Export project as YAML",children:r.jsx(aE,{className:"h-4 w-4 text-zinc-400"})}),r.jsx(oe,{type:"button",variant:"outline",size:"icon",onClick:()=>m(!0),"aria-label":"Delete project",children:r.jsx(CE,{className:"h-4 w-4 text-zinc-400"})}),r.jsx(oe,{type:"button",disabled:X.isPending,onClick:Ie,children:X.isPending?"Starting...":"Run now"})]})]})]}),r.jsx("nav",{className:"project-subnav","aria-label":"Project sections",children:Et.map(re=>r.jsx(St,{to:re.href,className:`project-subnav-link ${re.key===e?"project-subnav-link-active":""}`,"aria-current":re.key===e?"page":void 0,children:re.label},re.key))}),e==="overview"?r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"gauge-row",children:[r.jsx(KN,{value:u.visibilitySummary.value,label:u.visibilitySummary.label,delta:u.visibilitySummary.delta,tone:u.visibilitySummary.tone,description:u.visibilitySummary.description,tooltip:u.visibilitySummary.tooltip,isNumeric:nn(u.visibilitySummary.value),progress:u.visibilitySummary.progress}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Gap Key Phrases",r.jsx(Nn,{text:"Tracked key phrases where competitors are cited in the latest completed visibility run but your domain is not."})]}),r.jsxs("p",{className:"metric-card-big-value",children:[r.jsx("span",{className:"text-zinc-50",children:u.gapKeyPhrases.value}),r.jsxs("span",{className:"text-zinc-600",children:[" / ",u.keywordCounts.total]})]}),r.jsx("div",{className:"metric-card-bar",children:r.jsx("div",{className:`metric-card-bar-fill progress-fill-${u.gapKeyPhrases.tone}`,style:{width:u.gapKeyPhrases.progress!==void 0?`${u.gapKeyPhrases.progress*100}%`:"0%"}})}),r.jsx("p",{className:"metric-card-detail",children:u.gapKeyPhrases.delta}),r.jsx("p",{className:"metric-card-sub",children:u.gapKeyPhrases.description})]}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Index Coverage",r.jsx(Nn,{text:"Percentage of inspected URLs that are currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used."})]}),r.jsxs("p",{className:"metric-card-big-value",children:[r.jsx("span",{className:"text-zinc-50",children:u.indexCoverage.value}),r.jsx("span",{className:"text-zinc-600",children:"%"})]}),r.jsx("div",{className:"metric-card-bar",children:r.jsx("div",{className:`metric-card-bar-fill progress-fill-${u.indexCoverage.tone}`,style:{width:`${Number.parseInt(u.indexCoverage.value,10)||0}%`}})}),r.jsx("p",{className:"metric-card-detail",children:u.indexCoverage.delta}),r.jsx("p",{className:"metric-card-sub",children:u.indexCoverage.description})]}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Since Last Run",r.jsx(Nn,{text:"Keyword-level citation changes compared to the previous completed run."})]}),u.movementSummary.hasPreviousRun?r.jsxs("div",{className:"metric-card-movement",children:[r.jsxs("span",{className:u.movementSummary.gained>0?"text-emerald-400":"text-zinc-500",children:["+",u.movementSummary.gained," gained"]}),r.jsx("span",{className:"text-zinc-600 mx-1.5",children:"·"}),r.jsxs("span",{className:u.movementSummary.lost>0?"text-rose-400":"text-zinc-500",children:["−",u.movementSummary.lost," lost"]})]}):r.jsx("p",{className:"metric-card-movement text-zinc-500",children:"First run — no comparison yet"}),r.jsx("p",{className:"metric-card-sub mt-auto",children:u.movementSummary.gained===0&&u.movementSummary.lost===0&&u.movementSummary.hasPreviousRun?"No changes since last run":u.movementSummary.gained>u.movementSummary.lost?"Visibility improving":u.movementSummary.lost>u.movementSummary.gained?"Visibility declining":""})]})]}),u.providerScores.length>1&&r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Model breakdown"}),r.jsxs("h2",{children:["Visibility by model ",r.jsx(Nn,{text:"Per-model citation rate. Shows how often each AI model cites your domain across all tracked key phrases. Switching models can significantly affect citation rates."})]})]})}),r.jsx("div",{className:"evidence-table-wrap",children:r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Model"}),r.jsx("th",{children:"Score"}),r.jsx("th",{children:"Cited key phrases"})]})}),r.jsx("tbody",{children:u.providerScores.map(re=>r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("div",{className:"flex flex-col items-start gap-0.5",children:[r.jsx(ol,{provider:re.provider}),re.model&&r.jsx("span",{className:"text-[11px] font-mono text-zinc-500",children:re.model})]})}),r.jsx("td",{children:r.jsxs("span",{className:`font-semibold ${re.score>=70?"text-emerald-400":re.score>=40?"text-amber-400":"text-rose-400"}`,children:[re.score,"%"]})}),r.jsxs("td",{className:"text-zinc-500",children:[re.cited," of ",re.total]})]},`${re.provider}::${re.model??"unknown"}`))})]})})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"What changed"}),r.jsx("h2",{children:"Citation signals"})]})}),r.jsx($$,{insights:u.insights})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Visibility evidence"}),r.jsx("h2",{children:"Key phrase citation tracking"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("p",{className:"supporting-copy",children:[new Set(u.visibilityEvidence.map(re=>re.keyword)).size," key phrases tracked"]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>x(!y),children:y?"Cancel":"+ Add key phrases"})]})]}),y&&r.jsxs("div",{className:"mb-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3",children:[r.jsx("textarea",{className:"w-full resize-none rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",rows:3,placeholder:"Enter key phrases, one per line",value:b,onChange:re=>N(re.target.value)}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs text-zinc-500",children:[b.split(`
|
|
238
|
-
`).filter(re=>re.trim()).length," key phrases"]}),r.jsx(oe,{type:"button",size:"sm",disabled:!b.trim()||S,onClick:Ue,children:S?"Adding...":"Add key phrases"})]})]}),u.project.locations&&u.project.locations.length>0&&r.jsxs("div",{className:"filter-row mb-3",role:"toolbar","aria-label":"Location filters",children:[r.jsx("button",{className:`filter-chip ${ue===void 0?"filter-chip-active":""}`,type:"button","aria-pressed":ue===void 0,onClick:()=>{_e(void 0)},children:"All locations"}),u.project.locations.map(re=>Y.has(re.label)&&r.jsx("button",{className:`filter-chip ${ue===re.label?"filter-chip-active":""}`,type:"button","aria-pressed":ue===re.label,onClick:()=>{_e(re.label),K(!1)},children:re.label},re.label)),he&&r.jsx("button",{className:`filter-chip ${ue===""?"filter-chip-active":""}`,type:"button","aria-pressed":ue==="",onClick:()=>{_e(""),K(!1)},children:"No location"}),ge.length>1&&ue===void 0&&r.jsx("button",{className:`filter-chip filter-chip-compare ${xe?"filter-chip-active":""}`,type:"button","aria-pressed":xe,onClick:()=>K(re=>!re),title:"Side-by-side location comparison",children:"Compare"})]}),r.jsx(c$,{evidence:me})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Competitors"}),r.jsx("h2",{children:"Competitive landscape"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("p",{className:"supporting-copy",children:[u.competitors.length," tracked"]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>A(!k),children:k?"Cancel":"+ Add competitor"})]})]}),k&&r.jsxs("div",{className:"mb-3 flex gap-2 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"competitor.com",value:R,onChange:re=>z(re.target.value),onKeyDown:re=>re.key==="Enter"&&Qe()}),r.jsx(oe,{type:"button",size:"sm",disabled:!R.trim()||$,onClick:Qe,children:$?"Adding...":"Add"})]}),r.jsx(u$,{competitors:u.competitors})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Run timeline"}),r.jsx("h2",{children:"Recent execution history"})]})}),r.jsx("div",{className:"run-list",children:u.recentRuns.map(re=>r.jsx(qN,{run:re},re.id))})]}),r.jsx(R$,{project:{...u.project,displayName:u.project.displayName??u.project.name,defaultLocation:u.project.defaultLocation??null},onUpdateProject:Mn,onRefresh:()=>{c()}}),r.jsx(T$,{projectName:u.project.name}),r.jsx(D$,{projectName:u.project.name})]}):e==="analytics"?r.jsx(h$,{projectName:u.project.name}):e==="traffic"?r.jsx(v$,{projectName:u.project.name}):r.jsx(M$,{projectName:u.project.name})]})}function P$(){const{dashboard:e,isLoading:t}=Da(),n=C$();if(!e||t)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-20"}),r.jsx("div",{className:"skeleton-text-sm w-72"})]}),r.jsx("div",{className:"space-y-2",children:[1,2,3,4].map(m=>r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-3 flex items-center gap-3",children:[r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsx("div",{className:"skeleton-text w-40"}),r.jsx("div",{className:"skeleton-text-sm w-56"})]}),r.jsx("div",{className:"skeleton h-5 w-16 rounded-full"})]},m))})]});const a=e.runs,[o,c]=w.useState("all"),u=o==="all"?a:a.filter(m=>m.status===o),f=async()=>{try{await n.mutateAsync(void 0)}catch{}};return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Runs"}),r.jsx("p",{className:"page-subtitle",children:"Status, type, project, duration, and the shortest explanation that makes the outcome trustworthy."})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:n.isPending,onClick:()=>{f()},children:n.isPending?"Queueing…":"Run all projects"})]}),r.jsxs("section",{children:[r.jsx("div",{className:"filter-row",role:"toolbar","aria-label":"Run filters",children:["all","queued","running","completed","partial","failed","cancelled"].map(m=>r.jsx("button",{className:`filter-chip ${o===m?"filter-chip-active":""}`,type:"button","aria-pressed":o===m,onClick:()=>c(m),children:m==="all"?"All runs":Yu(m)},m))}),r.jsx("div",{className:"run-list",children:u.length>0?u.map(m=>r.jsx(qN,{run:m},m.id)):r.jsxs(De,{className:"surface-card empty-card",children:[r.jsx("h2",{children:"No runs match this filter"}),r.jsx("p",{children:"Try another status filter or queue a new run from a project command center."})]})})]})]})}function U$({providerName:e,keyUrl:t,modelHint:n,onSaved:a}){const o=e.toLowerCase()==="local",[c,u]=w.useState(""),[f,m]=w.useState(""),[p,v]=w.useState(""),[y,x]=w.useState(""),[b,N]=w.useState(""),[S,C]=w.useState(""),[k,A]=w.useState(!1),[R,z]=w.useState(null),[$,P]=w.useState(!1),E=o?f.trim().length>0:c.trim().length>0;async function O(){if(E){A(!0),z(null),P(!1);try{const ee=xe=>{const K=parseInt(xe.trim(),10);return Number.isFinite(K)&&K>0?K:void 0},V={},se=ee(y);se!==void 0&&(V.maxConcurrency=se);const ue=ee(b);ue!==void 0&&(V.maxRequestsPerMinute=ue);const _e=ee(S);_e!==void 0&&(V.maxRequestsPerDay=_e),await l2(e.toLowerCase(),{...c.trim()?{apiKey:c.trim()}:{},...f.trim()?{baseUrl:f.trim()}:{},...p.trim()?{model:p.trim()}:{},...Object.keys(V).length>0?{quota:V}:{}}),u(""),m(""),v(""),x(""),N(""),C(""),P(!0),Fe({title:"Provider updated",detail:`${e} configuration saved.`,tone:"positive",dedupeKey:`settings:provider:${e}`,dedupeMode:"replace"}),a()}catch(ee){z(ee instanceof Error?ee.message:"Failed to update provider")}finally{A(!1)}}}const H=n??"Use default model";return r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[o&&r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`base-url-${e}`,children:"Base URL"}),r.jsx("input",{id:`base-url-${e}`,type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"http://localhost:11434/v1",value:f,onChange:ee=>m(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Any OpenAI-compatible endpoint — Ollama, LM Studio, llama.cpp, vLLM"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"text-xs text-zinc-500",htmlFor:`api-key-${e}`,children:["API Key",o?" (optional)":""]}),t&&r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:["Get API key ","↗"]})]}),r.jsx("input",{id:`api-key-${e}`,type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:o?"Optional — most local servers don't need one":`Enter ${e} API key`,value:c,onChange:ee=>u(ee.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`model-${e}`,children:"Model (optional)"}),r.jsx("input",{id:`model-${e}`,type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:H,value:p,onChange:ee=>v(ee.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",children:"Quota (optional)"}),r.jsxs("div",{className:"mt-0.5 grid grid-cols-3 gap-1.5",children:[r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Concurrent",value:y,onChange:ee=>x(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Max concurrent"})]}),r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"/min",value:b,onChange:ee=>N(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Per minute"})]}),r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"/day",value:S,onChange:ee=>C(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Per day"})]})]})]}),R&&r.jsx("p",{className:"text-xs text-rose-400",children:R}),$&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Provider updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!E||k,onClick:O,children:k?"Saving...":"Save"})]})}function I$({onSaved:e}){const[t,n]=w.useState(""),[a,o]=w.useState(""),[c,u]=w.useState(!1),[f,m]=w.useState(null),[p,v]=w.useState(!1),y=t.trim().length>0&&a.trim().length>0;async function x(){if(y){u(!0),m(null),v(!1);try{await c2({clientId:t.trim(),clientSecret:a.trim()}),n(""),o(""),v(!0),Fe({title:"Google OAuth app updated",detail:"Dashboard Google credentials were saved.",tone:"positive",dedupeKey:"settings:google-oauth",dedupeMode:"replace"}),e()}catch(b){m(b instanceof Error?b.message:"Failed to update Google OAuth credentials")}finally{u(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"google-client-id",children:"Client ID"}),r.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:["Google Cloud ","↗"]})]}),r.jsx("input",{id:"google-client-id",type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Google OAuth client ID",value:t,onChange:b=>n(b.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"google-client-secret",children:"Client secret"}),r.jsx("input",{id:"google-client-secret",type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Google OAuth client secret",value:a,onChange:b=>o(b.target.value)})]}),r.jsxs("p",{className:"text-[11px] text-zinc-500",children:["These credentials are stored in ",r.jsx("code",{children:"~/.canonry/config.yaml"}),". Project-level Search Console connections are created separately per canonical domain."]}),f&&r.jsx("p",{className:"text-xs text-rose-400",children:f}),p&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Google OAuth credentials updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!y||c,onClick:x,children:c?"Saving...":"Save Google OAuth app"})]})}function B$(){const[e,t]=w.useState(null),[n,a]=w.useState(null),[o,c]=w.useState(!1),[u,f]=w.useState("localhost"),[m,p]=w.useState("9222"),[v,y]=w.useState(!1);return w.useEffect(()=>{Hx().then(t).catch(x=>{const b=x instanceof Error?x.message:String(x);b.includes("501")||a(b)})},[]),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Browser provider"}),r.jsx("h2",{children:"ChatGPT (CDP)"})]}),r.jsx(lt,{tone:e?.connected?"positive":"caution",children:e?.connected?"Connected":"Not connected"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[e?.endpoint&&r.jsxs("div",{children:[r.jsx("dt",{children:"Endpoint"}),r.jsx("dd",{className:"font-mono text-xs",children:e.endpoint})]}),e?.browserVersion&&r.jsxs("div",{children:[r.jsx("dt",{children:"Browser"}),r.jsx("dd",{className:"text-xs",children:e.browserVersion})]}),e?.targets&&e.targets.length>0&&r.jsxs("div",{children:[r.jsx("dt",{children:"Tabs"}),r.jsx("dd",{children:e.targets.map(x=>r.jsxs("span",{className:"mr-2",children:[x.name,": ",x.alive?"● alive":"○ idle"]},x.name))})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:e?.connected?"Connected to Chrome via CDP. Launch Chrome with --remote-debugging-port to use this provider.":n||"Not configured. Set an endpoint below or run: canonry cdp connect --host localhost --port 9222"}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>c(!o),children:o?"Cancel":e?.connected?"Update endpoint":"Configure"})}),o&&r.jsxs("form",{className:"mt-3 flex flex-col gap-2",onSubmit:async x=>{x.preventDefault(),y(!0);try{await T2(u,parseInt(m,10)||9222);const b=await Hx().catch(()=>null);b&&t(b),c(!1),Fe({title:"CDP endpoint saved",detail:`${u}:${parseInt(m,10)||9222} is now configured.`,tone:"positive",dedupeKey:"settings:cdp",dedupeMode:"replace"})}catch(b){a(b instanceof Error?b.message:String(b))}finally{y(!1)}},children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500",placeholder:"localhost",value:u,onChange:x=>f(x.target.value),"aria-label":"CDP host"}),r.jsx("input",{className:"w-24 rounded border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500",placeholder:"9222",value:m,onChange:x=>p(x.target.value),"aria-label":"CDP port"})]}),r.jsx("div",{children:r.jsx(oe,{type:"submit",size:"sm",disabled:v,children:v?"Saving…":"Save endpoint"})})]})]})}const q$={apiStatus:{state:"checking",detail:"Checking service health"},workerStatus:{state:"checking",detail:"Checking service health"}};function K$(){const e=yl(),{dashboard:t}=Da(),n=t?.settings??e?.dashboard?.settings,c=od(!e,e?.health).data??e?.health??q$,[u,f]=w.useState(null),[m,p]=w.useState(!1),[v,y]=w.useState(!1),[x,b]=w.useState(""),[N,S]=w.useState(!1),[C,k]=w.useState(null),[A,R]=w.useState(!1);return n?r.jsxs("div",{className:"page-container",children:[r.jsx("div",{className:"page-header",children:r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Settings"}),r.jsx("p",{className:"page-subtitle",children:"Provider state, Google OAuth, Bing WMT setup, and service health."})]})}),r.jsxs("section",{className:"settings-grid",children:[n.providerStatuses.map(z=>r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Provider"}),r.jsx("h2",{children:z.displayName??z.name})]}),r.jsx(lt,{tone:z.state==="ready"?"positive":"caution",children:z.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{className:"font-mono text-xs",children:z.model})]}),z.quota&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Concurrency"}),r.jsx("dd",{children:z.quota.maxConcurrency})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Rate limit"}),r.jsxs("dd",{children:[z.quota.maxRequestsPerMinute,"/min · ",z.quota.maxRequestsPerDay,"/day"]})]})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:z.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>f(u===z.name?null:z.name),children:u===z.name?"Cancel":z.state==="ready"?z.name.toLowerCase()==="local"?"Update config":"Update key":"Configure"})}),u===z.name&&r.jsx(U$,{providerName:z.name,keyUrl:z.keyUrl,modelHint:z.modelHint,onSaved:()=>{f(null)}})]},z.name)),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Google"}),r.jsx("h2",{children:"Search Console OAuth"})]}),r.jsx(lt,{tone:n.google.state==="ready"?"positive":"caution",children:n.google.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Auth model"}),r.jsx("dd",{children:"One app credential set, then one OAuth connection per project domain"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Storage"}),r.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:n.google.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>p(!m),children:m?"Cancel":n.google.state==="ready"?"Update OAuth app":"Configure Google OAuth"})}),m&&r.jsx(I$,{onSaved:()=>{p(!1)}})]}),r.jsxs(De,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Bing"}),r.jsx("h2",{children:"Webmaster Tools"})]}),r.jsx(lt,{tone:n.bing.state==="ready"?"positive":"caution",children:n.bing.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Auth model"}),r.jsx("dd",{children:"API key authentication — no OAuth needed"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Storage"}),r.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:n.bing.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>y(!v),children:v?"Cancel":n.bing.state==="ready"?"Update API key":"Configure Bing"})}),v&&r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"bing-api-key",children:"API Key"}),r.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:"Bing Webmaster Tools"})]}),r.jsx("input",{id:"bing-api-key",type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:x,onChange:z=>b(z.target.value)})]}),r.jsxs("p",{className:"text-[11px] text-zinc-500",children:["This key is stored in ",r.jsx("code",{children:"~/.canonry/config.yaml"}),". Project-level Bing connections are created separately per canonical domain."]}),C&&r.jsx("p",{className:"text-xs text-rose-400",children:C}),A&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Bing API key updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!x.trim()||N,onClick:async()=>{if(x.trim()){S(!0),k(null),R(!1);try{await P2(x.trim()),b(""),R(!0),y(!1),Fe({title:"Bing API key updated",detail:"Dashboard Bing credentials were saved.",tone:"positive",dedupeKey:"settings:bing",dedupeMode:"replace"})}catch(z){k(z instanceof Error?z.message:"Failed to update Bing API key")}finally{S(!1)}}},children:N?"Saving...":"Save Bing API key"})]})]}),r.jsx(B$,{}),r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Service health"}),r.jsx("h2",{children:"API and worker"})]})}),r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"health-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:"API"}),r.jsx("p",{className:"supporting-copy",children:c.apiStatus.detail})]}),r.jsx(lt,{tone:Tu(c.apiStatus),children:c.apiStatus.state==="ok"?"Healthy":"Attention"})]}),r.jsxs("div",{className:"health-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:"Worker"}),r.jsx("p",{className:"supporting-copy",children:c.workerStatus.detail})]}),r.jsx(lt,{tone:Tu(c.workerStatus),children:c.workerStatus.state==="ok"?"Healthy":"Attention"})]})]})]})]}),r.jsx("section",{className:"page-section",children:r.jsxs(De,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Self-host notes"}),r.jsx("h2",{children:"Operational guidance"})]})}),r.jsx("ul",{className:"detail-list",children:n.selfHostNotes.map(z=>r.jsx("li",{children:z},z))}),r.jsx("p",{className:"supporting-copy",children:n.bootstrapNote})]})})]}):null}const H$=[{label:"System check",description:"Verify your instance is ready"},{label:"Create project",description:"Name, domain, and locale"},{label:"Key phrases",description:"Add key phrases to track"},{label:"Competitors",description:"Add competitor domains"},{label:"Launch",description:"Start your first visibility sweep"}];function G$({current:e,labels:t}){return r.jsx("div",{className:"setup-steps",role:"list","aria-label":"Setup progress",children:t.map((n,a)=>{const o=a<e,c=a===e;return r.jsxs("div",{className:`setup-step ${o?"setup-step-done":""} ${c?"setup-step-active":""}`,role:"listitem","aria-current":c?"step":void 0,children:[r.jsx("span",{className:"setup-step-number",children:o?"✓":a+1}),r.jsx("span",{className:"setup-step-label",children:n.label})]},n.label)})})}function F$(){const e=yl(),{dashboard:t,isLoading:n,refetch:a}=Da(),o=t??e?.dashboard;if(!o||n)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-24"}),r.jsx("div",{className:"skeleton-text-sm w-80"})]}),r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-32"}),r.jsx("div",{className:"space-y-3 mt-3",children:[1,2,3].map(ce=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1 flex-1",children:[r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton-text-sm w-48"})]}),r.jsx("div",{className:"skeleton h-6 w-16 rounded-full"})]},ce))})]})]});const c=o.settings,m=od(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},p=Z4(o.setup,m,c),v=Bi(),[y,x]=w.useState(0),[b,N]=w.useState(""),[S,C]=w.useState(""),[k,A]=w.useState(""),[R,z]=w.useState("US"),[$,P]=w.useState("en"),[E,O]=w.useState(null),[H,ee]=w.useState(null),[V,se]=w.useState(null),[ue,_e]=w.useState(!1),[xe,K]=w.useState(""),[ae,pe]=w.useState(!1),[de,U]=w.useState(null),[T,L]=w.useState(!1),J=c.providerStatuses.filter(ce=>ce.state==="ready"),[X,Y]=w.useState(J[0]?.name??""),[he,ge]=w.useState(5),[we,me]=w.useState(!1),[Ie,Ye]=w.useState(null),[le,Ue]=w.useState(""),[Qe,Vt]=w.useState(!1),[Ut,Mn]=w.useState(null),[nn,Et]=w.useState(!1),[re,Ze]=w.useState(!1),[gt,Qt]=w.useState(!1),Je=FN(),Me=b.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),Xe=xe.split(`
|
|
239
|
-
`).map(ce=>ce.trim()).filter(Boolean),Nt=le.split(`
|
|
240
|
-
`).map(ce=>ce.trim()).filter(Boolean),Ke=p.healthChecks.some(ce=>ce.id==="api"&&ce.state==="ready"),Ma=async()=>{if(!(!Me||!k)){_e(!0),se(null);try{const ce=await Zu(Me,{displayName:S||b,canonicalDomain:k,country:R,language:$});O(Me),ee(ce.id),Fe({title:"Project created",detail:`${ce.displayName||ce.name} is ready for setup.`,tone:"positive",dedupeKey:`project:create:${ce.name}`,dedupeMode:"drop"}),a(),x(2)}catch(ce){se(ce instanceof Error?ce.message:"Failed to create project")}finally{_e(!1)}}},pn=async()=>{if(!E)return;const ce=Xe;if(ce.length!==0){L(!0),U(null);try{await Y_(E,ce),pe(!0),a(),x(3)}catch(zn){U(zn instanceof Error?zn.message:"Failed to save key phrases")}finally{L(!1)}}},st=async()=>{if(!(!E||!X)){me(!0),Ye(null);try{const ce=await g2(E,X,he);if(ce.keywords.length>0){const zn=xe?xe.trimEnd()+`
|
|
241
|
-
`+ce.keywords.join(`
|
|
242
|
-
`):ce.keywords.join(`
|
|
243
|
-
`);K(zn)}}catch(ce){Ye(ce instanceof Error?ce.message:"Failed to generate key phrases")}finally{me(!1)}}},Xr=async()=>{if(!E)return;const ce=Nt;if(ce.length!==0){Et(!0),Mn(null);try{await nj(E,ce),Vt(!0),a(),x(4)}catch(zn){Mn(zn instanceof Error?zn.message:"Failed to save competitors")}finally{Et(!1)}}},ns=async()=>{if(E){Qt(!0);try{await Je.mutateAsync({projectName:E,projectLabel:S||b||E,sourceAction:"setup-launch"}),Ze(!0),a()}catch{}finally{Qt(!1)}}},ht=()=>x(ce=>Math.max(0,ce-1)),gn=(()=>{switch(y){case 0:return r.jsxs(De,{className:"surface-card step-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 1 of 5"}),r.jsx("h2",{children:"System ready"})]})}),r.jsx("p",{className:"supporting-copy",children:"Checking that your Canonry instance is configured and reachable."}),r.jsx("div",{className:"compact-stack",children:p.healthChecks.map(ce=>r.jsxs("div",{className:"health-check-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:ce.label}),r.jsx("p",{className:"supporting-copy",children:ce.detail}),ce.id==="provider"&&ce.state!=="ready"&&r.jsx(St,{to:"/settings",className:"text-emerald-400 hover:text-emerald-300 text-sm mt-1 underline underline-offset-2 cursor-pointer",children:"Configure providers"})]}),r.jsx(lt,{tone:ce.state==="ready"?"positive":"caution",children:ce.state==="ready"?"Ready":"Attention"})]},ce.id))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx("span",{}),r.jsx(oe,{type:"button",disabled:!Ke,onClick:()=>x(1),children:"Continue"})]})]});case 1:return r.jsxs(De,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 2 of 5"}),r.jsx("h2",{children:"Create project"})]}),E?r.jsx(lt,{tone:"positive",children:"Created"}):null]}),E?r.jsxs("div",{className:"compact-stack",children:[r.jsxs("p",{className:"text-zinc-300",children:["Project ",r.jsx("span",{className:"text-zinc-100 font-medium",children:E})," created successfully."]}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>x(2),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"project-name",children:"Project name"}),r.jsx("input",{id:"project-name",className:"setup-input",type:"text",placeholder:"my-website",value:b,onChange:ce=>N(ce.target.value)}),Me&&Me!==b?r.jsxs("p",{className:"supporting-copy",children:["Slug: ",Me]}):null]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"display-name",children:"Display name (optional)"}),r.jsx("input",{id:"display-name",className:"setup-input",type:"text",placeholder:"My Website",value:S,onChange:ce=>C(ce.target.value)})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"domain",children:"Canonical domain"}),r.jsx("input",{id:"domain",className:"setup-input",type:"text",placeholder:"example.com",value:k,onChange:ce=>A(ce.target.value)})]}),r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"country",children:"Country"}),r.jsx("input",{id:"country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:R,onChange:ce=>z(ce.target.value.toUpperCase())})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"language",children:"Language"}),r.jsx("input",{id:"language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:$,onChange:ce=>P(ce.target.value.toLowerCase())})]})]}),V?r.jsx("p",{className:"text-rose-400 text-sm",children:V}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",disabled:!Me||!k||ue,onClick:Ma,children:ue?"Creating...":"Create project"})]})]})]});case 2:return r.jsxs(De,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 3 of 5"}),r.jsx("h2",{children:"Add key phrases"})]}),ae?r.jsxs(lt,{tone:"positive",children:[Xe.length," saved"]}):r.jsxs(lt,{tone:"neutral",children:[Xe.length," key phrase",Xe.length!==1?"s":""]})]}),r.jsx("p",{className:"supporting-copy",children:"Enter the search queries you want to track. One per line."}),ae?r.jsxs("div",{className:"compact-stack",children:[r.jsx("ul",{className:"detail-list",children:Xe.map(ce=>r.jsx("li",{children:ce},ce))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>x(3),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[J.length>0?r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[r.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"auto-generate",r.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsxs("div",{className:"setup-field flex-1",children:[r.jsx("label",{className:"setup-label",htmlFor:"gen-provider",children:"Provider"}),r.jsx("select",{id:"gen-provider",className:"setup-input",value:X,onChange:ce=>Y(ce.target.value),children:J.map(ce=>r.jsxs("option",{value:ce.name,children:[ce.displayName??ce.name,ce.model?` (${ce.model})`:""]},ce.name))})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"gen-count",children:"Count"}),r.jsx("select",{id:"gen-count",className:"setup-input",value:he,onChange:ce=>ge(Number(ce.target.value)),children:[3,5,10,15,20].map(ce=>r.jsx("option",{value:ce,children:ce},ce))})]}),r.jsx(oe,{type:"button",variant:"outline",disabled:we||!X,onClick:st,children:we?"Analyzing site...":"Generate"})]}),Ie?r.jsx("p",{className:"text-rose-400 text-sm",children:Ie}):null]}):null,r.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[r.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"or type manually",r.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"keywords",children:"Key phrases (one per line)"}),r.jsx("textarea",{id:"keywords",className:"setup-textarea",rows:6,placeholder:`emergency dentist brooklyn
|
|
244
|
-
best invisalign downtown brooklyn
|
|
245
|
-
pediatric dentist brooklyn heights`,value:xe,onChange:ce=>K(ce.target.value)})]}),de?r.jsx("p",{className:"text-rose-400 text-sm",children:de}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",disabled:Xe.length===0||T,onClick:pn,children:T?"Saving...":`Save ${Xe.length} key phrase${Xe.length!==1?"s":""}`})]})]})]});case 3:return r.jsxs(De,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 4 of 5"}),r.jsx("h2",{children:"Add competitors"})]}),Qe?r.jsx(lt,{tone:"positive",children:"Saved"}):null]}),r.jsx("p",{className:"supporting-copy",children:"Domains that compete for the same key phrases. One per line."}),Qe?r.jsxs("div",{className:"compact-stack",children:[r.jsx("ul",{className:"detail-list",children:Nt.map(ce=>r.jsx("li",{children:ce},ce))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>x(4),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"competitors",children:"Competitor domains (one per line)"}),r.jsx("textarea",{id:"competitors",className:"setup-textarea",rows:4,placeholder:`competitor1.com
|
|
246
|
-
competitor2.com`,value:le,onChange:ce=>Ue(ce.target.value)})]}),Ut?r.jsx("p",{className:"text-rose-400 text-sm",children:Ut}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:()=>x(4),children:"Skip"}),r.jsx(oe,{type:"button",disabled:Nt.length===0||nn,onClick:Xr,children:nn?"Saving...":`Save ${Nt.length} competitor${Nt.length!==1?"s":""}`})]})]})]})]});case 4:return r.jsxs(De,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 5 of 5"}),r.jsx("h2",{children:"Launch first run"})]}),re?r.jsx(lt,{tone:"positive",children:"Queued"}):null]}),re?r.jsxs("div",{className:"compact-stack",children:[r.jsx("p",{className:"text-zinc-300",children:"Visibility sweep has been queued. View progress on the project page."}),r.jsxs("div",{className:"setup-nav",children:[r.jsx("span",{}),r.jsx(oe,{type:"button",onClick:()=>v({to:H?`/projects/${H}`:"/"}),children:"Open project"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("p",{className:"supporting-copy",children:["Everything is configured. Launch an answer-visibility sweep to start tracking citations for ",r.jsx("span",{className:"text-zinc-100 font-medium",children:E}),"."]}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:ht,children:"Back"}),r.jsx(oe,{type:"button",disabled:gt,onClick:ns,children:gt?"Launching...":"Launch visibility sweep"})]})]})]});default:return null}})();return r.jsxs("div",{className:"page-container",children:[r.jsx("div",{className:"page-header",children:r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Setup"}),r.jsx("p",{className:"page-subtitle",children:"Create a project, add key phrases, add competitors, and launch the first run."})]})}),r.jsx(G$,{current:y,labels:H$}),r.jsx("section",{className:"setup-wizard",children:gn})]})}function Z$(){return r.jsx("div",{className:"page-container",children:r.jsx("section",{className:"page-section",children:r.jsxs(De,{className:"surface-card empty-card",children:[r.jsx("h1",{children:"Route not found"}),r.jsx("p",{children:"The current path does not map to a dashboard view."}),r.jsx(oe,{asChild:!0,children:r.jsx(St,{to:"/",children:"Return to overview"})})]})})})}function V$(){return r.jsx(q4,{children:r.jsx(B4,{})})}const ds=A_()({component:V$,validateSearch:e=>({runId:typeof e.runId=="string"?e.runId:void 0,evidenceId:typeof e.evidenceId=="string"?e.evidenceId:void 0})}),Q$=Wn({getParentRoute:()=>ds,path:"/",component:Q4,beforeLoad:({context:e})=>{const t=e.queryClient.getQueryData(Qn.projects.all);if(t&&t.length===0)throw fp({to:"/setup"})}}),Y$=Wn({getParentRoute:()=>ds,path:"/projects",component:o$}),wl=Wn({getParentRoute:()=>ds,path:"/projects/$projectId",component:()=>r.jsx(jp,{})}),J$=Wn({getParentRoute:()=>wl,path:"/",component:()=>r.jsx(bd,{tab:"overview"})}),X$=Wn({getParentRoute:()=>wl,path:"/search-console",component:()=>r.jsx(bd,{tab:"search-console"})}),W$=Wn({getParentRoute:()=>wl,path:"/analytics",component:()=>r.jsx(bd,{tab:"analytics"})}),eP=Wn({getParentRoute:()=>wl,path:"/traffic",component:()=>r.jsx(bd,{tab:"traffic"})}),tP=Wn({getParentRoute:()=>ds,path:"/runs",component:P$}),nP=Wn({getParentRoute:()=>ds,path:"/settings",component:K$,beforeLoad:({context:e})=>{}}),sP=Wn({getParentRoute:()=>ds,path:"/setup",component:F$,beforeLoad:({context:e})=>{const t=e.queryClient.getQueryData(Qn.projects.all);if(t&&t.length>0)throw fp({to:"/"})}}),iP=Wn({getParentRoute:()=>ds,path:"*",component:Z$}),aP=ds.addChildren([Q$,Y$,wl.addChildren([J$,X$,W$,eP]),tP,nP,sP,iP]);function rP(e,t){return B_({routeTree:aP,basepath:Gm||"/",context:{queryClient:e},...t?.initialEntries})}const ZN=J2(),oP=rP(ZN),VN=document.getElementById("root");if(!VN)throw new Error("Expected #root element for web app bootstrap.");function lP(){const[e,t]=w.useState(Bx()?"ready":"checking"),[n,a]=w.useState(""),[o,c]=w.useState(""),[u,f]=w.useState(null),[m,p]=w.useState(!1);w.useEffect(()=>{if(Bx())return;let x=!1;return a2().then(b=>{x||(b.authenticated?t("ready"):t(b.setupRequired?"setup":"login"))}).catch(b=>{x||(f(b instanceof Error?b.message:"Failed to reach the Canonry API"),t("login"))}),()=>{x=!0}},[]);const v=async x=>{if(x.preventDefault(),!n.trim()||n.trim().length<8){f("Password must be at least 8 characters");return}if(n!==o){f("Passwords do not match");return}p(!0),f(null);try{if(!(await r2(n.trim())).authenticated){f("Setup failed");return}a(""),c(""),t("ready")}catch(b){f(b instanceof _u||b instanceof Error?b.message:"Setup failed")}finally{p(!1)}},y=async x=>{if(x.preventDefault(),!!n.trim()){p(!0),f(null);try{if(!(await o2(n.trim())).authenticated){f("Incorrect password");return}a(""),t("ready")}catch(b){f(b instanceof _u||b instanceof Error?b.message:"Authentication failed")}finally{p(!1)}}};return e==="ready"?r.jsx(Pk,{client:ZN,children:r.jsx(H_,{router:oP})}):r.jsx("div",{className:"min-h-screen bg-zinc-950 px-4 py-8",children:r.jsx("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md items-center justify-center",children:r.jsx(De,{className:"surface-card w-full",children:e==="checking"?r.jsx(pu,{className:"py-8",children:r.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):e==="setup"?r.jsxs(r.Fragment,{children:[r.jsxs(Fm,{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),r.jsx(Zm,{children:"Create a dashboard password"}),r.jsx(Vm,{children:"Choose a password to protect the Canonry dashboard. You will use this to sign in on future visits."})]}),r.jsx(pu,{children:r.jsxs("form",{className:"space-y-4",onSubmit:v,children:[r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),r.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:n,onChange:x=>a(x.target.value),placeholder:"At least 8 characters"})]}),r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Confirm password"}),r.jsx("input",{className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:o,onChange:x=>c(x.target.value),placeholder:"Re-enter password"})]}),u?r.jsx("p",{className:"text-sm text-rose-400",children:u}):null,r.jsx(oe,{type:"submit",disabled:m||!n.trim()||!o.trim(),children:m?"Setting up…":"Create password & open dashboard"})]})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Fm,{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),r.jsx(Zm,{children:"Sign in to Canonry"}),r.jsx(Vm,{children:"Enter your dashboard password to continue."})]}),r.jsx(pu,{children:r.jsxs("form",{className:"space-y-4",onSubmit:y,children:[r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),r.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:n,onChange:x=>a(x.target.value),placeholder:"Dashboard password"})]}),u?r.jsx("p",{className:"text-sm text-rose-400",children:u}):null,r.jsx(oe,{type:"submit",disabled:m||!n.trim(),children:m?"Signing in…":"Open dashboard"})]})})]})})})})}hk.createRoot(VN).render(r.jsx(w.StrictMode,{children:r.jsx(lP,{})}));
|