@zuplo/editor 1.0.36988092953 → 1.0.36991925349

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/editor.main-B7ZQNwu9.js","static/js/chunk-6hGRweTZ.js","static/js/preload-helper-DxkSl20Q.js","static/js/editor.api2-DJi3_-IJ.js","static/css/editor-DU9oqspw.css","static/js/workers-CfQPK2eg.js","static/js/monaco.contribution-CZRO3JpP.js","static/js/McpCapabilityFilterDesigner-NlzlzABF.js","static/js/dist-CsanfiUI.js","static/js/GraphiQLConsole-C2iTqbJq.js","static/js/esm-y1PVfgTo.js","static/js/definition-C7QrKMH2.js","static/css/GraphiQLConsole-C4zv7lh0.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/editor.main-B7ZQNwu9.js","static/js/chunk-6hGRweTZ.js","static/js/preload-helper-DxkSl20Q.js","static/js/editor.api2-DJi3_-IJ.js","static/css/editor-DU9oqspw.css","static/js/workers-CfQPK2eg.js","static/js/monaco.contribution-CZRO3JpP.js","static/js/McpCapabilityFilterDesigner-CZevKoMn.js","static/js/dist-CsanfiUI.js","static/js/GraphiQLConsole-C2bvHgjX.js","static/js/esm-D4AD3Mz8.js","static/js/definition-C7QrKMH2.js","static/css/GraphiQLConsole-C4zv7lh0.css"])))=>i.map(i=>d[i]);
2
2
  import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-6hGRweTZ.js";import{$ as o,$n as s,$t as c,A as l,An as u,At as d,B as f,Bn as p,Bt as m,C as h,Cn as g,Ct as _,D as v,Dn as y,Dt as b,E as x,En as S,Et as C,F as w,Fn as T,Ft as E,G as D,Gn as O,Gt as k,H as A,Hn as j,Ht as M,I as N,In as P,It as F,J as I,Jn as L,Jt as R,K as z,Kn as B,Kt as ee,L as te,Ln as V,Lt as ne,M as re,Mn as ie,Mt as ae,N as oe,Nn as se,Nt as ce,O as le,On as ue,Ot as de,P as fe,Pn as pe,Pt as me,Q as he,Qn as ge,Qt as _e,R as ve,Rn as ye,Rt as be,S as xe,Sn as Se,St as Ce,T as we,Tn as Te,U as Ee,Un as De,Ut as Oe,V as ke,Vn as Ae,Vt as je,W as Me,Wn as Ne,Wt as Pe,X as Fe,Xn as Ie,Xt as Le,Y as Re,Yn as ze,Yt as Be,Z as Ve,Zn as He,Zt as Ue,_n as We,_t as Ge,a as Ke,an as qe,ar as Je,at as Ye,b as Xe,bn as Ze,bt as Qe,c as $e,cn as et,ct as tt,d as nt,dn as rt,dt as it,en as at,er as ot,et as st,fn as ct,ft as lt,gn as ut,gt as dt,hn as ft,ht as pt,i as mt,in as ht,ir as gt,it as _t,j as vt,jn as yt,jt as bt,k as xt,kn as St,kt as Ct,l as wt,ln as Tt,lt as Et,mn as Dt,mt as Ot,n as kt,nn as At,nr as jt,nt as Mt,o as Nt,on as Pt,or as Ft,ot as It,pn as Lt,pt as Rt,q as zt,qn as Bt,qt as Vt,r as Ht,rn as Ut,rr as Wt,rt as Gt,s as Kt,sn as qt,sr as Jt,st as Yt,t as Xt,tn as Zt,tr as Qt,tt as $t,u as en,un as tn,ut as nn,vn as rn,vt as an,w as on,wn as sn,wt as cn,x as ln,xn as un,xt as dn,y as fn,yn as pn,yt as mn,z as hn,zn as gn,zt as _n}from"./dist-CsanfiUI.js";import{t as vn}from"./preload-helper-DxkSl20Q.js";import{$ as yn,C as bn,E as xn,F as Sn,G as Cn,I as wn,J as Tn,K as En,M as Dn,O as On,P as kn,Q as An,S as jn,V as Mn,X as Nn,Y as Pn,Z as eee,_ as Fn,a as In,at as Ln,b as Rn,c as zn,ct as Bn,d as Vn,et as Hn,f as tee,h as Un,i as Wn,k as Gn,l as Kn,lt as qn,m as Jn,n as nee,nt as Yn,o as Xn,p as Zn,r as Qn,rt as $n,s as er,st as tr,t as nr,tt as rr,ut as ir,w as ar,x as or,y as sr}from"./definition-C7QrKMH2.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var cr=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),ree=a(((e,t)=>{t.exports=cr()})),lr=a((e=>{var t=ree(),n=Jt(),r=Ft();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),b=Symbol.for(`react.context`),x=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),C=Symbol.for(`react.suspense_list`),w=Symbol.for(`react.memo`),T=Symbol.for(`react.lazy`),E=Symbol.for(`react.activity`),D=Symbol.for(`react.memo_cache_sentinel`),O=Symbol.iterator;function k(e){return typeof e!=`object`||!e?null:(e=O&&e[O]||e[`@@iterator`],typeof e==`function`?e:null)}var A=Symbol.for(`react.client.reference`);function j(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===A?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case C:return`SuspenseList`;case E:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case b:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case x:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case w:return t=e.displayName||null,t===null?j(e.type)||`Memo`:t;case T:t=e._payload,e=e._init;try{return j(e(t))}catch{}}return null}var M=Array.isArray,N=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},I=[],L=-1;function R(e){return{current:e}}function z(e){0>L||(e.current=I[L],I[L]=null,L--)}function B(e,t){L++,I[L]=e.current,e.current=t}var ee=R(null),te=R(null),V=R(null),ne=R(null);function re(e,t){switch(B(V,t),B(te,e),B(ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?kd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=kd(t),e=Ad(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}z(ee),B(ee,e)}function ie(){z(ee),z(te),z(V)}function ae(e){e.memoizedState!==null&&B(ne,e);var t=ee.current,n=Ad(t,e.type);t!==n&&(B(te,e),B(ee,n))}function oe(e){te.current===e&&(z(ee),z(te)),ne.current===e&&(z(ne),Ef._currentValue=F)}var se,ce;function le(e){if(se===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);se=t&&t[1]||``,ce=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+se+e+ce}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -7,7 +7,7 @@ import{a as e,i as t,n,o as r,r as i,t as a}from"./chunk-6hGRweTZ.js";import{$ a
7
7
  `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ue=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return de(e.type,!1);case 11:return de(e.type.render,!1);case 1:return de(e.type,!0);case 31:return le(`Activity`);default:return``}}function pe(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
8
  Error generating stack: `+e.message+`
9
9
  `+e.stack}}var me=Object.prototype.hasOwnProperty,he=t.unstable_scheduleCallback,ge=t.unstable_cancelCallback,_e=t.unstable_shouldYield,ve=t.unstable_requestPaint,ye=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,xe=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,we=t.unstable_LowPriority,Te=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=P.p;return e===0?(e=window.event,e===void 0?32:zf(e.type)):e}function Qe(e,t){var n=P.p;try{return P.p=e,t()}finally{P.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qd(e);e!==null;){if(n=e[et])return n;e=qd(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=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]*$`),yt={},bt={};function xt(e){return me.call(bt,e)?!0:me.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ct(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):It(e,o,Tt(n)):It(e,o,Tt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Tt(s):e.removeAttribute(`name`)}function Pt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ot(e)}function It(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Lt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Tt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Rt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function zt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(M(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function Bt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Vt=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 Ht(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Vt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ut(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ht(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ht(e,o,t[o])}function Wt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Gt=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`]]),Kt=/^[\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 qt(e){return Kt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Yt(){}var Xt=null;function Zt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Qt=null,$t=null;function en(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[tt]||null;if(!a)throw Error(i(90));Nt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&kt(r)}break a;case`textarea`:Rt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Lt(e,!!n.multiple,t,!1)}}}var tn=!1;function nn(e,t,n){if(tn)return e(t,n);tn=!0;try{return e(t)}finally{if(tn=!1,(Qt!==null||$t!==null)&&(cu(),Qt&&(t=Qt,e=$t,$t=Qt=null,en(t),e)))for(t=0;t<e.length;t++)en(e[t])}}function rn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var an=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),on=!1;if(an)try{var sn={};Object.defineProperty(sn,`passive`,{get:function(){on=!0}}),window.addEventListener(`test`,sn,sn),window.removeEventListener(`test`,sn,sn)}catch{on=!1}var cn=null,ln=null,un=null;function dn(){if(un)return un;var e,t=ln,n=t.length,r,i=`value`in cn?cn.value:cn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return un=i.slice(e,1<r?1-r:void 0)}function fn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function pn(){return!0}function mn(){return!1}function hn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?pn:mn,this.isPropagationStopped=mn,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=pn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=pn)},persist:function(){},isPersistent:pn}),t}var gn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_n=hn(gn),vn=f({},gn,{view:0,detail:0}),yn=hn(vn),bn,xn,Sn,Cn=f({},vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Pn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Sn&&(Sn&&e.type===`mousemove`?(bn=e.screenX-Sn.screenX,xn=e.screenY-Sn.screenY):xn=bn=0,Sn=e),bn)},movementY:function(e){return`movementY`in e?e.movementY:xn}}),wn=hn(Cn),Tn=hn(f({},Cn,{dataTransfer:0})),En=hn(f({},vn,{relatedTarget:0})),Dn=hn(f({},gn,{animationName:0,elapsedTime:0,pseudoElement:0})),On=hn(f({},gn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),kn=hn(f({},gn,{data:0})),An={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},jn={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`},Mn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Nn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Mn[e])?!!t[e]:!1}function Pn(){return Nn}var eee=hn(f({},vn,{key:function(e){if(e.key){var t=An[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=fn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?jn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Pn,charCode:function(e){return e.type===`keypress`?fn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?fn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Fn=hn(f({},Cn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),In=hn(f({},vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Pn})),Ln=hn(f({},gn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Rn=hn(f({},Cn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),zn=hn(f({},gn,{newState:0,oldState:0})),Bn=[9,13,27,32],Vn=an&&`CompositionEvent`in window,Hn=null;an&&`documentMode`in document&&(Hn=document.documentMode);var tee=an&&`TextEvent`in window&&!Hn,Un=an&&(!Vn||Hn&&8<Hn&&11>=Hn),Wn=` `,Gn=!1;function Kn(e,t){switch(e){case`keyup`:return Bn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function qn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Jn=!1;function nee(e,t){switch(e){case`compositionend`:return qn(t);case`keypress`:return t.which===32?(Gn=!0,Wn):null;case`textInput`:return e=t.data,e===Wn&&Gn?null:e;default:return null}}function Yn(e,t){if(Jn)return e===`compositionend`||!Vn&&Kn(e,t)?(e=dn(),un=ln=cn=null,Jn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Un&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={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 Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Qt?$t?$t.push(r):$t=[r]:Qt=r,t=pd(t,`onChange`),0<t.length&&(n=new _n(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){ad(e,0)}function nr(e){if(kt(dt(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(an){var ar;if(an){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Zt(e)),nn(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function iee(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function H(e,t){if(e===`click`)return nr(t)}function dr(e,t){if(e===`input`||e===`change`)return nr(t)}function aee(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var fr=typeof Object.is==`function`?Object.is:aee;function pr(e,t){if(fr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!me.call(t,i)||!fr(e[i],t[i]))return!1}return!0}function mr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hr(e,t){var n=mr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=mr(n)}}function gr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=At(e.document)}return t}function vr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var yr=an&&`documentMode`in document&&11>=document.documentMode,br=null,xr=null,Sr=null,Cr=!1;function wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cr||br==null||br!==At(r)||(r=br,`selectionStart`in r&&vr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sr&&pr(Sr,r)||(Sr=r,r=pd(xr,`onSelect`),0<r.length&&(t=new _n(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=br)))}function Tr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Er={animationend:Tr(`Animation`,`AnimationEnd`),animationiteration:Tr(`Animation`,`AnimationIteration`),animationstart:Tr(`Animation`,`AnimationStart`),transitionrun:Tr(`Transition`,`TransitionRun`),transitionstart:Tr(`Transition`,`TransitionStart`),transitioncancel:Tr(`Transition`,`TransitionCancel`),transitionend:Tr(`Transition`,`TransitionEnd`)},Dr={},Or={};an&&(Or=document.createElement(`div`).style,`AnimationEvent`in window||(delete Er.animationend.animation,delete Er.animationiteration.animation,delete Er.animationstart.animation),`TransitionEvent`in window||delete Er.transitionend.transition);function kr(e){if(Dr[e])return Dr[e];if(!Er[e])return e;var t=Er[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Or)return Dr[e]=t[n];return e}var Ar=kr(`animationend`),jr=kr(`animationiteration`),Mr=kr(`animationstart`),oee=kr(`transitionrun`),see=kr(`transitionstart`),cee=kr(`transitioncancel`),Nr=kr(`transitionend`),Pr=new Map,Fr=`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(` `);Fr.push(`scrollEnd`);function Ir(e,t){Pr.set(e,t),gt(t,[e])}var Lr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Rr=[],zr=0,Br=0;function Vr(){for(var e=zr,t=Br=zr=0;t<e;){var n=Rr[t];Rr[t++]=null;var r=Rr[t];Rr[t++]=null;var i=Rr[t];Rr[t++]=null;var a=Rr[t];if(Rr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Gr(n,i,a)}}function Hr(e,t,n,r){Rr[zr++]=e,Rr[zr++]=t,Rr[zr++]=n,Rr[zr++]=r,Br|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ur(e,t,n,r){return Hr(e,t,n,r),Kr(e)}function Wr(e,t){return Hr(e,null,null,t),Kr(e)}function Gr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Kr(e){if(50<eu)throw eu=0,tu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var qr={};function Jr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Yr(e,t,n,r){return new Jr(e,t,n,r)}function Xr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Zr(e,t){var n=e.alternate;return n===null?(n=Yr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Qr(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function $r(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Xr(e)&&(s=1);else if(typeof e==`string`)s=jee(e,n,ee.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case E:return e=Yr(31,n,t,a),e.elementType=E,e.lanes=o,e;case g:return ei(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=Yr(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case S:return e=Yr(13,n,t,a),e.elementType=S,e.lanes=o,e;case C:return e=Yr(19,n,t,a),e.elementType=C,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case b:s=10;break a;case y:s=9;break a;case x:s=11;break a;case w:s=14;break a;case T:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Yr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ei(e,t,n,r){return e=Yr(7,e,r,t),e.lanes=n,e}function ti(e,t,n){return e=Yr(6,e,null,t),e.lanes=n,e}function ni(e){var t=Yr(18,null,null,0);return t.stateNode=e,t}function ri(e,t,n){return t=Yr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ii=new WeakMap;function ai(e,t){if(typeof e==`object`&&e){var n=ii.get(e);return n===void 0?(t={value:e,source:t,stack:pe(t)},ii.set(e,t),t):n}return{value:e,source:t,stack:pe(t)}}var oi=[],si=0,ci=null,li=0,ui=[],di=0,fi=null,pi=1,mi=``;function hi(e,t){oi[si++]=li,oi[si++]=ci,ci=e,li=t}function gi(e,t,n){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,fi=e;var r=pi;e=mi;var i=32-je(r)-1;r&=~(1<<i),n+=1;var a=32-je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,pi=1<<32-je(t)+i|n<<i|r,mi=a+e}else pi=1<<a|n<<i|r,mi=e}function _i(e){e.return!==null&&(hi(e,1),gi(e,1,0))}function vi(e){for(;e===ci;)ci=oi[--si],oi[si]=null,li=oi[--si],oi[si]=null;for(;e===fi;)fi=ui[--di],ui[di]=null,mi=ui[--di],ui[di]=null,pi=ui[--di],ui[di]=null}function yi(e,t){ui[di++]=pi,ui[di++]=mi,ui[di++]=fi,pi=t.id,mi=t.overflow,fi=e}var bi=null,xi=null,Si=!1,Ci=null,wi=!1,Ti=Error(i(519));function Ei(e){throw Mi(ai(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ti}function Di(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=r,n){case`dialog`:od(`cancel`,t),od(`close`,t);break;case`iframe`:case`object`:case`embed`:od(`load`,t);break;case`video`:case`audio`:for(n=0;n<rd.length;n++)od(rd[n],t);break;case`source`:od(`error`,t);break;case`img`:case`image`:case`link`:od(`error`,t),od(`load`,t);break;case`details`:od(`toggle`,t);break;case`input`:od(`invalid`,t),Pt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:od(`invalid`,t);break;case`textarea`:od(`invalid`,t),zt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||yd(t.textContent,n)?(r.popover!=null&&(od(`beforetoggle`,t),od(`toggle`,t)),r.onScroll!=null&&od(`scroll`,t),r.onScrollEnd!=null&&od(`scrollend`,t),r.onClick!=null&&(t.onclick=Yt),t=!0):t=!1,t||Ei(e,!0)}function Oi(e){for(bi=e.return;bi;)switch(bi.tag){case 5:case 31:case 13:wi=!1;return;case 27:case 3:wi=!0;return;default:bi=bi.return}}function ki(e){if(e!==bi)return!1;if(!Si)return Oi(e),Si=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||jd(e.type,e.memoizedProps)),n=!n),n&&xi&&Ei(e),Oi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));xi=Kd(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));xi=Kd(e)}else t===27?(t=xi,Fd(e.type)?(e=Gd,Gd=null,xi=e):xi=t):xi=bi?Wd(e.stateNode.nextSibling):null;return!0}function Ai(){xi=bi=null,Si=!1}function ji(){var e=Ci;return e!==null&&(Bl===null?Bl=e:Bl.push.apply(Bl,e),Ci=null),e}function Mi(e){Ci===null?Ci=[e]:Ci.push(e)}var Ni=R(null),Pi=null,Fi=null;function Ii(e,t,n){B(Ni,t._currentValue),t._currentValue=n}function Li(e){e._currentValue=Ni.current,z(Ni)}function Ri(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function zi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Ri(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Ri(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Bi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;fr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ne.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Ef]:e.push(Ef))}a=a.return}e!==null&&zi(t,e,n,r),t.flags|=262144}function Vi(e){for(e=e.firstContext;e!==null;){if(!fr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Hi(e){Pi=e,Fi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ui(e){return Gi(Pi,e)}function Wi(e,t){return Pi===null&&Hi(e),Gi(e,t)}function Gi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Fi===null){if(e===null)throw Error(i(308));Fi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Fi=Fi.next=t;return n}var Ki=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},lee=t.unstable_scheduleCallback,qi=t.unstable_NormalPriority,Ji={$$typeof:b,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yi(){return{controller:new Ki,data:new Map,refCount:0}}function Xi(e){e.refCount--,e.refCount===0&&lee(qi,function(){e.controller.abort()})}var Zi=null,Qi=0,$i=0,ea=null;function ta(e,t){if(Zi===null){var n=Zi=[];Qi=0,$i=Zu(),ea={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Qi++,t.then(na,na),t}function na(){if(--Qi===0&&Zi!==null){ea!==null&&(ea.status=`fulfilled`);var e=Zi;Zi=null,$i=0,ea=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function uee(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ra=N.S;N.S=function(e,t){Ul=ye(),typeof t==`object`&&t&&typeof t.then==`function`&&ta(e,t),ra!==null&&ra(e,t)};var ia=R(null);function aa(){var e=ia.current;return e===null?wl.pooledCache:e}function oa(e,t){t===null?B(ia,ia.current):B(ia,t.pool)}function sa(){var e=aa();return e===null?null:{parent:Ji._currentValue,pool:e}}var ca=Error(i(460)),la=Error(i(474)),ua=Error(i(542)),da={then:function(){}};function fa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function pa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Yt,Yt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,_a(e),e;default:if(typeof t.status==`string`)t.then(Yt,Yt);else{if(e=wl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,_a(e),e}throw ha=t,ca}}function ma(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ha=e,ca):e}}var ha=null;function ga(){if(ha===null)throw Error(i(459));var e=ha;return ha=null,e}function _a(e){if(e===ca||e===ua)throw Error(i(483))}var va=null,ya=0;function ba(e){var t=ya;return ya+=1,va===null&&(va=[]),pa(va,e,t)}function xa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Sa(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ca(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Zr(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ti(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===T&&ma(i)===t.type)?(t=a(t,n.props),xa(t,n),t.return=e,t):(t=$r(n.type,n.key,n.props,null,e.mode,r),xa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ri(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ei(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ti(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=$r(t.type,t.key,t.props,null,e.mode,n),xa(n,t),n.return=e,n;case h:return t=ri(t,e.mode,n),t.return=e,t;case T:return t=ma(t),f(e,t,n)}if(M(t)||k(t))return t=ei(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ba(t),n);if(t.$$typeof===b)return f(e,Wi(e,t),n);Sa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case T:return n=ma(n),p(e,t,n,r)}if(M(n)||k(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ba(n),r);if(n.$$typeof===b)return p(e,t,Wi(e,n),r);Sa(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case T:return r=ma(r),_(e,t,n,r,i)}if(M(r)||k(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,ba(r),i);if(r.$$typeof===b)return _(e,t,n,Wi(t,r),i);Sa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Si&&hi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Si&&hi(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Si&&hi(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Si&&hi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Si&&hi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Si&&hi(a,h),u}function x(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===T&&ma(l)===r.type){n(e,r.sibling),c=a(r,o.props),xa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===g?(c=ei(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=$r(o.type,o.key,o.props,null,e.mode,c),xa(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ri(o,e.mode,c),c.return=e,e=c}return s(e);case T:return o=ma(o),x(e,r,o,c)}if(M(o))return v(e,r,o,c);if(k(o)){if(l=k(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return x(e,r,ba(o),c);if(o.$$typeof===b)return x(e,r,Wi(e,o),c);Sa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ti(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ya=0;var i=x(e,t,n,r);return va=null,i}catch(t){if(t===ca||t===ua)throw t;var a=Yr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var wa=Ca(!0),Ta=Ca(!1),Ea=!1;function Da(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ka(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Aa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Cl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Kr(e),Gr(e,null,n),t}return Hr(e,r,t,n),Kr(e)}function ja(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}function Ma(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Na=!1;function Pa(){if(Na){var e=ea;if(e!==null)throw e}}function Fa(e,t,n,r){Na=!1;var i=e.updateQueue;Ea=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(El&p)===p:(r&p)===p){p!==0&&p===$i&&(Na=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Ea=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Pl|=o,e.lanes=o,e.memoizedState=d}}function Ia(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function La(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ia(n[e],t)}var Ra=R(null),za=R(0);function Ba(e,t){e=Ml,B(za,e),B(Ra,t),Ml=e|t.baseLanes}function Va(){B(za,Ml),B(Ra,Ra.current)}function Ha(){Ml=za.current,z(Ra),z(za)}var Ua=R(null),Wa=null;function Ga(e){var t=e.alternate;B(Xa,Xa.current&1),B(Ua,e),Wa===null&&(t===null||Ra.current!==null||t.memoizedState!==null)&&(Wa=e)}function Ka(e){B(Xa,Xa.current),B(Ua,e),Wa===null&&(Wa=e)}function qa(e){e.tag===22?(B(Xa,Xa.current),B(Ua,e),Wa===null&&(Wa=e)):Ja(e)}function Ja(){B(Xa,Xa.current),B(Ua,Ua.current)}function Ya(e){z(Ua),Wa===e&&(Wa=null),z(Xa)}var Xa=R(0);function Za(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||Hd(n)||Ud(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Qa=0,$a=null,eo=null,to=null,no=!1,ro=!1,io=!1,ao=0,oo=0,so=null,co=0;function lo(){throw Error(i(321))}function uo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!fr(e[n],t[n]))return!1;return!0}function fo(e,t,n,r,i,a){return Qa=a,$a=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,N.H=e===null||e.memoizedState===null?Es:Ds,io=!1,a=n(r,i),io=!1,ro&&(a=mo(t,n,r,i)),po(e),a}function po(e){N.H=Ts;var t=eo!==null&&eo.next!==null;if(Qa=0,to=eo=$a=null,no=!1,oo=0,so=null,t)throw Error(i(300));e===null||Us||(e=e.dependencies,e!==null&&Vi(e)&&(Us=!0))}function mo(e,t,n,r){$a=e;var a=0;do{if(ro&&(so=null),oo=0,ro=!1,25<=a)throw Error(i(301));if(a+=1,to=eo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}N.H=Os,o=t(n,r)}while(ro);return o}function ho(){var e=N.H,t=e.useState()[0];return t=typeof t.then==`function`?So(t):t,e=e.useState()[0],(eo===null?null:eo.memoizedState)!==e&&($a.flags|=1024),t}function go(){var e=ao!==0;return ao=0,e}function _o(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function vo(e){if(no){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}no=!1}Qa=0,to=eo=$a=null,ro=!1,oo=ao=0,so=null}function yo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return to===null?$a.memoizedState=to=e:to=to.next=e,to}function bo(){if(eo===null){var e=$a.alternate;e=e===null?null:e.memoizedState}else e=eo.next;var t=to===null?$a.memoizedState:to.next;if(t!==null)to=t,eo=e;else{if(e===null)throw $a.alternate===null?Error(i(467)):Error(i(310));eo=e,e={memoizedState:eo.memoizedState,baseState:eo.baseState,baseQueue:eo.baseQueue,queue:eo.queue,next:null},to===null?$a.memoizedState=to=e:to=to.next=e}return to}function xo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function So(e){var t=oo;return oo+=1,so===null&&(so=[]),e=pa(so,e,t),t=$a,(to===null?t.memoizedState:to.next)===null&&(t=t.alternate,N.H=t===null||t.memoizedState===null?Es:Ds),e}function Co(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return So(e);if(e.$$typeof===b)return Ui(e)}throw Error(i(438,String(e)))}function wo(e){var t=null,n=$a.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=$a.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=xo(),$a.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=D;return t.index++,n}function To(e,t){return typeof t==`function`?t(e):t}function Eo(e){return Do(bo(),eo,e)}function Do(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Qa&f)===f:(El&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===$i&&(d=!0);else if((Qa&p)===p){u=u.next,p===$i&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,$a.lanes|=p,Pl|=p;f=u.action,io&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,$a.lanes|=f,Pl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!fr(o,e.memoizedState)&&(Us=!0,d&&(n=ea,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Oo(e){var t=bo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);fr(o,t.memoizedState)||(Us=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function ko(e,t,n){var r=$a,a=bo(),o=Si;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!fr((eo||a).memoizedState,n);if(s&&(a.memoizedState=n,Us=!0),a=a.queue,$o(Mo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||to!==null&&to.memoizedState.tag&1){if(r.flags|=2048,Jo(9,{destroy:void 0},jo.bind(null,r,a,n,t),null),wl===null)throw Error(i(349));o||Qa&127||Ao(r,t,n)}return n}function Ao(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=$a.updateQueue,t===null?(t=xo(),$a.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function jo(e,t,n,r){t.value=n,t.getSnapshot=r,No(t)&&Po(e)}function Mo(e,t,n){return n(function(){No(t)&&Po(e)})}function No(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fr(e,n)}catch{return!0}}function Po(e){var t=Wr(e,2);t!==null&&iu(t,e,2)}function Fo(e){var t=yo();if(typeof e==`function`){var n=e;if(e=n(),io){Ae(!0);try{n()}finally{Ae(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:To,lastRenderedState:e},t}function Io(e,t,n,r){return e.baseState=n,Do(e,eo,typeof r==`function`?r:To)}function dee(e,t,n,r,a){if(Ss(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};N.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Lo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Lo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=N.T,o={};N.T=o;try{var s=n(i,r),c=N.S;c!==null&&c(o,s),Ro(e,t,s)}catch(n){Bo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),N.T=a}}else try{a=n(i,r),Ro(e,t,a)}catch(n){Bo(e,t,n)}}function Ro(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){zo(e,t,n)},function(n){return Bo(e,t,n)}):zo(e,t,n)}function zo(e,t,n){t.status=`fulfilled`,t.value=n,Vo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Lo(e,n)))}function Bo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Vo(t),t=t.next;while(t!==r)}e.action=null}function Vo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ho(e,t){return t}function Uo(e,t){if(Si){var n=wl.formState;if(n!==null){a:{var r=$a;if(Si){if(xi){b:{for(var i=xi,a=wi;i.nodeType!==8;){if(!a){i=null;break b}if(i=Wd(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){xi=Wd(i.nextSibling),r=i.data===`F!`;break a}}Ei(r)}r=!1}r&&(t=n[0])}}return n=yo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ho,lastRenderedState:t},n.queue=r,n=ys.bind(null,$a,r),r.dispatch=n,r=Fo(!1),a=xs.bind(null,$a,!1,r.queue),r=yo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=dee.bind(null,$a,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Wo(e){return Go(bo(),eo,e)}function Go(e,t,n){if(t=Do(e,t,Ho)[0],e=Eo(To)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=So(t)}catch(e){throw e===ca?ua:e}else r=t;t=bo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&($a.flags|=2048,Jo(9,{destroy:void 0},Ko.bind(null,i,n),null)),[r,a,e]}function Ko(e,t){e.action=t}function qo(e){var t=bo(),n=eo;if(n!==null)return Go(t,n,e);bo(),t=t.memoizedState,n=bo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Jo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=$a.updateQueue,t===null&&(t=xo(),$a.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Yo(){return bo().memoizedState}function Xo(e,t,n,r){var i=yo();$a.flags|=e,i.memoizedState=Jo(1|t,{destroy:void 0},n,r===void 0?null:r)}function Zo(e,t,n,r){var i=bo();r=r===void 0?null:r;var a=i.memoizedState.inst;eo!==null&&r!==null&&uo(r,eo.memoizedState.deps)?i.memoizedState=Jo(t,a,n,r):($a.flags|=e,i.memoizedState=Jo(1|t,a,n,r))}function Qo(e,t){Xo(8390656,8,e,t)}function $o(e,t){Zo(2048,8,e,t)}function es(e){$a.flags|=4;var t=$a.updateQueue;if(t===null)t=xo(),$a.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ts(e){var t=bo().memoizedState;return es({ref:t,nextImpl:e}),function(){if(Cl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ns(e,t){return Zo(4,2,e,t)}function rs(e,t){return Zo(4,4,e,t)}function is(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function as(e,t,n){n=n==null?null:n.concat([e]),Zo(4,4,is.bind(null,t,e),n)}function os(){}function ss(e,t){var n=bo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&uo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function cs(e,t){var n=bo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&uo(t,r[1]))return r[0];if(r=e(),io){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r}function ls(e,t,n){return n===void 0||Qa&1073741824&&!(El&261930)?e.memoizedState=t:(e.memoizedState=n,e=ru(),$a.lanes|=e,Pl|=e,n)}function us(e,t,n,r){return fr(n,t)?n:Ra.current===null?!(Qa&42)||Qa&1073741824&&!(El&261930)?(Us=!0,e.memoizedState=n):(e=ru(),$a.lanes|=e,Pl|=e,t):(e=ls(e,n,r),fr(e,t)||(Us=!0),e)}function ds(e,t,n,r,i){var a=P.p;P.p=a!==0&&8>a?a:8;var o=N.T,s={};N.T=s,xs(e,!1,t,n);try{var c=i(),l=N.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?bs(e,t,uee(c,r),nu(e)):bs(e,t,r,nu(e))}catch(n){bs(e,t,{then:function(){},status:`rejected`,reason:n},nu())}finally{P.p=a,o!==null&&s.types!==null&&(o.types=s.types),N.T=o}}function fee(){}function fs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=ps(e).queue;ds(e,a,t,F,n===null?fee:function(){return ms(e),n(r)})}function ps(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:To,lastRenderedState:F},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:To,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ms(e){var t=ps(e);t.next===null&&(t=e.alternate.memoizedState),bs(e,t.next.queue,{},nu())}function hs(){return Ui(Ef)}function gs(){return bo().memoizedState}function _s(){return bo().memoizedState}function vs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=nu();e=ka(n);var r=Aa(t,e,n);r!==null&&(iu(r,t,n),ja(r,t,n)),t={cache:Yi()},e.payload=t;return}t=t.return}}function pee(e,t,n){var r=nu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ss(e)?Cs(t,n):(n=Ur(e,t,n,r),n!==null&&(iu(n,e,r),ws(n,t,r)))}function ys(e,t,n){bs(e,t,n,nu())}function bs(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ss(e))Cs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,fr(s,o))return Hr(e,t,i,0),wl===null&&Vr(),!1}catch{}if(n=Ur(e,t,i,r),n!==null)return iu(n,e,r),ws(n,t,r),!0}return!1}function xs(e,t,n,r){if(r={lane:2,revertLane:Zu(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ss(e)){if(t)throw Error(i(479))}else t=Ur(e,n,r,2),t!==null&&iu(t,e,2)}function Ss(e){var t=e.alternate;return e===$a||t!==null&&t===$a}function Cs(e,t){ro=no=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ws(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Ts={readContext:Ui,use:Co,useCallback:lo,useContext:lo,useEffect:lo,useImperativeHandle:lo,useLayoutEffect:lo,useInsertionEffect:lo,useMemo:lo,useReducer:lo,useRef:lo,useState:lo,useDebugValue:lo,useDeferredValue:lo,useTransition:lo,useSyncExternalStore:lo,useId:lo,useHostTransitionStatus:lo,useFormState:lo,useActionState:lo,useOptimistic:lo,useMemoCache:lo,useCacheRefresh:lo};Ts.useEffectEvent=lo;var Es={readContext:Ui,use:Co,useCallback:function(e,t){return yo().memoizedState=[e,t===void 0?null:t],e},useContext:Ui,useEffect:Qo,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Xo(4194308,4,is.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Xo(4194308,4,e,t)},useInsertionEffect:function(e,t){Xo(4,2,e,t)},useMemo:function(e,t){var n=yo();t=t===void 0?null:t;var r=e();if(io){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=yo();if(n!==void 0){var i=n(t);if(io){Ae(!0);try{n(t)}finally{Ae(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=pee.bind(null,$a,e),[r.memoizedState,e]},useRef:function(e){var t=yo();return e={current:e},t.memoizedState=e},useState:function(e){e=Fo(e);var t=e.queue,n=ys.bind(null,$a,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:os,useDeferredValue:function(e,t){return ls(yo(),e,t)},useTransition:function(){var e=Fo(!1);return e=ds.bind(null,$a,e.queue,!0,!1),yo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=$a,a=yo();if(Si){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),wl===null)throw Error(i(349));El&127||Ao(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Qo(Mo.bind(null,r,o,e),[e]),r.flags|=2048,Jo(9,{destroy:void 0},jo.bind(null,r,o,n,t),null),n},useId:function(){var e=yo(),t=wl.identifierPrefix;if(Si){var n=mi,r=pi;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=ao++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=co++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:hs,useFormState:Uo,useActionState:Uo,useOptimistic:function(e){var t=yo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=xs.bind(null,$a,!0,n),n.dispatch=t,[e,t]},useMemoCache:wo,useCacheRefresh:function(){return yo().memoizedState=vs.bind(null,$a)},useEffectEvent:function(e){var t=yo(),n={impl:e};return t.memoizedState=n,function(){if(Cl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ds={readContext:Ui,use:Co,useCallback:ss,useContext:Ui,useEffect:$o,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Eo,useRef:Yo,useState:function(){return Eo(To)},useDebugValue:os,useDeferredValue:function(e,t){return us(bo(),eo.memoizedState,e,t)},useTransition:function(){var e=Eo(To)[0],t=bo().memoizedState;return[typeof e==`boolean`?e:So(e),t]},useSyncExternalStore:ko,useId:gs,useHostTransitionStatus:hs,useFormState:Wo,useActionState:Wo,useOptimistic:function(e,t){return Io(bo(),eo,e,t)},useMemoCache:wo,useCacheRefresh:_s};Ds.useEffectEvent=ts;var Os={readContext:Ui,use:Co,useCallback:ss,useContext:Ui,useEffect:$o,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Oo,useRef:Yo,useState:function(){return Oo(To)},useDebugValue:os,useDeferredValue:function(e,t){var n=bo();return eo===null?ls(n,e,t):us(n,eo.memoizedState,e,t)},useTransition:function(){var e=Oo(To)[0],t=bo().memoizedState;return[typeof e==`boolean`?e:So(e),t]},useSyncExternalStore:ko,useId:gs,useHostTransitionStatus:hs,useFormState:qo,useActionState:qo,useOptimistic:function(e,t){var n=bo();return eo===null?(n.baseState=e,[e,n.queue.dispatch]):Io(n,eo,e,t)},useMemoCache:wo,useCacheRefresh:_s};Os.useEffectEvent=ts;function ks(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var As={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=nu(),i=ka(r);i.payload=t,n!=null&&(i.callback=n),t=Aa(e,i,r),t!==null&&(iu(t,e,r),ja(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=nu(),i=ka(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Aa(e,i,r),t!==null&&(iu(t,e,r),ja(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=nu(),r=ka(n);r.tag=2,t!=null&&(r.callback=t),t=Aa(e,r,n),t!==null&&(iu(t,e,n),ja(t,e,n))}};function js(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!pr(n,r)||!pr(i,a):!0}function Ms(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&As.enqueueReplaceState(t,t.state,null)}function Ns(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Ps(e){Lr(e)}function mee(e){console.error(e)}function Fs(e){Lr(e)}function Is(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ls(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Rs(e,t,n){return n=ka(n),n.tag=3,n.payload={element:null},n.callback=function(){Is(e,t)},n}function zs(e){return e=ka(e),e.tag=3,e}function Bs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ls(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ls(t,n,r),typeof i!=`function`&&(Kl===null?Kl=new Set([this]):Kl.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Vs(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Bi(t,n,a,!0),n=Ua.current,n!==null){switch(n.tag){case 31:case 13:return Wa===null?hu():n.alternate===null&&Nl===0&&(Nl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===da?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Mu(e,r,a)),!1;case 22:return n.flags|=65536,r===da?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Mu(e,r,a)),!1}throw Error(i(435,n.tag))}return Mu(e,r,a),hu(),!1}if(Si)return t=Ua.current,t===null?(r!==Ti&&(t=Error(i(423),{cause:r}),Mi(ai(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ai(r,n),a=Rs(e.stateNode,r,a),Ma(e,a),Nl!==4&&(Nl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Ti&&(e=Error(i(422),{cause:r}),Mi(ai(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ai(o,n),zl===null?zl=[o]:zl.push(o),Nl!==4&&(Nl=2),t===null)return!0;r=ai(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Rs(n.stateNode,r,e),Ma(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Kl===null||!Kl.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=zs(a),Bs(a,e,n,r),Ma(n,a),!1}n=n.return}while(n!==null);return!1}var Hs=Error(i(461)),Us=!1;function Ws(e,t,n,r){t.child=e===null?Ta(t,null,n,r):wa(t,e.child,n,r)}function Gs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Hi(t),r=fo(e,t,n,o,a,i),s=go(),e!==null&&!Us?(_o(e,t,i),hc(e,t,i)):(Si&&s&&_i(t),t.flags|=1,Ws(e,t,r,i),t.child)}function Ks(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Xr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,qs(e,t,a,r,i)):(e=$r(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!gc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?pr:n,n(o,r)&&e.ref===t.ref)return hc(e,t,i)}return t.flags|=1,e=Zr(a,r),e.ref=t.ref,e.return=t,t.child=e}function qs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(pr(a,r)&&e.ref===t.ref)if(Us=!1,t.pendingProps=r=a,gc(e,i))e.flags&131072&&(Us=!0);else return t.lanes=e.lanes,hc(e,t,i)}return tc(e,t,n,r,i)}function Js(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Xs(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&oa(t,a===null?null:a.cachePool),a===null?Va():Ba(t,a),qa(t);else return r=t.lanes=536870912,Xs(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&oa(t,null),Va(),Ja(t)):(oa(t,a.cachePool),Ba(t,a),Ja(t),t.memoizedState=null);return Ws(e,t,i,n),t.child}function Ys(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Xs(e,t,n,r,i){var a=aa();return a=a===null?null:{parent:Ji._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&oa(t,null),Va(),qa(t),e!==null&&Bi(e,t,r,!0),t.childLanes=i,null}function Zs(e,t){return t=uc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Qs(e,t,n){return wa(t,e.child,null,n),e=Zs(t,t.pendingProps),e.flags|=2,Ya(t),t.memoizedState=null,e}function $s(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Si){if(r.mode===`hidden`)return e=Zs(t,r),t.lanes=536870912,Ys(null,e);if(Ka(t),(e=xi)?(e=Vd(e,wi),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ni(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return t.lanes=536870912,null}return Zs(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Ka(t),a)if(t.flags&256)t.flags&=-257,t=Qs(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(Us||Bi(e,t,n,!1),a=(n&e.childLanes)!==0,Us||a){if(r=wl,r!==null&&(s=Je(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Wr(e,s),iu(r,e,s),Hs;hu(),t=Qs(e,t,n)}else e=o.treeContext,xi=Wd(s.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=Zs(t,r),t.flags|=4096;return t}return e=Zr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ec(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function tc(e,t,n,r,i){return Hi(t),n=fo(e,t,n,r,void 0,i),r=go(),e!==null&&!Us?(_o(e,t,i),hc(e,t,i)):(Si&&r&&_i(t),t.flags|=1,Ws(e,t,n,i),t.child)}function nc(e,t,n,r,i,a){return Hi(t),t.updateQueue=null,n=mo(t,r,n,i),po(e),r=go(),e!==null&&!Us?(_o(e,t,a),hc(e,t,a)):(Si&&r&&_i(t),t.flags|=1,Ws(e,t,n,a),t.child)}function rc(e,t,n,r,i){if(Hi(t),t.stateNode===null){var a=qr,o=n.contextType;typeof o==`object`&&o&&(a=Ui(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=As,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Da(t),o=n.contextType,a.context=typeof o==`object`&&o?Ui(o):qr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(ks(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&As.enqueueReplaceState(a,a.state,null),Fa(t,r,a,i),Pa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ns(n,s);a.props=c;var l=a.context,u=n.contextType;o=qr,typeof u==`object`&&u&&(o=Ui(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Ms(t,a,r,o),Ea=!1;var f=t.memoizedState;a.state=f,Fa(t,r,a,i),Pa(),l=t.memoizedState,s||f!==l||Ea?(typeof d==`function`&&(ks(t,n,d,r),l=t.memoizedState),(c=Ea||js(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Oa(e,t),o=t.memoizedProps,u=Ns(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=qr,typeof l==`object`&&l&&(c=Ui(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Ms(t,a,r,c),Ea=!1,f=t.memoizedState,a.state=f,Fa(t,r,a,i),Pa();var p=t.memoizedState;o!==d||f!==p||Ea||e!==null&&e.dependencies!==null&&Vi(e.dependencies)?(typeof s==`function`&&(ks(t,n,s,r),p=t.memoizedState),(u=Ea||js(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Vi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,ec(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=wa(t,e.child,null,i),t.child=wa(t,null,n,i)):Ws(e,t,n,i),t.memoizedState=a.state,e=t.child):e=hc(e,t,i),e}function ic(e,t,n,r){return Ai(),t.flags|=256,Ws(e,t,n,r),t.child}var ac={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function oc(e){return{baseLanes:e,cachePool:sa()}}function sc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Ll),e}function cc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(Xa.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Si){if(a?Ga(t):Ja(t),(e=xi)?(e=Vd(e,wi),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:fi===null?null:{id:pi,overflow:mi},retryLane:536870912,hydrationErrors:null},n=ni(e),n.return=t,t.child=n,bi=t,xi=null)):e=null,e===null)throw Ei(t);return Ud(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Ja(t),a=t.mode,c=uc({mode:`hidden`,children:c},a),r=ei(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=oc(n),r.childLanes=sc(e,s,n),t.memoizedState=ac,Ys(null,r)):(Ga(t),lc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ga(t),t.flags&=-257,t=dc(e,t,n)):t.memoizedState===null?(Ja(t),c=r.fallback,a=t.mode,r=uc({mode:`visible`,children:r.children},a),c=ei(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,wa(t,e.child,null,n),r=t.child,r.memoizedState=oc(n),r.childLanes=sc(e,s,n),t.memoizedState=ac,t=Ys(null,r)):(Ja(t),t.child=e.child,t.flags|=128,t=null);else if(Ga(t),Ud(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Mi({value:r,source:null,stack:null}),t=dc(e,t,n)}else if(Us||Bi(e,t,n,!1),s=(n&e.childLanes)!==0,Us||s){if(s=wl,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Wr(e,r),iu(s,e,r),Hs;Hd(c)||hu(),t=dc(e,t,n)}else Hd(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,xi=Wd(c.nextSibling),bi=t,Si=!0,Ci=null,wi=!1,e!==null&&yi(t,e),t=lc(t,r.children),t.flags|=4096);return t}return a?(Ja(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=Zr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ei(c,a,n,null),c.flags|=2):c=Zr(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,Ys(null,r),r=t.child,c=e.child.memoizedState,c===null?c=oc(n):(a=c.cachePool,a===null?a=sa():(l=Ji._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=sc(e,s,n),t.memoizedState=ac,Ys(e.child,r)):(Ga(t),n=e.child,e=n.sibling,n=Zr(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function lc(e,t){return t=uc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function uc(e,t){return e=Yr(22,e,null,t),e.lanes=0,e}function dc(e,t,n){return wa(t,e.child,null,n),e=lc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function fc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ri(e.return,t,n)}function pc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function mc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Xa.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,B(Xa,o),Ws(e,t,r,n),r=Si?li:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&fc(e,n,t);else if(e.tag===19)fc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Za(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),pc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Za(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}pc(t,!0,n,null,a,r);break;case`together`:pc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function hc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Pl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Bi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Zr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Zr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function gc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Vi(e))):!0}function hee(e,t,n){switch(t.tag){case 3:re(t,t.stateNode.containerInfo),Ii(t,Ji,e.memoizedState.cache),Ai();break;case 27:case 5:ae(t);break;case 4:re(t,t.stateNode.containerInfo);break;case 10:Ii(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Ka(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ga(t),e=hc(e,t,n),e===null?null:e.sibling):cc(e,t,n):(Ga(t),t.flags|=128,null);Ga(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Bi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return mc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(Xa,Xa.current),r)break;return null;case 22:return t.lanes=0,Js(e,t,n,t.pendingProps);case 24:Ii(t,Ji,e.memoizedState.cache)}return hc(e,t,n)}function _c(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Us=!0;else{if(!gc(e,n)&&!(t.flags&128))return Us=!1,hee(e,t,n);Us=!!(e.flags&131072)}else Us=!1,Si&&t.flags&1048576&&gi(t,li,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ma(t.elementType),t.type=e,typeof e==`function`)Xr(e)?(r=Ns(e,r),t.tag=1,t=rc(null,t,e,r,n)):(t.tag=0,t=tc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===x){t.tag=11,t=Gs(null,t,e,r,n);break a}else if(a===w){t.tag=14,t=Ks(null,t,e,r,n);break a}}throw t=j(e)||e,Error(i(306,t,``))}}return t;case 0:return tc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ns(r,t.pendingProps),rc(e,t,r,a,n);case 3:a:{if(re(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Oa(e,t),Fa(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ii(t,Ji,r),r!==o.cache&&zi(t,[Ji],n,!0),Pa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=ic(e,t,r,n);break a}else if(r!==a){a=ai(Error(i(424)),t),Mi(a),t=ic(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(xi=Wd(e.firstChild),bi=t,Si=!0,Ci=null,wi=!0,n=Ta(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ai(),r===a){t=hc(e,t,n);break a}Ws(e,t,r,n)}t=t.child}return t;case 26:return ec(e,t),e===null?(n=lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Si||(n=t.type,e=t.pendingProps,r=Od(V.current).createElement(n),r[et]=t,r[tt]=e,Sd(r,n,e),pt(r),t.stateNode=r):t.memoizedState=lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ae(t),e===null&&Si&&(r=t.stateNode=Jd(t.type,t.pendingProps,V.current),bi=t,wi=!0,a=xi,Fd(t.type)?(Gd=a,xi=Wd(r.firstChild)):xi=a),Ws(e,t,t.pendingProps.children,n),ec(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Si&&((a=r=xi)&&(r=zd(r,t.type,t.pendingProps,wi),r===null?a=!1:(t.stateNode=r,bi=t,xi=Wd(r.firstChild),wi=!1,a=!0)),a||Ei(t)),ae(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,jd(a,o)?r=null:s!==null&&jd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=fo(e,t,ho,null,null,n),Ef._currentValue=a),ec(e,t),Ws(e,t,r,n),t.child;case 6:return e===null&&Si&&((e=n=xi)&&(n=Bd(n,t.pendingProps,wi),n===null?e=!1:(t.stateNode=n,bi=t,xi=null,e=!0)),e||Ei(t)),null;case 13:return cc(e,t,n);case 4:return re(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=wa(t,null,r,n):Ws(e,t,r,n),t.child;case 11:return Gs(e,t,t.type,t.pendingProps,n);case 7:return Ws(e,t,t.pendingProps,n),t.child;case 8:return Ws(e,t,t.pendingProps.children,n),t.child;case 12:return Ws(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ii(t,t.type,r.value),Ws(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Hi(t),a=Ui(a),r=r(a),t.flags|=1,Ws(e,t,r,n),t.child;case 14:return Ks(e,t,t.type,t.pendingProps,n);case 15:return qs(e,t,t.type,t.pendingProps,n);case 19:return mc(e,t,n);case 31:return $s(e,t,n);case 22:return Js(e,t,n,t.pendingProps);case 24:return Hi(t),r=Ui(Ji),e===null?(a=aa(),a===null&&(a=wl,o=Yi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Da(t),Ii(t,Ji,a)):((e.lanes&n)!==0&&(Oa(e,t),Fa(t,null,null,n),Pa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ii(t,Ji,r),r!==a.cache&&zi(t,[Ji],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ii(t,Ji,r))),Ws(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function vc(e){e.flags|=4}function yc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(fu())e.flags|=8192;else throw ha=da,la}else e.flags&=-16777217}function bc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Sf(t))if(fu())e.flags|=8192;else throw ha=da,la}function xc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,Rl|=t)}function Sc(e,t){if(!Si)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Cc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function gee(e,t,n){var r=t.pendingProps;switch(vi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Cc(t),null;case 1:return Cc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Li(Ji),ie(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ki(t)?vc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,ji())),Cc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(vc(t),o===null?(Cc(t),yc(t,a,null,r,n)):(Cc(t),bc(t,o))):o?o===e.memoizedState?(Cc(t),t.flags&=-16777217):(vc(t),Cc(t),bc(t,o)):(e=e.memoizedProps,e!==r&&vc(t),Cc(t),yc(t,a,e,r,n)),null;case 27:if(oe(t),n=V.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Cc(t),null}e=ee.current,ki(t)?Di(t,e):(e=Jd(a,r,n),t.stateNode=e,vc(t))}return Cc(t),null;case 5:if(oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&vc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Cc(t),null}if(o=ee.current,ki(t))Di(t,o);else{var s=Od(V.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[et]=t,o[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Sd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&vc(t)}}return Cc(t),yc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&vc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=V.current,ki(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=bi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||yd(e.nodeValue,n)),e||Ei(t,!0)}else e=Od(e).createTextNode(r),e[et]=t,t.stateNode=e}return Cc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ki(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[et]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Cc(t),e=!1}else n=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Ya(t),t):(Ya(t),null);if(t.flags&128)throw Error(i(558))}return Cc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ki(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[et]=t}else Ai(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Cc(t),a=!1}else a=ji(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Ya(t),t):(Ya(t),null)}return Ya(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),xc(t,t.updateQueue),Cc(t),null);case 4:return ie(),e===null&&ld(t.stateNode.containerInfo),Cc(t),null;case 10:return Li(t.type),Cc(t),null;case 19:if(z(Xa),r=t.memoizedState,r===null)return Cc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Sc(r,!1);else{if(Nl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Za(e),o!==null){for(t.flags|=128,Sc(r,!1),e=o.updateQueue,t.updateQueue=e,xc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Qr(n,e),n=n.sibling;return B(Xa,Xa.current&1|2),Si&&hi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ye()>Wl&&(t.flags|=128,a=!0,Sc(r,!1),t.lanes=4194304)}else{if(!a)if(e=Za(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,xc(t,e),Sc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Si)return Cc(t),null}else 2*ye()-r.renderingStartTime>Wl&&n!==536870912&&(t.flags|=128,a=!0,Sc(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Cc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ye(),e.sibling=null,n=Xa.current,B(Xa,a?n&1|2:n&1),Si&&hi(t,r.treeForkCount),e);case 22:case 23:return Ya(t),Ha(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Cc(t),t.subtreeFlags&6&&(t.flags|=8192)):Cc(t),n=t.updateQueue,n!==null&&xc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&z(ia),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Li(Ji),Cc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function _ee(e,t){switch(vi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Li(Ji),ie(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return oe(t),null;case 31:if(t.memoizedState!==null){if(Ya(t),t.alternate===null)throw Error(i(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Ya(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ai()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(Xa),null;case 4:return ie(),null;case 10:return Li(t.type),null;case 22:case 23:return Ya(t),Ha(),e!==null&&z(ia),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Li(Ji),null;case 25:return null;default:return null}}function wc(e,t){switch(vi(t),t.tag){case 3:Li(Ji),ie();break;case 26:case 27:case 5:oe(t);break;case 4:ie();break;case 31:t.memoizedState!==null&&Ya(t);break;case 13:Ya(t);break;case 19:z(Xa);break;case 10:Li(t.type);break;case 22:case 23:Ya(t),Ha(),e!==null&&z(ia);break;case 24:Li(Ji)}}function Tc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ju(t,t.return,e)}}function Ec(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ju(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ju(t,t.return,e)}}function Dc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{La(t,n)}catch(t){ju(e,e.return,t)}}}function Oc(e,t,n){n.props=Ns(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ju(e,t,n)}}function kc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ju(e,t,n)}}function Ac(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){ju(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ju(e,t,n)}else n.current=null}function jc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ju(e,e.return,t)}}function Mc(e,t,n){try{var r=e.stateNode;Cd(r,e.type,n,t),r[tt]=t}catch(t){ju(e,e.return,t)}}function Nc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Fd(e.type)||e.tag===4}function Pc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Nc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Fd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Yt));else if(r!==4&&(r===27&&Fd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Fc(e,t,n),e=e.sibling;e!==null;)Fc(e,t,n),e=e.sibling}function Ic(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Fd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Ic(e,t,n),e=e.sibling;e!==null;)Ic(e,t,n),e=e.sibling}function Lc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Sd(t,r,n),t[et]=e,t[tt]=n}catch(t){ju(e,e.return,t)}}var Rc=!1,zc=!1,Bc=!1,Vc=typeof WeakSet==`function`?WeakSet:Set,Hc=null;function Uc(e,t){if(e=e.containerInfo,Ed=Nf,e=_r(e),vr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Dd={focusedElem:e,selectionRange:n},Nf=!1,Hc=t;Hc!==null;)if(t=Hc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Hc=e;else for(;Hc!==null;){switch(t=Hc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ns(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){ju(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)Rd(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:Rd(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Hc=e;break}Hc=t.return}}function Wc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:al(e,n),r&4&&Tc(5,n);break;case 1:if(al(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ju(n,n.return,e)}else{var i=Ns(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ju(n,n.return,e)}}r&64&&Dc(n),r&512&&kc(n,n.return);break;case 3:if(al(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{La(e,t)}catch(e){ju(n,n.return,e)}}break;case 27:t===null&&r&4&&Lc(n);case 26:case 5:al(e,n),t===null&&r&4&&jc(n),r&512&&kc(n,n.return);break;case 12:al(e,n);break;case 31:al(e,n),r&4&&Xc(e,n);break;case 13:al(e,n),r&4&&Zc(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=xee.bind(null,n),Eee(e,n))));break;case 22:if(r=n.memoizedState!==null||Rc,!r){t=t!==null&&t.memoizedState!==null||zc,i=Rc;var a=zc;Rc=r,(zc=t)&&!a?sl(e,n,(n.subtreeFlags&8772)!=0):al(e,n),Rc=i,zc=a}break;case 30:break;default:al(e,n)}}function Gc(e){var t=e.alternate;t!==null&&(e.alternate=null,Gc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var Kc=null,qc=!1;function Jc(e,t,n){for(n=n.child;n!==null;)Yc(e,t,n),n=n.sibling}function Yc(e,t,n){if(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,n)}catch{}switch(n.tag){case 26:zc||Ac(n,t),Jc(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:zc||Ac(n,t);var r=Kc,i=qc;Fd(n.type)&&(Kc=n.stateNode,qc=!1),Jc(e,t,n),Yd(n.stateNode),Kc=r,qc=i;break;case 5:zc||Ac(n,t);case 6:if(r=Kc,i=qc,Kc=null,Jc(e,t,n),Kc=r,qc=i,Kc!==null)if(qc)try{(Kc.nodeType===9?Kc.body:Kc.nodeName===`HTML`?Kc.ownerDocument.body:Kc).removeChild(n.stateNode)}catch(e){ju(n,t,e)}else try{Kc.removeChild(n.stateNode)}catch(e){ju(n,t,e)}break;case 18:Kc!==null&&(qc?(e=Kc,Id(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),ip(e)):Id(Kc,n.stateNode));break;case 4:r=Kc,i=qc,Kc=n.stateNode.containerInfo,qc=!0,Jc(e,t,n),Kc=r,qc=i;break;case 0:case 11:case 14:case 15:Ec(2,n,t),zc||Ec(4,n,t),Jc(e,t,n);break;case 1:zc||(Ac(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Oc(n,t,r)),Jc(e,t,n);break;case 21:Jc(e,t,n);break;case 22:zc=(r=zc)||n.memoizedState!==null,Jc(e,t,n),zc=r;break;default:Jc(e,t,n)}}function Xc(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{ip(e)}catch(e){ju(t,t.return,e)}}}function Zc(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{ip(e)}catch(e){ju(t,t.return,e)}}function Qc(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Vc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Vc),t;default:throw Error(i(435,e.tag))}}function $c(e,t){var n=Qc(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Fu.bind(null,e,t);t.then(r,r)}})}function el(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Fd(c.type)){Kc=c.stateNode,qc=!1;break a}break;case 5:Kc=c.stateNode,qc=!1;break a;case 3:case 4:Kc=c.stateNode.containerInfo,qc=!0;break a}c=c.return}if(Kc===null)throw Error(i(160));Yc(o,s,a),Kc=null,qc=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)nl(t,e),t=t.sibling}var tl=null;function nl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:el(t,e),rl(e),r&4&&(Ec(3,e,e.return),Tc(3,e),Ec(5,e,e.return));break;case 1:el(t,e),rl(e),r&512&&(zc||n===null||Ac(n,n.return)),r&64&&Rc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=tl;if(el(t,e),rl(e),r&512&&(zc||n===null||Ac(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[st]||o[et]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Sd(o,r,n),o[et]=e,pt(o),r=o;break a;case`link`:var s=bf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Sd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=bf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Sd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[et]=e,pt(o),r=o}e.stateNode=r}else xf(a,e.type,e.stateNode);else e.stateNode=hf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Mc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?xf(a,e.type,e.stateNode):hf(a,r,e.memoizedProps))}break;case 27:el(t,e),rl(e),r&512&&(zc||n===null||Ac(n,n.return)),n!==null&&r&4&&Mc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(el(t,e),rl(e),r&512&&(zc||n===null||Ac(n,n.return)),e.flags&32){a=e.stateNode;try{Bt(a,``)}catch(t){ju(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Mc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Bc=!0);break;case 6:if(el(t,e),rl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){ju(e,e.return,t)}}break;case 3:if(yf=null,a=tl,tl=Qd(t.containerInfo),el(t,e),tl=a,rl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ip(t.containerInfo)}catch(t){ju(e,e.return,t)}Bc&&(Bc=!1,il(e));break;case 4:r=tl,tl=Qd(e.stateNode.containerInfo),el(t,e),rl(e),tl=r;break;case 12:el(t,e),rl(e);break;case 31:el(t,e),rl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,$c(e,r)));break;case 13:el(t,e),rl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Hl=ye()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,$c(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Rc,d=zc;if(Rc=u||a,zc=d||l,el(t,e),zc=d,Rc=u,rl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Rc||zc||ol(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){ju(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){ju(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?Ld(m,!0):Ld(l.stateNode,!1)}catch(e){ju(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,$c(e,n))));break;case 19:el(t,e),rl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,$c(e,r)));break;case 30:break;case 21:break;default:el(t,e),rl(e)}}function rl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Nc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Ic(e,Pc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Bt(o,``),n.flags&=-33),Ic(e,Pc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Fc(e,Pc(e),s);break;default:throw Error(i(161))}}catch(t){ju(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function il(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;il(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function al(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Wc(e,t.alternate,t),t=t.sibling}function ol(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ec(4,t,t.return),ol(t);break;case 1:Ac(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Oc(t,t.return,n),ol(t);break;case 27:Yd(t.stateNode);case 26:case 5:Ac(t,t.return),ol(t);break;case 22:t.memoizedState===null&&ol(t);break;case 30:ol(t);break;default:ol(t)}e=e.sibling}}function sl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:sl(i,a,n),Tc(4,a);break;case 1:if(sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ju(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ia(c[i],s)}catch(e){ju(r,r.return,e)}}n&&o&64&&Dc(a),kc(a,a.return);break;case 27:Lc(a);case 26:case 5:sl(i,a,n),n&&r===null&&o&4&&jc(a),kc(a,a.return);break;case 12:sl(i,a,n);break;case 31:sl(i,a,n),n&&o&4&&Xc(i,a);break;case 13:sl(i,a,n),n&&o&4&&Zc(i,a);break;case 22:a.memoizedState===null&&sl(i,a,n),kc(a,a.return);break;case 30:break;default:sl(i,a,n)}t=t.sibling}}function cl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Xi(n))}function ll(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Xi(e))}function ul(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dl(e,t,n,r),t=t.sibling}function dl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:ul(e,t,n,r),i&2048&&Tc(9,t);break;case 1:ul(e,t,n,r);break;case 3:ul(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Xi(e)));break;case 12:if(i&2048){ul(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){ju(t,t.return,e)}}else ul(e,t,n,r);break;case 31:ul(e,t,n,r);break;case 13:ul(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?ul(e,t,n,r):(a._visibility|=2,fl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?ul(e,t,n,r):pl(e,t),i&2048&&cl(o,t);break;case 24:ul(e,t,n,r),i&2048&&ll(t.alternate,t);break;default:ul(e,t,n,r)}}function fl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:fl(a,o,s,c,i),Tc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,fl(a,o,s,c,i)):u._visibility&2?fl(a,o,s,c,i):pl(a,o),i&&l&2048&&cl(o.alternate,o);break;case 24:fl(a,o,s,c,i),i&&l&2048&&ll(o.alternate,o);break;default:fl(a,o,s,c,i)}t=t.sibling}}function pl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:pl(n,r),i&2048&&cl(r.alternate,r);break;case 24:pl(n,r),i&2048&&ll(r.alternate,r);break;default:pl(n,r)}t=t.sibling}}var ml=8192;function hl(e,t,n){if(e.subtreeFlags&ml)for(e=e.child;e!==null;)gl(e,t,n),e=e.sibling}function gl(e,t,n){switch(e.tag){case 26:hl(e,t,n),e.flags&ml&&e.memoizedState!==null&&Mee(n,tl,e.memoizedState,e.memoizedProps);break;case 5:hl(e,t,n);break;case 3:case 4:var r=tl;tl=Qd(e.stateNode.containerInfo),hl(e,t,n),tl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=ml,ml=16777216,hl(e,t,n),ml=r):hl(e,t,n));break;default:hl(e,t,n)}}function _l(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function vl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Hc=r,xl(r,e)}_l(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)yl(e),e=e.sibling}function yl(e){switch(e.tag){case 0:case 11:case 15:vl(e),e.flags&2048&&Ec(9,e,e.return);break;case 3:vl(e);break;case 12:vl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,bl(e)):vl(e);break;default:vl(e)}}function bl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Hc=r,xl(r,e)}_l(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ec(8,t,t.return),bl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,bl(t));break;default:bl(t)}e=e.sibling}}function xl(e,t){for(;Hc!==null;){var n=Hc;switch(n.tag){case 0:case 11:case 15:Ec(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Xi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Hc=r;else a:for(n=e;Hc!==null;){r=Hc;var i=r.sibling,a=r.return;if(Gc(r),r===n){Hc=null;break a}if(i!==null){i.return=a,Hc=i;break a}Hc=a}}}var Sl={getCacheForType:function(e){var t=Ui(Ji),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ui(Ji).controller.signal}},vee=typeof WeakMap==`function`?WeakMap:Map,Cl=0,wl=null,Tl=null,El=0,Dl=0,Ol=null,kl=!1,Al=!1,jl=!1,Ml=0,Nl=0,Pl=0,Fl=0,Il=0,Ll=0,Rl=0,zl=null,Bl=null,Vl=!1,Hl=0,Ul=0,Wl=1/0,Gl=null,Kl=null,ql=0,Jl=null,Yl=null,Xl=0,Zl=0,Ql=null,$l=null,eu=0,tu=null;function nu(){return Cl&2&&El!==0?El&-El:N.T===null?Ze():Zu()}function ru(){if(Ll===0)if(!(El&536870912)||Si){var e=Ie;Ie<<=1,!(Ie&3932160)&&(Ie=262144),Ll=e}else Ll=536870912;return e=Ua.current,e!==null&&(e.flags|=32),Ll}function iu(e,t,n){(e===wl&&(Dl===2||Dl===9)||e.cancelPendingCommit!==null)&&(uu(e,0),su(e,El,Ll,!1)),We(e,n),(!(Cl&2)||e!==wl)&&(e===wl&&(!(Cl&2)&&(Fl|=n),Nl===4&&su(e,El,Ll,!1)),Uu(e))}function au(e,t,n){if(Cl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Be(e,t),a=r?_u(e,t):gu(e,t,!0),o=r;do{if(a===0){Al&&!r&&su(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!U(n)){a=gu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=zl;var l=c.current.memoizedState.isDehydrated;if(l&&(uu(c,s).flags|=256),s=gu(c,s,!1),s!==2){if(jl&&!l){c.errorRecoveryDisabledLanes|=o,Fl|=o,a=4;break a}o=Bl,Bl=a,o!==null&&(Bl===null?Bl=o:Bl.push.apply(Bl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){uu(e,0),su(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:su(r,t,Ll,!kl);break a;case 2:Bl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Hl+300-ye(),10<a)){if(su(r,t,Ll,!kl),ze(r,0,!0)!==0)break a;Xl=t,r.timeoutHandle=Nd(ou.bind(null,r,n,Bl,Gl,Vl,t,Ll,Fl,Rl,kl,o,`Throttled`,-0,0),a);break a}ou(r,n,Bl,Gl,Vl,t,Ll,Fl,Rl,kl,o,null,-0,0)}}break}while(1);Uu(e)}function ou(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Yt},gl(t,a,d);var m=(a&62914560)===a?Hl-ye():(a&4194048)===a?Ul-ye():0;if(m=Nee(d,m),m!==null){Xl=a,e.cancelPendingCommit=m(Cu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),su(e,a,o,!l);return}}Cu(e,t,a,n,r,i,o,s,c)}function U(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!fr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function su(e,t,n,r){t&=~Il,t&=~Fl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function cu(){return Cl&6?!0:(Wu(0,!1),!1)}function lu(){if(Tl!==null){if(Dl===0)var e=Tl.return;else e=Tl,Fi=Pi=null,vo(e),va=null,ya=0,e=Tl;for(;e!==null;)wc(e.alternate,e),e=e.return;Tl=null}}function uu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Cee(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Xl=0,lu(),wl=e,Tl=n=Zr(e.current,null),El=t,Dl=0,Ol=null,kl=!1,Al=Be(e,t),jl=!1,Rl=Ll=Il=Fl=Pl=Nl=0,Bl=zl=null,Vl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-je(r),a=1<<i;t|=e[i],r&=~a}return Ml=t,Vr(),n}function du(e,t){$a=null,N.H=Ts,t===ca||t===ua?(t=ga(),Dl=3):t===la?(t=ga(),Dl=4):Dl=t===Hs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ol=t,Tl===null&&(Nl=1,Is(e,ai(t,e.current)))}function fu(){var e=Ua.current;return e===null?!0:(El&4194048)===El?Wa===null:(El&62914560)===El||El&536870912?e===Wa:!1}function pu(){var e=N.H;return N.H=Ts,e===null?Ts:e}function mu(){var e=N.A;return N.A=Sl,e}function hu(){Nl=4,kl||(El&4194048)!==El&&Ua.current!==null||(Al=!0),!(Pl&134217727)&&!(Fl&134217727)||wl===null||su(wl,El,Ll,!1)}function gu(e,t,n){var r=Cl;Cl|=2;var i=pu(),a=mu();(wl!==e||El!==t)&&(Gl=null,uu(e,t)),t=!1;var o=Nl;a:do try{if(Dl!==0&&Tl!==null){var s=Tl,c=Ol;switch(Dl){case 8:lu(),o=6;break a;case 3:case 2:case 9:case 6:Ua.current===null&&(t=!0);var l=Dl;if(Dl=0,Ol=null,bu(e,s,c,l),n&&Al){o=0;break a}break;default:l=Dl,Dl=0,Ol=null,bu(e,s,c,l)}}yee(),o=Nl;break}catch(t){du(e,t)}while(1);return t&&e.shellSuspendCounter++,Fi=Pi=null,Cl=r,N.H=i,N.A=a,Tl===null&&(wl=null,El=0,Vr()),o}function yee(){for(;Tl!==null;)vu(Tl)}function _u(e,t){var n=Cl;Cl|=2;var r=pu(),a=mu();wl!==e||El!==t?(Gl=null,Wl=ye()+500,uu(e,t)):Al=Be(e,t);a:do try{if(Dl!==0&&Tl!==null){t=Tl;var o=Ol;b:switch(Dl){case 1:Dl=0,Ol=null,bu(e,t,o,1);break;case 2:case 9:if(fa(o)){Dl=0,Ol=null,yu(t);break}t=function(){Dl!==2&&Dl!==9||wl!==e||(Dl=7),Uu(e)},o.then(t,t);break a;case 3:Dl=7;break a;case 4:Dl=5;break a;case 7:fa(o)?(Dl=0,Ol=null,yu(t)):(Dl=0,Ol=null,bu(e,t,o,7));break;case 5:var s=null;switch(Tl.tag){case 26:s=Tl.memoizedState;case 5:case 27:var c=Tl;if(s?Sf(s):c.stateNode.complete){Dl=0,Ol=null;var l=c.sibling;if(l!==null)Tl=l;else{var u=c.return;u===null?Tl=null:(Tl=u,xu(u))}break b}}Dl=0,Ol=null,bu(e,t,o,5);break;case 6:Dl=0,Ol=null,bu(e,t,o,6);break;case 8:lu(),Nl=6;break a;default:throw Error(i(462))}}bee();break}catch(t){du(e,t)}while(1);return Fi=Pi=null,N.H=r,N.A=a,Cl=n,Tl===null?(wl=null,El=0,Vr(),Nl):0}function bee(){for(;Tl!==null&&!_e();)vu(Tl)}function vu(e){var t=_c(e.alternate,e,Ml);e.memoizedProps=e.pendingProps,t===null?xu(e):Tl=t}function yu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=nc(n,t,t.pendingProps,t.type,void 0,El);break;case 11:t=nc(n,t,t.pendingProps,t.type.render,t.ref,El);break;case 5:vo(t);default:wc(n,t),t=Tl=Qr(t,Ml),t=_c(n,t,Ml)}e.memoizedProps=e.pendingProps,t===null?xu(e):Tl=t}function bu(e,t,n,r){Fi=Pi=null,vo(t),va=null,ya=0;var i=t.return;try{if(Vs(e,i,t,n,El)){Nl=1,Is(e,ai(n,e.current)),Tl=null;return}}catch(t){if(i!==null)throw Tl=i,t;Nl=1,Is(e,ai(n,e.current)),Tl=null;return}t.flags&32768?(Si||r===1?e=!0:Al||El&536870912?e=!1:(kl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ua.current,r!==null&&r.tag===13&&(r.flags|=16384))),Su(t,e)):xu(t)}function xu(e){var t=e;do{if(t.flags&32768){Su(t,kl);return}e=t.return;var n=gee(t.alternate,t,Ml);if(n!==null){Tl=n;return}if(t=t.sibling,t!==null){Tl=t;return}Tl=t=e}while(t!==null);Nl===0&&(Nl=5)}function Su(e,t){do{var n=_ee(e.alternate,e);if(n!==null){n.flags&=32767,Tl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Tl=e;return}Tl=e=n}while(e!==null);Nl=6,Tl=null}function Cu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Ou();while(ql!==0);if(Cl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Br,Ge(e,n,o,s,c,l),e===wl&&(Tl=wl=null,El=0),Yl=t,Jl=e,Xl=n,Zl=o,Ql=a,$l=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Iu(Ce,function(){return ku(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=N.T,N.T=null,a=P.p,P.p=2,s=Cl,Cl|=4;try{Uc(e,t,n)}finally{Cl=s,P.p=a,N.T=r}}ql=1,wu(),Tu(),Eu()}}function wu(){if(ql===1){ql=0;var e=Jl,t=Yl,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Cl;Cl|=4;try{nl(t,e);var a=Dd,o=_r(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&gr(s.ownerDocument.documentElement,s)){if(c!==null&&vr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=hr(s,h),v=hr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Nf=!!Ed,Dd=Ed=null}finally{Cl=i,P.p=r,N.T=n}}e.current=t,ql=2}}function Tu(){if(ql===2){ql=0;var e=Jl,t=Yl,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=N.T,N.T=null;var r=P.p;P.p=2;var i=Cl;Cl|=4;try{Wc(e,t.alternate,t)}finally{Cl=i,P.p=r,N.T=n}}ql=3}}function Eu(){if(ql===4||ql===3){ql=0,ve();var e=Jl,t=Yl,n=Xl,r=$l;t.subtreeFlags&10256||t.flags&10256?ql=5:(ql=0,Yl=Jl=null,Du(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(Kl=null),Xe(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=N.T,i=P.p,P.p=2,N.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{N.T=t,P.p=i}}Xl&3&&Ou(),Uu(e),i=e.pendingLanes,n&261930&&i&42?e===tu?eu++:(eu=0,tu=e):eu=0,Wu(0,!1)}}function Du(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Xi(t)))}function Ou(){return wu(),Tu(),Eu(),ku()}function ku(){if(ql!==5)return!1;var e=Jl,t=Zl;Zl=0;var n=Xe(Xl),r=N.T,a=P.p;try{P.p=32>n?32:n,N.T=null,n=Ql,Ql=null;var o=Jl,s=Xl;if(ql=0,Yl=Jl=null,Xl=0,Cl&6)throw Error(i(331));var c=Cl;if(Cl|=4,yl(o.current),dl(o,o.current,s,n),Cl=c,Wu(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,o)}catch{}return!0}finally{P.p=a,N.T=r,Du(e,t)}}function Au(e,t,n){t=ai(n,t),t=Rs(e.stateNode,t,2),e=Aa(e,t,2),e!==null&&(We(e,2),Uu(e))}function ju(e,t,n){if(e.tag===3)Au(e,e,n);else for(;t!==null;){if(t.tag===3){Au(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Kl===null||!Kl.has(r))){e=ai(n,e),n=zs(2),r=Aa(t,n,2),r!==null&&(Bs(n,r,t,e),We(r,2),Uu(r));break}}t=t.return}}function Mu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new vee;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(jl=!0,i.add(n),e=Nu.bind(null,e,t,n),t.then(e,e))}function Nu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,wl===e&&(El&n)===n&&(Nl===4||Nl===3&&(El&62914560)===El&&300>ye()-Hl?!(Cl&2)&&uu(e,0):Il|=n,Rl===El&&(Rl=0)),Uu(e)}function Pu(e,t){t===0&&(t=He()),e=Wr(e,t),e!==null&&(We(e,t),Uu(e))}function xee(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Pu(e,n)}function Fu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Pu(e,n)}function Iu(e,t){return he(e,t)}var Lu=null,Ru=null,zu=!1,Bu=!1,Vu=!1,Hu=0;function Uu(e){e!==Ru&&e.next===null&&(Ru===null?Lu=Ru=e:Ru=Ru.next=e),Bu=!0,zu||(zu=!0,Xu())}function Wu(e,t){if(!Vu&&Bu){Vu=!0;do for(var n=!1,r=Lu;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Yu(r,a))}else a=El,a=ze(r,r===wl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(r,a)||(n=!0,Yu(r,a));r=r.next}while(n);Vu=!1}}function Gu(){Ku()}function Ku(){Bu=zu=!1;var e=0;Hu!==0&&See()&&(e=Hu);for(var t=ye(),n=null,r=Lu;r!==null;){var i=r.next,a=qu(r,t);a===0?(r.next=null,n===null?Lu=i:n.next=i,i===null&&(Ru=n)):(n=r,(e!==0||a&3)&&(Bu=!0)),r=i}ql!==0&&ql!==5||Wu(e,!1),Hu!==0&&(Hu=0)}function qu(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=wl,n=El,n=ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Dl===2||Dl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ge(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Be(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ge(r),Xe(n)){case 2:case 8:n=Se;break;case 32:n=Ce;break;case 268435456:n=Te;break;default:n=Ce}return r=Ju.bind(null,e),n=he(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ge(r),e.callbackPriority=2,e.callbackNode=null,2}function Ju(e,t){if(ql!==0&&ql!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ou()&&e.callbackNode!==n)return null;var r=El;return r=ze(e,e===wl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(au(e,r,t),qu(e,ye()),e.callbackNode!=null&&e.callbackNode===n?Ju.bind(null,e):null)}function Yu(e,t){if(Ou())return null;au(e,t,!0)}function Xu(){wee(function(){Cl&6?he(xe,Gu):Ku()})}function Zu(){if(Hu===0){var e=$i;e===0&&(e=Fe,Fe<<=1,!(Fe&261888)&&(Fe=256)),Hu=e}return Hu}function Qu(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:qt(``+e)}function $u(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function ed(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Qu((i[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?Qu(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new _n(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Hu!==0){var e=o?$u(i,o):new FormData(i);fs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?$u(i,o):new FormData(i),fs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var td=0;td<Fr.length;td++){var nd=Fr[td];Ir(nd.toLowerCase(),`on`+(nd[0].toUpperCase()+nd.slice(1)))}Ir(Ar,`onAnimationEnd`),Ir(jr,`onAnimationIteration`),Ir(Mr,`onAnimationStart`),Ir(`dblclick`,`onDoubleClick`),Ir(`focusin`,`onFocus`),Ir(`focusout`,`onBlur`),Ir(oee,`onTransitionRun`),Ir(see,`onTransitionStart`),Ir(cee,`onTransitionCancel`),Ir(Nr,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var rd=`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(` `),id=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(rd));function ad(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}}}}function od(e,t){var n=t[rt];n===void 0&&(n=t[rt]=new Set);var r=e+`__bubble`;n.has(r)||(ud(t,e,2,!1),n.add(r))}function sd(e,t,n){var r=0;t&&(r|=4),ud(n,e,r,t)}var cd=`_reactListening`+Math.random().toString(36).slice(2);function ld(e){if(!e[cd]){e[cd]=!0,mt.forEach(function(t){t!==`selectionchange`&&(id.has(t)||sd(t,!1,e),sd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[cd]||(t[cd]=!0,sd(`selectionchange`,!1,t))}}function ud(e,t,n,r){switch(zf(t)){case 2:var i=Iee;break;case 8:i=Pf;break;default:i=Ff}n=i.bind(null,t,n,e),i=void 0,!on||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=lt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}nn(function(){var r=a,i=Zt(n),s=[];a:{var c=Pr.get(e);if(c!==void 0){var l=_n,u=e;switch(e){case`keypress`:if(fn(n)===0)break a;case`keydown`:case`keyup`:l=eee;break;case`focusin`:u=`focus`,l=En;break;case`focusout`:u=`blur`,l=En;break;case`beforeblur`:case`afterblur`:l=En;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Tn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=In;break;case Ar:case jr:case Mr:l=Dn;break;case Nr:l=Ln;break;case`scroll`:case`scrollend`:l=yn;break;case`wheel`:l=Rn;break;case`copy`:case`cut`:case`paste`:l=On;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Fn;break;case`toggle`:case`beforetoggle`:l=zn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=rn(m,p),g!=null&&d.push(fd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Xt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?lt(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Fn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:dt(l),h=u==null?c:dt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,lt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=md,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&hd(s,c,l,d,!1),u!==null&&f!==null&&hd(s,f,u,d,!0)}}a:{if(c=r?dt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=rr;else if(Zn(c))if(ir)v=dr;else{v=iee;var y=ur}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Wt(r.elementType)&&(v=rr):v=H;if(v&&=v(e,r)){Qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&It(c,`number`,c.value)}switch(y=r?dt(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(br=y,xr=r,Sr=null);break;case`focusout`:Sr=xr=br=null;break;case`mousedown`:Cr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Cr=!1,wr(s,n,i);break;case`selectionchange`:if(yr)break;case`keydown`:case`keyup`:wr(s,n,i)}var b;if(Vn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Jn?Kn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Un&&n.locale!==`ko`&&(Jn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Jn&&(b=dn()):(cn=i,ln=`value`in cn?cn.value:cn.textContent,Jn=!0)),y=pd(r,x),0<y.length&&(x=new kn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=qn(n),b!==null&&(x.data=b)))),(b=tee?nee(e,n):Yn(e,n))&&(x=pd(r,`onBeforeInput`),0<x.length&&(y=new kn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),ed(s,e,r,n,i)}ad(s,t)})}function fd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function pd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=rn(e,n),i!=null&&r.unshift(fd(e,i,a)),i=rn(e,t),i!=null&&r.push(fd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function md(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function hd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=rn(n,a),l!=null&&o.unshift(fd(n,l,c))):i||(l=rn(n,a),l!=null&&o.push(fd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var gd=/\r\n?/g,_d=/\u0000|\uFFFD/g;function vd(e){return(typeof e==`string`?e:``+e).replace(gd,`
10
- `).replace(_d,``)}function yd(e,t){return t=vd(t),vd(e)===t}function bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Bt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ut(e,r,o);break;case`data`:if(t!==`object`){Ct(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&bd(e,t,`name`,a.name,a,null),bd(e,t,`formEncType`,a.formEncType,a,null),bd(e,t,`formMethod`,a.formMethod,a,null),bd(e,t,`formTarget`,a.formTarget,a,null)):(bd(e,t,`encType`,a.encType,a,null),bd(e,t,`method`,a.method,a,null),bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&od(`scroll`,e);break;case`onScrollEnd`:r!=null&&od(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:od(`beforetoggle`,e),od(`toggle`,e),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Gt.get(n)||n,St(e,n,r))}}function xd(e,t,n,r,a,o){switch(n){case`style`:Ut(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Bt(e,``+r);break;case`onScroll`:r!=null&&od(`scroll`,e);break;case`onScrollEnd`:r!=null&&od(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[tt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(e,n,r)}}}function Sd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:od(`error`,e),od(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:bd(e,t,o,s,n,null)}}a&&bd(e,t,`srcSet`,n.srcSet,n,null),r&&bd(e,t,`src`,n.src,n,null);return;case`input`:od(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:bd(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in od(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Lt(e,!!r,n,!0):Lt(e,!!r,t,!1);return;case`textarea`:for(s in od(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:bd(e,t,s,c,n,null)}zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:bd(e,t,l,r,n,null)}return;case`dialog`:od(`beforetoggle`,e),od(`toggle`,e),od(`cancel`,e),od(`close`,e);break;case`iframe`:case`object`:od(`load`,e);break;case`video`:case`audio`:for(r=0;r<rd.length;r++)od(rd[r],e);break;case`image`:od(`error`,e),od(`load`,e);break;case`details`:od(`toggle`,e);break;case`embed`:case`source`:case`link`:od(`error`,e),od(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:bd(e,t,u,r,n,null)}return;default:if(Wt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&xd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&bd(e,t,c,r,n,null))}function Cd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&bd(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Lt(e,!!n,n?[]:``,!1):Lt(e,!!n,t,!0)):Lt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&bd(e,t,s,a,r,o)}Rt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:bd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:bd(e,t,u,p,r,m)}return;default:if(Wt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&xd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||xd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||bd(e,t,f,p,r,m)}function wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Td(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Ed=null,Dd=null;function Od(e){return e.nodeType===9?e:e.ownerDocument}function kd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Ad(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function jd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Md=null;function See(){var e=window.event;return e&&e.type===`popstate`?e===Md?!1:(Md=e,!0):(Md=null,!1)}var Nd=typeof setTimeout==`function`?setTimeout:void 0,Cee=typeof clearTimeout==`function`?clearTimeout:void 0,Pd=typeof Promise==`function`?Promise:void 0,wee=typeof queueMicrotask==`function`?queueMicrotask:Pd===void 0?Nd:function(e){return Pd.resolve(null).then(e).catch(Tee)};function Tee(e){setTimeout(function(){throw e})}function Fd(e){return e===`head`}function Id(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Yd(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Yd(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Yd(e.ownerDocument.body);n=i}while(n);ip(t)}function Ld(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function Rd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:Rd(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function zd(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[st])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Wd(e.nextSibling),e===null)break}return null}function Bd(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Wd(e.nextSibling),e===null))return null;return e}function Vd(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Wd(e.nextSibling),e===null))return null;return e}function Hd(e){return e.data===`$?`||e.data===`$~`}function Ud(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Eee(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Wd(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Gd=null;function Kd(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Wd(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function qd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Jd(e,t,n){switch(t=Od(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Yd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var Xd=new Map,Zd=new Set;function Qd(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var $d=P.d;P.d={f:ef,r:Dee,D:Oee,C:rf,L:af,m:of,X:kee,S:sf,M:cf};function ef(){var e=$d.f(),t=cu();return e||t}function Dee(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?ms(t):$d.r(e)}var tf=typeof document>`u`?null:document;function nf(e,t,n){var r=tf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Zd.has(i)||(Zd.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Sd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Oee(e){$d.D(e),nf(`dns-prefetch`,e,null)}function rf(e,t){$d.C(e,t),nf(`preconnect`,e,t)}function af(e,t,n){$d.L(e,t,n);var r=tf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=uf(e);break;case`script`:a=pf(e)}Xd.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Xd.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(df(a))||t===`script`&&r.querySelector(mf(a))||(t=r.createElement(`link`),Sd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function of(e,t){$d.m(e,t);var n=tf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=pf(e)}if(!Xd.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Xd.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(mf(a)))return}r=n.createElement(`link`),Sd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function sf(e,t,n){$d.S(e,t,n);var r=tf;if(r&&e){var i=ft(r).hoistableStyles,a=uf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(df(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Xd.get(a))&&_f(e,n);var c=o=r.createElement(`link`);pt(c),Sd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kee(e,t){$d.X(e,t);var n=tf;if(n&&e){var r=ft(n).hoistableScripts,i=pf(e),a=r.get(i);a||(a=n.querySelector(mf(i)),a||(e=f({src:e,async:!0},t),(t=Xd.get(i))&&vf(e,t),a=n.createElement(`script`),pt(a),Sd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function cf(e,t){$d.M(e,t);var n=tf;if(n&&e){var r=ft(n).hoistableScripts,i=pf(e),a=r.get(i);a||(a=n.querySelector(mf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Xd.get(i))&&vf(e,t),a=n.createElement(`script`),pt(a),Sd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function lf(e,t,n,r){var a=(a=V.current)?Qd(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=uf(n.href),n=ft(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=uf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(df(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Xd.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xd.set(e,n),o||Aee(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=pf(n),n=ft(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function uf(e){return`href="`+Mt(e)+`"`}function df(e){return`link[rel="stylesheet"][`+e+`]`}function ff(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Aee(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Sd(t,`link`,n),pt(t),e.head.appendChild(t))}function pf(e){return`[src="`+Mt(e)+`"]`}function mf(e){return`script[async]`+e}function hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Sd(r,`style`,a),gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=uf(n.href);var o=e.querySelector(df(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=ff(n),(a=Xd.get(a))&&_f(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Sd(o,`link`,r),t.state.loading|=4,gf(o,n.precedence,e),t.instance=o;case`script`:return o=pf(n.src),(a=e.querySelector(mf(o)))?(t.instance=a,pt(a),a):(r=n,(a=Xd.get(o))&&(r=f({},n),vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),Sd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,gf(r,n.precedence,e));return t.instance}function gf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function _f(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var yf=null;function bf(e,t,n){if(yf===null){var r=new Map,i=yf=new Map;i.set(n,r)}else i=yf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[st]||a[et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function jee(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Sf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Mee(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=uf(r.href),a=t.querySelector(df(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Cf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=ff(r),(i=Xd.get(i))&&_f(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Sd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Cf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var W=0;function Nee(e,t){return e.stylesheets&&e.count===0&&Tf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Tf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&W===0&&(W=62500*Td());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Tf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>W?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Cf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wf=null;function Tf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wf=new Map,t.forEach(Pee,e),wf=null,Cf.call(e))}function Pee(e,t){if(!(t.state.loading&4)){var n=wf.get(e);if(n)var r=n.get(null);else{n=new Map,wf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Cf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Ef={$$typeof:b,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function Df(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Of(e,t,n,r,i,a,o,s,c,l,u,d){return e=new Df(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Yr(3,null,null,t),e.current=a,a.stateNode=e,t=Yi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Da(a),e}function Fee(e){return e?(e=qr,e):qr}function kf(e,t,n,r,i,a){i=Fee(i),r.context===null?r.context=i:r.pendingContext=i,r=ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Aa(e,r,t),n!==null&&(iu(n,e,t),ja(n,e,t))}function Af(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function G(e,t){Af(e,t),(e=e.alternate)&&Af(e,t)}function jf(e){if(e.tag===13||e.tag===31){var t=Wr(e,67108864);t!==null&&iu(t,e,67108864),G(e,67108864)}}function Mf(e){if(e.tag===13||e.tag===31){var t=nu();t=Ye(t);var n=Wr(e,t);n!==null&&iu(n,e,t),G(e,t)}}var Nf=!0;function Iee(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,Ff(e,t,n,r)}finally{P.p=a,N.T=i}}function Pf(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,Ff(e,t,n,r)}finally{P.p=a,N.T=i}}function Ff(e,t,n,r){if(Nf){var i=If(r);if(i===null)dd(e,t,r,Lf,n),Jf(e,r);else if(Xf(i,e,t,n,r))r.stopPropagation();else if(Jf(e,r),t&4&&-1<qf.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}Uu(a),!(Cl&6)&&(Wl=ye()+500,Wu(0,!1))}}break;case 31:case 13:s=Wr(a,2),s!==null&&iu(s,a,2),cu(),G(a,2)}if(a=If(r),a===null&&dd(e,t,r,Lf,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else dd(e,t,r,null,n)}}function If(e){return e=Zt(e),Rf(e)}var Lf=null;function Rf(e){if(Lf=null,e=lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Lf=e,null}function zf(e){switch(e){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(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te:return 268435456;default:return 32}default:return 32}}var Bf=!1,Vf=null,Hf=null,Uf=null,Wf=new Map,Gf=new Map,Kf=[],qf=`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 Jf(e,t){switch(e){case`focusin`:case`focusout`:Vf=null;break;case`dragenter`:case`dragleave`:Hf=null;break;case`mouseover`:case`mouseout`:Uf=null;break;case`pointerover`:case`pointerout`:Wf.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Gf.delete(t.pointerId)}}function Yf(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ut(t),t!==null&&jf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Xf(e,t,n,r,i){switch(t){case`focusin`:return Vf=Yf(Vf,e,t,n,r,i),!0;case`dragenter`:return Hf=Yf(Hf,e,t,n,r,i),!0;case`mouseover`:return Uf=Yf(Uf,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Wf.set(a,Yf(Wf.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Gf.set(a,Yf(Gf.get(a)||null,e,t,n,r,i)),!0}return!1}function Zf(e){var t=lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){Mf(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){Mf(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=If(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ut(n),t!==null&&jf(t),e.blockedOn=n,!1;t.shift()}return!0}function $f(e,t,n){Qf(e)&&n.delete(t)}function ep(){Bf=!1,Vf!==null&&Qf(Vf)&&(Vf=null),Hf!==null&&Qf(Hf)&&(Hf=null),Uf!==null&&Qf(Uf)&&(Uf=null),Wf.forEach($f),Gf.forEach($f)}function tp(e,n){e.blockedOn===n&&(e.blockedOn=null,Bf||(Bf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ep)))}var np=null;function rp(e){np!==e&&(np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){np===e&&(np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Rf(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,fs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function ip(e){function t(t){return tp(t,e)}Vf!==null&&tp(Vf,e),Hf!==null&&tp(Hf,e),Uf!==null&&tp(Uf,e),Wf.forEach(t),Gf.forEach(t);for(var n=0;n<Kf.length;n++){var r=Kf[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Kf.length&&(n=Kf[0],n.blockedOn===null);)Zf(n),n.blockedOn===null&&Kf.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[tt]||null;if(typeof a==`function`)o||rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(Rf(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),rp(n)}}}function ap(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function op(e){this._internalRoot=e}sp.prototype.render=op.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;kf(n,nu(),e,t,null,null)},sp.prototype.unmount=op.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kf(e.current,2,null,e,null,null),cu(),t[nt]=null}};function sp(e){this._internalRoot=e}sp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kf.length&&t!==0&&t<Kf[n].priority;n++);Kf.splice(n,0,e),n===0&&Zf(e)}};var cp=n.version;if(cp!==`19.2.7`)throw Error(i(527,cp,`19.2.7`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Lee={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var lp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lp.isDisabled&&lp.supportsFiber)try{Oe=lp.inject(Lee),ke=lp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ps,s=mee,c=Fs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Of(e,1,!1,null,null,n,r,null,o,s,c,ap),e[nt]=t.current,ld(e),new op(t)}})),ur=a(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=lr()})),iee=ur(),H=r(Jt()),dr=r(Je());function aee(){dr.default.setDefaultLevel(`silent`),localStorage.getItem(`ENABLE_DEBUG_LOGS`)&&dr.default.setLevel(`debug`),window.zuploEnableSupportLogs=()=>{localStorage.setItem(`ENABLE_DEBUG_LOGS`,`1`),dr.default.setDefaultLevel(`debug`),dr.default.info("Support logging is enabled. To disable run `window.zuploDisableSupportLogs()`")},window.zuploDisableSupportLogs=()=>{localStorage.removeItem(`ENABLE_DEBUG_LOGS`),dr.default.info(`Support logging is disabled.`),dr.default.setLevel(`silent`)}}function fr(e){return new Worker(`/static/editor.worker-Pe6d6EA8.js`,{name:e?.name})}function pr(e){return new Worker(`/static/css.worker-lKFT03HI.js`,{name:e?.name})}function mr(e){return new Worker(`/static/html.worker-22WyiEnc.js`,{name:e?.name})}function hr(e){return new Worker(`/static/json.worker-C4s5qRoG.js`,{name:e?.name})}function gr(e){return new Worker(`/static/ts.worker-DFduhuek.js`,{name:e?.name})}function _r(){self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new hr;case`css`:case`scss`:case`less`:return new pr;case`html`:case`handlebars`:case`razor`:return new mr;case`typescript`:case`javascript`:return new gr;default:return new fr}}}}var vr=e=>typeof e==`string`,yr=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},br=e=>e==null?``:String(e),xr=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Sr=/###/g,Cr=e=>e&&e.includes(`###`)?e.replace(Sr,`.`):e,wr=e=>!e||vr(e),Tr=(e,t,n)=>{let r=vr(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(wr(e))return{};let t=Cr(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return wr(e)?{}:{obj:e,k:Cr(r[i])}},Er=(e,t,n)=>{let{obj:r,k:i}=Tr(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Tr(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Tr(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Dr=(e,t,n,r)=>{let{obj:i,k:a}=Tr(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Or=(e,t)=>{let{obj:n,k:r}=Tr(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},kr=(e,t,n)=>{let r=Or(e,n);return r===void 0?Or(t,n):r},Ar=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?vr(e[r])||e[r]instanceof String||vr(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Ar(e[r],t[r],n):e[r]=t[r]);return e},jr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Mr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},oee=e=>vr(e)?e.replace(/[&<>"'\/]/g,e=>Mr[e]):e,see=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},cee=[` `,`,`,`?`,`!`,`;`],Nr=new see(20),Pr=(e,t,n)=>{t||=``,n||=``;let r=cee.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Nr.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Fr=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Ir=e=>e?.replace(/_/g,`-`),Lr={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Rr=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Lr,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>vr(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),vr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},zr=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},Br=class extends zr{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):vr(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Or(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!vr(n)?s:Fr(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Er(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(vr(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Or(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Ar(s,n,i):s={...s,...n},Er(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Vr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Hr=Symbol(`i18next/PATH_KEY`);function Ur(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Hr?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Wr(e,t){let{[Hr]:n}=e(Ur()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Gr=e=>!vr(e)&&typeof e!=`boolean`&&typeof e!=`number`,Kr=class e extends zr{constructor(e,t={}){super(),xr([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Rr.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Gr(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Pr(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:vr(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:vr(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Wr(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Wr(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!vr(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Gr(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(vr(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:Gr(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&vr(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=vr(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!vr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=vr(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Vr.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return vr(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Wr(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!vr(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(vr(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!vr(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},qr=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Rr.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=Ir(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Ir(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(vr(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),vr(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let i=t===void 0||t===!1||vr(t),a=t===void 0&&typeof this.options.fallbackLng==`function`,o=vr(e)&&i&&!a,s=null;if(o){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,s=`${e.length}:${e}|${n}`}if(s!==null){let e=this.resolveHierarchyCache[s];if(e!==void 0)return e.slice()}let c=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),l=[],u=e=>{e&&(this.isSupportedCode(e)?l.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return vr(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&u(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&u(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&u(this.getLanguagePartFromCode(e))):vr(e)&&u(this.formatLanguageCode(e)),c.forEach(e=>{l.includes(e)||u(this.formatLanguageCode(e))}),s===null?l:(this.resolveHierarchyCache[s]=l,l.slice())}},Jr={zero:0,one:1,two:2,few:3,many:4,other:5},Yr={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Xr=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Rr.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Ir(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Yr;if(!e.match(/-|_/))return Yr;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Jr[e]-Jr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Zr=(e,t,n,r=`.`,i=!0)=>{let a=kr(e,t,n);return!a&&i&&vr(n)&&(a=Fr(e,n,r),a===void 0&&(a=Fr(t,n,r))),a},Qr=e=>e.replace(/\$/g,`$$$$`),$r=class{constructor(e={}){this.logger=Rr.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?oee:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?jr(i):a||`{{`,this.suffix=o?jr(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?jr(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?jr(l):``,this.nestingPrefix=d?jr(d):f||jr(`$t(`),this.nestingSuffix=p?jr(p):m||jr(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Zr(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Zr(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=vr(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else !vr(a)&&!this.useRawValueToEscape&&(a=br(a));let s=t.safeValue(a);if(e=e.replace(i[0],Qr(s)),u?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${jr(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!vr(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!vr(i))return i;vr(i)||(i=br(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],Qr(br(i))),this.regexp.lastIndex=0}return e}},ei=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},ti=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Ir(r),i),t[o]=s),s(n)}},ni=e=>(t,n,r)=>e(Ir(n),r)(t),ri=class{constructor(e={}){this.logger=Rr.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?ti:ni;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ti(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ei(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},ii=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},ai=class extends zr{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Rr.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Dr(n.loaded,[i],a),ii(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();vr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),vr(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},oi=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),vr(e[1])&&(t.defaultValue=e[1]),vr(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),si=e=>(vr(e.ns)&&(e.ns=[e.ns]),vr(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),vr(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),ci=()=>{},li=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ui=class e extends zr{constructor(e={},t){if(super(),this.options=si(e),this.services={},this.logger=Rr,this.modules={external:[]},li(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(vr(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=oi();this.options={...n,...this.options,...si(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Rr.init(r(this.modules.logger),this.options):Rr.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:ri;let t=new qr(this.options);this.store=new Br(this.options.resources,this.options);let n=this.services;n.logger=Rr,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Xr(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new $r(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new ai(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new Kr(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=ci,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=yr(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=ci){let n=t,r=vr(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=yr();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=ci,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Vr.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=yr();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=vr(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(vr(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Wr(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Wr(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Wr(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return vr(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=yr();return this.options.ns?(vr(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=yr();vr(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new qr(oi());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=ci){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Br(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...oi().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new $r(n)}return a.translator=new Kr(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();ui.createInstance,ui.dir,ui.init,ui.loadResources,ui.reloadResources,ui.use,ui.changeLanguage,ui.getFixedT,ui.t,ui.exists,ui.setDefaultNamespace,ui.hasLoadedNamespace,ui.loadNamespaces,ui.loadLanguages;var di={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},fi=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function pi(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(di[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(fi),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim())if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var mi=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,hi=/<\/?([^\s]+?)[/\s>]/,gi=/^\s*$/,_i=/^(script|style)$/i,vi=`\0`,yi=Object.create(null);function bi(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(vi).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(vi).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(vi)>-1&&(e.attrs[t]=n.split(vi).join(`<`))}e.children.length&&bi(e.children)})}function xi(e,t){let n=t&&t.components||yi,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;mi.lastIndex=0;let o;for(;o=mi.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(hi);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=vi,a=o.index+1,mi.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=mi.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=pi(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=pi(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&_i.test(s.name)){t=!0,d||=e.toLowerCase();let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);gi.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&bi(a),a}function Si(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`&quot;`)+`"`);return t.length?` `+t.join(` `):``}function Ci(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?Si(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(Ci,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function wi(e){return e.reduce(function(e,t){return e+Ci(``,t)},``)}var Ti={parse:xi,stringify:wi},Ei=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);Ni(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},Di={},Oi=(e,t,n,r)=>{Ni(n)&&Di[n]||(Ni(n)&&(Di[n]=new Date),Ei(e,t,n,r))},ki=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Ai=(e,t,n)=>{e.loadNamespaces(t,ki(e,n))},ji=(e,t,n,r)=>{if(Ni(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ai(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,ki(e,r))},Mi=(e,t,n={})=>!t.languages||!t.languages.length?(Oi(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),Ni=e=>typeof e==`string`,Pi=e=>typeof e==`object`&&!!e,Fi=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ii={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},Li=e=>Ii[e],Ri=e=>e.replace(Fi,Li),zi={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:Ri,transDefaultProps:void 0},Bi=(e={})=>{zi={...zi,...e}},Vi=()=>zi,Hi,Ui=e=>{Hi=e},Wi=()=>Hi,Gi=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Ki=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?qi(t):t},lee=e=>qi(e).every(H.isValidElement),qi=e=>Array.isArray(e)?e:[e],Ji=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Yi=e=>{let t={};if(!e)return t;let n=e=>{qi(e).forEach(e=>{Ni(e)||(Gi(e)?n(Ki(e)):Pi(e)&&!(0,H.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},Xi=(e,t,n,r)=>{if(!e)return``;let i=``,a=qi(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(Ni(e)){i+=`${e}`;return}if((0,H.isValidElement)(e)){let{props:s,type:c}=e,l=Object.keys(s).length,u=o.indexOf(c)>-1,d=s.children;if(!d&&u&&!l){i+=`<${c}/>`;return}if(!d&&(!u||l)||s.i18nIsDynamicList){i+=`<${a}></${a}>`;return}if(u&&l<=1){let e=Ni(d)?d:Xi(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Xi(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){Ei(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(Pi(e)){let{format:t,...a}=e,o=Object.keys(a);if(o.length===1){let e=t?`${o[0]}, ${t}`:o[0];i+=`{{${e}}}`;return}Ei(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}Ei(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},Zi=(e,t,n,r,i,a,o)=>{if(n===``)return[];let s=i.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(s.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!c&&!o)return[n];let l=t??{},u=e=>{qi(e).forEach(e=>{Ni(e)||(Gi(e)?u(Ki(e)):Pi(e)&&!(0,H.isValidElement)(e)&&Object.assign(l,e))})};u(e);let d=Object.keys(l),f=Ti.parse(`<0>${n}</0>`,{allowedTags:e=>/^\d+$/.test(e)||s.indexOf(e)>-1||d.indexOf(e)>-1}),p={...l,...a},m=(e,t,n)=>{let r=Ki(e),i=g(r,t.children,n);return lee(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},h=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,H.cloneElement)(e,{key:r},i?void 0:t))):n.push(...H.Children.map([e],e=>{if(e.type===H.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,H.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,H.cloneElement)(e,n,i?null:t)}))},g=(e,n,a)=>{let l=qi(e),u=qi(n),d={};return u.reduce((e,n,u)=>{let f=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,p,r.language);if(n.type===`tag`){let _=l[parseInt(n.name,10)];!_&&t&&(_=t[n.name]),a.length===1&&!_&&(_=a[0][n.name]),_||={};let v={...n.attrs};o&&Object.keys(v).forEach(e=>{let t=v[e];Ni(t)&&(v[e]=Ri(t))});let y=Object.keys(v).length===0?_:Ji({props:v},_),b=(0,H.isValidElement)(y),x=b&&Gi(n,!0)&&!n.voidElement,S=c&&Pi(y)&&y.dummy&&!b,C=Pi(t)&&Object.hasOwnProperty.call(t,n.name);if(Ni(y)){let t=r.services.interpolator.interpolate(y,p,r.language);e.push(t)}else if(Gi(y)||x)h(y,m(y,n,a),e,u);else if(S)h(y,g(l,n.children,a),e,u);else if(Number.isNaN(parseFloat(n.name)))if(C)h(y,m(y,n,a),e,u,n.voidElement);else if(i.transSupportBasicHtmlNodes&&s.indexOf(n.name)>-1)if(n.voidElement)e.push((0,H.createElement)(n.name,{key:`${n.name}-${u}`}));else{let t=d[n.name]||0;d[n.name]=t+1;let r,i=0;for(let e=0;e<l.length;e+=1){let a=l[e];if((0,H.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=g(r?qi(Ki(r)):l,n.children,a);e.push((0,H.createElement)(n.name,{key:`${n.name}-${u}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=g(l,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(Pi(y)&&!b){let t=n.children[0]?f:null;t&&e.push(t)}else h(y,f,e,u,n.children.length!==1||!f)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:Vi().unescape,s=o?a(r.services.interpolator.interpolate(n.content,p,r.language)):r.services.interpolator.interpolate(n.content,p,r.language);t?e.push((0,H.createElement)(t,{key:`${n.name}-${u}`},s)):e.push(s)}return e},[])};return Ki(g([{dummy:!0,children:e||[]}],f,qi(e||[]))[0])},Qi=(e,t,n)=>{let r=e.key||t,i=(0,H.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,H.createElement)(H.Fragment,null,i)}return(0,H.createElement)(a,{key:r})},$i=(e,t)=>e.map((e,n)=>Qi(e,n,t)),ea=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Qi(e[r],r,t)})}),n},ta=(e,t,n,r)=>e?Array.isArray(e)?$i(e,t):Pi(e)?ea(e,t):(Oi(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,na=e=>!Pi(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function uee({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let m=u||Wi();if(!m)return Oi(m,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:r}),e;let h=d||m.t.bind(m)||(e=>e),g={...Vi(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=Ni(_)?[_]:_||[`translation`];let{transDefaultProps:v}=g,y=v?.tOptions?{...v.tOptions,...a}:a,b=f??v?.shouldUnescape,x=v?.values?{...v.values,...o}:o,S=v?.components?{...v.components,...c}:c,C=Xi(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?Wr(r):r),{hashTransKey:T}=g,E=r||(T?T(C||w):C||w);o=m.options?.interpolation?.defaultVariables?x&&Object.keys(x).length>0?{...x,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:x;let D=Yi(e);D&&typeof D.count==`number`&&t===void 0&&(t=D.count);let O=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?y.interpolation:{interpolation:{...y.interpolation,prefix:`#$?`,suffix:`?$#`}},k={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},A=E?h(E,k):w;A===E&&w&&(A=w);let j=ta(S,A,m,r),M=j||e,N=null;na(j)&&(N=j,M=e);let P=Zi(M,N,A,m,g,k,b),F=n??g.defaultTransParent;return F?(0,H.createElement)(F,p,P):P}var ra={type:`3rdParty`,init(e){Bi(e.options.react),Ui(e)}},ia=(0,H.createContext)(),aa=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}};function oa({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let{i18n:m,defaultNS:h}=(0,H.useContext)(ia)||{},g=u||m||Wi(),_=d||g?.t.bind(g);return uee({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||_?.ns||h||g?.options?.defaultNS,i18n:g,t:d,shouldUnescape:f,...p})}var sa=a((e=>{var t=Jt();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ca=a(((e,t)=>{t.exports=sa()})),la=ca(),ua={t:(e,t)=>{if(Ni(t))return t;if(Pi(t)&&Ni(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},da=()=>()=>{},fa=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,H.useContext)(ia)||{},a=n||r||Wi();a&&!a.reportNamespaces&&(a.reportNamespaces=new aa),a||Oi(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let o=(0,H.useMemo)(()=>({...Vi(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=Ni(l)?[l]:l||[`translation`],d=(0,H.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,H.useRef)(0),p=(0,H.useCallback)(e=>{if(!a)return da;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,H.useRef)(),h=(0,H.useCallback)(()=>{if(!a)return ua;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>Mi(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c,{scopeNs:d}),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,H.useState)(0),{t:v,ready:y}=(0,la.useSyncExternalStore)(p,h,h);(0,H.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?ji(a,t.lng,d,e):Ai(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,H.useRef)(null),S=(0,H.useRef)(),C=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,w=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,`__original`,{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},T=(0,H.useMemo)(()=>{let e=b,t=e&&C(e),n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=w(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(Oi(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y){let e=!1;try{e=!1}catch{}throw e&&Oi(a,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?ji(a,t.lng,d,n):Ai(a,d,n)})}return T},pa=[{code:`en`,name:`English`},{code:`de`,name:`Deutsch`}],ma={de:()=>vn(()=>import(`./de-CA--xTvM.js`),[])},ha=`zuplo-language`,ga=e=>pa.some(({code:t})=>t===e),_a={lng:`en`,fallbackLng:`en`,supportedLngs:pa.map(({code:e})=>e),resources:{en:{translation:{}}},initAsync:!1,keySeparator:!1,nsSeparator:!1,returnEmptyString:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1,transWrapTextNodes:`span`}},va=()=>{try{let e=localStorage.getItem(ha);return ga(e)?e:`en`}catch{return`en`}},ya=ui.createInstance();ya.on(`languageChanged`,e=>{typeof document<`u`&&(document.documentElement.lang=e)}),ya.use(ra).init(_a);var ba=`en`,xa=async e=>{if(ba=e,e!==`en`&&!ya.hasResourceBundle(e,`translation`)){let{default:t}=await ma[e]();ya.addResourceBundle(e,`translation`,t)}ba===e&&await ya.changeLanguage(e)},Sa=e=>xa(e).catch(()=>{}),Ca=va();Ca!==`en`&&Sa(Ca);var wa=e=>{throw TypeError(e)},Ta=(e,t,n)=>t.has(e)||wa(`Cannot `+n),Ea=(e,t,n)=>(Ta(e,t,`read from private field`),n?n.call(e):t.get(e)),Da=(e,t,n)=>t.has(e)?wa(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Oa=`popstate`;function ka(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return Pa(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:Fa(t)}return La(t,n,null,e)}function Aa(e,t){if(e===!1||e==null)throw Error(t)}function ja(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Ma(){return Math.random().toString(36).substring(2,10)}function Na(e,t){return{usr:e.state,key:e.key,idx:t}}function Pa(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ia(t):t,state:n,key:t&&t.key||r||Ma()}}function Fa({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ia(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function La(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Pa(h.location,e,t);n&&n(r,e),l=u()+1;let d=Na(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Pa(h.location,e,t);n&&n(r,e),l=u();let i=Na(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ra(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Oa,d),c=e,()=>{i.removeEventListener(Oa,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ra(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),Aa(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Fa(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var za,Ba=class{constructor(e){if(Da(this,za,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Ea(this,za).has(e))return Ea(this,za).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){Ea(this,za).set(e,t)}};za=new WeakMap;var Va=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function Ha(e){return Va.has(e)}var Ua=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function Wa(e){return Ua.has(e)}function Ga(e){return e.index===!0}function Ka(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Aa(e.index!==!0||!e.children,`Cannot specify children on an index route`),Aa(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),Ga(e)){let n={...e,...t(e),id:s};return r[s]=n,n}else{let n={...e,...t(e),id:s,children:void 0};return r[s]=n,e.children&&(n.children=Ka(e.children,t,o,r,i)),n}})}function qa(e,t,n=`/`){return Ja(e,t,n,!1)}function Ja(e,t,n,r){let i=mo((typeof t==`string`?Ia(t):t).pathname||`/`,n);if(i==null)return null;let a=Xa(e);Qa(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=po(i);o=co(a[e],t,r)}return o}function Ya(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Xa(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Aa(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=So([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Aa(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Xa(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:oo(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Za(e.path))a(e,t,!0,n)}),t}function Za(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Za(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Qa(e){e.sort((e,t)=>e.score===t.score?so(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var $a=/^:[\w-]+$/,eo=3,to=2,no=1,ro=10,io=-2,ao=e=>e===`*`;function oo(e,t){let n=e.split(`/`),r=n.length;return n.some(ao)&&(r+=io),t&&(r+=to),n.filter(e=>!ao(e)).reduce((e,t)=>e+($a.test(t)?eo:t===``?no:ro),r)}function so(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function co(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=uo({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=uo({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:So([a,u.pathname]),pathnameBase:Co(So([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=So([a,u.pathnameBase]))}return o}function lo(e,t={}){let n=e;n.endsWith(`*`)&&n!==`*`&&!n.endsWith(`/*`)&&(ja(!1,`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,`/*`)}".`),n=n.replace(/\*$/,`/*`));let r=n.startsWith(`/`)?`/`:``,i=e=>e==null?``:typeof e==`string`?e:String(e);return r+n.split(/\/+/).map((e,n,r)=>{if(n===r.length-1&&e===`*`)return i(t[`*`]);let a=e.match(/^:([\w-]+)(\??)$/);if(a){let[,e,n]=a,r=t[e];return Aa(n===`?`||r!=null,`Missing ":${e}" param`),encodeURIComponent(i(r))}return e.replace(/\?$/g,``)}).filter(e=>!!e).join(`/`)}function uo(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fo(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function fo(e,t=!1,n=!0){ja(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function po(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return ja(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function mo(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ho({basename:e,pathname:t}){return t===`/`?e:So([e,t])}function go(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ia(e):e;return{pathname:n?n.startsWith(`/`)?n:_o(n,t):t,search:wo(r),hash:To(i)}}function _o(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function vo(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function yo(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function bo(e){let t=yo(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function xo(e,t,n,r=!1){let i;typeof e==`string`?i=Ia(e):(i={...e},Aa(!i.pathname||!i.pathname.includes(`?`),vo(`?`,`pathname`,`search`,i)),Aa(!i.pathname||!i.pathname.includes(`#`),vo(`#`,`pathname`,`hash`,i)),Aa(!i.search||!i.search.includes(`#`),vo(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=go(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var So=e=>e.join(`/`).replace(/\/\/+/g,`/`),Co=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),wo=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,To=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Eo=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Do(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Oo=[`POST`,`PUT`,`PATCH`,`DELETE`],ko=new Set(Oo),Ao=[`GET`,...Oo],jo=new Set(Ao),Mo=new Set([301,302,303,307,308]),No=new Set([307,308]),Po={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Fo={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Io={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},dee=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lo=e=>dee.test(e),Ro=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),zo=`remix-router-transitions`,Bo=Symbol(`ResetLoaderData`);function Vo(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Aa(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Ro,a={},o=Ka(e.routes,i,void 0,a),s,c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||is,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=e.hydrationData!=null,_=qa(o,e.history.location,c),v=!1,y=null,b;if(_==null&&!e.patchRoutesOnNavigation){let t=ws(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Cs(o);b=!0,_=n,y={[r.id]:t}}else if(_&&!e.hydrationData&&ze(_,o,e.history.location.pathname).active&&(_=null),!_){b=!1,_=[];let t=ze(null,o,e.history.location.pathname);t.active&&t.matches&&(v=!0,_=t.matches)}else if(_.some(e=>e.route.lazy))b=!1;else if(!_.some(e=>Ko(e.route)))b=!0;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=_.findIndex(e=>n[e.route.id]!==void 0);b=_.slice(0,e+1).every(e=>!qo(e.route,t,n))}else b=_.every(e=>!qo(e.route,t,n))}let x,S={historyAction:e.history.action,location:e.history.location,matches:_,initialized:b,navigation:Po,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||y,fetchers:new Map,blockers:new Map},C=`POP`,w=!1,T,E=!1,D=new Map,O=null,k=!1,A=!1,j=new Set,M=new Map,N=0,P=-1,F=new Map,I=new Set,L=new Map,R=new Map,z=new Set,B=new Map,ee,te=null;function V(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ee){ee(),ee=void 0;return}ja(B.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ne({currentLocation:S.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ee=e});e.history.go(r*-1),Me(i,{state:`blocked`,location:n,proceed(){Me(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(S.blockers);e.set(i,Io),ie({blockers:e})}});return}return ce(t,n)}),n){Ws(t,D);let e=()=>Gs(t,D);t.addEventListener(`pagehide`,e),O=()=>t.removeEventListener(`pagehide`,e)}return S.initialized||ce(`POP`,S.location,{initialHydration:!0}),x}function ne(){d&&d(),O&&O(),f.clear(),T&&T.abort(),S.fetchers.forEach((e,t)=>we(t)),S.blockers.forEach((e,t)=>je(t))}function re(e){return f.add(e),()=>f.delete(e)}function ie(e,t={}){e.matches&&=e.matches.map(e=>{let t=a[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),S={...S,...e};let n=[],r=[];S.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!S.fetchers.has(e)&&!M.has(e)&&n.push(e)}),[...f].forEach(e=>e(S,{deletedFetchers:n,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>we(e)),r.forEach(e=>S.fetchers.delete(e))}function ae(t,n,{flushSync:r}={}){let i=S.actionData!=null&&S.navigation.formMethod!=null&&Fs(S.navigation.formMethod)&&S.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?S.actionData:null;let c=n.loaderData?bs(S.loaderData,n.loaderData,n.matches||[],n.errors):S.loaderData,l=S.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,Io)));let u=k?!1:Re(t,n.matches||S.matches),d=w===!0||S.navigation.formMethod!=null&&Fs(S.navigation.formMethod)&&t.state?._isRedirect!==!0;s&&=(o=s,void 0),k||C===`POP`||(C===`PUSH`?e.history.push(t,t.state):C===`REPLACE`&&e.history.replace(t,t.state));let f;if(C===`POP`){let e=D.get(S.location.pathname);e&&e.has(t.pathname)?f={currentLocation:S.location,nextLocation:t}:D.has(t.pathname)&&(f={currentLocation:t,nextLocation:S.location})}else if(E){let e=D.get(S.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),D.set(S.location.pathname,e)),f={currentLocation:S.location,nextLocation:t}}ie({...n,actionData:a,loaderData:c,historyAction:C,location:t,initialized:!0,navigation:Po,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),C=`POP`,w=!1,E=!1,k=!1,A=!1,te?.resolve(),te=null}async function oe(t,n){if(typeof t==`number`){e.history.go(t);return}let{path:r,submission:i,error:a}=Wo(!1,Uo(S.location,S.matches,c,t,n?.fromRouteId,n?.relative),n),o=S.location,s=Pa(S.location,r,n&&n.state);s={...s,...e.history.encodeLocation(s)};let l=n&&n.replace!=null?n.replace:void 0,u=`PUSH`;l===!0?u=`REPLACE`:l===!1||i!=null&&Fs(i.formMethod)&&i.formAction===S.location.pathname+S.location.search&&(u=`REPLACE`);let d=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,f=(n&&n.flushSync)===!0,p=Ne({currentLocation:o,nextLocation:s,historyAction:u});if(p){Me(p,{state:`blocked`,location:s,proceed(){Me(p,{state:`proceeding`,proceed:void 0,reset:void 0,location:s}),oe(t,n)},reset(){let e=new Map(S.blockers);e.set(p,Io),ie({blockers:e})}});return}await ce(u,s,{submission:i,pendingError:a,preventScrollReset:d,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:f})}function se(){te||=Ks(),ye(),ie({revalidation:`loading`});let e=te.promise;return S.navigation.state===`submitting`?e:S.navigation.state===`idle`?(ce(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),e):(ce(C||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:E===!0}),e)}async function ce(t,n,r){T&&T.abort(),T=null,C=t,k=(r&&r.startUninterruptedRevalidation)===!0,Le(S.location,S.matches),w=(r&&r.preventScrollReset)===!0,E=(r&&r.enableViewTransition)===!0;let i=s||o,a=r&&r.overrideNavigation,l=r?.initialHydration&&S.matches&&S.matches.length>0&&!v?S.matches:qa(i,n,c),u=(r&&r.flushSync)===!0;if(l&&S.initialized&&!A&&Ds(S.location,n)&&!(r&&r.submission&&Fs(r.submission.formMethod))){ae(n,{matches:l},{flushSync:u});return}let d=ze(l,i,n.pathname);if(d.active&&d.matches&&(l=d.matches),!l){let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);ae(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}T=new AbortController;let f=gs(e.history,n,T.signal,r&&r.submission),p=e.getContext?await e.getContext():new Ba,m;if(r&&r.pendingError)m=[Ss(l).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Fs(r.submission.formMethod)){let t=await le(f,n,r.submission,l,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(js(r)&&Do(r.error)&&r.error.status===404){T=null,ae(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}l=t.matches||l,m=t.pendingActionResult,a=zs(n,r.submission),u=!1,d.active=!1,f=gs(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:y}=await ue(f,n,l,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m);h||(T=null,ae(n,{matches:g||l,...xs(m),loaderData:_,errors:y}))}async function le(e,t,n,s,l,u,d,f={}){if(ye(),ie({navigation:Bs(t,n)},{flushSync:f.flushSync===!0}),u){let n=await Be(s,t.pathname,e.signal);if(n.type===`aborted`)return{shortCircuited:!0};if(n.type===`error`){if(n.partialMatches.length===0){let{matches:e,route:t}=Cs(o);return{matches:e,pendingActionResult:[t.id,{type:`error`,error:n.error}]}}let e=Ss(n.partialMatches).route.id;return{matches:n.partialMatches,pendingActionResult:[e,{type:`error`,error:n.error}]}}else if(n.matches)s=n.matches;else{let{notFoundMatches:e,error:n,route:r}=Pe(t.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:n}]}}}let p,m=Ls(s,t);if(!m.route.action&&!m.route.lazy)p={type:`error`,error:ws(405,{method:e.method,pathname:t.pathname,routeId:m.route.id})};else{let t=await _e(e,us(i,a,e,s,m,d?[]:r,l),l,null);if(p=t[m.route.id],!p){for(let e of s)if(t[e.route.id]){p=t[e.route.id];break}}if(e.signal.aborted)return{shortCircuited:!0}}if(Ms(p)){let t;return t=f&&f.replace!=null?f.replace:hs(p.response.headers.get(`Location`),new URL(e.url),c)===S.location.pathname+S.location.search,await ge(e,p,!0,{submission:n,replace:t}),{shortCircuited:!0}}if(js(p)){let e=Ss(s,m.route.id);return(f&&f.replace)!==!0&&(C=`PUSH`),{matches:s,pendingActionResult:[e.route.id,p,m.route.id]}}return{matches:s,pendingActionResult:[m.route.id,p]}}async function ue(t,n,l,u,d,f,p,m,h,g,_,v){let y=f||zs(n,p),b=p||m||Rs(y),x=!k&&!g;if(d){if(x){let e=de(v);ie({navigation:y,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Be(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Cs(o);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Ss(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)l=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s||o,{dsMatches:w,revalidatingFetchers:E}=Go(t,u,i,a,e.history,S,l,b,n,g?[]:r,g===!0,A,j,z,L,I,C,c,e.patchRoutesOnNavigation!=null,v);if(P=++N,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=Oe();return ae(n,{matches:l,loaderData:{},errors:v&&js(v[1])?{[v[0]]:v[1].error}:null,...xs(v),...e?{fetchers:new Map(S.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(x){let e={};if(!d){e.navigation=y;let t=de(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=fe(E)),ie(e,{flushSync:_})}E.forEach(e=>{Ee(e.key),e.controller&&M.set(e.key,e.controller)});let D=()=>E.forEach(e=>Ee(e.key));T&&T.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:F}=await ve(w,E,t,u);if(t.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener(`abort`,D),E.forEach(e=>M.delete(e.key));let R=Ts(O);if(R)return await ge(t,R.result,!0,{replace:h}),{shortCircuited:!0};if(R=Ts(F),R)return I.add(R.key),await ge(t,R.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:B,errors:ee}=ys(S,l,O,v,E,F);g&&S.errors&&(ee={...S.errors,...ee});let te=Oe(),V=ke(P),ne=te||V||E.length>0;return{matches:l,loaderData:B,errors:ee,...ne?{fetchers:new Map(S.fetchers)}:{}}}function de(e){if(e&&!js(e[1]))return{[e[0]]:e[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function fe(e){return e.forEach(e=>{let t=S.fetchers.get(e.key),n=Vs(void 0,t?t.data:void 0);S.fetchers.set(e.key,n)}),new Map(S.fetchers)}async function pe(t,n,r,i){Ee(t);let a=(i&&i.flushSync)===!0,l=s||o,u=Uo(S.location,S.matches,c,r,n,i?.relative),d=qa(l,u,c),f=ze(d,l,u);if(f.active&&f.matches&&(d=f.matches),!d){xe(t,n,ws(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=Wo(!0,u,i);if(h){xe(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new Ba,_=(i&&i.preventScrollReset)===!0;if(m&&Fs(m.formMethod)){await me(t,n,p,d,g,f.active,a,_,m);return}L.set(t,{routeId:n,path:p}),await he(t,n,p,d,g,f.active,a,_,m)}async function me(t,n,l,u,d,f,p,m,h){ye(),L.delete(t),be(t,Hs(h,S.fetchers.get(t)),{flushSync:p});let g=new AbortController,_=gs(e.history,l,g.signal,h);if(f){let e=await Be(u,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{xe(t,n,ws(404,{pathname:l}),{flushSync:p});return}}let v=Ls(u,l);if(!v.route.action&&!v.route.lazy){xe(t,n,ws(405,{method:h.formMethod,pathname:l,routeId:n}),{flushSync:p});return}M.set(t,g);let y=N,b=(await _e(_,us(i,a,_,u,v,r,d),d,t))[v.route.id];if(_.signal.aborted){M.get(t)===g&&M.delete(t);return}if(z.has(t)){if(Ms(b)||js(b)){be(t,Us(void 0));return}}else{if(Ms(b))if(M.delete(t),P>y){be(t,Us(void 0));return}else return I.add(t),be(t,Vs(h)),ge(_,b,!1,{fetcherSubmission:h,preventScrollReset:m});if(js(b)){xe(t,n,b.error);return}}let x=S.navigation.location||S.location,w=gs(e.history,x,g.signal),E=s||o,D=S.navigation.state===`idle`?S.matches:qa(E,S.navigation.location,c);Aa(D,`Didn't find any matches after fetcher action`);let O=++N;F.set(t,O);let k=Vs(h,b.data);S.fetchers.set(t,k);let{dsMatches:R,revalidatingFetchers:B}=Go(w,d,i,a,e.history,S,D,h,x,r,!1,A,j,z,L,I,E,c,e.patchRoutesOnNavigation!=null,[v.route.id,b]);B.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=S.fetchers.get(t),r=Vs(void 0,n?n.data:void 0);S.fetchers.set(t,r),Ee(t),e.controller&&M.set(t,e.controller)}),ie({fetchers:new Map(S.fetchers)});let ee=()=>B.forEach(e=>Ee(e.key));g.signal.addEventListener(`abort`,ee);let{loaderResults:te,fetcherResults:V}=await ve(R,B,w,d);if(g.signal.aborted)return;if(g.signal.removeEventListener(`abort`,ee),F.delete(t),M.delete(t),B.forEach(e=>M.delete(e.key)),S.fetchers.has(t)){let e=Us(b.data);S.fetchers.set(t,e)}let ne=Ts(te);if(ne)return ge(w,ne.result,!1,{preventScrollReset:m});if(ne=Ts(V),ne)return I.add(ne.key),ge(w,ne.result,!1,{preventScrollReset:m});let{loaderData:re,errors:oe}=ys(S,D,te,void 0,B,V);ke(O),S.navigation.state===`loading`&&O>P?(Aa(C,`Expected pending action`),T&&T.abort(),ae(S.navigation.location,{matches:D,loaderData:re,errors:oe,fetchers:new Map(S.fetchers)})):(ie({errors:oe,loaderData:bs(S.loaderData,re,D,oe),fetchers:new Map(S.fetchers)}),A=!1)}async function he(t,n,o,s,c,l,u,d,f){let p=S.fetchers.get(t);be(t,Vs(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=gs(e.history,o,m.signal);if(l){let e=await Be(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{xe(t,n,ws(404,{pathname:o}),{flushSync:u});return}}let g=Ls(s,o);M.set(t,m);let _=N,v=(await _e(h,us(i,a,h,s,g,r,c),c,t))[g.route.id];if(M.get(t)===m&&M.delete(t),!h.signal.aborted){if(z.has(t)){be(t,Us(void 0));return}if(Ms(v))if(P>_){be(t,Us(void 0));return}else{I.add(t),await ge(h,v,!1,{preventScrollReset:d});return}if(js(v)){xe(t,n,v.error);return}be(t,Us(v.data))}}async function ge(e,r,i,{submission:a,fetcherSubmission:o,preventScrollReset:s,replace:l}={}){r.response.headers.has(`X-Remix-Revalidate`)&&(A=!0);let u=r.response.headers.get(`Location`);Aa(u,`Expected a Location header on the redirect Response`),u=hs(u,new URL(e.url),c);let d=Pa(S.location,u,{_isRedirect:!0});if(n){let e=!1;if(r.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Lo(u)){let n=Ra(u,!0);e=n.origin!==t.location.origin||mo(n.pathname,c)==null}if(e){l?t.location.replace(u):t.location.assign(u);return}}T=null;let f=l===!0||r.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:p,formAction:m,formEncType:h}=S.navigation;!a&&!o&&p&&m&&h&&(a=Rs(S.navigation));let g=a||o;No.has(r.response.status)&&g&&Fs(g.formMethod)?await ce(f,d,{submission:{...g,formAction:u},preventScrollReset:s||w,enableViewTransition:i?E:void 0}):await ce(f,d,{overrideNavigation:zs(d,a),fetcherSubmission:o,preventScrollReset:s||w,enableViewTransition:i?E:void 0})}async function _e(e,t,n,r){let i,a={};try{i=await ds(l,e,t,r,n,!1)}catch(e){return t.filter(e=>e.shouldLoad).forEach(t=>{a[t.route.id]={type:`error`,error:e}}),a}if(e.signal.aborted)return a;for(let[n,r]of Object.entries(i))if(As(r)){let i=r.result;a[n]={type:`redirect`,response:ms(i,e,n,t,c)}}else a[n]=await ps(r);return a}async function ve(e,t,n,r){let i=_e(n,e,r,null),a=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await _e(e.request,e.matches,r,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:ws(404,{pathname:e.path})}})}));return{loaderResults:await i,fetcherResults:(await a).reduce((e,t)=>Object.assign(e,t),{})}}function ye(){A=!0,L.forEach((e,t)=>{M.has(t)&&j.add(t),Ee(t)})}function be(e,t,n={}){S.fetchers.set(e,t),ie({fetchers:new Map(S.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function xe(e,t,n,r={}){let i=Ss(S.matches,t);we(e),ie({errors:{[i.route.id]:n},fetchers:new Map(S.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Se(e){return R.set(e,(R.get(e)||0)+1),z.has(e)&&z.delete(e),S.fetchers.get(e)||Fo}function Ce(e,t){Ee(e,t?.reason),be(e,Us(null))}function we(e){let t=S.fetchers.get(e);M.has(e)&&!(t&&t.state===`loading`&&F.has(e))&&Ee(e),L.delete(e),F.delete(e),I.delete(e),z.delete(e),j.delete(e),S.fetchers.delete(e)}function Te(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),z.add(e)):R.set(e,t),ie({fetchers:new Map(S.fetchers)})}function Ee(e,t){let n=M.get(e);n&&(n.abort(t),M.delete(e))}function De(e){for(let t of e){let e=Us(Se(t).data);S.fetchers.set(t,e)}}function Oe(){let e=[],t=!1;for(let n of I){let r=S.fetchers.get(n);Aa(r,`Expected fetcher: ${n}`),r.state===`loading`&&(I.delete(n),e.push(n),t=!0)}return De(e),t}function ke(e){let t=[];for(let[n,r]of F)if(r<e){let e=S.fetchers.get(n);Aa(e,`Expected fetcher: ${n}`),e.state===`loading`&&(Ee(n),F.delete(n),t.push(n))}return De(t),t.length>0}function Ae(e,t){let n=S.blockers.get(e)||Io;return B.get(e)!==t&&B.set(e,t),n}function je(e){S.blockers.delete(e),B.delete(e)}function Me(e,t){let n=S.blockers.get(e)||Io;Aa(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(S.blockers);r.set(e,t),ie({blockers:r})}function Ne({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&ja(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=S.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Pe(e){let t=ws(404,{pathname:e}),{matches:n,route:r}=Cs(s||o);return{notFoundMatches:n,route:r,error:t}}function Fe(e,t,n){if(p=e,h=t,m=n||null,!g&&S.navigation===Po){g=!0;let e=Re(S.location,S.matches);e!=null&&ie({restoreScrollPosition:e})}return()=>{p=null,h=null,m=null}}function Ie(e,t){return m&&m(e,t.map(e=>Ya(e,S.loaderData)))||e.key}function Le(e,t){if(p&&h){let n=Ie(e,t);p[n]=h()}}function Re(e,t){if(p){let n=Ie(e,t),r=p[n];if(typeof r==`number`)return r}return null}function ze(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:Ja(n,r,c,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Ja(n,r,c,!0)}}return{active:!1,matches:null}}async function Be(t,n,r,l){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=s==null,d=s||o,f=a;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:l,patch:(e,t)=>{r.aborted||Zo(e,t,d,f,i,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(o=[...o])}if(r.aborted)return{type:`aborted`};let p=qa(d,n,c);if(p)return{type:`success`,matches:p};let m=Ja(d,n,c,!0);if(!m||u.length===m.length&&u.every((e,t)=>e.route.id===m[t].route.id))return{type:`success`,matches:null};u=m}}function Ve(e){a={},s=Ka(e,i,void 0,a)}function He(e,t,n=!1){let r=s==null;Zo(e,t,s||o,a,i,n),r&&(o=[...o],ie({}))}return x={get basename(){return c},get future(){return u},get state(){return S},get routes(){return o},get window(){return t},initialize:V,subscribe:re,enableScrollRestoration:Fe,navigate:oe,fetch:pe,revalidate:se,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Se,resetFetcher:Ce,deleteFetcher:Te,dispose:ne,getBlocker:Ae,deleteBlocker:je,patchRoutes:He,_internalFetchControllers:M,_internalSetRoutes:Ve,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){ie(e)}},x}function Ho(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Uo(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=xo(r||`.`,bo(o),mo(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Is(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=ho({basename:n,pathname:c.pathname})),Fa(c)}function Wo(e,t,n){if(!n||!Ho(n))return{path:t};if(n.formMethod&&!mee(n.formMethod))return{path:t,error:ws(405,{method:n.formMethod})};let r=()=>({path:t,error:ws(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Es(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Fs(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
10
+ `).replace(_d,``)}function yd(e,t){return t=vd(t),vd(e)===t}function bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Bt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ut(e,r,o);break;case`data`:if(t!==`object`){Ct(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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 o==`function`&&(n===`formAction`?(t!==`input`&&bd(e,t,`name`,a.name,a,null),bd(e,t,`formEncType`,a.formEncType,a,null),bd(e,t,`formMethod`,a.formMethod,a,null),bd(e,t,`formTarget`,a.formTarget,a,null)):(bd(e,t,`encType`,a.encType,a,null),bd(e,t,`method`,a.method,a,null),bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=qt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`onScroll`:r!=null&&od(`scroll`,e);break;case`onScrollEnd`:r!=null&&od(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=qt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:od(`beforetoggle`,e),od(`toggle`,e),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Gt.get(n)||n,St(e,n,r))}}function xd(e,t,n,r,a,o){switch(n){case`style`:Ut(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Bt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Bt(e,``+r);break;case`onScroll`:r!=null&&od(`scroll`,e);break;case`onScrollEnd`:r!=null&&od(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Yt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[tt]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(e,n,r)}}}function Sd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:od(`error`,e),od(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:bd(e,t,o,s,n,null)}}a&&bd(e,t,`srcSet`,n.srcSet,n,null),r&&bd(e,t,`src`,n.src,n,null);return;case`input`:od(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:bd(e,t,r,d,n,null)}}Pt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in od(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Lt(e,!!r,n,!0):Lt(e,!!r,t,!1);return;case`textarea`:for(s in od(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:bd(e,t,s,c,n,null)}zt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:bd(e,t,l,r,n,null)}return;case`dialog`:od(`beforetoggle`,e),od(`toggle`,e),od(`cancel`,e),od(`close`,e);break;case`iframe`:case`object`:od(`load`,e);break;case`video`:case`audio`:for(r=0;r<rd.length;r++)od(rd[r],e);break;case`image`:od(`error`,e),od(`load`,e);break;case`details`:od(`toggle`,e);break;case`embed`:case`source`:case`link`:od(`error`,e),od(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:bd(e,t,u,r,n,null)}return;default:if(Wt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&xd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&bd(e,t,c,r,n,null))}function Cd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||bd(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&bd(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Lt(e,!!n,n?[]:``,!1):Lt(e,!!n,t,!0)):Lt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&bd(e,t,s,a,r,o)}Rt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:bd(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:bd(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&bd(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:bd(e,t,u,p,r,m)}return;default:if(Wt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&xd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||xd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&bd(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||bd(e,t,f,p,r,m)}function wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Td(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&wd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&wd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Ed=null,Dd=null;function Od(e){return e.nodeType===9?e:e.ownerDocument}function kd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Ad(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function jd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Md=null;function See(){var e=window.event;return e&&e.type===`popstate`?e===Md?!1:(Md=e,!0):(Md=null,!1)}var Nd=typeof setTimeout==`function`?setTimeout:void 0,Cee=typeof clearTimeout==`function`?clearTimeout:void 0,Pd=typeof Promise==`function`?Promise:void 0,wee=typeof queueMicrotask==`function`?queueMicrotask:Pd===void 0?Nd:function(e){return Pd.resolve(null).then(e).catch(Tee)};function Tee(e){setTimeout(function(){throw e})}function Fd(e){return e===`head`}function Id(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),ip(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Yd(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Yd(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Yd(e.ownerDocument.body);n=i}while(n);ip(t)}function Ld(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function Rd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:Rd(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function zd(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[st])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=Wd(e.nextSibling),e===null)break}return null}function Bd(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=Wd(e.nextSibling),e===null))return null;return e}function Vd(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=Wd(e.nextSibling),e===null))return null;return e}function Hd(e){return e.data===`$?`||e.data===`$~`}function Ud(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function Eee(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function Wd(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var Gd=null;function Kd(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return Wd(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function qd(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Jd(e,t,n){switch(t=Od(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Yd(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var Xd=new Map,Zd=new Set;function Qd(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var $d=P.d;P.d={f:ef,r:Dee,D:Oee,C:rf,L:af,m:of,X:kee,S:sf,M:cf};function ef(){var e=$d.f(),t=cu();return e||t}function Dee(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?ms(t):$d.r(e)}var tf=typeof document>`u`?null:document;function nf(e,t,n){var r=tf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Zd.has(i)||(Zd.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Sd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Oee(e){$d.D(e),nf(`dns-prefetch`,e,null)}function rf(e,t){$d.C(e,t),nf(`preconnect`,e,t)}function af(e,t,n){$d.L(e,t,n);var r=tf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=uf(e);break;case`script`:a=pf(e)}Xd.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Xd.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(df(a))||t===`script`&&r.querySelector(mf(a))||(t=r.createElement(`link`),Sd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function of(e,t){$d.m(e,t);var n=tf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=pf(e)}if(!Xd.has(a)&&(e=f({rel:`modulepreload`,href:e},t),Xd.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(mf(a)))return}r=n.createElement(`link`),Sd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function sf(e,t,n){$d.S(e,t,n);var r=tf;if(r&&e){var i=ft(r).hoistableStyles,a=uf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(df(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Xd.get(a))&&_f(e,n);var c=o=r.createElement(`link`);pt(c),Sd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function kee(e,t){$d.X(e,t);var n=tf;if(n&&e){var r=ft(n).hoistableScripts,i=pf(e),a=r.get(i);a||(a=n.querySelector(mf(i)),a||(e=f({src:e,async:!0},t),(t=Xd.get(i))&&vf(e,t),a=n.createElement(`script`),pt(a),Sd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function cf(e,t){$d.M(e,t);var n=tf;if(n&&e){var r=ft(n).hoistableScripts,i=pf(e),a=r.get(i);a||(a=n.querySelector(mf(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=Xd.get(i))&&vf(e,t),a=n.createElement(`script`),pt(a),Sd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function lf(e,t,n,r){var a=(a=V.current)?Qd(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=uf(n.href),n=ft(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=uf(n.href);var o=ft(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(df(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Xd.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Xd.set(e,n),o||Aee(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=pf(n),n=ft(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function uf(e){return`href="`+Mt(e)+`"`}function df(e){return`link[rel="stylesheet"][`+e+`]`}function ff(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Aee(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Sd(t,`link`,n),pt(t),e.head.appendChild(t))}function pf(e){return`[src="`+Mt(e)+`"]`}function mf(e){return`script[async]`+e}function hf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Sd(r,`style`,a),gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=uf(n.href);var o=e.querySelector(df(a));if(o)return t.state.loading|=4,t.instance=o,pt(o),o;r=ff(n),(a=Xd.get(a))&&_f(r,a),o=(e.ownerDocument||e).createElement(`link`),pt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Sd(o,`link`,r),t.state.loading|=4,gf(o,n.precedence,e),t.instance=o;case`script`:return o=pf(n.src),(a=e.querySelector(mf(o)))?(t.instance=a,pt(a),a):(r=n,(a=Xd.get(o))&&(r=f({},n),vf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),pt(a),Sd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,gf(r,n.precedence,e));return t.instance}function gf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function _f(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function vf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var yf=null;function bf(e,t,n){if(yf===null){var r=new Map,i=yf=new Map;i.set(n,r)}else i=yf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[st]||a[et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function jee(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Sf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Mee(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=uf(r.href),a=t.querySelector(df(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Cf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=ff(r),(i=Xd.get(i))&&_f(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Sd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Cf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var W=0;function Nee(e,t){return e.stylesheets&&e.count===0&&Tf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Tf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&W===0&&(W=62500*Td());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Tf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>W?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Cf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Tf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var wf=null;function Tf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,wf=new Map,t.forEach(Pee,e),wf=null,Cf.call(e))}function Pee(e,t){if(!(t.state.loading&4)){var n=wf.get(e);if(n)var r=n.get(null);else{n=new Map,wf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Cf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Ef={$$typeof:b,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function Df(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function Of(e,t,n,r,i,a,o,s,c,l,u,d){return e=new Df(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Yr(3,null,null,t),e.current=a,a.stateNode=e,t=Yi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Da(a),e}function Fee(e){return e?(e=qr,e):qr}function kf(e,t,n,r,i,a){i=Fee(i),r.context===null?r.context=i:r.pendingContext=i,r=ka(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Aa(e,r,t),n!==null&&(iu(n,e,t),ja(n,e,t))}function Af(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function G(e,t){Af(e,t),(e=e.alternate)&&Af(e,t)}function jf(e){if(e.tag===13||e.tag===31){var t=Wr(e,67108864);t!==null&&iu(t,e,67108864),G(e,67108864)}}function Mf(e){if(e.tag===13||e.tag===31){var t=nu();t=Ye(t);var n=Wr(e,t);n!==null&&iu(n,e,t),G(e,t)}}var Nf=!0;function Iee(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=2,Ff(e,t,n,r)}finally{P.p=a,N.T=i}}function Pf(e,t,n,r){var i=N.T;N.T=null;var a=P.p;try{P.p=8,Ff(e,t,n,r)}finally{P.p=a,N.T=i}}function Ff(e,t,n,r){if(Nf){var i=If(r);if(i===null)dd(e,t,r,Lf,n),Jf(e,r);else if(Xf(i,e,t,n,r))r.stopPropagation();else if(Jf(e,r),t&4&&-1<qf.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}Uu(a),!(Cl&6)&&(Wl=ye()+500,Wu(0,!1))}}break;case 31:case 13:s=Wr(a,2),s!==null&&iu(s,a,2),cu(),G(a,2)}if(a=If(r),a===null&&dd(e,t,r,Lf,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else dd(e,t,r,null,n)}}function If(e){return e=Zt(e),Rf(e)}var Lf=null;function Rf(e){if(Lf=null,e=lt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Lf=e,null}function zf(e){switch(e){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(be()){case xe:return 2;case Se:return 8;case Ce:case we:return 32;case Te:return 268435456;default:return 32}default:return 32}}var Bf=!1,Vf=null,Hf=null,Uf=null,Wf=new Map,Gf=new Map,Kf=[],qf=`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 Jf(e,t){switch(e){case`focusin`:case`focusout`:Vf=null;break;case`dragenter`:case`dragleave`:Hf=null;break;case`mouseover`:case`mouseout`:Uf=null;break;case`pointerover`:case`pointerout`:Wf.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Gf.delete(t.pointerId)}}function Yf(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ut(t),t!==null&&jf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Xf(e,t,n,r,i){switch(t){case`focusin`:return Vf=Yf(Vf,e,t,n,r,i),!0;case`dragenter`:return Hf=Yf(Hf,e,t,n,r,i),!0;case`mouseover`:return Uf=Yf(Uf,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Wf.set(a,Yf(Wf.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Gf.set(a,Yf(Gf.get(a)||null,e,t,n,r,i)),!0}return!1}function Zf(e){var t=lt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){Mf(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){Mf(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=If(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Xt=r,n.target.dispatchEvent(r),Xt=null}else return t=ut(n),t!==null&&jf(t),e.blockedOn=n,!1;t.shift()}return!0}function $f(e,t,n){Qf(e)&&n.delete(t)}function ep(){Bf=!1,Vf!==null&&Qf(Vf)&&(Vf=null),Hf!==null&&Qf(Hf)&&(Hf=null),Uf!==null&&Qf(Uf)&&(Uf=null),Wf.forEach($f),Gf.forEach($f)}function tp(e,n){e.blockedOn===n&&(e.blockedOn=null,Bf||(Bf=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ep)))}var np=null;function rp(e){np!==e&&(np=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){np===e&&(np=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Rf(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,fs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function ip(e){function t(t){return tp(t,e)}Vf!==null&&tp(Vf,e),Hf!==null&&tp(Hf,e),Uf!==null&&tp(Uf,e),Wf.forEach(t),Gf.forEach(t);for(var n=0;n<Kf.length;n++){var r=Kf[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Kf.length&&(n=Kf[0],n.blockedOn===null);)Zf(n),n.blockedOn===null&&Kf.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[tt]||null;if(typeof a==`function`)o||rp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(Rf(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),rp(n)}}}function ap(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function op(e){this._internalRoot=e}sp.prototype.render=op.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;kf(n,nu(),e,t,null,null)},sp.prototype.unmount=op.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kf(e.current,2,null,e,null,null),cu(),t[nt]=null}};function sp(e){this._internalRoot=e}sp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Kf.length&&t!==0&&t<Kf[n].priority;n++);Kf.splice(n,0,e),n===0&&Zf(e)}};var cp=n.version;if(cp!==`19.2.7`)throw Error(i(527,cp,`19.2.7`));P.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Lee={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:N,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var lp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!lp.isDisabled&&lp.supportsFiber)try{Oe=lp.inject(Lee),ke=lp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Ps,s=mee,c=Fs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=Of(e,1,!1,null,null,n,r,null,o,s,c,ap),e[nt]=t.current,ld(e),new op(t)}})),ur=a(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=lr()})),iee=ur(),H=r(Jt()),dr=r(Je());function aee(){dr.default.setDefaultLevel(`silent`),localStorage.getItem(`ENABLE_DEBUG_LOGS`)&&dr.default.setLevel(`debug`),window.zuploEnableSupportLogs=()=>{localStorage.setItem(`ENABLE_DEBUG_LOGS`,`1`),dr.default.setDefaultLevel(`debug`),dr.default.info("Support logging is enabled. To disable run `window.zuploDisableSupportLogs()`")},window.zuploDisableSupportLogs=()=>{localStorage.removeItem(`ENABLE_DEBUG_LOGS`),dr.default.info(`Support logging is disabled.`),dr.default.setLevel(`silent`)}}function fr(e){return new Worker(`/static/editor.worker-Pe6d6EA8.js`,{name:e?.name})}function pr(e){return new Worker(`/static/css.worker-lKFT03HI.js`,{name:e?.name})}function mr(e){return new Worker(`/static/html.worker-22WyiEnc.js`,{name:e?.name})}function hr(e){return new Worker(`/static/json.worker-C4s5qRoG.js`,{name:e?.name})}function gr(e){return new Worker(`/static/ts.worker-DFduhuek.js`,{name:e?.name})}function _r(){self.MonacoEnvironment={getWorker(e,t){switch(t){case`json`:return new hr;case`css`:case`scss`:case`less`:return new pr;case`html`:case`handlebars`:case`razor`:return new mr;case`typescript`:case`javascript`:return new gr;default:return new fr}}}}var vr=e=>typeof e==`string`,yr=()=>{let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n},br=e=>e==null?``:String(e),xr=(e,t,n)=>{e.forEach(e=>{t[e]&&(n[e]=t[e])})},Sr=/###/g,Cr=e=>e&&e.includes(`###`)?e.replace(Sr,`.`):e,wr=e=>!e||vr(e),Tr=(e,t,n)=>{let r=vr(t)?t.split(`.`):t,i=0;for(;i<r.length-1;){if(wr(e))return{};let t=Cr(r[i]);!e[t]&&n&&(e[t]=new n),e=Object.prototype.hasOwnProperty.call(e,t)?e[t]:{},++i}return wr(e)?{}:{obj:e,k:Cr(r[i])}},Er=(e,t,n)=>{let{obj:r,k:i}=Tr(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let a=t[t.length-1],o=t.slice(0,t.length-1),s=Tr(e,o,Object);for(;s.obj===void 0&&o.length;)a=`${o[o.length-1]}.${a}`,o=o.slice(0,o.length-1),s=Tr(e,o,Object),s?.obj&&s.obj[`${s.k}.${a}`]!==void 0&&(s.obj=void 0);s.obj[`${s.k}.${a}`]=n},Dr=(e,t,n,r)=>{let{obj:i,k:a}=Tr(e,t,Object);i[a]=i[a]||[],i[a].push(n)},Or=(e,t)=>{let{obj:n,k:r}=Tr(e,t);if(n&&Object.prototype.hasOwnProperty.call(n,r))return n[r]},kr=(e,t,n)=>{let r=Or(e,n);return r===void 0?Or(t,n):r},Ar=(e,t,n)=>{for(let r in t)r!==`__proto__`&&r!==`constructor`&&(Object.prototype.hasOwnProperty.call(e,r)?vr(e[r])||e[r]instanceof String||vr(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):Ar(e[r],t[r],n):e[r]=t[r]);return e},jr=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,`\\$&`),Mr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`,"/":`&#x2F;`},oee=e=>vr(e)?e.replace(/[&<>"'\/]/g,e=>Mr[e]):e,see=class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){let t=this.regExpMap.get(e);if(t!==void 0)return t;let n=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,n),this.regExpQueue.push(e),n}},cee=[` `,`,`,`?`,`!`,`;`],Nr=new see(20),Pr=(e,t,n)=>{t||=``,n||=``;let r=cee.filter(e=>!t.includes(e)&&!n.includes(e));if(r.length===0)return!0;let i=Nr.getRegExp(`(${r.map(e=>e===`?`?`\\?`:e).join(`|`)})`),a=!i.test(e);if(!a){let t=e.indexOf(n);t>0&&!i.test(e.substring(0,t))&&(a=!0)}return a},Fr=(e,t,n=`.`)=>{if(!e)return;if(e[t])return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0;let r=t.split(n),i=e;for(let e=0;e<r.length;){if(!i||typeof i!=`object`)return;let t,a=``;for(let o=e;o<r.length;++o)if(o!==e&&(a+=n),a+=r[o],t=i[a],t!==void 0){if([`string`,`number`,`boolean`].includes(typeof t)&&o<r.length-1)continue;e+=o-e+1;break}i=t}return i},Ir=e=>e?.replace(/_/g,`-`),Lr={type:`logger`,log(e){this.output(`log`,e)},warn(e){this.output(`warn`,e)},error(e){this.output(`error`,e)},output(e,t){console?.[e]?.apply?.(console,t)}},Rr=new class e{constructor(e,t={}){this.init(e,t)}init(e,t={}){this.prefix=t.prefix||`i18next:`,this.logger=e||Lr,this.options=t,this.debug=t.debug}log(...e){return this.forward(e,`log`,``,!0)}warn(...e){return this.forward(e,`warn`,``,!0)}error(...e){return this.forward(e,`error`,``)}deprecate(...e){return this.forward(e,`warn`,`WARNING DEPRECATED: `,!0)}forward(e,t,n,r){return r&&!this.debug?null:(e=e.map(e=>vr(e)?e.replace(/[\r\n\x00-\x1F\x7F]/g,` `):e),vr(e[0])&&(e[0]=`${n}${this.prefix} ${e[0]}`),this.logger[t](e))}create(t){return new e(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t||=this.options,t.prefix=t.prefix||this.prefix,new e(this.logger,t)}},zr=class{constructor(){this.observers={}}on(e,t){return e.split(` `).forEach(e=>{this.observers[e]||(this.observers[e]=new Map);let n=this.observers[e].get(t)||0;this.observers[e].set(t,n+1)}),this}off(e,t){if(this.observers[e]){if(!t){delete this.observers[e];return}this.observers[e].delete(t)}}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}emit(e,...t){this.observers[e]&&Array.from(this.observers[e].entries()).forEach(([e,n])=>{for(let r=0;r<n;r++)e(...t)}),this.observers[`*`]&&Array.from(this.observers[`*`].entries()).forEach(([n,r])=>{for(let i=0;i<r;i++)n(e,...t)})}},Br=class extends zr{constructor(e,t={ns:[`translation`],defaultNS:`translation`}){super(),this.data=e||{},this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.includes(e)||this.options.ns.push(e)}removeNamespaces(e){let t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,t,n,r={}){let i=r.keySeparator===void 0?this.options.keySeparator:r.keySeparator,a=r.ignoreJSONStructure===void 0?this.options.ignoreJSONStructure:r.ignoreJSONStructure,o;e.includes(`.`)?o=e.split(`.`):(o=[e,t],n&&(Array.isArray(n)?o.push(...n):vr(n)&&i?o.push(...n.split(i)):o.push(n)));let s=Or(this.data,o);return!s&&!t&&!n&&e.includes(`.`)&&(e=o[0],t=o[1],n=o.slice(2).join(`.`)),s||!a||!vr(n)?s:Fr(this.data?.[e]?.[t],n,i)}addResource(e,t,n,r,i={silent:!1}){let a=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,o=[e,t];n&&(o=o.concat(a?n.split(a):n)),e.includes(`.`)&&(o=e.split(`.`),r=t,t=o[1]),this.addNamespaces(t),Er(this.data,o,r),i.silent||this.emit(`added`,e,t,n,r)}addResources(e,t,n,r={silent:!1}){for(let r in n)(vr(n[r])||Array.isArray(n[r]))&&this.addResource(e,t,r,n[r],{silent:!0});r.silent||this.emit(`added`,e,t,n)}addResourceBundle(e,t,n,r,i,a={silent:!1,skipCopy:!1}){let o=[e,t];e.includes(`.`)&&(o=e.split(`.`),r=n,n=t,t=o[1]),this.addNamespaces(t);let s=Or(this.data,o)||{};a.skipCopy||(n=JSON.parse(JSON.stringify(n))),r?Ar(s,n,i):s={...s,...n},Er(this.data,o,s),a.silent||this.emit(`added`,e,t,n)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit(`removed`,e,t)}hasResourceBundle(e,t){return this.getResource(e,t)!==void 0}getResourceBundle(e,t){return t||=this.options.defaultNS,this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){let t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}},Vr={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(e=>{t=this.processors[e]?.process(t,n,r,i)??t}),t}},Hr=Symbol(`i18next/PATH_KEY`);function Ur(){let e=[],t=Object.create(null),n;return t.get=(r,i)=>(n?.revoke?.(),i===Hr?e:(e.push(i),n=Proxy.revocable(r,t),n.proxy)),Proxy.revocable(Object.create(null),t).proxy}function Wr(e,t){let{[Hr]:n}=e(Ur()),r=t?.keySeparator??`.`,i=t?.nsSeparator??`:`,a=t?.enableSelector===`strict`;if(n.length>1&&i){let e=t?.ns,o=a?Array.isArray(e)?e:e?[e]:null:Array.isArray(e)?e:null;if(o&&(a?o:o.length>1?o.slice(1):[]).includes(n[0]))return`${n[0]}${i}${n.slice(1).join(r)}`}return n.join(r)}var Gr=e=>!vr(e)&&typeof e!=`boolean`&&typeof e!=`number`,Kr=class e extends zr{constructor(e,t={}){super(),xr([`resourceStore`,`languageUtils`,`pluralResolver`,`interpolator`,`backendConnector`,`i18nFormat`,`utils`],e,this),this.options=t,this.options.keySeparator===void 0&&(this.options.keySeparator=`.`),this.logger=Rr.create(`translator`),this.checkedLoadedFor={}}changeLanguage(e){e&&(this.language=e)}exists(e,t={interpolation:{}}){let n={...t};if(e==null)return!1;let r=this.resolve(e,n);if(r?.res===void 0)return!1;let i=Gr(r.res);return!(n.returnObjects===!1&&i)}extractFromKey(e,t){let n=t.nsSeparator===void 0?this.options.nsSeparator:t.nsSeparator;n===void 0&&(n=`:`);let r=t.keySeparator===void 0?this.options.keySeparator:t.keySeparator,i=t.ns||this.options.defaultNS||[],a=n&&e.includes(n),o=!this.options.userDefinedKeySeparator&&!t.keySeparator&&!this.options.userDefinedNsSeparator&&!t.nsSeparator&&!Pr(e,n,r);if(a&&!o){let t=e.match(this.interpolator.nestingRegexp);if(t&&t.length>0)return{key:e,namespaces:vr(i)?[i]:i};let a=e.split(n);(n!==r||n===r&&this.options.ns.includes(a[0]))&&(i=a.shift()),e=a.join(r)}return{key:e,namespaces:vr(i)?[i]:i}}translate(t,n,r){let i=typeof n==`object`?{...n}:n;if(typeof i!=`object`&&this.options.overloadTranslationOptionHandler&&(i=this.options.overloadTranslationOptionHandler(arguments)),typeof i==`object`&&(i={...i}),i||={},t==null)return``;typeof t==`function`&&(t=Wr(t,{...this.options,...i})),Array.isArray(t)||(t=[String(t)]),t=t.map(e=>typeof e==`function`?Wr(e,{...this.options,...i}):String(e));let a=i.returnDetails===void 0?this.options.returnDetails:i.returnDetails,o=i.keySeparator===void 0?this.options.keySeparator:i.keySeparator,{key:s,namespaces:c}=this.extractFromKey(t[t.length-1],i),l=c[c.length-1],u=i.nsSeparator===void 0?this.options.nsSeparator:i.nsSeparator;u===void 0&&(u=`:`);let d=i.lng||this.language,f=i.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d?.toLowerCase()===`cimode`)return f?a?{res:`${l}${u}${s}`,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:`${l}${u}${s}`:a?{res:s,usedKey:s,exactUsedKey:s,usedLng:d,usedNS:l,usedParams:this.getUsedParamsDetails(i)}:s;let p=this.resolve(t,i),m=p?.res,h=p?.usedKey||s,g=p?.exactUsedKey||s,_=[`[object Number]`,`[object Function]`,`[object RegExp]`],v=i.joinArrays===void 0?this.options.joinArrays:i.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject,b=i.count!==void 0&&!vr(i.count),x=e.hasDefaultValue(i),S=b?this.pluralResolver.getSuffix(d,i.count,i):``,C=i.ordinal&&b?this.pluralResolver.getSuffix(d,i.count,{ordinal:!1}):``,w=b&&!i.ordinal&&i.count===0,T=w&&i[`defaultValue${this.options.pluralSeparator}zero`]||i[`defaultValue${S}`]||i[`defaultValue${C}`]||i.defaultValue,E=m;y&&!m&&x&&(E=T);let D=Gr(E),O=Object.prototype.toString.apply(E);if(y&&E&&D&&!_.includes(O)&&!(vr(v)&&Array.isArray(E))){if(!i.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn(`accessing an object - but returnObjects options is not enabled!`);let e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,E,{...i,ns:c}):`key '${s} (${this.language})' returned an object instead of string.`;return a?(p.res=e,p.usedParams=this.getUsedParamsDetails(i),p):e}if(o){let e=Array.isArray(E),t=e?[]:{},n=e?g:h;for(let e in E)if(Object.prototype.hasOwnProperty.call(E,e)){let r=`${n}${o}${e}`;x&&!m?t[e]=this.translate(r,{...i,defaultValue:Gr(T)?T[e]:void 0,joinArrays:!1,ns:c}):t[e]=this.translate(r,{...i,joinArrays:!1,ns:c}),t[e]===r&&(t[e]=E[e])}m=t}}else if(y&&vr(v)&&Array.isArray(m))m=m.join(v),m&&=this.extendTranslation(m,t,i,r);else{let e=!1,n=!1;!this.isValidLookup(m)&&x&&(e=!0,m=T),this.isValidLookup(m)||(n=!0,m=s);let a=(i.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&n?void 0:m,c=x&&T!==m&&this.options.updateMissing;if(n||e||c){if(this.logger.log(c?`updateKey`:`missingKey`,d,l,b&&!c?`${s}${this.pluralResolver.getSuffix(d,i.count,i)}`:s,c?T:m),o){let e=this.resolve(s,{...i,keySeparator:!1});e&&e.res&&this.logger.warn(`Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.`)}let e=[],t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,i.lng||this.language);if(this.options.saveMissingTo===`fallback`&&t&&t[0])for(let n=0;n<t.length;n++)e.push(t[n]);else this.options.saveMissingTo===`all`?e=this.languageUtils.toResolveHierarchy(i.lng||this.language):e.push(i.lng||this.language);let n=(e,t,n)=>{let r=x&&n!==m?n:a;this.options.missingKeyHandler?this.options.missingKeyHandler(e,l,t,r,c,i):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,l,t,r,c,i),this.emit(`missingKey`,e,l,t,m)};this.options.saveMissing&&(this.options.saveMissingPlurals&&b?e.forEach(e=>{let t=this.pluralResolver.getSuffixes(e,i);w&&i[`defaultValue${this.options.pluralSeparator}zero`]&&!t.includes(`${this.options.pluralSeparator}zero`)&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{n([e],s+t,i[`defaultValue${t}`]||T)})}):n(e,s,T))}m=this.extendTranslation(m,t,i,p,r),n&&m===s&&this.options.appendNamespaceToMissingKey&&(m=`${l}${u}${s}`),(n||e)&&this.options.parseMissingKeyHandler&&(m=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}${u}${s}`:s,e?m:void 0,i))}return a?(p.res=m,p.usedParams=this.getUsedParamsDetails(i),p):m}extendTranslation(e,t,n,r,i){if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...n},n.lng||this.language||r.usedLng,r.usedNS,r.usedKey,{resolved:r});else if(!n.skipInterpolation){n.interpolation&&this.interpolator.init({...n,interpolation:{...this.options.interpolation,...n.interpolation}});let a=vr(e)&&(n?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:n.interpolation.skipOnVariables),o;if(a){let t=e.match(this.interpolator.nestingRegexp);o=t&&t.length}let s=n.replace&&!vr(n.replace)?n.replace:n;if(this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),e=this.interpolator.interpolate(e,s,n.lng||this.language||r.usedLng,n),a){let t=e.match(this.interpolator.nestingRegexp),r=t&&t.length;o<r&&(n.nest=!1)}!n.lng&&r&&r.res&&(n.lng=this.language||r.usedLng),n.nest!==!1&&(e=this.interpolator.nest(e,(...e)=>i?.[0]===e[0]&&!n.context?(this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`),null):this.translate(...e,t),n)),n.interpolation&&this.interpolator.reset()}let a=n.postProcess||this.options.postProcess,o=vr(a)?[a]:a;return e!=null&&o?.length&&n.applyPostProcessor!==!1&&(e=Vr.handle(o,e,t,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...r,usedParams:this.getUsedParamsDetails(n)},...n}:n,this)),e}resolve(e,t={}){let n,r,i,a,o;return vr(e)&&(e=[e]),Array.isArray(e)&&(e=e.map(e=>typeof e==`function`?Wr(e,{...this.options,...t}):e)),e.forEach(e=>{if(this.isValidLookup(n))return;let s=this.extractFromKey(e,t),c=s.key;r=c;let l=s.namespaces;this.options.fallbackNS&&(l=l.concat(this.options.fallbackNS));let u=t.count!==void 0&&!vr(t.count),d=u&&!t.ordinal&&t.count===0,f=t.context!==void 0&&(vr(t.context)||typeof t.context==`number`)&&t.context!==``,p=t.lngs?t.lngs:this.languageUtils.toResolveHierarchy(t.lng||this.language,t.fallbackLng);l.forEach(e=>{this.isValidLookup(n)||(o=e,!this.checkedLoadedFor[`${p[0]}-${e}`]&&this.utils?.hasLoadedNamespace&&!this.utils?.hasLoadedNamespace(o)&&(this.checkedLoadedFor[`${p[0]}-${e}`]=!0,this.logger.warn(`key "${r}" for languages "${p.join(`, `)}" won't get resolved as namespace "${o}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`)),p.forEach(r=>{if(this.isValidLookup(n))return;a=r;let o=[c];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(o,c,r,e,t);else{let e;u&&(e=this.pluralResolver.getSuffix(r,t.count,t));let n=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(u&&(t.ordinal&&e.startsWith(i)&&o.push(c+e.replace(i,this.options.pluralSeparator)),o.push(c+e),d&&o.push(c+n)),f){let r=`${c}${this.options.contextSeparator||`_`}${t.context}`;o.push(r),u&&(t.ordinal&&e.startsWith(i)&&o.push(r+e.replace(i,this.options.pluralSeparator)),o.push(r+e),d&&o.push(r+n))}}let s;for(;s=o.pop();)this.isValidLookup(n)||(i=s,n=this.getResource(r,e,s,t))}))})}),{res:n,usedKey:r,exactUsedKey:i,usedLng:a,usedNS:o}}isValidLookup(e){return e!==void 0&&!(!this.options.returnNull&&e===null)&&!(!this.options.returnEmptyString&&e===``)}getResource(e,t,n,r={}){return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,n,r):this.resourceStore.getResource(e,t,n,r)}getUsedParamsDetails(e={}){let t=[`defaultValue`,`ordinal`,`context`,`replace`,`lng`,`lngs`,`fallbackLng`,`ns`,`keySeparator`,`nsSeparator`,`returnObjects`,`returnDetails`,`joinArrays`,`postProcess`,`interpolation`],n=e.replace&&!vr(e.replace),r=n?e.replace:e;if(n&&e.count!==void 0&&(r={...r,count:e.count}),this.options.interpolation.defaultVariables&&(r={...this.options.interpolation.defaultVariables,...r}),!n){r={...r};for(let e of t)delete r[e]}return r}static hasDefaultValue(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&t.startsWith(`defaultValue`)&&e[t]!==void 0)return!0;return!1}},qr=class{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Rr.create(`languageUtils`),this.resolveHierarchyCache={}}clearCache(){this.resolveHierarchyCache={}}getScriptPartFromCode(e){if(e=Ir(e),!e||!e.includes(`-`))return null;let t=e.split(`-`);return t.length===2||(t.pop(),t[t.length-1].toLowerCase()===`x`)?null:this.formatLanguageCode(t.join(`-`))}getLanguagePartFromCode(e){if(e=Ir(e),!e||!e.includes(`-`))return e;let t=e.split(`-`);return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(vr(e)&&e.includes(`-`)){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch{}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return(this.options.load===`languageOnly`||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.includes(e)}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;let n=this.formatLanguageCode(e);(!this.options.supportedLngs||this.isSupportedCode(n))&&(t=n)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;let n=this.getScriptPartFromCode(e);if(this.isSupportedCode(n))return t=n;let r=this.getLanguagePartFromCode(e);if(this.isSupportedCode(r))return t=r;t=this.options.supportedLngs.find(e=>e===r?!0:!e.includes(`-`)&&!r.includes(`-`)?!1:!!(e.includes(`-`)&&!r.includes(`-`)&&e.slice(0,e.indexOf(`-`))===r||e.startsWith(r)&&r.length>1))}),t||=this.getFallbackCodes(this.options.fallbackLng)[0],t}getFallbackCodes(e,t){if(!e)return[];if(typeof e==`function`&&(e=e(t)),vr(e)&&(e=[e]),Array.isArray(e))return e;if(!t)return e.default||[];let n=e[t];return n||=e[this.getScriptPartFromCode(t)],n||=e[this.formatLanguageCode(t)],n||=e[this.getLanguagePartFromCode(t)],n||=e.default,n||[]}toResolveHierarchy(e,t){let n=this.options.fallbackLng,r=Array.isArray(n)?n.join(`|`):n;r!==this._cachedFallbackLng&&(this.resolveHierarchyCache={},this._cachedFallbackLng=r);let i=t===void 0||t===!1||vr(t),a=t===void 0&&typeof this.options.fallbackLng==`function`,o=vr(e)&&i&&!a,s=null;if(o){let n;n=t===void 0?`undefined`:t===!1?`boolean:false`:`string:${t}`,s=`${e.length}:${e}|${n}`}if(s!==null){let e=this.resolveHierarchyCache[s];if(e!==void 0)return e.slice()}let c=this.getFallbackCodes((t===!1?[]:t)||this.options.fallbackLng||[],e),l=[],u=e=>{e&&(this.isSupportedCode(e)?l.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return vr(e)&&(e.includes(`-`)||e.includes(`_`))?(this.options.load!==`languageOnly`&&u(this.formatLanguageCode(e)),this.options.load!==`languageOnly`&&this.options.load!==`currentOnly`&&u(this.getScriptPartFromCode(e)),this.options.load!==`currentOnly`&&u(this.getLanguagePartFromCode(e))):vr(e)&&u(this.formatLanguageCode(e)),c.forEach(e=>{l.includes(e)||u(this.formatLanguageCode(e))}),s===null?l:(this.resolveHierarchyCache[s]=l,l.slice())}},Jr={zero:0,one:1,two:2,few:3,many:4,other:5},Yr={select:e=>e===1?`one`:`other`,resolvedOptions:()=>({pluralCategories:[`one`,`other`]})},Xr=class{constructor(e,t={}){this.languageUtils=e,this.options=t,this.logger=Rr.create(`pluralResolver`),this.pluralRulesCache={}}clearCache(){this.pluralRulesCache={}}getRule(e,t={}){let n=Ir(e===`dev`?`en`:e),r=t.ordinal?`ordinal`:`cardinal`,i=JSON.stringify({cleanedCode:n,type:r});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(n,{type:r})}catch{if(typeof Intl>`u`)return this.logger.error(`No Intl support, please use an Intl polyfill!`),Yr;if(!e.match(/-|_/))return Yr;let n=this.languageUtils.getLanguagePartFromCode(e);a=this.getRule(n,t)}return this.pluralRulesCache[i]=a,a}needsPlural(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t,n={}){return this.getSuffixes(e,n).map(e=>`${t}${e}`)}getSuffixes(e,t={}){let n=this.getRule(e,t);return n||=this.getRule(`dev`,t),n?n.resolvedOptions().pluralCategories.sort((e,t)=>Jr[e]-Jr[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:``}${e}`):[]}getSuffix(e,t,n={}){let r=this.getRule(e,n);return r?`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:``}${r.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix(`dev`,t,n))}},Zr=(e,t,n,r=`.`,i=!0)=>{let a=kr(e,t,n);return!a&&i&&vr(n)&&(a=Fr(e,n,r),a===void 0&&(a=Fr(t,n,r))),a},Qr=e=>e.replace(/\$/g,`$$$$`),$r=class{constructor(e={}){this.logger=Rr.create(`interpolator`),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(e={}){e.interpolation||={escapeValue:!0};let{escape:t,escapeValue:n,useRawValueToEscape:r,prefix:i,prefixEscaped:a,suffix:o,suffixEscaped:s,formatSeparator:c,unescapeSuffix:l,unescapePrefix:u,nestingPrefix:d,nestingPrefixEscaped:f,nestingSuffix:p,nestingSuffixEscaped:m,nestingOptionsSeparator:h,maxReplaces:g,alwaysFormat:_}=e.interpolation;this.escape=t===void 0?oee:t,this.escapeValue=n===void 0?!0:n,this.useRawValueToEscape=r===void 0?!1:r,this.prefix=i?jr(i):a||`{{`,this.suffix=o?jr(o):s||`}}`,this.formatSeparator=c||`,`,this.unescapePrefix=l?``:u?jr(u):`-`,this.unescapeSuffix=this.unescapePrefix?``:l?jr(l):``,this.nestingPrefix=d?jr(d):f||jr(`$t(`),this.nestingSuffix=p?jr(p):m||jr(`)`),this.nestingOptionsSeparator=h||`,`,this.maxReplaces=g||1e3,this.alwaysFormat=_===void 0?!1:_,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){let e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,`g`);this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`)}interpolate(e,t,n,r){let i,a,o,s=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},c=e=>{if(!e.includes(this.formatSeparator)){let i=Zr(t,s,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(i,void 0,n,{...r,...t,interpolationkey:e}):i}let i=e.split(this.formatSeparator),a=i.shift().trim(),o=i.join(this.formatSeparator).trim();return this.format(Zr(t,s,a,this.options.keySeparator,this.options.ignoreJSONStructure),o,n,{...r,...t,interpolationkey:a})};this.resetRegExp(),!this.escapeValue&&typeof e==`string`&&/\$t\([^)]*\{[^}]*\{\{/.test(e)&&this.logger.warn(`nesting options string contains interpolated variables with escapeValue: false — if any of those values are attacker-controlled they can inject additional nesting options (e.g. redirect lng/ns). Sanitise untrusted input before passing it to t(), or keep escapeValue: true.`);let l=r?.missingInterpolationHandler||this.options.missingInterpolationHandler,u=r?.interpolation?.skipOnVariables===void 0?this.options.interpolation.skipOnVariables:r.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>e},{regex:this.regexp,safeValue:e=>this.escapeValue?this.escape(e):e}].forEach(t=>{for(o=0;i=t.regex.exec(e);){let n=i[1].trim();if(a=c(n),a===void 0)if(typeof l==`function`){let t=l(e,i,r);a=vr(t)?t:``}else if(r&&Object.prototype.hasOwnProperty.call(r,n))a=``;else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`),a=``;else !vr(a)&&!this.useRawValueToEscape&&(a=br(a));let s=t.safeValue(a);if(e=e.replace(i[0],Qr(s)),u?(t.regex.lastIndex+=s.length,t.regex.lastIndex-=i[0].length):t.regex.lastIndex=0,o++,o>=this.maxReplaces)break}}),e}nest(e,t,n={}){let r,i,a,o=(e,t)=>{let n=this.nestingOptionsSeparator;if(!e.includes(n))return e;let r=e.split(RegExp(`${jr(n)}[ ]*{`)),i=`{${r[1]}`;e=r[0],i=this.interpolate(i,a);let o=i.match(/'/g),s=i.match(/"/g);((o?.length??0)%2==0&&!s||(s?.length??0)%2!=0)&&(i=i.replace(/'/g,`"`));try{a=JSON.parse(i),t&&(a={...t,...a})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${n}${i}`}return a.defaultValue&&a.defaultValue.includes(this.prefix)&&delete a.defaultValue,e};for(;r=this.nestingRegexp.exec(e);){let s=[];a={...n},a=a.replace&&!vr(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let c=/{.*}/s.test(r[1])?r[1].lastIndexOf(`}`)+1:r[1].indexOf(this.formatSeparator);if(c!==-1&&(s=r[1].slice(c).split(this.formatSeparator).map(e=>e.trim()).filter(Boolean),r[1]=r[1].slice(0,c)),i=t(o.call(this,r[1].trim(),a),a),i&&r[0]===e&&!vr(i))return i;vr(i)||(i=br(i)),i||=(this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`),``),s.length&&(i=s.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:r[1].trim()}),i.trim())),e=e.replace(r[0],Qr(br(i))),this.regexp.lastIndex=0}return e}},ei=e=>{let t=e.toLowerCase().trim(),n={};if(e.includes(`(`)){let r=e.split(`(`);t=r[0].toLowerCase().trim();let i=r[1].slice(0,-1);t===`currency`&&!i.includes(`:`)?n.currency||=i.trim():t===`relativetime`&&!i.includes(`:`)?n.range||=i.trim():i.split(`;`).forEach(e=>{if(e){let[t,...r]=e.split(`:`),i=r.join(`:`).trim().replace(/^'+|'+$/g,``),a=t.trim();n[a]||(n[a]=i),i===`false`&&(n[a]=!1),i===`true`&&(n[a]=!0),isNaN(i)||(n[a]=parseInt(i,10))}})}return{formatName:t,formatOptions:n}},ti=e=>{let t={};return(n,r,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});let o=r+JSON.stringify(a),s=t[o];return s||(s=e(Ir(r),i),t[o]=s),s(n)}},ni=e=>(t,n,r)=>e(Ir(n),r)(t),ri=class{constructor(e={}){this.logger=Rr.create(`formatter`),this.options=e,this.init(e)}init(e,t={interpolation:{}}){this.formatSeparator=t.interpolation.formatSeparator||`,`;let n=t.cacheInBuiltFormats?ti:ni;this.formats={number:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t});return e=>n.format(e)}),currency:n((e,t)=>{let n=new Intl.NumberFormat(e,{...t,style:`currency`});return e=>n.format(e)}),datetime:n((e,t)=>{let n=new Intl.DateTimeFormat(e,{...t});return e=>n.format(e)}),relativetime:n((e,t)=>{let n=new Intl.RelativeTimeFormat(e,{...t});return e=>n.format(e,t.range||`day`)}),list:n((e,t)=>{let n=new Intl.ListFormat(e,{...t});return e=>n.format(e)})}}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=ti(t)}format(e,t,n,r={}){if(!t||e==null)return e;let i=t.split(this.formatSeparator),a=[];for(let e=0;e<i.length;e++){let t=i[e];for(;t.indexOf(`(`)>-1&&!t.includes(`)`)&&e+1<i.length;)t=`${t}${this.formatSeparator}${i[++e]}`;a.push(t)}return a.reduce((e,t)=>{let{formatName:i,formatOptions:a}=ei(t);if(this.formats[i]){let t=e;try{let o=r?.formatParams?.[r.interpolationkey]||{},s=o.locale||o.lng||r.locale||r.lng||n;t=this.formats[i](e,s,{...a,...r,...o})}catch(e){this.logger.warn(e)}return t}else this.logger.warn(`there was no format function for ${i}`);return e},e)}},ii=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)},ai=class extends zr{constructor(e,t,n,r={}){super(),this.backend=e,this.store=t,this.services=n,this.languageUtils=n.languageUtils,this.options=r,this.logger=Rr.create(`backendConnector`),this.waitingReads=[],this.maxParallelReads=r.maxParallelReads||10,this.readingCalls=0,this.maxRetries=r.maxRetries>=0?r.maxRetries:5,this.retryTimeout=r.retryTimeout>=1?r.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(n,r.backend,r)}queueLoad(e,t,n,r){let i={},a={},o={},s={};return e.forEach(e=>{let r=!0;t.forEach(t=>{let o=`${e}|${t}`;!n.reload&&this.store.hasResourceBundle(e,t)?this.state[o]=2:this.state[o]<0||(this.state[o]===1?a[o]===void 0&&(a[o]=!0):(this.state[o]=1,r=!1,a[o]===void 0&&(a[o]=!0),i[o]===void 0&&(i[o]=!0),s[t]===void 0&&(s[t]=!0)))}),r||(o[e]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:r}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(o),toLoadNamespaces:Object.keys(s)}}loaded(e,t,n){let r=e.split(`|`),i=r[0],a=r[1];t&&this.emit(`failedLoading`,i,a,t),!t&&n&&this.store.addResourceBundle(i,a,n,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&n&&(this.state[e]=0);let o={};this.queue.forEach(n=>{Dr(n.loaded,[i],a),ii(n,e),t&&n.errors.push(t),n.pendingCount===0&&!n.done&&(Object.keys(n.loaded).forEach(e=>{o[e]||(o[e]={});let t=n.loaded[e];t.length&&t.forEach(t=>{o[e][t]===void 0&&(o[e][t]=!0)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit(`loaded`,o),this.queue=this.queue.filter(e=>!e.done)}read(e,t,n,r=0,i=this.retryTimeout,a){if(!e.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:e,ns:t,fcName:n,tried:r,wait:i,callback:a});return}this.readingCalls++;let o=(o,s)=>{if(this.readingCalls--,this.waitingReads.length>0){let e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}if(o&&s&&r<this.maxRetries){setTimeout(()=>{this.read(e,t,n,r+1,i*2,a)},i);return}a(o,s)},s=this.backend[n].bind(this.backend);if(s.length===2){try{let n=s(e,t);n&&typeof n.then==`function`?n.then(e=>o(null,e)).catch(o):o(null,n)}catch(e){o(e)}return}return s(e,t,o)}prepareLoading(e,t,n={},r){if(!this.backend)return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`),r&&r();vr(e)&&(e=this.languageUtils.toResolveHierarchy(e)),vr(t)&&(t=[t]);let i=this.queueLoad(e,t,n,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,n){this.prepareLoading(e,t,{},n)}reload(e,t,n){this.prepareLoading(e,t,{reload:!0},n)}loadOne(e,t=``){let n=e.split(`|`),r=n[0],i=n[1];this.read(r,i,`read`,void 0,void 0,(n,a)=>{n&&this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`,n),!n&&a&&this.logger.log(`${t}loaded namespace ${i} for language ${r}`,a),this.loaded(e,n,a)})}saveMissing(e,t,n,r,i,a={},o=()=>{}){if(this.services?.utils?.hasLoadedNamespace&&!this.services?.utils?.hasLoadedNamespace(t)){this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`,`This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);return}if(!(n==null||n===``)){if(this.backend?.create){let s={...a,isUpdate:i},c=this.backend.create.bind(this.backend);if(c.length<6)try{let i;i=c.length===5?c(e,t,n,r,s):c(e,t,n,r),i&&typeof i.then==`function`?i.then(e=>o(null,e)).catch(o):o(null,i)}catch(e){o(e)}else c(e,t,n,r,o,s)}!e||!e[0]||this.store.addResource(e[0],t,n,r)}}},oi=()=>({debug:!1,initAsync:!0,ns:[`translation`],defaultNS:[`translation`],fallbackLng:[`dev`],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:`all`,preload:!1,keySeparator:`.`,nsSeparator:`:`,pluralSeparator:`_`,contextSeparator:`_`,enableSelector:!1,partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:`fallback`,saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]==`object`&&(t=e[1]),vr(e[1])&&(t.defaultValue=e[1]),vr(e[2])&&(t.tDescription=e[2]),typeof e[2]==`object`||typeof e[3]==`object`){let n=e[3]||e[2];Object.keys(n).forEach(e=>{t[e]=n[e]})}return t},interpolation:{escapeValue:!0,prefix:`{{`,suffix:`}}`,formatSeparator:`,`,unescapePrefix:`-`,nestingPrefix:`$t(`,nestingSuffix:`)`,nestingOptionsSeparator:`,`,maxReplaces:1e3,skipOnVariables:!0},cacheInBuiltFormats:!0}),si=e=>(vr(e.ns)&&(e.ns=[e.ns]),vr(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),vr(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&!e.supportedLngs.includes(`cimode`)&&(e.supportedLngs=e.supportedLngs.concat([`cimode`])),e),ci=()=>{},li=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(t=>{typeof e[t]==`function`&&(e[t]=e[t].bind(e))})},ui=class e extends zr{constructor(e={},t){if(super(),this.options=si(e),this.services={},this.logger=Rr,this.modules={external:[]},li(this),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(e={},t){this.isInitializing=!0,typeof e==`function`&&(t=e,e={}),e.defaultNS==null&&e.ns&&(vr(e.ns)?e.defaultNS=e.ns:e.ns.includes(`translation`)||(e.defaultNS=e.ns[0]));let n=oi();this.options={...n,...this.options,...si(e)},this.options.interpolation={...n.interpolation,...this.options.interpolation},e.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=e.keySeparator),e.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=e.nsSeparator),typeof this.options.overloadTranslationOptionHandler!=`function`&&(this.options.overloadTranslationOptionHandler=n.overloadTranslationOptionHandler);let r=e=>e?typeof e==`function`?new e:e:null;if(!this.options.isClone){this.modules.logger?Rr.init(r(this.modules.logger),this.options):Rr.init(null,this.options);let e;e=this.modules.formatter?this.modules.formatter:ri;let t=new qr(this.options);this.store=new Br(this.options.resources,this.options);let n=this.services;n.logger=Rr,n.resourceStore=this.store,n.languageUtils=t,n.pluralResolver=new Xr(t,{prepend:this.options.pluralSeparator}),e&&(n.formatter=r(e),n.formatter.init&&n.formatter.init(n,this.options),this.options.interpolation.format=n.formatter.format.bind(n.formatter)),n.interpolator=new $r(this.options),n.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},n.backendConnector=new ai(r(this.modules.backend),n.resourceStore,n,this.options),n.backendConnector.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.languageDetector&&(n.languageDetector=r(this.modules.languageDetector),n.languageDetector.init&&n.languageDetector.init(n,this.options.detection,this.options)),this.modules.i18nFormat&&(n.i18nFormat=r(this.modules.i18nFormat),n.i18nFormat.init&&n.i18nFormat.init(this)),this.translator=new Kr(this.services,this.options),this.translator.on(`*`,(e,...t)=>{this.emit(e,...t)}),this.modules.external.forEach(e=>{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,t||=ci,this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){let e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&e[0]!==`dev`&&(this.options.lng=e[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn(`init: no languageDetector is used and no lng is defined`),[`getResource`,`hasResourceBundle`,`getResourceBundle`,`getDataByLanguage`].forEach(e=>{this[e]=(...t)=>this.store[e](...t)}),[`addResource`,`addResources`,`addResourceBundle`,`removeResourceBundle`].forEach(e=>{this[e]=(...t)=>(this.store[e](...t),this)});let i=yr(),a=()=>{let e=(e,n)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn(`init: i18next is already initialized. You should call init just once!`),this.isInitialized=!0,this.options.isClone||this.logger.log(`initialized`,this.options),this.emit(`initialized`,this.options),i.resolve(n),t(e,n)};if((this.languages||this.isLanguageChangingTo)&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?a():setTimeout(a,0),i}loadResources(e,t=ci){let n=t,r=vr(e)?e:this.language;if(typeof e==`function`&&(n=e),!this.options.resources||this.options.partialBundledLanguages){if(r?.toLowerCase()===`cimode`&&(!this.options.preload||this.options.preload.length===0))return n();let e=[],t=t=>{t&&t!==`cimode`&&this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{t!==`cimode`&&(e.includes(t)||e.push(t))})};r?t(r):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e)),this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{!e&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),n(e)})}else n(null)}reloadResources(e,t,n){let r=yr();return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=void 0),e||=this.languages,t||=this.options.ns,n||=ci,this.services.backendConnector.reload(e,t,e=>{r.resolve(),n(e)}),r}use(e){if(!e)throw Error(`You are passing an undefined module! Please check the object you are passing to i18next.use()`);if(!e.type)throw Error(`You are passing a wrong module! Please check the object you are passing to i18next.use()`);return e.type===`backend`&&(this.modules.backend=e),(e.type===`logger`||e.log&&e.warn&&e.error)&&(this.modules.logger=e),e.type===`languageDetector`&&(this.modules.languageDetector=e),e.type===`i18nFormat`&&(this.modules.i18nFormat=e),e.type===`postProcessor`&&Vr.addPostProcessor(e),e.type===`formatter`&&(this.modules.formatter=e),e.type===`3rdParty`&&this.modules.external.push(e),this}setResolvedLanguage(e){if(!(!e||!this.languages)&&![`cimode`,`dev`].includes(e)){for(let e=0;e<this.languages.length;e++){let t=this.languages[e];if(![`cimode`,`dev`].includes(t)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}!this.resolvedLanguage&&!this.languages.includes(e)&&this.store.hasLanguageSomeTranslations(e)&&(this.resolvedLanguage=e,this.languages.unshift(e))}}changeLanguage(e,t){this.isLanguageChangingTo=e;let n=yr();this.emit(`languageChanging`,e);let r=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},i=(i,a)=>{a?this.isLanguageChangingTo===e&&(r(a),this.translator.changeLanguage(a),this.isLanguageChangingTo=void 0,this.emit(`languageChanged`,a),this.logger.log(`languageChanged`,a)):this.isLanguageChangingTo=void 0,n.resolve((...e)=>this.t(...e)),t&&t(i,(...e)=>this.t(...e))},a=t=>{!e&&!t&&this.services.languageDetector&&(t=[]);let n=vr(t)?t:t&&t[0],a=this.store.hasLanguageSomeTranslations(n)?n:this.services.languageUtils.getBestMatchFromCodes(vr(t)?[t]:t);a&&(this.language||r(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{i(e,a)})};return!e&&this.services.languageDetector&&!this.services.languageDetector.async?a(this.services.languageDetector.detect()):!e&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(a):this.services.languageDetector.detect(a):a(e),n}getFixedT(e,t,n,r){let i=r?.scopeNs,a=(e,t,...r)=>{let o;o=typeof t==`object`?{...t}:this.options.overloadTranslationOptionHandler([e,t].concat(r)),o.lng=o.lng||a.lng,o.lngs=o.lngs||a.lngs;let s=o.ns!==void 0&&o.ns!==null;o.ns=o.ns||a.ns,o.keyPrefix!==``&&(o.keyPrefix=o.keyPrefix||n||a.keyPrefix);let c={...this.options,...o};Array.isArray(i)&&!s&&(c.ns=i),typeof o.keyPrefix==`function`&&(o.keyPrefix=Wr(o.keyPrefix,c));let l=this.options.keySeparator||`.`,u;return o.keyPrefix&&Array.isArray(e)?u=e.map(e=>(typeof e==`function`&&(e=Wr(e,c)),`${o.keyPrefix}${l}${e}`)):(typeof e==`function`&&(e=Wr(e,c)),u=o.keyPrefix?`${o.keyPrefix}${l}${e}`:e),this.t(u,o)};return vr(e)?a.lng=e:a.lngs=e,a.ns=t,a.keyPrefix=n,a}t(...e){return this.translator?.translate(...e)}exists(...e){return this.translator?.exists(...e)}setDefaultNamespace(e){this.options.defaultNS=e}hasLoadedNamespace(e,t={}){if(!this.isInitialized)return this.logger.warn(`hasLoadedNamespace: i18next was not initialized`,this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn(`hasLoadedNamespace: i18n.languages were undefined or empty`,this.languages),!1;let n=t.lng||this.resolvedLanguage||this.languages[0],r=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(n.toLowerCase()===`cimode`)return!0;let a=(e,t)=>{let n=this.services.backendConnector.state[`${e}|${t}`];return n===-1||n===0||n===2};if(t.precheck){let e=t.precheck(this,a);if(e!==void 0)return e}return!!(this.hasResourceBundle(n,e)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(n,e)&&(!r||a(i,e)))}loadNamespaces(e,t){let n=yr();return this.options.ns?(vr(e)&&(e=[e]),e.forEach(e=>{this.options.ns.includes(e)||this.options.ns.push(e)}),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}loadLanguages(e,t){let n=yr();vr(e)&&(e=[e]);let r=this.options.preload||[],i=e.filter(e=>!r.includes(e)&&this.services.languageUtils.isSupportedCode(e));return i.length?(this.options.preload=r.concat(i),this.loadResources(e=>{n.resolve(),t&&t(e)}),n):(t&&t(),Promise.resolve())}dir(e){if(e||=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language),!e)return`rtl`;try{let t=new Intl.Locale(e);if(t&&t.getTextInfo){let e=t.getTextInfo();if(e&&e.direction)return e.direction}}catch{}let t=`ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb`.split(`.`),n=this.services?.languageUtils||new qr(oi());return e.toLowerCase().indexOf(`-latn`)>1?`ltr`:t.includes(n.getLanguagePartFromCode(e))||e.toLowerCase().indexOf(`-arab`)>1?`rtl`:`ltr`}static createInstance(t={},n){let r=new e(t,n);return r.createInstance=e.createInstance,r}cloneInstance(t={},n=ci){let r=t.forkResourceStore;r&&delete t.forkResourceStore;let i={...this.options,...t,isClone:!0},a=new e(i);if((t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),[`store`,`services`,`language`].forEach(e=>{a[e]=this[e]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},r&&(a.store=new Br(Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},e[t]=Object.keys(e[t]).reduce((n,r)=>(n[r]={...e[t][r]},n),e[t]),e),{}),i),a.services.resourceStore=a.store),t.interpolation){let e={...oi().interpolation,...this.options.interpolation,...t.interpolation},n={...i,interpolation:e};a.services.interpolator=new $r(n)}return a.translator=new Kr(a.services,i),a.translator.on(`*`,(e,...t)=>{a.emit(e,...t)}),a.init(i,n),a.translator.options=i,a.translator.backendConnector.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},a}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}.createInstance();ui.createInstance,ui.dir,ui.init,ui.loadResources,ui.reloadResources,ui.use,ui.changeLanguage,ui.getFixedT,ui.t,ui.exists,ui.setDefaultNamespace,ui.hasLoadedNamespace,ui.loadNamespaces,ui.loadLanguages;var di={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,"!doctype":!0,"!DOCTYPE":!0},fi=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?("[^"]*"|'[^']*')/g;function pi(e){let t={type:`tag`,name:``,voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(di[n[1]]||e.charAt(e.length-2)===`/`)&&(t.voidElement=!0),t.name.startsWith(`!--`))){let t=e.indexOf(`-->`);return{type:`comment`,comment:t===-1?``:e.slice(4,t)}}let r=new RegExp(fi),i=null;for(;i=r.exec(e),i!==null;)if(i[0].trim())if(i[1]){let e=i[1].trim(),n=[e,null],a=e.indexOf(`=`);a>-1&&(n=[e.slice(0,a),e.slice(a+1)]),t.attrs[n[0]]=n[1],r.lastIndex--}else i[2]&&(t.attrs[i[2]]=i[3].trim().substring(1,i[3].length-1));return t}var mi=/<!--[\s\S]*?-->|<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,hi=/<\/?([^\s]+?)[/\s>]/,gi=/^\s*$/,_i=/^(script|style)$/i,vi=`\0`,yi=Object.create(null);function bi(e){e.forEach(function(e){if(e.type===`text`){e.content=e.content.split(vi).join(`<`);return}if(e.type===`comment`){e.comment=e.comment.split(vi).join(`<`);return}for(let t in e.attrs){let n=e.attrs[t];typeof n==`string`&&n.indexOf(vi)>-1&&(e.attrs[t]=n.split(vi).join(`<`))}e.children.length&&bi(e.children)})}function xi(e,t){let n=t&&t.components||yi,r=t&&t.allowedTags,i=!1;if(r){let t=typeof r==`function`?r:function(e){return r.indexOf(e)>-1},n=``,a=0;mi.lastIndex=0;let o;for(;o=mi.exec(e);){let r=o[0];n+=e.slice(a,o.index);let s=r.match(hi);r.startsWith(`<!--`)||s&&t(s[1])?(n+=r,a=o.index+r.length):(i=!0,n+=vi,a=o.index+1,mi.lastIndex=a)}e=n+e.slice(a)}let a=[],o=[],s,c=-1,l=!1,u=0,d;if(e.indexOf(`<`)!==0){let t=e.indexOf(`<`);a.push({type:`text`,content:t===-1?e:e.substring(0,t)})}let f=[],p;for(;p=mi.exec(e);)f.push(p);return f.forEach(function(e,t){let n=e[0];if(!n||n.startsWith(`<!--`))return;let r=0,i=0,a=-1,o=null;for(let e=0;e<n.length;e++){let t=n.charAt(e);o?t===o&&(o=null):t===`"`||t===`'`?o=t:t===`<`?(r++,r===2&&(a=e)):t===`>`&&i++}let s=a>-1&&/[a-zA-Z0-9\-!/]/.test(n.charAt(a+1));if(r>i&&s){let e=n.substring(0,a),r=n.substring(e.length);f[t][0]=r,f[t].index+=e.length}}),f.forEach(function(t,r){let i=t[0];if(!i)return;let p=t.index;if(p<u)return;if(l){if(i!==`</`+s.name+`>`)return;l=!1}let m=i.charAt(1)!==`/`,h=i.startsWith(`<!--`),g=p+i.length,_=e.charAt(g),v=f[r+1],y;if(_===`<`&&v){let t=e.substring(g,v.index);y=t.split(`<`).length>t.split(`>`).length}let b;if(h){let t=pi(i);if(c<0)return a.push(t),a;b=o[c],b.children.push(t);let n=e.slice(g,v?v.index:void 0);return n.length>0&&b.children.push({type:`text`,content:n}),a}if(m){c++,s=pi(i),s.type===`tag`&&n[s.name]&&(s.type=`component`,l=!0);let t=!1;if(!l&&!s.voidElement&&_i.test(s.name)){t=!0,d||=e.toLowerCase();let n=d.indexOf(`</`+s.name.toLowerCase()+`>`,g),r=n===-1?e.length:n,i=e.slice(g,r);i&&s.children.push({type:`text`,content:i}),u=r}!s.voidElement&&!l&&!t&&_&&_!==`<`&&s.children.push({type:`text`,content:e.slice(g,v?v.index:void 0)}),c===0&&a.push(s),b=o[c-1],b&&b.children.push(s),o[c]=s}if((!m||s.voidElement)&&(c>-1&&(s.voidElement||s.name===i.slice(2,-1))&&(c--,s=c===-1?a:o[c]),!l&&(_!==`<`||y)&&_)){b=c===-1?a:o[c].children;let t=v?v.index:-1,n=e.slice(g,t===-1?void 0:t);gi.test(n)&&(n=` `),(t>-1&&c+b.length>=0||n!==` `)&&b.push({type:`text`,content:n})}}),i&&bi(a),a}function Si(e){let t=[];for(let n in e)e[n]===null?t.push(n):t.push(n+`="`+String(e[n]).replace(/"/g,`&quot;`)+`"`);return t.length?` `+t.join(` `):``}function Ci(e,t){switch(t.type){case`text`:return e+t.content;case`tag`:{let n=t.voidElement&&t.name.toLowerCase()!==`!doctype`?`/>`:`>`;return e+=`<`+t.name+(t.attrs?Si(t.attrs):``)+n,t.voidElement?e:e+t.children.reduce(Ci,``)+`</`+t.name+`>`}case`comment`:return e+=`<!--`+t.comment+`-->`,e}}function wi(e){return e.reduce(function(e,t){return e+Ci(``,t)},``)}var Ti={parse:xi,stringify:wi},Ei=(e,t,n,r)=>{let i=[n,{code:t,...r||{}}];if(e?.services?.logger?.forward)return e.services.logger.forward(i,`warn`,`react-i18next::`,!0);Ni(i[0])&&(i[0]=`react-i18next:: ${i[0]}`),e?.services?.logger?.warn?e.services.logger.warn(...i):console?.warn&&console.warn(...i)},Di={},Oi=(e,t,n,r)=>{Ni(n)&&Di[n]||(Ni(n)&&(Di[n]=new Date),Ei(e,t,n,r))},ki=(e,t)=>()=>{if(e.isInitialized)t();else{let n=()=>{setTimeout(()=>{e.off(`initialized`,n)},0),t()};e.on(`initialized`,n)}},Ai=(e,t,n)=>{e.loadNamespaces(t,ki(e,n))},ji=(e,t,n,r)=>{if(Ni(n)&&(n=[n]),e.options.preload&&e.options.preload.indexOf(t)>-1)return Ai(e,n,r);n.forEach(t=>{e.options.ns.indexOf(t)<0&&e.options.ns.push(t)}),e.loadLanguages(t,ki(e,r))},Mi=(e,t,n={})=>!t.languages||!t.languages.length?(Oi(t,`NO_LANGUAGES`,`i18n.languages were undefined or empty`,{languages:t.languages}),!0):t.hasLoadedNamespace(e,{lng:n.lng,precheck:(t,r)=>{if(n.bindI18n&&n.bindI18n.indexOf(`languageChanging`)>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!r(t.isLanguageChangingTo,e))return!1}}),Ni=e=>typeof e==`string`,Pi=e=>typeof e==`object`&&!!e,Fi=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Ii={"&amp;":`&`,"&#38;":`&`,"&lt;":`<`,"&#60;":`<`,"&gt;":`>`,"&#62;":`>`,"&apos;":`'`,"&#39;":`'`,"&quot;":`"`,"&#34;":`"`,"&nbsp;":` `,"&#160;":` `,"&copy;":`©`,"&#169;":`©`,"&reg;":`®`,"&#174;":`®`,"&hellip;":`…`,"&#8230;":`…`,"&#x2F;":`/`,"&#47;":`/`},Li=e=>Ii[e],Ri=e=>e.replace(Fi,Li),zi={bindI18n:`languageChanged`,bindI18nStore:``,transEmptyNodeValue:``,transSupportBasicHtmlNodes:!0,transWrapTextNodes:``,transKeepBasicHtmlNodesFor:[`br`,`strong`,`i`,`p`],useSuspense:!0,unescape:Ri,transDefaultProps:void 0},Bi=(e={})=>{zi={...zi,...e}},Vi=()=>zi,Hi,Ui=e=>{Hi=e},Wi=()=>Hi,Gi=(e,t)=>{if(!e)return!1;let n=e.props?.children??e.children;return t?n.length>0:!!n},Ki=e=>{if(!e)return[];let t=e.props?.children??e.children;return e.props?.i18nIsDynamicList?qi(t):t},lee=e=>qi(e).every(H.isValidElement),qi=e=>Array.isArray(e)?e:[e],Ji=(e,t)=>{let n={...t};return n.props={...t.props,...e.props},n},Yi=e=>{let t={};if(!e)return t;let n=e=>{qi(e).forEach(e=>{Ni(e)||(Gi(e)?n(Ki(e)):Pi(e)&&!(0,H.isValidElement)(e)&&Object.assign(t,e))})};return n(e),t},Xi=(e,t,n,r)=>{if(!e)return``;let i=``,a=qi(e),o=t?.transSupportBasicHtmlNodes?t.transKeepBasicHtmlNodesFor??[]:[];return a.forEach((e,a)=>{if(Ni(e)){i+=`${e}`;return}if((0,H.isValidElement)(e)){let{props:s,type:c}=e,l=Object.keys(s).length,u=o.indexOf(c)>-1,d=s.children;if(!d&&u&&!l){i+=`<${c}/>`;return}if(!d&&(!u||l)||s.i18nIsDynamicList){i+=`<${a}></${a}>`;return}if(u&&l<=1){let e=Ni(d)?d:Xi(d,t,n,r);i+=`<${c}>${e}</${c}>`;return}let f=Xi(d,t,n,r);i+=`<${a}>${f}</${a}>`;return}if(e===null){Ei(n,`TRANS_NULL_VALUE`,`Passed in a null value as child`,{i18nKey:r});return}if(Pi(e)){let{format:t,...a}=e,o=Object.keys(a);if(o.length===1){let e=t?`${o[0]}, ${t}`:o[0];i+=`{{${e}}}`;return}Ei(n,`TRANS_INVALID_OBJ`,`Invalid child - Object should only have keys {{ value, format }} (format is optional).`,{i18nKey:r,child:e});return}Ei(n,`TRANS_INVALID_VAR`,`Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`,{i18nKey:r,child:e})}),i},Zi=(e,t,n,r,i,a,o)=>{if(n===``)return[];let s=i.transKeepBasicHtmlNodesFor||[],c=n&&new RegExp(s.map(e=>`<${e}`).join(`|`)).test(n);if(!e&&!t&&!c&&!o)return[n];let l=t??{},u=e=>{qi(e).forEach(e=>{Ni(e)||(Gi(e)?u(Ki(e)):Pi(e)&&!(0,H.isValidElement)(e)&&Object.assign(l,e))})};u(e);let d=Object.keys(l),f=Ti.parse(`<0>${n}</0>`,{allowedTags:e=>/^\d+$/.test(e)||s.indexOf(e)>-1||d.indexOf(e)>-1}),p={...l,...a},m=(e,t,n)=>{let r=Ki(e),i=g(r,t.children,n);return lee(r)&&i.length===0||e.props?.i18nIsDynamicList?r:i},h=(e,t,n,r,i)=>{e.dummy?(e.children=t,n.push((0,H.cloneElement)(e,{key:r},i?void 0:t))):n.push(...H.Children.map([e],e=>{if(e.type===H.Fragment||e.props?.i18nIsDynamicList!==void 0){let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`children`||t===`i18nIsDynamicList`||(n[t]=e.props[t])}),(0,H.createElement)(e.type,n,i?null:t)}let n={key:r};return e&&e.props&&Object.keys(e.props).forEach(t=>{t===`ref`||t===`children`||(n[t]=e.props[t])}),(0,H.cloneElement)(e,n,i?null:t)}))},g=(e,n,a)=>{let l=qi(e),u=qi(n),d={};return u.reduce((e,n,u)=>{let f=n.children?.[0]?.content&&r.services.interpolator.interpolate(n.children[0].content,p,r.language);if(n.type===`tag`){let _=l[parseInt(n.name,10)];!_&&t&&(_=t[n.name]),a.length===1&&!_&&(_=a[0][n.name]),_||={};let v={...n.attrs};o&&Object.keys(v).forEach(e=>{let t=v[e];Ni(t)&&(v[e]=Ri(t))});let y=Object.keys(v).length===0?_:Ji({props:v},_),b=(0,H.isValidElement)(y),x=b&&Gi(n,!0)&&!n.voidElement,S=c&&Pi(y)&&y.dummy&&!b,C=Pi(t)&&Object.hasOwnProperty.call(t,n.name);if(Ni(y)){let t=r.services.interpolator.interpolate(y,p,r.language);e.push(t)}else if(Gi(y)||x)h(y,m(y,n,a),e,u);else if(S)h(y,g(l,n.children,a),e,u);else if(Number.isNaN(parseFloat(n.name)))if(C)h(y,m(y,n,a),e,u,n.voidElement);else if(i.transSupportBasicHtmlNodes&&s.indexOf(n.name)>-1)if(n.voidElement)e.push((0,H.createElement)(n.name,{key:`${n.name}-${u}`}));else{let t=d[n.name]||0;d[n.name]=t+1;let r,i=0;for(let e=0;e<l.length;e+=1){let a=l[e];if((0,H.isValidElement)(a)&&a.type===n.name){if(i===t){r=a;break}i+=1}}let o=g(r?qi(Ki(r)):l,n.children,a);e.push((0,H.createElement)(n.name,{key:`${n.name}-${u}`},o))}else if(n.voidElement)e.push(`<${n.name} />`);else{let t=g(l,n.children,a);e.push(`<${n.name}>${t}</${n.name}>`)}else if(Pi(y)&&!b){let t=n.children[0]?f:null;t&&e.push(t)}else h(y,f,e,u,n.children.length!==1||!f)}else if(n.type===`text`){let t=i.transWrapTextNodes,a=typeof i.unescape==`function`?i.unescape:Vi().unescape,s=o?a(r.services.interpolator.interpolate(n.content,p,r.language)):r.services.interpolator.interpolate(n.content,p,r.language);t?e.push((0,H.createElement)(t,{key:`${n.name}-${u}`},s)):e.push(s)}return e},[])};return Ki(g([{dummy:!0,children:e||[]}],f,qi(e||[]))[0])},Qi=(e,t,n)=>{let r=e.key||t,i=(0,H.cloneElement)(e,{key:r});if(!i.props||!i.props.children||n.indexOf(`${t}/>`)<0&&n.indexOf(`${t} />`)<0)return i;function a(){return(0,H.createElement)(H.Fragment,null,i)}return(0,H.createElement)(a,{key:r})},$i=(e,t)=>e.map((e,n)=>Qi(e,n,t)),ea=(e,t)=>{let n={};return Object.keys(e).forEach(r=>{Object.assign(n,{[r]:Qi(e[r],r,t)})}),n},ta=(e,t,n,r)=>e?Array.isArray(e)?$i(e,t):Pi(e)?ea(e,t):(Oi(n,`TRANS_INVALID_COMPONENTS`,`<Trans /> "components" prop expects an object or array`,{i18nKey:r}),null):null,na=e=>!Pi(e)||Array.isArray(e)?!1:Object.keys(e).reduce((e,t)=>e&&Number.isNaN(Number.parseFloat(t)),!0);function uee({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let m=u||Wi();if(!m)return Oi(m,`NO_I18NEXT_INSTANCE`,`Trans: You need to pass in an i18next instance using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`,{i18nKey:r}),e;let h=d||m.t.bind(m)||(e=>e),g={...Vi(),...m.options?.react},_=l||h.ns||m.options?.defaultNS;_=Ni(_)?[_]:_||[`translation`];let{transDefaultProps:v}=g,y=v?.tOptions?{...v.tOptions,...a}:a,b=f??v?.shouldUnescape,x=v?.values?{...v.values,...o}:o,S=v?.components?{...v.components,...c}:c,C=Xi(e,g,m,r),w=s||y?.defaultValue||C||g.transEmptyNodeValue||(typeof r==`function`?Wr(r):r),{hashTransKey:T}=g,E=r||(T?T(C||w):C||w);o=m.options?.interpolation?.defaultVariables?x&&Object.keys(x).length>0?{...x,...m.options.interpolation.defaultVariables}:{...m.options.interpolation.defaultVariables}:x;let D=Yi(e);D&&typeof D.count==`number`&&t===void 0&&(t=D.count);let O=o||t!==void 0&&!m.options?.interpolation?.alwaysFormat||!e?y.interpolation:{interpolation:{...y.interpolation,prefix:`#$?`,suffix:`?$#`}},k={...y,context:i||y.context,count:t,...o,...O,defaultValue:w,ns:_},A=E?h(E,k):w;A===E&&w&&(A=w);let j=ta(S,A,m,r),M=j||e,N=null;na(j)&&(N=j,M=e);let P=Zi(M,N,A,m,g,k,b),F=n??g.defaultTransParent;return F?(0,H.createElement)(F,p,P):P}var ra={type:`3rdParty`,init(e){Bi(e.options.react),Ui(e)}},ia=(0,H.createContext)(),aa=class{constructor(){this.usedNamespaces={}}addUsedNamespaces(e){e.forEach(e=>{this.usedNamespaces[e]||(this.usedNamespaces[e]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}};function oa({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a={},values:o,defaults:s,components:c,ns:l,i18n:u,t:d,shouldUnescape:f,...p}){let{i18n:m,defaultNS:h}=(0,H.useContext)(ia)||{},g=u||m||Wi(),_=d||g?.t.bind(g);return uee({children:e,count:t,parent:n,i18nKey:r,context:i,tOptions:a,values:o,defaults:s,components:c,ns:l||_?.ns||h||g?.options?.defaultNS,i18n:g,t:d,shouldUnescape:f,...p})}var sa=a((e=>{var t=Jt();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),ca=a(((e,t)=>{t.exports=sa()})),la=ca(),ua={t:(e,t)=>{if(Ni(t))return t;if(Pi(t)&&Ni(t.defaultValue))return t.defaultValue;if(typeof e==`function`)return``;if(Array.isArray(e)){let t=e[e.length-1];return typeof t==`function`?``:t}return e},ready:!1},da=()=>()=>{},fa=(e,t={})=>{let{i18n:n}=t,{i18n:r,defaultNS:i}=(0,H.useContext)(ia)||{},a=n||r||Wi();a&&!a.reportNamespaces&&(a.reportNamespaces=new aa),a||Oi(a,`NO_I18NEXT_INSTANCE`,`useTranslation: You will need to pass in an i18next instance by using initReactI18next or by passing it via props or context. In monorepo setups, make sure there is only one instance of react-i18next.`);let o=(0,H.useMemo)(()=>({...Vi(),...a?.options?.react,...t}),[a,t]),{useSuspense:s,keyPrefix:c}=o,l=e||i||a?.options?.defaultNS,u=Ni(l)?[l]:l||[`translation`],d=(0,H.useMemo)(()=>u,u);a?.reportNamespaces?.addUsedNamespaces?.(d);let f=(0,H.useRef)(0),p=(0,H.useCallback)(e=>{if(!a)return da;let{bindI18n:t,bindI18nStore:n}=o,r=()=>{f.current+=1,e()};return t&&a.on(t,r),n&&a.store.on(n,r),()=>{t&&t.split(` `).forEach(e=>a.off(e,r)),n&&n.split(` `).forEach(e=>a.store.off(e,r))}},[a,o]),m=(0,H.useRef)(),h=(0,H.useCallback)(()=>{if(!a)return ua;let e=!!(a.isInitialized||a.initializedStoreOnce)&&d.every(e=>Mi(e,a,o)),n=t.lng||a.language,r=f.current,i=m.current;if(i&&i.ready===e&&i.lng===n&&i.keyPrefix===c&&i.revision===r)return i;let s={t:a.getFixedT(n,o.nsMode===`fallback`?d:d[0],c,{scopeNs:d}),ready:e,lng:n,keyPrefix:c,revision:r};return m.current=s,s},[a,d,c,o,t.lng]),[g,_]=(0,H.useState)(0),{t:v,ready:y}=(0,la.useSyncExternalStore)(p,h,h);(0,H.useEffect)(()=>{if(a&&!y&&!s){let e=()=>_(e=>e+1);t.lng?ji(a,t.lng,d,e):Ai(a,d,e)}},[a,t.lng,d,y,s,g]);let b=a||{},x=(0,H.useRef)(null),S=(0,H.useRef)(),C=e=>`${e.language}|${e.resolvedLanguage}|${e.languages?.join(`,`)}`,w=e=>{let t=Object.getOwnPropertyDescriptors(e);t.__original&&delete t.__original;let n=Object.create(Object.getPrototypeOf(e),t);if(!Object.prototype.hasOwnProperty.call(n,`__original`))try{Object.defineProperty(n,`__original`,{value:e,writable:!1,enumerable:!1,configurable:!1})}catch{}return n},T=(0,H.useMemo)(()=>{let e=b,t=e&&C(e),n=e;e&&(x.current&&x.current.__original===e&&S.current===t?n=x.current:(n=w(e),x.current=n,S.current=t));let r=!y&&!s?(...e)=>(Oi(a,`USE_T_BEFORE_READY`,`useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t.`),v(...e)):v,i=[r,n,y];return i.t=r,i.i18n=n,i.ready=y,i},[v,b,y,b.resolvedLanguage,b.language,b.languages]);if(a&&s&&!y){let e=!1;try{e=!1}catch{}throw e&&Oi(a,`SUSPENDED_WHILE_LOADING`,`useTranslation: suspended while translations are loading (useSuspense is true by default). Add a <Suspense> boundary above this component, or set react.useSuspense: false in the i18next init options. https://react.i18next.com/latest/usetranslation-hook`),new Promise(e=>{let n=()=>e();t.lng?ji(a,t.lng,d,n):Ai(a,d,n)})}return T},pa=[{code:`en`,name:`English`},{code:`de`,name:`Deutsch`}],ma={de:()=>vn(()=>import(`./de-D62EvVe8.js`),[])},ha=`zuplo-language`,ga=e=>pa.some(({code:t})=>t===e),_a={lng:`en`,fallbackLng:`en`,supportedLngs:pa.map(({code:e})=>e),resources:{en:{translation:{}}},initAsync:!1,keySeparator:!1,nsSeparator:!1,returnEmptyString:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1,transWrapTextNodes:`span`}},va=()=>{try{let e=localStorage.getItem(ha);return ga(e)?e:`en`}catch{return`en`}},ya=ui.createInstance();ya.on(`languageChanged`,e=>{typeof document<`u`&&(document.documentElement.lang=e)}),ya.use(ra).init(_a);var ba=`en`,xa=async e=>{if(ba=e,e!==`en`&&!ya.hasResourceBundle(e,`translation`)){let{default:t}=await ma[e]();ya.addResourceBundle(e,`translation`,t)}ba===e&&await ya.changeLanguage(e)},Sa=e=>xa(e).catch(()=>{}),Ca=va();Ca!==`en`&&Sa(Ca);var wa=e=>{throw TypeError(e)},Ta=(e,t,n)=>t.has(e)||wa(`Cannot `+n),Ea=(e,t,n)=>(Ta(e,t,`read from private field`),n?n.call(e):t.get(e)),Da=(e,t,n)=>t.has(e)?wa(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Oa=`popstate`;function ka(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return Pa(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:Fa(t)}return La(t,n,null,e)}function Aa(e,t){if(e===!1||e==null)throw Error(t)}function ja(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Ma(){return Math.random().toString(36).substring(2,10)}function Na(e,t){return{usr:e.state,key:e.key,idx:t}}function Pa(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?Ia(t):t,state:n,key:t&&t.key||r||Ma()}}function Fa({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function Ia(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function La(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=Pa(h.location,e,t);n&&n(r,e),l=u()+1;let d=Na(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=Pa(h.location,e,t);n&&n(r,e),l=u();let i=Na(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Ra(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Oa,d),c=e,()=>{i.removeEventListener(Oa,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Ra(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),Aa(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:Fa(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}var za,Ba=class{constructor(e){if(Da(this,za,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Ea(this,za).has(e))return Ea(this,za).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){Ea(this,za).set(e,t)}};za=new WeakMap;var Va=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function Ha(e){return Va.has(e)}var Ua=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function Wa(e){return Ua.has(e)}function Ga(e){return e.index===!0}function Ka(e,t,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Aa(e.index!==!0||!e.children,`Cannot specify children on an index route`),Aa(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),Ga(e)){let n={...e,...t(e),id:s};return r[s]=n,n}else{let n={...e,...t(e),id:s,children:void 0};return r[s]=n,e.children&&(n.children=Ka(e.children,t,o,r,i)),n}})}function qa(e,t,n=`/`){return Ja(e,t,n,!1)}function Ja(e,t,n,r){let i=mo((typeof t==`string`?Ia(t):t).pathname||`/`,n);if(i==null)return null;let a=Xa(e);Qa(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=po(i);o=co(a[e],t,r)}return o}function Ya(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function Xa(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Aa(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=So([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Aa(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Xa(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:oo(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Za(e.path))a(e,t,!0,n)}),t}function Za(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Za(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Qa(e){e.sort((e,t)=>e.score===t.score?so(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var $a=/^:[\w-]+$/,eo=3,to=2,no=1,ro=10,io=-2,ao=e=>e===`*`;function oo(e,t){let n=e.split(`/`),r=n.length;return n.some(ao)&&(r+=io),t&&(r+=to),n.filter(e=>!ao(e)).reduce((e,t)=>e+($a.test(t)?eo:t===``?no:ro),r)}function so(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function co(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=uo({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=uo({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:So([a,u.pathname]),pathnameBase:Co(So([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=So([a,u.pathnameBase]))}return o}function lo(e,t={}){let n=e;n.endsWith(`*`)&&n!==`*`&&!n.endsWith(`/*`)&&(ja(!1,`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,`/*`)}".`),n=n.replace(/\*$/,`/*`));let r=n.startsWith(`/`)?`/`:``,i=e=>e==null?``:typeof e==`string`?e:String(e);return r+n.split(/\/+/).map((e,n,r)=>{if(n===r.length-1&&e===`*`)return i(t[`*`]);let a=e.match(/^:([\w-]+)(\??)$/);if(a){let[,e,n]=a,r=t[e];return Aa(n===`?`||r!=null,`Missing ":${e}" param`),encodeURIComponent(i(r))}return e.replace(/\?$/g,``)}).filter(e=>!!e).join(`/`)}function uo(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=fo(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function fo(e,t=!1,n=!0){ja(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function po(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return ja(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function mo(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function ho({basename:e,pathname:t}){return t===`/`?e:So([e,t])}function go(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?Ia(e):e;return{pathname:n?n.startsWith(`/`)?n:_o(n,t):t,search:wo(r),hash:To(i)}}function _o(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function vo(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function yo(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function bo(e){let t=yo(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function xo(e,t,n,r=!1){let i;typeof e==`string`?i=Ia(e):(i={...e},Aa(!i.pathname||!i.pathname.includes(`?`),vo(`?`,`pathname`,`search`,i)),Aa(!i.pathname||!i.pathname.includes(`#`),vo(`#`,`pathname`,`hash`,i)),Aa(!i.search||!i.search.includes(`#`),vo(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=go(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var So=e=>e.join(`/`).replace(/\/\/+/g,`/`),Co=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),wo=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,To=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Eo=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Do(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Oo=[`POST`,`PUT`,`PATCH`,`DELETE`],ko=new Set(Oo),Ao=[`GET`,...Oo],jo=new Set(Ao),Mo=new Set([301,302,303,307,308]),No=new Set([307,308]),Po={state:`idle`,location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Fo={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Io={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},dee=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Lo=e=>dee.test(e),Ro=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),zo=`remix-router-transitions`,Bo=Symbol(`ResetLoaderData`);function Vo(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Aa(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties||Ro,a={},o=Ka(e.routes,i,void 0,a),s,c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||is,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=e.hydrationData!=null,_=qa(o,e.history.location,c),v=!1,y=null,b;if(_==null&&!e.patchRoutesOnNavigation){let t=ws(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=Cs(o);b=!0,_=n,y={[r.id]:t}}else if(_&&!e.hydrationData&&ze(_,o,e.history.location.pathname).active&&(_=null),!_){b=!1,_=[];let t=ze(null,o,e.history.location.pathname);t.active&&t.matches&&(v=!0,_=t.matches)}else if(_.some(e=>e.route.lazy))b=!1;else if(!_.some(e=>Ko(e.route)))b=!0;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null;if(n){let e=_.findIndex(e=>n[e.route.id]!==void 0);b=_.slice(0,e+1).every(e=>!qo(e.route,t,n))}else b=_.every(e=>!qo(e.route,t,n))}let x,S={historyAction:e.history.action,location:e.history.location,matches:_,initialized:b,navigation:Po,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||y,fetchers:new Map,blockers:new Map},C=`POP`,w=!1,T,E=!1,D=new Map,O=null,k=!1,A=!1,j=new Set,M=new Map,N=0,P=-1,F=new Map,I=new Set,L=new Map,R=new Map,z=new Set,B=new Map,ee,te=null;function V(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ee){ee(),ee=void 0;return}ja(B.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=Ne({currentLocation:S.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ee=e});e.history.go(r*-1),Me(i,{state:`blocked`,location:n,proceed(){Me(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(S.blockers);e.set(i,Io),ie({blockers:e})}});return}return ce(t,n)}),n){Ws(t,D);let e=()=>Gs(t,D);t.addEventListener(`pagehide`,e),O=()=>t.removeEventListener(`pagehide`,e)}return S.initialized||ce(`POP`,S.location,{initialHydration:!0}),x}function ne(){d&&d(),O&&O(),f.clear(),T&&T.abort(),S.fetchers.forEach((e,t)=>we(t)),S.blockers.forEach((e,t)=>je(t))}function re(e){return f.add(e),()=>f.delete(e)}function ie(e,t={}){e.matches&&=e.matches.map(e=>{let t=a[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),S={...S,...e};let n=[],r=[];S.fetchers.forEach((e,t)=>{e.state===`idle`&&(z.has(t)?n.push(t):r.push(t))}),z.forEach(e=>{!S.fetchers.has(e)&&!M.has(e)&&n.push(e)}),[...f].forEach(e=>e(S,{deletedFetchers:n,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>we(e)),r.forEach(e=>S.fetchers.delete(e))}function ae(t,n,{flushSync:r}={}){let i=S.actionData!=null&&S.navigation.formMethod!=null&&Fs(S.navigation.formMethod)&&S.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?S.actionData:null;let c=n.loaderData?bs(S.loaderData,n.loaderData,n.matches||[],n.errors):S.loaderData,l=S.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,Io)));let u=k?!1:Re(t,n.matches||S.matches),d=w===!0||S.navigation.formMethod!=null&&Fs(S.navigation.formMethod)&&t.state?._isRedirect!==!0;s&&=(o=s,void 0),k||C===`POP`||(C===`PUSH`?e.history.push(t,t.state):C===`REPLACE`&&e.history.replace(t,t.state));let f;if(C===`POP`){let e=D.get(S.location.pathname);e&&e.has(t.pathname)?f={currentLocation:S.location,nextLocation:t}:D.has(t.pathname)&&(f={currentLocation:t,nextLocation:S.location})}else if(E){let e=D.get(S.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),D.set(S.location.pathname,e)),f={currentLocation:S.location,nextLocation:t}}ie({...n,actionData:a,loaderData:c,historyAction:C,location:t,initialized:!0,navigation:Po,revalidation:`idle`,restoreScrollPosition:u,preventScrollReset:d,blockers:l},{viewTransitionOpts:f,flushSync:r===!0}),C=`POP`,w=!1,E=!1,k=!1,A=!1,te?.resolve(),te=null}async function oe(t,n){if(typeof t==`number`){e.history.go(t);return}let{path:r,submission:i,error:a}=Wo(!1,Uo(S.location,S.matches,c,t,n?.fromRouteId,n?.relative),n),o=S.location,s=Pa(S.location,r,n&&n.state);s={...s,...e.history.encodeLocation(s)};let l=n&&n.replace!=null?n.replace:void 0,u=`PUSH`;l===!0?u=`REPLACE`:l===!1||i!=null&&Fs(i.formMethod)&&i.formAction===S.location.pathname+S.location.search&&(u=`REPLACE`);let d=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,f=(n&&n.flushSync)===!0,p=Ne({currentLocation:o,nextLocation:s,historyAction:u});if(p){Me(p,{state:`blocked`,location:s,proceed(){Me(p,{state:`proceeding`,proceed:void 0,reset:void 0,location:s}),oe(t,n)},reset(){let e=new Map(S.blockers);e.set(p,Io),ie({blockers:e})}});return}await ce(u,s,{submission:i,pendingError:a,preventScrollReset:d,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:f})}function se(){te||=Ks(),ye(),ie({revalidation:`loading`});let e=te.promise;return S.navigation.state===`submitting`?e:S.navigation.state===`idle`?(ce(S.historyAction,S.location,{startUninterruptedRevalidation:!0}),e):(ce(C||S.historyAction,S.navigation.location,{overrideNavigation:S.navigation,enableViewTransition:E===!0}),e)}async function ce(t,n,r){T&&T.abort(),T=null,C=t,k=(r&&r.startUninterruptedRevalidation)===!0,Le(S.location,S.matches),w=(r&&r.preventScrollReset)===!0,E=(r&&r.enableViewTransition)===!0;let i=s||o,a=r&&r.overrideNavigation,l=r?.initialHydration&&S.matches&&S.matches.length>0&&!v?S.matches:qa(i,n,c),u=(r&&r.flushSync)===!0;if(l&&S.initialized&&!A&&Ds(S.location,n)&&!(r&&r.submission&&Fs(r.submission.formMethod))){ae(n,{matches:l},{flushSync:u});return}let d=ze(l,i,n.pathname);if(d.active&&d.matches&&(l=d.matches),!l){let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);ae(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:u});return}T=new AbortController;let f=gs(e.history,n,T.signal,r&&r.submission),p=e.getContext?await e.getContext():new Ba,m;if(r&&r.pendingError)m=[Ss(l).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&Fs(r.submission.formMethod)){let t=await le(f,n,r.submission,l,p,d.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:u});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,r]=t.pendingActionResult;if(js(r)&&Do(r.error)&&r.error.status===404){T=null,ae(n,{matches:t.matches,loaderData:{},errors:{[e]:r.error}});return}}l=t.matches||l,m=t.pendingActionResult,a=zs(n,r.submission),u=!1,d.active=!1,f=gs(e.history,f.url,f.signal)}let{shortCircuited:h,matches:g,loaderData:_,errors:y}=await ue(f,n,l,p,d.active,a,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,u,m);h||(T=null,ae(n,{matches:g||l,...xs(m),loaderData:_,errors:y}))}async function le(e,t,n,s,l,u,d,f={}){if(ye(),ie({navigation:Bs(t,n)},{flushSync:f.flushSync===!0}),u){let n=await Be(s,t.pathname,e.signal);if(n.type===`aborted`)return{shortCircuited:!0};if(n.type===`error`){if(n.partialMatches.length===0){let{matches:e,route:t}=Cs(o);return{matches:e,pendingActionResult:[t.id,{type:`error`,error:n.error}]}}let e=Ss(n.partialMatches).route.id;return{matches:n.partialMatches,pendingActionResult:[e,{type:`error`,error:n.error}]}}else if(n.matches)s=n.matches;else{let{notFoundMatches:e,error:n,route:r}=Pe(t.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:n}]}}}let p,m=Ls(s,t);if(!m.route.action&&!m.route.lazy)p={type:`error`,error:ws(405,{method:e.method,pathname:t.pathname,routeId:m.route.id})};else{let t=await _e(e,us(i,a,e,s,m,d?[]:r,l),l,null);if(p=t[m.route.id],!p){for(let e of s)if(t[e.route.id]){p=t[e.route.id];break}}if(e.signal.aborted)return{shortCircuited:!0}}if(Ms(p)){let t;return t=f&&f.replace!=null?f.replace:hs(p.response.headers.get(`Location`),new URL(e.url),c)===S.location.pathname+S.location.search,await ge(e,p,!0,{submission:n,replace:t}),{shortCircuited:!0}}if(js(p)){let e=Ss(s,m.route.id);return(f&&f.replace)!==!0&&(C=`PUSH`),{matches:s,pendingActionResult:[e.route.id,p,m.route.id]}}return{matches:s,pendingActionResult:[m.route.id,p]}}async function ue(t,n,l,u,d,f,p,m,h,g,_,v){let y=f||zs(n,p),b=p||m||Rs(y),x=!k&&!g;if(d){if(x){let e=de(v);ie({navigation:y,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Be(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=Cs(o);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=Ss(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)l=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Pe(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s||o,{dsMatches:w,revalidatingFetchers:E}=Go(t,u,i,a,e.history,S,l,b,n,g?[]:r,g===!0,A,j,z,L,I,C,c,e.patchRoutesOnNavigation!=null,v);if(P=++N,!e.dataStrategy&&!w.some(e=>e.shouldLoad)&&!w.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=Oe();return ae(n,{matches:l,loaderData:{},errors:v&&js(v[1])?{[v[0]]:v[1].error}:null,...xs(v),...e?{fetchers:new Map(S.fetchers)}:{}},{flushSync:_}),{shortCircuited:!0}}if(x){let e={};if(!d){e.navigation=y;let t=de(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=fe(E)),ie(e,{flushSync:_})}E.forEach(e=>{Ee(e.key),e.controller&&M.set(e.key,e.controller)});let D=()=>E.forEach(e=>Ee(e.key));T&&T.signal.addEventListener(`abort`,D);let{loaderResults:O,fetcherResults:F}=await ve(w,E,t,u);if(t.signal.aborted)return{shortCircuited:!0};T&&T.signal.removeEventListener(`abort`,D),E.forEach(e=>M.delete(e.key));let R=Ts(O);if(R)return await ge(t,R.result,!0,{replace:h}),{shortCircuited:!0};if(R=Ts(F),R)return I.add(R.key),await ge(t,R.result,!0,{replace:h}),{shortCircuited:!0};let{loaderData:B,errors:ee}=ys(S,l,O,v,E,F);g&&S.errors&&(ee={...S.errors,...ee});let te=Oe(),V=ke(P),ne=te||V||E.length>0;return{matches:l,loaderData:B,errors:ee,...ne?{fetchers:new Map(S.fetchers)}:{}}}function de(e){if(e&&!js(e[1]))return{[e[0]]:e[1].data};if(S.actionData)return Object.keys(S.actionData).length===0?null:S.actionData}function fe(e){return e.forEach(e=>{let t=S.fetchers.get(e.key),n=Vs(void 0,t?t.data:void 0);S.fetchers.set(e.key,n)}),new Map(S.fetchers)}async function pe(t,n,r,i){Ee(t);let a=(i&&i.flushSync)===!0,l=s||o,u=Uo(S.location,S.matches,c,r,n,i?.relative),d=qa(l,u,c),f=ze(d,l,u);if(f.active&&f.matches&&(d=f.matches),!d){xe(t,n,ws(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=Wo(!0,u,i);if(h){xe(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new Ba,_=(i&&i.preventScrollReset)===!0;if(m&&Fs(m.formMethod)){await me(t,n,p,d,g,f.active,a,_,m);return}L.set(t,{routeId:n,path:p}),await he(t,n,p,d,g,f.active,a,_,m)}async function me(t,n,l,u,d,f,p,m,h){ye(),L.delete(t),be(t,Hs(h,S.fetchers.get(t)),{flushSync:p});let g=new AbortController,_=gs(e.history,l,g.signal,h);if(f){let e=await Be(u,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:p});return}else if(e.matches)u=e.matches;else{xe(t,n,ws(404,{pathname:l}),{flushSync:p});return}}let v=Ls(u,l);if(!v.route.action&&!v.route.lazy){xe(t,n,ws(405,{method:h.formMethod,pathname:l,routeId:n}),{flushSync:p});return}M.set(t,g);let y=N,b=(await _e(_,us(i,a,_,u,v,r,d),d,t))[v.route.id];if(_.signal.aborted){M.get(t)===g&&M.delete(t);return}if(z.has(t)){if(Ms(b)||js(b)){be(t,Us(void 0));return}}else{if(Ms(b))if(M.delete(t),P>y){be(t,Us(void 0));return}else return I.add(t),be(t,Vs(h)),ge(_,b,!1,{fetcherSubmission:h,preventScrollReset:m});if(js(b)){xe(t,n,b.error);return}}let x=S.navigation.location||S.location,w=gs(e.history,x,g.signal),E=s||o,D=S.navigation.state===`idle`?S.matches:qa(E,S.navigation.location,c);Aa(D,`Didn't find any matches after fetcher action`);let O=++N;F.set(t,O);let k=Vs(h,b.data);S.fetchers.set(t,k);let{dsMatches:R,revalidatingFetchers:B}=Go(w,d,i,a,e.history,S,D,h,x,r,!1,A,j,z,L,I,E,c,e.patchRoutesOnNavigation!=null,[v.route.id,b]);B.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=S.fetchers.get(t),r=Vs(void 0,n?n.data:void 0);S.fetchers.set(t,r),Ee(t),e.controller&&M.set(t,e.controller)}),ie({fetchers:new Map(S.fetchers)});let ee=()=>B.forEach(e=>Ee(e.key));g.signal.addEventListener(`abort`,ee);let{loaderResults:te,fetcherResults:V}=await ve(R,B,w,d);if(g.signal.aborted)return;if(g.signal.removeEventListener(`abort`,ee),F.delete(t),M.delete(t),B.forEach(e=>M.delete(e.key)),S.fetchers.has(t)){let e=Us(b.data);S.fetchers.set(t,e)}let ne=Ts(te);if(ne)return ge(w,ne.result,!1,{preventScrollReset:m});if(ne=Ts(V),ne)return I.add(ne.key),ge(w,ne.result,!1,{preventScrollReset:m});let{loaderData:re,errors:oe}=ys(S,D,te,void 0,B,V);ke(O),S.navigation.state===`loading`&&O>P?(Aa(C,`Expected pending action`),T&&T.abort(),ae(S.navigation.location,{matches:D,loaderData:re,errors:oe,fetchers:new Map(S.fetchers)})):(ie({errors:oe,loaderData:bs(S.loaderData,re,D,oe),fetchers:new Map(S.fetchers)}),A=!1)}async function he(t,n,o,s,c,l,u,d,f){let p=S.fetchers.get(t);be(t,Vs(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=gs(e.history,o,m.signal);if(l){let e=await Be(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){xe(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{xe(t,n,ws(404,{pathname:o}),{flushSync:u});return}}let g=Ls(s,o);M.set(t,m);let _=N,v=(await _e(h,us(i,a,h,s,g,r,c),c,t))[g.route.id];if(M.get(t)===m&&M.delete(t),!h.signal.aborted){if(z.has(t)){be(t,Us(void 0));return}if(Ms(v))if(P>_){be(t,Us(void 0));return}else{I.add(t),await ge(h,v,!1,{preventScrollReset:d});return}if(js(v)){xe(t,n,v.error);return}be(t,Us(v.data))}}async function ge(e,r,i,{submission:a,fetcherSubmission:o,preventScrollReset:s,replace:l}={}){r.response.headers.has(`X-Remix-Revalidate`)&&(A=!0);let u=r.response.headers.get(`Location`);Aa(u,`Expected a Location header on the redirect Response`),u=hs(u,new URL(e.url),c);let d=Pa(S.location,u,{_isRedirect:!0});if(n){let e=!1;if(r.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(Lo(u)){let n=Ra(u,!0);e=n.origin!==t.location.origin||mo(n.pathname,c)==null}if(e){l?t.location.replace(u):t.location.assign(u);return}}T=null;let f=l===!0||r.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:p,formAction:m,formEncType:h}=S.navigation;!a&&!o&&p&&m&&h&&(a=Rs(S.navigation));let g=a||o;No.has(r.response.status)&&g&&Fs(g.formMethod)?await ce(f,d,{submission:{...g,formAction:u},preventScrollReset:s||w,enableViewTransition:i?E:void 0}):await ce(f,d,{overrideNavigation:zs(d,a),fetcherSubmission:o,preventScrollReset:s||w,enableViewTransition:i?E:void 0})}async function _e(e,t,n,r){let i,a={};try{i=await ds(l,e,t,r,n,!1)}catch(e){return t.filter(e=>e.shouldLoad).forEach(t=>{a[t.route.id]={type:`error`,error:e}}),a}if(e.signal.aborted)return a;for(let[n,r]of Object.entries(i))if(As(r)){let i=r.result;a[n]={type:`redirect`,response:ms(i,e,n,t,c)}}else a[n]=await ps(r);return a}async function ve(e,t,n,r){let i=_e(n,e,r,null),a=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await _e(e.request,e.matches,r,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:ws(404,{pathname:e.path})}})}));return{loaderResults:await i,fetcherResults:(await a).reduce((e,t)=>Object.assign(e,t),{})}}function ye(){A=!0,L.forEach((e,t)=>{M.has(t)&&j.add(t),Ee(t)})}function be(e,t,n={}){S.fetchers.set(e,t),ie({fetchers:new Map(S.fetchers)},{flushSync:(n&&n.flushSync)===!0})}function xe(e,t,n,r={}){let i=Ss(S.matches,t);we(e),ie({errors:{[i.route.id]:n},fetchers:new Map(S.fetchers)},{flushSync:(r&&r.flushSync)===!0})}function Se(e){return R.set(e,(R.get(e)||0)+1),z.has(e)&&z.delete(e),S.fetchers.get(e)||Fo}function Ce(e,t){Ee(e,t?.reason),be(e,Us(null))}function we(e){let t=S.fetchers.get(e);M.has(e)&&!(t&&t.state===`loading`&&F.has(e))&&Ee(e),L.delete(e),F.delete(e),I.delete(e),z.delete(e),j.delete(e),S.fetchers.delete(e)}function Te(e){let t=(R.get(e)||0)-1;t<=0?(R.delete(e),z.add(e)):R.set(e,t),ie({fetchers:new Map(S.fetchers)})}function Ee(e,t){let n=M.get(e);n&&(n.abort(t),M.delete(e))}function De(e){for(let t of e){let e=Us(Se(t).data);S.fetchers.set(t,e)}}function Oe(){let e=[],t=!1;for(let n of I){let r=S.fetchers.get(n);Aa(r,`Expected fetcher: ${n}`),r.state===`loading`&&(I.delete(n),e.push(n),t=!0)}return De(e),t}function ke(e){let t=[];for(let[n,r]of F)if(r<e){let e=S.fetchers.get(n);Aa(e,`Expected fetcher: ${n}`),e.state===`loading`&&(Ee(n),F.delete(n),t.push(n))}return De(t),t.length>0}function Ae(e,t){let n=S.blockers.get(e)||Io;return B.get(e)!==t&&B.set(e,t),n}function je(e){S.blockers.delete(e),B.delete(e)}function Me(e,t){let n=S.blockers.get(e)||Io;Aa(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(S.blockers);r.set(e,t),ie({blockers:r})}function Ne({currentLocation:e,nextLocation:t,historyAction:n}){if(B.size===0)return;B.size>1&&ja(!1,`A router only supports one blocker at a time`);let r=Array.from(B.entries()),[i,a]=r[r.length-1],o=S.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Pe(e){let t=ws(404,{pathname:e}),{matches:n,route:r}=Cs(s||o);return{notFoundMatches:n,route:r,error:t}}function Fe(e,t,n){if(p=e,h=t,m=n||null,!g&&S.navigation===Po){g=!0;let e=Re(S.location,S.matches);e!=null&&ie({restoreScrollPosition:e})}return()=>{p=null,h=null,m=null}}function Ie(e,t){return m&&m(e,t.map(e=>Ya(e,S.loaderData)))||e.key}function Le(e,t){if(p&&h){let n=Ie(e,t);p[n]=h()}}function Re(e,t){if(p){let n=Ie(e,t),r=p[n];if(typeof r==`number`)return r}return null}function ze(t,n,r){if(e.patchRoutesOnNavigation){if(!t)return{active:!0,matches:Ja(n,r,c,!0)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:Ja(n,r,c,!0)}}return{active:!1,matches:null}}async function Be(t,n,r,l){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let u=t;for(;;){let t=s==null,d=s||o,f=a;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:u,fetcherKey:l,patch:(e,t)=>{r.aborted||Zo(e,t,d,f,i,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:u}}finally{t&&!r.aborted&&(o=[...o])}if(r.aborted)return{type:`aborted`};let p=qa(d,n,c);if(p)return{type:`success`,matches:p};let m=Ja(d,n,c,!0);if(!m||u.length===m.length&&u.every((e,t)=>e.route.id===m[t].route.id))return{type:`success`,matches:null};u=m}}function Ve(e){a={},s=Ka(e,i,void 0,a)}function He(e,t,n=!1){let r=s==null;Zo(e,t,s||o,a,i,n),r&&(o=[...o],ie({}))}return x={get basename(){return c},get future(){return u},get state(){return S},get routes(){return o},get window(){return t},initialize:V,subscribe:re,enableScrollRestoration:Fe,navigate:oe,fetch:pe,revalidate:se,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Se,resetFetcher:Ce,deleteFetcher:Te,dispose:ne,getBlocker:Ae,deleteBlocker:je,patchRoutes:He,_internalFetchControllers:M,_internalSetRoutes:Ve,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){ie(e)}},x}function Ho(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function Uo(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=xo(r||`.`,bo(o),mo(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=Is(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=ho({basename:n,pathname:c.pathname})),Fa(c)}function Wo(e,t,n){if(!n||!Ho(n))return{path:t};if(n.formMethod&&!mee(n.formMethod))return{path:t,error:ws(405,{method:n.formMethod})};let r=()=>({path:t,error:ws(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=Es(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!Fs(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}
11
11
  `,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!Fs(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Aa(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=_s(n.formData),s=n.formData;else if(n.body instanceof FormData)o=_s(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=vs(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=vs(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(Fs(c.formMethod))return{path:t,submission:c};let l=Ia(t);return e&&l.search&&Is(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:Fa(l),submission:c}}function Go(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){let b=y?js(y[1])?y[1].error:y[1].data:void 0,x=i.createURL(a.location),S=i.createURL(c),C;if(u&&a.errors){let e=Object.keys(a.errors)[0];C=o.findIndex(t=>t.route.id===e)}else if(y&&js(y[1])){let e=y[0];C=o.findIndex(t=>t.route.id===e)-1}let w=y?y[1].statusCode:void 0,T=w&&w>=400,E={currentUrl:x,currentParams:a.matches[0]?.params||{},nextUrl:S,nextParams:o[0].params,...s,actionResult:b,actionStatus:w},D=o.map((i,o)=>{let{route:s}=i,c=null;if(C!=null&&o>C?c=!1:s.lazy?c=!0:Ko(s)?u?c=qo(s,a.loaderData,a.errors):Jo(a.loaderData,a.matches[o],i)&&(c=!0):c=!1,c!==null)return ls(n,r,e,i,l,t,c);let f=T?!1:d||x.pathname+x.search===S.pathname+S.search||x.search!==S.search||Yo(a.matches[o],i),p={...E,defaultShouldRevalidate:f};return ls(n,r,e,i,l,t,Xo(i,p),p)}),O=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,y=qa(g,e.path,_);if(!y){if(v&&m)return;O.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let b=Ls(y,e.path),x=new AbortController,S=gs(i,e.path,x.signal),C=null;if(f.has(s))f.delete(s),C=us(n,r,S,y,b,l,t);else if(m)d&&(C=us(n,r,S,y,b,l,t));else{let e={...E,defaultShouldRevalidate:T?!1:d};Xo(b,e)&&(C=us(n,r,S,y,b,l,t,e))}C&&O.push({key:s,routeId:e.routeId,path:e.path,matches:C,match:b,request:S,controller:x})}),{dsMatches:D,revalidatingFetchers:O}}function Ko(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function qo(e,t,n){if(e.lazy)return!0;if(!Ko(e))return!1;let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;return!r&&i?!1:typeof e.loader==`function`&&e.loader.hydrate===!0?!0:!r&&!i}function Jo(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function Yo(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function Xo(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function Zo(e,t,n,r,i,a){let o;if(e){let t=r[e];Aa(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>Qo(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=Ka(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=Ka([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}}function Qo(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((e,n)=>t.children?.some(t=>Qo(e,t))):!1}var $o=new WeakMap,es=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Aa(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=$o.get(i);o||(o={},$o.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=Ha(e),n=i[e]!==void 0&&e!==`hasErrorBoundary`;if(t)ja(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)ja(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},ts=new WeakMap;function ns(e,t,n,r,i){let a=n[e.id];if(Aa(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=ts.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Aa(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=Wa(e),o=a[e]!==void 0&&e!==`hasErrorBoundary`;i?ja(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?ja(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return ts.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=es({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function rs(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function is(e){return e.matches.some(e=>e.route.middleware)?as(e,()=>rs(e)):rs(e)}function as(e,t){return os(e,t,e=>e,Os,n);function n(t,n,r){if(r)return Promise.resolve(Object.assign(r.value,{[n]:{type:`error`,result:t}}));{let{matches:r}=e,i=Ss(r,r[Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.unstable_shouldCallHandler()),0))].route.id).route.id;return Promise.resolve({[i]:{type:`error`,result:t}})}}}async function os(e,t,n,r,i){let{matches:a,request:o,params:s,context:c}=e,l=a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]);return await ss({request:o,params:s,context:c},l,t,n,r,i)}async function ss(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await ss(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function cs(e,t,n,r,i){let a=es({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=ns(r.route,Fs(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function ls(e,t,n,r,i,a,o,s=null){let c=!1,l=cs(e,t,n,r,i);return{...r,_lazyPromises:l,shouldLoad:o,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler(e){return c=!0,s?typeof e==`boolean`?Xo(r,{...s,defaultShouldRevalidate:e}):Xo(r,s):o},resolve(e){let{lazy:t,loader:i,middleware:s}=r.route,u=c||o||e&&!Fs(n.method)&&(t||i),d=s&&s.length>0&&!i&&!t;return u&&!d?fee({request:n,match:r,lazyHandlerPromise:l?.handler,lazyRoutePromise:l?.route,handlerOverride:e,scopedContext:a}):Promise.resolve({type:`data`,result:void 0})}}}function us(e,t,n,r,i,a,o,s=null){return r.map(r=>r.route.id===i.route.id?ls(e,t,n,r,a,o,!0,s):{...r,shouldLoad:!1,unstable_shouldRevalidateArgs:s,unstable_shouldCallHandler:()=>!1,_lazyPromises:cs(e,t,n,r,a),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function ds(e,t,n,r,i,a){n.some(e=>e._lazyPromises?.middleware)&&await Promise.all(n.map(e=>e._lazyPromises?.middleware));let o={request:t,params:n[0].params,context:i,matches:n},s=a?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=o;return as(t,()=>e({...t,fetcherKey:r,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},c=await e({...o,fetcherKey:r,runClientMiddleware:s});try{await Promise.all(n.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return c}async function fee({request:e,match:t,lazyHandlerPromise:n,lazyRoutePromise:r,handlerOverride:i,scopedContext:a}){let o,s,c=Fs(e.method),l=c?`action`:`loader`,u=n=>{let r,o=new Promise((e,t)=>r=t);s=()=>r(),e.signal.addEventListener(`abort`,s);let c=r=>typeof n==`function`?n({request:e,params:t.params,context:a},...r===void 0?[]:[r]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${l}" [routeId: ${t.route.id}]`)),u=(async()=>{try{return{type:`data`,result:await(i?i(e=>c(e)):c())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([u,o])};try{let i=c?t.route.action:t.route.loader;if(n||r)if(i){let e,[t]=await Promise.all([u(i).catch(t=>{e=t}),n,r]);if(e!==void 0)throw e;o=t}else{await n;let i=c?t.route.action:t.route.loader;if(i)[o]=await Promise.all([u(i),r]);else if(l===`action`){let n=new URL(e.url),r=n.pathname+n.search;throw ws(405,{method:e.method,pathname:r,routeId:t.route.id})}else return{type:`data`,result:void 0}}else if(i)o=await u(i);else{let t=new URL(e.url);throw ws(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{s&&e.signal.removeEventListener(`abort`,s)}return o}async function fs(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function ps(e){let{result:t,type:n}=e;if(Ps(t)){let e;try{e=await fs(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new Eo(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?Ns(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:new Eo(t.init?.status||500,void 0,t.data),statusCode:Do(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:Do(t)?t.status:void 0}:Ns(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function ms(e,t,n,r,i){let a=e.headers.get(`Location`);if(Aa(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!Lo(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=Uo(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}function hs(e,t,n){if(Lo(e)){let r=e,i=r.startsWith(`//`)?new URL(t.protocol+r):new URL(r),a=mo(i.pathname,n)!=null;if(i.origin===t.origin&&a)return i.pathname+i.search+i.hash}return e}function gs(e,t,n,r){let i=e.createURL(Es(t)).toString(),a={signal:n};if(r&&Fs(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=_s(r.formData):a.body=r.formData}return new Request(i,a)}function _s(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function vs(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function pee(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&js(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Aa(!Ms(f),`Cannot handle redirect results in processLoaderData`),js(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=Ss(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=Bo),c||(c=!0,s=Do(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function ys(e,t,n,r,i,a){let{loaderData:o,errors:s}=pee(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let o=a[n];if(Aa(o,`Did not find corresponding fetcher result`),js(o)){let t=Ss(e.matches,r?.route.id);s&&s[t.route.id]||(s={...s,[t.route.id]:o.error}),e.fetchers.delete(n)}else if(Ms(o))Aa(!1,`Unhandled fetcher revalidation redirect`);else{let t=Us(o.data);e.fetchers.set(n,t)}}),{loaderData:o,errors:s}}function bs(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==Bo).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function xs(e){return e?js(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function Ss(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.hasErrorBoundary===!0)||e[0]}function Cs(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function ws(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new Eo(e||500,o,Error(s),!0)}function Ts(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(Ms(r))return{key:n,result:r}}}function Es(e){return Fa({...typeof e==`string`?Ia(e):e,hash:``})}function Ds(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function Os(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&ks(t))}function ks(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function As(e){return Ps(e.result)&&Mo.has(e.result.status)}function js(e){return e.type===`error`}function Ms(e){return(e&&e.type)===`redirect`}function Ns(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function Ps(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function mee(e){return jo.has(e.toUpperCase())}function Fs(e){return ko.has(e.toUpperCase())}function Is(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function Ls(e,t){let n=typeof t==`string`?Ia(t).search:t.search;if(e[e.length-1].route.index&&Is(n||``))return e[e.length-1];let r=yo(e);return r[r.length-1]}function Rs(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function zs(e,t){return t?{state:`loading`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:`loading`,location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function Bs(e,t){return{state:`submitting`,location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function Vs(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Hs(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function Us(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function Ws(e,t){try{let n=e.sessionStorage.getItem(zo);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function Gs(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(zo,JSON.stringify(n))}catch(e){ja(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function Ks(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var qs=H.createContext(null);qs.displayName=`DataRouter`;var Js=H.createContext(null);Js.displayName=`DataRouterState`,H.createContext(!1);var Ys=H.createContext({isTransitioning:!1});Ys.displayName=`ViewTransition`;var Xs=H.createContext(new Map);Xs.displayName=`Fetchers`;var Zs=H.createContext(null);Zs.displayName=`Await`;var Qs=H.createContext(null);Qs.displayName=`Navigation`;var $s=H.createContext(null);$s.displayName=`Location`;var ec=H.createContext({outlet:null,matches:[],isDataRoute:!1});ec.displayName=`Route`;var tc=H.createContext(null);tc.displayName=`RouteError`;function nc(e,{relative:t}={}){Aa(rc(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=H.useContext(Qs),{hash:i,pathname:a,search:o}=pc(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:So([n,a])),r.createHref({pathname:s,search:o,hash:i})}function rc(){return H.useContext($s)!=null}function ic(){return Aa(rc(),`useLocation() may be used only in the context of a <Router> component.`),H.useContext($s).location}function ac(){return H.useContext($s).navigationType}var oc=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function sc(e){H.useContext(Qs).static||H.useLayoutEffect(e)}function cc(){let{isDataRoute:e}=H.useContext(ec);return e?Oc():lc()}function lc(){Aa(rc(),`useNavigate() may be used only in the context of a <Router> component.`);let e=H.useContext(qs),{basename:t,navigator:n}=H.useContext(Qs),{matches:r}=H.useContext(ec),{pathname:i}=ic(),a=JSON.stringify(bo(r)),o=H.useRef(!1);return sc(()=>{o.current=!0}),H.useCallback((r,s={})=>{if(ja(o.current,oc),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=xo(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:So([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var uc=H.createContext(null);function dc(e){let t=H.useContext(ec).outlet;return H.useMemo(()=>t&&H.createElement(uc.Provider,{value:e},t),[t,e])}function fc(){let{matches:e}=H.useContext(ec),t=e[e.length-1];return t?t.params:{}}function pc(e,{relative:t}={}){let{matches:n}=H.useContext(ec),{pathname:r}=ic(),i=JSON.stringify(bo(n));return H.useMemo(()=>xo(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function mc(e,t,n,r,i){Aa(rc(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=H.useContext(Qs),{matches:o}=H.useContext(ec),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;Ac(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
12
12
 
13
13
  Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=ic(),p;if(t){let e=typeof t==`string`?Ia(t):t;Aa(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=qa(e,{pathname:h});ja(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),ja(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=vc(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:So([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:So([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?H.createElement($s.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function hc(){let e=Tc(),t=Do(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=H.createElement(H.Fragment,null,H.createElement(`p`,null,`💿 Hey developer 👋`),H.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,H.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,H.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),H.createElement(H.Fragment,null,H.createElement(`h2`,null,`Unexpected Application Error!`),H.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?H.createElement(`pre`,{style:i},n):null,o)}var gc=H.createElement(hc,null),hee=class extends H.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.unstable_onError?this.props.unstable_onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){return this.state.error===void 0?this.props.children:H.createElement(ec.Provider,{value:this.props.routeContext},H.createElement(tc.Provider,{value:this.state.error,children:this.props.component}))}};function _c({routeContext:e,match:t,children:n}){let r=H.useContext(qs);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),H.createElement(ec.Provider,{value:e},n)}function vc(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);Aa(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,i,l)=>{let u,d=!1,f=null,p=null;n&&(u=o&&i.route.id?o[i.route.id]:void 0,f=i.route.errorElement||gc,s&&(c<0&&l===0?(Ac(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===l&&(d=!0,p=i.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,l+1)),h=()=>{let t;return t=u?f:d?p:i.route.Component?H.createElement(i.route.Component,null):i.route.element?i.route.element:e,H.createElement(_c,{match:i,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(i.route.ErrorBoundary||i.route.errorElement||l===0)?H.createElement(hee,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},unstable_onError:r}):h()},null)}function yc(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bc(e){let t=H.useContext(qs);return Aa(t,yc(e)),t}function xc(e){let t=H.useContext(Js);return Aa(t,yc(e)),t}function Sc(e){let t=H.useContext(ec);return Aa(t,yc(e)),t}function Cc(e){let t=Sc(e),n=t.matches[t.matches.length-1];return Aa(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function gee(){return Cc(`useRouteId`)}function _ee(){return xc(`useNavigation`).navigation}function wc(){let{matches:e,loaderData:t}=xc(`useMatches`);return H.useMemo(()=>e.map(e=>Ya(e,t)),[e,t])}function Tc(){let e=H.useContext(tc),t=xc(`useRouteError`),n=Cc(`useRouteError`);return e===void 0?t.errors?.[n]:e}var Ec=0;function Dc(e){let{router:t,basename:n}=bc(`useBlocker`),r=xc(`useBlocker`),[i,a]=H.useState(``),o=H.useCallback(t=>{if(typeof e!=`function`)return!!e;if(n===`/`)return e(t);let{currentLocation:r,nextLocation:i,historyAction:a}=t;return e({currentLocation:{...r,pathname:mo(r.pathname,n)||r.pathname},nextLocation:{...i,pathname:mo(i.pathname,n)||i.pathname},historyAction:a})},[n,e]);return H.useEffect(()=>{let e=String(++Ec);return a(e),()=>t.deleteBlocker(e)},[t]),H.useEffect(()=>{i!==``&&t.getBlocker(i,o)},[t,i,o]),i&&r.blockers.has(i)?r.blockers.get(i):Io}function Oc(){let{router:e}=bc(`useNavigate`),t=Cc(`useNavigate`),n=H.useRef(!1);return sc(()=>{n.current=!0}),H.useCallback(async(r,i={})=>{ja(n.current,oc),n.current&&(typeof r==`number`?e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var kc={};function Ac(e,t,n){!t&&!kc[e]&&(kc[e]=!0,ja(!1,n))}var jc={};function Mc(e,t){!e&&!jc[t]&&(jc[t]=!0,console.warn(t))}function Nc(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&ja(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:H.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&ja(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:H.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&ja(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:H.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var Pc=[`HydrateFallback`,`hydrateFallbackElement`],Fc=class{constructor(){this.status=`pending`,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Ic({router:e,flushSync:t,unstable_onError:n}){let[r,i]=H.useState(e.state),[a,o]=H.useState(),[s,c]=H.useState({isTransitioning:!1}),[l,u]=H.useState(),[d,f]=H.useState(),[p,m]=H.useState(),h=H.useRef(new Map),g=H.useCallback(e=>{i(t=>(e.errors&&n&&Object.entries(e.errors).forEach(([e,r])=>{t.errors?.[e]!==r&&n(r)}),e))},[n]),_=H.useCallback((n,{deletedFetchers:r,flushSync:i,viewTransitionOpts:a})=>{n.fetchers.forEach((e,t)=>{e.data!==void 0&&h.current.set(t,e.data)}),r.forEach(e=>h.current.delete(e)),Mc(i===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let s=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(Mc(a==null||s,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!a||!s){t&&i?t(()=>g(n)):H.startTransition(()=>g(n));return}if(t&&i){t(()=>{d&&(l&&l.resolve(),d.skipTransition()),c({isTransitioning:!0,flushSync:!0,currentLocation:a.currentLocation,nextLocation:a.nextLocation})});let r=e.window.document.startViewTransition(()=>{t(()=>g(n))});r.finished.finally(()=>{t(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})})}),t(()=>f(r));return}d?(l&&l.resolve(),d.skipTransition(),m({state:n,currentLocation:a.currentLocation,nextLocation:a.nextLocation})):(o(n),c({isTransitioning:!0,flushSync:!1,currentLocation:a.currentLocation,nextLocation:a.nextLocation}))},[e.window,t,d,l,g]);H.useLayoutEffect(()=>e.subscribe(_),[e,_]),H.useEffect(()=>{s.isTransitioning&&!s.flushSync&&u(new Fc)},[s]),H.useEffect(()=>{if(l&&a&&e.window){let t=a,n=l.promise,r=e.window.document.startViewTransition(async()=>{H.startTransition(()=>g(t)),await n});r.finished.finally(()=>{u(void 0),f(void 0),o(void 0),c({isTransitioning:!1})}),f(r)}},[a,l,e.window,g]),H.useEffect(()=>{l&&a&&r.location.key===a.location.key&&l.resolve()},[l,d,r.location,a]),H.useEffect(()=>{!s.isTransitioning&&p&&(o(p.state),c({isTransitioning:!0,flushSync:!1,currentLocation:p.currentLocation,nextLocation:p.nextLocation}),m(void 0))},[s.isTransitioning,p]);let v=H.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),y=e.basename||`/`,b=H.useMemo(()=>({router:e,navigator:v,static:!1,basename:y,unstable_onError:n}),[e,v,y,n]);return H.createElement(H.Fragment,null,H.createElement(qs.Provider,{value:b},H.createElement(Js.Provider,{value:r},H.createElement(Xs.Provider,{value:h.current},H.createElement(Ys.Provider,{value:s},H.createElement(Hc,{basename:y,location:r.location,navigationType:r.historyAction,navigator:v},H.createElement(Lc,{routes:e.routes,future:e.future,state:r,unstable_onError:n})))))),null)}var Lc=H.memo(Rc);function Rc({routes:e,future:t,state:n,unstable_onError:r}){return mc(e,void 0,n,r,t)}function zc({to:e,replace:t,state:n,relative:r}){Aa(rc(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=H.useContext(Qs);ja(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=H.useContext(ec),{pathname:o}=ic(),s=cc(),c=xo(e,bo(a),o,r===`path`),l=JSON.stringify(c);return H.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function Bc(e){return dc(e.context)}function Vc(e){Aa(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Hc({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1}){Aa(!rc(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let o=e.replace(/^\/*/,`/`),s=H.useMemo(()=>({basename:o,navigator:i,static:a,future:{}}),[o,i,a]);typeof n==`string`&&(n=Ia(n));let{pathname:c=`/`,search:l=``,hash:u=``,state:d=null,key:f=`default`}=n,p=H.useMemo(()=>{let e=mo(c,o);return e==null?null:{location:{pathname:e,search:l,hash:u,state:d,key:f},navigationType:r}},[o,c,l,u,d,f,r]);return ja(p!=null,`<Router basename="${o}"> is not able to match the URL "${c}${l}${u}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:H.createElement(Qs.Provider,{value:s},H.createElement($s.Provider,{children:t,value:p}))}function Uc(e,t=[]){let n=[];return H.Children.forEach(e,(e,r)=>{if(!H.isValidElement(e))return;let i=[...t,r];if(e.type===H.Fragment){n.push.apply(n,Uc(e.props.children,i));return}Aa(e.type===Vc,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Aa(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Uc(e.props.children,i)),n.push(a)}),n}var Wc=Uc,Gc=`get`,Kc=`application/x-www-form-urlencoded`;function qc(e){return e!=null&&typeof e.tagName==`string`}function Jc(e){return qc(e)&&e.tagName.toLowerCase()===`button`}function Yc(e){return qc(e)&&e.tagName.toLowerCase()===`form`}function Xc(e){return qc(e)&&e.tagName.toLowerCase()===`input`}function Zc(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Qc(e,t){return e.button===0&&(!t||t===`_self`)&&!Zc(e)}function $c(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function el(e,t){let n=$c(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var tl=null;function nl(){if(tl===null)try{new FormData(document.createElement(`form`),0),tl=!1}catch{tl=!0}return tl}var rl=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function il(e){return e!=null&&!rl.has(e)?(ja(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Kc}"`),null):e}function al(e,t){let n,r,i,a,o;if(Yc(e)){let o=e.getAttribute(`action`);r=o?mo(o,t):null,n=e.getAttribute(`method`)||Gc,i=il(e.getAttribute(`enctype`))||Kc,a=new FormData(e)}else if(Jc(e)||Xc(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?mo(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Gc,i=il(e.getAttribute(`formenctype`))||il(o.getAttribute(`enctype`))||Kc,a=new FormData(o,e),!nl()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(qc(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Gc,r=null,i=Kc,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ol(e,t){if(e===!1||e==null)throw Error(t)}function sl(e,t,n){let r=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return r.pathname===`/`?r.pathname=`_root.${n}`:t&&mo(r.pathname,t)===`/`?r.pathname=`${t.replace(/\/$/,``)}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,``)}.${n}`,r}async function cl(e,t){if(e.id in t)return t[e.id];try{let n=await vn(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function ll(e){return e!=null&&typeof e.page==`string`}function ul(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function dl(e,t,n){return gl((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await cl(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(ul).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function fl(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function pl(e,t,{includeHydrateFallback:n}={}){return ml(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function ml(e){return[...new Set(e)]}function hl(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function gl(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!ll(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(hl(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function _l(){let e=H.useContext(qs);return ol(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function vl(){let e=H.useContext(Js);return ol(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var yl=H.createContext(void 0);yl.displayName=`FrameworkContext`;function bl(){let e=H.useContext(yl);return ol(e,`You must render this element inside a <HydratedRouter> element`),e}function xl(e,t){let n=H.useContext(yl),[r,i]=H.useState(!1),[a,o]=H.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=H.useRef(null);H.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),H.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Sl(s,p),onBlur:Sl(c,m),onMouseEnter:Sl(l,p),onMouseLeave:Sl(u,m),onTouchStart:Sl(d,p)}]:[a,f,{}]:[!1,f,{}]}function Sl(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function vee({page:e,...t}){let{router:n}=_l(),r=H.useMemo(()=>qa(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?H.createElement(wl,{page:e,matches:r,...t}):null}function Cl(e){let{manifest:t,routeModules:n}=bl(),[r,i]=H.useState([]);return H.useEffect(()=>{let r=!1;return dl(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function wl({page:e,matches:t,...n}){let r=ic(),{manifest:i,routeModules:a}=bl(),{basename:o}=_l(),{loaderData:s,matches:c}=vl(),l=H.useMemo(()=>fl(e,t,c,i,r,`data`),[e,t,c,i,r]),u=H.useMemo(()=>fl(e,t,c,i,r,`assets`),[e,t,c,i,r]),d=H.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,c=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!l.some(t=>t.route.id===e.route.id)&&e.route.id in s&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?c=!0:n.add(e.route.id))}),n.size===0)return[];let u=sl(e,o,`data`);return c&&n.size>0&&u.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[u.pathname+u.search]},[o,s,r,i,l,t,e,a]),f=H.useMemo(()=>pl(u,i),[u,i]),p=Cl(u);return H.createElement(H.Fragment,null,d.map(e=>H.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),f.map(e=>H.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),p.map(({key:e,link:t})=>H.createElement(`link`,{key:e,nonce:n.nonce,...t})))}function Tl(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var El=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{El&&(window.__reactRouterVersion=`7.9.4`)}catch{}function Dl(e,t){return Vo({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:ka({window:t?.window}),hydrationData:t?.hydrationData||Ol(),routes:e,mapRouteProperties:Nc,hydrationRouteProperties:Pc,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window}).initialize()}function Ol(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:kl(e.errors)}),e}function kl(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new Eo(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(r.__subType){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function Al({basename:e,children:t,history:n}){let[r,i]=H.useState({action:n.action,location:n.location}),a=H.useCallback(e=>{H.startTransition(()=>i(e))},[i]);return H.useLayoutEffect(()=>n.listen(a),[n,a]),H.createElement(Hc,{basename:e,children:t,location:r.location,navigationType:r.action,navigator:n})}Al.displayName=`unstable_HistoryRouter`;var jl=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ml=H.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,...d},f){let{basename:p}=H.useContext(Qs),m=typeof c==`string`&&jl.test(c),h,g=!1;if(typeof c==`string`&&m&&(h=c,El))try{let e=new URL(window.location.href),t=c.startsWith(`//`)?new URL(e.protocol+c):new URL(c),n=mo(t.pathname,p);t.origin===e.origin&&n!=null?c=n+t.search+t.hash:g=!0}catch{ja(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let _=nc(c,{relative:r}),[v,y,b]=xl(n,d),x=zl(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u});function S(t){e&&e(t),t.defaultPrevented||x(t)}let C=H.createElement(`a`,{...d,...b,href:h||_,onClick:g||i?e:S,ref:Tl(f,y),target:s,"data-discover":!m&&t===`render`?`true`:void 0});return v&&!m?H.createElement(H.Fragment,null,C,H.createElement(vee,{page:_})):C});Ml.displayName=`Link`;var Nl=H.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=pc(a,{relative:c.relative}),d=ic(),f=H.useContext(Js),{navigator:p,basename:m}=H.useContext(Qs),h=f!=null&&Xl(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=mo(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return H.createElement(Ml,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});Nl.displayName=`NavLink`;var Pl=H.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Gc,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,...f},p)=>{let m=Ul(),h=Wl(s,{relative:l}),g=o.toLowerCase()===`get`?`get`:`post`,_=typeof s==`string`&&jl.test(s);return H.createElement(`form`,{ref:p,method:g,action:h,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o;m(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d})},...f,"data-discover":!_&&e===`render`?`true`:void 0})});Pl.displayName=`Form`;function Fl({getKey:e,storageKey:t,...n}){let r=H.useContext(yl),{basename:i}=H.useContext(Qs),a=ic(),o=wc();Jl({getKey:e,storageKey:t});let s=H.useMemo(()=>{if(!r||!e)return null;let t=ql(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return H.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${JSON.stringify(t||Gl)}, ${JSON.stringify(s)})`}})}Fl.displayName=`ScrollRestoration`;function Il(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Ll(e){let t=H.useContext(qs);return Aa(t,Il(e)),t}function Rl(e){let t=H.useContext(Js);return Aa(t,Il(e)),t}function zl(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o}={}){let s=cc(),c=ic(),l=pc(e,{relative:a});return H.useCallback(u=>{Qc(u,t)&&(u.preventDefault(),s(e,{replace:n===void 0?Fa(c)===Fa(l):n,state:r,preventScrollReset:i,relative:a,viewTransition:o}))},[c,s,l,n,r,t,e,i,a,o])}function Bl(e){ja(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=H.useRef($c(e)),n=H.useRef(!1),r=ic(),i=H.useMemo(()=>el(r.search,n.current?null:t.current),[r.search]),a=cc();return[i,H.useCallback((e,t)=>{let r=$c(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Vl=0,Hl=()=>`__${String(++Vl)}__`;function Ul(){let{router:e}=Ll(`useSubmit`),{basename:t}=H.useContext(Qs),n=gee();return H.useCallback(async(r,i={})=>{let{action:a,method:o,encType:s,formData:c,body:l}=al(r,t);if(i.navigate===!1){let t=i.fetcherKey||Hl();await e.fetch(t,n,i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,flushSync:i.flushSync})}else await e.navigate(i.action||a,{preventScrollReset:i.preventScrollReset,formData:c,body:l,formMethod:i.method||o,formEncType:i.encType||s,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[e,t,n])}function Wl(e,{relative:t}={}){let{basename:n}=H.useContext(Qs),r=H.useContext(ec);Aa(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...pc(e||`.`,{relative:t})},o=ic();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:So([n,a.pathname])),Fa(a)}var Gl=`react-router-scroll-positions`,Kl={};function ql(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:mo(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Jl({getKey:e,storageKey:t}={}){let{router:n}=Ll(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=Rl(`useScrollRestoration`),{basename:a}=H.useContext(Qs),o=ic(),s=wc(),c=_ee();H.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),Yl(H.useCallback(()=>{if(c.state===`idle`){let t=ql(o,s,a,e);Kl[t]=window.scrollY}try{sessionStorage.setItem(t||Gl,JSON.stringify(Kl))}catch(e){ja(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(H.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Gl);e&&(Kl=JSON.parse(e))}catch{}},[t]),H.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Kl,()=>window.scrollY,e?(t,n)=>ql(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),H.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{ja(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function Yl(e,t){let{capture:n}=t||{};H.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Xl(e,{relative:t}={}){let n=H.useContext(Ys);Aa(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Ll(`useViewTransitionState`),i=pc(e,{relative:t});if(!n.isTransitioning)return!1;let a=mo(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=mo(n.nextLocation.pathname,r)||n.nextLocation.pathname;return uo(i.pathname,o)!=null||uo(i.pathname,a)!=null}var Zl=function(e){return e[e.Unknown=0]=`Unknown`,e[e.File=1]=`File`,e[e.Directory=2]=`Directory`,e[e.SymbolicLink=64]=`SymbolicLink`,e}({}),Ql=function(e){return e.modified=`modified`,e.new=`new`,e.saving=`saving`,e.unmodified=`unmodified`,e.removing=`removing`,e.error=`error`,e}({});async function $l(e,t){let n=t?.method??`GET`,r=await eu(e,t);if(!r.ok){let t=await r.clone().text(),i=new s(`${r.status}: ${r.statusText} making request '${n} ${e}': ${t}`);throw await i.tryReadResponse(r),i}return r}async function eu(e,t){let n=B(),{getAccessToken:r}=await Ne(),i=await r();if(!i)throw Error(`Error requesting access token. Could not authenticate user.`);let a=`${Ie}/v1${e}`,o=`/api`?.startsWith(`http`)?new URL(a):new URL(a,window.location.origin),s={...t},c={Authorization:`Bearer ${i}`,"zuplo-request-id":n};t?.headers||(s.headers={}),Object.assign(s.headers??{},c);try{return await fetch(o.toString(),s)}catch(e){throw e instanceof TypeError?new ot({type:`https://zup.fail/api-request-failed`,title:`API request failed`,status:500,instance:o.toString()}):e}}async function*tu(e,t,n){let r=await $l(`/deployments/${e}/fs/dir-contents?${new URLSearchParams({path:t,recursive:`true`})}`,{signal:n?.signal});if(!r.body)throw Error(`dir-contents response has no body to stream`);let i=e=>{try{return JSON.parse(e)}catch{throw Error(`Malformed dir-contents NDJSON line (${e.length} chars): ${e.slice(0,120)}`)}},a=r.body.getReader(),o=new TextDecoder,s=``;try{for(;;){let{done:e,value:t}=await a.read();if(e)break;s+=o.decode(t,{stream:!0});let n=s.indexOf(`
@@ -482,7 +482,7 @@ export function runtimeInit(runtime: RuntimeExtensions) {
482
482
  `,`
483
483
  +`).split(`
484
484
  `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,H.useEffect)(()=>{let n=t?.target??EAt,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&AOt(e))return!1;let n=OAt(e.code,s);if(a.current.add(e[n]),DAt(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=OAt(e.code,s);DAt(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function DAt(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function OAt(e,t){return t.includes(e)?`code`:`key`}var kAt=()=>{let e=g4();return(0,H.useMemo)(()=>({zoomIn:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=B2(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return L2(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=R2(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function AAt(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)jAt(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function jAt(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function MAt(e,t){return AAt(e,t)}function NAt(e,t){return AAt(e,t)}function x4(e,t){return{id:e,type:`select`,selected:t}}function S4(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(x4(a.id,e)))}return r}function PAt({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function FAt(e){return{id:e.id,type:`remove`}}var IAt=e=>cOt(e),LAt=e=>sOt(e);function RAt(e){return(0,H.forwardRef)(e)}function zAt(e){let[t,n]=(0,H.useState)(BigInt(0)),[r]=(0,H.useState)(()=>BAt(()=>n(e=>e+BigInt(1))));return y4(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function BAt(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var VAt=(0,H.createContext)(null);function HAt({children:e}){let t=g4(),n=zAt((0,H.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=PAt({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=zAt((0,H.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(PAt({items:s,lookup:o}))},[])),i=(0,H.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,U.jsx)(VAt.Provider,{value:i,children:e})}function UAt(){let e=(0,H.useContext)(VAt);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var WAt=e=>!!e.panZoom;function C4(){let e=kAt(),t=g4(),n=UAt(),r=h4(WAt),i=(0,H.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=IAt(e)?e:n.get(e.id),a=i.parentId?wOt(i.position,i.measured,i.parentId,n,r):i.position;return M2({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&IAt(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&LAt(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await mOt({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(FAt);o?.(f),c(e)}if(m){let e=d.map(FAt);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=yOt(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=M2(s?r:a),l=P2(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=yOt(e)?e:a(e);if(!r)return!1;let i=P2(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return lOt(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??EOt();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,H.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var GAt=e=>e.selected,KAt=typeof window<`u`?window:void 0;function qAt({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=g4(),{deleteElements:r}=C4(),i=b4(e,{actInsideInputWithModifier:!1}),a=b4(t,{target:KAt});(0,H.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(GAt),edges:e.filter(GAt)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,H.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function JAt(e){let t=g4();(0,H.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=G2(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,h2.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var w4={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},YAt=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function XAt({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=v2.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=g4(),S=(0,H.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=h4(YAt,p4),E=b4(f),D=(0,H.useRef)();JAt(S);let O=(0,H.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,H.useEffect)(()=>{if(S.current){D.current=Fkt({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,H.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,U.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:w4,children:m})}var ZAt=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function QAt(){let{userSelectionActive:e,userSelectionRect:t}=h4(ZAt,p4);return e&&t?(0,U.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var T4=(e,t)=>n=>{n.target===t.current&&e?.(n)},$At=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ejt({isSelecting:e,selectionKeyPressed:t,selectionMode:n=y2.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:a,onSelectionStart:o,onSelectionEnd:s,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:u,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:p,children:m}){let h=g4(),{userSelectionActive:g,elementsSelectable:_,dragging:v,connectionInProgress:y}=h4($At,p4),b=_&&(e||g),x=(0,H.useRef)(null),S=(0,H.useRef)(),C=(0,H.useRef)(new Set),w=(0,H.useRef)(new Set),T=(0,H.useRef)(!1),E=e=>{if(T.current||y){T.current=!1;return}c?.(e),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},D=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}l?.(e)},O=u?e=>u(e):void 0;return(0,U.jsxs)(`div`,{className:l0([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:v,selection:e}]),onClick:b?void 0:T4(E,x),onContextMenu:T4(D,x),onWheel:T4(O,x),onPointerEnter:b?void 0:d,onPointerMove:b?e=>{let{userSelectionRect:r,transform:a,nodeLookup:s,edgeLookup:c,connectionLookup:l,triggerNodeChanges:u,triggerEdgeChanges:d,defaultEdgeOptions:f,resetSelectedElements:p}=h.getState();if(!S.current||!r)return;let{x:m,y:g}=K2(e.nativeEvent,S.current),{startX:_,startY:v}=r;if(!T.current){let n=t?0:i;if(Math.hypot(m-_,g-v)<=n)return;p(),o?.(e)}T.current=!0;let y={startX:_,startY:v,x:m<_?m:_,y:g<v?g:v,width:Math.abs(m-_),height:Math.abs(g-v)},b=C.current,x=w.current;C.current=new Set(E2(s,y,a,n===y2.Partial,!0).map(e=>e.id)),w.current=new Set;let E=f?.selectable??!0;for(let e of C.current){let t=l.get(e);if(t)for(let{edgeId:e}of t.values()){let t=c.get(e);t&&(t.selectable??E)&&w.current.add(e)}}TOt(b,C.current)||u(S4(s,C.current,!0)),TOt(x,w.current)||d(S4(c,w.current)),h.setState({userSelectionRect:y,userSelectionActive:!0,nodesSelectionActive:!1})}:f,onPointerUp:b?e=>{e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!g&&e.target===x.current&&h.getState().userSelectionRect&&E?.(e),h.setState({userSelectionActive:!1,userSelectionRect:null}),T.current&&(s?.(e),h.setState({nodesSelectionActive:C.current.size>0})))}:void 0,onPointerDownCapture:b?n=>{let{domNode:r}=h.getState();if(S.current=r?.getBoundingClientRect(),!S.current)return;let i=n.target===x.current;if(!i&&n.target.closest(`.nokey`)||!e||!(a&&i||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),T.current=!1;let{x:o,y:s}=K2(n.nativeEvent,S.current);h.setState({userSelectionRect:{width:0,height:0,startX:o,startY:s,x:o,y:s}}),i||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:b?e=>{T.current&&=(e.stopPropagation(),!1)}:void 0,onPointerLeave:p,ref:x,style:w4,children:[m,(0,U.jsx)(QAt,{})]})}function E4({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,h2.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function tjt({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=g4(),[c,l]=(0,H.useState)(!1),u=(0,H.useRef)();return(0,H.useEffect)(()=>{u.current=hkt({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{E4({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,H.useEffect)(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i,o]),c}var njt=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function rjt(){let e=g4();return(0,H.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=njt(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=I2(t,i));let{position:a,positionAbsolute:s}=pOt({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var D4=(0,H.createContext)(null),ijt=D4.Provider;D4.Consumer;var ajt=()=>(0,H.useContext)(D4),ojt=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),sjt=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===_2.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function cjt({type:e=`source`,position:t=S2.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=g4(),_=ajt(),{connectOnClick:v,noPanClassName:y,rfId:b}=h4(ojt,p4),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=h4(sjt(_,m,e),p4);_||g.getState().onError?.(`010`,h2.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(VOt(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=jOt(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();i4.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)},A=t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=OOt(t.target),h=n||c,{connection:v,isValid:y}=i4.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})};return(0,U.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:l0([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?A:void 0,ref:p,...f,children:c})}var O4=(0,H.memo)(RAt(cjt));function ljt({data:e,isConnectable:t,sourcePosition:n=S2.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[e?.label,(0,U.jsx)(O4,{type:`source`,position:n,isConnectable:t})]})}function ujt({data:e,isConnectable:t,targetPosition:n=S2.Top,sourcePosition:r=S2.Bottom}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O4,{type:`target`,position:n,isConnectable:t}),e?.label,(0,U.jsx)(O4,{type:`source`,position:r,isConnectable:t})]})}function djt(){return null}function fjt({data:e,isConnectable:t,targetPosition:n=S2.Top}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(O4,{type:`target`,position:n,isConnectable:t}),e?.label]})}var k4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},pjt={input:ljt,default:ujt,output:fjt,group:djt};function mjt(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var hjt=e=>{let{width:t,height:n,x:r,y:i}=T2(e.nodeLookup,{filter:e=>!!e.selected});return{width:F2(t)?t:null,height:F2(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function gjt({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=g4(),{width:i,height:a,transformString:o,userSelectionActive:s}=h4(hjt,p4),c=rjt(),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(tjt({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,U.jsx)(`div`,{className:l0([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,U.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(k4,e.key)&&(e.preventDefault(),c({direction:k4[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var _jt=typeof window<`u`?window:void 0,vjt=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function yjt({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,preventScrolling:k,onSelectionContextMenu:A,noWheelClassName:j,noPanClassName:M,disableKeyboardA11y:N,onViewportChange:P,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=h4(vjt,p4),R=b4(l,{target:_jt}),z=b4(h,{target:_jt}),B=z||w,ee=z||b,te=u&&B!==!0,V=R||L||te;return qAt({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,U.jsx)(XAt,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:ee,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&B,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,zoomActivationKeyCode:g,preventScrolling:k,noWheelClassName:j,noPanClassName:M,onViewportChange:P,isControlledViewport:F,paneClickDistance:s,selectionOnDrag:te,children:(0,U.jsxs)(ejt,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:B,isSelecting:!!V,selectionMode:d,selectionKeyPressed:R,paneClickDistance:s,selectionOnDrag:te,children:[e,I&&(0,U.jsx)(gjt,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}yjt.displayName=`FlowRenderer`;var bjt=(0,H.memo)(yjt),xjt=e=>t=>e?E2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Sjt(e){return h4((0,H.useCallback)(xjt(e),[e]),p4)}var Cjt=e=>e.updateNodeInternals;function wjt(){let e=h4(Cjt),[t]=(0,H.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,H.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Tjt({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=g4(),a=(0,H.useRef)(null),o=(0,H.useRef)(null),s=(0,H.useRef)(e.sourcePosition),c=(0,H.useRef)(e.targetPosition),l=(0,H.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,H.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,H.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,H.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Ejt({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=h4(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},p4),S=y.type||`default`,C=g?.[S]||pjt[S];C===void 0&&(v?.(`003`,h2.error003(S)),S=`default`,C=g?.default||pjt.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=g4(),k=COt(y),A=Tjt({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=tjt({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=rjt();if(y.hidden)return null;let N=U2(y),P=mjt(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,z=a?e=>a(e,{...b.userNode}):void 0,B=o?e=>o(e,{...b.userNode}):void 0,ee=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&E4({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},te=t=>{if(!(AOt(t.nativeEvent)||m)){if(nOt.includes(t.key)&&T)E4({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(k4,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:k4[t.key],factor:t.shiftKey?4:1})}}},V=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(E2(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,U.jsx)(`div`,{className:l0([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:z,onClick:ee,onDoubleClick:B,onKeyDown:D?te:void 0,tabIndex:D?0:void 0,onFocus:D?V:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${aAt}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,U.jsx)(ijt,{value:e,children:(0,U.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Djt=(0,H.memo)(Ejt),Ojt=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function kjt(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=h4(Ojt,p4),o=Sjt(e.onlyRenderVisibleElements),s=wjt();return(0,U.jsx)(`div`,{className:`react-flow__nodes`,style:w4,children:o.map(o=>(0,U.jsx)(Djt,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}kjt.displayName=`NodeRenderer`;var Ajt=(0,H.memo)(kjt);function jjt(e){return h4((0,H.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&ROt({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),p4)}var Mjt=({color:e=`none`,strokeWidth:t=1})=>(0,U.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),Njt=({color:e=`none`,strokeWidth:t=1})=>(0,U.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Pjt={[x2.Arrow]:Mjt,[x2.ArrowClosed]:Njt};function Fjt(e){let t=g4();return(0,H.useMemo)(()=>Object.prototype.hasOwnProperty.call(Pjt,e)?Pjt[e]:(t.getState().onError?.(`009`,h2.error009(e)),null),[e])}var Ijt=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Fjt(t);return c?(0,U.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,U.jsx)(c,{color:n,strokeWidth:o})}):null},Ljt=({defaultColor:e,rfId:t})=>{let n=h4(e=>e.edges),r=h4(e=>e.defaultEdgeOptions),i=(0,H.useMemo)(()=>QOt(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,U.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,U.jsx)(`defs`,{children:i.map(e=>(0,U.jsx)(Ijt,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Ljt.displayName=`MarkerDefinitions`;var Rjt=(0,H.memo)(Ljt);function zjt({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,H.useState)({x:1,y:0,width:0,height:0}),p=l0([`react-flow__edge-textwrapper`,l]),m=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,U.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,U.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,U.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}zjt.displayName=`EdgeText`;var Bjt=(0,H.memo)(zjt);function A4({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{...u,d:e,fill:`none`,className:l0([`react-flow__edge-path`,u.className])}),l?(0,U.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&F2(t)&&F2(n)?(0,U.jsx)(Bjt,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Vjt({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===S2.Left||e===S2.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Hjt({sourceX:e,sourceY:t,sourcePosition:n=S2.Bottom,targetX:r,targetY:i,targetPosition:a=S2.Top}){let[o,s]=Vjt({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Vjt({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=NOt({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Ujt(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Hjt({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,U.jsx)(A4,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var Wjt=Ujt({isInternal:!1}),Gjt=Ujt({isInternal:!0});Wjt.displayName=`SimpleBezierEdge`,Gjt.displayName=`SimpleBezierEdgeInternal`;function Kjt(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=S2.Bottom,targetPosition:m=S2.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=J2({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,U.jsx)(A4,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var qjt=Kjt({isInternal:!1}),Jjt=Kjt({isInternal:!0});qjt.displayName=`SmoothStepEdge`,Jjt.displayName=`SmoothStepEdgeInternal`;function Yjt(e){return(0,H.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,U.jsx)(qjt,{...n,id:r,pathOptions:(0,H.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var Xjt=Yjt({isInternal:!1}),Zjt=Yjt({isInternal:!0});Xjt.displayName=`StepEdge`,Zjt.displayName=`StepEdgeInternal`;function Qjt(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=HOt({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,U.jsx)(A4,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var $jt=Qjt({isInternal:!1}),eMt=Qjt({isInternal:!0});$jt.displayName=`StraightEdge`,eMt.displayName=`StraightEdgeInternal`;function tMt(e){return(0,H.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=S2.Bottom,targetPosition:s=S2.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=FOt({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,U.jsx)(A4,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var nMt=tMt({isInternal:!1}),rMt=tMt({isInternal:!0});nMt.displayName=`BezierEdge`,rMt.displayName=`BezierEdgeInternal`;var iMt={default:rMt,straight:eMt,step:Zjt,smoothstep:Jjt,simplebezier:Gjt},aMt={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},oMt=(e,t,n)=>n===S2.Left?e-t:n===S2.Right?e+t:e,sMt=(e,t,n)=>n===S2.Top?e-t:n===S2.Bottom?e+t:e,cMt=`react-flow__edgeupdater`;function lMt({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,U.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:l0([cMt,`${cMt}-${s}`]),cx:oMt(t,r,e),cy:sMt(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function uMt({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=g4(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;i4.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,U.jsxs)(U.Fragment,{children:[(e===!0||e===`source`)&&(0,U.jsx)(lMt,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,U.jsx)(lMt,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function dMt({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=h4(t=>t.edgeLookup.get(e)),b=h4(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||iMt[x];S===void 0&&(_?.(`011`,h2.error011(x)),x=`default`,S=h?.default||iMt.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,H.useRef)(null),[D,O]=(0,H.useState)(!1),[k,A]=(0,H.useState)(!1),j=g4(),{zIndex:M,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=h4((0,H.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...aMt};let i=YOt({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:LOt({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode}),...i||aMt}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),p4),z=(0,H.useMemo)(()=>y.markerStart?`url('#${X2(y.markerStart,m)}')`:void 0,[y.markerStart,m]),B=(0,H.useMemo)(()=>y.markerEnd?`url('#${X2(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let ee=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},te=a?e=>{a(e,{...y})}:void 0,V=o?e=>{o(e,{...y})}:void 0,ne=s?e=>{s(e,{...y})}:void 0,re=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,U.jsx)(`svg`,{style:{zIndex:M},children:(0,U.jsxs)(`g`,{className:l0([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:ee,onDoubleClick:te,onContextMenu:V,onMouseEnter:ne,onMouseMove:re,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&nOt.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${oAt}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,U.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:z,markerEnd:B,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,U.jsx)(uMt,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var fMt=(0,H.memo)(dMt),pMt=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function mMt({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=h4(pMt,p4),b=jjt(t);return(0,U.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,U.jsx)(Rjt,{defaultColor:e,rfId:n}),b.map(e=>(0,U.jsx)(fMt,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}mMt.displayName=`EdgeRenderer`;var hMt=(0,H.memo)(mMt),gMt=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function _Mt({children:e}){return(0,U.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:h4(gMt)},children:e})}function vMt(e){let t=C4(),n=(0,H.useRef)(!1);(0,H.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var yMt=e=>e.panZoom?.syncViewport;function bMt(e){let t=h4(yMt),n=g4();return(0,H.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function xMt(e){return e.connection.inProgress?{...e.connection,to:L2(e.connection.to,e.transform)}:{...e.connection}}function SMt(e){return e?t=>e(xMt(t)):xMt}function CMt(e){return h4(SMt(e),p4)}var wMt=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function TMt({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=h4(wMt,p4);return a&&i&&c?(0,U.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,U.jsx)(`g`,{className:l0([`react-flow__connection`,oOt(s)]),children:(0,U.jsx)(EMt,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var EMt=({style:e,type:t=b2.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=CMt();if(!i)return;if(n)return(0,U.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:oOt(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case b2.Bezier:[m]=FOt(h);break;case b2.SimpleBezier:[m]=Hjt(h);break;case b2.Step:[m]=J2({...h,borderRadius:0});break;case b2.SmoothStep:[m]=J2(h);break;default:[m]=HOt(h)}return(0,U.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};EMt.displayName=`ConnectionLine`;var DMt={};function OMt(e=DMt){(0,H.useRef)(e),g4(),(0,H.useEffect)(()=>{},[e])}function kMt(){g4(),(0,H.useRef)(!1),(0,H.useEffect)(()=>{},[])}function AMt({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:z,onPaneClick:B,onPaneMouseEnter:ee,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneScroll:ne,onPaneContextMenu:re,paneClickDistance:ie,nodeClickDistance:ae,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,onReconnect:de,onReconnectStart:fe,onReconnectEnd:pe,noDragClassName:me,noWheelClassName:he,noPanClassName:ge,disableKeyboardA11y:_e,nodeExtent:ve,rfId:ye,viewport:be,onViewportChange:xe}){return OMt(e),OMt(t),kMt(),vMt(n),bMt(be),(0,U.jsx)(bjt,{onPaneClick:B,onPaneMouseEnter:ee,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneContextMenu:re,onPaneScroll:ne,paneClickDistance:ie,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:z,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:me,noWheelClassName:he,noPanClassName:ge,disableKeyboardA11y:_e,onViewportChange:xe,isControlledViewport:!!be,children:(0,U.jsxs)(_Mt,{children:[(0,U.jsx)(hMt,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:de,onReconnectStart:fe,onReconnectEnd:pe,onlyRenderVisibleElements:T,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,defaultMarkerColor:M,noPanClassName:ge,disableKeyboardA11y:_e,rfId:ye}),(0,U.jsx)(TMt,{style:h,type:m,component:g,containerStyle:_}),(0,U.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,U.jsx)(Ajt,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ae,onlyRenderVisibleElements:T,noPanClassName:ge,noDragClassName:me,disableKeyboardA11y:_e,nodeExtent:ve,rfId:ye}),(0,U.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}AMt.displayName=`GraphView`;var jMt=(0,H.memo)(AMt),MMt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??g2;ukt(h,g,_);let{nodesInitialized:x}=e4(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=B2(T2(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:g2,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:_2.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...iOt},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:bOt,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:rOt,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},NMt=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>eAt((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await fOt({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...MMt({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=e4(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();ukt(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=skt(e,n,r,i,a,o,l);d&&(nkt(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=Y2(e,o.fromHandle,S2.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=n4(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(MAt(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(NAt(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>x4(e,!0)));return}i(S4(r,new Set([...e]),!0)),a(S4(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>x4(e,!0)));return}a(S4(n,new Set([...e]))),i(S4(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(x4(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(x4(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,x4(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,x4(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(e4(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return ckt({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return Promise.resolve(!1);let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...iOt}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...MMt()})}},Object.is);function PMt({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,H.useState)(()=>NMt({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,U.jsx)(tAt,{value:m,children:(0,U.jsx)(HAt,{children:p})})}function FMt({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,H.useContext)(m4)?(0,U.jsx)(U.Fragment,{children:e}):(0,U.jsx)(PMt,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var IMt={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function LMt({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=b2.Bezier,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,deleteKeyCode:te=`Backspace`,selectionKeyCode:V=`Shift`,selectionOnDrag:ne=!1,selectionMode:re=y2.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=V2()?`Meta`:`Control`,zoomActivationKeyCode:oe=V2()?`Meta`:`Control`,snapToGrid:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,nodeOrigin:he=vAt,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve=!0,defaultViewport:ye=yAt,minZoom:be=.5,maxZoom:xe=2,translateExtent:Se=g2,preventScrolling:Ce=!0,nodeExtent:we,defaultMarkerColor:Te=`#b1b1b7`,zoomOnScroll:Ee=!0,zoomOnPinch:De=!0,panOnScroll:Oe=!1,panOnScrollSpeed:ke=.5,panOnScrollMode:Ae=v2.Free,zoomOnDoubleClick:je=!0,panOnDrag:Me=!0,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze=1,nodeClickDistance:Be=0,children:Ve,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:ot,defaultEdgeOptions:st,elevateNodesOnSelect:ct=!0,elevateEdgesOnSelect:lt=!1,disableKeyboardA11y:ut=!1,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:ht,onError:gt,style:_t,id:vt,nodeDragThreshold:yt,connectionDragThreshold:bt,viewport:xt,onViewportChange:St,width:Ct,height:wt,colorMode:Tt=`light`,debug:Et,onScroll:Dt,ariaLabelConfig:Ot,zIndexMode:kt=`basic`,...At},jt){let Mt=vt||`1`,Nt=TAt(Tt),Pt=(0,H.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Dt?.(e)},[Dt]);return(0,U.jsx)(`div`,{"data-testid":`rf__wrapper`,...At,onScroll:Pt,style:{..._t,...IMt},ref:jt,className:l0([`react-flow`,i,Nt]),id:vt,role:`application`,children:(0,U.jsxs)(FMt,{nodes:e,edges:t,width:Ct,height:wt,fitView:nt,fitViewOptions:rt,minZoom:be,maxZoom:xe,nodeOrigin:he,nodeExtent:we,zIndexMode:kt,children:[(0,U.jsx)(CAt,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:fe,nodesConnectable:pe,nodesFocusable:me,edgesFocusable:ge,edgesReconnectable:_e,elementsSelectable:ve,elevateNodesOnSelect:ct,elevateEdgesOnSelect:lt,minZoom:be,maxZoom:xe,nodeExtent:we,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:Se,connectOnClick:it,defaultEdgeOptions:st,fitView:nt,fitViewOptions:rt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:tt,nodeOrigin:he,rfId:Mt,autoPanOnConnect:dt,autoPanOnNodeDrag:ft,autoPanSpeed:pt,onError:gt,connectionRadius:mt,isValidConnection:ht,selectNodesOnDrag:ue,nodeDragThreshold:yt,connectionDragThreshold:bt,onBeforeDelete:I,debug:Et,ariaLabelConfig:Ot,zIndexMode:kt}),(0,U.jsx)(jMt,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:z,connectionLineComponent:B,connectionLineContainerStyle:ee,selectionKeyCode:V,selectionOnDrag:ne,selectionMode:re,deleteKeyCode:te,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ye,translateExtent:Se,minZoom:be,maxZoom:xe,preventScrolling:Ce,zoomOnScroll:Ee,zoomOnPinch:De,zoomOnDoubleClick:je,panOnScroll:Oe,panOnScrollSpeed:ke,panOnScrollMode:Ae,panOnDrag:Me,onPaneClick:Ne,onPaneMouseEnter:Pe,onPaneMouseMove:Fe,onPaneMouseLeave:Ie,onPaneScroll:Le,onPaneContextMenu:Re,paneClickDistance:ze,nodeClickDistance:Be,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:Te,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:Mt,disableKeyboardA11y:ut,nodeExtent:we,viewport:xt,onViewportChange:St}),(0,U.jsx)(_At,{onSelectionChange:k}),Ve,(0,U.jsx)(fAt,{proOptions:ot,position:at}),(0,U.jsx)(dAt,{rfId:Mt,disableKeyboardA11y:ut})]})})}var RMt=RAt(LMt);h2.error014();function zMt({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,U.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:l0([`react-flow__background-pattern`,n,r])})}function BMt({radius:e,className:t}){return(0,U.jsx)(`circle`,{cx:e,cy:e,r:e,className:l0([`react-flow__background-pattern`,`dots`,t])})}var j4;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(j4||={});var VMt={[j4.Dots]:1,[j4.Lines]:1,[j4.Cross]:6},HMt=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function UMt({id:e,variant:t=j4.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,H.useRef)(null),{transform:f,patternId:p}=h4(HMt,p4),m=r||VMt[t],h=t===j4.Dots,g=t===j4.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,U.jsxs)(`svg`,{className:l0([`react-flow__background`,l]),style:{...c,...w4,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,U.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,U.jsx)(BMt,{radius:y/2,className:u}):(0,U.jsx)(zMt,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,U.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}UMt.displayName=`Background`;var WMt=(0,H.memo)(UMt);function GMt(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,U.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function KMt(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,U.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function qMt(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,U.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function JMt(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function YMt(){return(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,U.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function M4({children:e,className:t,...n}){return(0,U.jsx)(`button`,{type:`button`,className:l0([`react-flow__controls-button`,t]),...n,children:e})}var XMt=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ZMt({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=g4(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=h4(XMt,p4),{zoomIn:y,zoomOut:b,fitView:x}=C4(),S=()=>{y(),a?.()},C=()=>{b(),o?.()},w=()=>{x(i),s?.()},T=()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)};return(0,U.jsxs)(_4,{className:l0([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(M4,{onClick:S,className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,U.jsx)(GMt,{})}),(0,U.jsx)(M4,{onClick:C,className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,U.jsx)(KMt,{})})]}),n&&(0,U.jsx)(M4,{className:`react-flow__controls-fitview`,onClick:w,title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,U.jsx)(qMt,{})}),r&&(0,U.jsx)(M4,{className:`react-flow__controls-interactive`,onClick:T,title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,U.jsx)(YMt,{}):(0,U.jsx)(JMt,{})}),u]})}ZMt.displayName=`Controls`,(0,H.memo)(ZMt);function QMt({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,U.jsx)(`rect`,{className:l0([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var $Mt=(0,H.memo)(QMt),eNt=e=>e.nodes.map(e=>e.id),N4=e=>e instanceof Function?e:()=>e;function tNt({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=$Mt,onClick:o}){let s=h4(eNt,p4),c=N4(t),l=N4(e),u=N4(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,U.jsx)(U.Fragment,{children:s.map(e=>(0,U.jsx)(rNt,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function nNt({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=h4(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=U2(r);return{node:r,x:i,y:a,width:o,height:s}},p4);return!l||l.hidden||!COt(l)?null:(0,U.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var rNt=(0,H.memo)(nNt),iNt=(0,H.memo)(tNt),aNt=200,oNt=150,sNt=e=>!e.hidden,cNt=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?vOt(T2(e.nodeLookup,{filter:sNt}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},lNt=`react-flow__minimap-desc`;function uNt({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=g4(),S=(0,H.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=h4(cNt,p4),j=e?.width??aNt,M=e?.height??oNt,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,z=C.x-(I-C.width)/2-R,B=C.y-(L-C.height)/2-R,ee=I+R*2,te=L+R*2,V=`${lNt}-${T}`,ne=(0,H.useRef)(0),re=(0,H.useRef)();ne.current=F,(0,H.useEffect)(()=>{if(S.current&&E)return re.current=Tkt({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ne.current}),()=>{re.current?.destroy()}},[E]),(0,H.useEffect)(()=>{re.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=re.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=m?(0,H.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,oe=_??A[`minimap.ariaLabel`];return(0,U.jsx)(_4,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:l0([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,U.jsxs)(`svg`,{width:j,height:M,viewBox:`${z} ${B} ${ee} ${te}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":V,ref:S,onClick:ie,children:[oe&&(0,U.jsx)(`title`,{id:V,children:oe}),(0,U.jsx)(iNt,{onClick:ae,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,U.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${z-R},${B-R}h${ee+R*2}v${te+R*2}h${-ee-R*2}z
485
- M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}uNt.displayName=`MiniMap`,(0,H.memo)(uNt);var dNt=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fNt={[l4.Line]:`right`,[l4.Handle]:`bottom-right`};function pNt({nodeId:e,position:t,variant:n=l4.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=ajt(),y=typeof e==`string`?e:v,b=g4(),x=(0,H.useRef)(null),S=n===l4.Handle,C=h4((0,H.useCallback)(dNt(S&&p),[S,p]),p4),w=(0,H.useRef)(null),T=t??fNt[n];return(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=Wkt({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=n4([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...wOt({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,U.jsx)(`div`,{className:l0([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(pNt);function P4({value:e,onValueChange:t,options:n,columns:r=2,layout:i=`cards`,idPrefix:a=`wizard-choice`,ariaLabel:o,className:s}){return(0,U.jsx)(BCt,{value:e,onValueChange:e=>t(e),"aria-label":o,className:W(i===`list`?`flex flex-col gap-2`:[`grid gap-3`,r===1&&`grid-cols-1`,r===2&&`grid-cols-2`,r===3&&`grid-cols-3`],s),children:n.map(t=>{let n=`${a}-${t.value}`,r=e===t.value,o=W(`rounded-md border transition-colors`,t.disabled?`cursor-not-allowed opacity-60`:`cursor-pointer`,r?`border-zuplo-600 bg-zuplo-50 dark:bg-zuplo-950/40`:`bg-card hover:bg-neutral-50 dark:hover:bg-neutral-800/60`);return i===`list`?(0,U.jsxs)(XT,{htmlFor:n,className:W(`flex items-center gap-3 px-3 py-2.5`,o),children:[(0,U.jsx)(c0,{value:t.value,id:n,disabled:t.disabled}),t.icon,(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-center sm:gap-3`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium sm:w-56 sm:shrink-0`,children:t.title}),t.description&&(0,U.jsx)(`div`,{className:`min-w-0 flex-1 text-xs leading-snug text-muted-foreground`,children:t.description})]})]},t.value):(0,U.jsxs)(XT,{htmlFor:n,className:W(`flex flex-col gap-1.5 p-3`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(c0,{value:t.value,id:n,disabled:t.disabled}),t.icon,(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:t.title})]}),t.description&&(0,U.jsx)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t.description})]},t.value)})})}var F4=({tiles:e,selectedId:t,onSelect:n,fallbackIcon:r,columns:i=4,emptyState:a,className:o})=>{let[s,c]=(0,H.useState)(()=>new Set);return(0,U.jsxs)(`div`,{className:W(`grid auto-rows-min gap-2 p-0.5`,i===4?`grid-cols-4`:`grid-cols-3`,o),children:[e.map(e=>{let i=t===e.id,a=s.has(e.id)||!e.iconUrl;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-pressed":i,className:W(`flex flex-col items-center justify-center gap-1.5 rounded-md border bg-card p-2 text-center transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-800/60`,i?`border-zuplo-600 bg-zuplo-50 dark:bg-zuplo-950/40`:`border-border`),children:[a?r:(0,U.jsx)(`img`,{src:e.iconUrl,alt:``,className:`size-7 object-contain brightness-0 dark:invert`,onError:()=>c(t=>new Set(t).add(e.id))}),(0,U.jsx)(`span`,{className:`w-full truncate text-xs leading-tight`,children:e.name})]},e.id)}),e.length===0&&a&&(0,U.jsx)(`div`,{className:`col-span-full py-6 text-center text-sm text-muted-foreground`,children:a})]})},mNt=`#ff00bd`,hNt=`#98036a`,gNt=`#fff0fc`,_Nt=`#9ca3af`,vNt=`#6b7280`,yNt=`#f7f9fb`,I4=152,L4=60,bNt={client:Wf,gateway:Qp,origin:Ite},xNt=`!h-0 !min-h-0 !w-0 !min-w-0 !border-0 !bg-transparent`,SNt={box:({data:e})=>{let{label:t,kind:n,emphasis:r}=e,i=bNt[n];return(0,U.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center gap-1.5 rounded-lg border bg-card px-2 text-center shadow-xs`,r?`border-zuplo-600`:`border-neutral-300 dark:border-neutral-600`),style:{width:I4,height:L4},children:[(0,U.jsx)(O4,{type:`target`,position:S2.Left,isConnectable:!1,className:xNt}),(0,U.jsx)(i,{"aria-hidden":`true`,strokeWidth:1.75,className:W(`size-[18px] shrink-0`,r?`text-zuplo-600`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`text-xs font-medium leading-tight text-muted-foreground`,children:t}),(0,U.jsx)(O4,{type:`source`,position:S2.Right,isConnectable:!1,className:xNt})]})}},R4=[{id:`client`,type:`box`,position:{x:0,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`MCP Client`,kind:`client`,emphasis:!1},draggable:!1,selectable:!1},{id:`gateway`,type:`box`,position:{x:270,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`Zuplo MCP Gateway`,kind:`gateway`,emphasis:!0},draggable:!1,selectable:!1},{id:`origin`,type:`box`,position:{x:540,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`Origin MCP Server`,kind:`origin`,emphasis:!1},draggable:!1,selectable:!1}],CNt=e=>{let t=(e,t,n,r,i)=>({id:e,source:t,target:n,type:`smoothstep`,label:r,animated:!1,style:{stroke:i?mNt:_Nt,strokeWidth:i?2:1.5},labelStyle:{fill:i?hNt:vNt,fontWeight:i?600:500,fontSize:11},labelBgStyle:{fill:i?gNt:yNt,fillOpacity:.95},labelBgPadding:[6,3],labelBgBorderRadius:4,markerEnd:{type:x2.ArrowClosed,width:14,height:14,color:i?mNt:_Nt}});return[t(`inbound`,`client`,`gateway`,`Inbound auth`,e===`inbound`),t(`outbound`,`gateway`,`origin`,`Outbound auth`,e===`outbound`)]},z4={minX:Math.min(...R4.map(e=>e.position.x)),minY:Math.min(...R4.map(e=>e.position.y)),maxX:Math.max(...R4.map(e=>e.position.x+(e.width??I4))),maxY:Math.max(...R4.map(e=>e.position.y+(e.height??L4)))},wNt=z4.maxX-z4.minX,TNt=z4.maxY-z4.minY,ENt=.5,DNt=1.2,ONt=.12;function kNt(e,t){let n=Math.min(e/wNt,t/TNt),r=Math.min(DNt,Math.max(ENt,n*(1-ONt*2)));return{x:(e-wNt*r)/2-z4.minX*r,y:(t-TNt*r)/2-z4.minY*r,zoom:r}}var ANt=({active:e})=>{let t=(0,H.useMemo)(()=>CNt(e),[e]),n=(0,H.useRef)(null),r=(0,H.useRef)(null),i=(0,H.useCallback)(()=>{let e=n.current,t=e?.clientWidth??0,i=e?.clientHeight??0;t>0&&i>0&&r.current?.setViewport(kNt(t,i))},[]),a=(0,H.useCallback)(e=>{r.current=e,i()},[i]);return(0,H.useLayoutEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=requestAnimationFrame(i)});return r.observe(e),()=>{cancelAnimationFrame(t),r.disconnect()}},[i]),(0,U.jsx)(`div`,{ref:n,role:`img`,"aria-label":`MCP request flow, configuring ${e} authentication`,className:`h-36 w-full overflow-hidden rounded-md border border-border`,children:(0,U.jsx)(RMt,{nodes:R4,edges:t,nodeTypes:SNt,onInit:a,minZoom:ENt,maxZoom:DNt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,edgesFocusable:!1,nodesFocusable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},style:{backgroundColor:yNt},children:(0,U.jsx)(WMt,{variant:j4.Dots,gap:16,size:1,color:`#dbe1e8`})})})};function B4(e){return e&&e.length>0?e:void 0}function V4(e){return e&&Object.keys(e).length>0?e:void 0}function jNt(e){let t=new Set;for(let n of e??[]){let e=n.trim();e&&t.add(e)}return[...t]}function H4(e,t){if(t!==`rolesAndGroups`)return{};if(e.public===!0)return{public:!0};let n=jNt(e.roles),r=jNt(e.groups);return{...n.length>0?{roles:n}:{},...r.length>0?{groups:r}:{}}}function MNt(e){let t=e&&typeof e==`object`?e:{};return{accessControlMode:t.accessControl?.mode===`rolesAndGroups`?`rolesAndGroups`:`allPublic`,catalog:{tools:U4(t.tools,`name`,e=>({name:e})),prompts:U4(t.prompts,`name`,e=>({name:e})),resources:U4(t.resources,`uri`,e=>({uri:e,name:e})),resourceTemplates:U4(t.resourceTemplates,`uriTemplate`,e=>({uriTemplate:e,name:e}))}}}function U4(e,t,n){return Array.isArray(e)?e.flatMap(e=>{if(typeof e==`string`)return e.length>0?[n(e)]:[];if(!e||typeof e!=`object`)return[];let{public:r,...i}=e,a=i[t];if(typeof a!=`string`||a.length===0)return[];let o=i.name;return[{...i,...t!==`name`&&typeof o!=`string`?{name:a}:{},...r===!0?{public:!0}:{}}]}):[]}function W4(e){return NNt(e.catalog,e.accessControlMode)}function NNt(e,t=`allPublic`){return{...t===`rolesAndGroups`?{accessControl:{mode:t}}:{},tools:e.tools.flatMap(e=>{let n=B4(e.name);if(!n)return[];let r=B4(e.description),i=V4(e.annotations),a=V4(e._meta);return[{name:n,...r?{description:r}:{},...i?{annotations:i}:{},...a?{_meta:a}:{},...H4(e,t)}]}),prompts:e.prompts.flatMap(e=>{let n=B4(e.name);if(!n)return[];let r=B4(e.description),i=V4(e._meta);return[{name:n,...r?{description:r}:{},...i?{_meta:i}:{},...H4(e,t)}]}),resources:e.resources.flatMap(e=>{let n=B4(e.uri);if(!n)return[];let r=B4(e.name),i=B4(e.description),a=B4(e.mimeType),o=V4(e._meta);return[{uri:n,...r?{name:r}:{},...i?{description:i}:{},...a?{mimeType:a}:{},...o?{_meta:o}:{},...H4(e,t)}]}),resourceTemplates:e.resourceTemplates.flatMap(e=>{let n=B4(e.uriTemplate);if(!n)return[];let r=B4(e.name),i=B4(e.description),a=B4(e.mimeType),o=V4(e._meta);return[{uriTemplate:n,...r?{name:r}:{},...i?{description:i}:{},...a?{mimeType:a}:{},...o?{_meta:o}:{},...H4(e,t)}]})}}var G4=e=>`/mcp-idp-icons/${e}.svg`,K4=[{id:`auth0`,label:`Auth0`,description:`Auth0 by Okta`,iconUrl:G4(`auth0`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-auth0-oauth-inbound`,policyExport:`McpAuth0OAuthInboundPolicy`,suggestedPolicyName:`mcp-auth0-inbound`,fields:[{key:`auth0Domain`,label:`Auth0 Domain`,defaultValue:`$env(MCP_AUTH0_DOMAIN)`,helpText:`Auth0 tenant domain, for example acme.us.auth0.com.`,required:!0},{key:`audience`,label:`Audience`,defaultValue:``,helpText:`Optional Auth0 API audience.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(MCP_AUTH0_CLIENT_ID)`,helpText:`Use an environment variable for deployable configs.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(MCP_AUTH0_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`workos`,label:`WorkOS`,description:`WorkOS User Management`,iconUrl:G4(`workos`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-workos-oauth-inbound`,policyExport:`McpWorkosOAuthInboundPolicy`,suggestedPolicyName:`mcp-workos-inbound`,fields:[{key:`clientId`,label:`Client ID`,defaultValue:`$env(WORKOS_CLIENT_ID)`,helpText:`WorkOS User Management client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(WORKOS_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`google`,label:`Google`,description:`Google OAuth`,iconUrl:G4(`google`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-google-oauth-inbound`,policyExport:`McpGoogleOAuthInboundPolicy`,suggestedPolicyName:`mcp-google-inbound`,fields:[{key:`clientId`,label:`Client ID`,defaultValue:`$env(GOOGLE_CLIENT_ID)`,helpText:`Google OAuth client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(GOOGLE_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`okta`,label:`Okta`,description:`Okta OIDC`,iconUrl:G4(`okta`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-okta-oauth-inbound`,policyExport:`McpOktaOAuthInboundPolicy`,suggestedPolicyName:`mcp-okta-inbound`,fields:[{key:`oktaDomain`,label:`Okta Domain`,defaultValue:`$env(OKTA_DOMAIN)`,helpText:`Okta org domain, for example acme.okta.com.`,required:!0},{key:`authorizationServerId`,label:`Authorization Server ID`,defaultValue:``,helpText:`Optional. Use default for Okta's default custom authorization server.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(OKTA_CLIENT_ID)`,helpText:`Okta OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(OKTA_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`entra`,label:`Microsoft Entra`,description:`Microsoft Entra ID`,iconUrl:G4(`entra`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-entra-oauth-inbound`,policyExport:`McpEntraOAuthInboundPolicy`,suggestedPolicyName:`mcp-entra-inbound`,fields:[{key:`tenantId`,label:`Tenant ID`,defaultValue:`$env(ENTRA_TENANT_ID)`,helpText:`Microsoft Entra tenant UUID.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(ENTRA_CLIENT_ID)`,helpText:`Microsoft Entra application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(ENTRA_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`cognito`,label:`Cognito`,description:`Amazon Cognito`,iconUrl:G4(`cognito`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-cognito-oauth-inbound`,policyExport:`McpCognitoOAuthInboundPolicy`,suggestedPolicyName:`mcp-cognito-inbound`,fields:[{key:`awsRegion`,label:`AWS Region`,defaultValue:`$env(COGNITO_AWS_REGION)`,helpText:`AWS region containing the Cognito user pool.`,required:!0},{key:`userPoolId`,label:`User Pool ID`,defaultValue:`$env(COGNITO_USER_POOL_ID)`,helpText:`Cognito user pool ID, for example us-east-1_AbCdEf123.`,required:!0},{key:`userPoolDomain`,label:`User Pool Domain`,defaultValue:`$env(COGNITO_USER_POOL_DOMAIN)`,helpText:`Hosted UI domain without https:// or a path.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(COGNITO_CLIENT_ID)`,helpText:`Cognito app client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(COGNITO_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`clerk`,label:`Clerk`,description:`Clerk OAuth`,iconUrl:G4(`clerk`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-clerk-oauth-inbound`,policyExport:`McpClerkOAuthInboundPolicy`,suggestedPolicyName:`mcp-clerk-inbound`,fields:[{key:`frontendApiUrl`,label:`Frontend API URL`,defaultValue:`$env(CLERK_FRONTEND_API_URL)`,helpText:`Clerk Frontend API URL origin, without a path.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(CLERK_CLIENT_ID)`,helpText:`Clerk OAuth application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(CLERK_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`keycloak`,label:`Keycloak`,description:`Keycloak OIDC`,iconUrl:G4(`keycloak`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-keycloak-oauth-inbound`,policyExport:`McpKeycloakOAuthInboundPolicy`,suggestedPolicyName:`mcp-keycloak-inbound`,fields:[{key:`keycloakBaseUrl`,label:`Keycloak Base URL`,defaultValue:`$env(KEYCLOAK_BASE_URL)`,helpText:`Server root URL, without /realms/{realm}.`,required:!0},{key:`realm`,label:`Realm`,defaultValue:`$env(KEYCLOAK_REALM)`,helpText:`Keycloak realm name.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(KEYCLOAK_CLIENT_ID)`,helpText:`Keycloak OIDC client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(KEYCLOAK_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`logto`,label:`Logto`,description:`Logto OIDC`,iconUrl:G4(`logto`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-logto-oauth-inbound`,policyExport:`McpLogtoOAuthInboundPolicy`,suggestedPolicyName:`mcp-logto-inbound`,fields:[{key:`logtoEndpoint`,label:`Logto Endpoint`,defaultValue:`$env(LOGTO_ENDPOINT)`,helpText:`Logto tenant endpoint or custom domain, without /oidc.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(LOGTO_CLIENT_ID)`,helpText:`Logto application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(LOGTO_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`onelogin`,label:`OneLogin`,description:`OneLogin OIDC`,iconUrl:G4(`onelogin`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-onelogin-oauth-inbound`,policyExport:`McpOneLoginOAuthInboundPolicy`,suggestedPolicyName:`mcp-onelogin-inbound`,fields:[{key:`oneLoginSubdomain`,label:`OneLogin Subdomain`,defaultValue:`$env(ONELOGIN_SUBDOMAIN)`,helpText:`Account subdomain, without .onelogin.com.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(ONELOGIN_CLIENT_ID)`,helpText:`OneLogin OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(ONELOGIN_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`ping`,label:`Ping`,description:`PingOne OIDC`,iconUrl:G4(`ping`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-ping-oauth-inbound`,policyExport:`McpPingOAuthInboundPolicy`,suggestedPolicyName:`mcp-ping-inbound`,fields:[{key:`environmentId`,label:`Environment ID`,defaultValue:`$env(PING_ENVIRONMENT_ID)`,helpText:`PingOne environment ID. Not used when custom domain is set.`,required:!1},{key:`region`,label:`Region`,defaultValue:`north-america`,helpText:`PingOne geography. Ignored when custom domain is set.`,required:!1},{key:`customDomain`,label:`Custom Domain`,defaultValue:``,helpText:`Optional PingOne custom domain without https://.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(PING_CLIENT_ID)`,helpText:`PingOne OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(PING_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`custom-oauth`,label:`Custom OAuth`,description:`Any OAuth 2.0 / OIDC identity provider`,iconUrl:`https://cdn.zuplo.com/portal/policy-icons/mcp-oauth-inbound.svg`,policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-oauth-inbound`,policyExport:`McpOAuthInboundPolicy`,suggestedPolicyName:`mcp-oauth-inbound`,fields:[],defaultOptions:{oidc:{issuer:`https://my-tenant.us.auth0.com/`,jwksUrl:`https://my-tenant.us.auth0.com/.well-known/jwks.json`,audience:`https://gateway.example.com`},browserLogin:{url:`https://my-tenant.us.auth0.com/authorize`,tokenUrl:`https://my-tenant.us.auth0.com/oauth/token`,clientId:`$env(MCP_OAUTH_CLIENT_ID)`,clientSecret:`$env(MCP_OAUTH_CLIENT_SECRET)`,scope:`openid profile email`,pkce:`none`}}}];function q4(e){return K4.find(t=>t.id===e)}function PNt(e){return Object.fromEntries(e.fields.map(e=>[e.key,e.defaultValue]))}var FNt=`Most Used`,INt=`Other`,LNt=[`rate-limit`,`api-key`],RNt=[{name:`Rate Limiting & Quotas`,baseIds:[`rate-limit`,`complex-rate-limit`,`quota`]},{name:`Authentication`,baseIds:[`api-key`,`basic-auth`,`mtls-auth`,`ldap-auth`,`open-id-jwt-auth`,`okta-jwt-auth`,`auth0-jwt-auth`,`clerk-jwt-auth`,`cognito-jwt-auth`,`firebase-jwt`,`supabase-jwt-auth`,`propel-auth-jwt`,`curity-phantom-token`,`stripe-webhook-verification`,`web-bot-auth`]},{name:`Authorization`,baseIds:[`jwt-scopes`,`openfga-authz`,`okta-fga-authz`,`axiomatics-authz`,`authzen`,`geo-filter`,`require-origin`]},{name:`MCP Authentication`,baseIds:[`mcp-oauth`,`mcp-auth0-oauth`,`mcp-clerk-oauth`,`mcp-cognito-oauth`,`mcp-entra-oauth`,`mcp-google-oauth`,`mcp-keycloak-oauth`,`mcp-logto-oauth`,`mcp-okta-oauth`,`mcp-onelogin-oauth`,`mcp-ping-oauth`,`mcp-workos-oauth`,`mcp-token-exchange`,`mcp-capability-filter`]},{name:`AI Gateway`,baseIds:[`ai-gateway-model-filtering`,`ai-gateway-fallback-model`,`ai-gateway-metering`,`ai-gateway-semantic-cache`,`ai-gateway-dlp`,`ai-gateway-smart-router`,`ai-gateway-akamai-firewall`,`ai-gateway-opik-tracing`,`ai-gateway-galileo-tracing`]},{name:`AI & Security`,baseIds:[`prompt-injection`,`bot-detection`,`akamai-firewall-for-ai`,`secret-masking`]},{name:`Caching`,baseIds:[`caching`,`semantic-cache`]},{name:`Transformations`,baseIds:[`xml-to-json`,`formdata-to-json`,`set-body`,`set-headers`,`set-query-params`,`set-status`,`remove-headers`,`remove-query-params`,`clear-headers`,`query-param-to-header`,`replace-string`,`change-method`]},{name:`Validation`,baseIds:[`validate-json-schema`,`request-validation`,`request-size-limit`]},{name:`Traffic Management`,baseIds:[`traffic-splitting`,`brownout`,`sleep`,`mock-api`,`http-deprecation`]},{name:`GraphQL`,baseIds:[`graphql-complexity-limit`,`graphql-disable-introspection`,`graphql-introspection-filter`]},{name:`Monetization & Metering`,baseIds:[`monetization`,`openmeter`,`amberflo-metering`,`moesif`,`readme-metrics`]},{name:`Logging & Tracing`,baseIds:[`audit-log`]},{name:`Upstream Auth`,baseIds:[`set-upstream-api-key`,`upstream-azure-ad-service-auth`,`upstream-firebase-admin-auth`,`upstream-firebase-user-auth`,`upstream-gcp-federated-auth`,`upstream-gcp-jwt`,`upstream-gcp-service-auth`,`upstream-zuplo-jwt-auth`]},{name:`Custom & Composite`,baseIds:[`custom-code`,`composite`]}],zNt=/-(inbound|outbound|internal)$/,J4=e=>e.replace(zNt,``),Y4=new Map;for(let e of RNt)for(let t of e.baseIds)Y4.has(t)||Y4.set(t,e.name);var BNt=e=>Y4.get(J4(e.id))??`Other`,VNt=e=>Y4.get(J4(e))===`Authentication`,HNt=e=>LNt.includes(J4(e.id)),UNt=e=>{let t=new Map,n=[];for(let r of e){HNt(r)&&n.push(r);let e=BNt(r),i=t.get(e);i?i.push(r):t.set(e,[r])}let r=[];n.length>0&&r.push({name:FNt,policies:n});for(let{name:e}of RNt){let n=t.get(e);n&&n.length>0&&r.push({name:e,policies:n})}let i=t.get(INt);return i&&i.length>0&&r.push({name:INt,policies:i}),r},WNt=[...K4.map(e=>e.policyType)];function GNt(e){return WNt.includes(e)||VNt(e)}var X4=`mcp-token-exchange-inbound`,Z4=`mcp-capability-filter-inbound`,KNt=`set-upstream-api-key-inbound`,qNt=`remove-headers-inbound`;function Q4(e){if(!e||typeof e!=`object`)return!1;let t=e.headers;if(!Array.isArray(t)||t.length!==1)return!1;let[n]=t;return typeof n==`string`&&n.toLowerCase()===`authorization`}var JNt=e=>e.toLowerCase().replaceAll(` `,`-`),$4=({name:e,onChangeName:t,disabled:n,policies:r})=>{let[i,a]=(0,H.useState)(null);return(0,U.jsxs)(`div`,{className:`grid grid-cols-12 text-sm gap-2 items-center pt-1`,children:[(0,U.jsx)(`label`,{className:`col-span-1`,children:`Name`}),(0,U.jsx)(`div`,{className:`col-span-11`,children:(0,U.jsx)(YT,{type:`text`,id:`route-handler`,"data-test":`policy-picker-name-input`,name:`route-handler`,value:e??``,disabled:n,onChange:e=>{let n=e.currentTarget.value,i=JNt(n.toLowerCase());a(nSt(i,r)),t(i)},"aria-describedby":`email-description`})}),i&&(0,U.jsx)(`div`,{className:`col-span-11 col-start-2 mt-1 text-red-600`,children:i})]})},YNt=({documentationSrc:e,className:t})=>(0,U.jsx)(`div`,{className:W(`prose prose-neutral prose-sm dark:prose-invert z-10 prose-headings:mt-2 prose-headings:text-sm max-w-full [&_li>div]:inline [&_li>div>p]:inline [&_code::before]:content-none [&_code::after]:content-none`,t),dangerouslySetInnerHTML:{__html:e}}),XNt=({documentationSrc:e})=>(0,U.jsxs)(`div`,{className:`px-4 py-2 border-t h-full overflow-y-auto h-[stretch]`,children:[(0,U.jsx)(`h3`,{className:`text-lg font-medium text-foreground`,children:`Documentation`}),(0,U.jsx)(YNt,{documentationSrc:e})]}),ZNt={[Z4]:(0,H.lazy)(()=>vn(()=>import(`./McpCapabilityFilterDesigner-NlzlzABF.js`),__vite__mapDeps([7,1,8,2])))};function QNt(e){return e?ZNt[e]:void 0}var $Nt={type:`object`,properties:{handler:{type:`object`,properties:{options:{type:`object`,title:`Ensure Gateway Internal Invocation Only`,"x-no-options":!0,description:`Accepts only requests this gateway made itself with context.invokeRoute, and answers anything that arrived over the network with 403 Forbidden.
485
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}uNt.displayName=`MiniMap`,(0,H.memo)(uNt);var dNt=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,fNt={[l4.Line]:`right`,[l4.Handle]:`bottom-right`};function pNt({nodeId:e,position:t,variant:n=l4.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=ajt(),y=typeof e==`string`?e:v,b=g4(),x=(0,H.useRef)(null),S=n===l4.Handle,C=h4((0,H.useCallback)(dNt(S&&p),[S,p]),p4),w=(0,H.useRef)(null),T=t??fNt[n];return(0,H.useEffect)(()=>{if(!(!x.current||!y))return w.current||=Wkt({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=n4([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...wOt({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,U.jsx)(`div`,{className:l0([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,H.memo)(pNt);function P4({value:e,onValueChange:t,options:n,columns:r=2,layout:i=`cards`,idPrefix:a=`wizard-choice`,ariaLabel:o,className:s}){return(0,U.jsx)(BCt,{value:e,onValueChange:e=>t(e),"aria-label":o,className:W(i===`list`?`flex flex-col gap-2`:[`grid gap-3`,r===1&&`grid-cols-1`,r===2&&`grid-cols-2`,r===3&&`grid-cols-3`],s),children:n.map(t=>{let n=`${a}-${t.value}`,r=e===t.value,o=W(`rounded-md border transition-colors`,t.disabled?`cursor-not-allowed opacity-60`:`cursor-pointer`,r?`border-zuplo-600 bg-zuplo-50 dark:bg-zuplo-950/40`:`bg-card hover:bg-neutral-50 dark:hover:bg-neutral-800/60`);return i===`list`?(0,U.jsxs)(XT,{htmlFor:n,className:W(`flex items-center gap-3 px-3 py-2.5`,o),children:[(0,U.jsx)(c0,{value:t.value,id:n,disabled:t.disabled}),t.icon,(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-center sm:gap-3`,children:[(0,U.jsx)(`div`,{className:`text-sm font-medium sm:w-56 sm:shrink-0`,children:t.title}),t.description&&(0,U.jsx)(`div`,{className:`min-w-0 flex-1 text-xs leading-snug text-muted-foreground`,children:t.description})]})]},t.value):(0,U.jsxs)(XT,{htmlFor:n,className:W(`flex flex-col gap-1.5 p-3`,o),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(c0,{value:t.value,id:n,disabled:t.disabled}),t.icon,(0,U.jsx)(`div`,{className:`text-sm font-medium`,children:t.title})]}),t.description&&(0,U.jsx)(`div`,{className:`text-xs leading-relaxed text-muted-foreground`,children:t.description})]},t.value)})})}var F4=({tiles:e,selectedId:t,onSelect:n,fallbackIcon:r,columns:i=4,emptyState:a,className:o})=>{let[s,c]=(0,H.useState)(()=>new Set);return(0,U.jsxs)(`div`,{className:W(`grid auto-rows-min gap-2 p-0.5`,i===4?`grid-cols-4`:`grid-cols-3`,o),children:[e.map(e=>{let i=t===e.id,a=s.has(e.id)||!e.iconUrl;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-pressed":i,className:W(`flex flex-col items-center justify-center gap-1.5 rounded-md border bg-card p-2 text-center transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-800/60`,i?`border-zuplo-600 bg-zuplo-50 dark:bg-zuplo-950/40`:`border-border`),children:[a?r:(0,U.jsx)(`img`,{src:e.iconUrl,alt:``,className:`size-7 object-contain brightness-0 dark:invert`,onError:()=>c(t=>new Set(t).add(e.id))}),(0,U.jsx)(`span`,{className:`w-full truncate text-xs leading-tight`,children:e.name})]},e.id)}),e.length===0&&a&&(0,U.jsx)(`div`,{className:`col-span-full py-6 text-center text-sm text-muted-foreground`,children:a})]})},mNt=`#ff00bd`,hNt=`#98036a`,gNt=`#fff0fc`,_Nt=`#9ca3af`,vNt=`#6b7280`,yNt=`#f7f9fb`,I4=152,L4=60,bNt={client:Wf,gateway:Qp,origin:Ite},xNt=`!h-0 !min-h-0 !w-0 !min-w-0 !border-0 !bg-transparent`,SNt={box:({data:e})=>{let{label:t,kind:n,emphasis:r}=e,i=bNt[n];return(0,U.jsxs)(`div`,{className:W(`flex flex-col items-center justify-center gap-1.5 rounded-lg border bg-card px-2 text-center shadow-xs`,r?`border-zuplo-600`:`border-neutral-300 dark:border-neutral-600`),style:{width:I4,height:L4},children:[(0,U.jsx)(O4,{type:`target`,position:S2.Left,isConnectable:!1,className:xNt}),(0,U.jsx)(i,{"aria-hidden":`true`,strokeWidth:1.75,className:W(`size-[18px] shrink-0`,r?`text-zuplo-600`:`text-muted-foreground`)}),(0,U.jsx)(`span`,{className:`text-xs font-medium leading-tight text-muted-foreground`,children:t}),(0,U.jsx)(O4,{type:`source`,position:S2.Right,isConnectable:!1,className:xNt})]})}},R4=[{id:`client`,type:`box`,position:{x:0,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`MCP Client`,kind:`client`,emphasis:!1},draggable:!1,selectable:!1},{id:`gateway`,type:`box`,position:{x:270,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`Zuplo MCP Gateway`,kind:`gateway`,emphasis:!0},draggable:!1,selectable:!1},{id:`origin`,type:`box`,position:{x:540,y:0},width:I4,height:L4,initialWidth:I4,initialHeight:L4,data:{label:`Origin MCP Server`,kind:`origin`,emphasis:!1},draggable:!1,selectable:!1}],CNt=e=>{let t=(e,t,n,r,i)=>({id:e,source:t,target:n,type:`smoothstep`,label:r,animated:!1,style:{stroke:i?mNt:_Nt,strokeWidth:i?2:1.5},labelStyle:{fill:i?hNt:vNt,fontWeight:i?600:500,fontSize:11},labelBgStyle:{fill:i?gNt:yNt,fillOpacity:.95},labelBgPadding:[6,3],labelBgBorderRadius:4,markerEnd:{type:x2.ArrowClosed,width:14,height:14,color:i?mNt:_Nt}});return[t(`inbound`,`client`,`gateway`,`Inbound auth`,e===`inbound`),t(`outbound`,`gateway`,`origin`,`Outbound auth`,e===`outbound`)]},z4={minX:Math.min(...R4.map(e=>e.position.x)),minY:Math.min(...R4.map(e=>e.position.y)),maxX:Math.max(...R4.map(e=>e.position.x+(e.width??I4))),maxY:Math.max(...R4.map(e=>e.position.y+(e.height??L4)))},wNt=z4.maxX-z4.minX,TNt=z4.maxY-z4.minY,ENt=.5,DNt=1.2,ONt=.12;function kNt(e,t){let n=Math.min(e/wNt,t/TNt),r=Math.min(DNt,Math.max(ENt,n*(1-ONt*2)));return{x:(e-wNt*r)/2-z4.minX*r,y:(t-TNt*r)/2-z4.minY*r,zoom:r}}var ANt=({active:e})=>{let t=(0,H.useMemo)(()=>CNt(e),[e]),n=(0,H.useRef)(null),r=(0,H.useRef)(null),i=(0,H.useCallback)(()=>{let e=n.current,t=e?.clientWidth??0,i=e?.clientHeight??0;t>0&&i>0&&r.current?.setViewport(kNt(t,i))},[]),a=(0,H.useCallback)(e=>{r.current=e,i()},[i]);return(0,H.useLayoutEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=requestAnimationFrame(i)});return r.observe(e),()=>{cancelAnimationFrame(t),r.disconnect()}},[i]),(0,U.jsx)(`div`,{ref:n,role:`img`,"aria-label":`MCP request flow, configuring ${e} authentication`,className:`h-36 w-full overflow-hidden rounded-md border border-border`,children:(0,U.jsx)(RMt,{nodes:R4,edges:t,nodeTypes:SNt,onInit:a,minZoom:ENt,maxZoom:DNt,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,edgesFocusable:!1,nodesFocusable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},style:{backgroundColor:yNt},children:(0,U.jsx)(WMt,{variant:j4.Dots,gap:16,size:1,color:`#dbe1e8`})})})};function B4(e){return e&&e.length>0?e:void 0}function V4(e){return e&&Object.keys(e).length>0?e:void 0}function jNt(e){let t=new Set;for(let n of e??[]){let e=n.trim();e&&t.add(e)}return[...t]}function H4(e,t){if(t!==`rolesAndGroups`)return{};if(e.public===!0)return{public:!0};let n=jNt(e.roles),r=jNt(e.groups);return{...n.length>0?{roles:n}:{},...r.length>0?{groups:r}:{}}}function MNt(e){let t=e&&typeof e==`object`?e:{};return{accessControlMode:t.accessControl?.mode===`rolesAndGroups`?`rolesAndGroups`:`allPublic`,catalog:{tools:U4(t.tools,`name`,e=>({name:e})),prompts:U4(t.prompts,`name`,e=>({name:e})),resources:U4(t.resources,`uri`,e=>({uri:e,name:e})),resourceTemplates:U4(t.resourceTemplates,`uriTemplate`,e=>({uriTemplate:e,name:e}))}}}function U4(e,t,n){return Array.isArray(e)?e.flatMap(e=>{if(typeof e==`string`)return e.length>0?[n(e)]:[];if(!e||typeof e!=`object`)return[];let{public:r,...i}=e,a=i[t];if(typeof a!=`string`||a.length===0)return[];let o=i.name;return[{...i,...t!==`name`&&typeof o!=`string`?{name:a}:{},...r===!0?{public:!0}:{}}]}):[]}function W4(e){return NNt(e.catalog,e.accessControlMode)}function NNt(e,t=`allPublic`){return{...t===`rolesAndGroups`?{accessControl:{mode:t}}:{},tools:e.tools.flatMap(e=>{let n=B4(e.name);if(!n)return[];let r=B4(e.description),i=V4(e.annotations),a=V4(e._meta);return[{name:n,...r?{description:r}:{},...i?{annotations:i}:{},...a?{_meta:a}:{},...H4(e,t)}]}),prompts:e.prompts.flatMap(e=>{let n=B4(e.name);if(!n)return[];let r=B4(e.description),i=V4(e._meta);return[{name:n,...r?{description:r}:{},...i?{_meta:i}:{},...H4(e,t)}]}),resources:e.resources.flatMap(e=>{let n=B4(e.uri);if(!n)return[];let r=B4(e.name),i=B4(e.description),a=B4(e.mimeType),o=V4(e._meta);return[{uri:n,...r?{name:r}:{},...i?{description:i}:{},...a?{mimeType:a}:{},...o?{_meta:o}:{},...H4(e,t)}]}),resourceTemplates:e.resourceTemplates.flatMap(e=>{let n=B4(e.uriTemplate);if(!n)return[];let r=B4(e.name),i=B4(e.description),a=B4(e.mimeType),o=V4(e._meta);return[{uriTemplate:n,...r?{name:r}:{},...i?{description:i}:{},...a?{mimeType:a}:{},...o?{_meta:o}:{},...H4(e,t)}]})}}var G4=e=>`/mcp-idp-icons/${e}.svg`,K4=[{id:`auth0`,label:`Auth0`,description:`Auth0 by Okta`,iconUrl:G4(`auth0`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-auth0-oauth-inbound`,policyExport:`McpAuth0OAuthInboundPolicy`,suggestedPolicyName:`mcp-auth0-inbound`,fields:[{key:`auth0Domain`,label:`Auth0 Domain`,defaultValue:`$env(MCP_AUTH0_DOMAIN)`,helpText:`Auth0 tenant domain, for example acme.us.auth0.com.`,required:!0},{key:`audience`,label:`Audience`,defaultValue:``,helpText:`Optional Auth0 API audience.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(MCP_AUTH0_CLIENT_ID)`,helpText:`Use an environment variable for deployable configs.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(MCP_AUTH0_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`workos`,label:`WorkOS`,description:`WorkOS User Management`,iconUrl:G4(`workos`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-workos-oauth-inbound`,policyExport:`McpWorkosOAuthInboundPolicy`,suggestedPolicyName:`mcp-workos-inbound`,fields:[{key:`clientId`,label:`Client ID`,defaultValue:`$env(WORKOS_CLIENT_ID)`,helpText:`WorkOS User Management client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(WORKOS_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`google`,label:`Google`,description:`Google OAuth`,iconUrl:G4(`google`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-google-oauth-inbound`,policyExport:`McpGoogleOAuthInboundPolicy`,suggestedPolicyName:`mcp-google-inbound`,fields:[{key:`clientId`,label:`Client ID`,defaultValue:`$env(GOOGLE_CLIENT_ID)`,helpText:`Google OAuth client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(GOOGLE_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`okta`,label:`Okta`,description:`Okta OIDC`,iconUrl:G4(`okta`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-okta-oauth-inbound`,policyExport:`McpOktaOAuthInboundPolicy`,suggestedPolicyName:`mcp-okta-inbound`,fields:[{key:`oktaDomain`,label:`Okta Domain`,defaultValue:`$env(OKTA_DOMAIN)`,helpText:`Okta org domain, for example acme.okta.com.`,required:!0},{key:`authorizationServerId`,label:`Authorization Server ID`,defaultValue:``,helpText:`Optional. Use default for Okta's default custom authorization server.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(OKTA_CLIENT_ID)`,helpText:`Okta OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(OKTA_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`entra`,label:`Microsoft Entra`,description:`Microsoft Entra ID`,iconUrl:G4(`entra`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-entra-oauth-inbound`,policyExport:`McpEntraOAuthInboundPolicy`,suggestedPolicyName:`mcp-entra-inbound`,fields:[{key:`tenantId`,label:`Tenant ID`,defaultValue:`$env(ENTRA_TENANT_ID)`,helpText:`Microsoft Entra tenant UUID.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(ENTRA_CLIENT_ID)`,helpText:`Microsoft Entra application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(ENTRA_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`cognito`,label:`Cognito`,description:`Amazon Cognito`,iconUrl:G4(`cognito`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-cognito-oauth-inbound`,policyExport:`McpCognitoOAuthInboundPolicy`,suggestedPolicyName:`mcp-cognito-inbound`,fields:[{key:`awsRegion`,label:`AWS Region`,defaultValue:`$env(COGNITO_AWS_REGION)`,helpText:`AWS region containing the Cognito user pool.`,required:!0},{key:`userPoolId`,label:`User Pool ID`,defaultValue:`$env(COGNITO_USER_POOL_ID)`,helpText:`Cognito user pool ID, for example us-east-1_AbCdEf123.`,required:!0},{key:`userPoolDomain`,label:`User Pool Domain`,defaultValue:`$env(COGNITO_USER_POOL_DOMAIN)`,helpText:`Hosted UI domain without https:// or a path.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(COGNITO_CLIENT_ID)`,helpText:`Cognito app client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(COGNITO_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`clerk`,label:`Clerk`,description:`Clerk OAuth`,iconUrl:G4(`clerk`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-clerk-oauth-inbound`,policyExport:`McpClerkOAuthInboundPolicy`,suggestedPolicyName:`mcp-clerk-inbound`,fields:[{key:`frontendApiUrl`,label:`Frontend API URL`,defaultValue:`$env(CLERK_FRONTEND_API_URL)`,helpText:`Clerk Frontend API URL origin, without a path.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(CLERK_CLIENT_ID)`,helpText:`Clerk OAuth application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(CLERK_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`keycloak`,label:`Keycloak`,description:`Keycloak OIDC`,iconUrl:G4(`keycloak`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-keycloak-oauth-inbound`,policyExport:`McpKeycloakOAuthInboundPolicy`,suggestedPolicyName:`mcp-keycloak-inbound`,fields:[{key:`keycloakBaseUrl`,label:`Keycloak Base URL`,defaultValue:`$env(KEYCLOAK_BASE_URL)`,helpText:`Server root URL, without /realms/{realm}.`,required:!0},{key:`realm`,label:`Realm`,defaultValue:`$env(KEYCLOAK_REALM)`,helpText:`Keycloak realm name.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(KEYCLOAK_CLIENT_ID)`,helpText:`Keycloak OIDC client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(KEYCLOAK_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`logto`,label:`Logto`,description:`Logto OIDC`,iconUrl:G4(`logto`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-logto-oauth-inbound`,policyExport:`McpLogtoOAuthInboundPolicy`,suggestedPolicyName:`mcp-logto-inbound`,fields:[{key:`logtoEndpoint`,label:`Logto Endpoint`,defaultValue:`$env(LOGTO_ENDPOINT)`,helpText:`Logto tenant endpoint or custom domain, without /oidc.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(LOGTO_CLIENT_ID)`,helpText:`Logto application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(LOGTO_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`onelogin`,label:`OneLogin`,description:`OneLogin OIDC`,iconUrl:G4(`onelogin`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-onelogin-oauth-inbound`,policyExport:`McpOneLoginOAuthInboundPolicy`,suggestedPolicyName:`mcp-onelogin-inbound`,fields:[{key:`oneLoginSubdomain`,label:`OneLogin Subdomain`,defaultValue:`$env(ONELOGIN_SUBDOMAIN)`,helpText:`Account subdomain, without .onelogin.com.`,required:!0},{key:`clientId`,label:`Client ID`,defaultValue:`$env(ONELOGIN_CLIENT_ID)`,helpText:`OneLogin OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(ONELOGIN_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`ping`,label:`Ping`,description:`PingOne OIDC`,iconUrl:G4(`ping`),policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-ping-oauth-inbound`,policyExport:`McpPingOAuthInboundPolicy`,suggestedPolicyName:`mcp-ping-inbound`,fields:[{key:`environmentId`,label:`Environment ID`,defaultValue:`$env(PING_ENVIRONMENT_ID)`,helpText:`PingOne environment ID. Not used when custom domain is set.`,required:!1},{key:`region`,label:`Region`,defaultValue:`north-america`,helpText:`PingOne geography. Ignored when custom domain is set.`,required:!1},{key:`customDomain`,label:`Custom Domain`,defaultValue:``,helpText:`Optional PingOne custom domain without https://.`,required:!1},{key:`clientId`,label:`Client ID`,defaultValue:`$env(PING_CLIENT_ID)`,helpText:`PingOne OIDC application client ID.`,required:!0},{key:`clientSecret`,label:`Client Secret`,defaultValue:`$env(PING_CLIENT_SECRET)`,helpText:`Use an environment variable; do not commit secrets.`,required:!0}]},{id:`custom-oauth`,label:`Custom OAuth`,description:`Any OAuth 2.0 / OIDC identity provider`,iconUrl:`https://cdn.zuplo.com/portal/policy-icons/mcp-oauth-inbound.svg`,policyModule:`$import(@zuplo/runtime/mcp-gateway)`,policyType:`mcp-oauth-inbound`,policyExport:`McpOAuthInboundPolicy`,suggestedPolicyName:`mcp-oauth-inbound`,fields:[],defaultOptions:{oidc:{issuer:`https://my-tenant.us.auth0.com/`,jwksUrl:`https://my-tenant.us.auth0.com/.well-known/jwks.json`,audience:`https://gateway.example.com`},browserLogin:{url:`https://my-tenant.us.auth0.com/authorize`,tokenUrl:`https://my-tenant.us.auth0.com/oauth/token`,clientId:`$env(MCP_OAUTH_CLIENT_ID)`,clientSecret:`$env(MCP_OAUTH_CLIENT_SECRET)`,scope:`openid profile email`,pkce:`none`}}}];function q4(e){return K4.find(t=>t.id===e)}function PNt(e){return Object.fromEntries(e.fields.map(e=>[e.key,e.defaultValue]))}var FNt=`Most Used`,INt=`Other`,LNt=[`rate-limit`,`api-key`],RNt=[{name:`Rate Limiting & Quotas`,baseIds:[`rate-limit`,`complex-rate-limit`,`quota`]},{name:`Authentication`,baseIds:[`api-key`,`basic-auth`,`mtls-auth`,`ldap-auth`,`open-id-jwt-auth`,`okta-jwt-auth`,`auth0-jwt-auth`,`clerk-jwt-auth`,`cognito-jwt-auth`,`firebase-jwt`,`supabase-jwt-auth`,`propel-auth-jwt`,`curity-phantom-token`,`stripe-webhook-verification`,`web-bot-auth`]},{name:`Authorization`,baseIds:[`jwt-scopes`,`openfga-authz`,`okta-fga-authz`,`axiomatics-authz`,`authzen`,`geo-filter`,`require-origin`]},{name:`MCP Authentication`,baseIds:[`mcp-oauth`,`mcp-auth0-oauth`,`mcp-clerk-oauth`,`mcp-cognito-oauth`,`mcp-entra-oauth`,`mcp-google-oauth`,`mcp-keycloak-oauth`,`mcp-logto-oauth`,`mcp-okta-oauth`,`mcp-onelogin-oauth`,`mcp-ping-oauth`,`mcp-workos-oauth`,`mcp-token-exchange`,`mcp-capability-filter`]},{name:`AI Gateway`,baseIds:[`ai-gateway-model-filtering`,`ai-gateway-fallback-model`,`ai-gateway-metering`,`ai-gateway-semantic-cache`,`ai-gateway-dlp`,`ai-gateway-smart-router`,`ai-gateway-akamai-firewall`,`ai-gateway-opik-tracing`,`ai-gateway-galileo-tracing`]},{name:`AI & Security`,baseIds:[`prompt-injection`,`bot-detection`,`akamai-firewall-for-ai`,`secret-masking`]},{name:`Caching`,baseIds:[`caching`,`semantic-cache`]},{name:`Transformations`,baseIds:[`xml-to-json`,`formdata-to-json`,`set-body`,`set-headers`,`set-query-params`,`set-status`,`remove-headers`,`remove-query-params`,`clear-headers`,`query-param-to-header`,`replace-string`,`change-method`]},{name:`Validation`,baseIds:[`validate-json-schema`,`request-validation`,`request-size-limit`]},{name:`Traffic Management`,baseIds:[`traffic-splitting`,`brownout`,`sleep`,`mock-api`,`http-deprecation`]},{name:`GraphQL`,baseIds:[`graphql-complexity-limit`,`graphql-disable-introspection`,`graphql-introspection-filter`]},{name:`Monetization & Metering`,baseIds:[`monetization`,`openmeter`,`amberflo-metering`,`moesif`,`readme-metrics`]},{name:`Logging & Tracing`,baseIds:[`audit-log`]},{name:`Upstream Auth`,baseIds:[`set-upstream-api-key`,`upstream-azure-ad-service-auth`,`upstream-firebase-admin-auth`,`upstream-firebase-user-auth`,`upstream-gcp-federated-auth`,`upstream-gcp-jwt`,`upstream-gcp-service-auth`,`upstream-zuplo-jwt-auth`]},{name:`Custom & Composite`,baseIds:[`custom-code`,`composite`]}],zNt=/-(inbound|outbound|internal)$/,J4=e=>e.replace(zNt,``),Y4=new Map;for(let e of RNt)for(let t of e.baseIds)Y4.has(t)||Y4.set(t,e.name);var BNt=e=>Y4.get(J4(e.id))??`Other`,VNt=e=>Y4.get(J4(e))===`Authentication`,HNt=e=>LNt.includes(J4(e.id)),UNt=e=>{let t=new Map,n=[];for(let r of e){HNt(r)&&n.push(r);let e=BNt(r),i=t.get(e);i?i.push(r):t.set(e,[r])}let r=[];n.length>0&&r.push({name:FNt,policies:n});for(let{name:e}of RNt){let n=t.get(e);n&&n.length>0&&r.push({name:e,policies:n})}let i=t.get(INt);return i&&i.length>0&&r.push({name:INt,policies:i}),r},WNt=[...K4.map(e=>e.policyType)];function GNt(e){return WNt.includes(e)||VNt(e)}var X4=`mcp-token-exchange-inbound`,Z4=`mcp-capability-filter-inbound`,KNt=`set-upstream-api-key-inbound`,qNt=`remove-headers-inbound`;function Q4(e){if(!e||typeof e!=`object`)return!1;let t=e.headers;if(!Array.isArray(t)||t.length!==1)return!1;let[n]=t;return typeof n==`string`&&n.toLowerCase()===`authorization`}var JNt=e=>e.toLowerCase().replaceAll(` `,`-`),$4=({name:e,onChangeName:t,disabled:n,policies:r})=>{let[i,a]=(0,H.useState)(null);return(0,U.jsxs)(`div`,{className:`grid grid-cols-12 text-sm gap-2 items-center pt-1`,children:[(0,U.jsx)(`label`,{className:`col-span-1`,children:`Name`}),(0,U.jsx)(`div`,{className:`col-span-11`,children:(0,U.jsx)(YT,{type:`text`,id:`route-handler`,"data-test":`policy-picker-name-input`,name:`route-handler`,value:e??``,disabled:n,onChange:e=>{let n=e.currentTarget.value,i=JNt(n.toLowerCase());a(nSt(i,r)),t(i)},"aria-describedby":`email-description`})}),i&&(0,U.jsx)(`div`,{className:`col-span-11 col-start-2 mt-1 text-red-600`,children:i})]})},YNt=({documentationSrc:e,className:t})=>(0,U.jsx)(`div`,{className:W(`prose prose-neutral prose-sm dark:prose-invert z-10 prose-headings:mt-2 prose-headings:text-sm max-w-full [&_li>div]:inline [&_li>div>p]:inline [&_code::before]:content-none [&_code::after]:content-none`,t),dangerouslySetInnerHTML:{__html:e}}),XNt=({documentationSrc:e})=>(0,U.jsxs)(`div`,{className:`px-4 py-2 border-t h-full overflow-y-auto h-[stretch]`,children:[(0,U.jsx)(`h3`,{className:`text-lg font-medium text-foreground`,children:`Documentation`}),(0,U.jsx)(YNt,{documentationSrc:e})]}),ZNt={[Z4]:(0,H.lazy)(()=>vn(()=>import(`./McpCapabilityFilterDesigner-CZevKoMn.js`),__vite__mapDeps([7,1,8,2])))};function QNt(e){return e?ZNt[e]:void 0}var $Nt={type:`object`,properties:{handler:{type:`object`,properties:{options:{type:`object`,title:`Ensure Gateway Internal Invocation Only`,"x-no-options":!0,description:`Accepts only requests this gateway made itself with context.invokeRoute, and answers anything that arrived over the network with 403 Forbidden.
486
486
 
487
487
  Put it on an app that nothing outside the gateway calls — the classifier app behind Smart Router or Prompt Injection Protection, say — in place of API Key Authentication. Those calls never leave the gateway, so a key on them protects nothing; this checks the one thing that does, that the request started inside the deployment.`,additionalProperties:!1,properties:{}}}}}},ePt={"ai-gateway-internal-only-inbound":$Nt},tPt=e=>e?ePt[e]:void 0;function nPt(e){return e[`x-no-options`]===!0&&!!e.description}function rPt(e){let t=e?.properties?.handler?.properties?.options;if(!(!t||t.type!==`object`)&&(nPt(t)||!(!t.properties||Object.keys(t.properties).length===0)))return t}function iPt(e){let t=oPt(e);if(t){let e=t.every(t3),n=t.some(t3);return e?`string-array`:n?`multiline-text`:`text`}if(e.oneOf||e.anyOf||e.allOf||e.const)return`json`;if(e.enum)return e.enum.every(e=>typeof e==`string`)?`select`:`json`;if(typeof e.type!=`string`)return`json`;switch(e.type){case`boolean`:return`boolean`;case`number`:case`integer`:return`number`;case`string`:return`text`;case`array`:{let t=e.items;if(t&&!Array.isArray(t)){if(t.type===`string`&&!t.oneOf&&!t.anyOf&&!t.allOf)return`string-array`;if(t.type===`object`&&t.properties&&Object.keys(t.properties).length>0)return`object-array`}return`json`}case`object`:{if(e.properties&&Object.keys(e.properties).length>0)return`object`;let t=e.additionalProperties;return t&&typeof t==`object`&&(t.type===`string`||t.type===`number`||t.type===`integer`)?`record`:`json`}default:return`json`}}function e3(e,t){return e.required?.includes(t)??!1}function aPt(e){return e[`x-advanced`]===!0||e[`x-show-example`]===!1}function oPt(e){if(e.allOf||e.const||e.enum)return;let t=e.oneOf??e.anyOf;if(!(!t||t.length===0)&&t.every(e=>sPt(e)||t3(e)))return t}function sPt(e){return e.type===`string`&&!e.enum&&!e.const&&!e.oneOf&&!e.anyOf&&!e.allOf}function t3(e){let t=e.items;return e.type===`array`&&!!t&&!Array.isArray(t)&&sPt(t)&&!e.oneOf&&!e.anyOf&&!e.allOf}var cPt=()=>{let e=(0,H.useContext)(dm);return!!(e?.account&&e?.project)},lPt=({children:e,onInject:t,isEnabled:n=!0})=>{let r=cPt();return!n||!r?(0,U.jsx)(`div`,{className:`relative w-full`,children:e}):(0,U.jsx)(uPt,{onInject:t,children:e})},uPt=({children:e,onInject:t})=>{let n=fm([`account`,`project`]),r=rF(n.account.name,n.project.name);return(0,U.jsxs)(Jw,{children:[(0,U.jsxs)(`div`,{className:`relative w-full`,children:[e,(0,U.jsx)(Yw,{asChild:!0,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,className:`flex-none ml-1 absolute top-1 right-1 bg-card`,title:`Select environment variable`,children:(0,U.jsx)(mte,{className:`w-4`})})})]}),(0,U.jsxs)(Zw,{children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Environment Variables`}),(0,U.jsx)(tT,{asChild:!0,children:(0,U.jsxs)(ok,{className:`mt-4 divide-y divide-double bg-gray-50 dark:bg-neutral-900 max-h-96 overflow-y-auto`,children:[r.isPending?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(fD,{className:`h-6 w-2/3 m-1`}),(0,U.jsx)(fD,{className:`h-6 w-2/3 m-1`}),(0,U.jsx)(fD,{className:`h-6 w-2/3 m-1`})]}):r.data?.length===0&&(0,U.jsx)(`div`,{className:`p-2`,children:`No environment variables`}),r.data?.map(e=>(0,U.jsxs)(`div`,{className:`p-2 py-3 flex justify-between items-center`,children:[(0,U.jsx)(`div`,{children:e.name}),(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,size:`xs`,className:`flex-none`,onClick:()=>t(e,`$env(${e.name})`),children:`Use`})})]},e.id))]})})]}),(0,U.jsx)($w,{children:(0,U.jsx)(Xw,{children:(0,U.jsx)(Y,{type:`submit`,variant:`outline`,children:`Close`})})})]})]})},n3=(0,H.createContext)(!0),r3=(0,H.createContext)([]),i3=({schema:e,value:t,onChange:n,disabled:r,allowEnvVariables:i,fieldControls:a})=>{let o=(0,H.useContext)(n3),s=i??o,c=(0,H.useContext)(r3),l=a??c,u=(e,r)=>{if(r===void 0){let{[e]:r,...i}=t;n(i)}else n({...t,[e]:r})},d=(n,i)=>(0,U.jsx)(fPt,{name:n,schema:i,parentSchema:e,required:e3(e,n),value:t[n],onChange:e=>u(n,e),disabled:r},n),f=Object.entries(e.properties??{}),p=(t,n)=>aPt(n)&&!e3(e,t),m=f.filter(([e,t])=>p(e,t)),h=f.filter(([e,t])=>!p(e,t)),g=[...h.filter(([t])=>e3(e,t)),...h.filter(([t])=>!e3(e,t))];return(0,U.jsx)(n3.Provider,{value:s,children:(0,U.jsx)(r3.Provider,{value:l,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[f.length===0&&(0,U.jsxs)(`div`,{className:`rounded-md border bg-surface-muted px-4 py-3`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:`This policy has no options`}),e.description&&(0,U.jsx)(`p`,{className:`mt-1 whitespace-pre-line text-sm text-muted-foreground`,children:e.description})]}),g.map(([e,t])=>d(e,t)),m.length>0&&(0,U.jsx)(dPt,{defaultOpen:m.some(([e])=>t[e]!==void 0),children:m.map(([e,t])=>d(e,t))})]})})})},dPt=({defaultOpen:e,children:t})=>{let[n,r]=(0,H.useState)(e);return(0,U.jsxs)(GT,{open:n,onOpenChange:r,children:[(0,U.jsxs)(KT,{className:`flex items-center gap-1 text-sm font-medium text-muted-foreground transition-colors hover:text-foreground`,children:[(0,U.jsx)(tp,{className:W(`size-4 transition-transform`,n&&`rotate-90`)}),n?`Hide advanced options`:`Show advanced options`]}),(0,U.jsx)(qT,{className:`flex flex-col gap-5 pt-5`,children:t})]})},fPt=({name:e,schema:t,parentSchema:n,required:r,value:i,onChange:a,disabled:o})=>{let s=(0,H.useId)(),c=iPt(t),l=t.description?`${s}-description`:void 0,u=(0,H.useContext)(r3).find(r=>r.matches(e,t,n)),d=u?.annotate?`${s}-annotation`:void 0,f=[l,d].filter(Boolean).join(` `)||void 0,p={id:s,name:e,schema:t,required:r,value:i,onChange:a,disabled:o,descriptionId:f},m=(0,U.jsx)(pPt,{htmlFor:s,name:e,schema:t,required:r,descriptionId:l}),h=u?.annotate?(0,U.jsx)(`div`,{id:d,className:`flex flex-col gap-1`,children:u.annotate(p)}):null;if(u?.render)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[m,u.render(p),h]});if(c===`boolean`){let e=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[m,(0,U.jsx)(z1,{id:s,"aria-describedby":f,checked:typeof i==`boolean`?i:t.default===!0,onCheckedChange:e=>a(e),disabled:o})]});return h?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,h]}):e}return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[m,(0,U.jsx)(mPt,{id:s,name:e,descriptionId:f,kind:c,schema:t,required:r,value:i,onChange:a,disabled:o}),h]})},pPt=({htmlFor:e,name:t,schema:n,required:r,descriptionId:i})=>(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsxs)(XT,{htmlFor:e,className:`capitalize`,children:[t,r?(0,U.jsx)(`span`,{className:`text-destructive`,children:` *`}):(0,U.jsx)(`span`,{className:`ml-1 font-normal normal-case text-muted-foreground`,children:`(optional)`})]}),n.description&&(0,U.jsx)(`span`,{id:i,className:`text-xs text-muted-foreground`,children:n.description})]}),mPt=({id:e,name:t,descriptionId:n,kind:r,schema:i,required:a,value:o,onChange:s,disabled:c})=>{switch(r){case`text`:return(0,U.jsx)(gPt,{id:e,name:t,descriptionId:n,schema:i,required:a,value:o,onChange:s,disabled:c});case`multiline-text`:return(0,U.jsx)(_Pt,{id:e,descriptionId:n,value:o,onChange:s,disabled:c});case`number`:return(0,U.jsx)(YT,{id:e,type:`number`,"aria-describedby":n,step:i.type===`integer`?1:void 0,value:typeof o==`number`?o:``,placeholder:typeof i.default==`number`?String(i.default):void 0,onChange:e=>{let t=e.target.value===``?NaN:Number(e.target.value);s(Number.isNaN(t)?void 0:t)},disabled:c});case`select`:return(0,U.jsxs)(_Y,{value:typeof o==`string`?o:Eit,onValueChange:e=>s(e===`__UNSET`?void 0:e),disabled:c,children:[(0,U.jsx)(yY,{id:e,"aria-describedby":n,className:`w-full`,children:(0,U.jsx)(vY,{placeholder:`Select an option`})}),(0,U.jsxs)(bY,{children:[!a&&(0,U.jsx)(xY,{value:`__UNSET`,children:(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Not set`})}),(i.enum??[]).filter(e=>typeof e==`string`).map(e=>(0,U.jsx)(xY,{value:e,children:e},e))]})]});case`string-array`:return(0,U.jsx)(vPt,{value:o,onChange:s,disabled:c});case`object-array`:return(0,U.jsx)(yPt,{schema:i,value:o,onChange:s,disabled:c});case`record`:return(0,U.jsx)(bPt,{schema:i,value:o,onChange:s,disabled:c});case`object`:return(0,U.jsx)(`div`,{className:`border rounded-md p-3 ml-1`,children:(0,U.jsx)(i3,{schema:i,value:o3(o)?o:{},onChange:e=>s(Object.keys(e).length===0?void 0:e),disabled:c})});case`json`:return(0,U.jsx)(xPt,{id:e,value:o,onChange:s,disabled:c})}};function hPt(e,t){if(!t&&!(typeof e.default!=`string`||e.default===``)&&!(typeof e.minLength==`number`&&e.minLength>=1)&&!e.pattern)return e.default}var gPt=({id:e,name:t,descriptionId:n,schema:r,required:i,value:a,onChange:o,disabled:s})=>{let c=(0,H.useId)(),l=typeof r.default==`string`?r.default:void 0,u=hPt(r,i),d=u!==void 0,f=d&&a===``,p=d&&a===void 0,m=typeof a==`string`?a:``,h=[n,d?c:void 0].filter(Boolean).join(` `)||void 0;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(a3,{id:e,value:m,placeholder:a===``?void 0:l,describedById:h,onValueChange:e=>o(e===``?void 0:e),disabled:s}),d&&(0,U.jsx)(`p`,{className:`flex flex-wrap items-baseline gap-x-2 text-xs text-muted-foreground`,children:f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{id:c,children:[`Empty value set. The default (`,u,`) is not applied.`]}),!s&&(0,U.jsx)(Y,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs`,"aria-label":`Use the default for ${t}`,onClick:()=>o(void 0),children:`Use the default`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{id:c,children:[`Leave blank to use the default (`,u,`).`]}),p&&!s&&(0,U.jsx)(Y,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs`,"aria-label":`Use an empty value for ${t}`,onClick:()=>o(``),children:`Use an empty value`})]})})]})},_Pt=({id:e,descriptionId:t,value:n,onChange:r,disabled:i})=>{let a=SPt(n);return(0,U.jsx)(Aw,{id:e,"aria-describedby":t,value:a,rows:6,onChange:e=>{let t=e.target.value;r(t===``?void 0:t)},disabled:i})},a3=({id:e,value:t,placeholder:n,onValueChange:r,disabled:i,describedById:a})=>{let o=(0,H.useContext)(n3),s=cPt(),c=o&&s&&!i;return(0,U.jsx)(lPt,{isEnabled:c,onInject:(e,t)=>r(t),children:(0,U.jsx)(YT,{id:e,value:t,placeholder:n,"aria-describedby":a,onChange:e=>r(e.target.value),disabled:i,className:W(c&&`pr-10`)})})},vPt=({value:e,onChange:t,disabled:n})=>{let r=Array.isArray(e)?e.map(e=>typeof e==`string`?e:String(e)):[],i=e=>{t(e.length===0?void 0:e)};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(a3,{value:e,onValueChange:e=>{let n=[...r];n[t]=e,i(n)},disabled:n}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Remove item`,onClick:()=>i(r.filter((e,n)=>n!==t)),disabled:n,children:(0,U.jsx)($p,{className:`size-4`})})]},t)),(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>i([...r,``]),disabled:n,children:[(0,U.jsx)(Np,{className:`size-4`}),`Add item`]})]})},yPt=({schema:e,value:t,onChange:n,disabled:r})=>{let i=Array.isArray(e.items)?void 0:e.items,a=Array.isArray(t)?t:[],o=e=>{n(e.length===0?void 0:e)};return i?(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a.map((e,t)=>(0,U.jsxs)(`div`,{className:`relative border rounded-md p-3 pr-10`,children:[(0,U.jsx)(i3,{schema:i,value:o3(e)?e:{},onChange:e=>{let n=[...a];n[t]=e,o(n)},disabled:r}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Remove item`,className:`absolute top-2 right-2`,onClick:()=>o(a.filter((e,n)=>n!==t)),disabled:r,children:(0,U.jsx)($p,{className:`size-4`})})]},t)),(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>o([...a,{}]),disabled:r,children:[(0,U.jsx)(Np,{className:`size-4`}),`Add item`]})]}):null},bPt=({schema:e,value:t,onChange:n,disabled:r})=>{let i=typeof e.additionalProperties==`object`?e.additionalProperties.type:`string`,a=i===`number`||i===`integer`,[o,s]=(0,H.useState)(()=>o3(t)?Object.entries(t).map(([e,t])=>({key:e,value:String(t)})):[]),c=e=>{s(e);let t={};for(let n of e)if(n.key!==``)if(a){if(n.value.trim()===``)continue;let e=Number(n.value);if(Number.isNaN(e))continue;t[n.key]=e}else t[n.key]=n.value;n(Object.keys(t).length===0?void 0:t)};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[o.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(YT,{value:e.key,placeholder:`Key`,onChange:n=>{let r=[...o];r[t]={...e,key:n.target.value},c(r)},disabled:r}),a?(0,U.jsx)(YT,{value:e.value,placeholder:`Value`,type:`number`,onChange:n=>{let r=[...o];r[t]={...e,value:n.target.value},c(r)},disabled:r}):(0,U.jsx)(a3,{value:e.value,placeholder:`Value`,onValueChange:n=>{let r=[...o];r[t]={...e,value:n},c(r)},disabled:r}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,"aria-label":`Remove entry`,onClick:()=>c(o.filter((e,n)=>n!==t)),disabled:r,children:(0,U.jsx)($p,{className:`size-4`})})]},t)),(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,className:`self-start`,onClick:()=>c([...o,{key:``,value:``}]),disabled:r,children:[(0,U.jsx)(Np,{className:`size-4`}),`Add entry`]})]})},xPt=({id:e,value:t,onChange:n,disabled:r})=>{let[i,a]=(0,H.useState)(()=>t===void 0?``:JSON.stringify(t,void 0,2)),[o,s]=(0,H.useState)(!1);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(Aw,{id:e,className:W(`font-mono text-xs`,o&&`border-destructive`),value:i,placeholder:`JSON value`,onChange:e=>{let t=e.target.value;if(a(t),t.trim()===``){s(!1),n(void 0);return}try{n(JSON.parse(t)),s(!1)}catch{s(!0)}},disabled:r}),o&&(0,U.jsx)(`span`,{className:`text-xs text-destructive`,children:`Invalid JSON — the last valid value will be saved.`})]})};function o3(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function SPt(e){return typeof e==`string`?e:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e.join(`
488
488
  `):``}var CPt=({designConfig:e,policyType:t,defaultHandler:n,isReadOnly:r,hasError:i,codeTabLabel:a,documentationSrc:o,designerContext:s,ref:c})=>{let{logEvent:l}=S(),u=tPt(e?.id),d=cst(u?void 0:e?.optionsSchemaUrl),f=rPt(u??d.data),p=!!f,m=!!o,h=QNt(t),g=!!h,[_,v]=(0,H.useState)(n),[y,b]=(0,H.useState)(),[x,C]=(0,H.useState)(null),w=(0,H.useRef)(void 0),T=y??(g?`designer`:p?`form`:`code`),E=()=>{let e=w.current?.getValue();if(!e)throw Error(`The policy configuration is empty`);return JSON.parse(e)};(0,H.useImperativeHandle)(c,()=>({getHandler:()=>T===`code`?E():_}));let D=t=>{if(t!==T){if(T===`code`)try{v(E())}catch(e){C(`Fix the JSON before switching: ${e instanceof Error?e.message:`Unknown error`}`);return}t===`code`&&w.current?.setValue(JSON.stringify(_,void 0,2)),C(null),b(t),l(`policy-form-editor-mode-switched`,{policy:e?.id,mode:t})}};if(d.isLoading)return(0,U.jsx)(`div`,{className:`flex items-center justify-center min-h-40`,children:(0,U.jsx)(sP,{className:`w-5 h-5 border-2`})});let O=g||p;return(0,U.jsxs)(`div`,{className:`flex flex-col min-h-0 min-w-0 h-full`,children:[(0,U.jsx)(`div`,{className:`flex items-center gap-2 border-b p-2`,children:(0,U.jsx)(SD,{variant:`outline`,type:`single`,value:T,onValueChange:e=>{e&&D(e)},children:[...g?[{value:`designer`,label:`Designer`}]:[],...p?[{value:`form`,label:`Form`}]:[],{value:`code`,label:O?`Code`:a},...m?[{value:`docs`,label:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Vf,{}),`Docs`]})}]:[]].map(({value:e,label:t})=>(0,U.jsx)(CD,{value:e,variant:`outline`,size:`xs`,className:`gap-1 px-2`,children:t},e))})}),x&&(0,U.jsx)(`p`,{className:`text-sm text-red-500 mx-3 mt-2`,children:x}),h&&(0,U.jsx)(`div`,{className:W(`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,T!==`designer`&&`hidden`),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex items-center justify-center min-h-40`,children:(0,U.jsx)(sP,{className:`w-5 h-5 border-2`})}),children:(0,U.jsx)(h,{options:_.options,onChange:e=>v({..._,options:e}),isReadOnly:r,operation:s?.operation,policyManager:s?.policyManager})})}),p&&T===`form`&&f&&(0,U.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:(0,U.jsx)(i3,{schema:f,value:wPt(_.options)?_.options:{},onChange:e=>v({..._,options:e}),disabled:r})}),(0,U.jsx)(`div`,{className:W(`flex-1 min-h-0 min-w-0`,T!==`code`&&`hidden`),children:(0,U.jsx)(bP,{options:{...fQ,readOnly:r,automaticLayout:!0},className:W({"border border-red-500":i}),width:`100%`,height:`100%`,language:`json`,onMount:e=>{w.current=e},defaultValue:JSON.stringify(_,void 0,2)})}),m&&T===`docs`&&o&&(0,U.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-y-auto p-4`,children:(0,U.jsx)(YNt,{documentationSrc:o})})]})};function wPt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var s3=({designConfig:e,policyType:t,defaultHandler:n,initialName:r,policies:i,isReadOnly:a=!1,nameDisabled:o=!1,codeTabLabel:s=`Configuration`,designerContext:c,ref:l})=>{let[u,d]=(0,H.useState)(r),[f,p]=(0,H.useState)(null),m=(0,H.useRef)(null);return(0,H.useImperativeHandle)(l,()=>({getPolicyConfig:()=>{let e=nSt(u,i);if(e)throw p(e),Error(e);if(!m.current)throw Error(`The policy editor is not ready`);try{let e=m.current.getHandler();return p(null),{name:u,handler:e}}catch(e){let t=e instanceof Error?e.message:`Unknown error`;throw p(t),Error(t)}}})),(0,U.jsxs)(`div`,{className:`flex flex-col w-full h-full min-h-0`,children:[(0,U.jsx)($4,{name:u,onChangeName:d,disabled:o,policies:i}),(0,U.jsx)(`div`,{className:`border rounded overflow-hidden mt-4 flex-1 min-h-0 min-w-0`,children:(0,U.jsx)(CPt,{ref:m,designConfig:e,policyType:t,defaultHandler:n,isReadOnly:a,hasError:!!f,codeTabLabel:s,documentationSrc:e?.exampleHtml,designerContext:c})}),f&&(0,U.jsx)(`p`,{className:`text-red-500 ml-2 mt-1`,children:f})]})},TPt=`Invalid Rewrite URL provided`,EPt=`Tip: Use the API Test Console to test the behavior of request properties and environment variables.`,DPt=e=>`${e} is not a valid pattern`,OPt=e=>`Failed to parse component(s), rewrite result: ${e}`,kPt=e=>`${e} is not a valid URL`,c3=new Proxy({},{get(e,t){return typeof t==`symbol`?()=>`superProxy.toString()`:c3}}),APt=e=>{if(e===``)return{errorType:`Error`,message:TPt};let t={url:new URL(`https://www.zuplo.com`),host:``,hostname:``,origin:``,port:``,protocol:``,headers:new Headers({}),params:{},pathname:``,method:``,query:{},search:``,env:c3,request:c3,e:encodeURIComponent,context:c3},n=(e,t={})=>Function(`vars`,[`const tagged = ( ${Object.keys(t).join(`, `)} ) =>`,`\`${e}\``,`return tagged(...Object.values(vars))`].join(`
@@ -1566,7 +1566,7 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
1566
1566
  `+t+`)`}function x8(e){let t=f8(e.defaultValue,e.type),n=e.name+`: `+String(e.type);return t&&(n+=` = ${wn(t)}`),n+S8(e.deprecationReason)}function DHt(e){return C8(e)+`directive @`+e.name+EHt(e.args)+(e.isRepeatable?` repeatable`:``)+` on `+e.locations.join(` | `)}function S8(e){return e==null?``:e===`No longer supported`?` @deprecated`:` @deprecated(reason: ${wn({kind:rr.STRING,value:e})})`}function OHt(e){return e.specifiedByURL==null?``:` @specifiedBy(url: ${wn({kind:rr.STRING,value:e.specifiedByURL})})`}function C8(e,t=``,n=!0){let{description:r}=e;if(r==null)return``;let i=wn({kind:rr.STRING,value:r,block:eee(r)});return(t&&!n?`
1567
1567
  `+t:t)+i.replace(/\n/g,`
1568
1568
  `+t)+`
1569
- `}var w8=`/docs/schema.graphql`,kHt=()=>JSON.stringify({query:uHt()}),AHt=e=>{if(!e)throw Error(`The endpoint returned an empty response.`);let t;try{t=JSON.parse(e)}catch{throw Error(`The endpoint did not return a valid JSON response.`)}if(t.errors?.length)throw Error(`The introspection query returned errors: ${t.errors.map(e=>e.message).join(`; `)}`);if(!t.data?.__schema)throw Error(`The endpoint did not return an introspection result. Make sure introspection is enabled.`);try{return`${fHt(dHt(t.data))}\n`}catch(e){throw Error(`Could not build a schema from the introspection result: ${e instanceof Error?e.message:String(e)}`)}},jHt=({endpointUrl:e,rewriteUrl:t,ape:n,onClose:r})=>{let{logEvent:i}=S(),a=um(),o=yX(),s=_F(),[c,l]=(0,H.useState)(t??e),[u,d]=(0,H.useState)([{key:``,value:``}]),[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(),g=(e,t,n)=>{d(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},_=()=>d(e=>[...e,{key:``,value:``}]),v=e=>d(t=>t.filter((t,n)=>n!==e)),y=async()=>{h(void 0),p(!0);let l=c===t?`handler`:c===e?`gateway`:`custom`,d={account:n.account.name,project:n.project.name,environment:n.environment.name,endpointMode:l};i(`graphql-schema-introspection-run`,d);let f=`request`,m;try{let e;try{f=`invalid_url`,e=new URL(c)}catch{throw Error(`Enter a valid endpoint URL, including the protocol (e.g. https://).`)}let t={"content-type":`application/json`};for(let{key:e,value:n}of u){let r=e.trim();r.length>0&&(t[r]=n)}f=`request`;let l=await(await s({environmentName:n.environment.name,testRequest:{description:`GraphQL introspection`,pathname:`${e.pathname}${e.search}`,method:`POST`,headers:t,body:kHt()},overrideUrl:e.origin})).json();if(m=l.status,l.status<200||l.status>=300)throw f=`upstream_status`,Error(`The endpoint responded with ${l.status} ${l.statusText??``}.`.trim());f=`introspection`;let p=AHt(l.body);f=`save`,await o.mutateAsync({file:{path:w8,content:p},accountName:n.account.name,projectName:n.project.name,environmentName:n.environment.name}),i(`graphql-schema-introspection-success`,{...d,upstreamStatus:m}),a.success(`Schema saved to ${w8}`),r()}catch(e){let t=e instanceof Error?e.message:String(e);i(`graphql-schema-introspection-failed`,{...d,stage:f,upstreamStatus:m,reason:t}),h(t)}finally{p(!1)}};return(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&!f&&r(),children:(0,U.jsxs)(Zw,{className:`sm:max-w-2xl`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Download GraphQL schema`}),(0,U.jsxs)(tT,{children:[`Run an introspection query against this endpoint. On success the schema is stored in `,(0,U.jsx)(`code`,{children:w8}),`.`]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(XT,{htmlFor:`graphql-introspection-endpoint`,children:`Endpoint`}),e&&e!==c&&(0,U.jsx)(Y,{variant:`link`,size:`xs`,type:`button`,className:`h-auto p-0`,disabled:f,onClick:()=>l(e),children:`Use gateway URL`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(YT,{id:`graphql-introspection-endpoint`,value:c,onChange:e=>l(e.target.value),placeholder:`https://example.com/graphql`,disabled:f,"data-op-ignore":!0}),(0,U.jsx)(cP,{textToCopy:c})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(XT,{children:`Headers (optional)`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(YT,{placeholder:`Header name`,value:e.key,onChange:e=>g(t,`key`,e.target.value),"data-op-ignore":!0}),(0,U.jsx)(YT,{placeholder:`Value`,value:e.value,onChange:e=>g(t,`value`,e.target.value),"data-op-ignore":!0}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,type:`button`,"aria-label":`Remove header`,onClick:()=>v(t),children:(0,U.jsx)(Jp,{className:`size-4`})})]},t))}),(0,U.jsx)(`div`,{children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,type:`button`,onClick:_,children:[(0,U.jsx)(Np,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Add header`})]})})]}),m&&(0,U.jsxs)(db,{variant:`destructive`,children:[(0,U.jsx)(ap,{}),(0,U.jsx)(fb,{children:`Introspection failed`}),(0,U.jsx)(pb,{className:`break-words`,children:m})]})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,type:`button`,disabled:f,children:`Cancel`})}),(0,U.jsx)(Y,{variant:`brand`,type:`button`,onClick:y,disabled:f||c.trim().length===0,children:f?`Running…`:`Run introspection`})]})]})})},MHt=({path:e,rewriteUrl:t})=>{let n=fm(),r=cc(),{logEvent:i}=S(),[a,o]=(0,H.useState)(!1),s=vF(n.environment),c=s?new URL(e,s).toString():void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,children:[(0,U.jsx)(E1,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{children:`Schema`}),(0,U.jsx)(ep,{className:`size-4 shrink-0`})]})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onSelect:()=>{i(`graphql-schema-open`,{account:n.account.name,project:n.project.name,environment:n.environment.name}),r({pathname:lo(Db.Code,{account:n.account.name,project:n.project.name,environment:encodeURIComponent(n.environment.urlParameter)}),search:`?path=${w8}`})},children:[(0,U.jsx)(Sp,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Open Schema`})]}),(0,U.jsxs)(Dq,{disabled:!c,onSelect:()=>o(!0),children:[(0,U.jsx)(hp,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Download Schema`})]})]})]}),a&&c&&(0,U.jsx)(jHt,{endpointUrl:c,rewriteUrl:t,ape:n,onClose:()=>o(!1)})]})},NHt=({operationTags:e,onTagsChanged:t})=>{let{isReadOnly:n}=JZ(),r=h1(),[i,a]=(0,H.useState)(``),o=r.openApiData?.tags?.map(e=>e.name)??[],s=n=>{e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n])},c=()=>{let n=i.trim();if(n){if(!o.includes(n))try{r.addTag(n)}catch{}e.includes(n)||t([...e,n]),a(``)}};return(0,U.jsxs)(kT,{children:[(0,U.jsx)(AT,{asChild:!0,children:(0,U.jsxs)(S6,{children:[(0,U.jsx)(Kp,{size:16}),e.length===1?(0,U.jsx)(`span`,{className:`truncate max-w-[12ch]`,title:e[0],children:e[0]}):`${e.length} Tags`]})}),(0,U.jsxs)(jT,{className:`w-64 p-0 z-100`,align:`end`,children:[(0,U.jsx)(`div`,{className:`px-3 pt-3 pb-2`,children:(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:`Operation Tags`})}),o.length>0&&(0,U.jsx)(`div`,{className:`border-t max-h-48 overflow-y-auto`,children:o.map(t=>(0,U.jsxs)(`button`,{type:`button`,disabled:n,className:`w-full flex items-center justify-between px-3 py-1.5 text-sm hover:bg-accent disabled:opacity-50 disabled:cursor-default cursor-pointer`,onClick:()=>s(t),children:[(0,U.jsx)(`span`,{className:`truncate`,children:t}),(0,U.jsx)($f,{size:14,className:W(`shrink-0`,!e.includes(t)&&`invisible`)})]},t))}),!n&&(0,U.jsx)(`div`,{className:`border-t p-2`,children:(0,U.jsxs)(`form`,{className:`flex gap-1`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,U.jsx)(YT,{value:i,onChange:e=>a(e.target.value),placeholder:`New tag...`,className:`h-7 text-xs`}),(0,U.jsx)(Y,{type:`submit`,variant:`outline`,size:`icon-sm`,disabled:!i.trim(),children:(0,U.jsx)(Np,{size:14})})]})})]})]})},PHt=r(a((e=>{var t=/~/,n=/~[01]/g;function r(e){switch(e){case`~1`:return`/`;case`~0`:return`~`}throw Error(`Invalid tilde escape: `+e)}function i(e){return t.test(e)?e.replace(n,r):e}function a(e){if(typeof e==`string`){if(e=e.split(`/`),e[0]===``)return e;throw Error(`Invalid JSON pointer.`)}else if(Array.isArray(e)){for(let t of e)if(typeof t!=`string`&&typeof t!=`number`)throw Error(`Invalid JSON pointer. Must be of type string or number.`);return e}throw Error(`Invalid JSON pointer.`)}function o(e,t){if(typeof e!=`object`)throw Error(`Invalid input object.`);t=a(t);var n=t.length;if(n===1)return e;for(var r=1;r<n;){if(e=e[i(t[r++])],n===r)return e;if(typeof e!=`object`||!e)return}}e.get=o}))());function T8(e,t){try{return e.startsWith(`#`)?PHt.get(t,e.replace(`#`,``)):PHt.get(t,e)}catch(e){console.error(`Error resolving schema reference. Reference may be invalid or referencing an external document.`,e);return}}var FHt=(e,t)=>{let n=e;return!n||`$ref`in n&&(n=T8(n.$ref,t),!n)?``:n.example?n.example:n.examples&&n.examples.length>0?n.examples[0]:n.default?n.default:``},IHt=(e,t)=>{if(e.examples&&Object.keys(e.examples).length>0){let n=Object.values(e.examples)[0];if(`$ref`in n){let e=T8(n.$ref,t);if(!e)return``;n=e}return n.value}if(e.example)return e.example;let n=e.schema;return FHt(n,t)},LHt=(e,t)=>{let n=e.requestBody;if(!n)return``;if(`$ref`in n){let e=T8(n.$ref,t);if(!e)return``;n=e}let{content:r}=n;if(!(`application/json`in r))return``;let i=r[`application/json`];if(i.examples&&Object.keys(i.examples).length>0){let e=Object.values(i.examples)[0];if(`$ref`in e){let n=T8(e.$ref,t);if(!n)return``;e=n}return e.value}let a=i.schema;return FHt(a,t)},RHt=JSON.stringify({query:`{ __schema { queryType { name } } }`},null,2),zHt=new aKe,BHt=e=>e.additionalOperationContext.method.split(`,`).map(e=>e.toUpperCase()),E8=e=>{let{oasFilePath:t,method:n,path:r}=e.additionalOperationContext;return`${t}::${e.operationId??`${n} ${r}`}`},VHt=({ape:e,envUrl:t,operation:n,openApiDocument:r,showRebuildWarning:i,onClose:a,defaultEndpointsPanelOpen:o=!1,documentsByPath:s,endpointsLoading:c})=>{let l=(t,n)=>{let r=BHt(t)[0],i=t[WX]===!0,a=YX(t),o=LHt(t,n),s=zHt.getTest(e.account.name,e.project.name,e.environment.name,t.operationId),c=t.parameters?.filter(e=>!(`$ref`in e)&&e.in===`header`).reduce((e,t)=>({...e,[t.name]:IHt(t,n)}),{})??{},l=typeof o==`string`?o:JSON.stringify(o),u=a?{"content-type":`application/json`,accept:`application/json, text/event-stream`,...c}:i?{"content-type":`application/json`,...c}:c,d=l||(a?cF:i?RHt:l);return s?.test&&s.test.method===r?s.test:{description:t.summary??t.description??``,pathname:t.additionalOperationContext.path,method:r,headers:u,body:d}},[u,d]=(0,H.useState)(n),[f,p]=(0,H.useState)(()=>l(n,r)),[m,h]=(0,H.useState)(o),g=vm(e=>e.setTestResponse),_=Sm(),v=s??_,y=(0,H.useMemo)(()=>({...v,[n.additionalOperationContext.oasFilePath]:r}),[v,n.additionalOperationContext.oasFilePath,r]),b=(0,H.useMemo)(()=>Object.entries(y).flatMap(([e,t])=>m1(e,t)),[y]),x=(0,H.useMemo)(()=>b.map(e=>({id:E8(e),method:e.additionalOperationContext.method,path:e.additionalOperationContext.path,summary:e.summary,file:e.additionalOperationContext.oasFilePath})),[b]);return(0,H.useEffect)(()=>{g(void 0)},[]),(0,U.jsx)(`div`,{className:`flex h-[650px] max-h-[70vh] flex-col`,children:(0,U.jsx)(zat,{ape:e,apiTest:f,showRebuildWarning:i,allowedMethods:BHt(u),url:`${t}${u.additionalOperationContext.path}`,shouldAllowLocalSaving:!!u.operationId,operationId:u.operationId,path:u.additionalOperationContext.path,onRequestChange:e=>{p(e)},onClose:a,endpoints:x,selectedEndpointId:E8(u),onSelectEndpoint:e=>{if(e===E8(u))return;let t=b.find(t=>E8(t)===e);if(!t)return;let n=y[t.additionalOperationContext.oasFilePath]??r;d(t),p(l(t,n)),g(void 0)},isEndpointPanelOpen:m,onToggleEndpointPanel:()=>h(e=>!e),endpointsLoading:c},E8(u))})},HHt=({envUrl:e,ape:t,operation:n,openApiDocument:r,showRebuildWarning:i,entries:a,onClose:o,defaultEndpointsPanelOpen:s})=>(0,U.jsx)(SY.Provider,{value:{entries:a},children:(0,U.jsx)(`div`,{className:`w-full text-muted-foreground`,children:(0,U.jsx)(VHt,{openApiDocument:r,ape:t,envUrl:e,showRebuildWarning:i,operation:n,onClose:o,defaultEndpointsPanelOpen:s})})}),UHt=({open:e,onOpenChange:t,onProceed:n})=>{let{saveAndDeploy:r,isPending:i}=Vmt();return(0,U.jsx)(Jw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Zw,{className:`sm:max-w-md`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Unsaved changes`}),(0,U.jsx)(tT,{children:`Your unsaved changes will not be reflected when you test this route until you save and deploy them. Save them now, or continue testing the currently deployed version.`})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,onClick:n,disabled:i,children:`Continue without saving`}),(0,U.jsx)(Y,{variant:`default`,onClick:async()=>{try{await r()}catch{return}n()},disabled:i,children:(0,U.jsx)(aP,{loading:i,children:`Save changes`})})]})]})})},WHt=(0,H.lazy)(()=>vn(()=>import(`./GraphiQLConsole-C2iTqbJq.js`),__vite__mapDeps([9,1,2,8,10,11,12]))),GHt=({path:e,method:t,summary:n,operationData:r,hasFileChanged:i,isGraphql:a})=>{let{logEvent:o}=S(),s=fm(),c=h1().getOpenApiDataEnforced(),{entries:l}=(0,H.useContext)(SY),u=vF(s.environment),[d,f]=(0,H.useState)(null),p=u?new URL(e,u).toString():void 0,m=ine({mutationKey:est})>0,[h,g]=F$(()=>(o(`test-route-clicked`,{httpPath:e,httpMethod:t.includes(`,`)?t.split(`,`)[0]:t,account:s.account.name,project:s.project.name,environment:s.environment.name,mode:a?`playground`:`default`}),(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&g(),children:(0,U.jsxs)(Zw,{showCloseButton:!1,className:`max-w-6xl! w-full gap-0 overflow-hidden p-0`,children:[(0,U.jsx)(eT,{className:`sr-only`,children:`Test route`}),(0,U.jsx)(HHt,{envUrl:u??``,showRebuildWarning:i,ape:s,entries:l,operation:r,openApiDocument:c,onClose:g})]})})),[e,t,n,r,l,a]),[_,v]=F$(()=>(o(`test-route-clicked`,{httpPath:e,httpMethod:`POST`,account:s.account.name,project:s.project.name,environment:s.environment.name,mode:`graphiql`}),(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&v(),children:(0,U.jsxs)(Zw,{className:`max-w-6xl! w-full p-0 overflow-hidden`,children:[(0,U.jsx)(eT,{className:`sr-only`,children:`GraphiQL`}),(0,U.jsx)(`div`,{className:`h-[80vh] w-full`,children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`Loading GraphiQL…`}),children:(0,U.jsx)(WHt,{url:p??``,ape:s})})})]})})),[p,s]),y=e=>{e===`graphiql`?_():h()},b=e=>{if(i){f(e);return}y(e)},x=(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{children:`Saving`}),(0,U.jsx)(iP,{color:`current`})]}),C=m?`Saving`:`Test Route`;return(0,U.jsxs)(U.Fragment,{children:[a?(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsx)(Y,{variant:`brand`,disabled:m,"aria-label":C,children:(0,U.jsxs)(aP,{loading:m,className:`flex items-center gap-2`,alternative:x,children:[(0,U.jsx)(em,{className:`shrink-0 fill-current`}),(0,U.jsx)(`span`,{children:`Test Route`}),(0,U.jsx)(ep,{className:`size-4 shrink-0`})]})})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onSelect:()=>b(`playground`),children:[(0,U.jsx)(em,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Playground`})]}),(0,U.jsxs)(Dq,{disabled:!p,onSelect:()=>b(`graphiql`),children:[(0,U.jsx)(E1,{className:`size-4`}),(0,U.jsx)(`span`,{children:`GraphiQL`})]})]})]}):(0,U.jsx)(Y,{variant:`brand`,disabled:m,"aria-label":C,onClick:()=>b(`playground`),children:(0,U.jsxs)(aP,{loading:m,className:`flex items-center gap-2`,alternative:x,children:[(0,U.jsx)(em,{className:`shrink-0 fill-current`}),(0,U.jsx)(`span`,{children:`Test Route`})]})}),(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(UHt,{open:d!==null,onOpenChange:e=>{e||f(null)},onProceed:()=>{let e=d;f(null),e&&y(e)}})})]})},KHt=({onRequestHandlerChange:e,isReadOnly:t,routeHandler:n})=>{let r=O1(n),i=(t,i)=>{e({...n,options:{...r.options,[t]:i}})};return(0,U.jsxs)(ok,{className:`p-4 bg-surface-sunken`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-base font-medium`,children:`MCP Server Options`}),(0,U.jsx)(JT,{showIcon:!0,href:`https://docs.zuplo.com/handlers/mcp-server`,className:`text-sm text-zuplo-pink`,children:`MCP Server Docs`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-12 gap-4 col-span-full items-center`,children:[(0,U.jsx)(`div`,{className:`col-span-8`,children:(0,U.jsx)(b6,{isReadOnly:t,label:`Server Name`,onChange:e=>i(`name`,e.target.value),className:`col-span-8`,value:typeof r.options.name==`string`?r.options.name:`My MCP Server`})}),(0,U.jsx)(`div`,{className:`col-span-4`,children:(0,U.jsx)(b6,{isReadOnly:t,label:`Server Version`,className:`col-span-4`,onChange:e=>i(`version`,e.target.value),value:typeof r.options.version==`string`?r.options.version:`v0.0.1`})}),(0,U.jsxs)(`div`,{className:`col-span-12 mt-2`,children:[(0,U.jsx)(XT,{className:`text-sm mb-2 block`,children:`Advanced Options`}),(0,U.jsx)(`div`,{className:W(`flex gap-4`,t&&`opacity-50`),children:(0,U.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,U.jsx)(FY,{"data-test":`mcp-debug-mode`,checked:!!r.options.debugMode,onCheckedChange:e=>{i(`debugMode`,e)},disabled:t}),`Debug Mode`]})})]})]})]})},qHt=({routeHandler:e,operation:t,isReadOnly:n,onRequestHandlerChange:r})=>{let{captureRaw:i}=S(),a=cxt(),o=O1(e),s=typeof o.options.rewritePattern==`string`?o.options.rewritePattern:``,c=lzt(()=>{i(`mcp-gateway-upstream-url-edited`)});return(0,U.jsx)(ok,{className:`p-4`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground font-medium`,children:`Upstream MCP server`}),!!(a&&t)&&(0,U.jsxs)(Y,{type:`button`,variant:`default`,size:`sm`,disabled:n,onClick:()=>{!t||!a||(i(`mcp-gateway-edit-virtual-mcp-opened`),a(t))},className:`shrink-0`,children:[(0,U.jsx)(Ip,{className:`w-3.5 h-3.5`}),`Edit MCP Server Policy`]})]}),(0,U.jsx)(u3,{isReadOnly:n,url:s,onUrlChange:t=>{c(),r({...e,options:{...o.options,rewritePattern:t}})},placeholder:`https://example.com/mcp`,"aria-label":`Upstream MCP server URL`,"data-test":`mcp-upstream-url-input`})]})})};function JHt(e){if(e)switch(e.type){case`tool`:return{type:e.type,name:e.name??``,description:e.description??``,annotations:e.annotations};case`prompt`:return{type:e.type,name:e.name??``,description:e.description??``};case`resource`:return{type:e.type,name:e.name??``,description:e.description??``,uri:e.uri??``,mimeType:e.mimeType??``};case`graphql`:return{type:e.type,introspectionTool:{name:e.introspectionTool?.name??``,description:e.introspectionTool?.description??``},executeTool:{name:e.executeTool?.name??``,description:e.executeTool?.description??``}}}}function YHt({operationData:e,addRouteMenuProps:t}){return e?(0,U.jsx)(`div`,{className:`w-full h-full min-h-0 overflow-y-auto px-4 pt-2 pb-4`,children:(0,U.jsx)(ZHt,{operationData:e})}):(0,U.jsx)(pbt,{...t})}var XHt=()=>{let e=xm(),t=Sm(),n=(0,H.useMemo)(()=>e.flatMap(e=>{let n=t[e.path];return n?m1(e.path,n).filter(e=>YX(e)).map(t=>[e,t]):[]}),[e,t]);return{getLinkedMcpServers:(e,t)=>n.filter(([,n])=>{let r=n[KX]?.handler;return qX(r)?r.options?.operations?.some(n=>T1(n.file)===e&&n.id===t):!1})}},ZHt=({operationData:e})=>{let[t]=CY(`path`);if(!t)throw Error(`Open API file path not found in URL`);let n=Bmt(t),r=fm(),{logEvent:i}=S(),{additionalOperationContext:a,...o}=e,{path:s,method:c}=a,l=h1(),u=um(),d=A1(),{isReadOnly:f}=JZ(),[p,m]=(0,H.useState)(),[h,g]=(0,H.useState)();XHt();let _=l.openApiData?.servers?.at(0)?.url,v=o[KX]??_1(_??`https://echo.zuplo.io`),y=o[UX]===!0,b=o.deprecated===!0,x=o[WX]===!0,C=l.openApiFileModel.saveState!==Ql.unmodified,w=v.handler,T=qX(w)&&c.toUpperCase()!==`POST`?`MCP Server handler must use POST method`:void 0,E=e=>{try{l.updateOperation({path:s,method:c,newMethod:e.export===`mcpServerHandler`?`post`:void 0,newOperationObject:{...o,[KX]:{...v,handler:{...e}}}})}catch(e){u.error(e instanceof Error?e.message:`Unknown error`)}},D=e=>{l.updateOperation({path:s,method:c,newOperationObject:{...o,summary:e}})},O=e=>{l.updateOperation({path:s,method:c,newOperationObject:{...o,description:e}})},k=e=>{i(`route-visibility-changed`,{excludeFromDocs:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),l.updateOperation({path:s,method:c,newOperationObject:{...o,[UX]:e}})},A=e=>{i(`route-deprecated-changed`,{deprecated:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),l.updateOperation({path:s,method:c,newOperationObject:{...o,deprecated:e||void 0}})},j=e=>{i(`route-graphql-changed`,{graphql:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name});let n={...o};e?(n[WX]=!0,Zyt(d),n[KX]=Xyt(v,!0)):(delete n[WX],o[KX]&&(n[KX]=Xyt(v,!1))),l.updateOperation({path:s,method:c,newOperationObject:n})},M=e=>{let{newPath:t}=e,{newMethod:n}=e;h!=null&&t==null&&(t=h);try{l.updateOperation({path:s,newPath:t,method:c,newMethod:n,newOperationObject:o}),m(void 0),g(void 0)}catch(e){e instanceof Error&&t!=null&&(g(t),m(e.message))}},N=e=>{if(e===s){m(void 0),g(void 0);return}M({newPath:e.startsWith(`/`)?e:`/${e}`})},P=e=>{let n=e;n!==c&&(i(`route-method-changed`,{httpMethod:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),M({newMethod:n}))},F=e=>{let n={...v,corsPolicy:e};l.updateOperation({path:s,method:c,newOperationObject:{...o,[KX]:n}}),i(`route-cors-changed`,{newCors:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name})},I=e=>{let t={...o};e.length>0?t.tags=e:delete t.tags,l.updateOperation({path:s,method:c,newOperationObject:t})},L=n=>{let a={...e.additionalOperationContext.pathZuploConfig,pathMode:n},o=l.getOpenApiDataEnforced().paths;if(!o)throw Error(`Property 'paths' is undefined`);let c=o[s];if(!c)throw Error(`Path Item '${s}' is undefined`);l.updatePathItem(s,{...c,[GX]:a}),i(`route-path-mode-changed`,{pathMode:n,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name})},R=()=>{n(Ql.modified)};return(0,U.jsxs)(`div`,{className:`mb-4 flex flex-col gap-6`,children:[(0,U.jsxs)(ok,{className:`bg-neutral-50 dark:bg-transparent`,children:[(0,U.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{children:`Request Handling`}),(0,U.jsx)(lk,{})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 p-6`,children:[x&&(0,U.jsx)(MHt,{path:s,rewriteUrl:typeof w.options?.rewritePattern==`string`?w.options?.rewritePattern:void 0}),(0,U.jsx)(sVt,{operationData:e}),(0,U.jsx)(GHt,{path:s,method:c,summary:o.summary??``,operationData:e,hasFileChanged:C,isGraphql:x})]})]}),(0,U.jsxs)(uk,{className:`grid grid-cols-1 xl:grid-cols-[max-content_1fr] gap-y-3 xl:gap-y-2 items-center gap-x-6`,children:[(0,U.jsx)(gVt,{isReadOnly:f,initialPath:s,method:c,onChangeMethod:P,pathMode:e.additionalOperationContext.pathZuploConfig?.pathMode,hasError:p!=null,onPathChange:N,onPathModeChange:L,onFieldModified:R,isMcpToolHandler:qX(w)||JX(w)}),p&&(0,U.jsx)(db,{"data-test":`path-error`,className:`col-span-full p-2`,variant:`destructive`,children:(0,U.jsx)(pb,{children:p})}),T&&(0,U.jsx)(db,{className:`col-span-full p-2 py-1`,variant:`destructive`,children:(0,U.jsxs)(pb,{"data-test":`request-handler-error`,className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{children:T}),(0,U.jsx)(Y,{onClick:()=>P(`post`),size:`xs`,variant:`outline`,className:`border-none`,children:`Switch to POST method`})]})}),(0,U.jsx)(yFt,{isReadOnly:f,initialSummary:o.summary,onSummaryChange:D,onFieldModified:R}),(0,U.jsx)(cVt,{isReadOnly:f,defaultOperationId:e.operationId,openApiManager:l,path:s,method:c,operationData:e})]}),(0,U.jsxs)(dk,{className:`flex flex-wrap gap-2 px-3 py-1.5 bg-card justify-end`,children:[(0,U.jsx)(NHt,{operationTags:o.tags??[],onTagsChanged:I}),(0,U.jsx)(Vzt,{isReadOnly:f,selectedCorsPolicy:v.corsPolicy,corsPolicies:d.corsPolicyList??[],onSelectionChanged:F}),!qX(v.handler)&&!JX(v.handler)&&(0,U.jsx)(pVt,{operation:e,defaultValues:JHt(v.mcp),onSubmit:e=>{let t={...v,mcp:e};l.updateOperation({path:s,method:c,newOperationObject:{...o,[KX]:t}})}}),(0,U.jsx)(IBt,{isExcludedFromDocs:y,onVisibilityChanged:k}),(0,U.jsx)(_Vt,{isGraphql:x,onGraphqlChanged:j,isDeprecated:b,onDeprecatedChanged:A})]})]}),(0,U.jsx)(nzt,{inboundPolicies:v.policies?.inbound??[],outboundPolicies:v.policies?.outbound??[],operation:e,children:(0,U.jsx)(QHt,{isReadOnly:f,operationData:e,handler:v.handler,firstServerUrl:_,onRequestHandlerChange:E})}),(0,U.jsx)(FBt,{initialDescription:o.description??``,onChange:O,path:s,method:c,oasFilePath:t})]})},QHt=({operationData:e,handler:t,firstServerUrl:n,isReadOnly:r,onRequestHandlerChange:i})=>{let a=(e[KX]??_1(n??`https://echo.zuplo.io`)).handler;switch(t.export){case`mcpServerHandler`:return(0,U.jsx)(KHt,{isReadOnly:r,routeHandler:a,onRequestHandlerChange:i});case`McpProxyHandler`:case`McpVirtualServerHandler`:case`mcpVirtualServerHandler`:return(0,U.jsx)(qHt,{routeHandler:a,operation:e,isReadOnly:r,onRequestHandlerChange:i});default:return(0,U.jsx)(Lzt,{isReadOnly:r,routeHandler:a,onRequestHandlerChange:i})}},$Ht=De()(e=>({updateLinkedMcpServers:void 0,setUpdateLinkedMcpServers:t=>e({updateLinkedMcpServers:t})})),eUt=()=>{let e=j($Ht,e=>e.updateLinkedMcpServers),t=cQ(),n=()=>{$Ht.setState({updateLinkedMcpServers:void 0})};return(0,U.jsx)(Jw,{open:!!e,onOpenChange:e=>{e||n()},children:(0,U.jsxs)(Zw,{children:[(0,U.jsx)(eT,{children:`MCP Server Links`}),(0,U.jsx)(tT,{children:`This operation is linked to MCP servers, if you update the operation id, you need to update the MCP server links as well.`}),(0,U.jsx)(`div`,{className:`flex gap-2 items-center justify-center`,children:e?.linkedMcpServers.map(([,e])=>(0,U.jsx)(BT,{children:e},e))}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:n,children:`Cancel`}),(0,U.jsx)(Y,{onClick:()=>{e?.linkedMcpServers.forEach(([n,r])=>{let i=new Lyt(n,t),a=i.getOperationById(r);if(!a)return;let o=a[KX];if(!o)return;let s=o.handler;if(qX(s)){if(n.path===e.file){let t=i.getOperationById(e.oldOperationId);if(!t)throw Error(`Operation not found`);i.updateOperation({path:t.additionalOperationContext.path,method:t.additionalOperationContext.method,newOperationObject:G$(t,`operationId`,e.newOperationId)})}i.updateOperation({path:a?.additionalOperationContext.path,method:a.additionalOperationContext.method,newOperationObject:G$(a,`${KX}.handler.options.operations`,s.options?.operations?.map(t=>T1(t.file)===n.path?{...t,id:t.id===e.oldOperationId?e.newOperationId:t.id}:t))})}})},children:`Update`})]})]})})},tUt=`$import(@zuplo/runtime)`,nUt=`${tUt}::urlForwardHandler`,rUt=`${tUt}::urlRewriteHandler`,iUt=(e,t)=>{let n=e.options?.[t],r=typeof n==`string`?n.trim():``;return r.length>0?r:void 0},aUt=e=>{let t=e.trim();if(t.startsWith("${")){let e=t.indexOf(`}`);if(e!==-1)return t.slice(0,e+1)}let n=/^[a-z][a-z0-9+.-]*:\/\/[^/$?#]+/i.exec(t);if(n)return n[0];let r=t.indexOf(`/`);return r===-1?t:t.slice(0,r)},oUt=e=>{if(e){let t=`${e.module}::${e.export}`,n=t===nUt?iUt(e,`baseUrl`):t===rUt?iUt(e,`rewritePattern`):void 0;if(n){let e=aUt(n);return{key:`target:${e}`,label:e,mono:!0,icon:Tp,collapsible:!0}}}return{...Xbt(e),collapsible:!1}};function sUt(){let e=h1(),{captureRaw:t}=S(),n=fm(),r=aQ();return i=>{e.updateInfo(i),t(`openapi-info-updated`);let{projectTreeNodes:a,filesByPath:o}=vm.getState(),s=a.map(e=>e.path?o[e.path]:void 0).filter(e=>!!e&&e.saveState===Ql.modified);s.length!==0&&r.mutateAsync({environmentName:n.environment.name,accountName:n.account.name,projectName:n.project.name,files:s}).catch(()=>{})}}var D8=`Document Order`,cUt=[`Document Order`,`Path`,`Summary`],O8=`Untagged`,lUt=[{value:`none`,label:`None`},{value:`path`,label:`Path`},{value:`handler`,label:`Handler type`},{value:`target`,label:`Target`}],uUt=new Set([`handler`,`target`]);function dUt(e){return`${e}-${B().split(`-`).at(0)}`}function k8(e){return new Set(e.getPolicyListEnforced().map(e=>e.name))}function fUt(e){if(!e)return;let t=uFt(e.getPolicyListEnforced());if(t)return t.name;let n=_3(cFt,k8(e));return e.createPolicy(lFt(n)),n}var pUt=e=>(t,n)=>{switch(e){case`Document Order`:return 0;case`Path`:return t.additionalOperationContext.path.localeCompare(n.additionalOperationContext.path);case`Summary`:return!t.summary&&!n.summary?0:!t.summary&&n.summary?1:t.summary&&!n.summary?-1:t.summary?.localeCompare(n.summary??``)??0;default:return 0}},mUt=e=>t=>{if(e.length===0)return!0;let n=t.tags;return!n||n.length===0?e.includes(O8):n.some(t=>e.includes(t))},hUt=({onNavigateToOpenApiFileTab:e})=>{let{logEvent:t,captureRaw:n}=S(),[r,i]=Lit(`tags`,[]),[a,o]=NT(`open-api-designer-group-by`,`none`);(0,H.useEffect)(()=>{let e=window.localStorage.getItem(`open-api-designer-show-headers`);e!==null&&(e===`true`&&a===`none`&&o(`path`),window.localStorage.removeItem(`open-api-designer-show-headers`))},[a,o]);let[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(`details`),[d,f]=(0,H.useState)(!1),p=sUt(),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||(e.preventDefault(),m.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let[h,g]=(0,H.useState)(),[_,v]=(0,H.useState)(),[y,b]=(0,H.useState)(()=>new Set),x=e=>b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[C,w]=(0,H.useState)(()=>new Set),T=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),{isReadOnly:E}=JZ(),[D,O]=CY(`operation`),[k,A]=NT(`default-sort-routes`,D8),[j,M]=CY(`sort`,k);(0,H.useEffect)(()=>{j&&A(j)},[A,j]),(0,H.useEffectEvent)(()=>{if(D)try{document.querySelector(`#op-${D}`)?.scrollIntoView()}catch{}});let[N,P]=(0,H.useState)(void 0),F=h1(),I=A1(),L=dP(),R=lQ(Zbt),z=uQ(),ee=()=>{if(R)return $bt(R.content??``)?`ok`:`manual`;let e=Qbt,t={path:Zbt,content:e,type:Zl.File,saveState:Ql.new};if(L){let n=L.Uri.file(t.path);L.editor.getModel(n)||L.editor.createModel(e,void 0,n)}return z(t),z({...t,saveState:Ql.modified}),`ok`},{results:te,setSearchTerm:V,searchTerm:ne}=jbt(F.operationArray?.filter(mUt(r)).sort(pUt(j))??[],{keys:[e=>e.additionalOperationContext.path,e=>e.summary??``,e=>e.operationId,e=>e.additionalOperationContext.method]});(0,H.useEffect)(()=>{let e=ne?.trim()??``;if(e.length===0)return;let n=setTimeout(()=>{t(`route-search-used`,{view:`routes`,query:e,queryLength:e.length})},600);return()=>clearTimeout(n)},[ne,t]);let re=(()=>{let e=new Map;for(let t of te){let n,r,i,o,s;if(a===`handler`||a===`target`){let e=t[KX]?.handler,c=a===`target`?oUt(e):{...Xbt(e),collapsible:!1};({key:n,label:r,mono:i,collapsible:o,icon:s}=c)}else n=t.additionalOperationContext.path,r=n,i=!0,o=!1,s=void 0;let c=e.get(n);c?c.operations.push(t):e.set(n,{key:n,label:r,mono:i,icon:s,collapsible:o,operations:[t]})}return[...e.values()]})(),[ie,ae]=(0,H.useState)(),[oe,se]=(0,H.useState)(),[ce,le]=(0,H.useState)(!1),ue=(0,H.useMemo)(()=>{if(!_)return[];let e=(F.operationArray?.find(e=>e.additionalOperationContext.path===_.path&&e.additionalOperationContext.method===_.method))?.[KX]?.policies?.inbound??[];if(e.length===0)return[];let t=new Set;for(let e of I.policyList??[]){if(e.policyType!==`composite-inbound`&&e.policyType!==`composite-outbound`)continue;let n=e.handler.options?.policies;if(n)for(let e of n)t.add(e)}let n=I.policiesUsageInfo??[];return e.map(e=>n.find(t=>t.name===e)).filter(e=>{if(!e||e.operations.length!==1)return!1;let n=e.operations[0];return!(n.additionalOperationContext.path!==_.path||n.additionalOperationContext.method!==_.method||t.has(e.name))})},[_,F.operationArray,I.policyList,I.policiesUsageInfo]),[de,fe]=(0,H.useState)(()=>new Set);(0,H.useEffect)(()=>{fe(_?new Set(ue.map(e=>e.name)):new Set)},[_]);let pe=(e,t)=>{fe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},me=()=>{if(_==null){le(!1);return}try{for(let e of de)try{I.deletePolicy(e),t(`policy-deleted`,{policy:e})}catch{}F.deleteOperation(_.path,_.method),t(`route-deleted`,_)}catch(e){e instanceof Error&&(t(`route-deletion-failed`,_),P(e.message),he())}v(void 0),le(!1)},[he,ge]=F$(()=>{let t=()=>{P(void 0),ge()};return(0,U.jsx)(xQ,{alertType:`ERROR`,bodyText:N??``,onPrimaryButtonClick:e,onSecondaryButtonClick:t,primaryButtonText:`Edit file directly`,secondaryButtonText:`Cancel`,hideModal:t,title:`Error`})},[N]),[_e,ve]=F$(()=>(0,U.jsx)(xQ,{alertType:`CAUTION`,bodyText:`Cannot reorder in this view — view by Document Order to reorganize the order of operations.`,onPrimaryButtonClick:()=>{M(D8),ve()},onSecondaryButtonClick:ve,primaryButtonText:`Switch to Document Order`,secondaryButtonText:`Cancel`,hideModal:ve,title:`Cannot reorder`})),[ye,be]=F$(()=>(0,U.jsx)(txt,{open:!0,onOpenChange:e=>{e||be()}})),xe=(e,t)=>{if(j!==D8){_e();return}F.movePathInDocument(e,t)};if(!F.openApiData)throw Error(`Invalid State - no OpenApiData`);let Se=F.openApiData.info,Ce=F.openApiData.tags?.map(e=>({value:e.name,label:e.name}));Ce?.push({value:O8,label:O8});let we=()=>{let e=S1.OpenAPIV3.HttpMethods.GET,n=F.openApiData?.servers?.at(0)?.url,r=Jyt(n??`https://echo.zuplo.io`),i=`/path-${((F.operationArray?.filter(t=>t.additionalOperationContext.path.startsWith(`/path-`)&&t.additionalOperationContext.method===e)?.map(e=>parseInt(e.additionalOperationContext.path.replace(`/path-`,``),10))?.filter(e=>!Number.isNaN(e))?.sort((e,t)=>t-e))?.at(0)??0)+1}`;try{let t=F.addOperation(i,e,r);t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:i,httpMethod:e}),P(n.message),he())}t(`route-added`)},Te=(e,n,r)=>{let i=F.openApiData?.servers?.at(0)?.url,a=Jyt(i??`https://echo.zuplo.io`),o=r?.[KX],s=a[KX];o&&s&&(o.handler&&(s.handler=JSON.parse(JSON.stringify(o.handler))),o.policies&&(s.policies=JSON.parse(JSON.stringify(o.policies))));try{let t=F.addOperation(e,n,a);t&&O(t)}catch(r){r instanceof Error&&(t(`route-add-failed`,{httpPath:e,httpMethod:n}),P(r.message),he())}t(`route-added`)},Ee=()=>{let e=S1.OpenAPIV3.HttpMethods.POST,n=dUt(`mcp`),r=F.addOperation(`/mcp`,e,{summary:`MCP Server`,description:`Default MCP Server`,[KX]:{corsPolicy:`none`,handler:{export:`mcpServerHandler`,module:`$import(@zuplo/runtime)`,options:{operations:[]}},policies:{inbound:[]}},operationId:n},{avoidConflict:!0});r&&O(r),t(`route-added`)},De=()=>{let e=S1.OpenAPIV3.HttpMethods.POST,n=Qyt(`https://rickandmortyapi.com/graphql`);try{Zyt(I);let t=F.addOperation(`/graphql`,e,n,{avoidConflict:!0});t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:`/graphql`,httpMethod:e}),P(n.message),he())}t(`route-added`)},Oe=()=>{let e=S1.OpenAPIV3.HttpMethods.GET,n=$yt();try{let t=F.addOperation(`/websocket`,e,n,{avoidConflict:!0});t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:`/websocket`,httpMethod:e}),P(n.message),he())}t(`route-added`)},[ke,Ae]=(0,H.useState)(!1),[je,Me]=(0,H.useState)(),[Ne,Pe]=(0,H.useState)(0),Fe=(0,H.useMemo)(()=>{let e=new Set(Object.keys(F.openApiData?.paths??{}));return je&&e.delete(je.path),e},[F.openApiData?.paths,je]),Ie=async e=>{let n;try{n=ee()}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}let r;try{r=fFt({result:e,policyList:I.getPolicyListEnforced(),existingOperationIds:new Set(F.operationArray?.map(e=>e.operationId)??[])});for(let e of r.policiesToCreate)I.createPolicy(e)}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}try{let e=F.addOperation(r.operationPath,r.method,r.operation,{avoidConflict:!0});e&&O(e)}catch(e){e instanceof Error&&(P(e.message),he())}t(`route-added`),t(`mcp-gateway-create-virtual-mcp-submitted`,pFt(e)),n===`manual`&&ye()},Le=()=>{Pe(e=>e+1),Ae(!0)},Re=e=>{let t=$Pt({operationPath:e.additionalOperationContext.path,operation:e,policyList:I?.getPolicyListEnforced()??[]});t&&(Pe(e=>e+1),Me({initialResult:t,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method,operationId:e.operationId}))},ze=async e=>{let t=je;if(!t)return;let{initialResult:r,path:i,method:a}=t,o=F.operationArray?.find(e=>e.additionalOperationContext.path===i&&e.additionalOperationContext.method===a);if(!o){Me(void 0);return}let s;try{s=ee()}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}let c=oFt(e.step1.name),l=a0(e.step1.mcpUrl),u=l?.protectedResourceMetadataUrl??dFt(e.step1.mcpUrl),d=o[KX]?.policies?.inbound??[],f=I?.getPolicyListEnforced()??[],p=new Map(f.map(e=>[e.name,e])),m=d.map(e=>p.get(e)).filter(e=>e!=null),h=m.find(e=>e.policyType===X4),g=m.find(e=>e.policyType===Z4),_=m.find(e=>e.policyType===`remove-headers-inbound`&&Q4(e.handler?.options)),v=m.find(e=>e.policyType.startsWith(`upstream-`)),y;if(e.step1.authMode===`user-oauth`){let t={id:c,displayName:e.step1.name,summary:`${e.step1.name} remote MCP server, federated via the gateway.`,...u?{protectedResourceMetadataUrl:u}:{},authMode:`user-oauth`,scopes:l?.scopes??[],clientRegistration:e.step1.clientRegistration};if(h&&I)try{I.updatePolicy(h.name,{...h,handler:{...h.handler,options:t}}),y=h.name}catch(e){if(e instanceof Error){P(e.message),he();return}}else if(I){y=_3(`mcp-upstream-${c}`,k8(I));try{I.createPolicy({name:y,policyType:X4,handler:{module:`$import(@zuplo/runtime/mcp-gateway)`,export:`McpTokenExchangeInboundPolicy`,options:t}})}catch(e){if(e instanceof Error){P(e.message),he();return}}}}let b;if(e.step1.authMode===`upstream-policy`&&I){let{policyType:t,policyName:n,handler:r}=e.step1;try{v&&v.policyType===t?I.updatePolicy(v.name,{...v,name:n,handler:r}):I.createPolicy({name:n,policyType:t,handler:r}),b=n}catch(e){if(e instanceof Error){P(e.message),he();return}}}let x;if(e.step2.catalogMode===`curated`){let t=W4(e.step2);if(g&&I)try{I.updatePolicy(g.name,{...g,handler:{...g.handler,options:t}}),x=g.name}catch(e){if(e instanceof Error){P(e.message),he();return}}else if(I){x=_3(`mcp-filter-${c}`,k8(I));try{I.createPolicy({name:x,policyType:Z4,handler:{module:`$import(@zuplo/runtime/mcp-gateway)`,export:`McpCapabilityFilterInboundPolicy`,options:t}})}catch(e){if(e instanceof Error){P(e.message),he();return}}}}let S;if(e.step3.authPolicyChoice===`existing`)S=e.step3.existingPolicyName;else if((e.step3.authPolicyChoice===`new`||e.step3.authPolicyChoice===`new-other`)&&(S=e.step3.newPolicyName,I))try{I.createPolicy({name:S,policyType:e.step3.policyType,handler:e.step3.handler})}catch(e){if(e instanceof Error){P(e.message),he();return}}let C;if(e.step1.authMode===`none`&&e.step1.noAuthBehavior===`strip`)try{C=_?.name??fUt(I)}catch(e){if(e instanceof Error){P(e.message),he();return}}let w=[S,x,y,b,C].filter(e=>!!e),T=o[KX],E=T?.handler;try{F.updateOperation({path:i,method:a,newOperationObject:{...o,summary:e.step1.name,description:`MCP Virtual Server fronted by the gateway (${e.step1.mcpUrl})`,[KX]:{...T??{},handler:{...E??{export:`McpProxyHandler`,module:`$import(@zuplo/runtime/mcp-gateway)`},options:{...E?.options??{},rewritePattern:e.step1.mcpUrl}},policies:{...T?.policies??{},inbound:w}}}})}catch(e){if(e instanceof Error){P(e.message),he();return}}let D;try{D=new URL(e.step1.mcpUrl).hostname}catch{D=void 0}n(`mcp-gateway-edit-virtual-mcp-submitted`,{upstreamHost:D,upstreamAuthMode:e.step1.authMode,previousUpstreamAuthMode:r.step1.authMode,inboundAuthChoice:e.step3.authPolicyChoice,previousInboundAuthChoice:r.step3.authPolicyChoice}),Me(void 0),s===`manual`&&ye()},Be=(0,H.useMemo)(()=>D?te.find(e=>e.operationId===D)||te.find(e=>h?.path===e.additionalOperationContext.path&&h?.method===e.additionalOperationContext.method):void 0,[te,D,h]);(0,H.useEffect)(()=>{Be&&!h&&g({path:Be.additionalOperationContext.path,method:Be.additionalOperationContext.method})},[Be,h]);let Ve=(e,n,r)=>{let i=(e,t)=>{let n=e.replace(/-duplicate(-\d+)?$/,``),r=`${n}-duplicate`,i=2;for(;t(r);)r=`${n}-duplicate-${i}`,i++;return r},a=F.operationArray??[],o=i(e,e=>a.some(t=>t.additionalOperationContext.path===e&&t.additionalOperationContext.method===n)),s=i(r.operationId??`op-${B().slice(0,4)}`,e=>a.some(t=>t.operationId===e)),c=JSON.parse(JSON.stringify(r));c.operationId=s;try{let e=F.addOperation(o,n,c);e&&O(e)}catch(e){e instanceof Error&&(t(`route-add-failed`,{httpPath:o,httpMethod:n}),P(e.message),he())}t(`route-added`,{httpPath:o,httpMethod:n,duplicate:!0})},He=()=>{f(!0),u(`tags`),c(!0)},Ue=je!==void 0,We=(0,U.jsx)(eFt,{isOpen:ke||Ue,existingPaths:Fe,mode:Ue?`edit`:`create`,initialResult:je?.initialResult,onClose:()=>{Ae(!1),Me(void 0)},onFinish:Ue?ze:Ie},`mcp-wizard-${Ne}`),Ge={onAddRest:we,onAddGraphql:De,onAddWebSocket:Oe,onAddMcpVirtual:Le,onAddMcpServer:Ee,onAddTag:He};return F.operationArray?.length===0&&(!ne||ne.trim().length===0)?(0,U.jsxs)(U.Fragment,{children:[We,(0,U.jsx)(pbt,{...Ge})]}):(0,U.jsxs)(`div`,{className:`ms-2 grid grid-cols-3 h-full grow`,children:[(0,U.jsx)(M$,{open:ce,onOpenChange:e=>{le(e),e||v(void 0)},onClickDelete:me,title:`Delete`,deleteButtonText:`Confirm`,children:ue.length===0?`Are you sure you want to delete this operation?`:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{children:[`The following`,` `,ue.length===1?`policy is`:`policies are`,` `,`used only by this route. Would you like to delete`,` `,ue.length===1?`it`:`them`,` `,`too?`]}),(0,U.jsx)(`ul`,{className:`flex flex-col divide-y divide-border max-h-[40vh] overflow-y-auto rounded-md border bg-surface-sunken`,children:ue.map(e=>{let t=`delete-policy-${e.name}`;return(0,U.jsxs)(`li`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,U.jsx)(FY,{id:t,checked:de.has(e.name),onCheckedChange:t=>pe(e.name,t===!0),className:`mt-0.5`}),(0,U.jsxs)(`label`,{htmlFor:t,className:`flex flex-col gap-0.5 text-left cursor-pointer min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e.policyType})]})]},e.name)})})]})}),(0,U.jsx)(eUt,{}),We,Se&&(0,U.jsx)(_Ft,{open:s,onOpenChange:c,info:Se,onSave:p,defaultTab:l,tagsAutoCreate:d,onTagsAutoCreateConsumed:()=>f(!1)}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 justify-start h-full pt-2 min-h-0`,children:[(0,U.jsxs)(`div`,{className:`flex justify-between gap-x-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-1`,children:(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{className:`flex group select-none`,asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,title:`Filter and sort routes`,children:[(0,U.jsx)(rte,{size:16}),`Filter`]})}),(0,U.jsxs)(Tq,{className:`min-w-[220px]`,align:`start`,children:[(0,U.jsx)(jq,{children:`Sort by`}),(0,U.jsx)(Eq,{children:cUt.map(e=>(0,U.jsxs)(Dq,{onClick:()=>M(e),className:`justify-between`,children:[e,(0,U.jsx)($f,{className:W(`mr-2`,e!==j&&`invisible`),size:16})]},e))}),(0,U.jsx)(Mq,{}),(0,U.jsx)(jq,{children:`Filter by tag`}),(0,U.jsx)(Eq,{className:`max-h-60 overflow-y-auto`,children:Ce?.map(e=>(0,U.jsxs)(Dq,{onClick:t=>{t.stopPropagation(),t.preventDefault(),r.includes(e.value)?i(r.filter(t=>t!==e.value)):i([...r,e.value])},className:`justify-between`,children:[e.label,(0,U.jsx)($f,{className:W(`mr-2`,!r.includes(e.value)&&`invisible`),size:18})]},e.label))}),(0,U.jsx)(Mq,{}),(0,U.jsx)(jq,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(gte,{size:16}),`Group by`]})}),(0,U.jsx)(Eq,{children:lUt.map(e=>(0,U.jsxs)(Dq,{onClick:t=>{t.stopPropagation(),t.preventDefault(),o(e.value)},className:`justify-between`,children:[e.label,(0,U.jsx)($f,{className:W(`mr-2`,a!==e.value&&`invisible`),size:16})]},e.value))})]})]})}),E?null:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{f(!1),u(`details`),c(!0)},"aria-label":`API Settings`,title:`API Settings`,children:(0,U.jsx)(Mp,{size:16})}),(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,"data-test":`add-route-btn`,className:`relative gap-0.5!`,children:[(0,U.jsx)(`div`,{className:`absolute w-1.5 h-1.5 rounded-full -top-0.5 -right-[3px] bg-zuplo-700`}),(0,U.jsx)(Np,{"aria-hidden":`true`,className:`size-3.5`}),`Add`]})}),(0,U.jsx)(Tq,{children:(0,U.jsx)(fbt,{...Ge})})]})]})]}),(0,U.jsx)(AY,{onClearValue:()=>V(``),value:ne,showClearButton:!!ne&&ne.length>0,children:(0,U.jsx)(YT,{ref:m,value:ne,onChange:e=>V(e.target.value),placeholder:`Search Routes`,className:`px-8`})}),r.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,U.jsxs)(`div`,{className:`group flex items-center gap-1 max-w-full pl-1.5 pr-0.5 py-0.5 rounded-full border border-border bg-card text-xs text-foreground`,children:[(0,U.jsx)(Kp,{size:11,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,title:e,children:e}),(0,U.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e} filter`,onClick:t=>{t.stopPropagation(),i(r.filter(t=>t!==e))},className:`shrink-0 size-4 rounded-full flex items-center justify-center text-muted-foreground hover:bg-surface-emphasis hover:text-neutral-900 dark:hover:text-foreground`,children:(0,U.jsx)($p,{size:11})})]},e))}),(0,U.jsx)(`div`,{className:`overflow-y-auto space-y-1`,children:re.map((e,t,n)=>{let r=!e.collapsible||C.has(e.key),i=e.operations.length,o=e.icon,s=(0,U.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-background px-1.5 py-0.5 text-xs font-normal tabular-nums text-muted-foreground`,children:i});return(0,U.jsxs)(`div`,{children:[e.collapsible?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>T(e.key),"aria-expanded":r,className:`mt-3 mb-1 flex w-full items-center gap-1.5 rounded-md bg-muted/60 px-2 py-2 text-left text-sm font-semibold text-foreground transition-colors first:mt-1 hover:bg-muted`,title:r?`Collapse ${e.label}`:`Expand ${e.label} (${i} ${i===1?`route`:`routes`})`,children:[r?(0,U.jsx)(ep,{size:15,className:`shrink-0 text-muted-foreground`}):(0,U.jsx)(tp,{size:15,className:`shrink-0 text-muted-foreground`}),o&&(0,U.jsx)(o,{size:16,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate font-mono`,title:e.label,children:e.label}),s]}):a!==`none`&&(0,U.jsxs)(`div`,{className:`mt-3 mb-1 flex items-center gap-1.5 rounded-md bg-muted/60 px-2 py-2 text-sm font-semibold text-foreground first:mt-1`,children:[o&&(0,U.jsx)(o,{size:16,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:W(`truncate`,e.mono&&`font-mono`),title:e.label,children:e.label}),s]}),r&&e.operations.map(({additionalOperationContext:e,...r})=>{let i=Be?.operationId===r.operationId,o=r[KX]?.handler,s=qX(o),c=JX(o),l=s?o.options?.operations?.length??0:0,u=l>0,d=y.has(r.operationId);return(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(Rbt,{path:i&&ie?ie:e.path,type:c?`mcp-virtual`:s?`mcp`:`route`,method:e.method,summary:i&&oe?oe:r.summary,operationId:r.operationId,operation:r,isSelected:i,onOperationSelected:t=>{ae(``),se(``),g({path:e.path,method:e.method}),O(t)},onDelete:(e,t,n)=>{v({path:e,method:t,operationId:n}),le(!0)},onAddRoute:Te,onDuplicate:()=>Ve(e.path,e.method,r),onMoveUp:uUt.has(a)?void 0:()=>xe(e.path,`up`),onMoveDown:uUt.has(a)?void 0:()=>xe(e.path,`down`),isFirstPath:j===D8&&t===0,isLastPath:j===D8&&t===n.length-1,isToolsExpanded:u?d:void 0,onToggleTools:u?()=>x(r.operationId):void 0,toolsCount:u?l:void 0}),o&&u&&d&&(0,U.jsx)(oxt,{handler:o,operation:{...r,additionalOperationContext:e}})]},r.operationId)})]},e.key)})})]}),(0,U.jsx)(`div`,{className:`col-span-2 flex flex-col h-full overflow-y-auto`,children:(0,U.jsx)(v3.Provider,{value:{setPath:ae,setSummary:se},children:(0,U.jsx)(sxt.Provider,{value:Re,children:(0,U.jsx)(YHt,{operationData:Be,addRouteMenuProps:Ge})})})})]})},gUt={create:{shell:`bg-emerald-500/8 shadow-emerald-950/5`,icon:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`,count:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`},update:{shell:`bg-brand/8 shadow-brand/5`,icon:`bg-brand/12 text-brand`,count:`bg-brand/12 text-brand`},keep:{shell:`bg-background shadow-black/5 dark:shadow-white/5`,icon:`bg-muted text-muted-foreground`,count:`bg-muted text-muted-foreground`}},A8=({icon:e,operations:t,title:n,tone:r})=>{let i=gUt[r];return(0,U.jsxs)(`section`,{className:`rounded-2xl p-4 shadow-sm ${i.shell}`,"aria-label":`${n} operations`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-foreground`,children:[(0,U.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-xl ${i.icon}`,children:e}),n,` operations`]}),(0,U.jsx)(`div`,{className:`rounded-full px-2.5 py-1 text-xs font-medium tabular-nums ${i.count}`,children:t.size})]}),(0,U.jsx)(`div`,{className:`space-y-1.5`,children:Array.from(t).map(e=>{let t=e.split(`>`),n=t[0],r=t.slice(1,t.length).join(`>`);return(0,U.jsxs)(`div`,{className:`flex min-h-10 items-center gap-3 rounded-xl bg-background/80 px-3 py-2 text-sm shadow-xs`,children:[(0,U.jsx)(jY,{className:`w-14`,method:n}),(0,U.jsx)(`span`,{className:`break-all text-foreground/90`,children:r})]},e)})})]})},_Ut=({openApiFileModel:e,onOpenApiFileSynced:t,setIsOpen:n})=>{let[r,i]=(0,H.useState)(),a=um(),o=e=>{i(e)},s=async()=>{if(!r)throw Error(`No file selected`);let i=e.content?JSON.parse(e.content):null;t(i?lft(i,r.content):r.content),n(!1),a.success(`OpenAPI file merged successfully`,{icon:(0,U.jsx)(Fhe,{className:`h-4 w-4`})})};if(r){let t=mft(JSON.parse(e.content??`{}`),r.content);return(0,U.jsx)(y1,{isOpen:!0,setIsOpen:n,title:`Review OpenAPI import`,className:`sm:max-w-4xl max-h-[88vh] overflow-y-auto`,icon:(0,U.jsx)(Ly,{className:`shrink-0 h-6 w-6 text-brand`}),iconStyle:`bg-zuplo-pink/10`,buttons:[{onButtonClick:()=>{n(!1)},variant:`outline`,buttonContent:`Cancel`,id:`Close merge open-api modal`,testID:`merge-cancel-btn`},{onButtonClick:s,variant:`brand`,buttonContent:`Import changes`,id:`Complete open-api merge`,testID:`complete-merge-btn`}],bodyComponent:(0,U.jsxs)(`div`,{className:`mt-6 text-left text-sm`,children:[(0,U.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-gradient-to-br from-brand/12 via-background to-background p-px shadow-lg shadow-brand/5`,children:(0,U.jsxs)(`div`,{className:`rounded-[calc(1.5rem-1px)] bg-background p-5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[1fr_auto_1fr] md:items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-2xl bg-surface-sunken p-4 shadow-[inset_0_1px_rgba(255,255,255,0.05)]`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-brand/10 text-brand`,children:(0,U.jsx)(oge,{className:`h-5 w-5`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Import file`}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate font-medium text-foreground`,children:r.name})]})]})}),(0,U.jsx)(`div`,{className:`hidden h-10 w-10 items-center justify-center rounded-full bg-brand text-brand-foreground shadow-sm shadow-brand/24 md:flex`,children:(0,U.jsx)(Ly,{className:`h-5 w-5`})}),(0,U.jsx)(`div`,{className:`rounded-2xl bg-surface-sunken p-4 shadow-[inset_0_1px_rgba(255,255,255,0.05)]`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,children:(0,U.jsx)(Uy,{className:`h-5 w-5`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Current API`}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate font-medium text-foreground`,children:e.path})]})]})})]}),(0,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2 text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:`Operations are matched by`}),(0,U.jsx)(BT,{variant:`outline`,children:`Path + method`}),(0,U.jsx)(`span`,{children:`so existing Zuplo extensions and policies stay in place.`})]})]})}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-end justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:`Import summary`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Review what will change before applying this file.`})]}),(0,U.jsxs)(`div`,{className:`rounded-full bg-surface-sunken px-3 py-1 text-xs font-medium text-muted-foreground tabular-nums`,children:[t.created.size+t.merged.size+t.retained.size,` `,`operations`]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid max-h-96 gap-3 overflow-y-auto rounded-3xl bg-surface-sunken p-3 shadow-[inset_0_1px_rgba(255,255,255,0.04)]`,children:[t.created.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Ege,{className:`h-4 w-4`}),title:`Create`,tone:`create`,operations:t.created}):null,t.merged.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Cge,{className:`h-4 w-4`}),title:`Update`,tone:`update`,operations:t.merged}):null,t.retained.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Ihe,{className:`h-4 w-4`}),title:`Keep`,tone:`keep`,operations:t.retained}):null]})]})})}return(0,U.jsx)(obt,{title:`Import OpenAPI`,onValidFileSelected:o,setIsOpen:n})},vUt=()=>{let e=bt(),t=Oe({mutationFn:t=>e.fetch(ae.users.updatePreferences(t))}),{data:n}=Mb(je.user.preferences());return{preferences:n,updatePreferences:t.mutate,updatePreferencesMutation:t}},yUt=!1;function j8(){let e=At(),{preferences:t,updatePreferencesMutation:n}=vUt();return{isFileTreeOpen:t.fileTreeOpen??yUt,setIsFileTreeOpen:r=>{let i=[je.user.preferences().url,!0],a=e.getQueryData(i),o={...a??t,fileTreeOpen:r};e.setQueryData(i,o),n.mutate(o,{onError:()=>{a&&e.setQueryData(i,a),e.invalidateQueries({queryKey:i})}})}}}function bUt(){let e=sQ(),{logEvent:t}=S(),[n,r]=CY(`v`,`designer`),{isFileTreeOpen:i}=j8(),a=e?.path.split(`/`).pop()??`JSON`,o=cQ(),s=cbt(),[c,l]=F$(()=>{if(!e)throw Error(`File model not found`);return t(`merge-open-api`),(0,U.jsx)(_Ut,{openApiFileModel:e,onOpenApiFileSynced:n=>{let r={...e,content:JSON.stringify(n,null,2)};o(r,!0),t(`merge-open-api-complete`),s(r.path)},setIsOpen:l})},[e,s]);return(0,U.jsx)(Hbt,{children:(0,U.jsx)(zyt,{children:(0,U.jsxs)(Yk,{defaultValue:`designer`,value:n,onValueChange:e=>r(e),className:`flex flex-col h-full w-full max-h-screen min-w-[850px]`,children:[i&&(0,U.jsxs)(Xk,{className:`rounded-none border-b w-full justify-start`,children:[(0,U.jsx)(Zk,{value:`designer`,children:`Route Designer`}),(0,U.jsx)(Zk,{value:`raw`,children:a??`Raw`}),(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:c,className:`ml-4`,children:[(0,U.jsx)(Pge,{className:`w-4 h-4`}),` Import`]})]}),(0,U.jsx)(Qk,{value:`designer`,className:`grow h-full overflow-y-auto`,children:(0,U.jsx)(qyt,{onNavigateToOpenApiFileTab:()=>r(`raw`),children:(0,U.jsx)(hUt,{onNavigateToOpenApiFileTab:()=>r(`raw`)})})}),(0,U.jsx)(Qk,{value:`raw`,className:`grow h-full overflow-y-auto`,forceMount:!0,children:(0,U.jsx)(bQ,{})})]})})})}function xUt({title:e,description:t,folder:n,icon:r,emptyText:i,newLabel:a,onCreate:o}){let s=vm(e=>e.projectTreeNodes),[c,l]=Bl(),{isReadOnly:u}=JZ(),d=n.endsWith(`/`)?n:`${n}/`,f=(0,H.useMemo)(()=>s.filter(e=>e.type===Zl.File&&e.path.startsWith(d)).sort((e,t)=>e.path.localeCompare(t.path)),[s,d]),p=e=>{let t=new URLSearchParams(c);t.set(`path`,e),t.delete(`v`),t.delete(`line`),l(t)};return(0,U.jsx)(`div`,{className:`h-full w-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-bold text-neutral-900 dark:text-neutral-100`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-neutral-600 dark:text-neutral-400`,children:t})]}),!u&&(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:o,className:`shrink-0`,children:[(0,U.jsx)(Np,{className:`size-4`}),a]})]}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-1.5`,children:f.length===0?(0,U.jsx)(`div`,{className:`rounded-lg border border-dashed p-8 text-center text-sm text-neutral-500 dark:text-neutral-400`,children:i}):f.map(e=>{let t=e.path.slice(d.length);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:W(`group flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors`,`bg-surface hover:border-brand/40 hover:bg-brand/5`,`ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,U.jsx)(r,{className:`size-4 shrink-0 text-neutral-500 group-hover:text-brand`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-neutral-800 dark:text-neutral-200`,children:t})]},e.path)})})]})})}function SUt(){let e=vm(e=>e.setPendingNewFile),{setIsFileTreeOpen:t}=j8();return(0,U.jsx)(xUt,{title:`Custom Modules`,description:`TypeScript modules in your project's modules/ folder — request handlers, policies, and other custom code.`,folder:`/modules`,icon:wte,emptyText:`No custom modules yet. Create one to add request handlers or custom logic.`,newLabel:`New Module`,onCreate:()=>{t(!0),e({strategyFolder:`/modules`,template:`Request Handler`})}})}function CUt(){let e=vm(e=>e.setPendingNewFile),{setIsFileTreeOpen:t}=j8();return(0,U.jsx)(xUt,{title:`Schemas`,description:`JSON schemas in your project's schemas/ folder, used to validate requests and responses.`,folder:`/schemas`,icon:xp,emptyText:`No schemas yet. Create one to validate request or response bodies.`,newLabel:`New Schema`,onCreate:()=>{t(!0),e({strategyFolder:`/schemas`,template:`Schema`})}})}var wUt=()=>{let[e,t]=(0,H.useState)(),{isReadOnly:n}=JZ(),r=A1(),i=r.policiesUsageInfo,{logEvent:a}=S(),o=fm([`account`,`project`,`environment`]),[s,c]=F$(()=>e?(0,U.jsx)($Rt,{isOpen:!0,setIsOpen:c,stackType:e,shouldHideExistingPolicies:!0,policyManager:r}):null,[e]),l=e=>{t(e),a(`create-policy-clicked`,{account:o.account.name,project:o.project.name,environment:o.environment.name,type:e}),s()},u=(r.policyList??[]).flatMap(e=>i?.find(t=>t.name===e.name)??[]);return(0,U.jsx)(`div`,{className:`h-full w-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-bold text-neutral-900 dark:text-neutral-100`,children:`Policies`}),(0,U.jsx)(`p`,{className:`text-sm text-neutral-600 dark:text-neutral-400`,children:`Reusable policies from your project's config/policies.json — apply them to routes to inspect and control requests and responses.`})]}),!n&&(0,U.jsxs)(Cq,{modal:!1,children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`shrink-0`,children:[(0,U.jsx)(Np,{className:`size-4`}),`New Policy`]})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onClick:()=>l(`inbound`),children:[(0,U.jsx)(Nf,{className:`mr-2 size-4`}),`Inbound Policy`]}),(0,U.jsxs)(Dq,{onClick:()=>l(`outbound`),children:[(0,U.jsx)(Lf,{className:`mr-2 size-4`}),`Outbound Policy`]})]})]})]}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-1.5`,children:u.length===0?(0,U.jsxs)(`div`,{className:`rounded-lg border border-dashed p-8 text-center text-sm text-neutral-500 dark:text-neutral-400`,children:[`No policies yet. Create an inbound or outbound policy to inspect and control requests and responses, or`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/overview/policies`,children:`read the docs`}),`.`]}):u.map(e=>(0,U.jsx)(KRt,{policy:e},e.name))})]})})},TUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeploymentLogState=void 0;var t;(function(e){e.ERROR=`ERROR`,e.IN_PROGRESS=`IN_PROGRESS`,e.SUCCESS=`SUCCESS`})(t||(e.DeploymentLogState=t={}))})),EUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SourceControlProvider=e.PlanType=e.EnvironmentType=e.EnvironmentTarget=e.DeploymentState=void 0;var t;(function(e){e[e.IS_STARTING=0]=`IS_STARTING`,e[e.STARTED=1]=`STARTED`,e[e.STOPPED=2]=`STOPPED`,e[e.ERRORED=3]=`ERRORED`})(t||(e.DeploymentState=t={}));var n;(function(e){e.CLOUDFLARE=`CLOUDFLARE`,e.KNATIVE=`KNATIVE`})(n||(e.EnvironmentTarget=n={}));var r;(function(e){e.PRODUCTION=`PRODUCTION`,e.PREVIEW=`PREVIEW`,e.WORKING_COPY=`WORKING_COPY`})(r||(e.EnvironmentType=r={}));var i;(function(e){e.FREE_V1=`FREE_V1`,e.BUILDER_V1=`BUILDER_V1`,e.BUSINESS_V1=`BUSINESS_V1`,e.CUSTOM=`CUSTOM`,e.EMPLOYEE=`EMPLOYEE`,e.CUSTOM_TRIAL_V1=`CUSTOM_TRIAL_V1`})(i||(e.PlanType=i={}));var a;(function(e){e.GITHUB=`GITHUB`,e.GITLAB=`GITLAB`,e.BITBUCKET=`BITBUCKET`})(a||(e.SourceControlProvider=a={}))})),DUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),OUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.INTERNAL_ROUTE_VENDOR_TAG=e.ZUPLO_OPEN_API_ROUTE_KEY=e.ZUPLO_OPEN_API_PATH_KEY=e.ZUPLO_OPEN_API_VENDOR_PREFIX=void 0,e.ZUPLO_OPEN_API_VENDOR_PREFIX=`x-zuplo`,e.ZUPLO_OPEN_API_PATH_KEY=`${e.ZUPLO_OPEN_API_VENDOR_PREFIX}-path`,e.ZUPLO_OPEN_API_ROUTE_KEY=`${e.ZUPLO_OPEN_API_VENDOR_PREFIX}-route`,e.INTERNAL_ROUTE_VENDOR_TAG=`x-internal`})),kUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.processJsonErrorObject=void 0;var t={'must match pattern "^[0-9a-z-]+$"':`Value must be alphanumeric or dash '-' only`,'must match pattern "^\\$import\\([^ )]*?\\)$"':`Value must be of form '$import(./path/to/module)`},n={'must match pattern "^[0-9a-z-]+$"':`Make sure the value uses only lowercase letters, numbers and dashes ('-').`,'must match pattern "^\\$import\\([^ )]*?\\)$"':`Value must be of form '$import(./path/to/module)`},r=e=>e.replace(`/`,``).replaceAll(`/`,` → `).replaceAll(`~1`,`/`),i={paths:`paths`};function a(e,a){let o=e.message,s=e.details?.property??``,c=e.details?.index??0,l=e.details?.field,u=e.details?.fieldValue,d=e.keyword,f=e.params,p=e.propertyName,m=r(e.instancePath),h=t[o]??o,g,_;if(d===`unevaluatedProperties`)g=`Unrecognized property '${f.unevaluatedProperty}'${l?` detected in '${l}'`:``} within '${a}'. Property location: ${m}.`;else if(d===`additionalProperties`)g=`Unrecognized property '${f.additionalProperty}'${l?` detected in '${l}'`:``} within '${a}'. Property location: ${m}.`;else if(d===`enum`)g=`Unrecognized value${u?` '${u}'`:``} for '${l}' detected in '${a}'. Value ${h}. Property location: ${m}.`;else if(d===`pattern`){let e=f.pattern;g=p?`Property name '${p}' does not match pattern ${e} in '${a}'. Property location: ${m}.`:`Invalid value '${u}' for field '${l}' in '${a}'. Value does not match pattern ${e}. Property location: ${m}.`}else d===`propertyNames`?g=`Invalid property name '${f.propertyName}' for property '${s}' detected in '${a}'. Property location: ${m}.`:d===`required`?g=`Missing required property '${f.missingProperty}' in '${a}'. Property location: ${m}.`:l&&s?(g=`Property ${i[s]} entry at position ${c+1} in '${a}' has invalid ${l} with value '${e.details?.fieldValue}' (${h})`,_={field:l,fieldValue:e.details?.fieldValue??``,property:s,instancePath:m,suggestion:n[o]??``}):g=s?`The ${i[s]} entry at position ${c+1} in '${a}' is invalid (${h})`:`The '${a}' configuration is invalid (${h})`;return{property:s,entry:{message:g,index:c,field:l,details:_}}}e.processJsonErrorObject=a})),AUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.startsWithReservedKeyword=void 0;var t=[`settings`,`user`,`manage`,`profile`,`login`,`logout`,`admin`,`system`,`account`,`accounts`,`home`,`dashboard`];function n(e){return t.filter(t=>e.startsWith(t)).length>0}e.startsWithReservedKeyword=n})),jUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isValidProjectName=e.MAX_PRETTY_BRANCH_LENGTH=e.MAX_HASH_LENGTH=void 0;var t=AUt();e.MAX_HASH_LENGTH=7,e.MAX_PRETTY_BRANCH_LENGTH=10;var n=40;function r(e){let r={isValid:!0};return e.length===0?(r.isValid=!1,r.errorMessage=`Project name cannot be empty`,r):(0,t.startsWithReservedKeyword)(e)?(r.isValid=!1,r.errorMessage=`Project name can not start with a reserved keyword`,r):/[\s]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name can't contain spaces`,r):/[A-Z]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should be in lowercase`,r):/^[^a-z]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should start with a letter`,r):/[^a-z0-9]$/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should end with a letter or number`,r):/[^a-z0-9\\-]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name only can contain letter, numbers and dashes`,r):(e.length>n&&(r.isValid=!1,r.errorMessage=`Project name cannot exceed ${n} characters because it needs to be part of the URL subdomain. Your chosen name is ${e.length-n} over.`),r)}e.isValidProjectName=r})),MUt=i({$defs:()=>L8,$id:()=>N8,$schema:()=>M8,additionalProperties:()=>!1,default:()=>NUt,description:()=>``,properties:()=>R8,required:()=>I8,title:()=>P8,type:()=>F8}),M8,N8,P8,F8,I8,L8,R8,NUt,PUt=n((()=>{M8=`https://json-schema.org/draft/2020-12/schema`,N8=`http://schemas.zuplo.com/route.json`,P8=`Route Config File`,F8=`object`,I8=[`routes`,`versions`],L8={corsPolicy:{type:`string`,pattern:`^[0-9a-z-]+$`},httpMethod:{type:`string`,enum:[`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`CONNECT`,`OPTIONS`,`TRACE`,`PATCH`]},handlerDefinition:{type:`object`,properties:{module:{type:`string`,pattern:`^\\$import\\([^ )]*?\\)$`},export:{type:`string`},options:{type:`object`,additionalProperties:!0}},additionalProperties:!1,required:[`module`,`export`]},schema:{$comment:`https://spec.openapis.org/oas/v3.1.0#schema-object`,type:[`object`,`boolean`]},parameterBaseObject:{$comment:`https://spec.openapis.org/oas/v3.1.0#schema-object`,type:`object`,properties:{description:{type:`string`},required:{default:!1,type:`boolean`},deprecated:{default:!1,type:`boolean`},schema:{$ref:`#/$defs/schema`}},required:[`schema`]},parameterDefinition:{$comment:`https://spec.openapis.org/oas/v3.1.0#parameter-object`,allOf:[{$ref:`#/$defs/parameterBaseObject`}],type:`object`,properties:{name:{type:`string`},in:{type:`string`,enum:[`query`,`header`,`path`,`cookie`]}},required:[`name`,`in`,`schema`],if:{type:`object`,properties:{in:{const:`query`}},required:[`in`]},then:{type:`object`,properties:{allowEmptyValue:{default:!1,type:`boolean`}}}},"media-type":{$comment:`https://spec.openapis.org/oas/v3.1.0#media-type-object`,type:`object`,properties:{schema:{$ref:`#/$defs/schema`}},unevaluatedProperties:!1},content:{$comment:`https://spec.openapis.org/oas/v3.1.0#fixed-fields-10`,type:`object`,additionalProperties:{$ref:`#/$defs/media-type`},propertyNames:{enum:[`application/json`,`application/problem+json`]}},header:{$comment:`https://spec.openapis.org/oas/v3.1.0#header-object`,allOf:[{$ref:`#/$defs/parameterBaseObject`}],type:`object`,required:[`schema`]},response:{$comment:`https://spec.openapis.org/oas/v3.1.0#response-object`,type:`object`,properties:{description:{type:`string`},headers:{type:`object`,additionalProperties:{$ref:`#/$defs/header`}},content:{$ref:`#/$defs/content`}},required:[`description`],unevaluatedProperties:!1},responsesDefinition:{$comment:`https://spec.openapis.org/oas/v3.1.0#responses-object`,type:`object`,properties:{default:{$ref:`#/$defs/response`}},patternProperties:{"^[1-5](?:[0-9]{2}|XX)$":{$ref:`#/$defs/response`}},minProperties:1,unevaluatedProperties:!1},tag:{$comment:`https://spec.openapis.org/oas/v3.1.0#tag-object`,type:`object`,properties:{name:{type:`string`},description:{type:`string`}},required:[`name`],unevaluatedProperties:!1},info:{type:`object`,required:[`title`,`version`],properties:{title:{type:`string`},summary:{type:`string`},description:{type:`string`},termsOfService:{type:`string`,format:`uri`},version:{type:`string`}}},versionData:{type:`object`,required:[`name`,`pathPrefix`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},pathPrefix:{type:`string`,pattern:`(^$|^/[^\\s]*$)`},info:{$ref:`#/$defs/info`},openApiFile:{description:`The project relative path to the OpenAPI spec.`,type:`string`},tags:{type:`array`,items:{$ref:`#/$defs/tag`}},excludeFromOpenApi:{type:`boolean`,description:`If false, OpenAPI documentation will not be generated for this version. If openApiFile is set this setting is ignored.`},enforceOpenApi:{type:`boolean`,description:`If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.`}}},routeConfiguration:{type:`object`,required:[`path`,`methods`,`handler`,`version`],additionalProperties:!1,properties:{operationId:{type:`string`},path:{type:`string`,pattern:`^/[^\\s]*$`},methods:{type:`array`,items:{$ref:`#/$defs/httpMethod`}},label:{type:`string`,description:`An internal user-friendly identifier of the route.`},enforceOpenApi:{type:`boolean`,description:`If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.`},key:{type:`string`,deprecated:!0},handler:{$ref:`#/$defs/handlerDefinition`},corsPolicy:{$ref:`#/$defs/corsPolicy`},custom:{},version:{type:`string`,pattern:`^[0-9a-z-]+$`},policies:{type:`object`,additionalProperties:!1,properties:{inbound:{type:`array`,items:{type:`string`,pattern:`^[0-9a-z-]+$`}},outbound:{type:`array`,items:{type:`string`,pattern:`^[0-9a-z-]+$`}}}},summary:{type:`string`},description:{type:`string`},parameters:{type:`array`,items:{$ref:`#/$defs/parameterDefinition`}},excludeFromOpenApi:{type:`boolean`},responses:{$ref:`#/$defs/responsesDefinition`},tags:{type:`array`,items:{type:`string`}}}},policyConfiguration:{type:`object`,required:[`name`,`policyType`,`handler`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},policyType:{type:`string`},handler:{$ref:`#/$defs/handlerDefinition`},options:{type:`object`,additionalProperties:!0}}},corsPolicyConfiguration:{type:`object`,required:[`name`,`allowedOrigins`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},allowCredentials:{type:`boolean`},maxAge:{type:`number`},allowedOrigins:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]},allowedMethods:{oneOf:[{type:`array`,items:{$ref:`#/$defs/httpMethod`}},{type:`string`}]},allowedHeaders:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]},exposeHeaders:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]}}}},R8={$schema:{type:`string`},info:{$ref:`#/$defs/info`,deprecated:!0},versions:{type:`array`,minItems:1,items:{$ref:`#/$defs/versionData`}},routes:{type:`array`,minItems:0,items:{$ref:`#/$defs/routeConfiguration`}},policies:{type:`array`,items:{$ref:`#/$defs/policyConfiguration`}},corsPolicies:{type:`array`,items:{$ref:`#/$defs/corsPolicyConfiguration`}},requestErrorHandler:{$ref:`#/$defs/handlerDefinition`}},NUt={$schema:M8,$id:N8,title:P8,description:``,type:F8,additionalProperties:!1,required:I8,$defs:L8,properties:R8}})),FUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c,l),"date-time":t(d,f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:w,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:_,int32:{type:`number`,validate:b},int64:{type:`number`,validate:x},float:{type:`number`,validate:S},double:{type:`number`,validate:S},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function c(e,t){let n=s.exec(e);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[5];return(r<=23&&i<=59&&a<=59||r===23&&i===59&&a===60)&&(!t||o!==``)}function l(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3]+(n[4]||``),t=r[1]+r[2]+r[3]+(r[4]||``),e>t?1:e<t?-1:0}var u=/t|\s/i;function d(e){let t=e.split(u);return t.length===2&&a(t[0])&&c(t[1],!0)}function f(e,t){if(!(e&&t))return;let[n,r]=e.split(u),[i,a]=t.split(u),s=o(n,i);if(s!==void 0)return s||l(r,a)}var p=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(e){return p.test(e)&&m.test(e)}var g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _(e){return g.lastIndex=0,g.test(e)}var v=-(2**31),y=2**31-1;function b(e){return Number.isInteger(e)&&e<=y&&e>=v}function x(e){return Number.isInteger(e)}function S(){return!0}var C=/[^\\]\\Z/;function w(e){if(C.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),z8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),IUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=z8(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r=e.UsedValueState||={}),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),B8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=z8(),n=IUt(),r=z8();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=IUt();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
1569
+ `}var w8=`/docs/schema.graphql`,kHt=()=>JSON.stringify({query:uHt()}),AHt=e=>{if(!e)throw Error(`The endpoint returned an empty response.`);let t;try{t=JSON.parse(e)}catch{throw Error(`The endpoint did not return a valid JSON response.`)}if(t.errors?.length)throw Error(`The introspection query returned errors: ${t.errors.map(e=>e.message).join(`; `)}`);if(!t.data?.__schema)throw Error(`The endpoint did not return an introspection result. Make sure introspection is enabled.`);try{return`${fHt(dHt(t.data))}\n`}catch(e){throw Error(`Could not build a schema from the introspection result: ${e instanceof Error?e.message:String(e)}`)}},jHt=({endpointUrl:e,rewriteUrl:t,ape:n,onClose:r})=>{let{logEvent:i}=S(),a=um(),o=yX(),s=_F(),[c,l]=(0,H.useState)(t??e),[u,d]=(0,H.useState)([{key:``,value:``}]),[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(),g=(e,t,n)=>{d(r=>r.map((r,i)=>i===e?{...r,[t]:n}:r))},_=()=>d(e=>[...e,{key:``,value:``}]),v=e=>d(t=>t.filter((t,n)=>n!==e)),y=async()=>{h(void 0),p(!0);let l=c===t?`handler`:c===e?`gateway`:`custom`,d={account:n.account.name,project:n.project.name,environment:n.environment.name,endpointMode:l};i(`graphql-schema-introspection-run`,d);let f=`request`,m;try{let e;try{f=`invalid_url`,e=new URL(c)}catch{throw Error(`Enter a valid endpoint URL, including the protocol (e.g. https://).`)}let t={"content-type":`application/json`};for(let{key:e,value:n}of u){let r=e.trim();r.length>0&&(t[r]=n)}f=`request`;let l=await(await s({environmentName:n.environment.name,testRequest:{description:`GraphQL introspection`,pathname:`${e.pathname}${e.search}`,method:`POST`,headers:t,body:kHt()},overrideUrl:e.origin})).json();if(m=l.status,l.status<200||l.status>=300)throw f=`upstream_status`,Error(`The endpoint responded with ${l.status} ${l.statusText??``}.`.trim());f=`introspection`;let p=AHt(l.body);f=`save`,await o.mutateAsync({file:{path:w8,content:p},accountName:n.account.name,projectName:n.project.name,environmentName:n.environment.name}),i(`graphql-schema-introspection-success`,{...d,upstreamStatus:m}),a.success(`Schema saved to ${w8}`),r()}catch(e){let t=e instanceof Error?e.message:String(e);i(`graphql-schema-introspection-failed`,{...d,stage:f,upstreamStatus:m,reason:t}),h(t)}finally{p(!1)}};return(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&!f&&r(),children:(0,U.jsxs)(Zw,{className:`sm:max-w-2xl`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Download GraphQL schema`}),(0,U.jsxs)(tT,{children:[`Run an introspection query against this endpoint. On success the schema is stored in `,(0,U.jsx)(`code`,{children:w8}),`.`]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(XT,{htmlFor:`graphql-introspection-endpoint`,children:`Endpoint`}),e&&e!==c&&(0,U.jsx)(Y,{variant:`link`,size:`xs`,type:`button`,className:`h-auto p-0`,disabled:f,onClick:()=>l(e),children:`Use gateway URL`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(YT,{id:`graphql-introspection-endpoint`,value:c,onChange:e=>l(e.target.value),placeholder:`https://example.com/graphql`,disabled:f,"data-op-ignore":!0}),(0,U.jsx)(cP,{textToCopy:c})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(XT,{children:`Headers (optional)`}),(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:u.map((e,t)=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(YT,{placeholder:`Header name`,value:e.key,onChange:e=>g(t,`key`,e.target.value),"data-op-ignore":!0}),(0,U.jsx)(YT,{placeholder:`Value`,value:e.value,onChange:e=>g(t,`value`,e.target.value),"data-op-ignore":!0}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,type:`button`,"aria-label":`Remove header`,onClick:()=>v(t),children:(0,U.jsx)(Jp,{className:`size-4`})})]},t))}),(0,U.jsx)(`div`,{children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,type:`button`,onClick:_,children:[(0,U.jsx)(Np,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Add header`})]})})]}),m&&(0,U.jsxs)(db,{variant:`destructive`,children:[(0,U.jsx)(ap,{}),(0,U.jsx)(fb,{children:`Introspection failed`}),(0,U.jsx)(pb,{className:`break-words`,children:m})]})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{variant:`outline`,type:`button`,disabled:f,children:`Cancel`})}),(0,U.jsx)(Y,{variant:`brand`,type:`button`,onClick:y,disabled:f||c.trim().length===0,children:f?`Running…`:`Run introspection`})]})]})})},MHt=({path:e,rewriteUrl:t})=>{let n=fm(),r=cc(),{logEvent:i}=S(),[a,o]=(0,H.useState)(!1),s=vF(n.environment),c=s?new URL(e,s).toString():void 0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,children:[(0,U.jsx)(E1,{className:`size-4 shrink-0`}),(0,U.jsx)(`span`,{children:`Schema`}),(0,U.jsx)(ep,{className:`size-4 shrink-0`})]})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onSelect:()=>{i(`graphql-schema-open`,{account:n.account.name,project:n.project.name,environment:n.environment.name}),r({pathname:lo(Db.Code,{account:n.account.name,project:n.project.name,environment:encodeURIComponent(n.environment.urlParameter)}),search:`?path=${w8}`})},children:[(0,U.jsx)(Sp,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Open Schema`})]}),(0,U.jsxs)(Dq,{disabled:!c,onSelect:()=>o(!0),children:[(0,U.jsx)(hp,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Download Schema`})]})]})]}),a&&c&&(0,U.jsx)(jHt,{endpointUrl:c,rewriteUrl:t,ape:n,onClose:()=>o(!1)})]})},NHt=({operationTags:e,onTagsChanged:t})=>{let{isReadOnly:n}=JZ(),r=h1(),[i,a]=(0,H.useState)(``),o=r.openApiData?.tags?.map(e=>e.name)??[],s=n=>{e.includes(n)?t(e.filter(e=>e!==n)):t([...e,n])},c=()=>{let n=i.trim();if(n){if(!o.includes(n))try{r.addTag(n)}catch{}e.includes(n)||t([...e,n]),a(``)}};return(0,U.jsxs)(kT,{children:[(0,U.jsx)(AT,{asChild:!0,children:(0,U.jsxs)(S6,{children:[(0,U.jsx)(Kp,{size:16}),e.length===1?(0,U.jsx)(`span`,{className:`truncate max-w-[12ch]`,title:e[0],children:e[0]}):`${e.length} Tags`]})}),(0,U.jsxs)(jT,{className:`w-64 p-0 z-100`,align:`end`,children:[(0,U.jsx)(`div`,{className:`px-3 pt-3 pb-2`,children:(0,U.jsx)(`h4`,{className:`text-sm font-medium`,children:`Operation Tags`})}),o.length>0&&(0,U.jsx)(`div`,{className:`border-t max-h-48 overflow-y-auto`,children:o.map(t=>(0,U.jsxs)(`button`,{type:`button`,disabled:n,className:`w-full flex items-center justify-between px-3 py-1.5 text-sm hover:bg-accent disabled:opacity-50 disabled:cursor-default cursor-pointer`,onClick:()=>s(t),children:[(0,U.jsx)(`span`,{className:`truncate`,children:t}),(0,U.jsx)($f,{size:14,className:W(`shrink-0`,!e.includes(t)&&`invisible`)})]},t))}),!n&&(0,U.jsx)(`div`,{className:`border-t p-2`,children:(0,U.jsxs)(`form`,{className:`flex gap-1`,onSubmit:e=>{e.preventDefault(),c()},children:[(0,U.jsx)(YT,{value:i,onChange:e=>a(e.target.value),placeholder:`New tag...`,className:`h-7 text-xs`}),(0,U.jsx)(Y,{type:`submit`,variant:`outline`,size:`icon-sm`,disabled:!i.trim(),children:(0,U.jsx)(Np,{size:14})})]})})]})]})},PHt=r(a((e=>{var t=/~/,n=/~[01]/g;function r(e){switch(e){case`~1`:return`/`;case`~0`:return`~`}throw Error(`Invalid tilde escape: `+e)}function i(e){return t.test(e)?e.replace(n,r):e}function a(e){if(typeof e==`string`){if(e=e.split(`/`),e[0]===``)return e;throw Error(`Invalid JSON pointer.`)}else if(Array.isArray(e)){for(let t of e)if(typeof t!=`string`&&typeof t!=`number`)throw Error(`Invalid JSON pointer. Must be of type string or number.`);return e}throw Error(`Invalid JSON pointer.`)}function o(e,t){if(typeof e!=`object`)throw Error(`Invalid input object.`);t=a(t);var n=t.length;if(n===1)return e;for(var r=1;r<n;){if(e=e[i(t[r++])],n===r)return e;if(typeof e!=`object`||!e)return}}e.get=o}))());function T8(e,t){try{return e.startsWith(`#`)?PHt.get(t,e.replace(`#`,``)):PHt.get(t,e)}catch(e){console.error(`Error resolving schema reference. Reference may be invalid or referencing an external document.`,e);return}}var FHt=(e,t)=>{let n=e;return!n||`$ref`in n&&(n=T8(n.$ref,t),!n)?``:n.example?n.example:n.examples&&n.examples.length>0?n.examples[0]:n.default?n.default:``},IHt=(e,t)=>{if(e.examples&&Object.keys(e.examples).length>0){let n=Object.values(e.examples)[0];if(`$ref`in n){let e=T8(n.$ref,t);if(!e)return``;n=e}return n.value}if(e.example)return e.example;let n=e.schema;return FHt(n,t)},LHt=(e,t)=>{let n=e.requestBody;if(!n)return``;if(`$ref`in n){let e=T8(n.$ref,t);if(!e)return``;n=e}let{content:r}=n;if(!(`application/json`in r))return``;let i=r[`application/json`];if(i.examples&&Object.keys(i.examples).length>0){let e=Object.values(i.examples)[0];if(`$ref`in e){let n=T8(e.$ref,t);if(!n)return``;e=n}return e.value}let a=i.schema;return FHt(a,t)},RHt=JSON.stringify({query:`{ __schema { queryType { name } } }`},null,2),zHt=new aKe,BHt=e=>e.additionalOperationContext.method.split(`,`).map(e=>e.toUpperCase()),E8=e=>{let{oasFilePath:t,method:n,path:r}=e.additionalOperationContext;return`${t}::${e.operationId??`${n} ${r}`}`},VHt=({ape:e,envUrl:t,operation:n,openApiDocument:r,showRebuildWarning:i,onClose:a,defaultEndpointsPanelOpen:o=!1,documentsByPath:s,endpointsLoading:c})=>{let l=(t,n)=>{let r=BHt(t)[0],i=t[WX]===!0,a=YX(t),o=LHt(t,n),s=zHt.getTest(e.account.name,e.project.name,e.environment.name,t.operationId),c=t.parameters?.filter(e=>!(`$ref`in e)&&e.in===`header`).reduce((e,t)=>({...e,[t.name]:IHt(t,n)}),{})??{},l=typeof o==`string`?o:JSON.stringify(o),u=a?{"content-type":`application/json`,accept:`application/json, text/event-stream`,...c}:i?{"content-type":`application/json`,...c}:c,d=l||(a?cF:i?RHt:l);return s?.test&&s.test.method===r?s.test:{description:t.summary??t.description??``,pathname:t.additionalOperationContext.path,method:r,headers:u,body:d}},[u,d]=(0,H.useState)(n),[f,p]=(0,H.useState)(()=>l(n,r)),[m,h]=(0,H.useState)(o),g=vm(e=>e.setTestResponse),_=Sm(),v=s??_,y=(0,H.useMemo)(()=>({...v,[n.additionalOperationContext.oasFilePath]:r}),[v,n.additionalOperationContext.oasFilePath,r]),b=(0,H.useMemo)(()=>Object.entries(y).flatMap(([e,t])=>m1(e,t)),[y]),x=(0,H.useMemo)(()=>b.map(e=>({id:E8(e),method:e.additionalOperationContext.method,path:e.additionalOperationContext.path,summary:e.summary,file:e.additionalOperationContext.oasFilePath})),[b]);return(0,H.useEffect)(()=>{g(void 0)},[]),(0,U.jsx)(`div`,{className:`flex h-[650px] max-h-[70vh] flex-col`,children:(0,U.jsx)(zat,{ape:e,apiTest:f,showRebuildWarning:i,allowedMethods:BHt(u),url:`${t}${u.additionalOperationContext.path}`,shouldAllowLocalSaving:!!u.operationId,operationId:u.operationId,path:u.additionalOperationContext.path,onRequestChange:e=>{p(e)},onClose:a,endpoints:x,selectedEndpointId:E8(u),onSelectEndpoint:e=>{if(e===E8(u))return;let t=b.find(t=>E8(t)===e);if(!t)return;let n=y[t.additionalOperationContext.oasFilePath]??r;d(t),p(l(t,n)),g(void 0)},isEndpointPanelOpen:m,onToggleEndpointPanel:()=>h(e=>!e),endpointsLoading:c},E8(u))})},HHt=({envUrl:e,ape:t,operation:n,openApiDocument:r,showRebuildWarning:i,entries:a,onClose:o,defaultEndpointsPanelOpen:s})=>(0,U.jsx)(SY.Provider,{value:{entries:a},children:(0,U.jsx)(`div`,{className:`w-full text-muted-foreground`,children:(0,U.jsx)(VHt,{openApiDocument:r,ape:t,envUrl:e,showRebuildWarning:i,operation:n,onClose:o,defaultEndpointsPanelOpen:s})})}),UHt=({open:e,onOpenChange:t,onProceed:n})=>{let{saveAndDeploy:r,isPending:i}=Vmt();return(0,U.jsx)(Jw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Zw,{className:`sm:max-w-md`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Unsaved changes`}),(0,U.jsx)(tT,{children:`Your unsaved changes will not be reflected when you test this route until you save and deploy them. Save them now, or continue testing the currently deployed version.`})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,onClick:n,disabled:i,children:`Continue without saving`}),(0,U.jsx)(Y,{variant:`default`,onClick:async()=>{try{await r()}catch{return}n()},disabled:i,children:(0,U.jsx)(aP,{loading:i,children:`Save changes`})})]})]})})},WHt=(0,H.lazy)(()=>vn(()=>import(`./GraphiQLConsole-C2bvHgjX.js`),__vite__mapDeps([9,1,2,8,10,11,12]))),GHt=({path:e,method:t,summary:n,operationData:r,hasFileChanged:i,isGraphql:a})=>{let{logEvent:o}=S(),s=fm(),c=h1().getOpenApiDataEnforced(),{entries:l}=(0,H.useContext)(SY),u=vF(s.environment),[d,f]=(0,H.useState)(null),p=u?new URL(e,u).toString():void 0,m=ine({mutationKey:est})>0,[h,g]=F$(()=>(o(`test-route-clicked`,{httpPath:e,httpMethod:t.includes(`,`)?t.split(`,`)[0]:t,account:s.account.name,project:s.project.name,environment:s.environment.name,mode:a?`playground`:`default`}),(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&g(),children:(0,U.jsxs)(Zw,{showCloseButton:!1,className:`max-w-6xl! w-full gap-0 overflow-hidden p-0`,children:[(0,U.jsx)(eT,{className:`sr-only`,children:`Test route`}),(0,U.jsx)(HHt,{envUrl:u??``,showRebuildWarning:i,ape:s,entries:l,operation:r,openApiDocument:c,onClose:g})]})})),[e,t,n,r,l,a]),[_,v]=F$(()=>(o(`test-route-clicked`,{httpPath:e,httpMethod:`POST`,account:s.account.name,project:s.project.name,environment:s.environment.name,mode:`graphiql`}),(0,U.jsx)(Jw,{open:!0,onOpenChange:e=>!e&&v(),children:(0,U.jsxs)(Zw,{className:`max-w-6xl! w-full p-0 overflow-hidden`,children:[(0,U.jsx)(eT,{className:`sr-only`,children:`GraphiQL`}),(0,U.jsx)(`div`,{className:`h-[80vh] w-full`,children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(`div`,{className:`flex h-full items-center justify-center text-muted-foreground`,children:`Loading GraphiQL…`}),children:(0,U.jsx)(WHt,{url:p??``,ape:s})})})]})})),[p,s]),y=e=>{e===`graphiql`?_():h()},b=e=>{if(i){f(e);return}y(e)},x=(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(`span`,{children:`Saving`}),(0,U.jsx)(iP,{color:`current`})]}),C=m?`Saving`:`Test Route`;return(0,U.jsxs)(U.Fragment,{children:[a?(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsx)(Y,{variant:`brand`,disabled:m,"aria-label":C,children:(0,U.jsxs)(aP,{loading:m,className:`flex items-center gap-2`,alternative:x,children:[(0,U.jsx)(em,{className:`shrink-0 fill-current`}),(0,U.jsx)(`span`,{children:`Test Route`}),(0,U.jsx)(ep,{className:`size-4 shrink-0`})]})})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onSelect:()=>b(`playground`),children:[(0,U.jsx)(em,{className:`size-4`}),(0,U.jsx)(`span`,{children:`Playground`})]}),(0,U.jsxs)(Dq,{disabled:!p,onSelect:()=>b(`graphiql`),children:[(0,U.jsx)(E1,{className:`size-4`}),(0,U.jsx)(`span`,{children:`GraphiQL`})]})]})]}):(0,U.jsx)(Y,{variant:`brand`,disabled:m,"aria-label":C,onClick:()=>b(`playground`),children:(0,U.jsxs)(aP,{loading:m,className:`flex items-center gap-2`,alternative:x,children:[(0,U.jsx)(em,{className:`shrink-0 fill-current`}),(0,U.jsx)(`span`,{children:`Test Route`})]})}),(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(UHt,{open:d!==null,onOpenChange:e=>{e||f(null)},onProceed:()=>{let e=d;f(null),e&&y(e)}})})]})},KHt=({onRequestHandlerChange:e,isReadOnly:t,routeHandler:n})=>{let r=O1(n),i=(t,i)=>{e({...n,options:{...r.options,[t]:i}})};return(0,U.jsxs)(ok,{className:`p-4 bg-surface-sunken`,children:[(0,U.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-2`,children:[(0,U.jsx)(`span`,{className:`text-base font-medium`,children:`MCP Server Options`}),(0,U.jsx)(JT,{showIcon:!0,href:`https://docs.zuplo.com/handlers/mcp-server`,className:`text-sm text-zuplo-pink`,children:`MCP Server Docs`})]}),(0,U.jsxs)(`div`,{className:`grid grid-cols-12 gap-4 col-span-full items-center`,children:[(0,U.jsx)(`div`,{className:`col-span-8`,children:(0,U.jsx)(b6,{isReadOnly:t,label:`Server Name`,onChange:e=>i(`name`,e.target.value),className:`col-span-8`,value:typeof r.options.name==`string`?r.options.name:`My MCP Server`})}),(0,U.jsx)(`div`,{className:`col-span-4`,children:(0,U.jsx)(b6,{isReadOnly:t,label:`Server Version`,className:`col-span-4`,onChange:e=>i(`version`,e.target.value),value:typeof r.options.version==`string`?r.options.version:`v0.0.1`})}),(0,U.jsxs)(`div`,{className:`col-span-12 mt-2`,children:[(0,U.jsx)(XT,{className:`text-sm mb-2 block`,children:`Advanced Options`}),(0,U.jsx)(`div`,{className:W(`flex gap-4`,t&&`opacity-50`),children:(0,U.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,U.jsx)(FY,{"data-test":`mcp-debug-mode`,checked:!!r.options.debugMode,onCheckedChange:e=>{i(`debugMode`,e)},disabled:t}),`Debug Mode`]})})]})]})]})},qHt=({routeHandler:e,operation:t,isReadOnly:n,onRequestHandlerChange:r})=>{let{captureRaw:i}=S(),a=cxt(),o=O1(e),s=typeof o.options.rewritePattern==`string`?o.options.rewritePattern:``,c=lzt(()=>{i(`mcp-gateway-upstream-url-edited`)});return(0,U.jsx)(ok,{className:`p-4`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`div`,{className:`text-xs uppercase tracking-wide text-muted-foreground font-medium`,children:`Upstream MCP server`}),!!(a&&t)&&(0,U.jsxs)(Y,{type:`button`,variant:`default`,size:`sm`,disabled:n,onClick:()=>{!t||!a||(i(`mcp-gateway-edit-virtual-mcp-opened`),a(t))},className:`shrink-0`,children:[(0,U.jsx)(Ip,{className:`w-3.5 h-3.5`}),`Edit MCP Server Policy`]})]}),(0,U.jsx)(u3,{isReadOnly:n,url:s,onUrlChange:t=>{c(),r({...e,options:{...o.options,rewritePattern:t}})},placeholder:`https://example.com/mcp`,"aria-label":`Upstream MCP server URL`,"data-test":`mcp-upstream-url-input`})]})})};function JHt(e){if(e)switch(e.type){case`tool`:return{type:e.type,name:e.name??``,description:e.description??``,annotations:e.annotations};case`prompt`:return{type:e.type,name:e.name??``,description:e.description??``};case`resource`:return{type:e.type,name:e.name??``,description:e.description??``,uri:e.uri??``,mimeType:e.mimeType??``};case`graphql`:return{type:e.type,introspectionTool:{name:e.introspectionTool?.name??``,description:e.introspectionTool?.description??``},executeTool:{name:e.executeTool?.name??``,description:e.executeTool?.description??``}}}}function YHt({operationData:e,addRouteMenuProps:t}){return e?(0,U.jsx)(`div`,{className:`w-full h-full min-h-0 overflow-y-auto px-4 pt-2 pb-4`,children:(0,U.jsx)(ZHt,{operationData:e})}):(0,U.jsx)(pbt,{...t})}var XHt=()=>{let e=xm(),t=Sm(),n=(0,H.useMemo)(()=>e.flatMap(e=>{let n=t[e.path];return n?m1(e.path,n).filter(e=>YX(e)).map(t=>[e,t]):[]}),[e,t]);return{getLinkedMcpServers:(e,t)=>n.filter(([,n])=>{let r=n[KX]?.handler;return qX(r)?r.options?.operations?.some(n=>T1(n.file)===e&&n.id===t):!1})}},ZHt=({operationData:e})=>{let[t]=CY(`path`);if(!t)throw Error(`Open API file path not found in URL`);let n=Bmt(t),r=fm(),{logEvent:i}=S(),{additionalOperationContext:a,...o}=e,{path:s,method:c}=a,l=h1(),u=um(),d=A1(),{isReadOnly:f}=JZ(),[p,m]=(0,H.useState)(),[h,g]=(0,H.useState)();XHt();let _=l.openApiData?.servers?.at(0)?.url,v=o[KX]??_1(_??`https://echo.zuplo.io`),y=o[UX]===!0,b=o.deprecated===!0,x=o[WX]===!0,C=l.openApiFileModel.saveState!==Ql.unmodified,w=v.handler,T=qX(w)&&c.toUpperCase()!==`POST`?`MCP Server handler must use POST method`:void 0,E=e=>{try{l.updateOperation({path:s,method:c,newMethod:e.export===`mcpServerHandler`?`post`:void 0,newOperationObject:{...o,[KX]:{...v,handler:{...e}}}})}catch(e){u.error(e instanceof Error?e.message:`Unknown error`)}},D=e=>{l.updateOperation({path:s,method:c,newOperationObject:{...o,summary:e}})},O=e=>{l.updateOperation({path:s,method:c,newOperationObject:{...o,description:e}})},k=e=>{i(`route-visibility-changed`,{excludeFromDocs:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),l.updateOperation({path:s,method:c,newOperationObject:{...o,[UX]:e}})},A=e=>{i(`route-deprecated-changed`,{deprecated:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),l.updateOperation({path:s,method:c,newOperationObject:{...o,deprecated:e||void 0}})},j=e=>{i(`route-graphql-changed`,{graphql:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name});let n={...o};e?(n[WX]=!0,Zyt(d),n[KX]=Xyt(v,!0)):(delete n[WX],o[KX]&&(n[KX]=Xyt(v,!1))),l.updateOperation({path:s,method:c,newOperationObject:n})},M=e=>{let{newPath:t}=e,{newMethod:n}=e;h!=null&&t==null&&(t=h);try{l.updateOperation({path:s,newPath:t,method:c,newMethod:n,newOperationObject:o}),m(void 0),g(void 0)}catch(e){e instanceof Error&&t!=null&&(g(t),m(e.message))}},N=e=>{if(e===s){m(void 0),g(void 0);return}M({newPath:e.startsWith(`/`)?e:`/${e}`})},P=e=>{let n=e;n!==c&&(i(`route-method-changed`,{httpMethod:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name}),M({newMethod:n}))},F=e=>{let n={...v,corsPolicy:e};l.updateOperation({path:s,method:c,newOperationObject:{...o,[KX]:n}}),i(`route-cors-changed`,{newCors:e,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name})},I=e=>{let t={...o};e.length>0?t.tags=e:delete t.tags,l.updateOperation({path:s,method:c,newOperationObject:t})},L=n=>{let a={...e.additionalOperationContext.pathZuploConfig,pathMode:n},o=l.getOpenApiDataEnforced().paths;if(!o)throw Error(`Property 'paths' is undefined`);let c=o[s];if(!c)throw Error(`Path Item '${s}' is undefined`);l.updatePathItem(s,{...c,[GX]:a}),i(`route-path-mode-changed`,{pathMode:n,fileName:t,account:r.account.name,project:r.project.name,environment:r.environment.name})},R=()=>{n(Ql.modified)};return(0,U.jsxs)(`div`,{className:`mb-4 flex flex-col gap-6`,children:[(0,U.jsxs)(ok,{className:`bg-neutral-50 dark:bg-transparent`,children:[(0,U.jsxs)(`div`,{className:`flex justify-between items-center`,children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{children:`Request Handling`}),(0,U.jsx)(lk,{})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 p-6`,children:[x&&(0,U.jsx)(MHt,{path:s,rewriteUrl:typeof w.options?.rewritePattern==`string`?w.options?.rewritePattern:void 0}),(0,U.jsx)(sVt,{operationData:e}),(0,U.jsx)(GHt,{path:s,method:c,summary:o.summary??``,operationData:e,hasFileChanged:C,isGraphql:x})]})]}),(0,U.jsxs)(uk,{className:`grid grid-cols-1 xl:grid-cols-[max-content_1fr] gap-y-3 xl:gap-y-2 items-center gap-x-6`,children:[(0,U.jsx)(gVt,{isReadOnly:f,initialPath:s,method:c,onChangeMethod:P,pathMode:e.additionalOperationContext.pathZuploConfig?.pathMode,hasError:p!=null,onPathChange:N,onPathModeChange:L,onFieldModified:R,isMcpToolHandler:qX(w)||JX(w)}),p&&(0,U.jsx)(db,{"data-test":`path-error`,className:`col-span-full p-2`,variant:`destructive`,children:(0,U.jsx)(pb,{children:p})}),T&&(0,U.jsx)(db,{className:`col-span-full p-2 py-1`,variant:`destructive`,children:(0,U.jsxs)(pb,{"data-test":`request-handler-error`,className:`flex items-center justify-between`,children:[(0,U.jsx)(`span`,{children:T}),(0,U.jsx)(Y,{onClick:()=>P(`post`),size:`xs`,variant:`outline`,className:`border-none`,children:`Switch to POST method`})]})}),(0,U.jsx)(yFt,{isReadOnly:f,initialSummary:o.summary,onSummaryChange:D,onFieldModified:R}),(0,U.jsx)(cVt,{isReadOnly:f,defaultOperationId:e.operationId,openApiManager:l,path:s,method:c,operationData:e})]}),(0,U.jsxs)(dk,{className:`flex flex-wrap gap-2 px-3 py-1.5 bg-card justify-end`,children:[(0,U.jsx)(NHt,{operationTags:o.tags??[],onTagsChanged:I}),(0,U.jsx)(Vzt,{isReadOnly:f,selectedCorsPolicy:v.corsPolicy,corsPolicies:d.corsPolicyList??[],onSelectionChanged:F}),!qX(v.handler)&&!JX(v.handler)&&(0,U.jsx)(pVt,{operation:e,defaultValues:JHt(v.mcp),onSubmit:e=>{let t={...v,mcp:e};l.updateOperation({path:s,method:c,newOperationObject:{...o,[KX]:t}})}}),(0,U.jsx)(IBt,{isExcludedFromDocs:y,onVisibilityChanged:k}),(0,U.jsx)(_Vt,{isGraphql:x,onGraphqlChanged:j,isDeprecated:b,onDeprecatedChanged:A})]})]}),(0,U.jsx)(nzt,{inboundPolicies:v.policies?.inbound??[],outboundPolicies:v.policies?.outbound??[],operation:e,children:(0,U.jsx)(QHt,{isReadOnly:f,operationData:e,handler:v.handler,firstServerUrl:_,onRequestHandlerChange:E})}),(0,U.jsx)(FBt,{initialDescription:o.description??``,onChange:O,path:s,method:c,oasFilePath:t})]})},QHt=({operationData:e,handler:t,firstServerUrl:n,isReadOnly:r,onRequestHandlerChange:i})=>{let a=(e[KX]??_1(n??`https://echo.zuplo.io`)).handler;switch(t.export){case`mcpServerHandler`:return(0,U.jsx)(KHt,{isReadOnly:r,routeHandler:a,onRequestHandlerChange:i});case`McpProxyHandler`:case`McpVirtualServerHandler`:case`mcpVirtualServerHandler`:return(0,U.jsx)(qHt,{routeHandler:a,operation:e,isReadOnly:r,onRequestHandlerChange:i});default:return(0,U.jsx)(Lzt,{isReadOnly:r,routeHandler:a,onRequestHandlerChange:i})}},$Ht=De()(e=>({updateLinkedMcpServers:void 0,setUpdateLinkedMcpServers:t=>e({updateLinkedMcpServers:t})})),eUt=()=>{let e=j($Ht,e=>e.updateLinkedMcpServers),t=cQ(),n=()=>{$Ht.setState({updateLinkedMcpServers:void 0})};return(0,U.jsx)(Jw,{open:!!e,onOpenChange:e=>{e||n()},children:(0,U.jsxs)(Zw,{children:[(0,U.jsx)(eT,{children:`MCP Server Links`}),(0,U.jsx)(tT,{children:`This operation is linked to MCP servers, if you update the operation id, you need to update the MCP server links as well.`}),(0,U.jsx)(`div`,{className:`flex gap-2 items-center justify-center`,children:e?.linkedMcpServers.map(([,e])=>(0,U.jsx)(BT,{children:e},e))}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`outline`,onClick:n,children:`Cancel`}),(0,U.jsx)(Y,{onClick:()=>{e?.linkedMcpServers.forEach(([n,r])=>{let i=new Lyt(n,t),a=i.getOperationById(r);if(!a)return;let o=a[KX];if(!o)return;let s=o.handler;if(qX(s)){if(n.path===e.file){let t=i.getOperationById(e.oldOperationId);if(!t)throw Error(`Operation not found`);i.updateOperation({path:t.additionalOperationContext.path,method:t.additionalOperationContext.method,newOperationObject:G$(t,`operationId`,e.newOperationId)})}i.updateOperation({path:a?.additionalOperationContext.path,method:a.additionalOperationContext.method,newOperationObject:G$(a,`${KX}.handler.options.operations`,s.options?.operations?.map(t=>T1(t.file)===n.path?{...t,id:t.id===e.oldOperationId?e.newOperationId:t.id}:t))})}})},children:`Update`})]})]})})},tUt=`$import(@zuplo/runtime)`,nUt=`${tUt}::urlForwardHandler`,rUt=`${tUt}::urlRewriteHandler`,iUt=(e,t)=>{let n=e.options?.[t],r=typeof n==`string`?n.trim():``;return r.length>0?r:void 0},aUt=e=>{let t=e.trim();if(t.startsWith("${")){let e=t.indexOf(`}`);if(e!==-1)return t.slice(0,e+1)}let n=/^[a-z][a-z0-9+.-]*:\/\/[^/$?#]+/i.exec(t);if(n)return n[0];let r=t.indexOf(`/`);return r===-1?t:t.slice(0,r)},oUt=e=>{if(e){let t=`${e.module}::${e.export}`,n=t===nUt?iUt(e,`baseUrl`):t===rUt?iUt(e,`rewritePattern`):void 0;if(n){let e=aUt(n);return{key:`target:${e}`,label:e,mono:!0,icon:Tp,collapsible:!0}}}return{...Xbt(e),collapsible:!1}};function sUt(){let e=h1(),{captureRaw:t}=S(),n=fm(),r=aQ();return i=>{e.updateInfo(i),t(`openapi-info-updated`);let{projectTreeNodes:a,filesByPath:o}=vm.getState(),s=a.map(e=>e.path?o[e.path]:void 0).filter(e=>!!e&&e.saveState===Ql.modified);s.length!==0&&r.mutateAsync({environmentName:n.environment.name,accountName:n.account.name,projectName:n.project.name,files:s}).catch(()=>{})}}var D8=`Document Order`,cUt=[`Document Order`,`Path`,`Summary`],O8=`Untagged`,lUt=[{value:`none`,label:`None`},{value:`path`,label:`Path`},{value:`handler`,label:`Handler type`},{value:`target`,label:`Target`}],uUt=new Set([`handler`,`target`]);function dUt(e){return`${e}-${B().split(`-`).at(0)}`}function k8(e){return new Set(e.getPolicyListEnforced().map(e=>e.name))}function fUt(e){if(!e)return;let t=uFt(e.getPolicyListEnforced());if(t)return t.name;let n=_3(cFt,k8(e));return e.createPolicy(lFt(n)),n}var pUt=e=>(t,n)=>{switch(e){case`Document Order`:return 0;case`Path`:return t.additionalOperationContext.path.localeCompare(n.additionalOperationContext.path);case`Summary`:return!t.summary&&!n.summary?0:!t.summary&&n.summary?1:t.summary&&!n.summary?-1:t.summary?.localeCompare(n.summary??``)??0;default:return 0}},mUt=e=>t=>{if(e.length===0)return!0;let n=t.tags;return!n||n.length===0?e.includes(O8):n.some(t=>e.includes(t))},hUt=({onNavigateToOpenApiFileTab:e})=>{let{logEvent:t,captureRaw:n}=S(),[r,i]=Lit(`tags`,[]),[a,o]=NT(`open-api-designer-group-by`,`none`);(0,H.useEffect)(()=>{let e=window.localStorage.getItem(`open-api-designer-show-headers`);e!==null&&(e===`true`&&a===`none`&&o(`path`),window.localStorage.removeItem(`open-api-designer-show-headers`))},[a,o]);let[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(`details`),[d,f]=(0,H.useState)(!1),p=sUt(),m=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable)||(e.preventDefault(),m.current?.focus())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]);let[h,g]=(0,H.useState)(),[_,v]=(0,H.useState)(),[y,b]=(0,H.useState)(()=>new Set),x=e=>b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),[C,w]=(0,H.useState)(()=>new Set),T=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),{isReadOnly:E}=JZ(),[D,O]=CY(`operation`),[k,A]=NT(`default-sort-routes`,D8),[j,M]=CY(`sort`,k);(0,H.useEffect)(()=>{j&&A(j)},[A,j]),(0,H.useEffectEvent)(()=>{if(D)try{document.querySelector(`#op-${D}`)?.scrollIntoView()}catch{}});let[N,P]=(0,H.useState)(void 0),F=h1(),I=A1(),L=dP(),R=lQ(Zbt),z=uQ(),ee=()=>{if(R)return $bt(R.content??``)?`ok`:`manual`;let e=Qbt,t={path:Zbt,content:e,type:Zl.File,saveState:Ql.new};if(L){let n=L.Uri.file(t.path);L.editor.getModel(n)||L.editor.createModel(e,void 0,n)}return z(t),z({...t,saveState:Ql.modified}),`ok`},{results:te,setSearchTerm:V,searchTerm:ne}=jbt(F.operationArray?.filter(mUt(r)).sort(pUt(j))??[],{keys:[e=>e.additionalOperationContext.path,e=>e.summary??``,e=>e.operationId,e=>e.additionalOperationContext.method]});(0,H.useEffect)(()=>{let e=ne?.trim()??``;if(e.length===0)return;let n=setTimeout(()=>{t(`route-search-used`,{view:`routes`,query:e,queryLength:e.length})},600);return()=>clearTimeout(n)},[ne,t]);let re=(()=>{let e=new Map;for(let t of te){let n,r,i,o,s;if(a===`handler`||a===`target`){let e=t[KX]?.handler,c=a===`target`?oUt(e):{...Xbt(e),collapsible:!1};({key:n,label:r,mono:i,collapsible:o,icon:s}=c)}else n=t.additionalOperationContext.path,r=n,i=!0,o=!1,s=void 0;let c=e.get(n);c?c.operations.push(t):e.set(n,{key:n,label:r,mono:i,icon:s,collapsible:o,operations:[t]})}return[...e.values()]})(),[ie,ae]=(0,H.useState)(),[oe,se]=(0,H.useState)(),[ce,le]=(0,H.useState)(!1),ue=(0,H.useMemo)(()=>{if(!_)return[];let e=(F.operationArray?.find(e=>e.additionalOperationContext.path===_.path&&e.additionalOperationContext.method===_.method))?.[KX]?.policies?.inbound??[];if(e.length===0)return[];let t=new Set;for(let e of I.policyList??[]){if(e.policyType!==`composite-inbound`&&e.policyType!==`composite-outbound`)continue;let n=e.handler.options?.policies;if(n)for(let e of n)t.add(e)}let n=I.policiesUsageInfo??[];return e.map(e=>n.find(t=>t.name===e)).filter(e=>{if(!e||e.operations.length!==1)return!1;let n=e.operations[0];return!(n.additionalOperationContext.path!==_.path||n.additionalOperationContext.method!==_.method||t.has(e.name))})},[_,F.operationArray,I.policyList,I.policiesUsageInfo]),[de,fe]=(0,H.useState)(()=>new Set);(0,H.useEffect)(()=>{fe(_?new Set(ue.map(e=>e.name)):new Set)},[_]);let pe=(e,t)=>{fe(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},me=()=>{if(_==null){le(!1);return}try{for(let e of de)try{I.deletePolicy(e),t(`policy-deleted`,{policy:e})}catch{}F.deleteOperation(_.path,_.method),t(`route-deleted`,_)}catch(e){e instanceof Error&&(t(`route-deletion-failed`,_),P(e.message),he())}v(void 0),le(!1)},[he,ge]=F$(()=>{let t=()=>{P(void 0),ge()};return(0,U.jsx)(xQ,{alertType:`ERROR`,bodyText:N??``,onPrimaryButtonClick:e,onSecondaryButtonClick:t,primaryButtonText:`Edit file directly`,secondaryButtonText:`Cancel`,hideModal:t,title:`Error`})},[N]),[_e,ve]=F$(()=>(0,U.jsx)(xQ,{alertType:`CAUTION`,bodyText:`Cannot reorder in this view — view by Document Order to reorganize the order of operations.`,onPrimaryButtonClick:()=>{M(D8),ve()},onSecondaryButtonClick:ve,primaryButtonText:`Switch to Document Order`,secondaryButtonText:`Cancel`,hideModal:ve,title:`Cannot reorder`})),[ye,be]=F$(()=>(0,U.jsx)(txt,{open:!0,onOpenChange:e=>{e||be()}})),xe=(e,t)=>{if(j!==D8){_e();return}F.movePathInDocument(e,t)};if(!F.openApiData)throw Error(`Invalid State - no OpenApiData`);let Se=F.openApiData.info,Ce=F.openApiData.tags?.map(e=>({value:e.name,label:e.name}));Ce?.push({value:O8,label:O8});let we=()=>{let e=S1.OpenAPIV3.HttpMethods.GET,n=F.openApiData?.servers?.at(0)?.url,r=Jyt(n??`https://echo.zuplo.io`),i=`/path-${((F.operationArray?.filter(t=>t.additionalOperationContext.path.startsWith(`/path-`)&&t.additionalOperationContext.method===e)?.map(e=>parseInt(e.additionalOperationContext.path.replace(`/path-`,``),10))?.filter(e=>!Number.isNaN(e))?.sort((e,t)=>t-e))?.at(0)??0)+1}`;try{let t=F.addOperation(i,e,r);t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:i,httpMethod:e}),P(n.message),he())}t(`route-added`)},Te=(e,n,r)=>{let i=F.openApiData?.servers?.at(0)?.url,a=Jyt(i??`https://echo.zuplo.io`),o=r?.[KX],s=a[KX];o&&s&&(o.handler&&(s.handler=JSON.parse(JSON.stringify(o.handler))),o.policies&&(s.policies=JSON.parse(JSON.stringify(o.policies))));try{let t=F.addOperation(e,n,a);t&&O(t)}catch(r){r instanceof Error&&(t(`route-add-failed`,{httpPath:e,httpMethod:n}),P(r.message),he())}t(`route-added`)},Ee=()=>{let e=S1.OpenAPIV3.HttpMethods.POST,n=dUt(`mcp`),r=F.addOperation(`/mcp`,e,{summary:`MCP Server`,description:`Default MCP Server`,[KX]:{corsPolicy:`none`,handler:{export:`mcpServerHandler`,module:`$import(@zuplo/runtime)`,options:{operations:[]}},policies:{inbound:[]}},operationId:n},{avoidConflict:!0});r&&O(r),t(`route-added`)},De=()=>{let e=S1.OpenAPIV3.HttpMethods.POST,n=Qyt(`https://rickandmortyapi.com/graphql`);try{Zyt(I);let t=F.addOperation(`/graphql`,e,n,{avoidConflict:!0});t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:`/graphql`,httpMethod:e}),P(n.message),he())}t(`route-added`)},Oe=()=>{let e=S1.OpenAPIV3.HttpMethods.GET,n=$yt();try{let t=F.addOperation(`/websocket`,e,n,{avoidConflict:!0});t&&O(t)}catch(n){n instanceof Error&&(t(`route-add-failed`,{httpPath:`/websocket`,httpMethod:e}),P(n.message),he())}t(`route-added`)},[ke,Ae]=(0,H.useState)(!1),[je,Me]=(0,H.useState)(),[Ne,Pe]=(0,H.useState)(0),Fe=(0,H.useMemo)(()=>{let e=new Set(Object.keys(F.openApiData?.paths??{}));return je&&e.delete(je.path),e},[F.openApiData?.paths,je]),Ie=async e=>{let n;try{n=ee()}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}let r;try{r=fFt({result:e,policyList:I.getPolicyListEnforced(),existingOperationIds:new Set(F.operationArray?.map(e=>e.operationId)??[])});for(let e of r.policiesToCreate)I.createPolicy(e)}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}try{let e=F.addOperation(r.operationPath,r.method,r.operation,{avoidConflict:!0});e&&O(e)}catch(e){e instanceof Error&&(P(e.message),he())}t(`route-added`),t(`mcp-gateway-create-virtual-mcp-submitted`,pFt(e)),n===`manual`&&ye()},Le=()=>{Pe(e=>e+1),Ae(!0)},Re=e=>{let t=$Pt({operationPath:e.additionalOperationContext.path,operation:e,policyList:I?.getPolicyListEnforced()??[]});t&&(Pe(e=>e+1),Me({initialResult:t,path:e.additionalOperationContext.path,method:e.additionalOperationContext.method,operationId:e.operationId}))},ze=async e=>{let t=je;if(!t)return;let{initialResult:r,path:i,method:a}=t,o=F.operationArray?.find(e=>e.additionalOperationContext.path===i&&e.additionalOperationContext.method===a);if(!o){Me(void 0);return}let s;try{s=ee()}catch(e){if(e instanceof Error){P(e.message),he();return}throw e}let c=oFt(e.step1.name),l=a0(e.step1.mcpUrl),u=l?.protectedResourceMetadataUrl??dFt(e.step1.mcpUrl),d=o[KX]?.policies?.inbound??[],f=I?.getPolicyListEnforced()??[],p=new Map(f.map(e=>[e.name,e])),m=d.map(e=>p.get(e)).filter(e=>e!=null),h=m.find(e=>e.policyType===X4),g=m.find(e=>e.policyType===Z4),_=m.find(e=>e.policyType===`remove-headers-inbound`&&Q4(e.handler?.options)),v=m.find(e=>e.policyType.startsWith(`upstream-`)),y;if(e.step1.authMode===`user-oauth`){let t={id:c,displayName:e.step1.name,summary:`${e.step1.name} remote MCP server, federated via the gateway.`,...u?{protectedResourceMetadataUrl:u}:{},authMode:`user-oauth`,scopes:l?.scopes??[],clientRegistration:e.step1.clientRegistration};if(h&&I)try{I.updatePolicy(h.name,{...h,handler:{...h.handler,options:t}}),y=h.name}catch(e){if(e instanceof Error){P(e.message),he();return}}else if(I){y=_3(`mcp-upstream-${c}`,k8(I));try{I.createPolicy({name:y,policyType:X4,handler:{module:`$import(@zuplo/runtime/mcp-gateway)`,export:`McpTokenExchangeInboundPolicy`,options:t}})}catch(e){if(e instanceof Error){P(e.message),he();return}}}}let b;if(e.step1.authMode===`upstream-policy`&&I){let{policyType:t,policyName:n,handler:r}=e.step1;try{v&&v.policyType===t?I.updatePolicy(v.name,{...v,name:n,handler:r}):I.createPolicy({name:n,policyType:t,handler:r}),b=n}catch(e){if(e instanceof Error){P(e.message),he();return}}}let x;if(e.step2.catalogMode===`curated`){let t=W4(e.step2);if(g&&I)try{I.updatePolicy(g.name,{...g,handler:{...g.handler,options:t}}),x=g.name}catch(e){if(e instanceof Error){P(e.message),he();return}}else if(I){x=_3(`mcp-filter-${c}`,k8(I));try{I.createPolicy({name:x,policyType:Z4,handler:{module:`$import(@zuplo/runtime/mcp-gateway)`,export:`McpCapabilityFilterInboundPolicy`,options:t}})}catch(e){if(e instanceof Error){P(e.message),he();return}}}}let S;if(e.step3.authPolicyChoice===`existing`)S=e.step3.existingPolicyName;else if((e.step3.authPolicyChoice===`new`||e.step3.authPolicyChoice===`new-other`)&&(S=e.step3.newPolicyName,I))try{I.createPolicy({name:S,policyType:e.step3.policyType,handler:e.step3.handler})}catch(e){if(e instanceof Error){P(e.message),he();return}}let C;if(e.step1.authMode===`none`&&e.step1.noAuthBehavior===`strip`)try{C=_?.name??fUt(I)}catch(e){if(e instanceof Error){P(e.message),he();return}}let w=[S,x,y,b,C].filter(e=>!!e),T=o[KX],E=T?.handler;try{F.updateOperation({path:i,method:a,newOperationObject:{...o,summary:e.step1.name,description:`MCP Virtual Server fronted by the gateway (${e.step1.mcpUrl})`,[KX]:{...T??{},handler:{...E??{export:`McpProxyHandler`,module:`$import(@zuplo/runtime/mcp-gateway)`},options:{...E?.options??{},rewritePattern:e.step1.mcpUrl}},policies:{...T?.policies??{},inbound:w}}}})}catch(e){if(e instanceof Error){P(e.message),he();return}}let D;try{D=new URL(e.step1.mcpUrl).hostname}catch{D=void 0}n(`mcp-gateway-edit-virtual-mcp-submitted`,{upstreamHost:D,upstreamAuthMode:e.step1.authMode,previousUpstreamAuthMode:r.step1.authMode,inboundAuthChoice:e.step3.authPolicyChoice,previousInboundAuthChoice:r.step3.authPolicyChoice}),Me(void 0),s===`manual`&&ye()},Be=(0,H.useMemo)(()=>D?te.find(e=>e.operationId===D)||te.find(e=>h?.path===e.additionalOperationContext.path&&h?.method===e.additionalOperationContext.method):void 0,[te,D,h]);(0,H.useEffect)(()=>{Be&&!h&&g({path:Be.additionalOperationContext.path,method:Be.additionalOperationContext.method})},[Be,h]);let Ve=(e,n,r)=>{let i=(e,t)=>{let n=e.replace(/-duplicate(-\d+)?$/,``),r=`${n}-duplicate`,i=2;for(;t(r);)r=`${n}-duplicate-${i}`,i++;return r},a=F.operationArray??[],o=i(e,e=>a.some(t=>t.additionalOperationContext.path===e&&t.additionalOperationContext.method===n)),s=i(r.operationId??`op-${B().slice(0,4)}`,e=>a.some(t=>t.operationId===e)),c=JSON.parse(JSON.stringify(r));c.operationId=s;try{let e=F.addOperation(o,n,c);e&&O(e)}catch(e){e instanceof Error&&(t(`route-add-failed`,{httpPath:o,httpMethod:n}),P(e.message),he())}t(`route-added`,{httpPath:o,httpMethod:n,duplicate:!0})},He=()=>{f(!0),u(`tags`),c(!0)},Ue=je!==void 0,We=(0,U.jsx)(eFt,{isOpen:ke||Ue,existingPaths:Fe,mode:Ue?`edit`:`create`,initialResult:je?.initialResult,onClose:()=>{Ae(!1),Me(void 0)},onFinish:Ue?ze:Ie},`mcp-wizard-${Ne}`),Ge={onAddRest:we,onAddGraphql:De,onAddWebSocket:Oe,onAddMcpVirtual:Le,onAddMcpServer:Ee,onAddTag:He};return F.operationArray?.length===0&&(!ne||ne.trim().length===0)?(0,U.jsxs)(U.Fragment,{children:[We,(0,U.jsx)(pbt,{...Ge})]}):(0,U.jsxs)(`div`,{className:`ms-2 grid grid-cols-3 h-full grow`,children:[(0,U.jsx)(M$,{open:ce,onOpenChange:e=>{le(e),e||v(void 0)},onClickDelete:me,title:`Delete`,deleteButtonText:`Confirm`,children:ue.length===0?`Are you sure you want to delete this operation?`:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{children:[`The following`,` `,ue.length===1?`policy is`:`policies are`,` `,`used only by this route. Would you like to delete`,` `,ue.length===1?`it`:`them`,` `,`too?`]}),(0,U.jsx)(`ul`,{className:`flex flex-col divide-y divide-border max-h-[40vh] overflow-y-auto rounded-md border bg-surface-sunken`,children:ue.map(e=>{let t=`delete-policy-${e.name}`;return(0,U.jsxs)(`li`,{className:`flex items-start gap-2 px-3 py-2`,children:[(0,U.jsx)(FY,{id:t,checked:de.has(e.name),onCheckedChange:t=>pe(e.name,t===!0),className:`mt-0.5`}),(0,U.jsxs)(`label`,{htmlFor:t,className:`flex flex-col gap-0.5 text-left cursor-pointer min-w-0`,children:[(0,U.jsx)(`span`,{className:`font-medium text-foreground truncate`,children:e.name}),(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground truncate`,children:e.policyType})]})]},e.name)})})]})}),(0,U.jsx)(eUt,{}),We,Se&&(0,U.jsx)(_Ft,{open:s,onOpenChange:c,info:Se,onSave:p,defaultTab:l,tagsAutoCreate:d,onTagsAutoCreateConsumed:()=>f(!1)}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 justify-start h-full pt-2 min-h-0`,children:[(0,U.jsxs)(`div`,{className:`flex justify-between gap-x-2`,children:[(0,U.jsx)(`div`,{className:`flex gap-1`,children:(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{className:`flex group select-none`,asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,title:`Filter and sort routes`,children:[(0,U.jsx)(rte,{size:16}),`Filter`]})}),(0,U.jsxs)(Tq,{className:`min-w-[220px]`,align:`start`,children:[(0,U.jsx)(jq,{children:`Sort by`}),(0,U.jsx)(Eq,{children:cUt.map(e=>(0,U.jsxs)(Dq,{onClick:()=>M(e),className:`justify-between`,children:[e,(0,U.jsx)($f,{className:W(`mr-2`,e!==j&&`invisible`),size:16})]},e))}),(0,U.jsx)(Mq,{}),(0,U.jsx)(jq,{children:`Filter by tag`}),(0,U.jsx)(Eq,{className:`max-h-60 overflow-y-auto`,children:Ce?.map(e=>(0,U.jsxs)(Dq,{onClick:t=>{t.stopPropagation(),t.preventDefault(),r.includes(e.value)?i(r.filter(t=>t!==e.value)):i([...r,e.value])},className:`justify-between`,children:[e.label,(0,U.jsx)($f,{className:W(`mr-2`,!r.includes(e.value)&&`invisible`),size:18})]},e.label))}),(0,U.jsx)(Mq,{}),(0,U.jsx)(jq,{children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(gte,{size:16}),`Group by`]})}),(0,U.jsx)(Eq,{children:lUt.map(e=>(0,U.jsxs)(Dq,{onClick:t=>{t.stopPropagation(),t.preventDefault(),o(e.value)},className:`justify-between`,children:[e.label,(0,U.jsx)($f,{className:W(`mr-2`,a!==e.value&&`invisible`),size:16})]},e.value))})]})]})}),E?null:(0,U.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,U.jsx)(Y,{variant:`outline`,size:`sm`,onClick:()=>{f(!1),u(`details`),c(!0)},"aria-label":`API Settings`,title:`API Settings`,children:(0,U.jsx)(Mp,{size:16})}),(0,U.jsxs)(Cq,{children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,"data-test":`add-route-btn`,className:`relative gap-0.5!`,children:[(0,U.jsx)(`div`,{className:`absolute w-1.5 h-1.5 rounded-full -top-0.5 -right-[3px] bg-zuplo-700`}),(0,U.jsx)(Np,{"aria-hidden":`true`,className:`size-3.5`}),`Add`]})}),(0,U.jsx)(Tq,{children:(0,U.jsx)(fbt,{...Ge})})]})]})]}),(0,U.jsx)(AY,{onClearValue:()=>V(``),value:ne,showClearButton:!!ne&&ne.length>0,children:(0,U.jsx)(YT,{ref:m,value:ne,onChange:e=>V(e.target.value),placeholder:`Search Routes`,className:`px-8`})}),r.length>0&&(0,U.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:r.map(e=>(0,U.jsxs)(`div`,{className:`group flex items-center gap-1 max-w-full pl-1.5 pr-0.5 py-0.5 rounded-full border border-border bg-card text-xs text-foreground`,children:[(0,U.jsx)(Kp,{size:11,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate`,title:e,children:e}),(0,U.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e} filter`,onClick:t=>{t.stopPropagation(),i(r.filter(t=>t!==e))},className:`shrink-0 size-4 rounded-full flex items-center justify-center text-muted-foreground hover:bg-surface-emphasis hover:text-neutral-900 dark:hover:text-foreground`,children:(0,U.jsx)($p,{size:11})})]},e))}),(0,U.jsx)(`div`,{className:`overflow-y-auto space-y-1`,children:re.map((e,t,n)=>{let r=!e.collapsible||C.has(e.key),i=e.operations.length,o=e.icon,s=(0,U.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full bg-background px-1.5 py-0.5 text-xs font-normal tabular-nums text-muted-foreground`,children:i});return(0,U.jsxs)(`div`,{children:[e.collapsible?(0,U.jsxs)(`button`,{type:`button`,onClick:()=>T(e.key),"aria-expanded":r,className:`mt-3 mb-1 flex w-full items-center gap-1.5 rounded-md bg-muted/60 px-2 py-2 text-left text-sm font-semibold text-foreground transition-colors first:mt-1 hover:bg-muted`,title:r?`Collapse ${e.label}`:`Expand ${e.label} (${i} ${i===1?`route`:`routes`})`,children:[r?(0,U.jsx)(ep,{size:15,className:`shrink-0 text-muted-foreground`}):(0,U.jsx)(tp,{size:15,className:`shrink-0 text-muted-foreground`}),o&&(0,U.jsx)(o,{size:16,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`truncate font-mono`,title:e.label,children:e.label}),s]}):a!==`none`&&(0,U.jsxs)(`div`,{className:`mt-3 mb-1 flex items-center gap-1.5 rounded-md bg-muted/60 px-2 py-2 text-sm font-semibold text-foreground first:mt-1`,children:[o&&(0,U.jsx)(o,{size:16,className:`shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:W(`truncate`,e.mono&&`font-mono`),title:e.label,children:e.label}),s]}),r&&e.operations.map(({additionalOperationContext:e,...r})=>{let i=Be?.operationId===r.operationId,o=r[KX]?.handler,s=qX(o),c=JX(o),l=s?o.options?.operations?.length??0:0,u=l>0,d=y.has(r.operationId);return(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(Rbt,{path:i&&ie?ie:e.path,type:c?`mcp-virtual`:s?`mcp`:`route`,method:e.method,summary:i&&oe?oe:r.summary,operationId:r.operationId,operation:r,isSelected:i,onOperationSelected:t=>{ae(``),se(``),g({path:e.path,method:e.method}),O(t)},onDelete:(e,t,n)=>{v({path:e,method:t,operationId:n}),le(!0)},onAddRoute:Te,onDuplicate:()=>Ve(e.path,e.method,r),onMoveUp:uUt.has(a)?void 0:()=>xe(e.path,`up`),onMoveDown:uUt.has(a)?void 0:()=>xe(e.path,`down`),isFirstPath:j===D8&&t===0,isLastPath:j===D8&&t===n.length-1,isToolsExpanded:u?d:void 0,onToggleTools:u?()=>x(r.operationId):void 0,toolsCount:u?l:void 0}),o&&u&&d&&(0,U.jsx)(oxt,{handler:o,operation:{...r,additionalOperationContext:e}})]},r.operationId)})]},e.key)})})]}),(0,U.jsx)(`div`,{className:`col-span-2 flex flex-col h-full overflow-y-auto`,children:(0,U.jsx)(v3.Provider,{value:{setPath:ae,setSummary:se},children:(0,U.jsx)(sxt.Provider,{value:Re,children:(0,U.jsx)(YHt,{operationData:Be,addRouteMenuProps:Ge})})})})]})},gUt={create:{shell:`bg-emerald-500/8 shadow-emerald-950/5`,icon:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`,count:`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`},update:{shell:`bg-brand/8 shadow-brand/5`,icon:`bg-brand/12 text-brand`,count:`bg-brand/12 text-brand`},keep:{shell:`bg-background shadow-black/5 dark:shadow-white/5`,icon:`bg-muted text-muted-foreground`,count:`bg-muted text-muted-foreground`}},A8=({icon:e,operations:t,title:n,tone:r})=>{let i=gUt[r];return(0,U.jsxs)(`section`,{className:`rounded-2xl p-4 shadow-sm ${i.shell}`,"aria-label":`${n} operations`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 font-semibold text-foreground`,children:[(0,U.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-xl ${i.icon}`,children:e}),n,` operations`]}),(0,U.jsx)(`div`,{className:`rounded-full px-2.5 py-1 text-xs font-medium tabular-nums ${i.count}`,children:t.size})]}),(0,U.jsx)(`div`,{className:`space-y-1.5`,children:Array.from(t).map(e=>{let t=e.split(`>`),n=t[0],r=t.slice(1,t.length).join(`>`);return(0,U.jsxs)(`div`,{className:`flex min-h-10 items-center gap-3 rounded-xl bg-background/80 px-3 py-2 text-sm shadow-xs`,children:[(0,U.jsx)(jY,{className:`w-14`,method:n}),(0,U.jsx)(`span`,{className:`break-all text-foreground/90`,children:r})]},e)})})]})},_Ut=({openApiFileModel:e,onOpenApiFileSynced:t,setIsOpen:n})=>{let[r,i]=(0,H.useState)(),a=um(),o=e=>{i(e)},s=async()=>{if(!r)throw Error(`No file selected`);let i=e.content?JSON.parse(e.content):null;t(i?lft(i,r.content):r.content),n(!1),a.success(`OpenAPI file merged successfully`,{icon:(0,U.jsx)(Fhe,{className:`h-4 w-4`})})};if(r){let t=mft(JSON.parse(e.content??`{}`),r.content);return(0,U.jsx)(y1,{isOpen:!0,setIsOpen:n,title:`Review OpenAPI import`,className:`sm:max-w-4xl max-h-[88vh] overflow-y-auto`,icon:(0,U.jsx)(Ly,{className:`shrink-0 h-6 w-6 text-brand`}),iconStyle:`bg-zuplo-pink/10`,buttons:[{onButtonClick:()=>{n(!1)},variant:`outline`,buttonContent:`Cancel`,id:`Close merge open-api modal`,testID:`merge-cancel-btn`},{onButtonClick:s,variant:`brand`,buttonContent:`Import changes`,id:`Complete open-api merge`,testID:`complete-merge-btn`}],bodyComponent:(0,U.jsxs)(`div`,{className:`mt-6 text-left text-sm`,children:[(0,U.jsx)(`div`,{className:`overflow-hidden rounded-3xl bg-gradient-to-br from-brand/12 via-background to-background p-px shadow-lg shadow-brand/5`,children:(0,U.jsxs)(`div`,{className:`rounded-[calc(1.5rem-1px)] bg-background p-5`,children:[(0,U.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[1fr_auto_1fr] md:items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-2xl bg-surface-sunken p-4 shadow-[inset_0_1px_rgba(255,255,255,0.05)]`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-brand/10 text-brand`,children:(0,U.jsx)(oge,{className:`h-5 w-5`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Import file`}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate font-medium text-foreground`,children:r.name})]})]})}),(0,U.jsx)(`div`,{className:`hidden h-10 w-10 items-center justify-center rounded-full bg-brand text-brand-foreground shadow-sm shadow-brand/24 md:flex`,children:(0,U.jsx)(Ly,{className:`h-5 w-5`})}),(0,U.jsx)(`div`,{className:`rounded-2xl bg-surface-sunken p-4 shadow-[inset_0_1px_rgba(255,255,255,0.05)]`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-emerald-500/10 text-emerald-600 dark:text-emerald-400`,children:(0,U.jsx)(Uy,{className:`h-5 w-5`})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Current API`}),(0,U.jsx)(`div`,{className:`mt-0.5 truncate font-medium text-foreground`,children:e.path})]})]})})]}),(0,U.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2 text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:`Operations are matched by`}),(0,U.jsx)(BT,{variant:`outline`,children:`Path + method`}),(0,U.jsx)(`span`,{children:`so existing Zuplo extensions and policies stay in place.`})]})]})}),(0,U.jsxs)(`div`,{className:`mt-6 flex items-end justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`div`,{className:`text-base font-semibold text-foreground`,children:`Import summary`}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Review what will change before applying this file.`})]}),(0,U.jsxs)(`div`,{className:`rounded-full bg-surface-sunken px-3 py-1 text-xs font-medium text-muted-foreground tabular-nums`,children:[t.created.size+t.merged.size+t.retained.size,` `,`operations`]})]}),(0,U.jsxs)(`div`,{className:`mt-3 grid max-h-96 gap-3 overflow-y-auto rounded-3xl bg-surface-sunken p-3 shadow-[inset_0_1px_rgba(255,255,255,0.04)]`,children:[t.created.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Ege,{className:`h-4 w-4`}),title:`Create`,tone:`create`,operations:t.created}):null,t.merged.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Cge,{className:`h-4 w-4`}),title:`Update`,tone:`update`,operations:t.merged}):null,t.retained.size>0?(0,U.jsx)(A8,{icon:(0,U.jsx)(Ihe,{className:`h-4 w-4`}),title:`Keep`,tone:`keep`,operations:t.retained}):null]})]})})}return(0,U.jsx)(obt,{title:`Import OpenAPI`,onValidFileSelected:o,setIsOpen:n})},vUt=()=>{let e=bt(),t=Oe({mutationFn:t=>e.fetch(ae.users.updatePreferences(t))}),{data:n}=Mb(je.user.preferences());return{preferences:n,updatePreferences:t.mutate,updatePreferencesMutation:t}},yUt=!1;function j8(){let e=At(),{preferences:t,updatePreferencesMutation:n}=vUt();return{isFileTreeOpen:t.fileTreeOpen??yUt,setIsFileTreeOpen:r=>{let i=[je.user.preferences().url,!0],a=e.getQueryData(i),o={...a??t,fileTreeOpen:r};e.setQueryData(i,o),n.mutate(o,{onError:()=>{a&&e.setQueryData(i,a),e.invalidateQueries({queryKey:i})}})}}}function bUt(){let e=sQ(),{logEvent:t}=S(),[n,r]=CY(`v`,`designer`),{isFileTreeOpen:i}=j8(),a=e?.path.split(`/`).pop()??`JSON`,o=cQ(),s=cbt(),[c,l]=F$(()=>{if(!e)throw Error(`File model not found`);return t(`merge-open-api`),(0,U.jsx)(_Ut,{openApiFileModel:e,onOpenApiFileSynced:n=>{let r={...e,content:JSON.stringify(n,null,2)};o(r,!0),t(`merge-open-api-complete`),s(r.path)},setIsOpen:l})},[e,s]);return(0,U.jsx)(Hbt,{children:(0,U.jsx)(zyt,{children:(0,U.jsxs)(Yk,{defaultValue:`designer`,value:n,onValueChange:e=>r(e),className:`flex flex-col h-full w-full max-h-screen min-w-[850px]`,children:[i&&(0,U.jsxs)(Xk,{className:`rounded-none border-b w-full justify-start`,children:[(0,U.jsx)(Zk,{value:`designer`,children:`Route Designer`}),(0,U.jsx)(Zk,{value:`raw`,children:a??`Raw`}),(0,U.jsxs)(Y,{variant:`outline`,size:`sm`,onClick:c,className:`ml-4`,children:[(0,U.jsx)(Pge,{className:`w-4 h-4`}),` Import`]})]}),(0,U.jsx)(Qk,{value:`designer`,className:`grow h-full overflow-y-auto`,children:(0,U.jsx)(qyt,{onNavigateToOpenApiFileTab:()=>r(`raw`),children:(0,U.jsx)(hUt,{onNavigateToOpenApiFileTab:()=>r(`raw`)})})}),(0,U.jsx)(Qk,{value:`raw`,className:`grow h-full overflow-y-auto`,forceMount:!0,children:(0,U.jsx)(bQ,{})})]})})})}function xUt({title:e,description:t,folder:n,icon:r,emptyText:i,newLabel:a,onCreate:o}){let s=vm(e=>e.projectTreeNodes),[c,l]=Bl(),{isReadOnly:u}=JZ(),d=n.endsWith(`/`)?n:`${n}/`,f=(0,H.useMemo)(()=>s.filter(e=>e.type===Zl.File&&e.path.startsWith(d)).sort((e,t)=>e.path.localeCompare(t.path)),[s,d]),p=e=>{let t=new URLSearchParams(c);t.set(`path`,e),t.delete(`v`),t.delete(`line`),l(t)};return(0,U.jsx)(`div`,{className:`h-full w-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-bold text-neutral-900 dark:text-neutral-100`,children:e}),(0,U.jsx)(`p`,{className:`text-sm text-neutral-600 dark:text-neutral-400`,children:t})]}),!u&&(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:o,className:`shrink-0`,children:[(0,U.jsx)(Np,{className:`size-4`}),a]})]}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-1.5`,children:f.length===0?(0,U.jsx)(`div`,{className:`rounded-lg border border-dashed p-8 text-center text-sm text-neutral-500 dark:text-neutral-400`,children:i}):f.map(e=>{let t=e.path.slice(d.length);return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:W(`group flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors`,`bg-surface hover:border-brand/40 hover:bg-brand/5`,`ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,U.jsx)(r,{className:`size-4 shrink-0 text-neutral-500 group-hover:text-brand`}),(0,U.jsx)(`span`,{className:`truncate text-sm font-medium text-neutral-800 dark:text-neutral-200`,children:t})]},e.path)})})]})})}function SUt(){let e=vm(e=>e.setPendingNewFile),{setIsFileTreeOpen:t}=j8();return(0,U.jsx)(xUt,{title:`Custom Modules`,description:`TypeScript modules in your project's modules/ folder — request handlers, policies, and other custom code.`,folder:`/modules`,icon:wte,emptyText:`No custom modules yet. Create one to add request handlers or custom logic.`,newLabel:`New Module`,onCreate:()=>{t(!0),e({strategyFolder:`/modules`,template:`Request Handler`})}})}function CUt(){let e=vm(e=>e.setPendingNewFile),{setIsFileTreeOpen:t}=j8();return(0,U.jsx)(xUt,{title:`Schemas`,description:`JSON schemas in your project's schemas/ folder, used to validate requests and responses.`,folder:`/schemas`,icon:xp,emptyText:`No schemas yet. Create one to validate request or response bodies.`,newLabel:`New Schema`,onCreate:()=>{t(!0),e({strategyFolder:`/schemas`,template:`Schema`})}})}var wUt=()=>{let[e,t]=(0,H.useState)(),{isReadOnly:n}=JZ(),r=A1(),i=r.policiesUsageInfo,{logEvent:a}=S(),o=fm([`account`,`project`,`environment`]),[s,c]=F$(()=>e?(0,U.jsx)($Rt,{isOpen:!0,setIsOpen:c,stackType:e,shouldHideExistingPolicies:!0,policyManager:r}):null,[e]),l=e=>{t(e),a(`create-policy-clicked`,{account:o.account.name,project:o.project.name,environment:o.environment.name,type:e}),s()},u=(r.policyList??[]).flatMap(e=>i?.find(t=>t.name===e.name)??[]);return(0,U.jsx)(`div`,{className:`h-full w-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`mx-auto max-w-3xl px-6 py-8`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h1`,{className:`text-xl font-bold text-neutral-900 dark:text-neutral-100`,children:`Policies`}),(0,U.jsx)(`p`,{className:`text-sm text-neutral-600 dark:text-neutral-400`,children:`Reusable policies from your project's config/policies.json — apply them to routes to inspect and control requests and responses.`})]}),!n&&(0,U.jsxs)(Cq,{modal:!1,children:[(0,U.jsx)(wq,{asChild:!0,children:(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,className:`shrink-0`,children:[(0,U.jsx)(Np,{className:`size-4`}),`New Policy`]})}),(0,U.jsxs)(Tq,{align:`end`,children:[(0,U.jsxs)(Dq,{onClick:()=>l(`inbound`),children:[(0,U.jsx)(Nf,{className:`mr-2 size-4`}),`Inbound Policy`]}),(0,U.jsxs)(Dq,{onClick:()=>l(`outbound`),children:[(0,U.jsx)(Lf,{className:`mr-2 size-4`}),`Outbound Policy`]})]})]})]}),(0,U.jsx)(`div`,{className:`mt-6 flex flex-col gap-1.5`,children:u.length===0?(0,U.jsxs)(`div`,{className:`rounded-lg border border-dashed p-8 text-center text-sm text-neutral-500 dark:text-neutral-400`,children:[`No policies yet. Create an inbound or outbound policy to inspect and control requests and responses, or`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/overview/policies`,children:`read the docs`}),`.`]}):u.map(e=>(0,U.jsx)(KRt,{policy:e},e.name))})]})})},TUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DeploymentLogState=void 0;var t;(function(e){e.ERROR=`ERROR`,e.IN_PROGRESS=`IN_PROGRESS`,e.SUCCESS=`SUCCESS`})(t||(e.DeploymentLogState=t={}))})),EUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SourceControlProvider=e.PlanType=e.EnvironmentType=e.EnvironmentTarget=e.DeploymentState=void 0;var t;(function(e){e[e.IS_STARTING=0]=`IS_STARTING`,e[e.STARTED=1]=`STARTED`,e[e.STOPPED=2]=`STOPPED`,e[e.ERRORED=3]=`ERRORED`})(t||(e.DeploymentState=t={}));var n;(function(e){e.CLOUDFLARE=`CLOUDFLARE`,e.KNATIVE=`KNATIVE`})(n||(e.EnvironmentTarget=n={}));var r;(function(e){e.PRODUCTION=`PRODUCTION`,e.PREVIEW=`PREVIEW`,e.WORKING_COPY=`WORKING_COPY`})(r||(e.EnvironmentType=r={}));var i;(function(e){e.FREE_V1=`FREE_V1`,e.BUILDER_V1=`BUILDER_V1`,e.BUSINESS_V1=`BUSINESS_V1`,e.CUSTOM=`CUSTOM`,e.EMPLOYEE=`EMPLOYEE`,e.CUSTOM_TRIAL_V1=`CUSTOM_TRIAL_V1`})(i||(e.PlanType=i={}));var a;(function(e){e.GITHUB=`GITHUB`,e.GITLAB=`GITLAB`,e.BITBUCKET=`BITBUCKET`})(a||(e.SourceControlProvider=a={}))})),DUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),OUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.INTERNAL_ROUTE_VENDOR_TAG=e.ZUPLO_OPEN_API_ROUTE_KEY=e.ZUPLO_OPEN_API_PATH_KEY=e.ZUPLO_OPEN_API_VENDOR_PREFIX=void 0,e.ZUPLO_OPEN_API_VENDOR_PREFIX=`x-zuplo`,e.ZUPLO_OPEN_API_PATH_KEY=`${e.ZUPLO_OPEN_API_VENDOR_PREFIX}-path`,e.ZUPLO_OPEN_API_ROUTE_KEY=`${e.ZUPLO_OPEN_API_VENDOR_PREFIX}-route`,e.INTERNAL_ROUTE_VENDOR_TAG=`x-internal`})),kUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.processJsonErrorObject=void 0;var t={'must match pattern "^[0-9a-z-]+$"':`Value must be alphanumeric or dash '-' only`,'must match pattern "^\\$import\\([^ )]*?\\)$"':`Value must be of form '$import(./path/to/module)`},n={'must match pattern "^[0-9a-z-]+$"':`Make sure the value uses only lowercase letters, numbers and dashes ('-').`,'must match pattern "^\\$import\\([^ )]*?\\)$"':`Value must be of form '$import(./path/to/module)`},r=e=>e.replace(`/`,``).replaceAll(`/`,` → `).replaceAll(`~1`,`/`),i={paths:`paths`};function a(e,a){let o=e.message,s=e.details?.property??``,c=e.details?.index??0,l=e.details?.field,u=e.details?.fieldValue,d=e.keyword,f=e.params,p=e.propertyName,m=r(e.instancePath),h=t[o]??o,g,_;if(d===`unevaluatedProperties`)g=`Unrecognized property '${f.unevaluatedProperty}'${l?` detected in '${l}'`:``} within '${a}'. Property location: ${m}.`;else if(d===`additionalProperties`)g=`Unrecognized property '${f.additionalProperty}'${l?` detected in '${l}'`:``} within '${a}'. Property location: ${m}.`;else if(d===`enum`)g=`Unrecognized value${u?` '${u}'`:``} for '${l}' detected in '${a}'. Value ${h}. Property location: ${m}.`;else if(d===`pattern`){let e=f.pattern;g=p?`Property name '${p}' does not match pattern ${e} in '${a}'. Property location: ${m}.`:`Invalid value '${u}' for field '${l}' in '${a}'. Value does not match pattern ${e}. Property location: ${m}.`}else d===`propertyNames`?g=`Invalid property name '${f.propertyName}' for property '${s}' detected in '${a}'. Property location: ${m}.`:d===`required`?g=`Missing required property '${f.missingProperty}' in '${a}'. Property location: ${m}.`:l&&s?(g=`Property ${i[s]} entry at position ${c+1} in '${a}' has invalid ${l} with value '${e.details?.fieldValue}' (${h})`,_={field:l,fieldValue:e.details?.fieldValue??``,property:s,instancePath:m,suggestion:n[o]??``}):g=s?`The ${i[s]} entry at position ${c+1} in '${a}' is invalid (${h})`:`The '${a}' configuration is invalid (${h})`;return{property:s,entry:{message:g,index:c,field:l,details:_}}}e.processJsonErrorObject=a})),AUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.startsWithReservedKeyword=void 0;var t=[`settings`,`user`,`manage`,`profile`,`login`,`logout`,`admin`,`system`,`account`,`accounts`,`home`,`dashboard`];function n(e){return t.filter(t=>e.startsWith(t)).length>0}e.startsWithReservedKeyword=n})),jUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isValidProjectName=e.MAX_PRETTY_BRANCH_LENGTH=e.MAX_HASH_LENGTH=void 0;var t=AUt();e.MAX_HASH_LENGTH=7,e.MAX_PRETTY_BRANCH_LENGTH=10;var n=40;function r(e){let r={isValid:!0};return e.length===0?(r.isValid=!1,r.errorMessage=`Project name cannot be empty`,r):(0,t.startsWithReservedKeyword)(e)?(r.isValid=!1,r.errorMessage=`Project name can not start with a reserved keyword`,r):/[\s]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name can't contain spaces`,r):/[A-Z]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should be in lowercase`,r):/^[^a-z]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should start with a letter`,r):/[^a-z0-9]$/.test(e)?(r.isValid=!1,r.errorMessage=`Project name should end with a letter or number`,r):/[^a-z0-9\\-]/.test(e)?(r.isValid=!1,r.errorMessage=`Project name only can contain letter, numbers and dashes`,r):(e.length>n&&(r.isValid=!1,r.errorMessage=`Project name cannot exceed ${n} characters because it needs to be part of the URL subdomain. Your chosen name is ${e.length-n} over.`),r)}e.isValidProjectName=r})),MUt=i({$defs:()=>L8,$id:()=>N8,$schema:()=>M8,additionalProperties:()=>!1,default:()=>NUt,description:()=>``,properties:()=>R8,required:()=>I8,title:()=>P8,type:()=>F8}),M8,N8,P8,F8,I8,L8,R8,NUt,PUt=n((()=>{M8=`https://json-schema.org/draft/2020-12/schema`,N8=`http://schemas.zuplo.com/route.json`,P8=`Route Config File`,F8=`object`,I8=[`routes`,`versions`],L8={corsPolicy:{type:`string`,pattern:`^[0-9a-z-]+$`},httpMethod:{type:`string`,enum:[`GET`,`HEAD`,`POST`,`PUT`,`DELETE`,`CONNECT`,`OPTIONS`,`TRACE`,`PATCH`]},handlerDefinition:{type:`object`,properties:{module:{type:`string`,pattern:`^\\$import\\([^ )]*?\\)$`},export:{type:`string`},options:{type:`object`,additionalProperties:!0}},additionalProperties:!1,required:[`module`,`export`]},schema:{$comment:`https://spec.openapis.org/oas/v3.1.0#schema-object`,type:[`object`,`boolean`]},parameterBaseObject:{$comment:`https://spec.openapis.org/oas/v3.1.0#schema-object`,type:`object`,properties:{description:{type:`string`},required:{default:!1,type:`boolean`},deprecated:{default:!1,type:`boolean`},schema:{$ref:`#/$defs/schema`}},required:[`schema`]},parameterDefinition:{$comment:`https://spec.openapis.org/oas/v3.1.0#parameter-object`,allOf:[{$ref:`#/$defs/parameterBaseObject`}],type:`object`,properties:{name:{type:`string`},in:{type:`string`,enum:[`query`,`header`,`path`,`cookie`]}},required:[`name`,`in`,`schema`],if:{type:`object`,properties:{in:{const:`query`}},required:[`in`]},then:{type:`object`,properties:{allowEmptyValue:{default:!1,type:`boolean`}}}},"media-type":{$comment:`https://spec.openapis.org/oas/v3.1.0#media-type-object`,type:`object`,properties:{schema:{$ref:`#/$defs/schema`}},unevaluatedProperties:!1},content:{$comment:`https://spec.openapis.org/oas/v3.1.0#fixed-fields-10`,type:`object`,additionalProperties:{$ref:`#/$defs/media-type`},propertyNames:{enum:[`application/json`,`application/problem+json`]}},header:{$comment:`https://spec.openapis.org/oas/v3.1.0#header-object`,allOf:[{$ref:`#/$defs/parameterBaseObject`}],type:`object`,required:[`schema`]},response:{$comment:`https://spec.openapis.org/oas/v3.1.0#response-object`,type:`object`,properties:{description:{type:`string`},headers:{type:`object`,additionalProperties:{$ref:`#/$defs/header`}},content:{$ref:`#/$defs/content`}},required:[`description`],unevaluatedProperties:!1},responsesDefinition:{$comment:`https://spec.openapis.org/oas/v3.1.0#responses-object`,type:`object`,properties:{default:{$ref:`#/$defs/response`}},patternProperties:{"^[1-5](?:[0-9]{2}|XX)$":{$ref:`#/$defs/response`}},minProperties:1,unevaluatedProperties:!1},tag:{$comment:`https://spec.openapis.org/oas/v3.1.0#tag-object`,type:`object`,properties:{name:{type:`string`},description:{type:`string`}},required:[`name`],unevaluatedProperties:!1},info:{type:`object`,required:[`title`,`version`],properties:{title:{type:`string`},summary:{type:`string`},description:{type:`string`},termsOfService:{type:`string`,format:`uri`},version:{type:`string`}}},versionData:{type:`object`,required:[`name`,`pathPrefix`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},pathPrefix:{type:`string`,pattern:`(^$|^/[^\\s]*$)`},info:{$ref:`#/$defs/info`},openApiFile:{description:`The project relative path to the OpenAPI spec.`,type:`string`},tags:{type:`array`,items:{$ref:`#/$defs/tag`}},excludeFromOpenApi:{type:`boolean`,description:`If false, OpenAPI documentation will not be generated for this version. If openApiFile is set this setting is ignored.`},enforceOpenApi:{type:`boolean`,description:`If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.`}}},routeConfiguration:{type:`object`,required:[`path`,`methods`,`handler`,`version`],additionalProperties:!1,properties:{operationId:{type:`string`},path:{type:`string`,pattern:`^/[^\\s]*$`},methods:{type:`array`,items:{$ref:`#/$defs/httpMethod`}},label:{type:`string`,description:`An internal user-friendly identifier of the route.`},enforceOpenApi:{type:`boolean`,description:`If true, schema validation found in the OpenAPI spec will be enforced on requests/responses.`},key:{type:`string`,deprecated:!0},handler:{$ref:`#/$defs/handlerDefinition`},corsPolicy:{$ref:`#/$defs/corsPolicy`},custom:{},version:{type:`string`,pattern:`^[0-9a-z-]+$`},policies:{type:`object`,additionalProperties:!1,properties:{inbound:{type:`array`,items:{type:`string`,pattern:`^[0-9a-z-]+$`}},outbound:{type:`array`,items:{type:`string`,pattern:`^[0-9a-z-]+$`}}}},summary:{type:`string`},description:{type:`string`},parameters:{type:`array`,items:{$ref:`#/$defs/parameterDefinition`}},excludeFromOpenApi:{type:`boolean`},responses:{$ref:`#/$defs/responsesDefinition`},tags:{type:`array`,items:{type:`string`}}}},policyConfiguration:{type:`object`,required:[`name`,`policyType`,`handler`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},policyType:{type:`string`},handler:{$ref:`#/$defs/handlerDefinition`},options:{type:`object`,additionalProperties:!0}}},corsPolicyConfiguration:{type:`object`,required:[`name`,`allowedOrigins`],additionalProperties:!1,properties:{name:{type:`string`,pattern:`^[0-9a-z-]+$`},allowCredentials:{type:`boolean`},maxAge:{type:`number`},allowedOrigins:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]},allowedMethods:{oneOf:[{type:`array`,items:{$ref:`#/$defs/httpMethod`}},{type:`string`}]},allowedHeaders:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]},exposeHeaders:{oneOf:[{type:`array`,items:{type:`string`}},{type:`string`}]}}}},R8={$schema:{type:`string`},info:{$ref:`#/$defs/info`,deprecated:!0},versions:{type:`array`,minItems:1,items:{$ref:`#/$defs/versionData`}},routes:{type:`array`,minItems:0,items:{$ref:`#/$defs/routeConfiguration`}},policies:{type:`array`,items:{$ref:`#/$defs/policyConfiguration`}},corsPolicies:{type:`array`,items:{$ref:`#/$defs/corsPolicyConfiguration`}},requestErrorHandler:{$ref:`#/$defs/handlerDefinition`}},NUt={$schema:M8,$id:N8,title:P8,description:``,type:F8,additionalProperties:!1,required:I8,$defs:L8,properties:R8}})),FUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(e,t){return{validate:e,compare:t}}e.fullFormats={date:t(a,o),time:t(c,l),"date-time":t(d,f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:h,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:w,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:_,int32:{type:`number`,validate:b},int64:{type:`number`,validate:x},float:{type:`number`,validate:S},double:{type:`number`,validate:S},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,o),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function n(e){return e%4==0&&(e%100!=0||e%400==0)}var r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31];function a(e){let t=r.exec(e);if(!t)return!1;let a=+t[1],o=+t[2],s=+t[3];return o>=1&&o<=12&&s>=1&&s<=(o===2&&n(a)?29:i[o])}function o(e,t){if(e&&t)return e>t?1:e<t?-1:0}var s=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;function c(e,t){let n=s.exec(e);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=n[5];return(r<=23&&i<=59&&a<=59||r===23&&i===59&&a===60)&&(!t||o!==``)}function l(e,t){if(!(e&&t))return;let n=s.exec(e),r=s.exec(t);if(n&&r)return e=n[1]+n[2]+n[3]+(n[4]||``),t=r[1]+r[2]+r[3]+(r[4]||``),e>t?1:e<t?-1:0}var u=/t|\s/i;function d(e){let t=e.split(u);return t.length===2&&a(t[0])&&c(t[1],!0)}function f(e,t){if(!(e&&t))return;let[n,r]=e.split(u),[i,a]=t.split(u),s=o(n,i);if(s!==void 0)return s||l(r,a)}var p=/\/|:/,m=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function h(e){return p.test(e)&&m.test(e)}var g=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function _(e){return g.lastIndex=0,g.test(e)}var v=-(2**31),y=2**31-1;function b(e){return Number.isInteger(e)&&e<=y&&e>=v}function x(e){return Number.isInteger(e)}function S(){return!0}var C=/[^\\]\\Z/;function w(e){if(C.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),z8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),IUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=z8(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r=e.UsedValueState||={}),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),B8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=z8(),n=IUt(),r=z8();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=IUt();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=k(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=k(this.rhs,e,n),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=k(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(A(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>D(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(j(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=k(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&D(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=k(this.iteration,e,t),this}get names(){return D(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return O(O(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=k(this.iterable,e,t),this}get names(){return D(super.names,this.iterable.names)}},S=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};S.kind=`func`;var C=class extends p{render(e){return`return `+super.render(e)}};C.kind=`return`;var w=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&D(e,this.catch.names),this.finally&&D(e,this.finally.names),e}},T=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};T.kind=`catch`;var E=class extends m{render(e){return`finally`+super.render(e)}};E.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
1570
1570
  `:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new C;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(C)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new w;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new T(e),t(e)}return n&&(this._currNode=r.finally=new E,this.code(n)),this._endBlockNode(T,E)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new S(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(S)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function D(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function O(e,n){return n instanceof t._CodeOrName?D(e,n.names):e}function k(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function A(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function j(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${L(e)}`}e.not=j;var M=I(e.operators.AND);function N(...e){return e.reduce(M)}e.and=N;var P=I(e.operators.OR);function F(...e){return e.reduce(P)}e.or=F;function I(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${L(n)} ${e} ${L(r)}`}function L(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),V8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=B8(),n=z8();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y=e.Type||={});function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),H8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=B8();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),U8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=B8(),n=V8(),r=H8();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),LUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=U8(),n=B8(),r=H8(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),RUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),zUt=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),W8=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=RUt(),n=zUt(),r=U8(),i=B8(),a=V8(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o=e.DataType||={});function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
1571
1571
  || (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
1572
1572
  || (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
@@ -1577,7 +1577,7 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
1577
1577
  git clone ${i.sourceRepoUrl}
1578
1578
  cd ${i.sourceRepoUrl.split(`/`).pop()}
1579
1579
  npm install
1580
- npm run dev`.trim()})]})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,onClick:()=>t(!1),children:`Later`}),(0,U.jsx)(Y,{ref:o,onClick:()=>{s(`working-copy-create-clicked`,{account:r.name,project:i.name}),l.mutate({accountName:r.name,projectName:i.name})},children:(0,U.jsx)(aP,{loading:l.isPending,alternative:(0,U.jsx)(sP,{className:`w-4 h-4 border-2 border-white`}),children:`Create working copy`})})]})]})})},$Gt=()=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-amber-200 bg-amber-100 px-4 py-1.5 text-sm text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-200`,"data-test":`read-only-banner`,children:[(0,U.jsx)(tKt,{className:`min-w-0 flex-1`}),(0,U.jsx)(eKt,{className:`ml-auto shrink-0`})]}),eKt=({switchLabel:e,className:t,onActionClick:n})=>{let{project:r}=fm([`project`]);return VD(r)?(0,U.jsx)(JGt,{className:t,onOpenClick:n}):(0,U.jsx)(nKt,{label:e,className:t,onSwitchClick:n})},tKt=({className:e})=>{let t=fm(),n=t.environment.branchName??null,r=IP(t.environment.environmentType,FP.PRODUCTION),i=VD(t.project);return(0,U.jsxs)(`span`,{className:W(`flex items-center gap-x-2 text-xs`,e),"data-test":`read-only-hint`,children:[(0,U.jsx)(yp,{size:14,className:`shrink-0`,"aria-hidden":!0}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Read-only`}),` — you are viewing`,` `,n?(0,U.jsxs)(U.Fragment,{children:[`the `,(0,U.jsx)(`span`,{className:`font-medium`,children:n}),` branch`]}):r?`the deployed Production environment`:`a deployed environment`,`.`,` `,i?`To make changes, set up local development.`:`To make changes, switch to Development.`]})]})},nKt=({label:e=`Switch to Development`,variant:t=`outline`,size:n=`sm`,className:r,onSwitchClick:i})=>{let a=fm(),o=y7(),{logEvent:s}=S(),c=ZGt(),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),p=iF(a.account.name,a.project.name).data?.find(e=>IP(e.environmentType,FP.WORKING_COPY)),m=a.environment.branchName??null,h=!!(a.project.sourceRepoUrl&&m&&a.project.hasCurrentUserWorkingCopy&&p),g=c||a.project.hasCurrentUserWorkingCopy,_=c||!!p;return g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Y,{size:n,variant:t,className:r,onClick:()=>{if(i?.(),s(`read-only-banner-switch-to-development-clicked`,{account:a.account.name,project:a.project.name,environment:a.environment.name,action:c?`setup-working-copy`:h?`checkout-dialog`:`navigate`}),c){f(!0);return}if(h){u(!0);return}p&&o({environment:p})},disabled:!_,"data-test":`read-only-switch-to-development`,children:[(0,U.jsx)(Ky,{size:14}),e]}),(0,U.jsx)(QGt,{open:d,onOpenChange:f}),h&&m&&p&&(0,U.jsx)(rKt,{open:l,onOpenChange:u,branchName:m,workingCopyEnvironment:p})]}):null},rKt=({open:e,onOpenChange:t,branchName:n,workingCopyEnvironment:r})=>{let i=fm(),a=um(),o=y7(),{logEvent:s}=S(),c=dyt(),{data:l,isLoading:u}=nst(r.name,{enabled:e}),d=XGt(l,i.project.defaultBranch,!1,`Checking out`),f=d?.hasLocalWork??!1,p=()=>{s(`read-only-banner-keep-working-copy-clicked`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n}),t(!1),o({environment:r})},m=uyt({onSuccess:()=>{c(i.account.name,i.project.name),t(!1),a.success(`Checked out ${n} in your working copy`,{title:`Success`,icon:(0,U.jsx)($f,{className:`h-4 w-4`})}),o({environment:r})}});return(0,U.jsx)(Jw,{open:e,onOpenChange:e=>{m.isPending||t(e)},children:(0,U.jsxs)(Zw,{"data-test":`checkout-branch-dialog`,children:[(0,U.jsx)(Qw,{children:(0,U.jsx)(eT,{children:`Switch to Development`})}),(0,U.jsxs)(tT,{children:[`Development is your editable working copy. Keep it as it is now, or check out the `,(0,U.jsx)(BT,{variant:`outline`,children:n}),` branch to replace your working copy's files with the latest version of this branch.`]}),d?.hasLocalWork&&(0,U.jsxs)(db,{variant:`warning`,"data-test":`checkout-working-copy-warning`,children:[(0,U.jsx)(Xp,{}),(0,U.jsx)(fb,{children:d.title}),(0,U.jsxs)(pb,{children:[d.detail,` Keep your working copy to switch with them intact.`]})]}),(0,U.jsx)(ak,{error:m.error}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,className:`sm:mr-auto`,onClick:()=>{s(`read-only-banner-switch-cancelled`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n}),t(!1)},disabled:m.isPending,"data-test":`checkout-branch-cancel`,children:`Cancel`}),(0,U.jsx)(Y,{variant:`outline`,onClick:p,disabled:m.isPending,"data-test":`checkout-branch-keep`,children:`Just switch`}),(0,U.jsx)(Y,{variant:f?`destructive`:`default`,disabled:m.isPending||u,onClick:()=>{s(`read-only-banner-checkout-branch-confirmed`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n,hasLocalWork:f}),m.mutate({accountName:i.account.name,projectName:i.project.name,branchName:n})},"data-test":`checkout-branch-confirm`,children:(0,U.jsx)(aP,{loading:m.isPending,children:`Checkout & switch`})})]})]})})},iKt=({item:e,isSelected:t,onSelect:n})=>{let r=new Date(e.createdOn),i=IPe(r)?`${RD(r,`H:mm:ss`)} Today`:FPe(r)?`${RD(r,`H:mm:ss ccc d, MMM`)}`:`${RD(r,`H:mm:ss ccc d`)} ${RD(r,`MMM yyy`)}`;return(0,U.jsxs)(`div`,{className:(0,nP.default)(`flex items-center gap-2 px-3 cursor-pointer h-10 border-border border-b`,{"bg-accent text-accent-foreground":t,"hover:bg-accent/50":!t}),onClick:()=>n(),children:[(0,U.jsx)(`div`,{className:`flex justify-center items-center w-5 shrink-0`,children:(0,U.jsx)($G,{deployment:e})}),(0,U.jsx)(`span`,{className:`w-full text-sm truncate`,children:i})]})},aKt={"in-progress":`Building`,success:`Finished`,failed:`Failed`,skipped:`Skipped`},oKt=({status:e})=>aKt[e],sKt={lint:`Lint`,build:`Build`,deploy:`Deploy`},cKt=({step:e})=>sKt[e]??e,x7=r(a(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function lKt({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}var uKt=lKt();function dKt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(uKt,``)}var fKt=({logs:e,children:t,className:n})=>(0,U.jsx)(`div`,{className:W(`grid grid-cols-[auto_1fr] auto-rows-min gap-x-5 py-4 text-xs h-full overflow-auto`,`bg-neutral-950 font-mono text-white`,n),children:t||(e.length>0?e.map(({timestamp:e,severity:t,message:n},r)=>(0,U.jsxs)(`div`,{className:W(`grid grid-cols-subgrid col-span-full px-4 py-1 hover:bg-neutral-800 text-neutral-200`,{"text-red-400":t===`error`,"text-yellow-400":t===`warn`,"text-green-500":/^\x1b\[32m/.test(n)}),children:[(0,U.jsx)(`div`,{className:`select-none`,children:(0,x7.default)(e).format(`HH:mm:ss.SSS`)}),(0,U.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:(0,U.jsx)(LPe,{text:dKt(n).trim()})})]},`${e}-${r}`)):(0,U.jsx)(`div`,{className:`text-neutral-300 italic px-4`,children:`No logs available`}))}),pKt=({stage:e,buildLogs:t,isLoading:n})=>(0,U.jsx)(`div`,{className:`divide-y divide-neutral-800`,children:[...e.steps??[]].sort((e,t)=>e.ordinal-t.ordinal).map(r=>{let i=mtt(t,e.stage,r.step),a=rK(i);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs font-medium bg-neutral-900 text-neutral-300`,children:[(0,U.jsx)(l1,{status:r.status}),(0,U.jsx)(cKt,{step:r.step}),a>0&&(0,U.jsxs)(BT,{variant:`warn`,children:[a,` warning`,a>1?`s`:``]})]}),(0,U.jsx)(fKt,{logs:i,children:n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,U.jsx)(fD,{className:`h-4 w-3/6 bg-white/20`}),(0,U.jsx)(fD,{className:`h-4 w-2/6 bg-white/20`})]})})]},r.id)})}),mKt=(e,t)=>e?t(e):void 0,hKt=({deployment:e,defaultOpen:t})=>{let{environment:n}=fm([`environment`]),r=Pit(n.name,e.id,{});return r.isPending?(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(fD,{className:`h-10 w-full`}),(0,U.jsx)(fD,{className:`h-10 w-full`})]}):r.isError?(0,U.jsx)(db,{variant:`warning`,children:(0,U.jsx)(pb,{className:`text-center`,children:(0,U.jsx)(`div`,{className:`text-neutral-600 text-lg`,children:r.error?r.error.status===401||r.error.status===403?`You don't have permission to view build logs for this deployment.`:r.error.status===404?`Deployment not found. The selected deployment may have been deleted or doesn't exist.`:r.error.status===500?`Server error occurred while loading build logs. Please try again or contact support if the problem persists.`:`Unable to load build logs. Please try again or contact support if the problem persists.`:`Could not load logs. Please try again or contact support if the problem persists.`})})}):(0,U.jsx)(ok,{className:`divide-y overflow-hidden`,children:e.stages.map((n,i)=>(0,U.jsx)(gKt,{stage:n,stageIndex:i,stageCount:e.stages.length,buildLogs:r.data,isLoading:r.isLoading,defaultOpen:t},n.id))})},gKt=({stage:e,stageIndex:t,stageCount:n,buildLogs:r,isLoading:i,defaultOpen:a})=>{let o=e.steps&&e.steps.length>0;return(0,U.jsxs)(GT,{defaultOpen:a,children:[(0,U.jsx)(KT,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 p-2 w-full hover:bg-accent cursor-pointer group`,children:[(0,U.jsx)(l1,{status:e.status}),(0,U.jsxs)(`div`,{className:`font-medium`,children:[(0,U.jsxs)(`span`,{className:`font-mono text-xs me-2`,children:[`(`,t+1,`/`,n,`)`]}),`Building `,(0,U.jsx)(cyt,{stage:e.stage})]}),(0,U.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,U.jsx)(oKt,{status:e.status})}),(0,U.jsx)(`div`,{className:`text-xs text-amber-400`,children:mKt(rK(iK(r,e.stage)),e=>(0,U.jsxs)(BT,{variant:`warn`,children:[e,` warning`,e>1?`s`:``]}))}),(0,U.jsx)(`div`,{className:`ms-2 flex items-center justify-center`,children:(0,U.jsx)(ep,{className:`w-4 h-4 transition-transform group-data-[state=closed]:-rotate-90`})})]})}),(0,U.jsx)(qT,{children:o?(0,U.jsx)(pKt,{stage:e,buildLogs:r,isLoading:i}):(0,U.jsx)(fKt,{logs:iK(r,e.stage),children:i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,U.jsx)(fD,{className:`h-4 w-3/6 bg-white/20`}),(0,U.jsx)(fD,{className:`h-4 w-2/6 bg-white/20`})]})})})]})},_Kt=({build:e})=>(0,U.jsx)(`div`,{className:`p-4 w-full`,children:(0,U.jsx)(hKt,{deployment:e,defaultOpen:!0})}),vKt=()=>{let[e,t]=CY(`build`),{environment:n}=fm([`account`,`project`,`environment`]),{data:r}=MGe(n.name),i=r?.data?.find(t=>t.id===e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JJ,{}),(0,U.jsxs)(qJ,{className:`min-h-36 shadow-[rgb(215_215_215/15%)_0px_-4px_3px_0px] dark:shadow-[rgb(0_0_0/40%)_0px_-4px_3px_0px]`,defaultSize:30,children:[(0,U.jsxs)(`div`,{className:`flex gap-2 border-b h-8 items-center justify-between group bg-surface-muted px-3`,children:[(0,U.jsx)(`div`,{className:`divide-neutral-200`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 group rounded-none relative text-xs font-medium`,title:e,children:[(0,U.jsx)(Uee,{size:16}),e?`Build ${e.slice(0,8)}`:`Builds`]})}),(0,U.jsx)(`div`,{className:`flex flex-row gap-2`,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(void 0),children:(0,U.jsx)($p,{size:18})})})]}),(0,U.jsxs)(`div`,{className:`h-[calc(100%-2rem)]`,children:[r?.data?.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-sm`,children:`Start changing your local copy to see build information.`}),(0,U.jsxs)(`div`,{className:`divide-x grid grid-cols-[min-content_1fr] w-full h-full`,children:[(0,U.jsx)(`div`,{className:`overflow-y-auto`,children:r?.data?.map(n=>(0,U.jsx)(iKt,{item:n,isSelected:n.id===e,onSelect:()=>t(n.id)},`${n.id}`))}),(0,U.jsx)(`div`,{className:`overflow-y-auto`,children:e&&i?(0,U.jsx)(_Kt,{build:i}):(0,U.jsx)(`div`,{className:`p-3 text-sm`,children:`Select a build to view more information.`})})]})]})]})]})},S7=`/modules`,C7=`/schemas`;function yKt({showReadOnlyBanner:e=!0}={}){let t=fm(),{editStrategies:n}=x6(),[r,i]=CY(`path`),[a]=CY(`build`),{monaco:o,reloadFiles:c}=v7(),l=bF(c.execute),u=t.environment.name,{isReadOnly:d}=JZ(),{isFileTreeOpen:f,setIsFileTreeOpen:p}=j8(),m=vm(e=>e.projectTreeNodes),[h,g]=Bl(),_=e=>{let t=new URLSearchParams(h);t.set(`path`,e),t.delete(`v`),t.delete(`line`),g(t)},v=`${t.account.name}/${t.project.name}/${t.environment.name}`,[y,b]=(0,H.useState)(!1),[x,S]=(0,H.useState)(v);x!==v&&(S(v),b(!1)),(0,H.useEffect)(()=>{if(y)return;if(r){b(!0);return}if(m.length===0)return;let e=m.find(e=>e.path&&bm.test(e.path));b(!0),e&&i(e.path)},[r,m,i,y]);let C=m.length===0,w=!r&&(C||!y),T=m.find(e=>e.path&&bm.test(e.path))?.path,E=r??``,D=[{label:`Routes`,testId:`sidebar-routes`,icon:(0,U.jsx)(Wmt,{className:`size-[18px]`}),isActive:bm.test(E),disabled:!T,onClick:()=>T&&_(T)},{label:`Policies`,testId:`sidebar-policies`,icon:(0,U.jsx)(Rp,{size:18}),isActive:E===`/config/policies.json`,disabled:!1,onClick:()=>_(`/config/policies.json`)},{label:`Modules`,testId:`sidebar-modules`,icon:(0,U.jsx)(wte,{size:18}),isActive:E===S7,disabled:!1,onClick:()=>_(S7)},{label:`Schemas`,testId:`sidebar-schemas`,icon:(0,U.jsx)(xp,{size:18}),isActive:E===C7,disabled:!1,onClick:()=>_(C7)}],{isError:O,error:A}=k({queryKey:[`reloadFiles`,t.account.name,t.project.name,t.environment.name],queryFn:async({signal:e})=>(await l.current({accountName:t.account.name,projectName:t.project.name,environmentName:t.environment.name},e),!0),refetchOnWindowFocus:!1,enabled:!!o&&!!u});if(O&&A instanceof s)return(0,U.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,U.jsxs)(db,{className:`max-w-md`,children:[(0,U.jsx)(fb,{children:A.title}),(0,U.jsxs)(pb,{className:`flex flex-col gap-2`,children:[zb(A),(0,U.jsx)(BGt,{})]})]})});let j=(0,U.jsxs)(KJ,{direction:`vertical`,autoSaveId:`bottom-pane`,className:`relative`,children:[(0,U.jsx)(qJ,{minSize:10,children:r?(0,U.jsx)(HY,{blastRadius:`feature-dead`,fallback:e=>(0,U.jsx)(Pyt,{...e}),children:(0,U.jsx)(bKt,{})}):w?(0,U.jsx)(xKt,{}):null}),a!==void 0&&(0,U.jsx)(vKt,{})]});return(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col`,children:[e&&d&&(0,U.jsx)($Gt,{}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[!f&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center bg-surface-sunken border-r shrink-0 w-12 py-2 gap-1`,children:[(0,U.jsx)(SKt,{label:`Expand file tree`,onClick:()=>p(!0),testId:`expand-file-tree`,children:(0,U.jsx)(Ete,{size:18})}),(0,U.jsx)(`div`,{className:`my-1 h-px w-6 bg-surface-emphasis`,"aria-hidden":!0}),D.map(e=>(0,U.jsx)(SKt,{label:e.label,onClick:e.onClick,testId:e.testId,isActive:e.isActive,disabled:e.disabled,children:e.icon},e.label)),(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`span`,{className:`text-[10px] font-medium text-neutral-500 uppercase tracking-wider select-none pb-1`,style:{writingMode:`vertical-rl`},children:`Files`})]}),f?(0,U.jsxs)(KJ,{direction:`horizontal`,autoSaveId:`file-tree`,className:`flex-1 min-w-0`,children:[(0,U.jsx)(qJ,{minSize:10,defaultSize:20,className:`bg-surface-sunken min-w-[270px]`,children:(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between h-10 px-2 border-b shrink-0`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-neutral-600 dark:text-neutral-400 uppercase tracking-wide pl-1`,children:`Files`}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>p(!1),"aria-label":`Collapse file tree`,title:`Collapse file tree`,children:(0,U.jsx)(Tte,{size:14})})]}),(0,U.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,U.jsx)(Myt,{directoryStrategies:n})})]})}),(0,U.jsx)(JJ,{}),(0,U.jsx)(qJ,{minSize:70,children:j})]}):(0,U.jsx)(`div`,{className:`flex-1 min-w-0`,children:j})]})]})}var bKt=()=>{let[e]=CY(`path`);if(!e)throw Error(`Invalid state - FileViewer should not be displayed if no path`);let t=e.toLowerCase();if(t===S7)return(0,U.jsx)(SUt,{});if(t===C7)return(0,U.jsx)(CUt,{});if(t===`/docs/sidebar.json`)return(0,U.jsx)(Ygt,{});if(t.includes(`.oas.json`))return(0,U.jsx)(bUt,{});if(t===`/config/policies.json`)return(0,U.jsx)(MGt,{});if(t.endsWith(`.md`)||t.endsWith(`.mdx`)){let e=t.split(`/`),n=e[e.length-1];return(0,U.jsx)(Jgt,{fileName:n})}return t.endsWith(`.ts`)||t.endsWith(`.css`)?(0,U.jsx)(bQ,{maxHeightVh:100}):t.startsWith(`/schemas`)&&t.endsWith(`.json`)?(0,U.jsx)(bQ,{}):t===`/config/dev-portal.json`?(0,U.jsxs)(`div`,{className:`size-full`,children:[(0,U.jsx)(`div`,{className:`p-4`,children:(0,U.jsx)(IGt,{})}),(0,U.jsx)(bQ,{})]}):(0,U.jsx)(bQ,{})},xKt=()=>(0,U.jsxs)(`div`,{className:`p-6 flex flex-col gap-2`,"data-test":`editor-loading`,children:[(0,U.jsx)(fD,{className:`w-40 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-28 h-4`}),(0,U.jsx)(fD,{className:`w-64 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`})]}),SKt=({label:e,onClick:t,testId:n,isActive:r=!1,disabled:i=!1,children:a})=>(0,U.jsx)($P,{content:e,side:`right`,children:(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,"aria-current":r?`page`:void 0,disabled:i,"data-test":n,className:W(`group flex items-center justify-center size-9 rounded-md transition-colors ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i?`text-neutral-300 dark:text-neutral-700 cursor-not-allowed`:`cursor-pointer`,!i&&(r?`bg-brand/10 text-brand`:`text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:bg-neutral-200 dark:hover:bg-neutral-800`)),children:a})});function CKt(){return(0,U.jsxs)(jpt,{children:[(0,U.jsx)(yKt,{}),(0,U.jsx)(Umt,{})]})}var wKt=`/static/img/hero-Ct8-h_EN.svg`,TKt=`/static/img/hero-dark-Z9HfvwEQ.svg`,EKt=[{label:`Monetization`,value:`monetization`,badge:`Beta`,items:[{title:`Monetization Overview`,description:`Learn more about our first-party metering and billing solution built directly into the Zuplo platform.`,icon:My,link:{href:{web:`https://zuplo.com/docs/articles/monetization/index`,local:`https://zuplo.com/docs/articles/monetization/index`},text:`Read the docs`}},{title:`Monetization Quickstart`,description:`Get up and running with API monetization in minutes using Zuplo's built-in billing and metering.`,icon:By,link:{href:{web:`https://zuplo.com/docs/articles/monetization/quickstart`,local:`https://zuplo.com/docs/articles/monetization/quickstart`},text:`Get Started`}},{title:`Pricing Models`,description:`Explore the different pricing models available for monetizing your APIs with Zuplo.`,icon:Ny,link:{href:{web:`https://zuplo.com/docs/articles/monetization/pricing-models`,local:`https://zuplo.com/docs/articles/monetization/pricing-models`},text:`Read the docs`}}]},{label:`MCP`,value:`mcp`,items:[{title:`Installing the MCP Inspector`,description:`Set up the MCP Inspector locally and start testing your MCP server with ease.`,icon:Fy,link:{href:{web:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`,local:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`},text:`Get Started`}},{title:`MCP Quickstart`,description:`Learn how to start using Model Context Protocol to pass context into any model call.`,icon:By,link:{href:{web:`https://zuplo.com/docs/articles/mcp-quickstart`,local:`https://zuplo.com/docs/articles/mcp-quickstart`},text:`Get Started`}},{title:`Using OAuth with MCP`,description:`Authenticate users securely by integrating OAuth flows into your Model Context Protocol setup.`,icon:zy,link:{href:{web:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`,local:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`},text:`Get Started`}}]},{label:`Rate Limiting`,value:`rate-limiting`,items:[{title:`Adding Rate Limiting`,description:`Control traffic and protect your APIs by setting up flexible, customizable rate limits.`,icon:Ny,link:{href:{web:`https://zuplo.com/docs/articles/step-2-add-rate-limiting`,local:`https://zuplo.com/docs/articles/step-2-add-rate-limiting-local`},text:`Get Started`}},{title:`Complex Rate Limiting`,description:`Implement advanced rules to rate limit by user, IP, plan, or custom logic.`,icon:Py,link:{href:{web:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`,local:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`},text:`Get Started`}},{title:`Dynamic Rate Limits`,description:`Set rate limits that adapt in real-time based on headers, tokens, or user context.`,icon:fge,link:{href:{web:`https://zuplo.com/examples/dynamic-rate-limits`,local:`https://zuplo.com/examples/dynamic-rate-limits`},text:`Get Started`}}]},{label:`Authentication`,value:`authentication`,items:[{title:`Using API Keys`,description:`Authenticate and manage access to your APIs with simple, secure API key workflows.`,icon:_ge,link:{href:{web:`https://zuplo.com/docs/policies/api-key-inbound`,local:`https://zuplo.com/docs/policies/api-key-inbound`},text:`Get Started`}},{title:`Using Auth0`,description:`Connect your APIs to Auth0 for streamlined authentication and powerful identity management.`,icon:Wy,link:{href:{web:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`},text:`Get Started`}},{title:`Using Okta`,description:`Integrate Okta with your APIs to enable secure, enterprise-grade authentication and authorization.`,icon:Iy,link:{href:{web:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`},text:`Get Started`}}]},{label:`Dev Portal`,value:`dev-portal`,items:[{title:`Setup your API Reference`,description:`Instantly generate an interactive reference by importing your OpenAPI spec—no manual work needed.`,icon:vhe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`},text:`Get Started`}},{title:`Adding Authentication`,description:`Guide users through secure API access by adding auth flows to your developer portal.`,icon:Vy,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`},text:`Get Started`}},{title:`Creating API Catalogs`,description:`Organize your APIs into searchable, user-friendly catalogs for easier discovery and onboarding.`,icon:My,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`,local:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`},text:`Get Started`}}]}],DKt=({mode:e=`web`})=>(0,U.jsxs)(Gk,{defaultValue:`monetization`,className:`flex flex-col my-8`,children:[(0,U.jsx)(Kk,{className:`flex gap-8 border-b border-surface-border mb-8 ml-1`,children:EKt.map(e=>(0,U.jsxs)(qk,{value:e.value,className:`relative py-2 text-sm font-medium text-gray-600 dark:text-neutral-400 hover:text-gray-900 dark:hover:text-neutral-100 data-[state=active]:text-gray-900 dark:data-[state=active]:text-neutral-100 border-b-2 border-transparent data-[state=active]:border-black dark:data-[state=active]:border-white transition-colors`,children:[e.label,`badge`in e&&e.badge&&(0,U.jsx)(BT,{variant:`invert`,className:`ml-2`,children:e.badge})]},e.value))}),EKt.map(t=>(0,U.jsx)(Jk,{value:t.value,className:`grid grid-cols-3 gap-4`,children:t.items.map(t=>(0,U.jsxs)(ok,{className:`flex flex-col gap-2 text-muted-foreground`,children:[(0,U.jsxs)(sk,{className:`flex gap-2`,children:[(0,U.jsx)(t.icon,{size:24,weight:`duotone`,className:`[&_[opacity='0.2']]:fill-pink-500`}),(0,U.jsx)(ck,{className:`gap-x-2 text-lg font-semibold`,children:t.title})]}),(0,U.jsx)(uk,{children:t.description}),(0,U.jsx)(dk,{className:`flex-1 items-end! border-0 mb-4`,children:(0,U.jsx)(Y,{variant:`outline`,className:`w-full`,asChild:!0,children:(0,U.jsx)(JT,{href:t.link.href[e],variant:`ghost`,children:t.link.text})})})]},t.title))},t.value))]}),OKt=({title:e,url:t,className:n})=>{let{copyToClipboard:r,state:i}=Mw(t??``);return(0,U.jsxs)(ok,{className:W(`col-span-full md:col-span-5 py-2 px-4 flex items-center text-sm gap-x-2`,n),children:[(0,U.jsx)(`div`,{className:`bg-green-600 rounded-full w-4 h-4 p-0.5`,children:(0,U.jsx)($f,{className:`text-white`,size:12})}),(0,U.jsx)(`span`,{className:`font-semibold`,children:e}),(0,U.jsx)(`div`,{className:`flex-1`,children:t?(0,U.jsx)(JT,{href:t,className:`ml-2 font-medium line-clamp-1 break-all`,children:t}):(0,U.jsx)(fD,{className:`ml-2 h-4 w-8/12`})}),(0,U.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:r,children:(0,U.jsxs)(aP,{loading:i===`copied`,alternative:(0,U.jsx)($f,{size:12,className:`text-green-600`,strokeWidth:3}),className:`flex`,children:[(0,U.jsx)(mp,{size:16,className:`mr-2`,strokeWidth:1.5}),`Copy URL`]})})]})},kKt=({size:e=24,...t})=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,fill:`none`,viewBox:`0 0 16 16`,...t,children:(0,U.jsx)(`path`,{fill:`currentColor`,d:`m7.47 12.412 3.348-.592.031-.007-1.722-2.049a291.474 291.474 0 0 1-1.723-2.058c0-.01 1.779-4.909 1.789-4.926a788.95 788.95 0 0 1 2.934 5.066l2.95 5.115.023.039-10.948-.001 3.317-.587zM.9 11.788c0-.003.811-1.412 1.803-3.131L4.507 5.53l2.102-1.764C7.765 2.797 8.714 2 8.717 2a.37.37 0 0 1-.033.085L6.4 6.981l-2.24 4.808-1.63.002c-.897.001-1.63 0-1.63-.003z`})}),AKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{d:`M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z`})}),jKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.606 9.606 0 0112 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48C19.137 20.107 22 16.373 22 11.969 22 6.463 17.522 2 12 2z`})}),MKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z`})});function w7({providerName:e,className:t,size:n=24}){switch(e?.toLowerCase()){case`gitlab`:return(0,U.jsx)(MKt,{className:t,size:n});case`bitbucket`:return(0,U.jsx)(AKt,{className:t,size:n});case`azure`:return(0,U.jsx)(kKt,{className:t,size:n});default:return(0,U.jsx)(jKt,{className:t,size:n})}}var NKt=({onSuccess:e}={})=>{let t=bt(),{logEvent:n,captureException:r}=S();return Oe({mutationFn:async e=>(await t.fetch(ae.accounts.createCustomDomain({accountName:e.accountName,isAlias:e.isAlias,projectName:e.projectName,hostname:e.hostname,deploymentName:e.deploymentName,stage:e.stage}))).json(),onSuccess:(t,r)=>{n(`account-custom-domain-creation-success`,{account:r.accountName}),e?.(t)},onError:e=>{n(`account-custom-domain-creation-failed`),r(e)}})},PKt=()=>{let e=bt();return Oe({mutationFn:async t=>{await e.fetch(ae.accounts.editCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},FKt=()=>{let e=bt();return Oe({mutationFn:async t=>{await e.fetch(ae.accounts.deleteCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},IKt=(e,t)=>Nb(je.customDomains(e,t),{extractData:!0}),LKt=(0,H.forwardRef)(({icon:e,label:t,count:n,expanded:r,onToggle:i,children:a},o)=>(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-surface-border bg-surface shadow-xs`,children:[(0,U.jsxs)(`button`,{ref:o,type:`button`,onClick:i,"aria-expanded":r,className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-sm transition hover:bg-gray-50 dark:hover:bg-neutral-800`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-gray-800 dark:text-neutral-200`,children:[(0,U.jsx)(e,{size:14,className:`text-gray-500 dark:text-neutral-400`,strokeWidth:2}),t]}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(BT,{variant:`secondary`,size:`sm`,className:`px-1.5 font-mono`,children:n??0}),r?(0,U.jsx)(np,{size:14,className:`text-gray-500 dark:text-neutral-400`}):(0,U.jsx)(ep,{size:14,className:`text-gray-400 dark:text-neutral-500`})]})]}),r?(0,U.jsx)(`div`,{className:`border-t border-gray-100 dark:border-neutral-800`,children:a}):null]}));LKt.displayName=`ExpandableNode`;var RKt=({selected:e,onChange:t,options:n,listLabel:r,className:i,classNameOptions:a,testId:o,placeholder:s,disabled:c,isLoadingData:l=!1})=>{let u=(0,H.useId)(),d=n.filter(e=>String(e.value)!==``);return(0,U.jsxs)(_Y,{value:e?String(e.value):``,onValueChange:e=>{let n=d.find(t=>String(t.value)===e);n&&t(n)},disabled:c,children:[r?(0,U.jsx)(`span`,{id:u,className:`mb-1 block text-sm font-medium text-foreground`,children:r}):null,(0,U.jsx)(yY,{"data-test":o,className:W(`w-full`,i),"aria-labelledby":r?u:void 0,"aria-label":r?void 0:s,children:l&&e?.icon?(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(sP,{className:`h-4 w-4`,borderPositionAndSize:`border-l-2`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label})]}):(0,U.jsx)(vY,{placeholder:s})}),(0,U.jsx)(bY,{align:`start`,className:W(`max-h-72`,a),children:d.map((e,t)=>(0,U.jsx)(xY,{"data-test":`${o}-${t}`,value:String(e.value),disabled:e.disabled??!1,description:e.description,children:e.icon?(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]}):e.label},`${t}-${e.value}`))})]})};function zKt(e,t=500){let[n,r]=(0,H.useState)(e);return(0,H.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>{clearTimeout(n)}},[e,t]),n}var BKt=({projects:e,isLoadingProjects:t,selectedProject:n,onProjectChange:r})=>(0,U.jsx)(RKt,{testId:`project-selector`,placeholder:`Select Project`,options:(e||[]).map(e=>({label:e.name,value:e.id,icon:(0,U.jsx)(Cp,{className:`mr-1.5`,size:16})})),selected:n,onChange:r,className:`flex-1 items-center w-full h-9`,isLoadingData:t});function VKt({title:e,className:t}){return(0,U.jsx)(`div`,{className:W(`text-2xl font-medium`,t),children:e})}var HKt=({showHeader:e})=>(0,U.jsxs)(U.Fragment,{children:[e&&(0,U.jsx)(VKt,{title:`Source Control Settings`}),(0,U.jsxs)(`div`,{className:`w-full sm:max-w-md md:max-w-2xl lg:max-w-5xl animate-pulse`,children:[e&&(0,U.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`}),(0,U.jsxs)(`div`,{className:`flex flex-col md:flex-row lg:flex-row sm:gap-4`,children:[(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs right-0 h-10 bg-gray-200 rounded-md dark:bg-gray-700`})]}),(0,U.jsx)(`div`,{className:`h-5 mt-5 mb-3`,children:(0,U.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`})}),(0,U.jsx)(`div`,{className:`mt-5 h-96 relative bg-gray-200 rounded-md dark:bg-gray-700`})]})]}),T7=`GITLAB`,E7=`GITHUB`,D7=`BITBUCKET`,O7=`AZURE`,UKt=({installUrl:e,selectedOrg:t,projectName:n,className:r,provider:i=E7,disabled:a,repoDescription:o=`Zuplo API Gateway`,onContinue:s})=>{let{logEvent:c}=S(),[l,u]=(0,H.useState)(!1),d=e=>{c(`source-control-create-repo-continue-clicked`,{sourceControlNamespace:e??`none`,sourceControlProvider:i,project:n}),s?.();let t;switch(i){case O7:t=e?`https://dev.azure.com/${e}/_createproject`:`https://dev.azure.com/`;break;case T7:t=e?`https://gitlab.com/projects/new?namespace_id=${e}`:`https://gitlab.com/projects/new`;break;case D7:t=e?`https://bitbucket.org/repo/create?owner=${e}`:`https://bitbucket.org/repo/create`;break;default:{let r=encodeURIComponent(o);t=e===null?`https://github.com/new?name=${n}&description=${r}`:`https://github.com/organizations/${e}/repositories/new?owner=${e}&name=${n}&description=${r}`;break}}window.open(t),u(!1)};return(0,U.jsxs)(Jw,{open:l,onOpenChange:u,children:[(0,U.jsx)(Yw,{asChild:!0,children:(0,U.jsx)(Y,{className:r,disabled:a,children:`Create new repository`})}),(0,U.jsxs)(Zw,{className:`max-w-xl! w-full`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Create new repository`}),(0,U.jsx)(tT,{})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`We're about to help you create a new repository in`,` `,Rb(i),`.`]}),(0,U.jsxs)(`div`,{className:`rounded-md bg-muted/50 p-3 text-sm space-y-2 border`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`What you'll need to do:`}),i===`AZURE`&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsx)(`li`,{children:`Create a project and repository in Azure DevOps`}),(0,U.jsx)(`li`,{children:`Return to Zuplo to connect it`})]}),i===`GITHUB`&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsx)(`li`,{children:`Create your new repository on GitHub`}),(0,U.jsxs)(`li`,{children:[`Ensure the`,` `,(0,U.jsx)(JT,{href:e,children:`Zuplo GitHub App`}),` `,`has access to your new repo`]}),(0,U.jsx)(`li`,{children:`Return to Zuplo to see and connect it`})]}),(i===`GITLAB`||i===`BITBUCKET`)&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsxs)(`li`,{children:[`Create your repository in `,Rb(i)]}),(0,U.jsx)(`li`,{children:`Return to Zuplo to connect it`})]})]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need help?`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/source-control`,children:`View our troubleshooting guide`})]})]}),(0,U.jsx)($w,{children:(0,U.jsxs)(Y,{"data-test":`navigate-new-${i.toLowerCase()}-repo`,onClick:()=>d(t),children:[`Continue to `,Rb(i)]})})]})]})},WKt=e=>e instanceof s&&e.type===`https://zup.fail/github-integration-monorepo-detected`,GKt=`The GitHub integration connects a repository with a single Zuplo project at its root, so it can't connect this repository. You can still deploy it using the Zuplo CLI in your CI/CD pipeline.`,k7={linkAnyway:{title:`Link existing Zuplo project`,description:`Looks like Zuplo was set up here before, so we'll link your project to the existing repository instead of pushing a new one. Nothing is pushed or pulled automatically; you can commit and push from the portal whenever you're ready.`,actionLabel:`Link project`},monorepo:{title:`This looks like a monorepo`,description:GKt,actionLabel:`Manual setup`},nonEmpty:{title:`This repository isn't empty`,description:GKt,actionLabel:`Manual setup`},pullRequestOpened:{title:`We opened a pull request`,description:`Your default branch requires changes to go through a pull request, so we pushed your project to a setup branch and opened one. Merge the pull request to finish setup and land your project on the default branch.`,actionLabel:`Open pull request`}},A7=`https://zuplo.com/docs/articles/monorepo-deployment`,KKt=new Set([`https://zup.fail/github-integration-invalid-repo`,`https://zup.fail/github-integration-package-json-missing-repo`,`https://zup.fail/create-project-invalid-git-repo`,`https://zup.fail/azure-integration-invalid-repo`]),qKt=e=>WKt(e)?`monorepo`:e instanceof s&&typeof e.type==`string`&&KKt.has(e.type)?`invalidRepo`:`other`,JKt=({accountName:e,projectName:t,orgName:n,repositoryUrl:r,provider:i,handleErrors:a})=>{let{logEvent:o,captureException:s}=S(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),f=aAe(e,t),p={account:e,project:t,sourceControlNamespace:n},m=async(e,t,n)=>{try{if(e===null)throw Error(`Invalid ${Rb(i)} account/organization selected, please try again.`);if(t===null)throw Error(`Invalid repository selected, please try again.`);let r=await(await f.mutateAsync({orgName:e,repositoryURL:t,defaultBranch:`main`,forceConnect:n})).json();r.connected?r.pullRequestUrl?(d(r.pullRequestUrl),o(`source-control-repo-connected-via-pr`,p),l(`pullRequestOpened`)):(o(`source-control-repo-connected`,p),l(null)):r.emptyRepository===!1&&(a(``),o(`source-control-existing-repo-confirm-shown`,p),l(`linkAnyway`))}catch(e){let t=zb(e);switch(qKt(e)){case`monorepo`:a(``),o(`source-control-monorepo-detected`,p),l(`monorepo`);break;case`invalidRepo`:a(``),o(`source-control-nonempty-repo-detected`,p),l(`nonEmpty`);break;default:s(e),o(`source-control-repo-connection-failed`,{...p,errorMessage:t,...v_e(e)}),a(t),l(null)}}};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(AP,{open:c===`linkAnyway`,onOpenChange:e=>{e||(o(`source-control-existing-repo-confirm-cancelled`,p),l(null))},title:k7.linkAnyway.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.linkAnyway.description,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/source-control`,children:`Learn more about source control`})]}),actionLabel:k7.linkAnyway.actionLabel,isPending:f.isPending,onConfirm:()=>{o(`source-control-existing-repo-confirm-confirmed`,p),m(n,r,!0)}}),(0,U.jsx)(AP,{open:c===`monorepo`,onOpenChange:e=>{e||(o(`source-control-monorepo-cancelled`,p),l(null))},title:k7.monorepo.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.monorepo.description,` `,(0,U.jsx)(JT,{href:A7,children:`Learn how to deploy from a monorepo`})]}),actionLabel:k7.monorepo.actionLabel,onConfirm:()=>{o(`source-control-monorepo-manual-setup-clicked`,p),l(null),window.open(A7,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(AP,{open:c===`nonEmpty`,onOpenChange:e=>{e||(o(`source-control-nonempty-repo-cancelled`,p),l(null))},title:k7.nonEmpty.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.nonEmpty.description,` `,(0,U.jsx)(JT,{href:A7,children:`Learn how to deploy from a monorepo`})]}),actionLabel:k7.nonEmpty.actionLabel,onConfirm:()=>{o(`source-control-nonempty-repo-manual-setup-clicked`,p),l(null),window.open(A7,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(AP,{open:c===`pullRequestOpened`,onOpenChange:e=>{e||l(null)},title:k7.pullRequestOpened.title,description:k7.pullRequestOpened.description,actionLabel:k7.pullRequestOpened.actionLabel,onConfirm:()=>{o(`source-control-pr-opened-view-clicked`,p),l(null),u&&window.open(u,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(Y,{"data-test":`connect-repo-button`,variant:`outline`,size:`sm`,onClick:()=>{o(`source-control-connect-button-clicked`,{...p,sourceControlProvider:i}),m(n,r,!1)},children:(0,U.jsx)(aP,{loading:f.isPending,children:`Connect`})})]})},YKt=({repositories:e,account:t,project:n,selectedNamespace:r,provider:i,maxItems:a=5,onConnectError:o,newRepoIds:s})=>{let c=i===`azure`;return(0,U.jsx)(U.Fragment,{children:e.slice(0,a).map((e,a)=>(0,U.jsxs)(`div`,{className:(0,nP.default)(`flex flex-row items-center justify-center h-16 border-border px-5 lg:gap-5 gap-2 transition-colors duration-700`,{"border-t":a!==0},{"bg-emerald-50 dark:bg-emerald-950/30":s?.has(e.id)}),children:[(0,U.jsxs)(`div`,{className:`flex text-sm flex-1 gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium line-clamp-1`,children:e.name}),s?.has(e.id)&&(0,U.jsx)(`span`,{className:`rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300`,children:`New`})]}),c&&e.metadata?.projectName?(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Project: `,e.metadata.projectName]}):(0,U.jsxs)(`span`,{className:`text-muted-foreground hidden md:inline-block lg:inline-block`,children:[`Updated on`,` `,new Date(e.updatedAt).toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})]})]}),e.private&&(0,U.jsxs)(`div`,{className:`flex justify-center items-center text-muted-foreground gap-1`,children:[(0,U.jsx)(Ap,{className:`h-4 w-4`,"aria-hidden":`false`,"aria-label":`Private Git repository`}),(0,U.jsx)(`span`,{className:`hidden lg:block`,children:`Private Repository`})]})]}),(0,U.jsx)(JKt,{accountName:t.name,projectName:n.name,orgName:r?.label||``,repositoryUrl:e.url,provider:i,handleErrors:o})]},e.id))})},XKt={[E7]:{name:`GitHub`,icon:(e=20)=>(0,U.jsx)(jKt,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitHub Account`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? We can help you create a new one.`,selectAccount:`Make sure to select a Git account or organization on the top left.`,grantAccess:`Make sure to grant Zuplo access to the Git account & its repositories you'd like to connect to.`}},[O7]:{name:`Azure DevOps`,icon:(e=20)=>(0,U.jsx)(kKt,{className:`mr-1.5`,size:e}),supportsProjects:!0,placeholder:{namespace:`Select Organization`,project:`Select Project`,search:`Search repositories`},messages:{noRepoInProject:`No repository in this project? Create a new one.`,noRepoAtHand:`No project at hand? We can help you create one.`,selectAccount:`Please select a project to view repositories.`,grantAccess:`No repositories in this project yet.`}},[T7]:{name:`GitLab`,icon:(e=20)=>(0,U.jsx)(wp,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitLab Group`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a GitLab group or namespace.`,grantAccess:`Connect your GitLab account to see repositories.`}},[D7]:{name:`Bitbucket`,icon:(e=20)=>(0,U.jsx)(Jf,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select Bitbucket Project`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a Bitbucket project.`,grantAccess:`Connect your Bitbucket account to see repositories.`}}},ZKt=e=>XKt[e]||XKt.GITHUB,j7=({account:e,project:t})=>{let{logEvent:n}=S(),r=iAe(e.name),[i,a]=(0,H.useState)(t.name),[o,s]=(0,H.useState)(!1);return{newRepoName:i,setNewRepoName:a,showCreateRepoForm:o,setShowCreateRepoForm:s,createRepoMutation:r,isCreating:r.isPending,handleCreateRepo:async({namespace:o,repoName:c,otherParams:l})=>{let u=c||i||t.name;await r.mutateAsync({projectName:t.name,orgName:o,repositoryName:u,defaultBranch:`main`,otherParams:l}),n(`source-control-repo-created`,{sourceControlRepository:u,sourceControlNamespace:o,account:e.name,project:t.name}),a(``),s(!1)},reset:()=>{s(!1),a(t.name)},transformRepoToRepository:(e,t)=>({id:e.url,url:e.url,provider:t,name:e.name,slug:e.name,defaultBranch:e.defaultBranch,namespace:e.organization,owner:{id:0,name:e.organization},private:!0,updatedAt:new Date().toISOString(),ownerType:e.isUserRepo?`user`:`team`,metadata:e.metadata}),logEvent:n}},QKt=e=>{let{account:t,project:n,sourceControlConfig:r,selectedNamespace:i,searchTerm:a}=e,o=j7(e),[s,c]=(0,H.useState)(null),l=r.provider===O7,{data:u,isLoading:d}=myt(t.name,i?.value||``,{enabled:l&&!!i}),{data:f,isLoading:p}=fyt(t.name),m=o.transformRepoToRepository;return{repositories:(0,H.useMemo)(()=>!f?.data||!i||!s?[]:(f.data[i.label]||[]).filter(e=>e.metadata?.projectName===s.label).filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())).map(e=>m(e,`azure`)),[f,i,s,a,m]),isLoadingRepos:p&&!!s,projects:u?.data,selectedProject:s,isLoadingProjects:d,onProjectChange:e=>{c(e),o.logEvent(`source-control-project-selected`,{account:t.name,project:n.name,sourceControlProvider:r.provider})},reset:()=>{c(null),o.reset()}}},$Kt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=j7(e),o=n.provider===D7,{data:s,isLoading:c,refetch:l}=hyt(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{repositories:s?.repositories||[],isLoadingRepos:c,onCreateRepo:async()=>{if(!r)throw Error(`Please select a project`);await a.handleCreateRepo({namespace:r.value}),l()},reset:a.reset,showCreateRepoForm:a.showCreateRepoForm,setShowCreateRepoForm:a.setShowCreateRepoForm,newRepoName:a.newRepoName,setNewRepoName:a.setNewRepoName,isCreating:a.isCreating}},eqt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=j7(e),o=n.provider===E7,{data:s,isLoading:c}=hyt(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{...a,repositories:s?.repositories||[],isLoadingRepos:c,reset:a.reset}},tqt=e=>{let{account:t,selectedNamespace:n,searchTerm:r}=e,i=j7(e),{data:a}=pyt(t.name),{data:o,isLoading:s,refetch:c}=fyt(t.name),l=i.transformRepoToRepository;return{repositories:(0,H.useMemo)(()=>{if(!o?.data||!n)return[];let e=a?.find(e=>e.installationId===Number(n.value))?.slug||n.label;return(o.data[e]||[]).filter(e=>!r||e.name.toLowerCase().includes(r.toLowerCase())).map(e=>l(e,`gitlab`))},[o,n,r,a,l]),isLoadingRepos:s,onCreateRepo:async()=>{if(!n)throw Error(`Please select a namespace`);await i.handleCreateRepo({namespace:n.value}),c()},reset:i.reset,showCreateRepoForm:i.showCreateRepoForm,setShowCreateRepoForm:i.setShowCreateRepoForm,newRepoName:i.newRepoName,setNewRepoName:i.setNewRepoName,isCreating:i.isCreating}},nqt=250,rqt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=S(),i=n.provider,a=ZKt(i),[o,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(null),[d,f]=(0,H.useState)(``),p=zKt(d,nqt),m=(0,H.useRef)(new Set),h=(0,H.useRef)(null),g=(0,H.useRef)(!1),[_,v]=(0,H.useState)(new Set),[y,b]=(0,H.useState)(!1),{data:x,isLoading:C,isFetching:w,error:T}=pyt(e.name),E=T instanceof s&&T.type===gt.type,D={account:e,project:t,sourceControlConfig:n,selectedNamespace:l,searchTerm:p},O=QKt(D),k=tqt(D),A=$Kt(D),j=eqt(D),M=(()=>{switch(i){case O7:return O;case T7:return k;case D7:return A;default:return j}})();(0,H.useEffect)(()=>{if(x&&x.length>0){let e=x[0];u({label:e.name,value:i===`AZURE`?e.slug:e.installationId.toString(),icon:a.icon(20)})}},[x,i,a]),(0,H.useEffect)(()=>{if(p!==``||M.isLoadingRepos)return;let e=l?.value?.toString()??null,t=M.repositories.map(e=>e.id);if(h.current!==e){h.current=e,m.current=new Set(t),v(new Set),b(!1);return}let n=t.filter(e=>!m.current.has(e));if(n.length>0){for(let e of n)m.current.add(e);g.current=!1,b(!1),v(new Set(n))}else g.current&&(g.current=!1,b(!0))},[M.repositories,M.isLoadingRepos,p,l]);let N=a=>{if(a.value===`add-github-account`){r(`source-control-add-account-selected`,{sourceControlNamespace:a.value,account:e.name,project:t.name,sourceControlProvider:i}),n.installUrl&&(g.current=!0,window.open(n.installUrl));return}r(`source-control-namespace-selected`,{sourceControlNamespace:a.value,sourceControlProvider:i,account:e.name,project:t.name}),c(``),u(a),M.reset()},P=[];x?.forEach(e=>{P.push({label:e.name,value:String(i===`AZURE`?e.slug:e.installationId),icon:a.icon(20)})}),i===`GITHUB`&&P.push({label:`Add GitHub Account`,value:`add-github-account`,icon:(0,U.jsx)(Np,{className:`mr-1.5`,size:16})});let F=()=>a.supportsProjects&&M.selectedProject?M.repositories.length>0?`Showing ${M.repositories.length} repositories from project: ${M.selectedProject.label}`:a.messages.grantAccess:!a.supportsProjects&&M.repositories.length>0?`Showing ${Math.min(M.repositories.length,5)} repositories`:a.supportsProjects&&!M.selectedProject?a.messages.selectAccount:`Select an account to view repositories`,I=()=>(0,U.jsx)(UKt,{installUrl:n.installUrl??``,selectedOrg:l?.label??``,projectName:t.name,provider:i,repoDescription:VD(t)?`Zuplo AI Gateway`:void 0,className:`w-full md:w-auto`,onContinue:()=>{g.current=!0}}),L=C||M.isLoadingRepos,R=!a.supportsProjects||M.selectedProject;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[E?(0,U.jsxs)(db,{variant:`destructive`,children:[(0,U.jsx)(fb,{children:`Reconnect GitHub`}),(0,U.jsxs)(pb,{children:[(0,U.jsx)(`p`,{children:`Your saved GitHub credentials are no longer valid. Revoke the connection from your profile, then connect GitHub again.`}),(0,U.jsx)(Y,{asChild:!0,variant:`outline`,size:`sm`,className:`mt-2`,children:(0,U.jsx)(Ml,{to:Db.Profile,children:`Go to profile`})})]})]}):(0,U.jsx)(ak,{error:T}),(0,U.jsx)(ak,{error:o}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3 rounded-lg border p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`text-sm`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`Start fresh with a new repository`}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`We'll set up a ready-to-deploy Zuplo project so GitOps works right away.`})]}),I()]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 my-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,U.jsx)(`span`,{children:`Or connect an existing repository`}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We'll link this project to your repo. You'll push and pull changes manually.`})]}),L&&l===null&&(0,U.jsx)(HKt,{showHeader:!1}),!C&&(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(RKt,{testId:`namespace-selector`,placeholder:a.placeholder.namespace,options:P,selected:l,onChange:N,className:`flex-1 items-center h-9`,isLoadingData:w}),i===`AZURE`&&l&&(0,U.jsx)(BKt,{projects:M.projects,isLoadingProjects:M.isLoadingProjects||!1,selectedProject:M.selectedProject||null,onProjectChange:M.onProjectChange||(()=>{})}),(0,U.jsxs)($Y,{className:`flex-2 w-full`,children:[(0,U.jsx)(tX,{value:d,onChange:e=>f(e.target.value),placeholder:a.placeholder.search}),(0,U.jsx)(eX,{align:`inline-start`,children:(0,U.jsx)(Fp,{className:`opacity-75`})}),d&&(0,U.jsx)(eX,{align:`inline-end`,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>f(``),children:(0,U.jsx)($p,{})})})]})]}),(0,U.jsx)(ok,{className:`flex flex-col`,children:M.isLoadingRepos&&R?(0,U.jsxs)(`div`,{className:`flex flex-row items-center p-2 justify-center align-middle h-80`,children:[(0,U.jsx)(sP,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}),(0,U.jsx)(`span`,{children:`Loading repositories...`})]}):R&&M.repositories.length>0?(0,U.jsx)(YKt,{repositories:M.repositories,account:e,project:t,selectedNamespace:l,provider:i,onConnectError:c,newRepoIds:_}):R?(0,U.jsxs)(`div`,{className:`flex flex-col text-sm text-center gap-2 items-center justify-center h-80`,children:[(0,U.jsx)(`h2`,{className:`text-base`,children:`No Results Found`}),(0,U.jsx)(`p`,{children:d?`Your search for "${d}" did not return any results.`:a.messages.grantAccess})]}):(0,U.jsx)(`div`,{className:`flex items-center justify-center h-80`,children:(0,U.jsx)(`p`,{children:a.messages.selectAccount})})}),i===`GITHUB`&&n.installUrl&&(y?(0,U.jsxs)(db,{variant:`info`,children:[(0,U.jsx)(fb,{children:`Don't see your repository?`}),(0,U.jsxs)(pb,{children:[`Check that you selected the right account above, and that you granted the Zuplo GitHub App access to that repository.`,` `,(0,U.jsx)(JT,{href:n.installUrl,onClick:()=>{g.current=!0},children:`Manage repository access →`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-dashed p-3 text-sm sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Missing repositories? `}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Zuplo only shows repositories you've granted the Zuplo GitHub App access to.`})]}),(0,U.jsx)(JT,{href:n.installUrl,className:`whitespace-nowrap`,onClick:()=>{g.current=!0},children:`Manage repository access →`})]})),(0,U.jsxs)(`div`,{className:`flex whitespace-pre-line text-gray-500 text-sm justify-between gap-4`,children:[(0,U.jsx)(`span`,{children:F()}),(i===`GITLAB`||i===`BITBUCKET`)&&n.installUrl&&(0,U.jsxs)(JT,{href:n.installUrl,className:`whitespace-pre`,children:[`Adjust `,a.name,` Permissions →`]})]})]})},iqt=({provider:e,url:t,org:n,name:r,children:i})=>(0,U.jsx)(ok,{className:`flex gap-2 flex-col`,offset:`md`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(w7,{providerName:e}),(0,U.jsx)(`div`,{className:`flex flex-col flex-1`,children:(0,U.jsxs)(`a`,{className:`text-sm font-semibold hover:text-zuplo-pink-hover underline flex gap-1 items-center`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[n,`/`,r,(0,U.jsx)(_p,{className:`h-4 w-4`})]})}),i]})}),aqt=({account:e,project:t})=>{let{logEvent:n}=S(),r=fm([`account`,`project`]);if(!t.sourceRepoUrl)throw Error(`No sourceRepoUrl on project '${r.account.name}'`);let i=t.sourceRepoUrl.replace(`.git`,``),a,o,s=!1;try{s=new URL(t.sourceRepoUrl).hostname===`dev.azure.com`}catch{s=!1}if(s){let e=t.sourceRepoUrl.match(/^https:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)/);if(e){a=e[1];let t=e[2],n=e[3].replace(`.git`,``);a=`${e[1]}/${t}`,o=n}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}let c=oAe(e.name,t.name),l=async()=>{await c.mutateAsync(),n(`source-control-repo-disconnected`,{account:r.account.name,project:r.project.name})};return(0,U.jsx)(iqt,{org:a,name:o,url:i,provider:t.sourceControlProvider.toLowerCase(),children:(0,U.jsx)(Y,{"data-test":`disconnect-repo-button`,onClick:l,variant:`secondary`,className:`self-end`,disabled:c.isPending,children:(0,U.jsx)(aP,{className:`flex items-center gap-1`,loading:c.isPending,children:`Disconnect`})})})},oqt=({provider:e,onClose:t})=>{if(!e)return null;let n=Rb(e);return(0,U.jsx)(Jw,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(Zw,{children:[(0,U.jsxs)(Qw,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(w7,{providerName:e.toLowerCase(),size:28}),(0,U.jsxs)(eT,{children:[n,` Integration`]})]}),(0,U.jsxs)(tT,{className:`pt-2`,children:[n,` source control integration is available on Enterprise plans. Contact our sales team or book a demo to learn more about connecting your `,n,` repositories to Zuplo.`]})]}),(0,U.jsxs)($w,{className:`mt-2`,children:[(0,U.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,U.jsx)(JT,{href:`mailto:${Tb}?subject=${encodeURIComponent(`${n} Source Control Integration`)}`,variant:`ghost`,children:`Contact Sales`})}),(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(JT,{href:wb,variant:`ghost`,children:`Book a Demo`})})]})]})})},M7=`sourceControlConnect`,sqt=`sourceControlConnectError`,cqt=`sourceControlConnectSuccess`,lqt=3e5,uqt=1e3;function dqt(e){if(e.key!==`sourceControlConnectSuccess`&&e.key!==`sourceControlConnectError`||!e.newValue)return null;try{return JSON.parse(e.newValue)}catch{return null}}var fqt=()=>{let{logEvent:e}=S(),{error:t}=um(),n=At(),[r,i]=(0,H.useState)(!1),a=(0,H.useRef)(null),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>()=>a.current?.(),[]),{connect:(r,s,c)=>{let{id:l,provider:u,clientId:d,scopes:f,redirectUri:p,providerUrl:m}=s;e(`source-control-provider-clicked`,{provider:u});let h=`${r}::${l}::${crypto.randomUUID()}`;localStorage.removeItem(M7),localStorage.removeItem(sqt),localStorage.removeItem(cqt),localStorage.setItem(M7,h),i(!0);let g;if(u===`GITHUB`?g=f===``?`https://github.com/login/oauth/authorize?client_id=${d}`:`https://github.com/login/oauth/authorize?client_id=${d}&scope=${f}`:u===`GITLAB`?g=`${m}/oauth/authorize?client_id=${d}&redirect_uri=${p}&response_type=code&scope=${f}`:u===`BITBUCKET`?g=`${m}/site/oauth2/authorize?client_id=${d}&response_type=code`:u===`AZURE`&&(g=`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${d}&redirect_uri=${encodeURIComponent(p)}&response_type=code&response_mode=query&scope=${encodeURIComponent(f)}`),!g){i(!1),localStorage.removeItem(M7);return}let _=window.open(g),v=!1,y,b,x;function S(i){let a=dqt(i);if(!(!a||a.connect!==h)){if(i.key===`sourceControlConnectSuccess`){w(()=>{e(`source-control-access-granted`,{account:r,sourceControlProvider:u}),n.invalidateQueries({queryKey:[je.accountsSourceControlConfigurations().url],exact:!1})});return}i.key===`sourceControlConnectError`&&w(()=>{t(a.message??``),c?.onFailure?.()})}}function C(){window.removeEventListener(`storage`,S),y!==void 0&&clearInterval(y),b!==void 0&&clearTimeout(b),x!==void 0&&clearTimeout(x),localStorage.removeItem(M7),localStorage.removeItem(sqt),localStorage.removeItem(cqt),a.current=null,o.current=null}function w(e){v||(v=!0,i(!1),C(),e?.())}if(window.addEventListener(`storage`,S,!1),!_){w(()=>{t(`Couldn't open the ${Rb(u)} sign-in window. Your browser may be blocking pop-ups; allow them for this site and try again.`),e(`source-control-connect-popup-blocked`,{account:r,sourceControlProvider:u}),c?.onFailure?.()});return}y=setInterval(()=>{let n=!1;try{n=_.closed}catch{return}n&&(y!==void 0&&clearInterval(y),b=setTimeout(()=>{w(()=>{t(`We didn't get a response from the ${Rb(u)} sign-in window. Please try again.`),e(`source-control-connect-abandoned`,{account:r,sourceControlProvider:u}),c?.onFailure?.()})},uqt))},500),x=setTimeout(()=>{w(()=>{t(`Connecting to ${Rb(u)} timed out. Please try again.`),e(`source-control-connect-timeout`,{account:r,sourceControlProvider:u}),c?.onFailure?.()})},lqt),a.current=C,o.current={account:r,provider:u}},isConnecting:r,cancel:()=>{let t=o.current;t&&e(`source-control-connect-abandoned`,{account:t.account,sourceControlProvider:t.provider}),a.current?.(),i(!1)}}},pqt=({accountName:e,sourceControlConfig:t})=>{let{connect:n,isConnecting:r,cancel:i}=fqt(),{provider:a}=t;return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Y,{variant:`outline`,className:`gap-2`,disabled:r,onClick:()=>n(e,t),children:(0,U.jsx)(aP,{loading:r,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(w7,{providerName:a}),(0,U.jsx)(`span`,{children:`Connect to ${Rb(a)}`})]})})}),r&&(0,U.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`})]})},mqt=[{key:T7,label:`GitLab`},{key:D7,label:`Bitbucket`}],hqt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=S(),[i,a]=(0,H.useState)(null);if(n?.userHasCredentials&&t.sourceRepoUrl)return(0,U.jsx)(aqt,{account:e,project:t});if(n&&!t.sourceRepoUrl&&n.userHasCredentials)return(0,U.jsx)(rqt,{account:e,project:t,sourceControlConfig:n});let o=n?Rb(n.provider):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ok,{offset:`md`,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`text-sm whitespace-pre-line text-gray-500`,children:[n&&t.sourceRepoUrl&&(0,U.jsxs)(`p`,{className:`mb-3`,children:[`This project is currently associated with a `,o,` `,`repository but you have not connected to your `,o,` `,`account.`]}),(0,U.jsx)(`p`,{children:`Connect to a source control provider to enable source control on your project.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,U.jsx)(pqt,{accountName:e.name,sourceControlConfig:n}),mqt.map(({key:e,label:t})=>(0,U.jsxs)(Y,{variant:`outline`,className:`gap-2`,onClick:()=>{r(`source-control-provider-clicked`,{provider:e}),a(e)},children:[(0,U.jsx)(w7,{providerName:e.toLowerCase(),size:20}),(0,U.jsxs)(`span`,{children:[`Connect to `,t]})]},e))]})]}),(0,U.jsx)(oqt,{provider:i,onClose:()=>a(null)})]})},gqt=()=>Nb(je.accountsSourceControlConfigurations()),_qt=()=>{let{account:e,project:t}=fm([`account`,`project`]),{logEvent:n}=S();return(0,U.jsxs)(`div`,{className:`flex flex-col space-y-4`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Support`}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Ote,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Talk to an API expert`}),(0,U.jsx)(lk,{children:`Get a free technical consultation with one of our API experts.`})]}),(0,U.jsx)(Y,{onClick:()=>{n(`getting-started-book-a-meeting-clicked`,{account:e.name}),window.open(wb,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(JT,{href:wb,variant:`ghost`,children:[(0,U.jsx)(Zf,{}),`Book a Meeting`]})})]})}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Op,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Feeling Stuck?`}),(0,U.jsx)(lk,{children:`Check out our various support options to get help with your API`})]}),(0,U.jsx)(Y,{className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(Ml,{to:lo(Db.Support,{account:e.name}),children:[(0,U.jsx)(Op,{}),`Get Help`]})})]})}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Ote,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Join the Zuplo API Community`}),(0,U.jsx)(lk,{children:`Come chat with fellow Zuplo users and the Zuplo team in our Discord channel.`})]}),(0,U.jsx)(Y,{onClick:()=>{n(`getting-started-join-discord-clicked`,{account:e.name,project:t.name}),window.open(Sb,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(JT,{href:Sb,variant:`ghost`,children:[(0,U.jsx)(bte,{size:16}),`Join Us`]})})]})})]})},vqt=()=>{let{account:e,project:t,environment:n}=Pb([`account`,`project`,`environment`]);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{className:`text-base`,children:`Welcome to your Gateway`}),(0,U.jsx)(lk,{className:`text-base`,children:`You can get started by configuring your routes and setting up policies in our visual Route Designer.`})]}),(0,U.jsxs)(dk,{className:`border-0 gap-2 py-6`,children:[(0,U.jsx)(Y,{asChild:!0,size:`sm`,className:`gap-2 px-8`,variant:`brand-outline`,children:(0,U.jsxs)(Ml,{to:lo(Db.Code,{account:e,project:t,environment:n}),children:[(0,U.jsx)(fp,{size:16}),`Start Building`]})}),(0,U.jsx)(Y,{className:`px-8`,variant:`secondary`,size:`sm`,asChild:!0,children:(0,U.jsxs)(JT,{variant:`ghost`,href:`https://zuplo.com/docs/articles/step-1-setup-basic-gateway`,children:[(0,U.jsx)(Sp,{size:16}),`Quickstart`]})})]})]})},yqt=()=>{let[e,t]=(0,H.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ok,{className:`col-span-full md:col-span-3 py-2 px-4 flex items-center text-sm gap-x-2`,children:[(0,U.jsx)(`div`,{className:`rounded-full w-4 h-4 p-0.5 bg-gray-500`,children:(0,U.jsx)(dp,{className:`text-white`,size:12})}),(0,U.jsx)(`span`,{className:`font-semibold flex-1 line-clamp-1 break-all`,children:`Developer Portal`}),(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!0),children:[(0,U.jsx)(Sp,{}),`Open\xA0Portal`]})]}),(0,U.jsx)(Jw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Zw,{children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Run Developer Portal Locally`}),(0,U.jsx)(tT,{children:`To view and edit your API documentation, you need to run the developer portal locally.`})]}),(0,U.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold`,children:`Steps to run the portal:`}),(0,U.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 text-sm text-gray-600`,children:[(0,U.jsxs)(`li`,{children:[`Open a terminal in the`,` `,(0,U.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`/docs`}),` `,`folder of your Zuplo project`]}),(0,U.jsxs)(`li`,{children:[`Run`,` `,(0,U.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`npm run dev`})]}),(0,U.jsx)(`li`,{children:`The portal will open in your browser automatically`})]})]}),(0,U.jsx)(`div`,{className:`bg-info-muted border border-blue-200 dark:border-blue-800 rounded-md p-3`,children:(0,U.jsxs)(`p`,{className:`text-xs text-blue-800 dark:text-blue-200`,children:[(0,U.jsx)(`strong`,{children:`Tip:`}),` The developer portal will automatically reload when you make changes to your OpenAPI documentation.`]})})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`secondary`,onClick:()=>t(!1),children:`Close`}),(0,U.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dev-portal`,children:`View Documentation`})})]})]})})]})},bqt=()=>{let{project:e,environment:t}=fm(),n=vF(t);return(0,U.jsx)(`div`,{className:`bg-neutral-50 dark:bg-neutral-950 h-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`pt-4 max-w-6xl pb-16 m-auto px-5 flex flex-col gap-4`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.name}),(0,U.jsxs)(`div`,{className:`grid grid-cols-8 gap-3`,children:[(0,U.jsx)(OKt,{title:`Gateway`,url:n}),(0,U.jsx)(yqt,{})]}),(0,U.jsxs)(ok,{className:`relative grid md:grid-cols-2 overflow-hidden min-h-[220px]`,children:[(0,U.jsx)(vqt,{}),(0,U.jsxs)(`div`,{className:`hidden md:block self-end h-full w-full`,children:[(0,U.jsx)(`img`,{src:wKt,alt:e.name,className:`w-full h-full object-cover object-left dark:hidden`}),(0,U.jsx)(`img`,{src:TKt,alt:``,"aria-hidden":!0,className:`hidden w-full h-full object-cover object-left dark:block`})]})]}),(0,U.jsx)(DKt,{mode:`local`}),(0,U.jsx)(_qt,{})]})})},xqt=()=>Xe().brand,Sqt=({account:e,accountLabel:t,navigateTo:n})=>{let{data:r,isLoading:i}=PT(e),a=$Ee(e),o=i||a.isLoading,s=t||e,c=nDe(r,a).sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()));return o?(0,U.jsx)(oT,{heading:s,forceMount:!0,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,U.jsx)(kp,{className:`h-4 w-4 animate-spin`}),(0,U.jsx)(`span`,{children:`Loading projects...`})]})}):(0,U.jsx)(oT,{heading:s,children:c.map(r=>(0,U.jsxs)(sT,{value:`${e}/${r.name}`,keywords:t?[r.name,e,t]:[r.name,e],onSelect:()=>n(lo(Db.Overview,{account:e,project:r.name})),children:[(0,U.jsx)(Gf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{children:r.name})]},r.id))})},Cqt=({accounts:e,navigateTo:t})=>{let n=e?.map(e=>e.name)??[],r=eAe(n),i=eDe(n),a=[...e??[]].sort((e,t)=>(e.label||e.name).toLowerCase().localeCompare((t.label||t.name).toLowerCase())),o=(e??[]).flatMap((e,t)=>i[t]?nDe(r[t]?.data,i[t]).map(t=>({account:e,project:t})):[]).sort((e,t)=>e.project.name.toLowerCase().localeCompare(t.project.name.toLowerCase()));return(0,U.jsxs)(oT,{children:[a.map(e=>(0,U.jsxs)(sT,{value:e.name,keywords:[e.label||e.name,e.name],onSelect:()=>t(lo(Db.AccountProjects,{account:e.name})),children:[(0,U.jsx)(Xf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label||e.name}),e.label&&e.label!==e.name&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:e.name}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:`Account`})]},`account:${e.name}`)),o.map(({account:e,project:n})=>(0,U.jsxs)(sT,{value:`${e.name}/${n.name}`,keywords:e.label?[n.name,e.name,e.label]:[n.name,e.name],onSelect:()=>t(lo(Db.Overview,{account:e.name,project:n.name})),children:[(0,U.jsx)(Gf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{className:`truncate`,children:n.name}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:e.label||e.name})]},n.id))]})},wqt=({accounts:e,navigateTo:t,search:n})=>n.trim()?(0,U.jsx)(Cqt,{accounts:e,navigateTo:t}):(0,U.jsxs)(U.Fragment,{children:[e?.map(e=>(0,U.jsx)(Sqt,{navigateTo:t,account:e.name,accountLabel:e.label},`projects-${e.name}`)),(0,U.jsx)(oT,{heading:`Accounts`,children:e?.map(e=>(0,U.jsxs)(sT,{keywords:[e.label||e.name,e.name],onSelect:()=>{t(lo(Db.AccountProjects,{account:e.name}))},children:[(0,U.jsx)(Xf,{className:`mr-2 h-4 w-4`}),(0,U.jsx)(`span`,{children:e.label||e.name}),e.label&&e.label!==e.name&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:e.name})]},e.name))})]}),Tqt=`__zuplo_commander_ask_ai__`,Eqt=.5,Dqt=(e,t,n)=>{if(e===`__zuplo_commander_ask_ai__`)return Eqt;let[r=e,...i]=n??[],a=Bw(r,t);if(a>0)return 2+a;let o=i.reduce((e,n)=>Math.max(e,Bw(n,t)),0);return o>0?1+o:0},Oqt=({query:e,onSelected:t})=>{let n=dpt(),{logEvent:r}=S();if(!n?.enabled)return null;let i=e.trim();return(0,U.jsx)(oT,{children:(0,U.jsxs)(sT,{value:Tqt,onSelect:()=>{r(`agent-z-panel-opened`,{source:`command-palette`}),n.openWithPrompt(i),t()},children:[(0,U.jsx)(`div`,{className:`mr-2`,children:(0,U.jsx)(Gy,{weight:`fill`,"aria-hidden":!0})}),(0,U.jsx)(`span`,{children:`Ask AI`}),i&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:`"${i}"`})]})})},kqt=({account:e,navigateTo:t,project:n,environment:r})=>(0,U.jsx)(oT,{heading:`Files`,children:vm(e=>e.projectTreeNodes).filter(e=>e.path&&e.type===Zl.File).map(i=>(0,U.jsxs)(sT,{onSelect:()=>t(lo(`${Db.Code}?path=${i.path}`,{account:e,project:n,environment:r})),children:[(0,U.jsx)(`div`,{className:`mr-3`,children:(0,U.jsx)($ee,{className:`h-4 w-4 text-neutral-500`})}),(0,U.jsx)(`span`,{className:`line-clamp-1`,children:i.path.substring(1)})]},i.path))}),Aqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`bg-surface-sunken`,t),children:e}),jqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`pt-4 max-w-6xl pb-16 m-auto px-5 w-full`,t),children:e}),Mqt=({children:e,className:t,muted:n})=>(0,U.jsx)(`div`,{className:W(`bg-background`,n&&`bg-surface-sunken`),children:(0,U.jsx)(`div`,{className:W(`py-6 max-w-6xl mx-auto px-5 min-h-20 flex items-center w-full`,t),children:e})}),Nqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`text-sm text-foreground`,t),children:e}),Pqt=({children:e,className:t})=>(0,U.jsx)(`h1`,{className:W(`text-2xl font-semibold tracking-tight`,t),children:e});(0,H.createContext)(void 0);var Fqt=yF(`div`,`grid grid-cols-subgrid col-span-full w-full items-center border-b px-4 py-3 last:border-0`),Iqt=yF(`div`,`grid grid-cols-subgrid col-span-full w-full items-center border-b px-4 py-2.5 text-xs font-medium uppercase tracking-wide text-muted-foreground`),N7=({title:e,description:t,action:n,children:r,contentClassName:i})=>(0,U.jsxs)(Aqt,{className:`min-h-full`,children:[(0,U.jsx)(`div`,{className:`border-b`,children:(0,U.jsx)(Mqt,{muted:!0,children:(0,U.jsxs)(`div`,{className:`flex w-full flex-wrap items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(Pqt,{children:e}),t&&(0,U.jsx)(Nqt,{className:`text-muted-foreground`,children:t})]}),n]})})}),(0,U.jsx)(jqt,{className:W(`flex flex-col gap-5`,i),children:r})]});function Lqt({assignment:e,children:t,onOpenChange:n}){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),{startOpening:s,renderTrigger:c}=Jct(),l=(0,H.useCallback)(()=>{o(!1),n?.(!1),i(!1)},[n]),u=MP(a,l);return(0,U.jsxs)(Jw,{open:r,onOpenChange:e=>{e?(n?.(!0),s(()=>i(!0))):u.guardedClose()},children:[(0,U.jsx)(Yw,{asChild:!0,children:c(t)}),(0,U.jsxs)(Zw,{className:`sm:max-w-4xl max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:(0,U.jsx)(Z,{children:`Edit AI Provider`})}),(0,U.jsx)(tT,{children:(0,U.jsxs)(Z,{children:[`The Provider Name is the routing address used in`,` `,(0,U.jsx)(`code`,{className:`font-mono`,translate:`no`,children:`providerName/model`}),` `,`references and cannot be changed.`]})})]}),(0,U.jsx)(Rqt,{assignment:e,onDirtyChange:o,onClose:l})]}),(0,U.jsx)(jP,{open:u.showConfirm,onOpenChange:u.setShowConfirm,onDiscard:u.handleDiscard})]})}var Rqt=({assignment:e,onDirtyChange:t,onClose:n})=>{let r=QY(),{logEvent:i}=S(),a=um(),o=wX(),s=(0,H.useRef)(null),c=bt(),{account:l,project:u}=Pb([`account`,`project`]),{project:d}=fm([`project`]),{data:f,providers:p}=OX().data,m=e.provider===`Custom`?e.customProviderName??e.provider:e.provider,h=p[m],g=h?.isCustom===!0,_=(0,H.useMemo)(()=>[...f[m]??[]].sort((e,t)=>AX(e.model,t.model)),[f,m]),v=(0,H.useMemo)(()=>{try{return JSON.parse(e.metadata)}catch{return{}}},[e.metadata]),y=rk({defaultValues:{provider:m,customProviderName:e.customProviderName,label:e.label,apiKey:``,envVarName:e.envVarName,region:GPe(e.endpointUrl)??YPe(e.endpointUrl)??rFe(e.endpointUrl)??``,awsAccessKeyId:``,awsSecretAccessKey:``,gcpProjectId:e.gcpProjectId??``,azureResourceName:YD(e.endpointUrl)?.resourceName??``,azureHostSuffix:YD(e.endpointUrl)?.hostSuffix??`openai.azure.com`,deploymentModels:pFe(e.deploymentModels),models:{completions:v.models?.completions??[],embeddings:v.models?.embeddings??[]},...g?{customModels:_.map(e=>({modelId:e.id,name:e.model,kind:e.kind,status:e.status===`deprecated`?`deprecated`:`active`,inputCostPerToken:e.inputCostPerToken,outputCostPerToken:e.outputCostPerToken,cachedInputCostPerToken:e.cachedInputCostPerToken,cacheWriteCostPerToken:e.cacheWriteCostPerToken}))}:{}},mode:`onChange`,resolver:ik(zct),shouldFocusError:!1}),{isDirty:b}=SO(y);(0,H.useEffect)(()=>{t(b)},[b,t]);let x=Oe({mutationFn:async t=>{if(g&&h?.id){let e=sct(_,t.customModels);for(let t of e.deleted)await c.fetch(ae.ai.deleteAiProviderModel(o,h.id,t));for(let t of e.repriced)await c.fetch(ae.ai.updateAiProviderModel(o,h.id,t.id,{inputCostPerToken:t.inputCostPerToken,outputCostPerToken:t.outputCostPerToken,cachedInputCostPerToken:t.cachedInputCostPerToken,cacheWriteCostPerToken:t.cacheWriteCostPerToken}));for(let t of e.created)await c.fetch(ae.ai.createAiProviderModel(o,h.id,{model:t.name,kind:t.kind,inputCostPerToken:t.inputCostPerToken,outputCostPerToken:t.outputCostPerToken,cachedInputCostPerToken:t.cachedInputCostPerToken,cacheWriteCostPerToken:t.cacheWriteCostPerToken,status:`active`}))}let n=aFe(t),r=UD(t);return await c.fetch(ae.ai.updateAiProviderAssignment(l,u,e.id,{envVarName:t.envVarName,...r?{value:r}:{},...n?{endpointUrl:n}:{},...t.provider===`VertexAI`&&t.gcpProjectId?.trim()?{gcpProjectId:t.gcpProjectId.trim()}:{},...t.provider===`AzureAI`?{deploymentModels:XD(t.deploymentModels)??{}}:{},metadata:{models:cct(t,g)}}))},onSuccess:(e,t)=>{VD(d)&&UD(t)&&a.success((0,U.jsx)(Z,{children:`Key updated. Your gateway is redeploying — this usually takes a minute or two.`}),{duration:VPe}),y.reset(y.getValues()),n()},onSettled:(t,n)=>r(`provider.updated`,n?`failed`:`succeeded`,{provider:e.provider})});return(0,U.jsx)(UY,{...y,children:(0,U.jsxs)(`form`,{onSubmit:y.handleSubmit(e=>x.mutate(e),t=>i(`ai-gateway-update-ai-provider-invalid`,{provider:e.provider,fields:Uct(t)})),className:`flex flex-col flex-1 min-h-0`,children:[(0,U.jsx)(ak,{error:x.error,className:`mb-4 break-all`}),(0,U.jsx)(qct,{form:y,scrollAreaRef:s,title:(0,U.jsx)(Z,{children:`Your changes weren't saved.`}),className:`mb-4`}),(0,U.jsx)(`div`,{ref:s,className:`flex-1 min-h-0 overflow-y-auto px-1 space-y-4`,children:(0,U.jsx)(mct,{form:y,mode:`edit`,providerDisabled:!0})}),(0,U.jsxs)($w,{className:`mt-4`,children:[(0,U.jsx)(Y,{type:`button`,variant:`ghost`,onClick:n,disabled:x.isPending,children:(0,U.jsx)(Z,{children:`Cancel`})}),(0,U.jsx)(Y,{type:`submit`,disabled:x.isPending,children:(0,U.jsx)(aP,{loading:x.isPending,children:(0,U.jsx)(Z,{children:`Save`})})})]})]})})},zqt=e=>e.label,P7=12,Bqt=(0,U.jsx)(Z,{children:`Connect API keys for providers like OpenAI and Anthropic and choose which models your gateway is allowed to route to.`}),Vqt=()=>(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(BX,{children:(0,U.jsxs)(Y,{children:[(0,U.jsx)(Np,{size:16}),(0,U.jsx)(Z,{children:`Add Provider`})]})})}),Hqt=()=>(0,U.jsx)(MX,{source:`providers-page`,children:(0,U.jsxs)(Y,{variant:`outline`,children:[(0,U.jsx)(Ste,{size:16}),(0,U.jsx)(Z,{children:`Request a provider or model`})]})}),Uqt=()=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(Hqt,{}),(0,U.jsx)(Vqt,{})]}),Wqt=()=>(0,U.jsx)(U.Fragment,{children:[0,1].map(e=>(0,U.jsxs)(ok,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 p-5`,children:[(0,U.jsx)(fD,{className:`size-10 rounded-lg`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(fD,{className:`h-5 w-48`}),(0,U.jsx)(fD,{className:`h-3 w-32`})]})]}),(0,U.jsx)(`div`,{className:`border-t`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 p-5`,children:[(0,U.jsx)(fD,{className:`h-3 w-24`}),(0,U.jsx)(fD,{className:`h-4 w-full max-w-2xl`})]})]},e))}),Gqt=()=>{let e=QY(),{account:t,project:n}=Pb([`account`,`project`]),r=Mb(je.aiProviderAssignments(t,n)),i=bt(),a=Oe({mutationFn:async e=>i.fetch(ae.ai.deleteAiProviderAssignment(t,n,e)),onSettled:(t,n)=>e(`provider.deleted`,n?`failed`:`succeeded`)}),o=r.data;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{error:a.error}),o.length>0?o.map(e=>(0,U.jsx)(qqt,{assignment:e,onDelete:()=>a.mutate(e.id)},e.id)):(0,U.jsx)(ok,{children:(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(qf,{})}),(0,U.jsx)(vb,{children:(0,U.jsx)(Z,{children:`No AI providers yet`})}),(0,U.jsx)(yb,{children:(0,U.jsx)(Z,{children:`Connect API keys for providers like OpenAI and Anthropic so your gateway can route requests to their models.`})})]}),(0,U.jsx)(bb,{children:(0,U.jsx)(BX,{})})]})})]})},Kqt=({assignment:e})=>(0,U.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-zuplo-100 text-lg font-semibold text-zuplo-700 dark:bg-zuplo-950/50 dark:text-zuplo-300`,children:(e.label||e.provider||`?`).trim().charAt(0).toUpperCase()}),qqt=({assignment:e,onDelete:t})=>{let[n,r]=(0,H.useState)(!1),i=(0,H.useCallback)(()=>r(!0),[]),{completions:a,embeddings:o}=(0,H.useMemo)(()=>{try{let t=JSON.parse(e.metadata);return{completions:t.models?.completions??[],embeddings:t.models?.embeddings??[]}}catch{return{completions:[],embeddings:[]}}},[e.metadata]),s=a.length+o.length,c=zqt(e),l=e.provider===`Custom`,u=e.provider===oFe,d=a.length>P7||o.length>P7;return(0,U.jsxs)(ok,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(Kqt,{assignment:e}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-lg font-medium`,children:e.label}),(0,U.jsx)(BT,{variant:`outline`,size:`default`,children:l?e.customProviderName===e.label?e.customProviderName:(0,U.jsx)(Z,{children:`Custom`}):u?sFe:e.provider})]}),u?(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-xs text-amber-700 dark:text-amber-400`,children:[(0,U.jsx)(Xp,{size:12}),(0,U.jsx)(`span`,{className:`truncate`,children:(0,U.jsx)(Z,{children:`Demo provider — not for production`})})]}):(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(Dp,{size:12}),(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.envVarName})]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(Lqt,{assignment:e,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,title:`Edit provider`,"aria-label":`Edit provider`,children:(0,U.jsx)(Mp,{size:16})})}),(0,U.jsx)(X_t,{onConfirm:t,description:(0,U.jsx)(Z,{children:`Are you sure you want to delete this provider? Apps using its models will stop working.`}),children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,title:`Delete provider`,"aria-label":`Delete provider`,className:`text-muted-foreground hover:text-destructive-foreground`,children:(0,U.jsx)(Yp,{size:16})})})]})]}),(0,U.jsx)(`div`,{className:`border-t`}),s===0?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-5`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,U.jsx)(Z,{children:`No models are enabled for this provider yet.`})}),(0,U.jsx)(Lqt,{assignment:e,children:(0,U.jsx)(Y,{variant:`outline`,size:`sm`,children:(0,U.jsx)(Z,{children:`Select models`})})})]}):(0,U.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,U.jsx)(Jqt,{icon:(0,U.jsx)(Cte,{size:14}),title:(0,U.jsx)(Z,{children:`Chat`}),models:a,referenceKey:c,expanded:n,onReveal:i}),(0,U.jsx)(Jqt,{icon:(0,U.jsx)(dte,{size:14}),title:(0,U.jsx)(Z,{children:`Embeddings`}),models:o,referenceKey:c,expanded:n,onReveal:i}),d&&(0,U.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto px-0`,onClick:()=>r(e=>!e),children:n?(0,U.jsx)(Z,{children:`Show fewer models`}):(0,U.jsxs)(Z,{children:[`Show all `,{count:s},` models`]})})]})]})},Jqt=({icon:e,title:t,models:n,referenceKey:r,expanded:i,onReveal:a})=>{if(n.length===0)return null;let o=n.slice(P7);return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[e,(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:n.length})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(Yqt,{models:n.slice(0,P7),referenceKey:r}),o.length>0&&(0,U.jsx)(Zqt,{hidden:!i,onReveal:a,children:(0,U.jsx)(Yqt,{models:o,referenceKey:r,className:`mt-1`})})]})]})},Yqt=({models:e,referenceKey:t,className:n})=>(0,U.jsx)(`ul`,{className:W(`grid grid-cols-1 gap-x-6 gap-y-1 font-mono text-xs sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,n),children:e.map(e=>(0,U.jsx)(Xqt,{model:e,referenceKey:t},e))}),Xqt=({model:e,referenceKey:t})=>{let n=t?`${t}/${e}`:e,{copyToClipboard:r}=Mw(n);return(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsxs)(YP,{delayDuration:300,children:[(0,U.jsx)(XP,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(),"aria-label":`Copy ${n}`,className:`block w-full cursor-pointer truncate rounded-xs text-left outline-none hover:underline hover:decoration-dotted hover:underline-offset-4 focus-visible:ring-2 focus-visible:ring-ring`,children:e})}),(0,U.jsxs)(ZP,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n}),(0,U.jsx)(`span`,{className:`text-background/70`,children:(0,U.jsx)(Z,{children:`Click to copy full name`})})]})]})})},Zqt=({hidden:e,onReveal:t,children:n})=>{let r=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{let t=r.current;t&&(e?t.setAttribute(`hidden`,`until-found`):t.removeAttribute(`hidden`))},[e]),(0,H.useEffect)(()=>{let e=r.current;if(e)return e.addEventListener(`beforematch`,t),()=>e.removeEventListener(`beforematch`,t)},[t]),(0,U.jsx)(`div`,{ref:r,children:n})},Qqt=()=>(0,U.jsx)(N7,{title:`AI Gateway`,description:Bqt,action:(0,U.jsx)(Uqt,{}),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(Wqt,{}),children:(0,U.jsx)(Gqt,{})})}),$qt=e=>e.plan===`FREE_V1`,eJt=({account:e,className:t,source:n})=>{let r=e.customDomainsInUse,i=e.entitlements.customDomains,a=$qt(e),o=`${lo(Db.AccountSettings,{account:e.name})}/upgrade-billing?source=${n}`;return(0,U.jsxs)(ok,{variant:`default`,className:t,children:[(0,U.jsx)(sk,{children:a?`Custom domains require a paid plan`:`Custom domain limit reached`}),(0,U.jsx)(uk,{className:`text-sm leading-relaxed`,children:a?(0,U.jsx)(`p`,{children:`Custom domains let you serve your APIs and developer portal from your own domain. Upgrade to the Builder plan to add custom domains to your account.`}):(0,U.jsxs)(`p`,{children:[`Your account is using`,` `,(0,U.jsxs)(`span`,{className:`font-medium`,children:[r,` of `,i]}),` `,`custom domains. Contact our team to increase your limit.`]})}),(0,U.jsxs)(dk,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(mb,{variant:`ghost`,to:o,children:`Upgrade to Builder`})}):(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(JT,{href:wb,variant:`ghost`,children:`Contact Sales`})}),(0,U.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,U.jsx)(mb,{variant:`ghost`,to:o,children:`View Plans`})})]})]})},tJt=({used:e,max:t,label:n,account:r,navigationSource:i,className:a,hideAtLimit:o=!1})=>{if(t<=0)return null;let s=e>=t,c=r.plan.startsWith(`FREE`),l=`${lo(Db.AccountSettings,{account:r.name})}/upgrade-billing${i?`?source=${i}`:``}`;return s?o?null:(0,U.jsxs)(db,{variant:`warning`,className:a,children:[(0,U.jsx)(Xp,{}),(0,U.jsx)(pb,{children:(0,U.jsxs)(`p`,{children:[`You've reached the limit of `,t,` `,n,` on your plan (`,e,` of`,` `,t,` used).`,` `,c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mb,{to:l,className:`hover:text-zuplo-pink-hover text-zuplo-pink underline`,children:`Upgrade your plan`}),` `,`to add more.`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JT,{href:`mailto:${Tb}`,className:`text-zuplo-pink hover:text-zuplo-pink-hover underline`,children:`Contact sales`}),` `,`to increase your limit.`]})]})})]}):(0,U.jsxs)(`p`,{className:W(`text-sm text-muted-foreground`,a),children:[`Using `,e,` of `,t,` `,n,`.`]})},nJt=({className:e})=>(0,U.jsxs)(ok,{variant:`info`,className:e,children:[(0,U.jsx)(sk,{children:`Managed Dedicated Project`}),(0,U.jsx)(uk,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,U.jsxs)(`p`,{className:`leading-loose`,children:[`This project uses Akamai managed dedicated hosting. Custom domains for Akamai must be configured through Akamai CDN. See`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`.`]})})]}),F7=`Switch`,[rJt,iJt]=V(F7),[aJt,oJt]=rJt(F7),sJt=H.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,m]=H.useState(null),h=p(t,e=>m(e)),g=H.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=yt({prop:i,defaultProp:a??!1,onChange:l,caller:F7});return(0,U.jsxs)(aJt,{scope:n,checked:v,disabled:s,children:[(0,U.jsx)(hu.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":fJt(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:ou(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,U.jsx)(dJt,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});sJt.displayName=F7;var cJt=`SwitchThumb`,lJt=H.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=oJt(cJt,n);return(0,U.jsx)(hu.span,{"data-state":fJt(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});lJt.displayName=cJt;var uJt=`SwitchBubbleInput`,dJt=H.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=H.useRef(null),s=p(o,a),c=XJ(n),l=we(t);return H.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,U.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});dJt.displayName=uJt;function fJt(e){return e?`checked`:`unchecked`}var pJt=sJt,mJt=lJt;function hJt({className:e,...t}){return(0,U.jsx)(pJt,{"data-slot":`switch`,className:W(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,U.jsx)(mJt,{"data-slot":`switch-thumb`,className:W(`bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var I7=({customDomain:e,cname:t,documentationUrl:n=`https://www.zuplo.com/docs/guides/custom-domain-setup`})=>(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsx)(`p`,{children:`We've set things up on our end, now you need to configure your DNS with a new entry.`}),(0,U.jsx)(`br`,{}),(0,U.jsx)(ok,{variant:`muted`,className:`font-mono p-4 text-sm`,children:(0,U.jsxs)(`ol`,{children:[(0,U.jsx)(`li`,{className:`leading-6`,children:`Type: CNAME`}),(0,U.jsxs)(`li`,{className:`leading-6`,children:[`Name: `,e,` `,(0,U.jsx)(cP,{textToCopy:e??``})]}),(0,U.jsxs)(`li`,{className:`leading-6`,children:[`Value: `,t,` `,(0,U.jsx)(cP,{textToCopy:t??``})]}),(0,U.jsx)(`li`,{className:`leading-6`,children:`TTL: 60s or auto`})]})}),(0,U.jsx)(`br`,{}),(0,U.jsx)(`p`,{children:`Note that it does sometimes take a few hours for records to propagate and for the SSL certificate to be created.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[`For more information see our`,` `,(0,U.jsx)(JT,{href:n,children:`documentation on custom domains`}),`.`]})]});function gJt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>!!e.managedDedicatedConfiguration)}function _Jt({stage:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n,formIsAlias:r}){return e===`dev-portal`?!1:n?!0:t?!1:r??!1}function vJt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>e.managedDedicatedConfiguration?.vendor===`akamai`)}function yJt({project:e,isAkamaiManagedDedicatedProject:t}){return t||!e?!1:!VD(e)}var L7=()=>(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsx)(`p`,{children:`This custom domain is setup with an advanced configuration. In order to make changes to this domain, please contact support.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[`For more information see our`,` `,(0,U.jsx)(JT,{href:`https://www.zuplo.com/docs/guides/custom-domain-setup`,children:`documentation on custom domains`}),`.`]})]}),bJt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,xJt=`https://zuplo.com/docs/dedicated/custom-domains`,SJt=Lh({project:Nh().min(1),hostname:Nh().regex(bJt,`Please enter a valid domain name (e.g. api.example.com)`),environment:Nh().min(1),stage:zh([`api`,`dev-portal`]),isAlias:Fh().optional()}),CJt=({account:e,projectName:t,disabled:n=!1,isManagedDedicatedProject:r=!1,isAkamaiManagedDedicatedProject:i=!1})=>{let a=t===void 0,o=cc(),s=rk({resolver:ik(SJt),defaultValues:{project:t??``,hostname:``,environment:``,stage:`api`,isAlias:i}}),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(`project`),[f,p,m]=s.watch([`isAlias`,`stage`,`project`]),{data:h,isLoading:g}=iF(e.name,m,{enabled:!!m}),{aliasDomains:_}=e.entitlements,{data:v}=PT(e.name),y=v?.find(e=>e.name===m),b=y?NPe(new Date(Number(y.createdOn)),new Date(`2025-04-01`)):!1,x=(v??[]).filter(e=>e.type!==`self-hosted`&&e.deployedEnvironmentCount>0).sort((e,t)=>e.name.localeCompare(t.name)),{data:S,isLoading:C}=FT(e.name,m,{enabled:a&&!!m}),w=a?gJt({projectType:y?.type,defaultConfiguration:S?.defaultConfiguration??[]}):r,T=a?vJt({projectType:y?.type,defaultConfiguration:S?.defaultConfiguration??[]}):i,E=yJt({project:y,isAkamaiManagedDedicatedProject:T}),D=h?h.filter(e=>e.environmentType!==FP.WORKING_COPY):[],O=NKt({onSuccess:()=>{_Jt({stage:p,isManagedDedicatedProject:w,isAkamaiManagedDedicatedProject:T,formIsAlias:f})&&!a&&l(!1)}}),k=(0,H.useCallback)(()=>{s.reset(),O.isSuccess&&O.reset(),d(`project`),l(!1)},[s,O]),A=MP(s.formState.isDirty&&!O.isSuccess,k),j=()=>{l(!1),o(`${lo(Db.Settings,{account:e.name,project:m})}/custom-domain`)},M=a&&v!==void 0&&x.length===0,N=!a||u===`details`,P=g||C;return(0,U.jsxs)(Jw,{open:c,onOpenChange:e=>{e?l(!0):A.guardedClose()},children:[(0,U.jsx)(Yw,{asChild:!0,children:(0,U.jsx)(Y,{"data-test":`create-custom-domain-modal-btn`,disabled:n,title:n?`You reached the limit of custom domains`:``,children:`Add Custom Domain`})}),(0,U.jsxs)(Zw,{children:[(0,U.jsx)(Qw,{children:(0,U.jsx)(eT,{children:`Add Custom Domain`})}),(0,U.jsx)(`div`,{className:`space-y-4`,children:O.isSuccess?(0,U.jsxs)(U.Fragment,{children:[w&&!f&&p===`api`?O.data?.cname?(0,U.jsx)(I7,{customDomain:s.getValues(`hostname`),cname:O.data.cname,documentationUrl:xJt}):(0,U.jsx)(L7,{}):!_&&O.data?.cname&&(0,U.jsx)(I7,{customDomain:s.getValues(`hostname`),cname:O.data?.cname}),!w&&!_&&!O.data?.cname&&p===`api`&&(0,U.jsx)(L7,{}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[a&&(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`view-custom-domain-btn`,onClick:j,children:`View in project`}),(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{"data-test":`ok-create-custom-domain-btn`,children:`Done`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{error:O.error}),(0,U.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,U.jsxs)(UY,{...s,children:[N&&T&&(0,U.jsx)(db,{variant:`info`,children:(0,U.jsx)(pb,{children:`Make sure this hostname is already configured in your Akamai CDN. Registering it here records the alias domain with Zuplo so your public URLs match the client-facing domain.`})}),N&&b&&E&&(0,U.jsxs)(db,{variant:`warning`,children:[(0,U.jsx)(fb,{children:`Preview Notice`}),(0,U.jsxs)(pb,{children:[`Custom domains for the Dev Portal are currently in preview and only available after the migration to our preview version.`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains`,target:`_blank`,children:`Learn more`})]})]}),(0,U.jsx)(`form`,{onSubmit:s.handleSubmit(async t=>{await O.mutateAsync({accountName:e.name,projectName:t.project,isAlias:_Jt({stage:t.stage,isManagedDedicatedProject:w,isAkamaiManagedDedicatedProject:T,formIsAlias:t.isAlias}),hostname:t.hostname,deploymentName:t.environment,stage:t.stage})}),children:a&&u===`project`?(0,U.jsxs)(U.Fragment,{children:[M?(0,U.jsx)(`p`,{className:`mt-2`,children:`You don't have any projects that can use a custom domain yet. Custom domains require a project with a deployed (edge) environment.`}):(0,U.jsx)(WY,{control:s.control,name:`project`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{className:`block`,htmlFor:`project-field`,children:`Which project is this domain for?`}),(0,U.jsxs)(_Y,{value:e.value,onValueChange:t=>{e.onChange(t),s.setValue(`environment`,``),s.setValue(`stage`,`api`),s.setValue(`isAlias`,!1)},disabled:O.isPending,children:[(0,U.jsx)(yY,{id:`project-field`,"data-test":`project-field`,className:`w-full`,children:(0,U.jsx)(vY,{placeholder:`Select a project`})}),(0,U.jsx)(bY,{children:x.map(e=>(0,U.jsx)(xY,{value:e.name,children:e.name},e.id))})]}),(0,U.jsx)(XY,{})]})}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`cancel-create-custom-domain-btn`,children:`Cancel`})}),!M&&(0,U.jsx)(Y,{type:`button`,"data-test":`continue-create-custom-domain-btn`,disabled:!m||P,onClick:()=>d(`details`),children:(0,U.jsx)(aP,{loading:!!m&&P,children:`Continue`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[a&&(0,U.jsxs)(`div`,{className:`mt-2 mb-1 flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Project:`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}),(0,U.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,"data-test":`change-project-custom-domain-btn`,onClick:()=>d(`project`),disabled:O.isPending,children:`Change`})]}),g?(0,U.jsx)(fD,{className:`h-9 mt-4`}):D.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(WY,{control:s.control,name:`environment`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{htmlFor:`environment-field`,children:`Which environment do you want to apply your new domain to?`}),(0,U.jsx)(tF,{id:`environment-field`,"data-test":`environment-field`,environments:D,value:e.value,onValueChange:e.onChange,disabled:O.isPending,placeholder:`Select an environment`}),(0,U.jsx)(XY,{})]})}),E&&(0,U.jsx)(WY,{control:s.control,name:`stage`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{className:`block`,htmlFor:`stage-field`,children:`What do you want the custom domain to be assigned to?`}),(0,U.jsxs)(_Y,{onValueChange:t=>{(t===`api`||t===`dev-portal`)&&e.onChange(t)},disabled:O.isPending,...e,children:[(0,U.jsx)(yY,{id:`stage-field`,className:`w-full`,children:(0,U.jsx)(vY,{placeholder:`Select a stage`})}),(0,U.jsxs)(bY,{children:[(0,U.jsx)(xY,{value:`api`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Tp,{size:16}),` Gateway`]})}),(0,U.jsx)(xY,{value:`dev-portal`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Vp,{size:16}),` Dev Portal`,(0,U.jsx)(BT,{className:``,variant:`info`,children:`New`})]})})]})]}),(0,U.jsx)(XY,{})]})}),(0,U.jsx)(WY,{control:s.control,name:`hostname`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{htmlFor:`hostname-field`,children:`Your custom domain (e.g. example.com or api.example.com)`}),(0,U.jsx)(YT,{type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,"data-test":`hostname-field`,...e,disabled:O.isPending}),(0,U.jsx)(XY,{})]})}),(0,U.jsx)(WY,{control:s.control,name:`isAlias`,render:({field:e})=>(0,U.jsx)(KY,{className:W((!_||p===`dev-portal`||w)&&`hidden`,`mt-2`),children:(0,U.jsxs)(ok,{className:`p-4 flex items-center gap-3`,children:[(0,U.jsxs)(XT,{className:`flex flex-col gap-2`,htmlFor:`isAlias`,children:[`Is this an alias domain?`,(0,U.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`If your API Gateway is behind a CDN or WAF, your clients may use a different domain. Use an`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains#alias-domains`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`alias domain`}),` `,`so public URLs like docs and OpenAPI match the client-facing domain.`]})]}),(0,U.jsx)(hJt,{className:`mx-3`,id:`isAlias`,"data-test":`isAlias`,checked:e.value??!1,onCheckedChange:e.onChange,disabled:O.isPending}),(0,U.jsx)(XY,{})]})})}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[a?(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`back-create-custom-domain-btn`,disabled:O.isPending,onClick:()=>d(`project`),children:`Back`}):(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{type:`button`,"data-test":`cancel-create-custom-domain-btn`,disabled:O.isPending,variant:`secondary`,children:`Cancel`})}),(0,U.jsx)(Y,{type:`submit`,"data-test":`create-custom-domain-btn`,disabled:O.isPending,children:(0,U.jsx)(aP,{loading:O.isPending,children:`Create`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`mt-4`,children:`Custom domains can only be configured on edge deployment environments and this project only has a working-copy environment.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[` `,`For more information on this see our`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/environments`,children:`documentation on environments`}),`.`]}),a&&(0,U.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end`,children:(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`back-create-custom-domain-btn`,onClick:()=>d(`project`),children:`Back`})})]})]})})]})})]})})]}),(0,U.jsx)(jP,{open:A.showConfirm,onOpenChange:A.setShowConfirm,onDiscard:A.handleDiscard})]})},wJt=`https://zuplo.com/docs/dedicated/custom-domains`,TJt=({customDomain:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n})=>{let[r,i]=(0,H.useState)(void 0),a=()=>{s(),i(void 0)},[o,s]=F$(()=>{let i=r?.deployments.at(0)?.stage,o=r?.deployments.at(0)?.cname,s=typeof o==`string`&&o.length>0;return(0,U.jsx)(LP,{onClose:a,isOpen:!0,title:`Configure your custom domain`,children:(0,U.jsx)(`div`,{className:`space-y-4`,children:n?(0,U.jsx)(nJt,{}):t&&i===`api`?s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o,documentationUrl:wJt}):(0,U.jsx)(L7,{}):e.provider===`custom`?(0,U.jsx)(L7,{}):e.provider===`amazon`?s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o,documentationUrl:wJt}):(0,U.jsx)(L7,{}):s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o}):(0,U.jsx)(L7,{})})})},[r]),c=e=>{i(e),o()};return(0,U.jsx)(Y,{onClick:()=>{c(e)},"data-test":`view-domain-configuration-btn`,title:`View Configuration`,variant:`ghost`,size:`icon`,children:(0,U.jsx)(Ep,{size:18})})},EJt=/held zone/i;function DJt(e){return!!e?.some(e=>EJt.test(e))}var OJt=new Set([`pending`,`pending_migration`,`pending_provisioned`,`active_redeploying`,`provisioned`]),kJt=new Set([`blocked`,`pending_blocked`,`moved`,`deleted`,`pending_deletion`,`test_blocked`,`test_failed`]),AJt=new Set([`initializing`,`pending_validation`,`pending_issuance`,`pending_deployment`,`pending_cleanup`,`staging_deployment`,`holding_deployment`]),jJt=new Set([`expired`,`deactivating`,`inactive`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`deleted`,`pending_deletion`,`pending_expiration`]);function MJt(e){if(e.provider===`alias`)return null;if(e.provider===`custom`||e.provider===`amazon`)return{level:`unknown`,label:`Externally managed`,description:`This domain's status isn't reported to Zuplo — verification and certificates are handled by your dedicated infrastructure provider.`};let t=e.verificationErrors&&e.verificationErrors.length>0,n=e.status??null,r=e.sslStatus??null;if(!n&&!r&&!t)return{level:`pending`,label:`Initializing`,description:`We're waiting for the domain provider to report a status. This usually takes a few seconds after the domain is created.`};if(DJt(e.verificationErrors))return{level:`error`,label:`Zone hold`,description:`Cloudflare is blocking this hostname because the parent domain has a zone hold on another Cloudflare account. The zone owner needs to release the hold before we can finish provisioning.`,helpUrl:`https://developers.cloudflare.com/fundamentals/account/account-security/zone-holds/`,helpLabel:`How to release a zone hold`};if(t)return{level:`error`,label:`Needs attention`,description:`The domain provider reported verification errors. Review the details to resolve them.`};if(n&&kJt.has(n))return{level:`error`,label:R7(n),description:`The domain is in a state that prevents it from serving traffic. Contact support if this persists.`};if(r&&jJt.has(r))return{level:`error`,label:`SSL error`,description:`The SSL certificate is in the "${R7(r)}" state. The domain may not serve HTTPS traffic until this is resolved.`};let i=n===`active`||n===`test_active`||n===`test_active_apex`;return i&&(r===`active`||r===`staging_active`||r===`backup_issued`)?{level:`active`,label:`Active`,description:`The domain is verified and serving traffic over HTTPS.`}:i&&r&&AJt.has(r)?{level:`pending`,label:`Issuing certificate`,description:`The domain is verified. We're still provisioning the SSL certificate — this usually takes a few minutes.`}:n&&OJt.has(n)?{level:`pending`,label:`Verifying domain`,description:`We're waiting for DNS verification. Double-check the CNAME record at your DNS provider.`}:n||r?{level:`pending`,label:R7(n??r??`pending`),description:`The domain is still being set up. If this state persists, contact support.`}:{level:`unknown`,label:`Unknown`,description:`No status information is available for this domain.`}}function R7(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var NJt={active:{dot:`bg-green-500`,pulse:!1,pill:`bg-green-50 text-green-700 border-green-200 hover:bg-green-100 dark:bg-green-950 dark:text-green-300 dark:border-green-800 dark:hover:bg-green-900`},pending:{dot:`bg-amber-500`,pulse:!0,pill:`bg-amber-50 text-amber-800 border-amber-200 hover:bg-amber-100 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800 dark:hover:bg-amber-900`},error:{dot:`bg-red-500`,pulse:!1,pill:`bg-red-50 text-red-700 border-red-200 hover:bg-red-100 dark:bg-red-950 dark:text-red-300 dark:border-red-800 dark:hover:bg-red-900`},unknown:{dot:`bg-gray-400`,pulse:!1,pill:`bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700`}},PJt=({domain:e})=>{let t=MJt(e);if(!t)return null;let n=NJt[t.level],r=e.verificationErrors??[];return(0,U.jsxs)(kT,{children:[(0,U.jsx)(AT,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:W(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n.pill),"aria-label":`${e.hostname} status: ${t.label}`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-2 items-center justify-center`,children:[n.pulse&&(0,U.jsx)(`span`,{className:W(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,n.dot)}),(0,U.jsx)(`span`,{className:W(`relative inline-flex size-2 rounded-full`,n.dot)})]}),t.label]})}),(0,U.jsx)(jT,{align:`start`,className:`w-96`,children:(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:W(`inline-flex size-2 rounded-full`,n.dot)}),(0,U.jsx)(`span`,{className:`font-medium`,children:t.label})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:t.description}),t.helpUrl&&(0,U.jsx)(JT,{href:t.helpUrl,className:`text-xs`,children:t.helpLabel??`Learn more`}),r.length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Verification errors`}),(0,U.jsx)(`ul`,{className:`list-disc pl-5 space-y-1 text-destructive-foreground`,children:r.map(e=>(0,U.jsx)(`li`,{children:e},e))})]})]})})]})},FJt=({account:e,currentDomainConfig:t})=>{let{logEvent:n,captureException:r}=S(),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),c=e=>{let t=e.target.value;a(t)},l=FKt(),u=async()=>{try{if(s(``),!t.hostname||t.hostname.trim()===``){s(`The current domain configuration does not have a hostname associated with it`);return}await l.mutateAsync({accountName:e.name,projectName:t.projectName??``,hostname:t.hostname,deploymentName:t.deployments[0]?.deploymentName}),n(`account-custom-domain-delete-success`,{account:e.name}),d()}catch(t){r(t);let i=zb(t);s(i),n(`account-custom-domain-delete-failed`,{account:e.name,errorMessage:i})}},d=()=>{p(),a(``),s(``)},[f,p]=F$(()=>(0,U.jsx)(LP,{onClose:d,isOpen:!0,title:`Delete custom domain`,className:`sm:max-w-xl`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(ak,{error:o,className:`mb-3`}),(0,U.jsxs)(`div`,{className:`text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsxs)(`div`,{className:`relative bg-yellow-100 dark:bg-yellow-950/40 rounded-sm p-4 text-yellow-900 dark:text-yellow-200 text-sm whitespace-pre-line w-full mb-2`,children:[(0,U.jsxs)(`div`,{className:`flex space-x-2 items-center`,children:[(0,U.jsx)(ap,{className:`h-5 w-5 text-yellow-900 dark:text-yellow-200`}),(0,U.jsx)(`span`,{className:`text-sm font-medium antialiased mt-0.5`,children:`Caution: Your project will no longer be accessible with this domain.`})]}),(0,U.jsxs)(`p`,{className:`px-2 mt-4`,children:[`You are about to delete the custom domain`,` `,(0,U.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`from your project. Requests using it will no longer reach your zup.`]})]}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:[`Please type`,` `,(0,U.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`to confirm.`]}),(0,U.jsx)(YT,{className:`mb-4`,type:`text`,autoComplete:`off`,value:i,onChange:c,id:`hostname-field`,"data-test":`hostname-field`}),(0,U.jsx)(`div`,{className:` text-red-500`,children:`I understand the consequences, delete this custom domain`})]}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Y,{onClick:d,"data-test":`cancel-delete-custom-domain-btn`,variant:`outline`,disabled:l.isPending,children:`Cancel`}),(0,U.jsx)(Y,{"data-test":`delete-custom-domain-btn`,onClick:u,disabled:l.isPending||i!==t.hostname,children:(0,U.jsx)(aP,{loading:l.isPending,children:`Delete`})})]})]})}),[l.isPending,o,t,i]);return(0,U.jsx)(Y,{type:`button`,title:`Delete Custom Domain`,onClick:f,"data-test-id":`delete-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,U.jsx)(aP,{loading:l.isPending,children:(0,U.jsx)(Yp,{size:18})})})},IJt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,LJt=({account:e,projectName:t,currentDomainConfig:n})=>{let{logEvent:r,captureException:i}=S(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(n.deployments[0]?.deploymentName),d=n.hostname,{data:f,error:p}=iF(e.name,t),m=zb(p);(0,H.useEffect)(()=>{m&&o(m)},[m]);let h=f?f.filter(e=>e.environmentType!==FP.WORKING_COPY):[],g=PKt(),_=async n=>{if(n.preventDefault(),!l||l.trim()===``){o(`Please select an environment from the options available`);return}if(!d||d.trim()===``){o(`Please provide a value on the custom domain field.`);return}if(d&&!IJt.test(d)){o(`A custom domain value should only be the domain name. It should not start with 'http(s)' and should end with an alpha character.`);return}try{o(``),await g.mutateAsync({accountName:e.name,projectName:t,hostname:d,deploymentName:l}),c(!0),r(`account-custom-domain-edit-success`,{account:e.name})}catch(t){i(t);let n=zb(t);r(`account-custom-domain-edit-failed`,{account:e.name,errorMessage:n}),o(n),c(!1)}},v=()=>{b(),u(n.deployments[0]?.deploymentName),o(``),c(!1)},[y,b]=F$(()=>(0,U.jsx)(LP,{onClose:v,isOpen:!0,title:`Edit your custom domain`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(ak,{error:a}),(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[s===!1&&(0,U.jsxs)(`form`,{onSubmit:_,children:[(0,U.jsx)(`label`,{className:`block mb-2`,htmlFor:`environment-field`,children:`Which environment do you want to apply your custom domain to ?`}),(0,U.jsx)(`div`,{className:`mb-9`,children:(0,U.jsx)(tF,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:l??``,onValueChange:e=>u(e),disabled:g.isPending,placeholder:`Select an environment`})}),(0,U.jsx)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:`Your custom domain`}),(0,U.jsx)(YT,{className:`mb-9`,type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,value:d,disabled:!0,"data-test":`hostname-field`}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Y,{variant:`outline`,type:`button`,onClick:v,"data-test":`cancel-edit-custom-domain-btn`,disabled:g.isPending,children:`Cancel`}),(0,U.jsx)(Y,{"data-test":`save-edit-custom-domain-btn`,type:`submit`,disabled:g.isPending||l===n.deployments[0]?.deploymentName,children:(0,U.jsx)(aP,{loading:g.isPending,children:`Save`})})]})]}),s===!0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,U.jsxs)(`p`,{children:[`Successfully edited custom domain`,` `,(0,U.jsx)(JT,{href:`https://${d}`,children:d}),` `,`to map to deployment `,l]})}),(0,U.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,U.jsx)(Y,{variant:`outline`,className:`w-24 justify-center`,type:`button`,onClick:v,"data-test":`ok-edit-custom-domain-btn`,disabled:!s,children:`OK`})})]})]})]})}),[h,a]),x=()=>{y()};return(0,U.jsx)(Y,{onClick:()=>x(),title:`Edit Custom Domain`,"data-test-id":`edit-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,U.jsx)(aP,{loading:g.isPending,children:(0,U.jsx)(Zee,{size:18})})})},RJt=({classNames:e,projectType:t,feature:n,helpUrl:r})=>(0,U.jsxs)(ok,{variant:`danger`,className:e,children:[(0,U.jsx)(sk,{children:t===`managed-dedicated`?`Managed Dedicated Project`:t===`self-hosted`?`Self Hosted Project`:`Managed Edge Project`}),(0,U.jsx)(uk,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,U.jsxs)(`p`,{className:`leading-loose`,children:[`Your project is running on a `,t===`managed-dedicated`?`managed dedicated`:t===`self-hosted`?`self hosted`:`managed edge hosted`,` environment. For information on how to setup up `,n,`, please refer to`,` `,(0,U.jsx)(JT,{href:r,children:`the documentation`}),`.`]})})]});function zJt(){return(0,U.jsx)(`button`,{type:`button`,disabled:!0,title:`Locked custom domain`,className:`items-center justify-center p-2 hover:bg-gray-100 rounded-sm cursor-pointer`,children:(0,U.jsx)(Ap,{className:`h-5 w-5 mx-auto`,"aria-hidden":`true`})})}var BJt=`Custom Domains`,VJt=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains`,children:`Custom domains`}),` `,`allow you to use your own domain name for your API and developer portal. For complex custom domain configurations, please contact us at`,` `,(0,U.jsx)(JT,{href:`mailto:${Cb}`,children:Cb}),` `,`or use the chat widget at the bottom right.`]}),HJt=()=>{let e=fm([`account`,`project`]),t=IKt(e.account.name,e.project.name),n=FT(e.account.name,e.project.name);if(!t.data||!n.data)return(0,U.jsx)(N7,{title:BJt,description:VJt,children:(0,U.jsx)(f1,{})});let r=t.data?.filter(t=>t.projectName&&t.projectName===e.project.name&&t.deployments[0]).sort((e,t)=>e.deployments[0].deploymentName.localeCompare(t.deployments[0].deploymentName)),i=e.account.customDomainsInUse>=e.account.entitlements.customDomains,a=vJt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),o=gJt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),s=e.project.type!==`self-hosted`&&(a?!!e.account.entitlements.aliasDomains:e.account.entitlements.customDomains>0);return(0,U.jsxs)(N7,{title:BJt,description:VJt,action:s?(0,U.jsx)(CJt,{disabled:!a&&i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}):void 0,children:[i&&e.account.entitlements.customDomains>0&&e.project.type!==`self-hosted`&&!a&&(0,U.jsx)(eJt,{account:e.account,source:`custom-domain-limit`}),!i&&e.project.type!==`self-hosted`&&!a&&(0,U.jsx)(tJt,{used:e.account.customDomainsInUse,max:e.account.entitlements.customDomains,label:`custom domains`,account:e.account,hideAtLimit:!0}),a&&!!e.account.entitlements.aliasDomains&&(0,U.jsx)(db,{variant:`info`,className:`text-sm`,children:(0,U.jsx)(pb,{children:(0,U.jsxs)(`p`,{children:[`This project uses Akamai managed dedicated hosting. Configure the hostname in your Akamai CDN first — see the`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`. Once it's set up there, add the domain using the button above to register it with Zuplo.`]})})}),r.length>0?(0,U.jsx)(ok,{className:`overflow-hidden`,children:r.map(t=>{let n=t.deployments[0],r=o&&n?.stage===`api`,i=t.provider===`custom`&&!r,s=t.provider===`alias`,c=n.stage===`dev-portal`,l=a&&!s||i;return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b px-4 py-3 last:border-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`shrink-0 flex size-9 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:c?(0,U.jsx)(Vp,{className:`size-4`}):(0,U.jsx)(Tp,{className:`size-4`})}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,U.jsxs)(`a`,{href:`https://${t.hostname}`,target:`_blank`,rel:`noreferrer`,className:`font-medium text-sm text-foreground hover:underline inline-flex items-center gap-1 truncate`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:t.hostname}),(0,U.jsx)(_p,{className:`size-3 shrink-0 opacity-60`})]}),(0,U.jsx)(PJt,{domain:t}),n.isDefault&&(0,U.jsx)(BT,{variant:`outline`,className:`text-xs`,children:`Default`}),s&&(0,U.jsx)(BT,{variant:`outline`,className:`text-xs`,children:`Alias`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,U.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:c?`Dev Portal`:`API`}),(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(dGe,{env:n.environmentType??null}),` `,`(`,n.deploymentName,`)`]}),n.branch&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,U.jsx)(wp,{className:`size-3`}),n.branch]})]})]})]})]}),(0,U.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1`,children:[!s&&(0,U.jsx)(TJt,{customDomain:t,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}),l?(0,U.jsx)(zJt,{}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(LJt,{account:e.account,projectName:e.project.name,currentDomainConfig:t}),(0,U.jsx)(FJt,{account:e.account,currentDomainConfig:t})]})]})]},t.id)})}):s?(0,U.jsx)(ok,{children:(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(Tp,{})}),(0,U.jsx)(vb,{children:`No custom domains yet`}),(0,U.jsx)(yb,{children:`Serve your API and developer portal from your own domain name.`})]}),(0,U.jsx)(bb,{children:(0,U.jsx)(CJt,{disabled:!a&&i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a})})]})}):null,e.project.type===`self-hosted`?(0,U.jsx)(RJt,{classNames:``,feature:`custom domains`,helpUrl:`https://zuplo.com/docs/dedicated/custom-domains`,projectType:e.project.type}):a&&!e.account.entitlements.aliasDomains?(0,U.jsx)(nJt,{}):!a&&e.account.entitlements.customDomains<=0?(0,U.jsx)(eJt,{account:e.account,source:`custom-domain`}):null]})},UJt=e=>{let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width>e.getBoundingClientRect().width},WJt=()=>{let[e,t]=(0,H.useState)(!1);return{tooltipProps:(0,H.useMemo)(()=>{if(!e)return{open:!1}},[e]),triggerProps:(0,H.useMemo)(()=>({ref:e=>{e&&t(UJt(e))}}),[])}};function GJt({isSecret:e}){return e?(0,U.jsx)(Ap,{className:`h-4 w-auto`}):(0,U.jsx)(fp,{className:`h-4 w-auto`})}var KJt=({variable:e,asIcon:t=!1})=>(0,U.jsxs)(uzt,{children:[(0,U.jsx)(dzt,{asChild:!0,children:t?(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,className:`flex items-center`,children:(0,U.jsx)(fp,{className:`w-4 h-4`})}):(0,U.jsxs)(Y,{variant:`secondary`,size:`default`,className:`flex items-center gap-2`,children:[(0,U.jsx)(fp,{className:`w-4 h-4`}),`Get Code Snippet`]})}),(0,U.jsxs)(y6,{side:`right`,className:`sm:max-w-none w-1/3 min-w-[500px]`,children:[(0,U.jsx)(`div`,{className:`text-lg font-semibold border-b`,children:`Code Snippets`}),(0,U.jsx)(`p`,{className:`my-2 text-sm`,children:`Use this Code Snippet anywhere in your modules to access your environment variable.`}),(0,U.jsx)(ok,{offset:`md`,className:`bg-gray-200 text-xs `,children:(0,U.jsxs)(`pre`,{id:`codePre`,"data-lang":`typescript`,className:`font-mono text-gray-900 overflow-x-auto`,children:[`import `,`{`,` environment `,`}`,` from "@zuplo/runtime";`,`\r
1580
+ npm run dev`.trim()})]})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,onClick:()=>t(!1),children:`Later`}),(0,U.jsx)(Y,{ref:o,onClick:()=>{s(`working-copy-create-clicked`,{account:r.name,project:i.name}),l.mutate({accountName:r.name,projectName:i.name})},children:(0,U.jsx)(aP,{loading:l.isPending,alternative:(0,U.jsx)(sP,{className:`w-4 h-4 border-2 border-white`}),children:`Create working copy`})})]})]})})},$Gt=()=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-amber-200 bg-amber-100 px-4 py-1.5 text-sm text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-200`,"data-test":`read-only-banner`,children:[(0,U.jsx)(tKt,{className:`min-w-0 flex-1`}),(0,U.jsx)(eKt,{className:`ml-auto shrink-0`})]}),eKt=({switchLabel:e,className:t,onActionClick:n})=>{let{project:r}=fm([`project`]);return VD(r)?(0,U.jsx)(JGt,{className:t,onOpenClick:n}):(0,U.jsx)(nKt,{label:e,className:t,onSwitchClick:n})},tKt=({className:e})=>{let t=fm(),n=t.environment.branchName??null,r=IP(t.environment.environmentType,FP.PRODUCTION),i=VD(t.project);return(0,U.jsxs)(`span`,{className:W(`flex items-center gap-x-2 text-xs`,e),"data-test":`read-only-hint`,children:[(0,U.jsx)(yp,{size:14,className:`shrink-0`,"aria-hidden":!0}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Read-only`}),` — you are viewing`,` `,n?(0,U.jsxs)(U.Fragment,{children:[`the `,(0,U.jsx)(`span`,{className:`font-medium`,children:n}),` branch`]}):r?`the deployed Production environment`:`a deployed environment`,`.`,` `,i?`To make changes, set up local development.`:`To make changes, switch to Development.`]})]})},nKt=({label:e=`Switch to Development`,variant:t=`outline`,size:n=`sm`,className:r,onSwitchClick:i})=>{let a=fm(),o=y7(),{logEvent:s}=S(),c=ZGt(),[l,u]=(0,H.useState)(!1),[d,f]=(0,H.useState)(!1),p=iF(a.account.name,a.project.name).data?.find(e=>IP(e.environmentType,FP.WORKING_COPY)),m=a.environment.branchName??null,h=!!(a.project.sourceRepoUrl&&m&&a.project.hasCurrentUserWorkingCopy&&p),g=c||a.project.hasCurrentUserWorkingCopy,_=c||!!p;return g?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Y,{size:n,variant:t,className:r,onClick:()=>{if(i?.(),s(`read-only-banner-switch-to-development-clicked`,{account:a.account.name,project:a.project.name,environment:a.environment.name,action:c?`setup-working-copy`:h?`checkout-dialog`:`navigate`}),c){f(!0);return}if(h){u(!0);return}p&&o({environment:p})},disabled:!_,"data-test":`read-only-switch-to-development`,children:[(0,U.jsx)(Ky,{size:14}),e]}),(0,U.jsx)(QGt,{open:d,onOpenChange:f}),h&&m&&p&&(0,U.jsx)(rKt,{open:l,onOpenChange:u,branchName:m,workingCopyEnvironment:p})]}):null},rKt=({open:e,onOpenChange:t,branchName:n,workingCopyEnvironment:r})=>{let i=fm(),a=um(),o=y7(),{logEvent:s}=S(),c=dyt(),{data:l,isLoading:u}=nst(r.name,{enabled:e}),d=XGt(l,i.project.defaultBranch,!1,`Checking out`),f=d?.hasLocalWork??!1,p=()=>{s(`read-only-banner-keep-working-copy-clicked`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n}),t(!1),o({environment:r})},m=uyt({onSuccess:()=>{c(i.account.name,i.project.name),t(!1),a.success(`Checked out ${n} in your working copy`,{title:`Success`,icon:(0,U.jsx)($f,{className:`h-4 w-4`})}),o({environment:r})}});return(0,U.jsx)(Jw,{open:e,onOpenChange:e=>{m.isPending||t(e)},children:(0,U.jsxs)(Zw,{"data-test":`checkout-branch-dialog`,children:[(0,U.jsx)(Qw,{children:(0,U.jsx)(eT,{children:`Switch to Development`})}),(0,U.jsxs)(tT,{children:[`Development is your editable working copy. Keep it as it is now, or check out the `,(0,U.jsx)(BT,{variant:`outline`,children:n}),` branch to replace your working copy's files with the latest version of this branch.`]}),d?.hasLocalWork&&(0,U.jsxs)(db,{variant:`warning`,"data-test":`checkout-working-copy-warning`,children:[(0,U.jsx)(Xp,{}),(0,U.jsx)(fb,{children:d.title}),(0,U.jsxs)(pb,{children:[d.detail,` Keep your working copy to switch with them intact.`]})]}),(0,U.jsx)(ak,{error:m.error}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`ghost`,className:`sm:mr-auto`,onClick:()=>{s(`read-only-banner-switch-cancelled`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n}),t(!1)},disabled:m.isPending,"data-test":`checkout-branch-cancel`,children:`Cancel`}),(0,U.jsx)(Y,{variant:`outline`,onClick:p,disabled:m.isPending,"data-test":`checkout-branch-keep`,children:`Just switch`}),(0,U.jsx)(Y,{variant:f?`destructive`:`default`,disabled:m.isPending||u,onClick:()=>{s(`read-only-banner-checkout-branch-confirmed`,{account:i.account.name,project:i.project.name,environment:i.environment.name,branch:n,hasLocalWork:f}),m.mutate({accountName:i.account.name,projectName:i.project.name,branchName:n})},"data-test":`checkout-branch-confirm`,children:(0,U.jsx)(aP,{loading:m.isPending,children:`Checkout & switch`})})]})]})})},iKt=({item:e,isSelected:t,onSelect:n})=>{let r=new Date(e.createdOn),i=IPe(r)?`${RD(r,`H:mm:ss`)} Today`:FPe(r)?`${RD(r,`H:mm:ss ccc d, MMM`)}`:`${RD(r,`H:mm:ss ccc d`)} ${RD(r,`MMM yyy`)}`;return(0,U.jsxs)(`div`,{className:(0,nP.default)(`flex items-center gap-2 px-3 cursor-pointer h-10 border-border border-b`,{"bg-accent text-accent-foreground":t,"hover:bg-accent/50":!t}),onClick:()=>n(),children:[(0,U.jsx)(`div`,{className:`flex justify-center items-center w-5 shrink-0`,children:(0,U.jsx)($G,{deployment:e})}),(0,U.jsx)(`span`,{className:`w-full text-sm truncate`,children:i})]})},aKt={"in-progress":`Building`,success:`Finished`,failed:`Failed`,skipped:`Skipped`},oKt=({status:e})=>aKt[e],sKt={lint:`Lint`,build:`Build`,deploy:`Deploy`},cKt=({step:e})=>sKt[e]??e,x7=r(a(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1);function lKt({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}var uKt=lKt();function dKt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(uKt,``)}var fKt=({logs:e,children:t,className:n})=>(0,U.jsx)(`div`,{className:W(`grid grid-cols-[auto_1fr] auto-rows-min gap-x-5 py-4 text-xs h-full overflow-auto`,`bg-neutral-950 font-mono text-white`,n),children:t||(e.length>0?e.map(({timestamp:e,severity:t,message:n},r)=>(0,U.jsxs)(`div`,{className:W(`grid grid-cols-subgrid col-span-full px-4 py-1 hover:bg-neutral-800 text-neutral-200`,{"text-red-400":t===`error`,"text-yellow-400":t===`warn`,"text-green-500":/^\x1b\[32m/.test(n)}),children:[(0,U.jsx)(`div`,{className:`select-none`,children:(0,x7.default)(e).format(`HH:mm:ss.SSS`)}),(0,U.jsx)(`pre`,{className:`whitespace-pre-wrap`,children:(0,U.jsx)(LPe,{text:dKt(n).trim()})})]},`${e}-${r}`)):(0,U.jsx)(`div`,{className:`text-neutral-300 italic px-4`,children:`No logs available`}))}),pKt=({stage:e,buildLogs:t,isLoading:n})=>(0,U.jsx)(`div`,{className:`divide-y divide-neutral-800`,children:[...e.steps??[]].sort((e,t)=>e.ordinal-t.ordinal).map(r=>{let i=mtt(t,e.stage,r.step),a=rK(i);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-1.5 text-xs font-medium bg-neutral-900 text-neutral-300`,children:[(0,U.jsx)(l1,{status:r.status}),(0,U.jsx)(cKt,{step:r.step}),a>0&&(0,U.jsxs)(BT,{variant:`warn`,children:[a,` warning`,a>1?`s`:``]})]}),(0,U.jsx)(fKt,{logs:i,children:n&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,U.jsx)(fD,{className:`h-4 w-3/6 bg-white/20`}),(0,U.jsx)(fD,{className:`h-4 w-2/6 bg-white/20`})]})})]},r.id)})}),mKt=(e,t)=>e?t(e):void 0,hKt=({deployment:e,defaultOpen:t})=>{let{environment:n}=fm([`environment`]),r=Pit(n.name,e.id,{});return r.isPending?(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(fD,{className:`h-10 w-full`}),(0,U.jsx)(fD,{className:`h-10 w-full`})]}):r.isError?(0,U.jsx)(db,{variant:`warning`,children:(0,U.jsx)(pb,{className:`text-center`,children:(0,U.jsx)(`div`,{className:`text-neutral-600 text-lg`,children:r.error?r.error.status===401||r.error.status===403?`You don't have permission to view build logs for this deployment.`:r.error.status===404?`Deployment not found. The selected deployment may have been deleted or doesn't exist.`:r.error.status===500?`Server error occurred while loading build logs. Please try again or contact support if the problem persists.`:`Unable to load build logs. Please try again or contact support if the problem persists.`:`Could not load logs. Please try again or contact support if the problem persists.`})})}):(0,U.jsx)(ok,{className:`divide-y overflow-hidden`,children:e.stages.map((n,i)=>(0,U.jsx)(gKt,{stage:n,stageIndex:i,stageCount:e.stages.length,buildLogs:r.data,isLoading:r.isLoading,defaultOpen:t},n.id))})},gKt=({stage:e,stageIndex:t,stageCount:n,buildLogs:r,isLoading:i,defaultOpen:a})=>{let o=e.steps&&e.steps.length>0;return(0,U.jsxs)(GT,{defaultOpen:a,children:[(0,U.jsx)(KT,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 p-2 w-full hover:bg-accent cursor-pointer group`,children:[(0,U.jsx)(l1,{status:e.status}),(0,U.jsxs)(`div`,{className:`font-medium`,children:[(0,U.jsxs)(`span`,{className:`font-mono text-xs me-2`,children:[`(`,t+1,`/`,n,`)`]}),`Building `,(0,U.jsx)(cyt,{stage:e.stage})]}),(0,U.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,U.jsx)(oKt,{status:e.status})}),(0,U.jsx)(`div`,{className:`text-xs text-amber-400`,children:mKt(rK(iK(r,e.stage)),e=>(0,U.jsxs)(BT,{variant:`warn`,children:[e,` warning`,e>1?`s`:``]}))}),(0,U.jsx)(`div`,{className:`ms-2 flex items-center justify-center`,children:(0,U.jsx)(ep,{className:`w-4 h-4 transition-transform group-data-[state=closed]:-rotate-90`})})]})}),(0,U.jsx)(qT,{children:o?(0,U.jsx)(pKt,{stage:e,buildLogs:r,isLoading:i}):(0,U.jsx)(fKt,{logs:iK(r,e.stage),children:i&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-0.5 col-span-full px-4`,children:[(0,U.jsx)(fD,{className:`h-4 w-3/6 bg-white/20`}),(0,U.jsx)(fD,{className:`h-4 w-2/6 bg-white/20`})]})})})]})},_Kt=({build:e})=>(0,U.jsx)(`div`,{className:`p-4 w-full`,children:(0,U.jsx)(hKt,{deployment:e,defaultOpen:!0})}),vKt=()=>{let[e,t]=CY(`build`),{environment:n}=fm([`account`,`project`,`environment`]),{data:r}=MGe(n.name),i=r?.data?.find(t=>t.id===e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JJ,{}),(0,U.jsxs)(qJ,{className:`min-h-36 shadow-[rgb(215_215_215/15%)_0px_-4px_3px_0px] dark:shadow-[rgb(0_0_0/40%)_0px_-4px_3px_0px]`,defaultSize:30,children:[(0,U.jsxs)(`div`,{className:`flex gap-2 border-b h-8 items-center justify-between group bg-surface-muted px-3`,children:[(0,U.jsx)(`div`,{className:`divide-neutral-200`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 group rounded-none relative text-xs font-medium`,title:e,children:[(0,U.jsx)(Uee,{size:16}),e?`Build ${e.slice(0,8)}`:`Builds`]})}),(0,U.jsx)(`div`,{className:`flex flex-row gap-2`,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(void 0),children:(0,U.jsx)($p,{size:18})})})]}),(0,U.jsxs)(`div`,{className:`h-[calc(100%-2rem)]`,children:[r?.data?.length===0&&(0,U.jsx)(`div`,{className:`p-3 text-sm`,children:`Start changing your local copy to see build information.`}),(0,U.jsxs)(`div`,{className:`divide-x grid grid-cols-[min-content_1fr] w-full h-full`,children:[(0,U.jsx)(`div`,{className:`overflow-y-auto`,children:r?.data?.map(n=>(0,U.jsx)(iKt,{item:n,isSelected:n.id===e,onSelect:()=>t(n.id)},`${n.id}`))}),(0,U.jsx)(`div`,{className:`overflow-y-auto`,children:e&&i?(0,U.jsx)(_Kt,{build:i}):(0,U.jsx)(`div`,{className:`p-3 text-sm`,children:`Select a build to view more information.`})})]})]})]})]})},S7=`/modules`,C7=`/schemas`;function yKt({showReadOnlyBanner:e=!0}={}){let t=fm(),{editStrategies:n}=x6(),[r,i]=CY(`path`),[a]=CY(`build`),{monaco:o,reloadFiles:c}=v7(),l=bF(c.execute),u=t.environment.name,{isReadOnly:d}=JZ(),{isFileTreeOpen:f,setIsFileTreeOpen:p}=j8(),m=vm(e=>e.projectTreeNodes),[h,g]=Bl(),_=e=>{let t=new URLSearchParams(h);t.set(`path`,e),t.delete(`v`),t.delete(`line`),g(t)},v=`${t.account.name}/${t.project.name}/${t.environment.name}`,[y,b]=(0,H.useState)(!1),[x,S]=(0,H.useState)(v);x!==v&&(S(v),b(!1)),(0,H.useEffect)(()=>{if(y)return;if(r){b(!0);return}if(m.length===0)return;let e=m.find(e=>e.path&&bm.test(e.path));b(!0),e&&i(e.path)},[r,m,i,y]);let C=m.length===0,w=!r&&(C||!y),T=m.find(e=>e.path&&bm.test(e.path))?.path,E=r??``,D=[{label:`Routes`,testId:`sidebar-routes`,icon:(0,U.jsx)(Wmt,{className:`size-[18px]`}),isActive:bm.test(E),disabled:!T,onClick:()=>T&&_(T)},{label:`Policies`,testId:`sidebar-policies`,icon:(0,U.jsx)(Rp,{size:18}),isActive:E===`/config/policies.json`,disabled:!1,onClick:()=>_(`/config/policies.json`)},{label:`Modules`,testId:`sidebar-modules`,icon:(0,U.jsx)(wte,{size:18}),isActive:E===S7,disabled:!1,onClick:()=>_(S7)},{label:`Schemas`,testId:`sidebar-schemas`,icon:(0,U.jsx)(xp,{size:18}),isActive:E===C7,disabled:!1,onClick:()=>_(C7)}],{isError:O,error:A}=k({queryKey:[`reloadFiles`,t.account.name,t.project.name,t.environment.name],queryFn:async({signal:e})=>(await l.current({accountName:t.account.name,projectName:t.project.name,environmentName:t.environment.name},e),!0),refetchOnWindowFocus:!1,enabled:!!o&&!!u});if(O&&A instanceof s)return(0,U.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,U.jsxs)(db,{className:`max-w-md`,children:[(0,U.jsx)(fb,{children:A.title}),(0,U.jsxs)(pb,{className:`flex flex-col gap-2`,children:[zb(A),(0,U.jsx)(BGt,{})]})]})});let j=(0,U.jsxs)(KJ,{direction:`vertical`,autoSaveId:`bottom-pane`,className:`relative`,children:[(0,U.jsx)(qJ,{minSize:10,children:r?(0,U.jsx)(HY,{blastRadius:`feature-dead`,fallback:e=>(0,U.jsx)(Pyt,{...e}),children:(0,U.jsx)(bKt,{})}):w?(0,U.jsx)(xKt,{}):null}),a!==void 0&&(0,U.jsx)(vKt,{})]});return(0,U.jsxs)(`div`,{className:`flex h-full w-full flex-col`,children:[e&&d&&(0,U.jsx)($Gt,{}),(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[!f&&(0,U.jsxs)(`div`,{className:`flex flex-col items-center bg-surface-sunken border-r shrink-0 w-12 py-2 gap-1`,children:[(0,U.jsx)(SKt,{label:`Expand file tree`,onClick:()=>p(!0),testId:`expand-file-tree`,children:(0,U.jsx)(Ete,{size:18})}),(0,U.jsx)(`div`,{className:`my-1 h-px w-6 bg-surface-emphasis`,"aria-hidden":!0}),D.map(e=>(0,U.jsx)(SKt,{label:e.label,onClick:e.onClick,testId:e.testId,isActive:e.isActive,disabled:e.disabled,children:e.icon},e.label)),(0,U.jsx)(`div`,{className:`flex-1`}),(0,U.jsx)(`span`,{className:`text-[10px] font-medium text-neutral-500 uppercase tracking-wider select-none pb-1`,style:{writingMode:`vertical-rl`},children:`Files`})]}),f?(0,U.jsxs)(KJ,{direction:`horizontal`,autoSaveId:`file-tree`,className:`flex-1 min-w-0`,children:[(0,U.jsx)(qJ,{minSize:10,defaultSize:20,className:`bg-surface-sunken min-w-[270px]`,children:(0,U.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between h-10 px-2 border-b shrink-0`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-neutral-600 dark:text-neutral-400 uppercase tracking-wide pl-1`,children:`Files`}),(0,U.jsx)(Y,{variant:`ghost`,size:`icon-xs`,onClick:()=>p(!1),"aria-label":`Collapse file tree`,title:`Collapse file tree`,children:(0,U.jsx)(Tte,{size:14})})]}),(0,U.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,U.jsx)(Myt,{directoryStrategies:n})})]})}),(0,U.jsx)(JJ,{}),(0,U.jsx)(qJ,{minSize:70,children:j})]}):(0,U.jsx)(`div`,{className:`flex-1 min-w-0`,children:j})]})]})}var bKt=()=>{let[e]=CY(`path`);if(!e)throw Error(`Invalid state - FileViewer should not be displayed if no path`);let t=e.toLowerCase();if(t===S7)return(0,U.jsx)(SUt,{});if(t===C7)return(0,U.jsx)(CUt,{});if(t===`/docs/sidebar.json`)return(0,U.jsx)(Ygt,{});if(t.includes(`.oas.json`))return(0,U.jsx)(bUt,{});if(t===`/config/policies.json`)return(0,U.jsx)(MGt,{});if(t.endsWith(`.md`)||t.endsWith(`.mdx`)){let e=t.split(`/`),n=e[e.length-1];return(0,U.jsx)(Jgt,{fileName:n})}return t.endsWith(`.ts`)||t.endsWith(`.css`)?(0,U.jsx)(bQ,{maxHeightVh:100}):t.startsWith(`/schemas`)&&t.endsWith(`.json`)?(0,U.jsx)(bQ,{}):t===`/config/dev-portal.json`?(0,U.jsxs)(`div`,{className:`size-full`,children:[(0,U.jsx)(`div`,{className:`p-4`,children:(0,U.jsx)(IGt,{})}),(0,U.jsx)(bQ,{})]}):(0,U.jsx)(bQ,{})},xKt=()=>(0,U.jsxs)(`div`,{className:`p-6 flex flex-col gap-2`,"data-test":`editor-loading`,children:[(0,U.jsx)(fD,{className:`w-40 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-28 h-4`}),(0,U.jsx)(fD,{className:`w-64 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`}),(0,U.jsx)(fD,{className:`w-56 h-4`})]}),SKt=({label:e,onClick:t,testId:n,isActive:r=!1,disabled:i=!1,children:a})=>(0,U.jsx)($P,{content:e,side:`right`,children:(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":e,"aria-current":r?`page`:void 0,disabled:i,"data-test":n,className:W(`group flex items-center justify-center size-9 rounded-md transition-colors ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,i?`text-neutral-300 dark:text-neutral-700 cursor-not-allowed`:`cursor-pointer`,!i&&(r?`bg-brand/10 text-brand`:`text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 hover:bg-neutral-200 dark:hover:bg-neutral-800`)),children:a})});function CKt(){return(0,U.jsxs)(jpt,{children:[(0,U.jsx)(yKt,{}),(0,U.jsx)(Umt,{})]})}var wKt=`/static/img/hero-Ct8-h_EN.svg`,TKt=`/static/img/hero-dark-Z9HfvwEQ.svg`,EKt=[{label:`Monetization`,value:`monetization`,badge:`Beta`,items:[{title:`Monetization Overview`,description:`Learn more about our first-party metering and billing solution built directly into the Zuplo platform.`,icon:My,link:{href:{web:`https://zuplo.com/docs/articles/monetization/index`,local:`https://zuplo.com/docs/articles/monetization/index`},text:`Read the docs`}},{title:`Monetization Quickstart`,description:`Get up and running with API monetization in minutes using Zuplo's built-in billing and metering.`,icon:By,link:{href:{web:`https://zuplo.com/docs/articles/monetization/quickstart`,local:`https://zuplo.com/docs/articles/monetization/quickstart`},text:`Get Started`}},{title:`Pricing Models`,description:`Explore the different pricing models available for monetizing your APIs with Zuplo.`,icon:Ny,link:{href:{web:`https://zuplo.com/docs/articles/monetization/pricing-models`,local:`https://zuplo.com/docs/articles/monetization/pricing-models`},text:`Read the docs`}}]},{label:`MCP`,value:`mcp`,items:[{title:`Installing the MCP Inspector`,description:`Set up the MCP Inspector locally and start testing your MCP server with ease.`,icon:Fy,link:{href:{web:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`,local:`https://zuplo.com/docs/handlers/mcp-server#mcp-inspector`},text:`Get Started`}},{title:`MCP Quickstart`,description:`Learn how to start using Model Context Protocol to pass context into any model call.`,icon:By,link:{href:{web:`https://zuplo.com/docs/articles/mcp-quickstart`,local:`https://zuplo.com/docs/articles/mcp-quickstart`},text:`Get Started`}},{title:`Using OAuth with MCP`,description:`Authenticate users securely by integrating OAuth flows into your Model Context Protocol setup.`,icon:zy,link:{href:{web:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`,local:`https://zuplo.com/docs/articles/configuring-auth0-for-mcp-auth`},text:`Get Started`}}]},{label:`Rate Limiting`,value:`rate-limiting`,items:[{title:`Adding Rate Limiting`,description:`Control traffic and protect your APIs by setting up flexible, customizable rate limits.`,icon:Ny,link:{href:{web:`https://zuplo.com/docs/articles/step-2-add-rate-limiting`,local:`https://zuplo.com/docs/articles/step-2-add-rate-limiting-local`},text:`Get Started`}},{title:`Complex Rate Limiting`,description:`Implement advanced rules to rate limit by user, IP, plan, or custom logic.`,icon:Py,link:{href:{web:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`,local:`https://zuplo.com/docs/policies/complex-rate-limit-inbound`},text:`Get Started`}},{title:`Dynamic Rate Limits`,description:`Set rate limits that adapt in real-time based on headers, tokens, or user context.`,icon:fge,link:{href:{web:`https://zuplo.com/examples/dynamic-rate-limits`,local:`https://zuplo.com/examples/dynamic-rate-limits`},text:`Get Started`}}]},{label:`Authentication`,value:`authentication`,items:[{title:`Using API Keys`,description:`Authenticate and manage access to your APIs with simple, secure API key workflows.`,icon:_ge,link:{href:{web:`https://zuplo.com/docs/policies/api-key-inbound`,local:`https://zuplo.com/docs/policies/api-key-inbound`},text:`Get Started`}},{title:`Using Auth0`,description:`Connect your APIs to Auth0 for streamlined authentication and powerful identity management.`,icon:Wy,link:{href:{web:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/auth0-jwt-auth-inbound`},text:`Get Started`}},{title:`Using Okta`,description:`Integrate Okta with your APIs to enable secure, enterprise-grade authentication and authorization.`,icon:Iy,link:{href:{web:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`,local:`https://zuplo.com/docs/policies/okta-jwt-auth-inbound`},text:`Get Started`}}]},{label:`Dev Portal`,value:`dev-portal`,items:[{title:`Setup your API Reference`,description:`Instantly generate an interactive reference by importing your OpenAPI spec—no manual work needed.`,icon:vhe,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/api-reference`},text:`Get Started`}},{title:`Adding Authentication`,description:`Guide users through secure API access by adding auth flows to your developer portal.`,icon:Vy,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`,local:`https://zuplo.com/docs/dev-portal/zudoku/configuration/authentication`},text:`Get Started`}},{title:`Creating API Catalogs`,description:`Organize your APIs into searchable, user-friendly catalogs for easier discovery and onboarding.`,icon:My,link:{href:{web:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`,local:`https://zuplo.com/docs/dev-portal/zudoku/guides/using-multiple-apis`},text:`Get Started`}}]}],DKt=({mode:e=`web`})=>(0,U.jsxs)(Gk,{defaultValue:`monetization`,className:`flex flex-col my-8`,children:[(0,U.jsx)(Kk,{className:`flex gap-8 border-b border-surface-border mb-8 ml-1`,children:EKt.map(e=>(0,U.jsxs)(qk,{value:e.value,className:`relative py-2 text-sm font-medium text-gray-600 dark:text-neutral-400 hover:text-gray-900 dark:hover:text-neutral-100 data-[state=active]:text-gray-900 dark:data-[state=active]:text-neutral-100 border-b-2 border-transparent data-[state=active]:border-black dark:data-[state=active]:border-white transition-colors`,children:[e.label,`badge`in e&&e.badge&&(0,U.jsx)(BT,{variant:`invert`,className:`ml-2`,children:e.badge})]},e.value))}),EKt.map(t=>(0,U.jsx)(Jk,{value:t.value,className:`grid grid-cols-3 gap-4`,children:t.items.map(t=>(0,U.jsxs)(ok,{className:`flex flex-col gap-2 text-muted-foreground`,children:[(0,U.jsxs)(sk,{className:`flex gap-2`,children:[(0,U.jsx)(t.icon,{size:24,weight:`duotone`,className:`[&_[opacity='0.2']]:fill-pink-500`}),(0,U.jsx)(ck,{className:`gap-x-2 text-lg font-semibold`,children:t.title})]}),(0,U.jsx)(uk,{children:t.description}),(0,U.jsx)(dk,{className:`flex-1 items-end! border-0 mb-4`,children:(0,U.jsx)(Y,{variant:`outline`,className:`w-full`,asChild:!0,children:(0,U.jsx)(JT,{href:t.link.href[e],variant:`ghost`,children:t.link.text})})})]},t.title))},t.value))]}),OKt=({title:e,url:t,className:n})=>{let{copyToClipboard:r,state:i}=Mw(t??``);return(0,U.jsxs)(ok,{className:W(`col-span-full md:col-span-5 py-2 px-4 flex items-center text-sm gap-x-2`,n),children:[(0,U.jsx)(`div`,{className:`bg-green-600 rounded-full w-4 h-4 p-0.5`,children:(0,U.jsx)($f,{className:`text-white`,size:12})}),(0,U.jsx)(`span`,{className:`font-semibold`,children:e}),(0,U.jsx)(`div`,{className:`flex-1`,children:t?(0,U.jsx)(JT,{href:t,className:`ml-2 font-medium line-clamp-1 break-all`,children:t}):(0,U.jsx)(fD,{className:`ml-2 h-4 w-8/12`})}),(0,U.jsx)(Y,{variant:`secondary`,size:`sm`,onClick:r,children:(0,U.jsxs)(aP,{loading:i===`copied`,alternative:(0,U.jsx)($f,{size:12,className:`text-green-600`,strokeWidth:3}),className:`flex`,children:[(0,U.jsx)(mp,{size:16,className:`mr-2`,strokeWidth:1.5}),`Copy URL`]})})]})},kKt=({size:e=24,...t})=>(0,U.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,fill:`none`,viewBox:`0 0 16 16`,...t,children:(0,U.jsx)(`path`,{fill:`currentColor`,d:`m7.47 12.412 3.348-.592.031-.007-1.722-2.049a291.474 291.474 0 0 1-1.723-2.058c0-.01 1.779-4.909 1.789-4.926a788.95 788.95 0 0 1 2.934 5.066l2.95 5.115.023.039-10.948-.001 3.317-.587zM.9 11.788c0-.003.811-1.412 1.803-3.131L4.507 5.53l2.102-1.764C7.765 2.797 8.714 2 8.717 2a.37.37 0 0 1-.033.085L6.4 6.981l-2.24 4.808-1.63.002c-.897.001-1.63 0-1.63-.003z`})}),AKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{d:`M.778 1.211c-.424-.006-.772.334-.778.758 0 .045.002.09.01.134l3.263 19.811c.084.499.515.867 1.022.872H19.95c.382.004.708-.271.77-.646l3.27-20.03c.068-.418-.216-.813-.635-.881-.045-.008-.089-.011-.133-.01L.778 1.211zM14.52 15.528H9.522L8.17 8.464h7.561l-1.211 7.064z`})}),jKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.606 9.606 0 0112 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48C19.137 20.107 22 16.373 22 11.969 22 6.463 17.522 2 12 2z`})}),MKt=({className:e,size:t=24})=>(0,U.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 24 24`,fill:`currentColor`,className:e,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M22.65 14.39L12 22.13 1.35 14.39a.84.84 0 0 1-.3-.94l1.22-3.78 2.44-7.51A.42.42 0 0 1 4.82 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.49h8.1l2.44-7.51A.42.42 0 0 1 18.6 2a.43.43 0 0 1 .58 0 .42.42 0 0 1 .11.18l2.44 7.51L23 13.45a.84.84 0 0 1-.35.94z`})});function w7({providerName:e,className:t,size:n=24}){switch(e?.toLowerCase()){case`gitlab`:return(0,U.jsx)(MKt,{className:t,size:n});case`bitbucket`:return(0,U.jsx)(AKt,{className:t,size:n});case`azure`:return(0,U.jsx)(kKt,{className:t,size:n});default:return(0,U.jsx)(jKt,{className:t,size:n})}}var NKt=({onSuccess:e}={})=>{let t=bt(),{logEvent:n,captureException:r}=S();return Oe({mutationFn:async e=>(await t.fetch(ae.accounts.createCustomDomain({accountName:e.accountName,isAlias:e.isAlias,projectName:e.projectName,hostname:e.hostname,deploymentName:e.deploymentName,stage:e.stage}))).json(),onSuccess:(t,r)=>{n(`account-custom-domain-creation-success`,{account:r.accountName}),e?.(t)},onError:e=>{n(`account-custom-domain-creation-failed`),r(e)}})},PKt=()=>{let e=bt();return Oe({mutationFn:async t=>{await e.fetch(ae.accounts.editCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},FKt=()=>{let e=bt();return Oe({mutationFn:async t=>{await e.fetch(ae.accounts.deleteCustomDomain({accountName:t.accountName,projectName:t.projectName,hostname:t.hostname,deploymentName:t.deploymentName}))}})},IKt=(e,t)=>Nb(je.customDomains(e,t),{extractData:!0}),LKt=(0,H.forwardRef)(({icon:e,label:t,count:n,expanded:r,onToggle:i,children:a},o)=>(0,U.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-surface-border bg-surface shadow-xs`,children:[(0,U.jsxs)(`button`,{ref:o,type:`button`,onClick:i,"aria-expanded":r,className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-sm transition hover:bg-gray-50 dark:hover:bg-neutral-800`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-gray-800 dark:text-neutral-200`,children:[(0,U.jsx)(e,{size:14,className:`text-gray-500 dark:text-neutral-400`,strokeWidth:2}),t]}),(0,U.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,U.jsx)(BT,{variant:`secondary`,size:`sm`,className:`px-1.5 font-mono`,children:n??0}),r?(0,U.jsx)(np,{size:14,className:`text-gray-500 dark:text-neutral-400`}):(0,U.jsx)(ep,{size:14,className:`text-gray-400 dark:text-neutral-500`})]})]}),r?(0,U.jsx)(`div`,{className:`border-t border-gray-100 dark:border-neutral-800`,children:a}):null]}));LKt.displayName=`ExpandableNode`;var RKt=({selected:e,onChange:t,options:n,listLabel:r,className:i,classNameOptions:a,testId:o,placeholder:s,disabled:c,isLoadingData:l=!1})=>{let u=(0,H.useId)(),d=n.filter(e=>String(e.value)!==``);return(0,U.jsxs)(_Y,{value:e?String(e.value):``,onValueChange:e=>{let n=d.find(t=>String(t.value)===e);n&&t(n)},disabled:c,children:[r?(0,U.jsx)(`span`,{id:u,className:`mb-1 block text-sm font-medium text-foreground`,children:r}):null,(0,U.jsx)(yY,{"data-test":o,className:W(`w-full`,i),"aria-labelledby":r?u:void 0,"aria-label":r?void 0:s,children:l&&e?.icon?(0,U.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(sP,{className:`h-4 w-4`,borderPositionAndSize:`border-l-2`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label})]}):(0,U.jsx)(vY,{placeholder:s})}),(0,U.jsx)(bY,{align:`start`,className:W(`max-h-72`,a),children:d.map((e,t)=>(0,U.jsx)(xY,{"data-test":`${o}-${t}`,value:String(e.value),disabled:e.disabled??!1,description:e.description,children:e.icon?(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e.icon,e.label]}):e.label},`${t}-${e.value}`))})]})};function zKt(e,t=500){let[n,r]=(0,H.useState)(e);return(0,H.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>{clearTimeout(n)}},[e,t]),n}var BKt=({projects:e,isLoadingProjects:t,selectedProject:n,onProjectChange:r})=>(0,U.jsx)(RKt,{testId:`project-selector`,placeholder:`Select Project`,options:(e||[]).map(e=>({label:e.name,value:e.id,icon:(0,U.jsx)(Cp,{className:`mr-1.5`,size:16})})),selected:n,onChange:r,className:`flex-1 items-center w-full h-9`,isLoadingData:t});function VKt({title:e,className:t}){return(0,U.jsx)(`div`,{className:W(`text-2xl font-medium`,t),children:e})}var HKt=({showHeader:e})=>(0,U.jsxs)(U.Fragment,{children:[e&&(0,U.jsx)(VKt,{title:`Source Control Settings`}),(0,U.jsxs)(`div`,{className:`w-full sm:max-w-md md:max-w-2xl lg:max-w-5xl animate-pulse`,children:[e&&(0,U.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`}),(0,U.jsxs)(`div`,{className:`flex flex-col md:flex-row lg:flex-row sm:gap-4`,children:[(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs mr-4 h-10 bg-gray-200 rounded-md dark:bg-gray-700`}),(0,U.jsx)(`div`,{className:`inline-block w-full max-w-sm md:max-w-xs right-0 h-10 bg-gray-200 rounded-md dark:bg-gray-700`})]}),(0,U.jsx)(`div`,{className:`h-5 mt-5 mb-3`,children:(0,U.jsx)(`div`,{className:`h-2.5 bg-gray-200 rounded-full dark:bg-gray-700 mb-9 mt-7 w-[650px]`})}),(0,U.jsx)(`div`,{className:`mt-5 h-96 relative bg-gray-200 rounded-md dark:bg-gray-700`})]})]}),T7=`GITLAB`,E7=`GITHUB`,D7=`BITBUCKET`,O7=`AZURE`,UKt=({installUrl:e,selectedOrg:t,projectName:n,className:r,provider:i=E7,disabled:a,repoDescription:o=`Zuplo API Gateway`,onContinue:s})=>{let{logEvent:c}=S(),[l,u]=(0,H.useState)(!1),d=e=>{c(`source-control-create-repo-continue-clicked`,{sourceControlNamespace:e??`none`,sourceControlProvider:i,project:n}),s?.();let t;switch(i){case O7:t=e?`https://dev.azure.com/${e}/_createproject`:`https://dev.azure.com/`;break;case T7:t=e?`https://gitlab.com/projects/new?namespace_id=${e}`:`https://gitlab.com/projects/new`;break;case D7:t=e?`https://bitbucket.org/repo/create?owner=${e}`:`https://bitbucket.org/repo/create`;break;default:{let r=encodeURIComponent(o);t=e===null?`https://github.com/new?name=${n}&description=${r}`:`https://github.com/organizations/${e}/repositories/new?owner=${e}&name=${n}&description=${r}`;break}}window.open(t),u(!1)};return(0,U.jsxs)(Jw,{open:l,onOpenChange:u,children:[(0,U.jsx)(Yw,{asChild:!0,children:(0,U.jsx)(Y,{className:r,disabled:a,children:`Create new repository`})}),(0,U.jsxs)(Zw,{className:`max-w-xl! w-full`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Create new repository`}),(0,U.jsx)(tT,{})]}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`We're about to help you create a new repository in`,` `,Rb(i),`.`]}),(0,U.jsxs)(`div`,{className:`rounded-md bg-muted/50 p-3 text-sm space-y-2 border`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`What you'll need to do:`}),i===`AZURE`&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsx)(`li`,{children:`Create a project and repository in Azure DevOps`}),(0,U.jsx)(`li`,{children:`Return to Zuplo to connect it`})]}),i===`GITHUB`&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsx)(`li`,{children:`Create your new repository on GitHub`}),(0,U.jsxs)(`li`,{children:[`Ensure the`,` `,(0,U.jsx)(JT,{href:e,children:`Zuplo GitHub App`}),` `,`has access to your new repo`]}),(0,U.jsx)(`li`,{children:`Return to Zuplo to see and connect it`})]}),(i===`GITLAB`||i===`BITBUCKET`)&&(0,U.jsxs)(`ul`,{className:`list-disc list-inside space-y-1 text-muted-foreground`,children:[(0,U.jsxs)(`li`,{children:[`Create your repository in `,Rb(i)]}),(0,U.jsx)(`li`,{children:`Return to Zuplo to connect it`})]})]}),(0,U.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Need help?`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/source-control`,children:`View our troubleshooting guide`})]})]}),(0,U.jsx)($w,{children:(0,U.jsxs)(Y,{"data-test":`navigate-new-${i.toLowerCase()}-repo`,onClick:()=>d(t),children:[`Continue to `,Rb(i)]})})]})]})},WKt=e=>e instanceof s&&e.type===`https://zup.fail/github-integration-monorepo-detected`,GKt=`The GitHub integration connects a repository with a single Zuplo project at its root, so it can't connect this repository. You can still deploy it using the Zuplo CLI in your CI/CD pipeline.`,k7={linkAnyway:{title:`Link existing Zuplo project`,description:`Looks like Zuplo was set up here before, so we'll link your project to the existing repository instead of pushing a new one. Nothing is pushed or pulled automatically; you can commit and push from the portal whenever you're ready.`,actionLabel:`Link project`},monorepo:{title:`This looks like a monorepo`,description:GKt,actionLabel:`Manual setup`},nonEmpty:{title:`This repository isn't empty`,description:GKt,actionLabel:`Manual setup`},pullRequestOpened:{title:`We opened a pull request`,description:`Your default branch requires changes to go through a pull request, so we pushed your project to a setup branch and opened one. Merge the pull request to finish setup and land your project on the default branch.`,actionLabel:`Open pull request`}},A7=`https://zuplo.com/docs/articles/monorepo-deployment`,KKt=new Set([`https://zup.fail/github-integration-invalid-repo`,`https://zup.fail/github-integration-package-json-missing-repo`,`https://zup.fail/create-project-invalid-git-repo`,`https://zup.fail/azure-integration-invalid-repo`]),qKt=e=>WKt(e)?`monorepo`:e instanceof s&&typeof e.type==`string`&&KKt.has(e.type)?`invalidRepo`:`other`,JKt=({accountName:e,projectName:t,orgName:n,repositoryUrl:r,provider:i,handleErrors:a})=>{let{logEvent:o,captureException:s}=S(),[c,l]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),f=aAe(e,t),p={account:e,project:t,sourceControlNamespace:n},m=async(e,t,n)=>{try{if(e===null)throw Error(`Invalid ${Rb(i)} account/organization selected, please try again.`);if(t===null)throw Error(`Invalid repository selected, please try again.`);let r=await(await f.mutateAsync({orgName:e,repositoryURL:t,defaultBranch:`main`,forceConnect:n})).json();r.connected?r.pullRequestUrl?(d(r.pullRequestUrl),o(`source-control-repo-connected-via-pr`,p),l(`pullRequestOpened`)):(o(`source-control-repo-connected`,p),l(null)):r.emptyRepository===!1&&(a(``),o(`source-control-existing-repo-confirm-shown`,p),l(`linkAnyway`))}catch(e){let t=zb(e);switch(qKt(e)){case`monorepo`:a(``),o(`source-control-monorepo-detected`,p),l(`monorepo`);break;case`invalidRepo`:a(``),o(`source-control-nonempty-repo-detected`,p),l(`nonEmpty`);break;default:s(e),o(`source-control-repo-connection-failed`,{...p,errorMessage:t,...v_e(e)}),a(t),l(null)}}};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(AP,{open:c===`linkAnyway`,onOpenChange:e=>{e||(o(`source-control-existing-repo-confirm-cancelled`,p),l(null))},title:k7.linkAnyway.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.linkAnyway.description,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/source-control`,children:`Learn more about source control`})]}),actionLabel:k7.linkAnyway.actionLabel,isPending:f.isPending,onConfirm:()=>{o(`source-control-existing-repo-confirm-confirmed`,p),m(n,r,!0)}}),(0,U.jsx)(AP,{open:c===`monorepo`,onOpenChange:e=>{e||(o(`source-control-monorepo-cancelled`,p),l(null))},title:k7.monorepo.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.monorepo.description,` `,(0,U.jsx)(JT,{href:A7,children:`Learn how to deploy from a monorepo`})]}),actionLabel:k7.monorepo.actionLabel,onConfirm:()=>{o(`source-control-monorepo-manual-setup-clicked`,p),l(null),window.open(A7,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(AP,{open:c===`nonEmpty`,onOpenChange:e=>{e||(o(`source-control-nonempty-repo-cancelled`,p),l(null))},title:k7.nonEmpty.title,description:(0,U.jsxs)(U.Fragment,{children:[k7.nonEmpty.description,` `,(0,U.jsx)(JT,{href:A7,children:`Learn how to deploy from a monorepo`})]}),actionLabel:k7.nonEmpty.actionLabel,onConfirm:()=>{o(`source-control-nonempty-repo-manual-setup-clicked`,p),l(null),window.open(A7,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(AP,{open:c===`pullRequestOpened`,onOpenChange:e=>{e||l(null)},title:k7.pullRequestOpened.title,description:k7.pullRequestOpened.description,actionLabel:k7.pullRequestOpened.actionLabel,onConfirm:()=>{o(`source-control-pr-opened-view-clicked`,p),l(null),u&&window.open(u,`_blank`,`noopener,noreferrer`)}}),(0,U.jsx)(Y,{"data-test":`connect-repo-button`,variant:`outline`,size:`sm`,onClick:()=>{o(`source-control-connect-button-clicked`,{...p,sourceControlProvider:i}),m(n,r,!1)},children:(0,U.jsx)(aP,{loading:f.isPending,children:`Connect`})})]})},YKt=({repositories:e,account:t,project:n,selectedNamespace:r,provider:i,maxItems:a=5,onConnectError:o,newRepoIds:s})=>{let c=i===`azure`;return(0,U.jsx)(U.Fragment,{children:e.slice(0,a).map((e,a)=>(0,U.jsxs)(`div`,{className:(0,nP.default)(`flex flex-row items-center justify-center h-16 border-border px-5 lg:gap-5 gap-2 transition-colors duration-700`,{"border-t":a!==0},{"bg-emerald-50 dark:bg-emerald-950/30":s?.has(e.id)}),children:[(0,U.jsxs)(`div`,{className:`flex text-sm flex-1 gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`font-medium line-clamp-1`,children:e.name}),s?.has(e.id)&&(0,U.jsx)(`span`,{className:`rounded bg-emerald-100 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300`,children:`New`})]}),c&&e.metadata?.projectName?(0,U.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Project: `,e.metadata.projectName]}):(0,U.jsxs)(`span`,{className:`text-muted-foreground hidden md:inline-block lg:inline-block`,children:[`Updated on`,` `,new Date(e.updatedAt).toLocaleDateString([],{day:`numeric`,month:`short`,year:`numeric`})]})]}),e.private&&(0,U.jsxs)(`div`,{className:`flex justify-center items-center text-muted-foreground gap-1`,children:[(0,U.jsx)(Ap,{className:`h-4 w-4`,"aria-hidden":`false`,"aria-label":`Private Git repository`}),(0,U.jsx)(`span`,{className:`hidden lg:block`,children:`Private Repository`})]})]}),(0,U.jsx)(JKt,{accountName:t.name,projectName:n.name,orgName:r?.label||``,repositoryUrl:e.url,provider:i,handleErrors:o})]},e.id))})},XKt={[E7]:{name:`GitHub`,icon:(e=20)=>(0,U.jsx)(jKt,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitHub Account`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? We can help you create a new one.`,selectAccount:`Make sure to select a Git account or organization on the top left.`,grantAccess:`Make sure to grant Zuplo access to the Git account & its repositories you'd like to connect to.`}},[O7]:{name:`Azure DevOps`,icon:(e=20)=>(0,U.jsx)(kKt,{className:`mr-1.5`,size:e}),supportsProjects:!0,placeholder:{namespace:`Select Organization`,project:`Select Project`,search:`Search repositories`},messages:{noRepoInProject:`No repository in this project? Create a new one.`,noRepoAtHand:`No project at hand? We can help you create one.`,selectAccount:`Please select a project to view repositories.`,grantAccess:`No repositories in this project yet.`}},[T7]:{name:`GitLab`,icon:(e=20)=>(0,U.jsx)(wp,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select GitLab Group`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a GitLab group or namespace.`,grantAccess:`Connect your GitLab account to see repositories.`}},[D7]:{name:`Bitbucket`,icon:(e=20)=>(0,U.jsx)(Jf,{className:`mr-1.5`,size:e}),supportsProjects:!1,placeholder:{namespace:`Select Bitbucket Project`,search:`Search repositories`},messages:{noRepoAtHand:`No repository at hand? Create a new one.`,selectAccount:`Select a Bitbucket project.`,grantAccess:`Connect your Bitbucket account to see repositories.`}}},ZKt=e=>XKt[e]||XKt.GITHUB,j7=({account:e,project:t})=>{let{logEvent:n}=S(),r=iAe(e.name),[i,a]=(0,H.useState)(t.name),[o,s]=(0,H.useState)(!1);return{newRepoName:i,setNewRepoName:a,showCreateRepoForm:o,setShowCreateRepoForm:s,createRepoMutation:r,isCreating:r.isPending,handleCreateRepo:async({namespace:o,repoName:c,otherParams:l})=>{let u=c||i||t.name;await r.mutateAsync({projectName:t.name,orgName:o,repositoryName:u,defaultBranch:`main`,otherParams:l}),n(`source-control-repo-created`,{sourceControlRepository:u,sourceControlNamespace:o,account:e.name,project:t.name}),a(``),s(!1)},reset:()=>{s(!1),a(t.name)},transformRepoToRepository:(e,t)=>({id:e.url,url:e.url,provider:t,name:e.name,slug:e.name,defaultBranch:e.defaultBranch,namespace:e.organization,owner:{id:0,name:e.organization},private:!0,updatedAt:new Date().toISOString(),ownerType:e.isUserRepo?`user`:`team`,metadata:e.metadata}),logEvent:n}},QKt=e=>{let{account:t,project:n,sourceControlConfig:r,selectedNamespace:i,searchTerm:a}=e,o=j7(e),[s,c]=(0,H.useState)(null),l=r.provider===O7,{data:u,isLoading:d}=myt(t.name,i?.value||``,{enabled:l&&!!i}),{data:f,isLoading:p}=fyt(t.name),m=o.transformRepoToRepository;return{repositories:(0,H.useMemo)(()=>!f?.data||!i||!s?[]:(f.data[i.label]||[]).filter(e=>e.metadata?.projectName===s.label).filter(e=>!a||e.name.toLowerCase().includes(a.toLowerCase())).map(e=>m(e,`azure`)),[f,i,s,a,m]),isLoadingRepos:p&&!!s,projects:u?.data,selectedProject:s,isLoadingProjects:d,onProjectChange:e=>{c(e),o.logEvent(`source-control-project-selected`,{account:t.name,project:n.name,sourceControlProvider:r.provider})},reset:()=>{c(null),o.reset()}}},$Kt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=j7(e),o=n.provider===D7,{data:s,isLoading:c,refetch:l}=hyt(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{repositories:s?.repositories||[],isLoadingRepos:c,onCreateRepo:async()=>{if(!r)throw Error(`Please select a project`);await a.handleCreateRepo({namespace:r.value}),l()},reset:a.reset,showCreateRepoForm:a.showCreateRepoForm,setShowCreateRepoForm:a.setShowCreateRepoForm,newRepoName:a.newRepoName,setNewRepoName:a.setNewRepoName,isCreating:a.isCreating}},eqt=e=>{let{account:t,sourceControlConfig:n,selectedNamespace:r,searchTerm:i}=e,a=j7(e),o=n.provider===E7,{data:s,isLoading:c}=hyt(t.name,r?r.value:``,i,{enabled:o&&r!==null});return{...a,repositories:s?.repositories||[],isLoadingRepos:c,reset:a.reset}},tqt=e=>{let{account:t,selectedNamespace:n,searchTerm:r}=e,i=j7(e),{data:a}=pyt(t.name),{data:o,isLoading:s,refetch:c}=fyt(t.name),l=i.transformRepoToRepository;return{repositories:(0,H.useMemo)(()=>{if(!o?.data||!n)return[];let e=a?.find(e=>e.installationId===Number(n.value))?.slug||n.label;return(o.data[e]||[]).filter(e=>!r||e.name.toLowerCase().includes(r.toLowerCase())).map(e=>l(e,`gitlab`))},[o,n,r,a,l]),isLoadingRepos:s,onCreateRepo:async()=>{if(!n)throw Error(`Please select a namespace`);await i.handleCreateRepo({namespace:n.value}),c()},reset:i.reset,showCreateRepoForm:i.showCreateRepoForm,setShowCreateRepoForm:i.setShowCreateRepoForm,newRepoName:i.newRepoName,setNewRepoName:i.setNewRepoName,isCreating:i.isCreating}},nqt=250,rqt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=S(),i=n.provider,a=ZKt(i),[o,c]=(0,H.useState)(``),[l,u]=(0,H.useState)(null),[d,f]=(0,H.useState)(``),p=zKt(d,nqt),m=(0,H.useRef)(new Set),h=(0,H.useRef)(null),g=(0,H.useRef)(!1),[_,v]=(0,H.useState)(new Set),[y,b]=(0,H.useState)(!1),{data:x,isLoading:C,isFetching:w,error:T}=pyt(e.name),E=T instanceof s&&T.type===gt.type,D={account:e,project:t,sourceControlConfig:n,selectedNamespace:l,searchTerm:p},O=QKt(D),k=tqt(D),A=$Kt(D),j=eqt(D),M=(()=>{switch(i){case O7:return O;case T7:return k;case D7:return A;default:return j}})();(0,H.useEffect)(()=>{if(x&&x.length>0){let e=x[0];u({label:e.name,value:i===`AZURE`?e.slug:e.installationId.toString(),icon:a.icon(20)})}},[x,i,a]),(0,H.useEffect)(()=>{if(p!==``||M.isLoadingRepos)return;let e=l?.value?.toString()??null,t=M.repositories.map(e=>e.id);if(h.current!==e){h.current=e,m.current=new Set(t),v(new Set),b(!1);return}let n=t.filter(e=>!m.current.has(e));if(n.length>0){for(let e of n)m.current.add(e);g.current=!1,b(!1),v(new Set(n))}else g.current&&(g.current=!1,b(!0))},[M.repositories,M.isLoadingRepos,p,l]);let N=a=>{if(a.value===`add-github-account`){r(`source-control-add-account-selected`,{sourceControlNamespace:a.value,account:e.name,project:t.name,sourceControlProvider:i}),n.installUrl&&(g.current=!0,window.open(n.installUrl));return}r(`source-control-namespace-selected`,{sourceControlNamespace:a.value,sourceControlProvider:i,account:e.name,project:t.name}),c(``),u(a),M.reset()},P=[];x?.forEach(e=>{P.push({label:e.name,value:String(i===`AZURE`?e.slug:e.installationId),icon:a.icon(20)})}),i===`GITHUB`&&P.push({label:`Add GitHub Account`,value:`add-github-account`,icon:(0,U.jsx)(Np,{className:`mr-1.5`,size:16})});let F=()=>a.supportsProjects&&M.selectedProject?M.repositories.length>0?`Showing ${M.repositories.length} repositories from project: ${M.selectedProject.label}`:a.messages.grantAccess:!a.supportsProjects&&M.repositories.length>0?`Showing ${Math.min(M.repositories.length,5)} repositories`:a.supportsProjects&&!M.selectedProject?a.messages.selectAccount:`Select an account to view repositories`,I=()=>(0,U.jsx)(UKt,{installUrl:n.installUrl??``,selectedOrg:l?.label??``,projectName:t.name,provider:i,repoDescription:VD(t)?`Zuplo AI Gateway`:void 0,className:`w-full md:w-auto`,onContinue:()=>{g.current=!0}}),L=C||M.isLoadingRepos,R=!a.supportsProjects||M.selectedProject;return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[E?(0,U.jsxs)(db,{variant:`destructive`,children:[(0,U.jsx)(fb,{children:`Reconnect GitHub`}),(0,U.jsxs)(pb,{children:[(0,U.jsx)(`p`,{children:`Your saved GitHub credentials are no longer valid. Revoke the connection from your profile, then connect GitHub again.`}),(0,U.jsx)(Y,{asChild:!0,variant:`outline`,size:`sm`,className:`mt-2`,children:(0,U.jsx)(Ml,{to:Db.Profile,children:`Go to profile`})})]})]}):(0,U.jsx)(ak,{error:T}),(0,U.jsx)(ak,{error:o}),(0,U.jsxs)(`div`,{className:`mt-2 flex flex-col gap-3 rounded-lg border p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`div`,{className:`text-sm`,children:[(0,U.jsx)(`p`,{className:`font-medium`,children:`Start fresh with a new repository`}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:`We'll set up a ready-to-deploy Zuplo project so GitOps works right away.`})]}),I()]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 my-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,U.jsx)(`span`,{children:`Or connect an existing repository`}),(0,U.jsx)(`span`,{className:`h-px flex-1 bg-border`})]}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`We'll link this project to your repo. You'll push and pull changes manually.`})]}),L&&l===null&&(0,U.jsx)(HKt,{showHeader:!1}),!C&&(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(RKt,{testId:`namespace-selector`,placeholder:a.placeholder.namespace,options:P,selected:l,onChange:N,className:`flex-1 items-center h-9`,isLoadingData:w}),i===`AZURE`&&l&&(0,U.jsx)(BKt,{projects:M.projects,isLoadingProjects:M.isLoadingProjects||!1,selectedProject:M.selectedProject||null,onProjectChange:M.onProjectChange||(()=>{})}),(0,U.jsxs)($Y,{className:`flex-2 w-full`,children:[(0,U.jsx)(tX,{value:d,onChange:e=>f(e.target.value),placeholder:a.placeholder.search}),(0,U.jsx)(eX,{align:`inline-start`,children:(0,U.jsx)(Fp,{className:`opacity-75`})}),d&&(0,U.jsx)(eX,{align:`inline-end`,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-sm`,onClick:()=>f(``),children:(0,U.jsx)($p,{})})})]})]}),(0,U.jsx)(ok,{className:`flex flex-col`,children:M.isLoadingRepos&&R?(0,U.jsxs)(`div`,{className:`flex flex-row items-center p-2 justify-center align-middle h-80`,children:[(0,U.jsx)(sP,{className:`w-4 h-4 mr-2`,borderPositionAndSize:`border-l-2`}),(0,U.jsx)(`span`,{children:`Loading repositories...`})]}):R&&M.repositories.length>0?(0,U.jsx)(YKt,{repositories:M.repositories,account:e,project:t,selectedNamespace:l,provider:i,onConnectError:c,newRepoIds:_}):R?(0,U.jsxs)(`div`,{className:`flex flex-col text-sm text-center gap-2 items-center justify-center h-80`,children:[(0,U.jsx)(`h2`,{className:`text-base`,children:`No Results Found`}),(0,U.jsx)(`p`,{children:d?`Your search for "${d}" did not return any results.`:a.messages.grantAccess})]}):(0,U.jsx)(`div`,{className:`flex items-center justify-center h-80`,children:(0,U.jsx)(`p`,{children:a.messages.selectAccount})})}),i===`GITHUB`&&n.installUrl&&(y?(0,U.jsxs)(db,{variant:`info`,children:[(0,U.jsx)(fb,{children:`Don't see your repository?`}),(0,U.jsxs)(pb,{children:[`Check that you selected the right account above, and that you granted the Zuplo GitHub App access to that repository.`,` `,(0,U.jsx)(JT,{href:n.installUrl,onClick:()=>{g.current=!0},children:`Manage repository access →`})]})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg border border-dashed p-3 text-sm sm:flex-row sm:items-center sm:justify-between`,children:[(0,U.jsxs)(`p`,{children:[(0,U.jsx)(`span`,{className:`font-medium`,children:`Missing repositories? `}),(0,U.jsx)(`span`,{className:`text-muted-foreground`,children:`Zuplo only shows repositories you've granted the Zuplo GitHub App access to.`})]}),(0,U.jsx)(JT,{href:n.installUrl,className:`whitespace-nowrap`,onClick:()=>{g.current=!0},children:`Manage repository access →`})]})),(0,U.jsxs)(`div`,{className:`flex whitespace-pre-line text-gray-500 text-sm justify-between gap-4`,children:[(0,U.jsx)(`span`,{children:F()}),(i===`GITLAB`||i===`BITBUCKET`)&&n.installUrl&&(0,U.jsxs)(JT,{href:n.installUrl,className:`whitespace-pre`,children:[`Adjust `,a.name,` Permissions →`]})]})]})},iqt=({provider:e,url:t,org:n,name:r,children:i})=>(0,U.jsx)(ok,{className:`flex gap-2 flex-col`,offset:`md`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(w7,{providerName:e}),(0,U.jsx)(`div`,{className:`flex flex-col flex-1`,children:(0,U.jsxs)(`a`,{className:`text-sm font-semibold hover:text-zuplo-pink-hover underline flex gap-1 items-center`,href:t,target:`_blank`,rel:`noopener noreferrer`,children:[n,`/`,r,(0,U.jsx)(_p,{className:`h-4 w-4`})]})}),i]})}),aqt=({account:e,project:t})=>{let{logEvent:n}=S(),r=fm([`account`,`project`]);if(!t.sourceRepoUrl)throw Error(`No sourceRepoUrl on project '${r.account.name}'`);let i=t.sourceRepoUrl.replace(`.git`,``),a,o,s=!1;try{s=new URL(t.sourceRepoUrl).hostname===`dev.azure.com`}catch{s=!1}if(s){let e=t.sourceRepoUrl.match(/^https:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)/);if(e){a=e[1];let t=e[2],n=e[3].replace(`.git`,``);a=`${e[1]}/${t}`,o=n}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}}else{let e=t.sourceRepoUrl.split(`/`);a=e[e.length-2],o=e[e.length-1]}let c=oAe(e.name,t.name),l=async()=>{await c.mutateAsync(),n(`source-control-repo-disconnected`,{account:r.account.name,project:r.project.name})};return(0,U.jsx)(iqt,{org:a,name:o,url:i,provider:t.sourceControlProvider.toLowerCase(),children:(0,U.jsx)(Y,{"data-test":`disconnect-repo-button`,onClick:l,variant:`secondary`,className:`self-end`,disabled:c.isPending,children:(0,U.jsx)(aP,{className:`flex items-center gap-1`,loading:c.isPending,children:`Disconnect`})})})},oqt=({provider:e,onClose:t})=>{if(!e)return null;let n=Rb(e);return(0,U.jsx)(Jw,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,U.jsxs)(Zw,{children:[(0,U.jsxs)(Qw,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(w7,{providerName:e.toLowerCase(),size:28}),(0,U.jsxs)(eT,{children:[n,` Integration`]})]}),(0,U.jsxs)(tT,{className:`pt-2`,children:[n,` source control integration is available on Enterprise plans. Contact our sales team or book a demo to learn more about connecting your `,n,` repositories to Zuplo.`]})]}),(0,U.jsxs)($w,{className:`mt-2`,children:[(0,U.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,U.jsx)(JT,{href:`mailto:${Tb}?subject=${encodeURIComponent(`${n} Source Control Integration`)}`,variant:`ghost`,children:`Contact Sales`})}),(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(JT,{href:wb,variant:`ghost`,children:`Book a Demo`})})]})]})})},M7=`sourceControlConnect`,sqt=`sourceControlConnectError`,cqt=`sourceControlConnectSuccess`,lqt=3e5,uqt=1e3;function dqt(e){if(e.key!==`sourceControlConnectSuccess`&&e.key!==`sourceControlConnectError`||!e.newValue)return null;try{return JSON.parse(e.newValue)}catch{return null}}var fqt=()=>{let{logEvent:e}=S(),{error:t}=um(),n=At(),[r,i]=(0,H.useState)(!1),a=(0,H.useRef)(null),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>()=>a.current?.(),[]),{connect:(r,s,c)=>{let{id:l,provider:u,clientId:d,scopes:f,redirectUri:p,providerUrl:m}=s;e(`source-control-provider-clicked`,{provider:u});let h=`${r}::${l}::${crypto.randomUUID()}`;localStorage.removeItem(M7),localStorage.removeItem(sqt),localStorage.removeItem(cqt),localStorage.setItem(M7,h),i(!0);let g;if(u===`GITHUB`?g=f===``?`https://github.com/login/oauth/authorize?client_id=${d}`:`https://github.com/login/oauth/authorize?client_id=${d}&scope=${f}`:u===`GITLAB`?g=`${m}/oauth/authorize?client_id=${d}&redirect_uri=${p}&response_type=code&scope=${f}`:u===`BITBUCKET`?g=`${m}/site/oauth2/authorize?client_id=${d}&response_type=code`:u===`AZURE`&&(g=`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${d}&redirect_uri=${encodeURIComponent(p)}&response_type=code&response_mode=query&scope=${encodeURIComponent(f)}`),!g){i(!1),localStorage.removeItem(M7);return}let _=window.open(g),v=!1,y,b,x;function S(i){let a=dqt(i);if(!(!a||a.connect!==h)){if(i.key===`sourceControlConnectSuccess`){w(()=>{e(`source-control-access-granted`,{account:r,sourceControlProvider:u}),n.invalidateQueries({queryKey:[je.accountsSourceControlConfigurations().url],exact:!1})});return}i.key===`sourceControlConnectError`&&w(()=>{t(a.message??``),c?.onFailure?.()})}}function C(){window.removeEventListener(`storage`,S),y!==void 0&&clearInterval(y),b!==void 0&&clearTimeout(b),x!==void 0&&clearTimeout(x),localStorage.removeItem(M7),localStorage.removeItem(sqt),localStorage.removeItem(cqt),a.current=null,o.current=null}function w(e){v||(v=!0,i(!1),C(),e?.())}if(window.addEventListener(`storage`,S,!1),!_){w(()=>{t(`Couldn't open the ${Rb(u)} sign-in window. Your browser may be blocking pop-ups; allow them for this site and try again.`),e(`source-control-connect-popup-blocked`,{account:r,sourceControlProvider:u}),c?.onFailure?.()});return}y=setInterval(()=>{let n=!1;try{n=_.closed}catch{return}n&&(y!==void 0&&clearInterval(y),b=setTimeout(()=>{w(()=>{t(`We didn't get a response from the ${Rb(u)} sign-in window. Please try again.`),e(`source-control-connect-abandoned`,{account:r,sourceControlProvider:u}),c?.onFailure?.()})},uqt))},500),x=setTimeout(()=>{w(()=>{t(`Connecting to ${Rb(u)} timed out. Please try again.`),e(`source-control-connect-timeout`,{account:r,sourceControlProvider:u}),c?.onFailure?.()})},lqt),a.current=C,o.current={account:r,provider:u}},isConnecting:r,cancel:()=>{let t=o.current;t&&e(`source-control-connect-abandoned`,{account:t.account,sourceControlProvider:t.provider}),a.current?.(),i(!1)}}},pqt=({accountName:e,sourceControlConfig:t})=>{let{connect:n,isConnecting:r,cancel:i}=fqt(),{provider:a}=t;return(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Y,{variant:`outline`,className:`gap-2`,disabled:r,onClick:()=>n(e,t),children:(0,U.jsx)(aP,{loading:r,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(w7,{providerName:a}),(0,U.jsx)(`span`,{children:`Connect to ${Rb(a)}`})]})})}),r&&(0,U.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:i,children:`Cancel`})]})},mqt=[{key:T7,label:`GitLab`},{key:D7,label:`Bitbucket`}],hqt=({account:e,project:t,sourceControlConfig:n})=>{let{logEvent:r}=S(),[i,a]=(0,H.useState)(null);if(n?.userHasCredentials&&t.sourceRepoUrl)return(0,U.jsx)(aqt,{account:e,project:t});if(n&&!t.sourceRepoUrl&&n.userHasCredentials)return(0,U.jsx)(rqt,{account:e,project:t,sourceControlConfig:n});let o=n?Rb(n.provider):null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ok,{offset:`md`,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`text-sm whitespace-pre-line text-gray-500`,children:[n&&t.sourceRepoUrl&&(0,U.jsxs)(`p`,{className:`mb-3`,children:[`This project is currently associated with a `,o,` `,`repository but you have not connected to your `,o,` `,`account.`]}),(0,U.jsx)(`p`,{children:`Connect to a source control provider to enable source control on your project.`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n&&(0,U.jsx)(pqt,{accountName:e.name,sourceControlConfig:n}),mqt.map(({key:e,label:t})=>(0,U.jsxs)(Y,{variant:`outline`,className:`gap-2`,onClick:()=>{r(`source-control-provider-clicked`,{provider:e}),a(e)},children:[(0,U.jsx)(w7,{providerName:e.toLowerCase(),size:20}),(0,U.jsxs)(`span`,{children:[`Connect to `,t]})]},e))]})]}),(0,U.jsx)(oqt,{provider:i,onClose:()=>a(null)})]})},gqt=()=>Nb(je.accountsSourceControlConfigurations()),_qt=()=>{let{account:e,project:t}=fm([`account`,`project`]),{logEvent:n}=S();return(0,U.jsxs)(`div`,{className:`flex flex-col space-y-4`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Support`}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Ote,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Talk to an API expert`}),(0,U.jsx)(lk,{children:`Get a free technical consultation with one of our API experts.`})]}),(0,U.jsx)(Y,{onClick:()=>{n(`getting-started-book-a-meeting-clicked`,{account:e.name}),window.open(wb,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(JT,{href:wb,variant:`ghost`,children:[(0,U.jsx)(Zf,{}),`Book a Meeting`]})})]})}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Op,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Feeling Stuck?`}),(0,U.jsx)(lk,{children:`Check out our various support options to get help with your API`})]}),(0,U.jsx)(Y,{className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(Ml,{to:lo(Db.Support,{account:e.name}),children:[(0,U.jsx)(Op,{}),`Get Help`]})})]})}),(0,U.jsx)(ok,{offset:`md`,className:`p-6`,children:(0,U.jsxs)(`div`,{className:`flex w-full gap-4 items-center`,children:[(0,U.jsx)(`div`,{className:`rounded-lg bg-gray-100 dark:bg-neutral-800 w-20 h-20 grid place-items-center`,children:(0,U.jsx)(Ote,{size:38,strokeWidth:1.6,fill:`#FF99E5`,fillOpacity:.2})}),(0,U.jsxs)(`div`,{className:`flex-1`,children:[(0,U.jsx)(ck,{className:`text-base`,children:`Join the Zuplo API Community`}),(0,U.jsx)(lk,{children:`Come chat with fellow Zuplo users and the Zuplo team in our Discord channel.`})]}),(0,U.jsx)(Y,{onClick:()=>{n(`getting-started-join-discord-clicked`,{account:e.name,project:t.name}),window.open(Sb,`_blank`)},className:`min-w-40`,variant:`secondary`,asChild:!0,children:(0,U.jsxs)(JT,{href:Sb,variant:`ghost`,children:[(0,U.jsx)(bte,{size:16}),`Join Us`]})})]})})]})},vqt=()=>{let{account:e,project:t,environment:n}=Pb([`account`,`project`,`environment`]);return(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{className:`text-base`,children:`Welcome to your Gateway`}),(0,U.jsx)(lk,{className:`text-base`,children:`You can get started by configuring your routes and setting up policies in our visual Route Designer.`})]}),(0,U.jsxs)(dk,{className:`border-0 gap-2 py-6`,children:[(0,U.jsx)(Y,{asChild:!0,size:`sm`,className:`gap-2 px-8`,variant:`brand-outline`,children:(0,U.jsxs)(Ml,{to:lo(Db.Code,{account:e,project:t,environment:n}),children:[(0,U.jsx)(fp,{size:16}),`Start Building`]})}),(0,U.jsx)(Y,{className:`px-8`,variant:`secondary`,size:`sm`,asChild:!0,children:(0,U.jsxs)(JT,{variant:`ghost`,href:`https://zuplo.com/docs/articles/step-1-setup-basic-gateway`,children:[(0,U.jsx)(Sp,{size:16}),`Quickstart`]})})]})]})},yqt=()=>{let[e,t]=(0,H.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(ok,{className:`col-span-full md:col-span-3 py-2 px-4 flex items-center text-sm gap-x-2`,children:[(0,U.jsx)(`div`,{className:`rounded-full w-4 h-4 p-0.5 bg-gray-500`,children:(0,U.jsx)(dp,{className:`text-white`,size:12})}),(0,U.jsx)(`span`,{className:`font-semibold flex-1 line-clamp-1 break-all`,children:`Developer Portal`}),(0,U.jsxs)(Y,{variant:`secondary`,size:`sm`,onClick:()=>t(!0),children:[(0,U.jsx)(Sp,{}),`Open\xA0Portal`]})]}),(0,U.jsx)(Jw,{open:e,onOpenChange:t,children:(0,U.jsxs)(Zw,{children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:`Run Developer Portal Locally`}),(0,U.jsx)(tT,{children:`To view and edit your API documentation, you need to run the developer portal locally.`})]}),(0,U.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{className:`text-sm font-semibold`,children:`Steps to run the portal:`}),(0,U.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 text-sm text-gray-600`,children:[(0,U.jsxs)(`li`,{children:[`Open a terminal in the`,` `,(0,U.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`/docs`}),` `,`folder of your Zuplo project`]}),(0,U.jsxs)(`li`,{children:[`Run`,` `,(0,U.jsx)(`code`,{className:`bg-gray-100 px-1 rounded-sm`,children:`npm run dev`})]}),(0,U.jsx)(`li`,{children:`The portal will open in your browser automatically`})]})]}),(0,U.jsx)(`div`,{className:`bg-info-muted border border-blue-200 dark:border-blue-800 rounded-md p-3`,children:(0,U.jsxs)(`p`,{className:`text-xs text-blue-800 dark:text-blue-200`,children:[(0,U.jsx)(`strong`,{children:`Tip:`}),` The developer portal will automatically reload when you make changes to your OpenAPI documentation.`]})})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Y,{variant:`secondary`,onClick:()=>t(!1),children:`Close`}),(0,U.jsx)(Y,{asChild:!0,variant:`outline`,children:(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dev-portal`,children:`View Documentation`})})]})]})})]})},bqt=()=>{let{project:e,environment:t}=fm(),n=vF(t);return(0,U.jsx)(`div`,{className:`bg-neutral-50 dark:bg-neutral-950 h-full overflow-y-auto`,children:(0,U.jsxs)(`div`,{className:`pt-4 max-w-6xl pb-16 m-auto px-5 flex flex-col gap-4`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e.name}),(0,U.jsxs)(`div`,{className:`grid grid-cols-8 gap-3`,children:[(0,U.jsx)(OKt,{title:`Gateway`,url:n}),(0,U.jsx)(yqt,{})]}),(0,U.jsxs)(ok,{className:`relative grid md:grid-cols-2 overflow-hidden min-h-[220px]`,children:[(0,U.jsx)(vqt,{}),(0,U.jsxs)(`div`,{className:`hidden md:block self-end h-full w-full`,children:[(0,U.jsx)(`img`,{src:wKt,alt:e.name,className:`w-full h-full object-cover object-left dark:hidden`}),(0,U.jsx)(`img`,{src:TKt,alt:``,"aria-hidden":!0,className:`hidden w-full h-full object-cover object-left dark:block`})]})]}),(0,U.jsx)(DKt,{mode:`local`}),(0,U.jsx)(_qt,{})]})})},xqt=()=>Xe().brand,Sqt=({account:e,accountLabel:t,navigateTo:n})=>{let{data:r,isLoading:i}=PT(e),a=$Ee(e),o=i||a.isLoading,s=t||e,c=nDe(r,a).sort((e,t)=>e.name.toLowerCase().localeCompare(t.name.toLowerCase()));return o?(0,U.jsx)(oT,{heading:s,forceMount:!0,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-3 text-sm text-muted-foreground`,"aria-live":`polite`,children:[(0,U.jsx)(kp,{className:`h-4 w-4 animate-spin`}),(0,U.jsx)(`span`,{children:`Loading projects...`})]})}):(0,U.jsx)(oT,{heading:s,children:c.map(r=>(0,U.jsxs)(sT,{value:`${e}/${r.name}`,keywords:t?[r.name,e,t]:[r.name,e],onSelect:()=>n(lo(Db.Overview,{account:e,project:r.name})),children:[(0,U.jsx)(Gf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{children:r.name})]},r.id))})},Cqt=({accounts:e,navigateTo:t})=>{let n=e?.map(e=>e.name)??[],r=eAe(n),i=eDe(n),a=[...e??[]].sort((e,t)=>(e.label||e.name).toLowerCase().localeCompare((t.label||t.name).toLowerCase())),o=(e??[]).flatMap((e,t)=>i[t]?nDe(r[t]?.data,i[t]).map(t=>({account:e,project:t})):[]).sort((e,t)=>e.project.name.toLowerCase().localeCompare(t.project.name.toLowerCase()));return(0,U.jsxs)(oT,{children:[a.map(e=>(0,U.jsxs)(sT,{value:e.name,keywords:[e.label||e.name,e.name],onSelect:()=>t(lo(Db.AccountProjects,{account:e.name})),children:[(0,U.jsx)(Xf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.label||e.name}),e.label&&e.label!==e.name&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:e.name}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:`Account`})]},`account:${e.name}`)),o.map(({account:e,project:n})=>(0,U.jsxs)(sT,{value:`${e.name}/${n.name}`,keywords:e.label?[n.name,e.name,e.label]:[n.name,e.name],onSelect:()=>t(lo(Db.Overview,{account:e.name,project:n.name})),children:[(0,U.jsx)(Gf,{className:`mr-3 h-4 w-4 text-neutral-600`}),(0,U.jsx)(`span`,{className:`truncate`,children:n.name}),(0,U.jsx)(`span`,{className:`ml-auto shrink-0 pl-3 text-xs text-muted-foreground`,children:e.label||e.name})]},n.id))]})},wqt=({accounts:e,navigateTo:t,search:n})=>n.trim()?(0,U.jsx)(Cqt,{accounts:e,navigateTo:t}):(0,U.jsxs)(U.Fragment,{children:[e?.map(e=>(0,U.jsx)(Sqt,{navigateTo:t,account:e.name,accountLabel:e.label},`projects-${e.name}`)),(0,U.jsx)(oT,{heading:`Accounts`,children:e?.map(e=>(0,U.jsxs)(sT,{keywords:[e.label||e.name,e.name],onSelect:()=>{t(lo(Db.AccountProjects,{account:e.name}))},children:[(0,U.jsx)(Xf,{className:`mr-2 h-4 w-4`}),(0,U.jsx)(`span`,{children:e.label||e.name}),e.label&&e.label!==e.name&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:e.name})]},e.name))})]}),Tqt=`__zuplo_commander_ask_ai__`,Eqt=.5,Dqt=(e,t,n)=>{if(e===`__zuplo_commander_ask_ai__`)return Eqt;let[r=e,...i]=n??[],a=Bw(r,t);if(a>0)return 2+a;let o=i.reduce((e,n)=>Math.max(e,Bw(n,t)),0);return o>0?1+o:0},Oqt=({query:e,onSelected:t})=>{let n=dpt(),{logEvent:r}=S();if(!n?.enabled)return null;let i=e.trim();return(0,U.jsx)(oT,{children:(0,U.jsxs)(sT,{value:Tqt,onSelect:()=>{r(`agent-z-panel-opened`,{source:`command-palette`}),n.openWithPrompt(i),t()},children:[(0,U.jsx)(`div`,{className:`mr-2`,children:(0,U.jsx)(Gy,{weight:`fill`,"aria-hidden":!0})}),(0,U.jsx)(`span`,{children:`Ask AI`}),i&&(0,U.jsx)(`span`,{className:`ml-2 truncate text-xs text-muted-foreground`,children:`"${i}"`})]})})},kqt=({account:e,navigateTo:t,project:n,environment:r})=>(0,U.jsx)(oT,{heading:`Files`,children:vm(e=>e.projectTreeNodes).filter(e=>e.path&&e.type===Zl.File).map(i=>(0,U.jsxs)(sT,{onSelect:()=>t(lo(`${Db.Code}?path=${i.path}`,{account:e,project:n,environment:r})),children:[(0,U.jsx)(`div`,{className:`mr-3`,children:(0,U.jsx)($ee,{className:`h-4 w-4 text-neutral-500`})}),(0,U.jsx)(`span`,{className:`line-clamp-1`,children:i.path.substring(1)})]},i.path))}),Aqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`bg-surface-sunken`,t),children:e}),jqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`pt-4 max-w-6xl pb-16 m-auto px-5 w-full`,t),children:e}),Mqt=({children:e,className:t,muted:n})=>(0,U.jsx)(`div`,{className:W(`bg-background`,n&&`bg-surface-sunken`),children:(0,U.jsx)(`div`,{className:W(`py-6 max-w-6xl mx-auto px-5 min-h-20 flex items-center w-full`,t),children:e})}),Nqt=({children:e,className:t})=>(0,U.jsx)(`div`,{className:W(`text-sm text-foreground`,t),elementtiming:`page-description`,children:e}),Pqt=({children:e,className:t})=>(0,U.jsx)(`h1`,{className:W(`text-2xl font-semibold tracking-tight`,t),elementtiming:`page-title`,children:e});(0,H.createContext)(void 0);var Fqt=yF(`div`,`grid grid-cols-subgrid col-span-full w-full items-center border-b px-4 py-3 last:border-0`),Iqt=yF(`div`,`grid grid-cols-subgrid col-span-full w-full items-center border-b px-4 py-2.5 text-xs font-medium uppercase tracking-wide text-muted-foreground`),N7=({title:e,description:t,action:n,children:r,contentClassName:i})=>(0,U.jsxs)(Aqt,{className:`min-h-full`,children:[(0,U.jsx)(`div`,{className:`border-b`,children:(0,U.jsx)(Mqt,{muted:!0,children:(0,U.jsxs)(`div`,{className:`flex w-full flex-wrap items-start justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(Pqt,{children:e}),t&&(0,U.jsx)(Nqt,{className:`text-muted-foreground`,children:t})]}),n]})})}),(0,U.jsx)(jqt,{className:W(`flex flex-col gap-5`,i),children:r})]});function Lqt({assignment:e,children:t,onOpenChange:n}){let[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),{startOpening:s,renderTrigger:c}=Jct(),l=(0,H.useCallback)(()=>{o(!1),n?.(!1),i(!1)},[n]),u=MP(a,l);return(0,U.jsxs)(Jw,{open:r,onOpenChange:e=>{e?(n?.(!0),s(()=>i(!0))):u.guardedClose()},children:[(0,U.jsx)(Yw,{asChild:!0,children:c(t)}),(0,U.jsxs)(Zw,{className:`sm:max-w-4xl max-h-[90vh] overflow-hidden flex flex-col`,children:[(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{children:(0,U.jsx)(Z,{children:`Edit AI Provider`})}),(0,U.jsx)(tT,{children:(0,U.jsxs)(Z,{children:[`The Provider Name is the routing address used in`,` `,(0,U.jsx)(`code`,{className:`font-mono`,translate:`no`,children:`providerName/model`}),` `,`references and cannot be changed.`]})})]}),(0,U.jsx)(Rqt,{assignment:e,onDirtyChange:o,onClose:l})]}),(0,U.jsx)(jP,{open:u.showConfirm,onOpenChange:u.setShowConfirm,onDiscard:u.handleDiscard})]})}var Rqt=({assignment:e,onDirtyChange:t,onClose:n})=>{let r=QY(),{logEvent:i}=S(),a=um(),o=wX(),s=(0,H.useRef)(null),c=bt(),{account:l,project:u}=Pb([`account`,`project`]),{project:d}=fm([`project`]),{data:f,providers:p}=OX().data,m=e.provider===`Custom`?e.customProviderName??e.provider:e.provider,h=p[m],g=h?.isCustom===!0,_=(0,H.useMemo)(()=>[...f[m]??[]].sort((e,t)=>AX(e.model,t.model)),[f,m]),v=(0,H.useMemo)(()=>{try{return JSON.parse(e.metadata)}catch{return{}}},[e.metadata]),y=rk({defaultValues:{provider:m,customProviderName:e.customProviderName,label:e.label,apiKey:``,envVarName:e.envVarName,region:GPe(e.endpointUrl)??YPe(e.endpointUrl)??rFe(e.endpointUrl)??``,awsAccessKeyId:``,awsSecretAccessKey:``,gcpProjectId:e.gcpProjectId??``,azureResourceName:YD(e.endpointUrl)?.resourceName??``,azureHostSuffix:YD(e.endpointUrl)?.hostSuffix??`openai.azure.com`,deploymentModels:pFe(e.deploymentModels),models:{completions:v.models?.completions??[],embeddings:v.models?.embeddings??[]},...g?{customModels:_.map(e=>({modelId:e.id,name:e.model,kind:e.kind,status:e.status===`deprecated`?`deprecated`:`active`,inputCostPerToken:e.inputCostPerToken,outputCostPerToken:e.outputCostPerToken,cachedInputCostPerToken:e.cachedInputCostPerToken,cacheWriteCostPerToken:e.cacheWriteCostPerToken}))}:{}},mode:`onChange`,resolver:ik(zct),shouldFocusError:!1}),{isDirty:b}=SO(y);(0,H.useEffect)(()=>{t(b)},[b,t]);let x=Oe({mutationFn:async t=>{if(g&&h?.id){let e=sct(_,t.customModels);for(let t of e.deleted)await c.fetch(ae.ai.deleteAiProviderModel(o,h.id,t));for(let t of e.repriced)await c.fetch(ae.ai.updateAiProviderModel(o,h.id,t.id,{inputCostPerToken:t.inputCostPerToken,outputCostPerToken:t.outputCostPerToken,cachedInputCostPerToken:t.cachedInputCostPerToken,cacheWriteCostPerToken:t.cacheWriteCostPerToken}));for(let t of e.created)await c.fetch(ae.ai.createAiProviderModel(o,h.id,{model:t.name,kind:t.kind,inputCostPerToken:t.inputCostPerToken,outputCostPerToken:t.outputCostPerToken,cachedInputCostPerToken:t.cachedInputCostPerToken,cacheWriteCostPerToken:t.cacheWriteCostPerToken,status:`active`}))}let n=aFe(t),r=UD(t);return await c.fetch(ae.ai.updateAiProviderAssignment(l,u,e.id,{envVarName:t.envVarName,...r?{value:r}:{},...n?{endpointUrl:n}:{},...t.provider===`VertexAI`&&t.gcpProjectId?.trim()?{gcpProjectId:t.gcpProjectId.trim()}:{},...t.provider===`AzureAI`?{deploymentModels:XD(t.deploymentModels)??{}}:{},metadata:{models:cct(t,g)}}))},onSuccess:(e,t)=>{VD(d)&&UD(t)&&a.success((0,U.jsx)(Z,{children:`Key updated. Your gateway is redeploying — this usually takes a minute or two.`}),{duration:VPe}),y.reset(y.getValues()),n()},onSettled:(t,n)=>r(`provider.updated`,n?`failed`:`succeeded`,{provider:e.provider})});return(0,U.jsx)(UY,{...y,children:(0,U.jsxs)(`form`,{onSubmit:y.handleSubmit(e=>x.mutate(e),t=>i(`ai-gateway-update-ai-provider-invalid`,{provider:e.provider,fields:Uct(t)})),className:`flex flex-col flex-1 min-h-0`,children:[(0,U.jsx)(ak,{error:x.error,className:`mb-4 break-all`}),(0,U.jsx)(qct,{form:y,scrollAreaRef:s,title:(0,U.jsx)(Z,{children:`Your changes weren't saved.`}),className:`mb-4`}),(0,U.jsx)(`div`,{ref:s,className:`flex-1 min-h-0 overflow-y-auto px-1 space-y-4`,children:(0,U.jsx)(mct,{form:y,mode:`edit`,providerDisabled:!0})}),(0,U.jsxs)($w,{className:`mt-4`,children:[(0,U.jsx)(Y,{type:`button`,variant:`ghost`,onClick:n,disabled:x.isPending,children:(0,U.jsx)(Z,{children:`Cancel`})}),(0,U.jsx)(Y,{type:`submit`,disabled:x.isPending,children:(0,U.jsx)(aP,{loading:x.isPending,children:(0,U.jsx)(Z,{children:`Save`})})})]})]})})},zqt=e=>e.label,P7=12,Bqt=(0,U.jsx)(Z,{children:`Connect API keys for providers like OpenAI and Anthropic and choose which models your gateway is allowed to route to.`}),Vqt=()=>(0,U.jsx)(H.Suspense,{fallback:null,children:(0,U.jsx)(BX,{children:(0,U.jsxs)(Y,{children:[(0,U.jsx)(Np,{size:16}),(0,U.jsx)(Z,{children:`Add Provider`})]})})}),Hqt=()=>(0,U.jsx)(MX,{source:`providers-page`,children:(0,U.jsxs)(Y,{variant:`outline`,children:[(0,U.jsx)(Ste,{size:16}),(0,U.jsx)(Z,{children:`Request a provider or model`})]})}),Uqt=()=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[(0,U.jsx)(Hqt,{}),(0,U.jsx)(Vqt,{})]}),Wqt=()=>(0,U.jsx)(U.Fragment,{children:[0,1].map(e=>(0,U.jsxs)(ok,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 p-5`,children:[(0,U.jsx)(fD,{className:`size-10 rounded-lg`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(fD,{className:`h-5 w-48`}),(0,U.jsx)(fD,{className:`h-3 w-32`})]})]}),(0,U.jsx)(`div`,{className:`border-t`}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 p-5`,children:[(0,U.jsx)(fD,{className:`h-3 w-24`}),(0,U.jsx)(fD,{className:`h-4 w-full max-w-2xl`})]})]},e))}),Gqt=()=>{let e=QY(),{account:t,project:n}=Pb([`account`,`project`]),r=Mb(je.aiProviderAssignments(t,n)),i=bt(),a=Oe({mutationFn:async e=>i.fetch(ae.ai.deleteAiProviderAssignment(t,n,e)),onSettled:(t,n)=>e(`provider.deleted`,n?`failed`:`succeeded`)}),o=r.data;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{error:a.error}),o.length>0?o.map(e=>(0,U.jsx)(qqt,{assignment:e,onDelete:()=>a.mutate(e.id)},e.id)):(0,U.jsx)(ok,{children:(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(qf,{})}),(0,U.jsx)(vb,{children:(0,U.jsx)(Z,{children:`No AI providers yet`})}),(0,U.jsx)(yb,{children:(0,U.jsx)(Z,{children:`Connect API keys for providers like OpenAI and Anthropic so your gateway can route requests to their models.`})})]}),(0,U.jsx)(bb,{children:(0,U.jsx)(BX,{})})]})})]})},Kqt=({assignment:e})=>(0,U.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-lg bg-zuplo-100 text-lg font-semibold text-zuplo-700 dark:bg-zuplo-950/50 dark:text-zuplo-300`,children:(e.label||e.provider||`?`).trim().charAt(0).toUpperCase()}),qqt=({assignment:e,onDelete:t})=>{let[n,r]=(0,H.useState)(!1),i=(0,H.useCallback)(()=>r(!0),[]),{completions:a,embeddings:o}=(0,H.useMemo)(()=>{try{let t=JSON.parse(e.metadata);return{completions:t.models?.completions??[],embeddings:t.models?.embeddings??[]}}catch{return{completions:[],embeddings:[]}}},[e.metadata]),s=a.length+o.length,c=zqt(e),l=e.provider===`Custom`,u=e.provider===oFe,d=a.length>P7||o.length>P7;return(0,U.jsxs)(ok,{children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(Kqt,{assignment:e}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-lg font-medium`,children:e.label}),(0,U.jsx)(BT,{variant:`outline`,size:`default`,children:l?e.customProviderName===e.label?e.customProviderName:(0,U.jsx)(Z,{children:`Custom`}):u?sFe:e.provider})]}),u?(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-xs text-amber-700 dark:text-amber-400`,children:[(0,U.jsx)(Xp,{size:12}),(0,U.jsx)(`span`,{className:`truncate`,children:(0,U.jsx)(Z,{children:`Demo provider — not for production`})})]}):(0,U.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,U.jsx)(Dp,{size:12}),(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.envVarName})]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(Lqt,{assignment:e,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,title:`Edit provider`,"aria-label":`Edit provider`,children:(0,U.jsx)(Mp,{size:16})})}),(0,U.jsx)(X_t,{onConfirm:t,description:(0,U.jsx)(Z,{children:`Are you sure you want to delete this provider? Apps using its models will stop working.`}),children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,title:`Delete provider`,"aria-label":`Delete provider`,className:`text-muted-foreground hover:text-destructive-foreground`,children:(0,U.jsx)(Yp,{size:16})})})]})]}),(0,U.jsx)(`div`,{className:`border-t`}),s===0?(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 p-5`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,U.jsx)(Z,{children:`No models are enabled for this provider yet.`})}),(0,U.jsx)(Lqt,{assignment:e,children:(0,U.jsx)(Y,{variant:`outline`,size:`sm`,children:(0,U.jsx)(Z,{children:`Select models`})})})]}):(0,U.jsxs)(`div`,{className:`space-y-4 p-5`,children:[(0,U.jsx)(Jqt,{icon:(0,U.jsx)(Cte,{size:14}),title:(0,U.jsx)(Z,{children:`Chat`}),models:a,referenceKey:c,expanded:n,onReveal:i}),(0,U.jsx)(Jqt,{icon:(0,U.jsx)(dte,{size:14}),title:(0,U.jsx)(Z,{children:`Embeddings`}),models:o,referenceKey:c,expanded:n,onReveal:i}),d&&(0,U.jsx)(Y,{variant:`link`,size:`sm`,className:`h-auto px-0`,onClick:()=>r(e=>!e),children:n?(0,U.jsx)(Z,{children:`Show fewer models`}):(0,U.jsxs)(Z,{children:[`Show all `,{count:s},` models`]})})]})]})},Jqt=({icon:e,title:t,models:n,referenceKey:r,expanded:i,onReveal:a})=>{if(n.length===0)return null;let o=n.slice(P7);return(0,U.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[e,(0,U.jsx)(`span`,{children:t}),(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:`·`}),(0,U.jsx)(`span`,{className:`text-muted-foreground/70`,children:n.length})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(Yqt,{models:n.slice(0,P7),referenceKey:r}),o.length>0&&(0,U.jsx)(Zqt,{hidden:!i,onReveal:a,children:(0,U.jsx)(Yqt,{models:o,referenceKey:r,className:`mt-1`})})]})]})},Yqt=({models:e,referenceKey:t,className:n})=>(0,U.jsx)(`ul`,{className:W(`grid grid-cols-1 gap-x-6 gap-y-1 font-mono text-xs sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4`,n),children:e.map(e=>(0,U.jsx)(Xqt,{model:e,referenceKey:t},e))}),Xqt=({model:e,referenceKey:t})=>{let n=t?`${t}/${e}`:e,{copyToClipboard:r}=Mw(n);return(0,U.jsx)(`li`,{className:`min-w-0`,children:(0,U.jsxs)(YP,{delayDuration:300,children:[(0,U.jsx)(XP,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>void r(),"aria-label":`Copy ${n}`,className:`block w-full cursor-pointer truncate rounded-xs text-left outline-none hover:underline hover:decoration-dotted hover:underline-offset-4 focus-visible:ring-2 focus-visible:ring-ring`,children:e})}),(0,U.jsxs)(ZP,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`font-mono`,children:n}),(0,U.jsx)(`span`,{className:`text-background/70`,children:(0,U.jsx)(Z,{children:`Click to copy full name`})})]})]})})},Zqt=({hidden:e,onReveal:t,children:n})=>{let r=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{let t=r.current;t&&(e?t.setAttribute(`hidden`,`until-found`):t.removeAttribute(`hidden`))},[e]),(0,H.useEffect)(()=>{let e=r.current;if(e)return e.addEventListener(`beforematch`,t),()=>e.removeEventListener(`beforematch`,t)},[t]),(0,U.jsx)(`div`,{ref:r,children:n})},Qqt=()=>(0,U.jsx)(N7,{title:`AI Gateway`,description:Bqt,action:(0,U.jsx)(Uqt,{}),children:(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(Wqt,{}),children:(0,U.jsx)(Gqt,{})})}),$qt=e=>e.plan===`FREE_V1`,eJt=({account:e,className:t,source:n})=>{let r=e.customDomainsInUse,i=e.entitlements.customDomains,a=$qt(e),o=`${lo(Db.AccountSettings,{account:e.name})}/upgrade-billing?source=${n}`;return(0,U.jsxs)(ok,{variant:`default`,className:t,children:[(0,U.jsx)(sk,{children:a?`Custom domains require a paid plan`:`Custom domain limit reached`}),(0,U.jsx)(uk,{className:`text-sm leading-relaxed`,children:a?(0,U.jsx)(`p`,{children:`Custom domains let you serve your APIs and developer portal from your own domain. Upgrade to the Builder plan to add custom domains to your account.`}):(0,U.jsxs)(`p`,{children:[`Your account is using`,` `,(0,U.jsxs)(`span`,{className:`font-medium`,children:[r,` of `,i]}),` `,`custom domains. Contact our team to increase your limit.`]})}),(0,U.jsxs)(dk,{className:`flex flex-wrap items-center gap-2`,children:[a?(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(mb,{variant:`ghost`,to:o,children:`Upgrade to Builder`})}):(0,U.jsx)(Y,{asChild:!0,children:(0,U.jsx)(JT,{href:wb,variant:`ghost`,children:`Contact Sales`})}),(0,U.jsx)(Y,{variant:`outline`,asChild:!0,children:(0,U.jsx)(mb,{variant:`ghost`,to:o,children:`View Plans`})})]})]})},tJt=({used:e,max:t,label:n,account:r,navigationSource:i,className:a,hideAtLimit:o=!1})=>{if(t<=0)return null;let s=e>=t,c=r.plan.startsWith(`FREE`),l=`${lo(Db.AccountSettings,{account:r.name})}/upgrade-billing${i?`?source=${i}`:``}`;return s?o?null:(0,U.jsxs)(db,{variant:`warning`,className:a,children:[(0,U.jsx)(Xp,{}),(0,U.jsx)(pb,{children:(0,U.jsxs)(`p`,{children:[`You've reached the limit of `,t,` `,n,` on your plan (`,e,` of`,` `,t,` used).`,` `,c?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(mb,{to:l,className:`hover:text-zuplo-pink-hover text-zuplo-pink underline`,children:`Upgrade your plan`}),` `,`to add more.`]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JT,{href:`mailto:${Tb}`,className:`text-zuplo-pink hover:text-zuplo-pink-hover underline`,children:`Contact sales`}),` `,`to increase your limit.`]})]})})]}):(0,U.jsxs)(`p`,{className:W(`text-sm text-muted-foreground`,a),children:[`Using `,e,` of `,t,` `,n,`.`]})},nJt=({className:e})=>(0,U.jsxs)(ok,{variant:`info`,className:e,children:[(0,U.jsx)(sk,{children:`Managed Dedicated Project`}),(0,U.jsx)(uk,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,U.jsxs)(`p`,{className:`leading-loose`,children:[`This project uses Akamai managed dedicated hosting. Custom domains for Akamai must be configured through Akamai CDN. See`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`.`]})})]}),F7=`Switch`,[rJt,iJt]=V(F7),[aJt,oJt]=rJt(F7),sJt=H.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,m]=H.useState(null),h=p(t,e=>m(e)),g=H.useRef(!1),_=f?u||!!f.closest(`form`):!0,[v,y]=yt({prop:i,defaultProp:a??!1,onChange:l,caller:F7});return(0,U.jsxs)(aJt,{scope:n,checked:v,disabled:s,children:[(0,U.jsx)(hu.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":fJt(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:h,onClick:ou(e.onClick,e=>{y(e=>!e),_&&(g.current=e.isPropagationStopped(),g.current||e.stopPropagation())})}),_&&(0,U.jsx)(dJt,{control:f,bubbles:!g.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});sJt.displayName=F7;var cJt=`SwitchThumb`,lJt=H.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=oJt(cJt,n);return(0,U.jsx)(hu.span,{"data-state":fJt(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});lJt.displayName=cJt;var uJt=`SwitchBubbleInput`,dJt=H.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=H.useRef(null),s=p(o,a),c=XJ(n),l=we(t);return H.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,U.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});dJt.displayName=uJt;function fJt(e){return e?`checked`:`unchecked`}var pJt=sJt,mJt=lJt;function hJt({className:e,...t}){return(0,U.jsx)(pJt,{"data-slot":`switch`,className:W(`peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,U.jsx)(mJt,{"data-slot":`switch-thumb`,className:W(`bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}var I7=({customDomain:e,cname:t,documentationUrl:n=`https://www.zuplo.com/docs/guides/custom-domain-setup`})=>(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsx)(`p`,{children:`We've set things up on our end, now you need to configure your DNS with a new entry.`}),(0,U.jsx)(`br`,{}),(0,U.jsx)(ok,{variant:`muted`,className:`font-mono p-4 text-sm`,children:(0,U.jsxs)(`ol`,{children:[(0,U.jsx)(`li`,{className:`leading-6`,children:`Type: CNAME`}),(0,U.jsxs)(`li`,{className:`leading-6`,children:[`Name: `,e,` `,(0,U.jsx)(cP,{textToCopy:e??``})]}),(0,U.jsxs)(`li`,{className:`leading-6`,children:[`Value: `,t,` `,(0,U.jsx)(cP,{textToCopy:t??``})]}),(0,U.jsx)(`li`,{className:`leading-6`,children:`TTL: 60s or auto`})]})}),(0,U.jsx)(`br`,{}),(0,U.jsx)(`p`,{children:`Note that it does sometimes take a few hours for records to propagate and for the SSL certificate to be created.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[`For more information see our`,` `,(0,U.jsx)(JT,{href:n,children:`documentation on custom domains`}),`.`]})]});function gJt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>!!e.managedDedicatedConfiguration)}function _Jt({stage:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n,formIsAlias:r}){return e===`dev-portal`?!1:n?!0:t?!1:r??!1}function vJt({projectType:e,defaultConfiguration:t}){return e===`managed-dedicated`&&t.some(e=>e.managedDedicatedConfiguration?.vendor===`akamai`)}function yJt({project:e,isAkamaiManagedDedicatedProject:t}){return t||!e?!1:!VD(e)}var L7=()=>(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsx)(`p`,{children:`This custom domain is setup with an advanced configuration. In order to make changes to this domain, please contact support.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[`For more information see our`,` `,(0,U.jsx)(JT,{href:`https://www.zuplo.com/docs/guides/custom-domain-setup`,children:`documentation on custom domains`}),`.`]})]}),bJt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,xJt=`https://zuplo.com/docs/dedicated/custom-domains`,SJt=Lh({project:Nh().min(1),hostname:Nh().regex(bJt,`Please enter a valid domain name (e.g. api.example.com)`),environment:Nh().min(1),stage:zh([`api`,`dev-portal`]),isAlias:Fh().optional()}),CJt=({account:e,projectName:t,disabled:n=!1,isManagedDedicatedProject:r=!1,isAkamaiManagedDedicatedProject:i=!1})=>{let a=t===void 0,o=cc(),s=rk({resolver:ik(SJt),defaultValues:{project:t??``,hostname:``,environment:``,stage:`api`,isAlias:i}}),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(`project`),[f,p,m]=s.watch([`isAlias`,`stage`,`project`]),{data:h,isLoading:g}=iF(e.name,m,{enabled:!!m}),{aliasDomains:_}=e.entitlements,{data:v}=PT(e.name),y=v?.find(e=>e.name===m),b=y?NPe(new Date(Number(y.createdOn)),new Date(`2025-04-01`)):!1,x=(v??[]).filter(e=>e.type!==`self-hosted`&&e.deployedEnvironmentCount>0).sort((e,t)=>e.name.localeCompare(t.name)),{data:S,isLoading:C}=FT(e.name,m,{enabled:a&&!!m}),w=a?gJt({projectType:y?.type,defaultConfiguration:S?.defaultConfiguration??[]}):r,T=a?vJt({projectType:y?.type,defaultConfiguration:S?.defaultConfiguration??[]}):i,E=yJt({project:y,isAkamaiManagedDedicatedProject:T}),D=h?h.filter(e=>e.environmentType!==FP.WORKING_COPY):[],O=NKt({onSuccess:()=>{_Jt({stage:p,isManagedDedicatedProject:w,isAkamaiManagedDedicatedProject:T,formIsAlias:f})&&!a&&l(!1)}}),k=(0,H.useCallback)(()=>{s.reset(),O.isSuccess&&O.reset(),d(`project`),l(!1)},[s,O]),A=MP(s.formState.isDirty&&!O.isSuccess,k),j=()=>{l(!1),o(`${lo(Db.Settings,{account:e.name,project:m})}/custom-domain`)},M=a&&v!==void 0&&x.length===0,N=!a||u===`details`,P=g||C;return(0,U.jsxs)(Jw,{open:c,onOpenChange:e=>{e?l(!0):A.guardedClose()},children:[(0,U.jsx)(Yw,{asChild:!0,children:(0,U.jsx)(Y,{"data-test":`create-custom-domain-modal-btn`,disabled:n,title:n?`You reached the limit of custom domains`:``,children:`Add Custom Domain`})}),(0,U.jsxs)(Zw,{children:[(0,U.jsx)(Qw,{children:(0,U.jsx)(eT,{children:`Add Custom Domain`})}),(0,U.jsx)(`div`,{className:`space-y-4`,children:O.isSuccess?(0,U.jsxs)(U.Fragment,{children:[w&&!f&&p===`api`?O.data?.cname?(0,U.jsx)(I7,{customDomain:s.getValues(`hostname`),cname:O.data.cname,documentationUrl:xJt}):(0,U.jsx)(L7,{}):!_&&O.data?.cname&&(0,U.jsx)(I7,{customDomain:s.getValues(`hostname`),cname:O.data?.cname}),!w&&!_&&!O.data?.cname&&p===`api`&&(0,U.jsx)(L7,{}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[a&&(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`view-custom-domain-btn`,onClick:j,children:`View in project`}),(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{"data-test":`ok-create-custom-domain-btn`,children:`Done`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ak,{error:O.error}),(0,U.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,U.jsxs)(UY,{...s,children:[N&&T&&(0,U.jsx)(db,{variant:`info`,children:(0,U.jsx)(pb,{children:`Make sure this hostname is already configured in your Akamai CDN. Registering it here records the alias domain with Zuplo so your public URLs match the client-facing domain.`})}),N&&b&&E&&(0,U.jsxs)(db,{variant:`warning`,children:[(0,U.jsx)(fb,{children:`Preview Notice`}),(0,U.jsxs)(pb,{children:[`Custom domains for the Dev Portal are currently in preview and only available after the migration to our preview version.`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains`,target:`_blank`,children:`Learn more`})]})]}),(0,U.jsx)(`form`,{onSubmit:s.handleSubmit(async t=>{await O.mutateAsync({accountName:e.name,projectName:t.project,isAlias:_Jt({stage:t.stage,isManagedDedicatedProject:w,isAkamaiManagedDedicatedProject:T,formIsAlias:t.isAlias}),hostname:t.hostname,deploymentName:t.environment,stage:t.stage})}),children:a&&u===`project`?(0,U.jsxs)(U.Fragment,{children:[M?(0,U.jsx)(`p`,{className:`mt-2`,children:`You don't have any projects that can use a custom domain yet. Custom domains require a project with a deployed (edge) environment.`}):(0,U.jsx)(WY,{control:s.control,name:`project`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{className:`block`,htmlFor:`project-field`,children:`Which project is this domain for?`}),(0,U.jsxs)(_Y,{value:e.value,onValueChange:t=>{e.onChange(t),s.setValue(`environment`,``),s.setValue(`stage`,`api`),s.setValue(`isAlias`,!1)},disabled:O.isPending,children:[(0,U.jsx)(yY,{id:`project-field`,"data-test":`project-field`,className:`w-full`,children:(0,U.jsx)(vY,{placeholder:`Select a project`})}),(0,U.jsx)(bY,{children:x.map(e=>(0,U.jsx)(xY,{value:e.name,children:e.name},e.id))})]}),(0,U.jsx)(XY,{})]})}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`cancel-create-custom-domain-btn`,children:`Cancel`})}),!M&&(0,U.jsx)(Y,{type:`button`,"data-test":`continue-create-custom-domain-btn`,disabled:!m||P,onClick:()=>d(`details`),children:(0,U.jsx)(aP,{loading:!!m&&P,children:`Continue`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[a&&(0,U.jsxs)(`div`,{className:`mt-2 mb-1 flex items-center justify-between gap-2`,children:[(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Project:`,` `,(0,U.jsx)(`span`,{className:`font-medium text-foreground`,children:m})]}),(0,U.jsx)(Y,{type:`button`,variant:`ghost`,size:`sm`,"data-test":`change-project-custom-domain-btn`,onClick:()=>d(`project`),disabled:O.isPending,children:`Change`})]}),g?(0,U.jsx)(fD,{className:`h-9 mt-4`}):D.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(WY,{control:s.control,name:`environment`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{htmlFor:`environment-field`,children:`Which environment do you want to apply your new domain to?`}),(0,U.jsx)(tF,{id:`environment-field`,"data-test":`environment-field`,environments:D,value:e.value,onValueChange:e.onChange,disabled:O.isPending,placeholder:`Select an environment`}),(0,U.jsx)(XY,{})]})}),E&&(0,U.jsx)(WY,{control:s.control,name:`stage`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{className:`block`,htmlFor:`stage-field`,children:`What do you want the custom domain to be assigned to?`}),(0,U.jsxs)(_Y,{onValueChange:t=>{(t===`api`||t===`dev-portal`)&&e.onChange(t)},disabled:O.isPending,...e,children:[(0,U.jsx)(yY,{id:`stage-field`,className:`w-full`,children:(0,U.jsx)(vY,{placeholder:`Select a stage`})}),(0,U.jsxs)(bY,{children:[(0,U.jsx)(xY,{value:`api`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Tp,{size:16}),` Gateway`]})}),(0,U.jsx)(xY,{value:`dev-portal`,children:(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(Vp,{size:16}),` Dev Portal`,(0,U.jsx)(BT,{className:``,variant:`info`,children:`New`})]})})]})]}),(0,U.jsx)(XY,{})]})}),(0,U.jsx)(WY,{control:s.control,name:`hostname`,render:({field:e})=>(0,U.jsxs)(KY,{className:`mt-2`,children:[(0,U.jsx)(XT,{htmlFor:`hostname-field`,children:`Your custom domain (e.g. example.com or api.example.com)`}),(0,U.jsx)(YT,{type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,"data-test":`hostname-field`,...e,disabled:O.isPending}),(0,U.jsx)(XY,{})]})}),(0,U.jsx)(WY,{control:s.control,name:`isAlias`,render:({field:e})=>(0,U.jsx)(KY,{className:W((!_||p===`dev-portal`||w)&&`hidden`,`mt-2`),children:(0,U.jsxs)(ok,{className:`p-4 flex items-center gap-3`,children:[(0,U.jsxs)(XT,{className:`flex flex-col gap-2`,htmlFor:`isAlias`,children:[`Is this an alias domain?`,(0,U.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`If your API Gateway is behind a CDN or WAF, your clients may use a different domain. Use an`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains#alias-domains`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`alias domain`}),` `,`so public URLs like docs and OpenAPI match the client-facing domain.`]})]}),(0,U.jsx)(hJt,{className:`mx-3`,id:`isAlias`,"data-test":`isAlias`,checked:e.value??!1,onCheckedChange:e.onChange,disabled:O.isPending}),(0,U.jsx)(XY,{})]})})}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[a?(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`back-create-custom-domain-btn`,disabled:O.isPending,onClick:()=>d(`project`),children:`Back`}):(0,U.jsx)(Xw,{asChild:!0,children:(0,U.jsx)(Y,{type:`button`,"data-test":`cancel-create-custom-domain-btn`,disabled:O.isPending,variant:`secondary`,children:`Cancel`})}),(0,U.jsx)(Y,{type:`submit`,"data-test":`create-custom-domain-btn`,disabled:O.isPending,children:(0,U.jsx)(aP,{loading:O.isPending,children:`Create`})})]})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`mt-4`,children:`Custom domains can only be configured on edge deployment environments and this project only has a working-copy environment.`}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`p`,{children:[` `,`For more information on this see our`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/environments`,children:`documentation on environments`}),`.`]}),a&&(0,U.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end`,children:(0,U.jsx)(Y,{type:`button`,variant:`secondary`,"data-test":`back-create-custom-domain-btn`,onClick:()=>d(`project`),children:`Back`})})]})]})})]})})]})})]}),(0,U.jsx)(jP,{open:A.showConfirm,onOpenChange:A.setShowConfirm,onDiscard:A.handleDiscard})]})},wJt=`https://zuplo.com/docs/dedicated/custom-domains`,TJt=({customDomain:e,isManagedDedicatedProject:t,isAkamaiManagedDedicatedProject:n})=>{let[r,i]=(0,H.useState)(void 0),a=()=>{s(),i(void 0)},[o,s]=F$(()=>{let i=r?.deployments.at(0)?.stage,o=r?.deployments.at(0)?.cname,s=typeof o==`string`&&o.length>0;return(0,U.jsx)(LP,{onClose:a,isOpen:!0,title:`Configure your custom domain`,children:(0,U.jsx)(`div`,{className:`space-y-4`,children:n?(0,U.jsx)(nJt,{}):t&&i===`api`?s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o,documentationUrl:wJt}):(0,U.jsx)(L7,{}):e.provider===`custom`?(0,U.jsx)(L7,{}):e.provider===`amazon`?s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o,documentationUrl:wJt}):(0,U.jsx)(L7,{}):s?(0,U.jsx)(I7,{customDomain:r?.hostname,cname:o}):(0,U.jsx)(L7,{})})})},[r]),c=e=>{i(e),o()};return(0,U.jsx)(Y,{onClick:()=>{c(e)},"data-test":`view-domain-configuration-btn`,title:`View Configuration`,variant:`ghost`,size:`icon`,children:(0,U.jsx)(Ep,{size:18})})},EJt=/held zone/i;function DJt(e){return!!e?.some(e=>EJt.test(e))}var OJt=new Set([`pending`,`pending_migration`,`pending_provisioned`,`active_redeploying`,`provisioned`]),kJt=new Set([`blocked`,`pending_blocked`,`moved`,`deleted`,`pending_deletion`,`test_blocked`,`test_failed`]),AJt=new Set([`initializing`,`pending_validation`,`pending_issuance`,`pending_deployment`,`pending_cleanup`,`staging_deployment`,`holding_deployment`]),jJt=new Set([`expired`,`deactivating`,`inactive`,`initializing_timed_out`,`validation_timed_out`,`issuance_timed_out`,`deployment_timed_out`,`deletion_timed_out`,`deleted`,`pending_deletion`,`pending_expiration`]);function MJt(e){if(e.provider===`alias`)return null;if(e.provider===`custom`||e.provider===`amazon`)return{level:`unknown`,label:`Externally managed`,description:`This domain's status isn't reported to Zuplo — verification and certificates are handled by your dedicated infrastructure provider.`};let t=e.verificationErrors&&e.verificationErrors.length>0,n=e.status??null,r=e.sslStatus??null;if(!n&&!r&&!t)return{level:`pending`,label:`Initializing`,description:`We're waiting for the domain provider to report a status. This usually takes a few seconds after the domain is created.`};if(DJt(e.verificationErrors))return{level:`error`,label:`Zone hold`,description:`Cloudflare is blocking this hostname because the parent domain has a zone hold on another Cloudflare account. The zone owner needs to release the hold before we can finish provisioning.`,helpUrl:`https://developers.cloudflare.com/fundamentals/account/account-security/zone-holds/`,helpLabel:`How to release a zone hold`};if(t)return{level:`error`,label:`Needs attention`,description:`The domain provider reported verification errors. Review the details to resolve them.`};if(n&&kJt.has(n))return{level:`error`,label:R7(n),description:`The domain is in a state that prevents it from serving traffic. Contact support if this persists.`};if(r&&jJt.has(r))return{level:`error`,label:`SSL error`,description:`The SSL certificate is in the "${R7(r)}" state. The domain may not serve HTTPS traffic until this is resolved.`};let i=n===`active`||n===`test_active`||n===`test_active_apex`;return i&&(r===`active`||r===`staging_active`||r===`backup_issued`)?{level:`active`,label:`Active`,description:`The domain is verified and serving traffic over HTTPS.`}:i&&r&&AJt.has(r)?{level:`pending`,label:`Issuing certificate`,description:`The domain is verified. We're still provisioning the SSL certificate — this usually takes a few minutes.`}:n&&OJt.has(n)?{level:`pending`,label:`Verifying domain`,description:`We're waiting for DNS verification. Double-check the CNAME record at your DNS provider.`}:n||r?{level:`pending`,label:R7(n??r??`pending`),description:`The domain is still being set up. If this state persists, contact support.`}:{level:`unknown`,label:`Unknown`,description:`No status information is available for this domain.`}}function R7(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var NJt={active:{dot:`bg-green-500`,pulse:!1,pill:`bg-green-50 text-green-700 border-green-200 hover:bg-green-100 dark:bg-green-950 dark:text-green-300 dark:border-green-800 dark:hover:bg-green-900`},pending:{dot:`bg-amber-500`,pulse:!0,pill:`bg-amber-50 text-amber-800 border-amber-200 hover:bg-amber-100 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800 dark:hover:bg-amber-900`},error:{dot:`bg-red-500`,pulse:!1,pill:`bg-red-50 text-red-700 border-red-200 hover:bg-red-100 dark:bg-red-950 dark:text-red-300 dark:border-red-800 dark:hover:bg-red-900`},unknown:{dot:`bg-gray-400`,pulse:!1,pill:`bg-gray-50 text-gray-700 border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 dark:hover:bg-gray-700`}},PJt=({domain:e})=>{let t=MJt(e);if(!t)return null;let n=NJt[t.level],r=e.verificationErrors??[];return(0,U.jsxs)(kT,{children:[(0,U.jsx)(AT,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,className:W(`inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors focus:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,n.pill),"aria-label":`${e.hostname} status: ${t.label}`,children:[(0,U.jsxs)(`span`,{className:`relative flex size-2 items-center justify-center`,children:[n.pulse&&(0,U.jsx)(`span`,{className:W(`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75`,n.dot)}),(0,U.jsx)(`span`,{className:W(`relative inline-flex size-2 rounded-full`,n.dot)})]}),t.label]})}),(0,U.jsx)(jT,{align:`start`,className:`w-96`,children:(0,U.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:W(`inline-flex size-2 rounded-full`,n.dot)}),(0,U.jsx)(`span`,{className:`font-medium`,children:t.label})]}),(0,U.jsx)(`p`,{className:`text-muted-foreground`,children:t.description}),t.helpUrl&&(0,U.jsx)(JT,{href:t.helpUrl,className:`text-xs`,children:t.helpLabel??`Learn more`}),r.length>0&&(0,U.jsxs)(`div`,{className:`space-y-1`,children:[(0,U.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Verification errors`}),(0,U.jsx)(`ul`,{className:`list-disc pl-5 space-y-1 text-destructive-foreground`,children:r.map(e=>(0,U.jsx)(`li`,{children:e},e))})]})]})})]})},FJt=({account:e,currentDomainConfig:t})=>{let{logEvent:n,captureException:r}=S(),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(``),c=e=>{let t=e.target.value;a(t)},l=FKt(),u=async()=>{try{if(s(``),!t.hostname||t.hostname.trim()===``){s(`The current domain configuration does not have a hostname associated with it`);return}await l.mutateAsync({accountName:e.name,projectName:t.projectName??``,hostname:t.hostname,deploymentName:t.deployments[0]?.deploymentName}),n(`account-custom-domain-delete-success`,{account:e.name}),d()}catch(t){r(t);let i=zb(t);s(i),n(`account-custom-domain-delete-failed`,{account:e.name,errorMessage:i})}},d=()=>{p(),a(``),s(``)},[f,p]=F$(()=>(0,U.jsx)(LP,{onClose:d,isOpen:!0,title:`Delete custom domain`,className:`sm:max-w-xl`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(ak,{error:o,className:`mb-3`}),(0,U.jsxs)(`div`,{className:`text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[(0,U.jsxs)(`div`,{className:`relative bg-yellow-100 dark:bg-yellow-950/40 rounded-sm p-4 text-yellow-900 dark:text-yellow-200 text-sm whitespace-pre-line w-full mb-2`,children:[(0,U.jsxs)(`div`,{className:`flex space-x-2 items-center`,children:[(0,U.jsx)(ap,{className:`h-5 w-5 text-yellow-900 dark:text-yellow-200`}),(0,U.jsx)(`span`,{className:`text-sm font-medium antialiased mt-0.5`,children:`Caution: Your project will no longer be accessible with this domain.`})]}),(0,U.jsxs)(`p`,{className:`px-2 mt-4`,children:[`You are about to delete the custom domain`,` `,(0,U.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`from your project. Requests using it will no longer reach your zup.`]})]}),(0,U.jsx)(`br`,{}),(0,U.jsxs)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:[`Please type`,` `,(0,U.jsx)(`span`,{className:`font-medium antialiased`,children:t.hostname}),` `,`to confirm.`]}),(0,U.jsx)(YT,{className:`mb-4`,type:`text`,autoComplete:`off`,value:i,onChange:c,id:`hostname-field`,"data-test":`hostname-field`}),(0,U.jsx)(`div`,{className:` text-red-500`,children:`I understand the consequences, delete this custom domain`})]}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Y,{onClick:d,"data-test":`cancel-delete-custom-domain-btn`,variant:`outline`,disabled:l.isPending,children:`Cancel`}),(0,U.jsx)(Y,{"data-test":`delete-custom-domain-btn`,onClick:u,disabled:l.isPending||i!==t.hostname,children:(0,U.jsx)(aP,{loading:l.isPending,children:`Delete`})})]})]})}),[l.isPending,o,t,i]);return(0,U.jsx)(Y,{type:`button`,title:`Delete Custom Domain`,onClick:f,"data-test-id":`delete-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,U.jsx)(aP,{loading:l.isPending,children:(0,U.jsx)(Yp,{size:18})})})},IJt=/^(?!https?:\/\/)[a-zA-Z0-9.-]*\.[a-zA-Z]+$/,LJt=({account:e,projectName:t,currentDomainConfig:n})=>{let{logEvent:r,captureException:i}=S(),[a,o]=(0,H.useState)(``),[s,c]=(0,H.useState)(!1),[l,u]=(0,H.useState)(n.deployments[0]?.deploymentName),d=n.hostname,{data:f,error:p}=iF(e.name,t),m=zb(p);(0,H.useEffect)(()=>{m&&o(m)},[m]);let h=f?f.filter(e=>e.environmentType!==FP.WORKING_COPY):[],g=PKt(),_=async n=>{if(n.preventDefault(),!l||l.trim()===``){o(`Please select an environment from the options available`);return}if(!d||d.trim()===``){o(`Please provide a value on the custom domain field.`);return}if(d&&!IJt.test(d)){o(`A custom domain value should only be the domain name. It should not start with 'http(s)' and should end with an alpha character.`);return}try{o(``),await g.mutateAsync({accountName:e.name,projectName:t,hostname:d,deploymentName:l}),c(!0),r(`account-custom-domain-edit-success`,{account:e.name})}catch(t){i(t);let n=zb(t);r(`account-custom-domain-edit-failed`,{account:e.name,errorMessage:n}),o(n),c(!1)}},v=()=>{b(),u(n.deployments[0]?.deploymentName),o(``),c(!1)},[y,b]=F$(()=>(0,U.jsx)(LP,{onClose:v,isOpen:!0,title:`Edit your custom domain`,children:(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(ak,{error:a}),(0,U.jsxs)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:[s===!1&&(0,U.jsxs)(`form`,{onSubmit:_,children:[(0,U.jsx)(`label`,{className:`block mb-2`,htmlFor:`environment-field`,children:`Which environment do you want to apply your custom domain to ?`}),(0,U.jsx)(`div`,{className:`mb-9`,children:(0,U.jsx)(tF,{id:`environment-field`,"data-test":`environment-field`,environments:h,value:l??``,onValueChange:e=>u(e),disabled:g.isPending,placeholder:`Select an environment`})}),(0,U.jsx)(`label`,{className:`block mb-2`,htmlFor:`hostname-field`,children:`Your custom domain`}),(0,U.jsx)(YT,{className:`mb-9`,type:`text`,autoComplete:`off`,placeholder:`api.example.com`,id:`hostname-field`,value:d,disabled:!0,"data-test":`hostname-field`}),(0,U.jsxs)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:[(0,U.jsx)(Y,{variant:`outline`,type:`button`,onClick:v,"data-test":`cancel-edit-custom-domain-btn`,disabled:g.isPending,children:`Cancel`}),(0,U.jsx)(Y,{"data-test":`save-edit-custom-domain-btn`,type:`submit`,disabled:g.isPending||l===n.deployments[0]?.deploymentName,children:(0,U.jsx)(aP,{loading:g.isPending,children:`Save`})})]})]}),s===!0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`text-left text-sm text-foreground whitespace-pre-line w-full mb-2`,children:(0,U.jsxs)(`p`,{children:[`Successfully edited custom domain`,` `,(0,U.jsx)(JT,{href:`https://${d}`,children:d}),` `,`to map to deployment `,l]})}),(0,U.jsx)(`div`,{className:`mt-5 sm:mt-4 flex justify-end gap-x-4`,children:(0,U.jsx)(Y,{variant:`outline`,className:`w-24 justify-center`,type:`button`,onClick:v,"data-test":`ok-edit-custom-domain-btn`,disabled:!s,children:`OK`})})]})]})]})}),[h,a]),x=()=>{y()};return(0,U.jsx)(Y,{onClick:()=>x(),title:`Edit Custom Domain`,"data-test-id":`edit-custom-domain-btn`,variant:`ghost`,size:`icon-sm`,children:(0,U.jsx)(aP,{loading:g.isPending,children:(0,U.jsx)(Zee,{size:18})})})},RJt=({classNames:e,projectType:t,feature:n,helpUrl:r})=>(0,U.jsxs)(ok,{variant:`danger`,className:e,children:[(0,U.jsx)(sk,{children:t===`managed-dedicated`?`Managed Dedicated Project`:t===`self-hosted`?`Self Hosted Project`:`Managed Edge Project`}),(0,U.jsx)(uk,{className:`flex-1 leading-loose mt-1 text-sm`,children:(0,U.jsxs)(`p`,{className:`leading-loose`,children:[`Your project is running on a `,t===`managed-dedicated`?`managed dedicated`:t===`self-hosted`?`self hosted`:`managed edge hosted`,` environment. For information on how to setup up `,n,`, please refer to`,` `,(0,U.jsx)(JT,{href:r,children:`the documentation`}),`.`]})})]});function zJt(){return(0,U.jsx)(`button`,{type:`button`,disabled:!0,title:`Locked custom domain`,className:`items-center justify-center p-2 hover:bg-gray-100 rounded-sm cursor-pointer`,children:(0,U.jsx)(Ap,{className:`h-5 w-5 mx-auto`,"aria-hidden":`true`})})}var BJt=`Custom Domains`,VJt=(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/custom-domains`,children:`Custom domains`}),` `,`allow you to use your own domain name for your API and developer portal. For complex custom domain configurations, please contact us at`,` `,(0,U.jsx)(JT,{href:`mailto:${Cb}`,children:Cb}),` `,`or use the chat widget at the bottom right.`]}),HJt=()=>{let e=fm([`account`,`project`]),t=IKt(e.account.name,e.project.name),n=FT(e.account.name,e.project.name);if(!t.data||!n.data)return(0,U.jsx)(N7,{title:BJt,description:VJt,children:(0,U.jsx)(f1,{})});let r=t.data?.filter(t=>t.projectName&&t.projectName===e.project.name&&t.deployments[0]).sort((e,t)=>e.deployments[0].deploymentName.localeCompare(t.deployments[0].deploymentName)),i=e.account.customDomainsInUse>=e.account.entitlements.customDomains,a=vJt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),o=gJt({projectType:e.project.type,defaultConfiguration:n.data.defaultConfiguration}),s=e.project.type!==`self-hosted`&&(a?!!e.account.entitlements.aliasDomains:e.account.entitlements.customDomains>0);return(0,U.jsxs)(N7,{title:BJt,description:VJt,action:s?(0,U.jsx)(CJt,{disabled:!a&&i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}):void 0,children:[i&&e.account.entitlements.customDomains>0&&e.project.type!==`self-hosted`&&!a&&(0,U.jsx)(eJt,{account:e.account,source:`custom-domain-limit`}),!i&&e.project.type!==`self-hosted`&&!a&&(0,U.jsx)(tJt,{used:e.account.customDomainsInUse,max:e.account.entitlements.customDomains,label:`custom domains`,account:e.account,hideAtLimit:!0}),a&&!!e.account.entitlements.aliasDomains&&(0,U.jsx)(db,{variant:`info`,className:`text-sm`,children:(0,U.jsx)(pb,{children:(0,U.jsxs)(`p`,{children:[`This project uses Akamai managed dedicated hosting. Configure the hostname in your Akamai CDN first — see the`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/dedicated/akamai/cdn`,children:`Akamai custom domain documentation`}),`. Once it's set up there, add the domain using the button above to register it with Zuplo.`]})})}),r.length>0?(0,U.jsx)(ok,{className:`overflow-hidden`,children:r.map(t=>{let n=t.deployments[0],r=o&&n?.stage===`api`,i=t.provider===`custom`&&!r,s=t.provider===`alias`,c=n.stage===`dev-portal`,l=a&&!s||i;return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b px-4 py-3 last:border-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`shrink-0 flex size-9 items-center justify-center rounded-md bg-muted text-muted-foreground`,children:c?(0,U.jsx)(Vp,{className:`size-4`}):(0,U.jsx)(Tp,{className:`size-4`})}),(0,U.jsxs)(`div`,{className:`flex flex-col min-w-0 gap-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,U.jsxs)(`a`,{href:`https://${t.hostname}`,target:`_blank`,rel:`noreferrer`,className:`font-medium text-sm text-foreground hover:underline inline-flex items-center gap-1 truncate`,children:[(0,U.jsx)(`span`,{className:`truncate`,children:t.hostname}),(0,U.jsx)(_p,{className:`size-3 shrink-0 opacity-60`})]}),(0,U.jsx)(PJt,{domain:t}),n.isDefault&&(0,U.jsx)(BT,{variant:`outline`,className:`text-xs`,children:`Default`}),s&&(0,U.jsx)(BT,{variant:`outline`,className:`text-xs`,children:`Alias`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,U.jsx)(`span`,{className:`inline-flex items-center gap-1`,children:c?`Dev Portal`:`API`}),(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,U.jsxs)(`span`,{children:[(0,U.jsx)(dGe,{env:n.environmentType??null}),` `,`(`,n.deploymentName,`)`]}),n.branch&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`text-muted-foreground/50`,children:`·`}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono`,children:[(0,U.jsx)(wp,{className:`size-3`}),n.branch]})]})]})]})]}),(0,U.jsxs)(`div`,{className:`shrink-0 flex items-center gap-1`,children:[!s&&(0,U.jsx)(TJt,{customDomain:t,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a}),l?(0,U.jsx)(zJt,{}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(LJt,{account:e.account,projectName:e.project.name,currentDomainConfig:t}),(0,U.jsx)(FJt,{account:e.account,currentDomainConfig:t})]})]})]},t.id)})}):s?(0,U.jsx)(ok,{children:(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(Tp,{})}),(0,U.jsx)(vb,{children:`No custom domains yet`}),(0,U.jsx)(yb,{children:`Serve your API and developer portal from your own domain name.`})]}),(0,U.jsx)(bb,{children:(0,U.jsx)(CJt,{disabled:!a&&i,account:e.account,projectName:e.project.name,isManagedDedicatedProject:o,isAkamaiManagedDedicatedProject:a})})]})}):null,e.project.type===`self-hosted`?(0,U.jsx)(RJt,{classNames:``,feature:`custom domains`,helpUrl:`https://zuplo.com/docs/dedicated/custom-domains`,projectType:e.project.type}):a&&!e.account.entitlements.aliasDomains?(0,U.jsx)(nJt,{}):!a&&e.account.entitlements.customDomains<=0?(0,U.jsx)(eJt,{account:e.account,source:`custom-domain`}):null]})},UJt=e=>{let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect().width>e.getBoundingClientRect().width},WJt=()=>{let[e,t]=(0,H.useState)(!1);return{tooltipProps:(0,H.useMemo)(()=>{if(!e)return{open:!1}},[e]),triggerProps:(0,H.useMemo)(()=>({ref:e=>{e&&t(UJt(e))}}),[])}};function GJt({isSecret:e}){return e?(0,U.jsx)(Ap,{className:`h-4 w-auto`}):(0,U.jsx)(fp,{className:`h-4 w-auto`})}var KJt=({variable:e,asIcon:t=!1})=>(0,U.jsxs)(uzt,{children:[(0,U.jsx)(dzt,{asChild:!0,children:t?(0,U.jsx)(Y,{variant:`ghost`,size:`icon`,className:`flex items-center`,children:(0,U.jsx)(fp,{className:`w-4 h-4`})}):(0,U.jsxs)(Y,{variant:`secondary`,size:`default`,className:`flex items-center gap-2`,children:[(0,U.jsx)(fp,{className:`w-4 h-4`}),`Get Code Snippet`]})}),(0,U.jsxs)(y6,{side:`right`,className:`sm:max-w-none w-1/3 min-w-[500px]`,children:[(0,U.jsx)(`div`,{className:`text-lg font-semibold border-b`,children:`Code Snippets`}),(0,U.jsx)(`p`,{className:`my-2 text-sm`,children:`Use this Code Snippet anywhere in your modules to access your environment variable.`}),(0,U.jsx)(ok,{offset:`md`,className:`bg-gray-200 text-xs `,children:(0,U.jsxs)(`pre`,{id:`codePre`,"data-lang":`typescript`,className:`font-mono text-gray-900 overflow-x-auto`,children:[`import `,`{`,` environment `,`}`,` from "@zuplo/runtime";`,`\r
1581
1581
  \r
1582
1582
  `,`const ${e.name} = environment.${e.name};\r\n`]})})]})]}),qJt=e=>{let t=[];return e.targets.includes(`production`)&&t.push(`production`),e.targets.includes(`preview`)&&t.push(e.targetBranch??`preview`),e.targets.includes(`working-copy`)&&t.push(`development`),t.join(`, `)};function JJt({variable:e,account:t,project:n,previewEnvironments:r,environmentsLoaded:i}){let a=EGe(),{logEvent:o}=S(),[c,l]=(0,H.useState)(),[u,d]=(0,H.useState)(!1),{tooltipProps:f,triggerProps:p}=WJt(),{tooltipProps:m,triggerProps:h}=WJt(),[g,_]=F$(()=>{let r=async()=>{_(),await a.mutateAsync({accountName:t,projectName:n.name,id:e.id}),o(`env-var-deleted`,{account:t,project:n.name,id:e.id})},i=`Error deleting Environment Variable`,l=`We found an error trying to remove the variable.`;return c instanceof s&&(i=c.title??i,l=c.detail??l),(0,U.jsx)(xQ,{alertType:`ERROR`,bodyText:l,onPrimaryButtonClick:r,onSecondaryButtonClick:_,primaryButtonText:`Try again`,secondaryButtonText:`Cancel`,hideModal:_,title:i})},[e,r,c]),v=async()=>{try{await a.mutateAsync({accountName:t,projectName:n.name,id:e.id}),o(`env-var-deleted`,{account:t,project:n.name,id:e.id}),d(!1)}catch(r){o(`env-var-deletion-failed`,{account:t,project:n.name,id:e.id}),d(!1),l(r instanceof Error?r:Error(r)),g()}},[y,b]=F$(()=>(0,U.jsx)(DGe,{project:n,variable:e,previewEnvironments:r,environmentsLoaded:i,onClose:b,account:t}),[e,r,i]),x=e.personalValue??e.value;return(0,U.jsxs)(`div`,{className:`grid grid-cols-subgrid col-span-full gap-4 items-center border-b px-4 py-3 last:border-0`,children:[(0,U.jsxs)(M$,{open:u,onOpenChange:d,onClickDelete:v,isPending:a.isPending,deleteButtonText:`Confirm`,children:[`Are you sure you want to delete the variable '`,e.name,`'`]}),(0,U.jsx)(`div`,{className:`rounded-full border w-10 h-10 flex items-center justify-center`,children:(0,U.jsx)(GJt,{isSecret:e.type===`secret`})}),(0,U.jsxs)(`div`,{className:`flex flex-row justify-between items-center truncate`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col truncate`,children:[(0,U.jsxs)(YP,{...m,delayDuration:0,children:[(0,U.jsx)(XP,{...h,asChild:!0,children:(0,U.jsx)(`span`,{className:`font-mono text-sm truncate`,"data-test":`env-variable-name`,children:e.name})}),(0,U.jsxs)(ZP,{className:`font-mono`,children:[(0,U.jsx)(QP,{}),e.name]})]}),(0,U.jsx)(`div`,{className:`text-sm text-neutral-500 line-clamp-2`,children:qJt(e)})]}),e.personalValue&&(0,U.jsx)(`div`,{className:`bg-zuplo-highlight rounded-full text-2xs text-white px-2 py-1 mx-2 flex-none`,children:`PERSONAL`})]}),(0,U.jsx)(`div`,{"data-test":`env-variable-value`,className:`truncate flex text-xs font-mono`,children:x?(0,U.jsxs)(YP,{...f,children:[(0,U.jsx)(XP,{asChild:!0,...p,children:(0,U.jsx)(`div`,{className:`bg-muted p-1 px-2 rounded-sm max-w-96 truncate`,children:e.type===`config`?x:`************`})}),(0,U.jsxs)(ZP,{className:`text-xs`,children:[(0,U.jsx)(QP,{}),x]})]}):(0,U.jsx)(BT,{variant:`outline`,children:`No value`})}),(0,U.jsxs)(`div`,{className:`flex gap-2 justify-end`,children:[(0,U.jsx)(KJt,{variable:e,asIcon:!0}),(0,U.jsx)(Y,{size:`icon`,variant:`ghost`,type:`button`,"data-test":`env-variable-edit`,onClick:()=>{y()},children:(0,U.jsx)(Ip,{size:18})}),(0,U.jsx)(Y,{size:`icon`,variant:`ghost`,"data-test":`env-variable-delete`,onClick:()=>{d(!0)},children:a.isPending?(0,U.jsx)(sP,{className:`w-4 h-4`,borderPositionAndSize:`border-2`}):(0,U.jsx)(Yp,{size:18})})]})]},e.name)}var z7=`___EMPTY___`,B7=`Environment Variables`,V7=`Configuration and secrets available to your environments at build and runtime. Changes take effect on the next deployment.`;function YJt(){let e=fm([`account`,`project`]),{logEvent:t}=S(),n=rF(e.account.name,e.project.name),r=!!e.project.sourceRepoUrl,i=iF(e.account.name,e.project.name),a=[{label:`All`,value:z7},{label:`Production`,value:`production`},{label:`Preview (other branches)`,value:`preview`},{label:`Development`,value:`working-copy`}],[o,s]=(0,H.useState)(z7),[c,l]=(0,H.useState)(z7),[u,d]=(0,H.useState)(``),f=i.data?.filter(e=>!IP(e.environmentType,FP.PRODUCTION,FP.WORKING_COPY))??[],p=i.data!==void 0,m=f.map(e=>e.branchName),h=(0,H.useMemo)(()=>[z7,...m],[m]),g=(0,H.useMemo)(()=>n.data??[],[n.data]),_=(0,H.useMemo)(()=>g.filter(e=>o===z7||e.targets.includes(o)),[g,o]),v=pX(u,(0,H.useMemo)(()=>o!==`preview`||c===z7?_:_.filter(e=>e.targets.includes(`preview`)&&e.targetBranch===c),[_,o,c]),{key:`id`,getText:e=>[e.name,e.type,e.value,...e.targets,e.targetBranch].filter(Boolean)}),[y,b]=F$(()=>(0,U.jsx)(jGe,{account:e.account.name,project:e.project,previewEnvironments:f,onClose:b}),[f]);if(n.isError)return(0,U.jsx)(N7,{title:B7,description:V7,children:(0,U.jsx)(fWe,{error:n.error})});if(!n.data||r&&!i.data)return(0,U.jsx)(N7,{title:B7,description:V7,children:(0,U.jsx)(f1,{})});let x=o!==z7||c!==z7&&c!==``||u!==``;return(0,U.jsxs)(N7,{title:B7,description:V7,action:(0,U.jsxs)(Y,{onClick:y,children:[(0,U.jsx)(Np,{size:16}),`Add variable`]}),children:[(0,U.jsxs)(`div`,{className:`flex flex-row items-center gap-3`,children:[(0,U.jsx)(YT,{type:`search`,placeholder:`Search variables`,className:`max-w-xs`,value:u,onChange:n=>{d(n.currentTarget.value),t(`env-var-filter-changed`,{account:e.account.name,project:e.project.name,query:n.currentTarget.value})}}),(0,U.jsxs)(_Y,{value:o,onValueChange:e=>{s(e),e!==`preview`&&l(``)},children:[(0,U.jsx)(yY,{className:`w-52`,"data-test":`env-variable-filter`,children:(0,U.jsx)(vY,{})}),(0,U.jsx)(bY,{className:`w-52`,children:a.map((e,t)=>(0,U.jsx)(xY,{value:e.value,"data-test":`env-variable-filter-${t}`,children:e.label},e.value))})]}),o===`preview`?(0,U.jsxs)(_Y,{value:c,onValueChange:e=>{l(e)},children:[(0,U.jsx)(yY,{className:`w-52`,"data-test":`env-variable-branch-filter`,children:(0,U.jsx)(vY,{})}),(0,U.jsx)(bY,{className:`w-52`,children:h.map(e=>(0,U.jsx)(xY,{value:e,children:e===z7?`All branches`:e},e))})]}):null]}),v.length>0?(0,U.jsx)(ok,{className:`grid grid-cols-[min-content_minmax(auto,250px)_1fr_auto] overflow-hidden`,children:v.map(t=>(0,U.jsx)(JJt,{account:e.account.name,project:e.project,previewEnvironments:f,environmentsLoaded:p,variable:t},t.id))}):(0,U.jsx)(ok,{children:x?(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(Pte,{})}),(0,U.jsx)(vb,{children:`No matching variables`}),(0,U.jsx)(yb,{children:`No environment variables match the current search or filter.`})]}),(0,U.jsx)(bb,{children:(0,U.jsx)(Y,{variant:`outline`,onClick:()=>{d(``),s(z7),l(z7)},children:`Clear filters`})})]}):(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(Hp,{})}),(0,U.jsx)(vb,{children:`No environment variables yet`}),(0,U.jsxs)(yb,{className:`max-w-md`,children:[`Variables you add here are provided to your environments during build and at runtime.`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/deployments/environment-variables`,children:`Read the docs`}),`.`]})]}),(0,U.jsx)(bb,{children:(0,U.jsxs)(Y,{onClick:y,children:[(0,U.jsx)(Np,{size:16}),`Add your first variable`]})})]})})]})}var XJt=({projectName:e,closeModalAction:t,accountName:n,onFinishDeletion:r})=>{let{logEvent:i,captureException:a}=S(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)(null),u=t=>{s(t.target.value===e)},d=nAe(n,e);return(0,U.jsx)(Zgt,{alertType:`DELETE`,isOpen:!0,title:`Delete Project`,setIsOpen:t,secondaryButtonContent:`Cancel`,secondaryButtonTestID:`project-list-close-delete-project-modal`,onSecondaryButtonClick:t,primaryButtonTestID:`project-list-delete-project-button`,secondaryButtonDisabled:d.isPending,primaryButtonDisabled:!o||d.isPending,primaryButtonContent:`Delete`,onPrimaryButtonClick:async()=>{try{l(null),await d.mutateAsync(),i(`project-deleted`,{account:n,project:e}),r?.(),t()}catch(t){i(`project-deletion-failed`,{account:n,project:e}),a(t),l(zb(t))}},bodyElement:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(ak,{error:c}),(0,U.jsx)(`p`,{className:`text-sm`,children:`This cannot be undone! Your GitHub repository will be untouched.`}),(0,U.jsxs)(`p`,{className:`text-sm`,children:[`Please type `,(0,U.jsx)(`strong`,{onDoubleClick:e=>{let t=e.currentTarget,n=new Range;n.setStart(t,0),n.setEnd(t,1),document.getSelection()?.removeAllRanges(),document.getSelection()?.addRange(n)},children:e}),` `,`to confirm.`]}),(0,U.jsx)(YT,{disabled:d.isPending,type:`text`,className:`mt-2`,autoFocus:!0,autoComplete:`off`,onChange:u})]})})};function ZJt(){let e=Pb([`account`,`project`]),t=cc(),[n,r]=F$(()=>(0,U.jsx)(XJt,{projectName:e.project,accountName:e.account,closeModalAction:r,onFinishDeletion:()=>t(`/`)}),[]);return(0,U.jsxs)(ok,{variant:`danger`,children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{children:`Delete Project`}),(0,U.jsx)(lk,{children:`Permanently delete this project and all associated data. This cannot be undone, there is no going back.`})]}),(0,U.jsx)(uk,{className:`leading-loose text-sm`,children:`Your GitHub repository will remain untouched.`}),(0,U.jsx)(dk,{variant:`danger`,className:`justify-end`,children:(0,U.jsxs)(Y,{"data-test":`delete-button`,variant:`destructive`,onClick:n,children:[(0,U.jsx)(Yp,{size:16}),`Delete Project`]})})]})}var QJt=({children:e,copyValue:t})=>{let{logEvent:n}=S();return(0,U.jsxs)(`div`,{className:`mb-2 md:mb-0`,children:[e,t&&(0,U.jsx)(cP,{className:`relative top-1`,onClick:()=>{n(`project-information-property-copied`)},textToCopy:t})]})},$Jt=()=>{let{logEvent:e}=S(),t=fm([`account`,`project`]);if(!iF(t.account.name,t.project.name).data)return(0,U.jsx)(`div`,{className:`p-6`,children:(0,U.jsx)(f1,{})});let n=[];return n.push({label:`Project Name`,value:t.project.name}),n.push({label:`Account Name`,value:t.account.name}),(0,U.jsxs)(ok,{children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{children:`Project Information`}),(0,U.jsx)(lk,{})]}),(0,U.jsx)(uk,{children:(0,U.jsx)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[150px_1fr] text-sm mt-2`,children:n.map(t=>(0,U.jsxs)(H.Fragment,{children:[(0,U.jsx)(`div`,{className:`font-medium`,children:t.label}),(0,U.jsx)(QJt,{copyValue:t.value,children:t.isLink?(0,U.jsx)(JT,{href:t.value,onClick:()=>{e(`project-information-link-clicked`,{label:t.label,value:t.value})},className:`break-all`,children:t.value}):t.value})]},t.value))})})]})},eYt=()=>(0,U.jsxs)(N7,{title:`General`,description:`Project name, identifiers, and lifecycle.`,children:[(0,U.jsx)($Jt,{}),(0,U.jsx)(ZJt,{})]}),tYt={admin:`Admin`,developer:`Developer`,member:`Member`,"ai-user":`AI User`,"no-access":`No Access`},H7=(e,t)=>e!==`no-access`&&(t||e===`admin`),nYt=({value:e,hiddenRoles:t=[],aiProject:n=!1,...r})=>{let i=um(),a=fm([`account`]).account.entitlements.rbacEnabled,o=jw.filter(r=>!t.concat([`no-access`]).includes(r)&&(r!==`ai-user`||n&&(a||e===`ai-user`)));return(0,U.jsxs)(_Y,{...r,value:e,onValueChange:e=>{H7(e,a)?r.onValueChange?.(e):i.toast((0,U.jsxs)(U.Fragment,{children:[`This role is not available for your account. Please upgrade to the Enterprise plan.`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/accounts/roles-and-permissions`,target:`_blank`,children:`Learn more about roles and permissions.`})]}))},children:[(0,U.jsx)(yY,{className:`min-w-40`,children:(0,U.jsx)(vY,{placeholder:`Select a role`})}),(0,U.jsx)(bY,{className:`min-w-40`,children:o.map(e=>(0,U.jsx)(xY,{value:e,onClick:t=>{H7(e,a)||(t.preventDefault(),t.stopPropagation(),window.open(`https://zuplo.com/docs/articles/accounts/roles-and-permissions`,`_blank`))},children:(0,U.jsxs)(`div`,{className:`grid grid-cols-2`,children:[tYt[e],!H7(e,a)&&(0,U.jsx)(BT,{variant:`outline`,className:``,children:`Enterprise`})]})},e))})]})},rYt={zuplo:{viewBox:[0,0,308,308],ink:[41.36,259.74],Glyph:()=>(0,U.jsxs)(`g`,{fillRule:`nonzero`,fill:`none`,children:[(0,U.jsx)(`path`,{d:`M0 0h308v308H0z`}),(0,U.jsx)(`path`,{d:`M214.523 182.007h-74.088l78.939-79.076a5.34 5.34 0 0 0-.807-8.204 5.314 5.314 0 0 0-2.957-.899H90.239V41.364h137.515a53.31 53.31 0 0 1 28.617 7.922 53.444 53.444 0 0 1 19.967 22.011 52.117 52.117 0 0 1 4.221 31.194 52.062 52.062 0 0 1-14.508 27.924l-51.528 51.592Z`,fill:`currentColor`}),(0,U.jsx)(`path`,{d:`M90.24 119.097h74.092l-78.781 78.917a5.431 5.431 0 0 0-1.172 5.912 5.423 5.423 0 0 0 5.001 3.351h125.017v52.464H77.016a53.322 53.322 0 0 1-28.616-7.923 53.453 53.453 0 0 1-19.968-22.011 52.109 52.109 0 0 1-4.219-31.194 52.059 52.059 0 0 1 14.51-27.924l51.517-51.592Z`,fill:`currentColor`})]})},akamai:{viewBox:[344.42,285.18,451,489.75],ink:[285.18,774.93],Glyph:()=>(0,U.jsxs)(`g`,{fill:`currentColor`,children:[(0,U.jsx)(`path`,{d:`M592.85,764.11c-100.8-30.77-174.12-123.92-174.12-234.05s74.88-205.29,177.4-235.02c10.48-3.06,7.73-9.86-4.91-9.86-136.28,0-246.8,109.69-246.8,244.89s110.51,244.86,246.8,244.86c12.63,0,13.14-7.3,1.63-10.81Z`}),(0,U.jsx)(`path`,{d:`M465.48,587.42c-.68-6.58-1.01-13.23-1.01-19.94,0-107.36,87.05-194.39,194.43-194.39,101.52,0,132,45.31,135.78,42.35,4.12-3.26-36.84-93.07-156.05-93.07-107.39,0-194.44,87.03-194.44,194.39,0,24.84,4.65,48.52,13.13,70.31,3.58,9.14,9.08,9.22,8.17.35Z`}),(0,U.jsx)(`path`,{d:`M546.92,447.31c50.53-22.03,114.01-22.7,176.42-.89,41.91,14.62,66.2,35.5,68.19,34.64,3.31-1.43-24.38-45.28-74.36-64.24-60.51-22.93-125.69-10.93-173.18,26.32-5.22,4.11-3.25,6.87,2.93,4.17Z`})]})}},iYt=({mark:e,...t})=>(0,U.jsx)(`svg`,{viewBox:e.viewBox.join(` `),xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,U.jsx)(e.Glyph,{})}),aYt=({viewBox:[e,t,n,r],ink:[i,a]})=>{let o=n/2,s=(a-i)*.07,c=o/2,l=e-o,u=e+n+o,d=t+r+s;return{surface:`M${l} ${t}${Array.from({length:Math.round((u-l)/c)},(e,t)=>`q${c/2} ${t%2==0?-2*s:2*s} ${c} 0`).join(``)}L${u} ${d}L${l} ${d}Z`,period:o,empty:a-t+s,full:i-t-s}},oYt=({mark:e})=>{let t=(0,H.useId)(),[n,r,i,a]=e.viewBox,{surface:o,period:s,empty:c,full:l}=aYt(e);return(0,U.jsxs)(`svg`,{viewBox:e.viewBox.join(` `),xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`absolute inset-0 size-full text-zuplo-pink`,style:{"--logo-fill-empty":`${c}px`,"--logo-fill-full":`${l}px`,"--logo-fill-period":`${s}px`},children:[(0,U.jsx)(`mask`,{id:t,maskUnits:`userSpaceOnUse`,x:n,y:r,width:i,height:a,children:(0,U.jsxs)(`g`,{className:`logo-fill-level`,children:[(0,U.jsx)(`path`,{className:`logo-fill-wave`,d:o,fill:`#fff`}),(0,U.jsx)(`path`,{className:`logo-fill-wave`,d:o,fill:`#fff`})]})}),(0,U.jsx)(`g`,{mask:`url(#${t})`,children:(0,U.jsx)(e.Glyph,{})})]})},sYt=({variant:e=`full`,className:t,width:n,height:r,fillOnHover:i=!1})=>{let a=xqt();if(e===`mark`){let e=rYt[a.id],o=(0,U.jsx)(iYt,{mark:e,className:t,width:n,height:r,role:`img`,"aria-label":a.logoAlt});return i?(0,U.jsxs)(`span`,{className:`group relative flex`,children:[o,(0,U.jsx)(oYt,{mark:e})]}):o}return e===`full`&&a.logoDark?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`img`,{src:a.logo,alt:a.logoAlt,className:W(t,`dark:hidden`),width:n,height:r}),(0,U.jsx)(`img`,{src:a.logoDark,alt:a.logoAlt,className:W(t,`hidden dark:inline`),width:n,height:r})]}):(0,U.jsx)(`img`,{src:e===`white`?a.logoWhite:a.logo,alt:a.logoAlt,className:W(t),width:n,height:r})},cYt=()=>(0,U.jsx)(`div`,{className:`h-0 flex flex-col items-center -translate-y-14 mb-2`,children:(0,U.jsx)(sYt,{variant:`white`,className:`h-17 w-auto rounded-full bg-zuplo-pink p-4 shadow-xs`})}),lYt=(e,t,n)=>{let[r,i]=(0,H.useState)(t),a=bF(n);return[e===void 0?r:e,(0,H.useCallback)(t=>{e===void 0?i(t):a.current?.(t)},[e,a])]},uYt=Lh({email:Nh().email(`Invalid email address`),role:zh([`admin`,`developer`,`member`,`ai-user`])}),dYt=({inviteOnly:e=!1,account:t,project:n,pool:r,description:i,hiddenRoles:a,children:o,open:s,onOpenChange:c,excludeUserIds:l,changeRoleForUserIds:u})=>{let d=fm([`account`]),{logEvent:f}=S(),[p,m]=lYt(s,!1,c),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(!1),y=bt(),{onError:b,onSuccess:x}=NP(),C=d.account.entitlements.rbacEnabled,w=rk({resolver:ik(uYt),defaultValues:{email:``,role:C?`member`:`admin`}}),T=C?`member`:`admin`,E=Nb(je.authAccountUsersRoles(t),{extractData:!0}),D=w.watch(`email`),O=bF(()=>{w.reset(),g(!1)});(0,H.useEffect)(()=>{p||O.current()},[p,O]);let k=Oe({mutationFn:({email:e,role:i})=>{let a=r&&n?{account:{role:T},project:{name:n,role:T},team:{...r,role:i}}:n?{account:{role:T},project:{name:n,role:i}}:{account:{role:i}},o=E?.data?.find(t=>t.email===e)?.id;return!h&&o&&u?.includes(o)?y.fetch(ae.auth.updateUsersRole({accountName:t,projectName:n,userId:o,role:i})):y.fetch(ae.accountInvite.createAccountInvite(t,e,a))},onError:b,onSuccess:()=>{x(h?`Invitation sent to ${w.getValues(`email`)}`:`Member added to ${d.account.label??d.account.name}`),m(!1)}}),A=pX(D,(E?.data??[]).filter(e=>!l||!l.includes(e.id)&&!l.includes(e.sub)),{getText:e=>[e.name,e.email],key:`email`}),j=e=>{f(`account-invite-submitted`,{role:e.role,teamId:r?.id??``,project:n,account:t}),k.mutate({email:e.email,role:e.role})};return(0,U.jsxs)(Jw,{open:p,onOpenChange:e=>{e||w.reset(),m(e)},children:[o&&(0,U.jsx)(Yw,{asChild:!0,children:o}),(0,U.jsxs)(Zw,{className:`max-w-md`,children:[(0,U.jsx)(zke,{}),(0,U.jsx)(cYt,{}),(0,U.jsxs)(Qw,{className:`mt-2`,children:[(0,U.jsxs)(eT,{children:[`Invite to `,d.account.label??d.account.name]}),(0,U.jsx)(tT,{className:`opacity-75`,children:i??`Once you invite someone to your account, they can be granted access to account projects.`})]}),(0,U.jsx)(UY,{...w,children:(0,U.jsxs)(`form`,{onSubmit:w.handleSubmit(j),className:`mt-2 space-y-4`,children:[(0,U.jsxs)(`div`,{className:`flex justify-between gap-2`,children:[(0,U.jsx)(WY,{control:w.control,name:`email`,render:({field:t})=>(0,U.jsxs)(KY,{className:`w-full`,children:[(0,U.jsx)(qY,{children:`Member`}),(0,U.jsx)(JY,{children:(0,U.jsx)(`div`,{className:`relative`,children:(0,U.jsx)(kT,{open:_&&D.length>0,onOpenChange:v,modal:!1,children:(0,U.jsxs)(nT,{shouldFilter:!1,loop:!0,children:[(0,U.jsx)(ET,{asChild:!0,children:(0,U.jsx)(Uw.Input,{asChild:!0,value:D,onValueChange:t.onChange,onKeyDown:e=>{if(e.key===`Enter`&&_===!1){e.currentTarget.form?.requestSubmit(),e.preventDefault();return}v(e.key!==`Escape`)},onMouseDown:()=>v(e=>!!D||!e),onFocus:()=>v(!0),onBlur:()=>v(!1),children:(0,U.jsx)(YT,{placeholder:`Email address or member name`})})}),!open&&(0,U.jsx)(iT,{"aria-hidden":`true`,className:`hidden`}),(0,U.jsx)(jT,{asChild:!0,align:`start`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{e.target instanceof Element&&e.target.hasAttribute(`cmdk-input`)&&e.preventDefault()},className:`w-(--radix-popover-trigger-width) p-0`,children:(0,U.jsxs)(iT,{className:`max-h-[200px] overflow-y-auto`,children:[(0,U.jsx)(aT,{children:`No members found.`}),(0,U.jsxs)(oT,{children:[!e&&A.map((e,n)=>(0,U.jsx)(sT,{value:n.toString(),onSelect:()=>{t.onChange(e.email),g(!1),v(!1)},children:(0,U.jsx)(`span`,{children:e.name})},e.id)),D.length>0&&(0,U.jsxs)(sT,{value:A.length.toString(),onSelect:()=>{g(!0),v(!1)},children:[(0,U.jsx)(Wee,{size:16,className:`mr-2`}),` `,`Invite "`,D.includes(`@`)?D:`${D}@example.com`,`" to Account`]})]})]})})]})})})}),(0,U.jsx)(XY,{})]})}),(0,U.jsx)(WY,{control:w.control,name:`role`,render:({field:e})=>(0,U.jsxs)(KY,{children:[(0,U.jsx)(qY,{children:`Role`}),(0,U.jsx)(JY,{children:(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{asChild:!0,children:(0,U.jsx)(nYt,{aiProject:!!(n&&!r&&d.project&&VD(d.project)),value:e.value,onValueChange:e.onChange,hiddenRoles:a})}),(0,U.jsx)(ZP,{children:C?(0,U.jsx)(`p`,{children:`New users will be assigned the member role. You can change their role later.`}):(0,U.jsx)(`p`,{children:`New users will be assigned the admin role. You can change their role later.`})})]})}),(0,U.jsx)(XY,{})]})})]}),(0,U.jsx)($w,{children:(0,U.jsx)(Y,{type:`submit`,className:`justify-end`,children:(0,U.jsxs)(aP,{loading:k.isPending,children:[h?`Send Invite`:`Add member`,(0,U.jsx)(TKe,{className:`bg-white/20`,children:(0,U.jsx)(wKe,{onPress:w.handleSubmit(j),hotkey:`meta+Enter`})})]})})})]})})]})]})},fYt=()=>{let{account:e}=fm([`account`]);return e.entitlements.rbacEnabled?null:(0,U.jsxs)(db,{variant:`info`,className:`text-sm`,children:[(0,U.jsx)(op,{size:22}),(0,U.jsx)(pb,{children:(0,U.jsxs)(`p`,{children:[`Role-based access control (RBAC) is not enabled for this account.`,` `,(0,U.jsx)(mb,{to:`mailto:${Tb}?subject=Fine-grain%20access%20control`,children:`Contact sales`}),` `,`for more information.`]})})]})},pYt=({name:e,sub:t,email:n})=>{let{copyToClipboard:r}=Mw(t??n??``);return(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{onDoubleClick:()=>{r()},className:`text-left`,children:e}),(0,U.jsxs)(ZP,{className:`flex items-center gap-2`,children:[t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ete,{size:16}),` Sub `,t]}),n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(yte,{size:16}),` Email `,n]})]})]})},mYt=r(a(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_relativeTime=r()})(e,(function(){return function(e,t,n){e||={};var r=t.prototype,i={future:`in %s`,past:`%s ago`,s:`a few seconds`,m:`a minute`,mm:`%d minutes`,h:`an hour`,hh:`%d hours`,d:`a day`,dd:`%d days`,M:`a month`,MM:`%d months`,y:`a year`,yy:`%d years`};function a(e,t,n,i){return r.fromToBase(e,t,n,i)}n.en.relativeTime=i,r.fromToBase=function(t,r,a,o,s){for(var c,l,u,d=a.$locale().relativeTime||i,f=e.thresholds||[{l:`s`,r:44,d:`second`},{l:`m`,r:89},{l:`mm`,r:44,d:`minute`},{l:`h`,r:89},{l:`hh`,r:21,d:`hour`},{l:`d`,r:35},{l:`dd`,r:25,d:`day`},{l:`M`,r:45},{l:`MM`,r:10,d:`month`},{l:`y`,r:17},{l:`yy`,d:`year`}],p=f.length,m=0;m<p;m+=1){var h=f[m];h.d&&(c=o?n(t).diff(a,h.d,!0):a.diff(t,h.d,!0));var g=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,g<=h.r||!h.r){g<=1&&m>0&&(h=f[m-1]);var _=d[h.l];s&&(g=s(``+g)),l=typeof _==`string`?_.replace(`%d`,g):_(g,r,h.l,u);break}}if(r)return l;var v=u?d.future:d.past;return typeof v==`function`?v(l):v.replace(`%s`,l)},r.to=function(e,t){return a(e,t,this,!0)},r.from=function(e,t){return a(e,t,this)};var o=function(e){return e.$u?n.utc():n()};r.toNow=function(e){return this.to(o(this),e)},r.fromNow=function(e){return this.from(o(this),e)}}}))}))());function hYt({accountName:e,invite:t}){let n=um(),[r,i]=(0,H.useState)(!1),a=b_e();return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Y,{size:`icon`,variant:`ghost`,title:`Remove invitation`,disabled:a.isPending,onClick:()=>i(!0),children:(0,U.jsx)(Yp,{size:18})}),(0,U.jsxs)(M$,{open:r,onOpenChange:i,title:`Delete account invite`,deleteButtonText:`Delete invitation`,isPending:a.isPending,onClickDelete:async()=>{try{await a.mutateAsync({accountName:e,inviteId:t.id}),n.success(`Invitation was removed`),i(!1)}catch(e){n.error(zb(e))}},children:[`You are about to delete the account invite sent to `,t.email,`. The invitation can no longer be used to join your account.`]})]})}function gYt({accountName:e,invite:t}){let n=um(),r=x_e(),[i,a]=(0,H.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{asChild:!0,children:(0,U.jsx)(Y,{size:`icon`,variant:`ghost`,disabled:r.isPending,onClick:()=>a(!0),children:(0,U.jsx)(ute,{size:18})})}),(0,U.jsx)(ZP,{children:`Resend invitation`})]}),(0,U.jsx)(AP,{open:i,onOpenChange:a,title:`Do you want to resend the invitation?`,description:`You are about to resend the account membership invite for "${t.email}" to join "${e}".`,actionLabel:`Resend invitation`,isPending:r.isPending,onConfirm:async()=>{try{await r.mutateAsync({accountName:e,inviteId:t.id}),n.success(`Invitation has been resent`),a(!1)}catch(e){n.error(zb(e)),a(!1)}}})]})}var _Yt=({date:e,withTime:t})=>(0,U.jsxs)(`span`,{children:[e.toLocaleDateString(),t&&` ${e.toLocaleTimeString()}`]}),vYt=({email:e,className:t})=>{let{copyToClipboard:n}=Mw(e);return(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{onDoubleClick:n,className:W(`cursor-pointer`,t),children:e}),(0,U.jsxs)(ZP,{children:[`Copy `,(0,U.jsxs)(`span`,{className:`font-mono`,children:[`"`,e,`"`]}),` to clipboard`]})]})};x7.default.extend(mYt.default);function yYt(){let{account:e}=Pb([`account`]),t=y_e(e).data??[];return t.length===0?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{className:`text-lg font-medium`,children:`Pending account invitations`}),(0,U.jsx)(`div`,{className:`grid grid-cols-4 gap-2`,children:t.map(t=>(0,U.jsxs)(I$,{variant:`outline`,size:`sm`,className:W(`col-span-full grid grid-cols-subgrid justify-between py-1`,(0,x7.default)().diff((0,x7.default)(t.createdOn),`minutes`)<5&&`bg-zuplo-50/50`),children:[(0,U.jsx)(`div`,{className:`text-ellipsis overflow-hidden truncate`,children:(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{children:(0,U.jsxs)(BT,{variant:`outline`,children:[`Invited `,(0,x7.default)(t.createdOn).fromNow()]})}),(0,U.jsx)(ZP,{children:(0,U.jsx)(_Yt,{date:new Date(t.createdOn),withTime:!0})})]})}),(0,U.jsx)(vYt,{email:t.email,className:`text-left text-ellipsis overflow-hidden truncate`}),(0,U.jsxs)(`div`,{className:`flex justify-end col-span-2`,children:[(0,U.jsx)(gYt,{accountName:e,invite:t}),(0,U.jsx)(hYt,{accountName:e,invite:t})]})]},t.id))})]})}var bYt=5,xYt=`Members & Access`,SYt=(0,U.jsxs)(U.Fragment,{children:[`Manage who can access this project. Account members can create or be added to projects.`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/add-project-collaborators`,children:`Learn more`}),`.`]});function CYt(){let e=fm([`account`,`project`]),{canViewMembers:t,role:n,error:r}=ZEe(e.account.name,e.project.name);return n?t?(0,U.jsx)(wYt,{}):(0,U.jsx)(`p`,{className:`p-6`,children:`You do not have access to project membership.`}):r?(0,U.jsxs)(`div`,{role:`alert`,className:`p-6 flex items-center gap-3`,children:[(0,U.jsx)(`p`,{children:`We couldn’t check your project access.`}),(0,U.jsx)(Y,{variant:`outline`,onClick:()=>window.location.reload(),children:`Reload to retry`})]}):(0,U.jsx)(`output`,{"aria-label":`Loading project access`,className:`p-6 flex justify-center items-center`,children:(0,U.jsx)(iP,{color:`primary`})})}function wYt(){let e=fm([`account`,`project`]),t=um(),{user:n}=u(),r=bt(),i=Oe({mutationFn:({userId:t,role:n})=>r.fetch(ae.auth.updateUsersRole({accountName:e.account.name,projectName:e.project.name,userId:t,role:n})),onError:e=>t.error(zb(e))}),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(!1),l=Mb(je.accountMemberInvites(e.account.name)),d=Mb(je.authProjectUsersRoles(e.account.name,e.project.name,{includeInheritedRoles:!1}),{extractData:!0}),f=d.data?.map(e=>e.id),p=Mb(je.authProjectUsersRoles(e.account.name,e.project.name,{includeInheritedRoles:!0}),{extractData:!0}),m=p.data?.filter(e=>!f?.includes(e.id)),h=d.data?.filter(e=>e.project.role!==`no-access`),g=e.account.entitlements.rbacEnabled,_=(h?.map(({id:e})=>e)??[]).concat(g?[]:m?.map(({id:e})=>e)??[]);return(0,U.jsxs)(N7,{title:xYt,description:SYt,action:(0,U.jsx)(dYt,{account:e.account.name,project:e.project.name,changeRoleForUserIds:p.data?.map(({id:e})=>e)??[],excludeUserIds:_,open:s,onOpenChange:c,description:`Inviting a user to a project will grant them access to the project and add them to the account as a member.`,children:(0,U.jsxs)(Y,{children:[(0,U.jsx)(Np,{size:16}),`Add to project`]})}),children:[(0,U.jsxs)(`section`,{className:`flex flex-col gap-3 text-sm`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Members with inherited access`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Account Admins and developers automatically have access to all projects.`})]}),(m?.length??0)>0&&(0,U.jsx)(ok,{className:`overflow-hidden`,children:m?.slice(0,a?void 0:bYt).map(e=>(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-b px-4 py-3 last:border-0`,children:[(0,U.jsx)(pYt,{name:e.name,email:e.email}),(0,U.jsxs)(YP,{children:[(0,U.jsx)(XP,{children:(0,U.jsx)(BT,{variant:`outline`,children:e.project.role===`admin`?`Full access`:`Read only`})}),(0,U.jsx)(ZP,{children:tYt[e.project.role]})]})]},e.id))}),(m?.length??0)>bYt&&(0,U.jsx)(Y,{variant:`ghost`,size:`sm`,onClick:()=>{o(!a)},children:a?`Show less`:`Show more`})]}),l.data?.length>0&&(0,U.jsx)(yYt,{}),(0,U.jsxs)(`section`,{className:`flex flex-col gap-3 text-sm`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Members with project access`}),(0,U.jsx)(ak,{error:d.error}),i.isError&&(0,U.jsx)(fYt,{}),h?.length===0&&(0,U.jsx)(ok,{children:(0,U.jsxs)(hb,{children:[(0,U.jsxs)(gb,{children:[(0,U.jsx)(_b,{variant:`icon`,children:(0,U.jsx)(Zp,{})}),(0,U.jsx)(vb,{children:`No project members yet`}),(0,U.jsx)(yb,{children:`No members have been added directly to this project yet.`})]}),(0,U.jsx)(bb,{children:(0,U.jsxs)(Y,{onClick:()=>c(!0),children:[(0,U.jsx)(Np,{size:16}),`Add to project`]})})]})}),(h?.length??0)>0&&(0,U.jsxs)(ok,{className:`grid grid-cols-[1fr_auto_auto] gap-x-4 overflow-hidden text-sm`,children:[(0,U.jsxs)(Iqt,{children:[(0,U.jsx)(`div`,{children:`Member`}),(0,U.jsx)(`div`,{children:`Role`}),(0,U.jsx)(`div`,{})]}),!d.isError&&h?.map(t=>(0,U.jsxs)(Fqt,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(pYt,{name:t.name,sub:t.sub}),t.sub===n?.sub&&(0,U.jsx)(BT,{variant:`outline`,className:`ml-4`,children:`You`})]}),(0,U.jsx)(`div`,{className:W(`text-ellipsis overflow-hidden truncate`,t.email===t.name&&`hidden`),title:t.email,children:t.email})]}),(0,U.jsx)(`div`,{className:`max-w-60 w-full`,children:(0,U.jsx)(nYt,{aiProject:VD(e.project),hiddenRoles:e.account.entitlements.rbacEnabled?[]:[`member`,`developer`],value:t.project.role,disabled:!!(t.sub===n?.sub||i.isPending),onValueChange:e=>{if(!jw.includes(e))throw Error(`Invalid role`);i.mutate({userId:t.id,role:e})}})}),(0,U.jsx)(`div`,{className:`flex justify-end`,children:(0,U.jsx)(Y,{variant:`ghost`,size:`icon-lg`,onClick:()=>{i.mutate({role:`no-access`,userId:t.id})},children:(0,U.jsx)(Yp,{size:16})})})]},t.sub))]})]})]})}yF(`div`,`grid grid-cols-subgrid col-span-full w-full border-b px-4 py-3 items-center`);var TYt=({accountName:e,projectName:t,sourceRepoUrl:n,defaultBranch:r})=>{let{logEvent:i,captureException:a}=S(),[o,s]=(0,H.useState)(``),[c,l]=(0,H.useState)(r),[u,d]=(0,H.useState)(!1),f=sAe(e,t);(0,H.useEffect)(()=>{u||(s(``),l(r))},[u,r]);let p=n.split(`/`),m=p[p.length-2],h=p[p.length-1],g=async()=>{try{if(s(``),!c||c===r){s(`Select a new default branch.`);return}await f.mutateAsync({defaultBranch:c,sourceRepoUrl:n}),i(`project-update-default-branch-success`,{account:e}),d(!1)}catch(t){a(t);let n=zb(t);s(n),i(`project-update-default-branch-failed`,{account:e,errorMessage:n})}};return(0,U.jsxs)(ok,{children:[(0,U.jsx)(sk,{children:`Default Branch`}),(0,U.jsxs)(uk,{className:`mt-1 text-sm`,children:[(0,U.jsx)(lk,{children:`The default branch is considered the “base” branch in your repository, against which all pull requests and code commits are automatically made. This is the branch used for your project's production deployments.`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(YT,{type:`text`,autoComplete:`off`,id:`default-branch-field`,value:r??`main`,disabled:!0,className:`max-w-52`,"data-test":`default-branch-field`}),(0,U.jsxs)(Jw,{onOpenChange:e=>d(e),open:u,children:[(0,U.jsx)(Yw,{children:(0,U.jsx)(Y,{type:`button`,"data-test":`update-default-branch`,variant:`outline`,children:`Update`})}),(0,U.jsxs)(Zw,{children:[(0,U.jsx)(Qw,{children:(0,U.jsx)(eT,{children:`Switch default branch to another branch`})}),(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(ak,{error:o}),(0,U.jsxs)(tT,{className:`text-foreground`,children:[`Choose another branch in`,` `,(0,U.jsxs)(JT,{href:n,children:[m,`/`,h]}),` `,`to use as the default branch of the project instead of`,` `,r,`.`,(0,U.jsx)(YT,{type:`text`,autoComplete:`off`,placeholder:`Type a branch name`,id:`default-branch-field`,className:`mt-4`,"data-test":`default-branch-field`,value:c,onChange:e=>l(e.target.value)})]})]}),(0,U.jsxs)($w,{children:[(0,U.jsx)(Xw,{children:(0,U.jsx)(Y,{"data-test":`cancel-update-default-branch-btn`,disabled:f.isPending,variant:`ghost`,children:`Cancel`})}),(0,U.jsx)(Y,{"data-test":`update-default-branch-btn`,type:`button`,onClick:g,disabled:f.isPending,variant:`outline`,children:(0,U.jsx)(aP,{loading:f.isPending,alternative:`Updating...`,children:`Switch branch`})})]})]})]})]})]})]})},EYt=`Source Control`,DYt=(0,U.jsxs)(U.Fragment,{children:[`Connect a Git repository to deploy your project. Learn more about deploying with source control in our`,` `,(0,U.jsx)(JT,{href:`https://zuplo.com/docs/articles/step-4-deploying-to-the-edge`,showIcon:!0,children:`documentation`}),`.`]}),OYt=()=>{let e=fm([`account`,`project`]),{logEvent:t}=S(),n=gqt();if((0,H.useEffect)(()=>{t(`source-control-settings-viewed`,{account:e.account.name,project:e.project.name})},[e.account.name,e.project.name,t]),!n.data)return(0,U.jsx)(N7,{title:EYt,description:DYt,children:(0,U.jsx)(HKt,{showHeader:!1})});let r=__e(e.account.name,n.data);return(0,U.jsxs)(N7,{title:EYt,description:DYt,children:[e.project.sourceRepoUrl!==null&&(0,U.jsx)(TYt,{accountName:e.account.name,projectName:e.project.name,sourceRepoUrl:e.project.sourceRepoUrl,defaultBranch:e.project.defaultBranch??void 0}),(0,U.jsxs)(ok,{children:[(0,U.jsxs)(sk,{children:[(0,U.jsx)(ck,{children:`Connected Git Repository`}),(0,U.jsx)(lk,{children:`Seamlessly create Environments for every branch and deployments for any commits pushed to your Git repository.`})]}),(0,U.jsx)(uk,{children:(0,U.jsx)(hqt,{account:e.account,project:e.project,sourceControlConfig:r})})]})]})},kYt=()=>{let{account:e,project:t}=Pb([`account`,`project`]);return(0,U.jsx)(zc,{to:lo(Db.Environments,{account:e,project:t})})},AYt=({to:e})=>(0,U.jsx)(zc,{to:`/accounts/${fm([`account`]).account.name}/settings/${e}`,replace:!0}),jYt=[{key:`general`,group:`project`,icon:(0,U.jsx)(Gp,{className:`w-4 h-4`}),name:`General`,view:(0,U.jsx)(eYt,{}),testID:`settings-general`},{key:`share-project`,group:`project`,icon:(0,U.jsx)(Zp,{className:`w-4 h-4`}),name:`Members & Access`,view:(0,U.jsx)(CYt,{}),testID:`settings-share-project`},{key:`source-control-settings`,group:`project`,icon:(0,U.jsx)(ate,{className:`w-4 h-4`}),name:`Source Control`,view:(0,U.jsx)(OYt,{}),testID:`settings-source-control-settings`},{key:`environment-variables`,group:`configuration`,icon:(0,U.jsx)(Hp,{className:`w-4 h-4`}),name:`Environment Variables`,view:(0,U.jsx)(YJt,{}),testID:`settings-environment-variables`},{key:`custom-domain`,group:`configuration`,icon:(0,U.jsx)(pte,{className:`w-4 h-4`}),name:`Custom Domains`,view:(0,U.jsx)(HJt,{}),testID:`settings-custom-domain`},{key:`ai-providers`,group:`configuration`,icon:(0,U.jsx)(qf,{className:`w-4 h-4`}),name:`AI Gateway`,view:(0,U.jsx)(Qqt,{}),testID:`settings-ai-providers`},{key:`upgrade-billing`,group:`account`,icon:(0,U.jsx)(op,{className:`w-4 h-4`}),name:`Billing`,view:(0,U.jsx)(AYt,{to:`upgrade-billing`}),outbound:!0,testID:`settings-upgrade-billing`},{key:`zuplo-api-keys`,group:`account`,icon:(0,U.jsx)(Dp,{className:`w-4 h-4`}),name:`Zuplo API Keys`,view:(0,U.jsx)(AYt,{to:`api-keys`}),outbound:!0,testID:`settings-zuplo-api-keys`},{key:`api-key-consumers`,group:`configuration`,icon:(0,U.jsx)(Dp,{className:`w-4 h-4`}),name:`API Key Consumers`,view:(0,U.jsx)(()=>{let e=fm([`account`,`project`]);return(0,U.jsx)(zc,{to:lo(Db.ProjectServices,{account:e.account.name,project:e.project.name}),replace:!0})},{}),hidden:!0},{key:`environments`,group:`account`,icon:(0,U.jsx)(Gp,{className:`w-4 h-4`}),name:`Environments`,view:(0,U.jsx)(kYt,{}),hidden:!0}];function MYt({project:e,hideEnvironmentVariables:t}){return jYt.filter(n=>n.hidden?!1:n.key===`ai-providers`?VD(e):n.key===`environment-variables`?!t:!0)}var NYt=({account:e,project:t,environment:n,navigateTo:r})=>{let{data:i}=tAe(e??``,t);return!e||!t||!n?null:(0,U.jsx)(oT,{heading:`Settings`,children:MYt({project:i??{productType:`standard`},hideEnvironmentVariables:!1}).map(n=>(0,U.jsxs)(sT,{onSelect:()=>r(lo(`${Db.Settings}/${n.key}`,{account:e,project:t})),children:[n.icon,(0,U.jsx)(`span`,{className:`ml-3`,children:n.name})]},n.key))})},PYt={GET:`bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300 dark:border-emerald-800`,POST:`bg-sky-50 text-sky-700 border-sky-200 dark:bg-sky-950 dark:text-sky-300 dark:border-sky-800`,PUT:`bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-950 dark:text-amber-300 dark:border-amber-800`,PATCH:`bg-orange-50 text-orange-700 border-orange-200 dark:bg-orange-950 dark:text-orange-300 dark:border-orange-800`,DELETE:`bg-red-50 text-red-700 border-red-200 dark:bg-red-950 dark:text-red-300 dark:border-red-800`},FYt=({account:e,project:t,environment:n,navigateTo:r})=>{let i=iF(e,t).data?.find(e=>e.urlParameter===n)?.name,a=Tft(i??``,{enabled:i!==void 0}).data?.model;if(!a||a.routes.length===0)return null;let o=new Map(a.handlers.map(e=>[e.key,e])),s=lo(Db.Code,{account:e,project:t,environment:n}),c=e=>`${s}?path=${encodeURIComponent(e.filePath)}${e.operationId?`&operation=${encodeURIComponent(e.operationId)}`:``}`;return(0,U.jsx)(oT,{heading:`Routes`,children:a.routes.map(e=>{let t=e.handlerKey?o.get(e.handlerKey):void 0;return(0,U.jsxs)(sT,{value:e.id,keywords:[`${e.method} ${e.path}`,...[e.operationId,e.summary,t?.name].filter(e=>!!e),...e.inboundPolicies,...e.outboundPolicies],onSelect:()=>r(c(e)),className:`gap-2`,children:[(0,U.jsx)(`span`,{className:W(`w-14 shrink-0 rounded-sm border px-1 py-0.5 text-center font-mono text-[10px] font-semibold uppercase leading-4`,PYt[e.method]??`bg-neutral-50 text-neutral-600 border-neutral-200 dark:bg-neutral-900 dark:text-neutral-300 dark:border-neutral-700`),children:e.method}),(0,U.jsx)(`span`,{className:`truncate font-mono`,children:e.path}),e.summary&&(0,U.jsx)(`span`,{className:`ml-auto truncate pl-3 text-xs text-muted-foreground`,children:e.summary})]},e.id)})})},U7=({path:e,children:t,navigateTo:n,...r})=>(0,U.jsxs)(sT,{onSelect:()=>n(lo(e,r)),children:[(0,U.jsx)(`div`,{className:`mr-2`,children:t??(0,U.jsx)(Ff,{className:` h-4 w-4`})}),(0,U.jsx)(`span`,{children:Object.entries(Db).find(([,t])=>t===e)?.at(0)})]}),IYt=({account:e,navigateTo:t})=>{let{isAiUser:n,isLoading:r}=$Ee(e);return n||r?null:(0,U.jsx)(U7,{path:Db.AccountSettings,navigateTo:t,account:e,children:(0,U.jsx)(Lp,{})})};function LYt(){let{isAuthenticated:e}=u(),t=xqt(),{account:n,project:r,environment:i}=fc(),a=cc(),o=n&&r&&i,s={account:n,project:r,environment:i},[c,l]=(0,H.useState)(``),d=(0,H.useRef)(null),f=e=>{l(e),d.current?.scrollTo({top:0})},p=Bb({enabled:e});eAe(e?p.data?.map(e=>e.name)??[]:[]);let[m,h]=(0,H.useState)(!1);CF(`meta+k`,()=>{h(!0)});let g=e=>{h(e),e||l(``)},_=e=>{a(e),g(!1)};return(0,U.jsxs)(HDe,{open:m,onOpenChange:g,filter:Dqt,children:[(0,U.jsx)(rT,{placeholder:`What do you want to do?`,onValueChange:f}),(0,U.jsxs)(iT,{ref:d,children:[(0,U.jsx)(aT,{children:(0,U.jsxs)(`div`,{className:`text-muted-foreground my-3`,children:[`No results found "`,c,`".`]})}),o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(FYt,{navigateTo:_,account:n,project:r,environment:i}),(0,U.jsx)(kqt,{navigateTo:_,account:n,project:r,environment:i})]}),n&&r&&i&&(0,U.jsx)(NYt,{navigateTo:_,...s}),e&&(0,U.jsx)(wqt,{navigateTo:_,accounts:p.data,search:c}),(0,U.jsxs)(oT,{title:t.shortName,children:[(0,U.jsx)(U7,{path:Db.Profile,navigateTo:_,children:(0,U.jsx)(Hte,{})}),(0,U.jsx)(U7,{path:Db.Logout,navigateTo:_,children:(0,U.jsx)(vte,{})}),n&&r&&(0,U.jsx)(U7,{path:Db.Settings,navigateTo:_,account:n,project:r,children:(0,U.jsx)(Lp,{})}),n&&e&&(0,U.jsx)(IYt,{account:n,navigateTo:_})]}),(0,U.jsx)(Oqt,{query:c,onSelected:()=>g(!1)})]})]})}var RYt=Date.now(),zYt=300*1e3,BYt=14400*1e3,VYt=1440*60*1e3,HYt=async e=>{try{let t=await fetch(e,{method:`HEAD`,cache:`no-cache`});if(!t.ok)return!1;let n=t.headers.get(`date`),r=t.headers.get(`last-modified`);if(!n||!r)return!1;let i=new Date(n).getTime(),a=new Date(r).getTime();if(Number.isNaN(i)||Number.isNaN(a))return!1;let o=i-a>=VYt;return a>RYt&&i>RYt&&o}catch{return!1}},UYt=({enabled:e})=>{let t=(0,H.useRef)(0),n=y(),{data:r}=k({enabled:e,refetchInterval:zYt,refetchIntervalInBackground:!1,networkMode:`online`,retry:!1,queryFn:async()=>{let e=await HYt(window.location.href),r=Date.now();return e&&r-t.current>=BYt?(t.current=r,n.capture(`show-update-toast`),!0):!1},queryKey:[`update-check`]});return(0,U.jsxs)(im,{open:r??!1,duration:1/0,children:[(0,U.jsxs)(rm,{children:[(0,U.jsx)(sm,{children:`Update available`}),(0,U.jsx)(cm,{children:`A new version of the Zuplo Portal is available. Click to reload.`})]}),(0,U.jsx)(am,{altText:`Reload`,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),children:`Reload`})}),(0,U.jsx)(om,{})]})},WYt=e=>e.handle?.preserveScroll===!0,GYt=(e,t)=>{for(let t=e.length-1;t>=0;t--)if(!WYt(e[t]))return e[t].pathname;return t},KYt=`[data-scroll-reset]`,W7=()=>Array.from(document.querySelectorAll(KYt)),qYt=e=>{if(!e)return!1;try{let t=document.getElementById(decodeURIComponent(e.slice(1)));return t?.scrollIntoView(),t!==null}catch{return!1}},JYt=e=>{let t=W7(),n=0,r=()=>{let i=!0;t.forEach((t,n)=>{let r=e[n]??0;t.scrollTop=r,Math.abs(t.scrollTop-r)>1&&(i=!1)}),!i&&++n<30&&requestAnimationFrame(r)};r()};function YYt(){let{key:e,pathname:t,hash:n}=ic(),r=ac(),i=GYt(wc(),t),a=(0,H.useRef)(i),o=(0,H.useRef)(e),s=(0,H.useRef)(new Map);return(0,H.useEffect)(()=>{let e=e=>{e.target instanceof Element&&e.target.matches(KYt)&&s.current.set(o.current,W7().map(e=>e.scrollTop))};return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,e,{capture:!0})},[]),(0,H.useLayoutEffect)(()=>{let t=a.current!==i;if(a.current=i,o.current=e,t&&r===`POP`)JYt(s.current.get(e)??[]);else if(t&&!qYt(n)){window.scrollTo(0,0);for(let e of W7())e.scrollTop=0}s.current.has(e)||s.current.set(e,W7().map(e=>e.scrollTop))},[e,i,n,r]),null}var XYt=({enableUpdateNotifications:e})=>(0,U.jsx)(rvt,{children:(0,U.jsxs)(tm,{children:[(0,U.jsx)(YYt,{}),(0,U.jsx)(UYt,{enabled:e}),(0,U.jsx)(LYt,{}),(0,U.jsx)(Kte,{}),(0,U.jsx)(Bc,{}),(0,U.jsx)(nm,{})]})});function ZYt(){return(0,U.jsx)(`div`,{className:`m-auto`,children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2 my-5`,children:[(0,U.jsx)(`div`,{children:(0,U.jsx)(BT,{variant:`outline`,children:`404`})}),(0,U.jsx)(`span`,{className:`text-2xl font-medium`,children:`Oops! Page not found.`}),(0,U.jsx)(`span`,{children:`Sorry, we could not find the page you were looking for.`}),(0,U.jsx)(`div`,{className:`h-2`}),(0,U.jsx)(hpt,{hasGoHome:!0})]})})}var QYt=()=>{let{environment:e}=Pb([`environment`]),[t,n]=(0,H.useState)(null),r=vm(e=>e.updateFile),i=vm(e=>e.filesByPath);return{conflict:t,checkForConflictsBeforeSave:(0,H.useCallback)(async(t,r)=>{let a=i[t];try{let i=await nu(e,t);return a.lastModified&&i.lastModified&&i.lastModified>a.lastModified?(jt.warn(`File ${t} was modified on disk. Showing conflict dialog before save.`),new Promise(e=>{n({filePath:t,localContent:a.content??``,remoteContent:i.content??``,remoteLastModified:i.lastModified,onProceed:async()=>{await r(),e(!0)}})})):(await r(),!0)}catch(e){return jt.error(`Error checking for conflicts`,{error:e}),await r(),!0}},[e,i]),showConflict:(0,H.useCallback)(e=>{jt.info(`Showing conflict dialog for ${e.filePath}`),n(e)},[]),resolveConflict:(0,H.useCallback)(async a=>{if(!t)return;let o=i[t.filePath];if(!o){n(null);return}if(a===`remote`)r({...o,content:t.remoteContent,lastModified:t.remoteLastModified,saveState:Ql.unmodified}),jt.info(`Using disk version for ${t.filePath}, canceling save`),n(null);else if(jt.info(`User chose local version for ${t.filePath}${t.onProceed?`, proceeding with save`:`, saving to disk`}`),t.onProceed)await t.onProceed(),n(null);else try{await iu(e,{path:o.path,content:o.content},{forceSave:!0});let i=await nu(e,t.filePath);r({...o,lastModified:i.lastModified,saveState:Ql.unmodified}),jt.info(`Successfully saved local version for ${t.filePath}`),n(null)}catch(e){jt.error(`Error saving local version for ${t.filePath}`,{error:e}),r({...o,saveState:Ql.modified})}},[t,i,r,e]),cancelConflict:(0,H.useCallback)(async()=>{if(!t)return;let a=i[t.filePath];if(a){let n=await nu(e,t.filePath);r({...a,lastModified:n.lastModified,saveState:Ql.modified}),jt.info(`Conflict dialog canceled for ${t.filePath}, file marked as modified`)}n(null)},[t,i,r,e])}};function $Yt({open:e,filePath:t,localContent:n,remoteContent:r,onResolve:i,onCancel:a}){let[o,s]=(0,H.useState)(`local`),c=vX(t);return(0,U.jsx)(Jw,{open:e,onOpenChange:e=>!e&&a(),children:(0,U.jsxs)(Zw,{className:`max-w-7xl max-h-[90vh] p-0`,showCloseButton:!1,children:[(0,U.jsx)(`div`,{className:`p-6 pb-0`,children:(0,U.jsxs)(Qw,{children:[(0,U.jsx)(eT,{className:`text-lg font-semibold text-left mb-1`,children:`File Conflict Detected`}),(0,U.jsxs)(`p`,{className:`text-sm text-muted-foreground text-left`,children:[(0,U.jsx)(`span`,{className:`font-mono font-semibold`,children:t}),` has been modified both locally and on disk`]})]})}),(0,U.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col px-6`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-2`,children:[(0,U.jsxs)(`button`,{type:`button`,className:`flex flex-col py-3 cursor-pointer transition-all border-t-4 border-x ${o===`local`?`border-t-pink-500 border-x-pink-200 bg-pink-50`:`border-t-border border-x-border bg-gray-50 dark:bg-neutral-900 hover:bg-gray-100 dark:hover:bg-neutral-800`}`,style:{paddingLeft:`26px`,paddingRight:`24px`},onClick:()=>s(`local`),"aria-pressed":o===`local`,children:[(0,U.jsx)(`div`,{className:`font-semibold text-sm`,children:`Browser Version`}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Current editor content`})]}),(0,U.jsxs)(`button`,{type:`button`,className:`flex flex-col px-6 py-3 cursor-pointer transition-all border-t-4 border-x ${o===`remote`?`border-t-pink-500 border-x-pink-200 bg-pink-50`:`border-t-border border-x-border bg-gray-50 dark:bg-neutral-900 hover:bg-gray-100 dark:hover:bg-neutral-800`}`,onClick:()=>s(`remote`),"aria-pressed":o===`remote`,children:[(0,U.jsx)(`div`,{className:`font-semibold text-sm`,children:`Disk Version`}),(0,U.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`File on disk`})]})]}),(0,U.jsx)(`div`,{className:`border border-t-0 overflow-hidden shadow-xs flex-1 min-h-[55vh]`,children:(0,U.jsx)(xP,{original:n,modified:r,language:c,options:{readOnly:!0,renderSideBySide:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:13,wordWrap:`off`}})})]}),(0,U.jsxs)($w,{className:`px-6 pb-6 flex-row justify-between items-center`,children:[(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:o===`local`?(0,U.jsx)(U.Fragment,{children:`Browser version will be saved to disk`}):(0,U.jsx)(U.Fragment,{children:`Disk version will replace browser content`})}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(Y,{variant:`ghost`,onClick:a,children:`Cancel`}),(0,U.jsxs)(Y,{variant:`default`,onClick:()=>i(o),children:[`Apply `,o===`local`?`Browser`:`Disk`,` Version`]})]})]})]})})}function eXt(){let{environment:e}=Pb([`environment`]),{conflict:t,showConflict:n,resolveConflict:r,cancelConflict:i}=QYt(),a=vm(e=>e.filesByPath),o=vm(e=>e.saveConflictPath),s=vm(e=>e.clearSaveConflict);return(0,H.useEffect)(()=>{if(o){jt.info(`Save conflict detected for ${o}`);let t=a[o];t?nu(e,o).then(e=>{n({filePath:o,localContent:t.content??``,remoteContent:e.content??``,remoteLastModified:e.lastModified})}).catch(e=>{jt.error(`Error fetching file for conflict dialog`,{error:e})}):jt.warn(`No file model found for ${o}`),s()}},[o,a,s,n,e]),t?(0,U.jsx)($Yt,{open:!0,filePath:t.filePath,localContent:t.localContent,remoteContent:t.remoteContent,onResolve:r,onCancel:i}):null}var tXt=()=>{let e=fm(),{monaco:t,reloadFiles:n}=v7(),r=bF(n.execute),i=e.environment.name,{error:a}=k({queryKey:[`reloadFiles`,e.account.name,e.project.name,i],queryFn:async()=>{try{return await r.current({accountName:e.account.name,projectName:e.project.name,environmentName:e.environment.name}),!0}catch(e){throw jt.error(`Failed to reload files`,{error:e}),e}},refetchOnWindowFocus:!1,enabled:!!t&&!!i,retry:3,retryDelay:e=>Math.min(1e3*2**e,3e4)});return a?(0,U.jsx)(`div`,{className:`flex items-center justify-center h-full bg-gray-50`,children:(0,U.jsxs)(`div`,{className:`text-center p-8 max-w-lg`,children:[(0,U.jsx)(`h2`,{className:`text-xl font-semibold text-gray-900 mb-2`,children:`Failed to Load Files`}),(0,U.jsx)(`p`,{className:`text-gray-600 mb-4`,children:`Unable to load project files from the local server. Please check that the dev server is running and try again.`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`px-4 py-2 bg-blue-600 text-white rounded-sm hover:bg-blue-700`,children:`Retry`})]})}):null},nXt=()=>{let{account:e,project:t}=Pb([`account`,`project`]),n=vm(e=>e.resetStore);return(0,H.useEffect)(()=>{n()},[t,e,n]),(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(tXt,{}),(0,U.jsx)(eXt,{}),(0,U.jsx)(PGt,{}),(0,U.jsx)(Bc,{})]})};H.createContext({en:{translations:{archiveNotification:`Archive this notification`,archiveRead:`Archive Read`,markAllAsRead:`Mark all as read`,notifications:`Notifications`,emptyFeedTitle:`No notifications yet`,emptyFeedBody:`We'll let you know when we've got something new for you.`,all:`All`,unread:`Unread`,read:`Read`,unseen:`Unseen`,msTeamsChannelSetError:`Error setting channel.`,msTeamsConnect:`Connect to Microsoft Teams`,msTeamsConnected:`Connected`,msTeamsConnecting:`Connecting to Microsoft Teams…`,msTeamsConnectionErrorExists:`Try reconnecting to Microsoft Teams to find and select channels from your teams.`,msTeamsConnectionErrorOccurred:`There was an error connecting to Microsoft Teams. Try reconnecting to find and select channels from your teams.`,msTeamsConnectContainerDescription:`Connect to get notifications in Microsoft Teams`,msTeamsDisconnect:`Disconnect`,msTeamsDisconnecting:`Disconnecting from Microsoft Teams…`,msTeamsError:`Error`,msTeamsReconnect:`Reconnect`,msTeamsTenantIdNotSet:`Microsoft Teams tenant ID not set.`,slackConnectChannel:`Connect channel`,slackChannelId:`Slack channel ID`,slackConnecting:`Connecting to Slack...`,slackDisconnecting:`Disconnecting...`,slackConnect:`Connect to Slack`,slackConnected:`Connected`,slackConnectContainerDescription:`Connect to get notifications in your Slack workspace.`,slackSearchbarDisconnected:`Slack is not connected.`,slackSearchbarNoChannelsConnected:`Search channels`,slackSearchbarNoChannelsFound:`No slack channels.`,slackSearchbarChannelsError:`Error fetching channels.`,slackSearchChannels:`Search channels`,slackConnectionErrorExists:`Try reconnecting to Slack to find and select channels from your workspace.`,slackConnectionErrorOccurred:`There was an error connecting to Slack. Try reconnecting to find and select channels from your workspace.`,slackChannelAlreadyConnected:`Error: already connected`,slackError:`Error`,slackDisconnect:`Disconnect`,slackChannelSetError:`Error setting channel.`,slackAccessTokenNotSet:`Access token not set.`,slackReconnect:`Reconnect`},locale:`en`},de:{translations:{archiveNotification:`Benachrichtigung archivieren`,archiveRead:`Gelesenes Archivieren`,markAllAsRead:`Alle als gelesen markieren`,notifications:`Benachrichtigungen`,emptyFeedTitle:`Noch keine Benachrichtigungen`,emptyFeedBody:`Wir werden dich benachrichtigen, sobald wir etwas Neues für dich haben.`,all:`Alle`,unread:`Ungelesen`,read:`Gelesen`,unseen:`Ungesehen`,slackConnectChannel:`Kanal verbinden`,slackChannelId:`Slack Kanal ID`,slackConnecting:`Verbinden mit Slack...`,slackDisconnecting:`Trennen der Verbindung...`,slackConnect:`Mit Slack verbinden`,slackConnected:`Verbunden`,slackConnectContainerDescription:`Verbinden, um Benachrichtigungen in Ihrem Slack-Arbeitsbereich zu erhalten.`,slackSearchbarDisconnected:`Slack ist nicht verbunden.`,slackSearchbarNoChannelsConnected:`Suchkanäle`,slackSearchbarNoChannelsFound:`Keine schlaffen Kanäle.`,slackSearchbarChannelsError:`Fehler beim Abrufen von Kanälen.`,slackSearchChannels:`Suchkanäle`,slackConnectionErrorExists:`Versuchen Sie, sich erneut mit Slack zu verbinden, um Kanäle in Ihrem Arbeitsbereich zu finden und auszuwählen.`,slackConnectionErrorOccurred:`Es ist ein Fehler beim Verbinden mit Slack aufgetreten. Versuchen Sie, sich erneut zu verbinden, um Kanäle in Ihrem Arbeitsbereich zu finden und auszuwählen.`,slackChannelAlreadyConnected:`Fehler: bereits verbunden`,slackError:`Fehler`,slackDisconnect:`Trennen Sie die Verbindung.`,slackChannelSetError:`Fehlereinstellung Kanal.`,slackAccessTokenNotSet:`Zugriffstoken nicht gesetzt.`,slackReconnect:`Neu verbinden`},locale:`de`}}.en),a(((e,t)=>{(function(n){var r=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(e){return Object.prototype.toString.call(e)===`[object Array]`},a=10,o=typeof process==`object`&&typeof process.nextTick==`function`,s=typeof Symbol==`function`,c=typeof Reflect==`object`,l=typeof setImmediate==`function`?setImmediate:setTimeout,u=s?c&&typeof Reflect.ownKeys==`function`?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function d(){this._events={},this._conf&&f.call(this,this._conf)}function f(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==n&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function p(e,t){var n=`(node) warning: possible EventEmitter memory leak detected. `+e+` listeners added. Use emitter.setMaxListeners() to increase limit.`;if(this.verboseMemoryLeak&&(n+=` Event name: `+t+`.`),typeof process<`u`&&process.emitWarning){var r=Error(n);r.name=`MaxListenersExceededWarning`,r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var m=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var i=Array(r);r--;)i[r]=arguments[r];return i}};function h(e,t){for(var r={},i,a=e.length,o=t?t.length:0,s=0;s<a;s++)i=e[s],r[i]=s<o?t[s]:n;return r}function g(e,t,n){this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0;var r,i;if((n.on||n.off)&&(r=n.on,i=n.off),t.addEventListener?(r=t.addEventListener,i=t.removeEventListener):t.addListener?(r=t.addListener,i=t.removeListener):t.on&&(r=t.on,i=t.off),!r&&!i)throw Error(`target does not implement any known event API`);if(typeof r!=`function`)throw TypeError(`on method must be a function`);if(typeof i!=`function`)throw TypeError(`off method must be a function`);this._on=r,this._off=i;var a=e._observers;a?a.push(this):e._observers=[this]}Object.assign(g.prototype,{subscribe:function(e,t,n){var r=this,i=this._target,a=this._emitter,o=this._listeners,s=function(){var r=m.apply(null,arguments),o={data:r,name:t,original:e};if(n){n.call(i,o)!==!1&&a.emit.apply(a,[o.name].concat(r));return}a.emit.apply(a,[t].concat(r))};if(o[e])throw Error(`Event '`+e+`' is already listening`);this._listenersCount++,a._newListener&&a._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&o[e]===null&&(o[e]=s,r._on.call(i,e,s))},a.on(`newListener`,this._onNewListener),this._onRemoveListener=function(n){n===t&&!a.hasListeners(n)&&o[e]&&(o[e]=null,r._off.call(i,e,s))},o[e]=null,a.on(`removeListener`,this._onRemoveListener)):(o[e]=s,r._on.call(i,e,s))},unsubscribe:function(e){var t=this,n=this._listeners,r=this._emitter,i,a,o=this._off,s=this._target,c;if(e&&typeof e!=`string`)throw TypeError(`event must be a string`);function l(){t._onNewListener&&(r.off(`newListener`,t._onNewListener),r.off(`removeListener`,t._onRemoveListener),t._onNewListener=null,t._onRemoveListener=null);var e=C.call(r,t);r._observers.splice(e,1)}if(e){if(i=n[e],!i)return;o.call(s,e,i),delete n[e],--this._listenersCount||l()}else{for(a=u(n),c=a.length;c-- >0;)e=a[c],o.call(s,e,n[e]);this._listeners={},this._listenersCount=0,l()}}});function _(e,t,i,a){var o=Object.assign({},t);if(!e)return o;if(typeof e!=`object`)throw TypeError(`options must be an object`);var s=Object.keys(e),c=s.length,l,u,d;function f(e){throw Error(`Invalid "`+l+`" option value`+(e?`. Reason: `+e:``))}for(var p=0;p<c;p++){if(l=s[p],!a&&!r.call(t,l))throw Error(`Unknown "`+l+`" option`);u=e[l],u!==n&&(d=i[l],o[l]=d?d(u,f):u)}return o}function v(e,t){return(typeof e!=`function`||!e.hasOwnProperty(`prototype`))&&t(`value must be a constructor`),e}function y(e){var t=`value must be type of `+e.join(`|`),n=e.length,r=e[0],i=e[1];return n===1?function(e,n){if(typeof e===r)return e;n(t)}:n===2?function(e,n){var a=typeof e;if(a===r||a===i)return e;n(t)}:function(r,i){for(var a=typeof r,o=n;o-- >0;)if(a===e[o])return r;i(t)}}var b=y([`function`]),x=y([`object`,`function`]);function S(e,t,n){var r,i,a=0,o,s=new e(function(c,l,u){n=_(n,{timeout:0,overload:!1},{timeout:function(e,t){return e*=1,(typeof e!=`number`||e<0||!Number.isFinite(e))&&t(`timeout must be a positive number`),e}}),r=!n.overload&&typeof e.prototype.cancel==`function`&&typeof u==`function`;function d(){i&&=null,a&&=(clearTimeout(a),0)}var f=function(e){d(),c(e)},p=function(e){d(),l(e)};r?t(f,p,u):(i=[function(e){p(e||Error(`canceled`))}],t(f,p,function(e){if(o)throw Error(`Unable to subscribe on cancel event asynchronously`);if(typeof e!=`function`)throw TypeError(`onCancel callback must be a function`);i.push(e)}),o=!0),n.timeout>0&&(a=setTimeout(function(){var e=Error(`timeout`);e.code=`ETIMEDOUT`,a=0,s.cancel(e),l(e)},n.timeout))});return r||(s.cancel=function(e){if(i){for(var t=i.length,n=1;n<t;n++)i[n](e);i[0](e),i=null}}),s}function C(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function w(e,t,n,r,i){if(!n)return null;if(r===0){var a=typeof t;if(a===`string`){var o,s,c=0,l=0,d=this.delimiter,f=d.length;if((s=t.indexOf(d))!==-1){o=[,,,,,];do o[c++]=t.slice(l,s),l=s+f;while((s=t.indexOf(d,l))!==-1);o[c++]=t.slice(l),t=o,i=c}else t=[t],i=1}else a===`object`?i=t.length:(t=[t],i=1)}var p=null,m,h,g,_,v,y=t[r],b=t[r+1],x,S;if(r===i)n._listeners&&(typeof n._listeners==`function`?(e&&e.push(n._listeners),p=[n]):(e&&e.push.apply(e,n._listeners),p=[n]));else if(y===`*`){for(x=u(n),s=x.length;s-- >0;)m=x[s],m!==`_listeners`&&(S=w(e,t,n[m],r+1,i),S&&(p?p.push.apply(p,S):p=S));return p}else if(y===`**`){for(v=r+1===i||r+2===i&&b===`*`,v&&n._listeners&&(p=w(e,t,n,i,i)),x=u(n),s=x.length;s-- >0;)m=x[s],m!==`_listeners`&&(m===`*`||m===`**`?(n[m]._listeners&&!v&&(S=w(e,t,n[m],i,i),S&&(p?p.push.apply(p,S):p=S)),S=w(e,t,n[m],r,i)):S=m===b?w(e,t,n[m],r+2,i):w(e,t,n[m],r,i),S&&(p?p.push.apply(p,S):p=S));return p}else n[y]&&(p=w(e,t,n[y],r+1,i));if(h=n[`*`],h&&w(e,t,h,r+1,i),g=n[`**`],g)if(r<i)for(g._listeners&&w(e,t,g,i,i),x=u(g),s=x.length;s-- >0;)m=x[s],m!==`_listeners`&&(m===b?w(e,t,g[m],r+2,i):m===y?w(e,t,g[m],r+1,i):(_={},_[m]=g[m],w(e,t,{"**":_},r+1,i)));else g._listeners?w(e,t,g,i,i):g[`*`]&&g[`*`]._listeners&&w(e,t,g[`*`],i,i);return p}function T(e,t,n){var r=0,i=0,a,o=this.delimiter,s=o.length,c;if(typeof e==`string`)if((a=e.indexOf(o))!==-1){c=[,,,,,];do c[r++]=e.slice(i,a),i=a+s;while((a=e.indexOf(o,i))!==-1);c[r++]=e.slice(i)}else c=[e],r=1;else c=e,r=e.length;if(r>1){for(a=0;a+1<r;a++)if(c[a]===`**`&&c[a+1]===`**`)return}var l=this.listenerTree,u;for(a=0;a<r;a++)if(u=c[a],l=l[u]||(l[u]={}),a===r-1)return l._listeners?(typeof l._listeners==`function`&&(l._listeners=[l._listeners]),n?l._listeners.unshift(t):l._listeners.push(t),!l._listeners.warned&&this._maxListeners>0&&l._listeners.length>this._maxListeners&&(l._listeners.warned=!0,p.call(this,l._listeners.length,u))):l._listeners=t,!0;return!0}function E(e,t,n,r){for(var i=u(e),a=i.length,o,s,c,l=e._listeners,d;a-- >0;)s=i[a],o=e[s],c=s===`_listeners`?n:n?n.concat(s):[s],d=r||typeof s==`symbol`,l&&t.push(d?c:c.join(this.delimiter)),typeof o==`object`&&E.call(this,o,t,c,d);return t}function D(e){for(var t=u(e),n=t.length,r,i,a;n-- >0;)i=t[n],r=e[i],r&&(a=!0,i!==`_listeners`&&!D(r)&&delete e[i]);return a}function O(e,t,n){this.emitter=e,this.event=t,this.listener=n}O.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function k(e,t,r){if(r===!0)a=!0;else if(r===!1)i=!0;else{if(!r||typeof r!=`object`)throw TypeError(`options should be an object or true`);var i=r.async,a=r.promisify,s=r.nextTick,c=r.objectify}if(i||s||a){var u=t,d=t._origin||t;if(s&&!o)throw Error(`process.nextTick is not supported`);a===n&&(a=t.constructor.name===`AsyncFunction`),t=function(){var e=arguments,t=this,n=this.event;return a?s?Promise.resolve():new Promise(function(e){l(e)}).then(function(){return t.event=n,u.apply(t,e)}):(s?process.nextTick:l)(function(){t.event=n,u.apply(t,e)})},t._async=!0,t._origin=d}return[t,c?new O(this,e,t):this]}function A(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,e)}A.EventEmitter2=A,A.prototype.listenTo=function(e,t,r){if(typeof e!=`object`)throw TypeError(`target musts be an object`);var a=this;r=_(r,{on:n,off:n,reducers:n},{on:b,off:b,reducers:x});function o(t){if(typeof t!=`object`)throw TypeError(`events must be an object`);for(var n=r.reducers,i=C.call(a,e),o=i===-1?new g(a,e,r):a._observers[i],s=u(t),c=s.length,l,d=typeof n==`function`,f=0;f<c;f++)l=s[f],o.subscribe(l,t[l]||l,d?n:n&&n[l])}return i(t)?o(h(t)):o(typeof t==`string`?h(t.split(/\s+/)):t),this},A.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r=n.length,i,a=!1;if(e&&typeof e!=`object`)throw TypeError(`target should be an object`);for(;r-- >0;)i=n[r],(!e||i._target===e)&&(i.unsubscribe(t),a=!0);return a},A.prototype.delimiter=`.`,A.prototype.setMaxListeners=function(e){e!==n&&(this._maxListeners=e,this._conf||={},this._conf.maxListeners=e)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event=``,A.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},A.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},A.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},A.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},A.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},A.prototype._many=function(e,t,n,r,i){var a=this;if(typeof n!=`function`)throw Error(`many only accepts instances of Function`);function o(){return--t===0&&a.off(e,o),n.apply(this,arguments)}return o._origin=n,this._on(e,o,r,i)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||d.call(this);var e=arguments[0],t,n=this.wildcard,r,i,a,o,c;if(e===`newListener`&&!this._newListener&&!this._events.newListener)return!1;if(n&&(t=e,e!==`newListener`&&e!==`removeListener`&&typeof e==`object`)){if(i=e.length,s){for(a=0;a<i;a++)if(typeof e[a]==`symbol`){c=!0;break}}c||(e=e.join(this.delimiter))}var l=arguments.length,u;if(this._all&&this._all.length)for(u=this._all.slice(),a=0,i=u.length;a<i;a++)switch(this.event=e,l){case 1:u[a].call(this,e);break;case 2:u[a].call(this,e,arguments[1]);break;case 3:u[a].call(this,e,arguments[1],arguments[2]);break;default:u[a].apply(this,arguments)}if(n)u=[],w.call(this,u,t,this.listenerTree,0,i);else if(u=this._events[e],typeof u==`function`){switch(this.event=e,l){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(r=Array(l-1),o=1;o<l;o++)r[o-1]=arguments[o];u.apply(this,r)}return!0}else u&&=u.slice();if(u&&u.length){if(l>3)for(r=Array(l-1),o=1;o<l;o++)r[o-1]=arguments[o];for(a=0,i=u.length;a<i;a++)switch(this.event=e,l){case 1:u[a].call(this);break;case 2:u[a].call(this,arguments[1]);break;case 3:u[a].call(this,arguments[1],arguments[2]);break;default:u[a].apply(this,r)}return!0}else if(!this.ignoreErrors&&!this._all&&e===`error`)throw arguments[1]instanceof Error?arguments[1]:Error(`Uncaught, unspecified 'error' event.`);return!!this._all},A.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||d.call(this);var e=arguments[0],t=this.wildcard,n,r,i,a,o,c;if(e===`newListener`&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(t&&(n=e,e!==`newListener`&&e!==`removeListener`&&typeof e==`object`)){if(a=e.length,s){for(o=0;o<a;o++)if(typeof e[o]==`symbol`){r=!0;break}}r||(e=e.join(this.delimiter))}var l=[],u=arguments.length,f;if(this._all)for(o=0,a=this._all.length;o<a;o++)switch(this.event=e,u){case 1:l.push(this._all[o].call(this,e));break;case 2:l.push(this._all[o].call(this,e,arguments[1]));break;case 3:l.push(this._all[o].call(this,e,arguments[1],arguments[2]));break;default:l.push(this._all[o].apply(this,arguments))}if(t?(f=[],w.call(this,f,n,this.listenerTree,0)):f=this._events[e],typeof f==`function`)switch(this.event=e,u){case 1:l.push(f.call(this));break;case 2:l.push(f.call(this,arguments[1]));break;case 3:l.push(f.call(this,arguments[1],arguments[2]));break;default:for(i=Array(u-1),c=1;c<u;c++)i[c-1]=arguments[c];l.push(f.apply(this,i))}else if(f&&f.length){if(f=f.slice(),u>3)for(i=Array(u-1),c=1;c<u;c++)i[c-1]=arguments[c];for(o=0,a=f.length;o<a;o++)switch(this.event=e,u){case 1:l.push(f[o].call(this));break;case 2:l.push(f[o].call(this,arguments[1]));break;case 3:l.push(f[o].call(this,arguments[1],arguments[2]));break;default:l.push(f[o].apply(this,i))}}else if(!this.ignoreErrors&&!this._all&&e===`error`)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject(`Uncaught, unspecified 'error' event.`);return Promise.all(l)},A.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},A.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},A.prototype.onAny=function(e){return this._onAny(e,!1)},A.prototype.prependAny=function(e){return this._onAny(e,!0)},A.prototype.addListener=A.prototype.on,A.prototype._onAny=function(e,t){if(typeof e!=`function`)throw Error(`onAny only accepts instances of Function`);return this._all||=[],t?this._all.unshift(e):this._all.push(e),this},A.prototype._on=function(e,t,r,i){if(typeof e==`function`)return this._onAny(e,t),this;if(typeof t!=`function`)throw Error(`on only accepts instances of Function`);this._events||d.call(this);var a=this,o;return i!==n&&(o=k.call(this,e,t,i),t=o[0],a=o[1]),this._newListener&&this.emit(`newListener`,e,t),this.wildcard?(T.call(this,e,t,r),a):(this._events[e]?(typeof this._events[e]==`function`&&(this._events[e]=[this._events[e]]),r?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,p.call(this,this._events[e].length,e))):this._events[e]=t,a)},A.prototype.off=function(e,t){if(typeof t!=`function`)throw Error(`removeListener only takes instances of Function`);var n,r=[];if(this.wildcard){var a=typeof e==`string`?e.split(this.delimiter):e.slice();if(r=w.call(this,null,a,this.listenerTree,0),!r)return this}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var o=0;o<r.length;o++){var s=r[o];if(n=s._listeners,i(n)){for(var c=-1,l=0,u=n.length;l<u;l++)if(n[l]===t||n[l].listener&&n[l].listener===t||n[l]._origin&&n[l]._origin===t){c=l;break}if(c<0)continue;return this.wildcard?s._listeners.splice(c,1):this._events[e].splice(c,1),n.length===0&&(this.wildcard?delete s._listeners:delete this._events[e]),this._removeListener&&this.emit(`removeListener`,e,t),this}else (n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete s._listeners:delete this._events[e],this._removeListener&&this.emit(`removeListener`,e,t))}return this.listenerTree&&D(this.listenerTree),this},A.prototype.offAny=function(e){var t=0,n=0,r;if(e&&this._all&&this._all.length>0){for(r=this._all,t=0,n=r.length;t<n;t++)if(e===r[t])return r.splice(t,1),this._removeListener&&this.emit(`removeListenerAny`,e),this}else{if(r=this._all,this._removeListener)for(t=0,n=r.length;t<n;t++)this.emit(`removeListenerAny`,r[t]);this._all=[]}return this},A.prototype.removeListener=A.prototype.off,A.prototype.removeAllListeners=function(e){if(e===n)return!this._events||d.call(this),this;if(this.wildcard){var t=w.call(this,null,e,this.listenerTree,0),r,i;if(!t)return this;for(i=0;i<t.length;i++)r=t[i],r._listeners=null;this.listenerTree&&D(this.listenerTree)}else this._events&&(this._events[e]=null);return this},A.prototype.listeners=function(e){var t=this._events,r,i,a,o,s;if(e===n){if(this.wildcard)throw Error(`event name required for wildcard emitter`);if(!t)return[];for(r=u(t),o=r.length,a=[];o-- >0;)i=t[r[o]],typeof i==`function`?a.push(i):a.push.apply(a,i);return a}else{if(this.wildcard){if(s=this.listenerTree,!s)return[];var c=[],l=typeof e==`string`?e.split(this.delimiter):e.slice();return w.call(this,c,l,s,0),c}return!t||(i=t[e],!i)?[]:typeof i==`function`?[i]:i}},A.prototype.eventNames=function(e){var t=this._events;return this.wildcard?E.call(this,this.listenerTree,[],null,e):t?u(t):[]},A.prototype.listenerCount=function(e){return this.listeners(e).length},A.prototype.hasListeners=function(e){if(this.wildcard){var t=[],r=typeof e==`string`?e.split(this.delimiter):e.slice();return w.call(this,t,r,this.listenerTree,0),t.length>0}var i=this._events,a=this._all;return!!(a&&a.length||i&&(e===n?u(i).length:i[e]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(e,t){var r=this,i=typeof t;return i===`number`?t={timeout:t}:i===`function`&&(t={filter:t}),t=_(t,{timeout:0,filter:n,handleError:!1,Promise,overload:!1},{filter:b,Promise:v}),S(t.Promise,function(n,i,a){function o(){var a=t.filter;if(!(a&&!a.apply(r,arguments)))if(r.off(e,o),t.handleError){var s=arguments[0];s?i(s):n(m.apply(null,arguments).slice(1))}else n(m.apply(null,arguments))}a(function(){r.off(e,o)}),r._on(e,o,!1)},{timeout:t.timeout,overload:t.overload})};function j(e,t,n){n=_(n,{Promise,timeout:0,overload:!1},{Promise:v});var r=n.Promise;return S(r,function(n,r,i){var a;if(typeof e.addEventListener==`function`){a=function(){n(m.apply(null,arguments))},i(function(){e.removeEventListener(t,a)}),e.addEventListener(t,a,{once:!0});return}var o=function(){s&&e.removeListener(`error`,s),n(m.apply(null,arguments))},s;t!==`error`&&(s=function(n){e.removeListener(t,o),r(n)},e.once(`error`,s)),i(function(){s&&e.removeListener(`error`,s),e.removeListener(t,o)}),e.once(t,o)},{timeout:n.timeout,overload:n.overload})}var M=A.prototype;if(Object.defineProperties(A,{defaultMaxListeners:{get:function(){return M._maxListeners},set:function(e){if(typeof e!=`number`||e<0||Number.isNaN(e))throw TypeError(`n must be a non-negative number`);M._maxListeners=e},enumerable:!0},once:{value:j,writable:!0,configurable:!0}}),Object.defineProperties(M,{_maxListeners:{value:a,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),typeof define==`function`&&define.amd)define(function(){return A});else if(typeof e==`object`)t.exports=A;else{var N=Function(``,`return this`)();N.EventEmitter2=A}})()}))();var rXt=(e=>(e.loading=`loading`,e.fetchMore=`fetchMore`,e.ready=`ready`,e.error=`error`,e))(rXt||{}),G7=new WeakMap,K7=new WeakMap,q7={current:[]},J7=!1,iXt=0,Y7=new Set,X7=new Map;function aXt(e){let t=Array.from(e).sort((e,t)=>e instanceof dXt&&e.options.deps.includes(t)?1:t instanceof dXt&&t.options.deps.includes(e)?-1:0);for(let e of t){if(q7.current.includes(e))continue;q7.current.push(e),e.recompute();let t=K7.get(e);if(t)for(let e of t){let t=G7.get(e);t&&aXt(t)}}}function oXt(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function sXt(e){let t={prevVal:e.prevState,currentVal:e.state};for(let n of e.listeners)n(t)}function cXt(e){if(iXt>0&&!X7.has(e)&&X7.set(e,e.prevState),Y7.add(e),!(iXt>0)&&!J7)try{for(J7=!0;Y7.size>0;){let e=Array.from(Y7);Y7.clear();for(let t of e)t.prevState=X7.get(t)??t.prevState,oXt(t);for(let t of e){let e=G7.get(t);e&&(q7.current.push(t),aXt(e))}for(let t of e){let e=G7.get(t);if(e)for(let t of e)sXt(t)}}}finally{J7=!1,q7.current=[],X7.clear()}}function lXt(e){return typeof e==`function`}var uXt=class{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t;this.listeners.add(e);let n=((t=this.options)?.onSubscribe)?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,n;this.prevState=this.state,this.options?.updateFn?this.state=this.options.updateFn(this.prevState)(e):lXt(e)?this.state=e(this.prevState):this.state=e,(n=(t=this.options)?.onUpdate)==null||n.call(t),cXt(this)}},dXt=class e{constructor(t){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=this.options.deps.length,t=Array(e),n=Array(e);for(let r=0;r<e;r++){let e=this.options.deps[r];t[r]=e.prevState,n[r]=e.state}return this.lastSeenDepValues=n,{prevDepVals:t,currDepVals:n,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let n=this.getDepVals();this.state=this.options.fn(n),(t=(e=this.options).onUpdate)==null||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let t of this.options.deps)t instanceof e&&t.checkIfRecalculationNeededDeeply();let t=!1,n=this.lastSeenDepValues,{currDepVals:r}=this.getDepVals();for(let e=0;e<r.length;e++)if(r[e]!==n[e]){t=!0;break}t&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(let e of this._subscriptions)e()}),this.subscribe=e=>{var t;this.listeners.add(e);let n=(t=this.options).onSubscribe?.call(t,e,this);return()=>{this.listeners.delete(e),n?.()}},this.options=t,this.state=t.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(t=this.options.deps){for(let n of t)if(n instanceof e)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof uXt){let e=G7.get(n);e||(e=new Set,G7.set(n,e)),e.add(this);let t=K7.get(this);t||(t=new Set,K7.set(this,t)),t.add(n)}}unregisterFromGraph(t=this.options.deps){for(let n of t)if(n instanceof e)this.unregisterFromGraph(n.options.deps);else if(n instanceof uXt){let e=G7.get(n);e&&e.delete(this);let t=K7.get(this);t&&t.delete(n)}}};({NewMessage:`new-message`}).NewMessage,rXt.ready;var fXt=class extends Error{};fXt.prototype.name=`InvalidTokenError`;function pXt(e,t){return function(){return e.apply(t,arguments)}}var{toString:mXt}=Object.prototype,{getPrototypeOf:Z7}=Object,{iterator:Q7,toStringTag:hXt}=Symbol,$7=(e=>t=>{let n=mXt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),e9=e=>(e=e.toLowerCase(),t=>$7(t)===e),t9=e=>t=>typeof t===e,{isArray:n9}=Array,r9=t9(`undefined`);function i9(e){return e!==null&&!r9(e)&&e.constructor!==null&&!r9(e.constructor)&&a9(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var gXt=e9(`ArrayBuffer`);function _Xt(e){let t;return t=typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&gXt(e.buffer),t}var vXt=t9(`string`),a9=t9(`function`),yXt=t9(`number`),o9=e=>typeof e==`object`&&!!e,bXt=e=>e===!0||e===!1,s9=e=>{if($7(e)!==`object`)return!1;let t=Z7(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(hXt in e)&&!(Q7 in e)},xXt=e=>{if(!o9(e)||i9(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},SXt=e9(`Date`),CXt=e9(`File`),wXt=e9(`Blob`),TXt=e9(`FileList`),EXt=e=>o9(e)&&a9(e.pipe),DXt=e=>{let t;return e&&(typeof FormData==`function`&&e instanceof FormData||a9(e.append)&&((t=$7(e))===`formdata`||t===`object`&&a9(e.toString)&&e.toString()===`[object FormData]`))},OXt=e9(`URLSearchParams`),[kXt,AXt,jXt,MXt]=[`ReadableStream`,`Request`,`Response`,`Headers`].map(e9),NXt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,``);function c9(e,t,{allOwnKeys:n=!1}={}){if(e==null)return;let r,i;if(typeof e!=`object`&&(e=[e]),n9(e))for(r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else{if(i9(e))return;let i=n?Object.getOwnPropertyNames(e):Object.keys(e),a=i.length,o;for(r=0;r<a;r++)o=i[r],t.call(null,e[o],o,e)}}function PXt(e,t){if(i9(e))return null;t=t.toLowerCase();let n=Object.keys(e),r=n.length,i;for(;r-- >0;)if(i=n[r],t===i.toLowerCase())return i;return null}var l9=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:global,FXt=e=>!r9(e)&&e!==l9;function u9(){let{caseless:e,skipUndefined:t}=FXt(this)&&this||{},n={},r=(r,i)=>{if(i===`__proto__`||i===`constructor`||i===`prototype`)return;let a=e&&PXt(n,i)||i;s9(n[a])&&s9(r)?n[a]=u9(n[a],r):s9(r)?n[a]=u9({},r):n9(r)?n[a]=r.slice():(!t||!r9(r))&&(n[a]=r)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&c9(arguments[e],r);return n}var IXt=(e,t,n,{allOwnKeys:r}={})=>(c9(t,(t,r)=>{n&&a9(t)?Object.defineProperty(e,r,{value:pXt(t,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,r,{value:t,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),LXt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),RXt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,`constructor`,{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,`super`,{value:t.prototype}),n&&Object.assign(e.prototype,n)},zXt=(e,t,n,r)=>{let i,a,o,s={};if(t||={},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!r||r(o,e,t))&&!s[o]&&(t[o]=e[o],s[o]=!0);e=n!==!1&&Z7(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},BXt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;let r=e.indexOf(t,n);return r!==-1&&r===n},VXt=e=>{if(!e)return null;if(n9(e))return e;let t=e.length;if(!yXt(t))return null;let n=Array(t);for(;t-- >0;)n[t]=e[t];return n},HXt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<`u`&&Z7(Uint8Array)),UXt=(e,t)=>{let n=(e&&e[Q7]).call(e),r;for(;(r=n.next())&&!r.done;){let n=r.value;t.call(e,n[0],n[1])}},WXt=(e,t)=>{let n,r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},GXt=e9(`HTMLFormElement`),KXt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(e,t,n){return t.toUpperCase()+n}),qXt=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),JXt=e9(`RegExp`),YXt=(e,t)=>{let n=Object.getOwnPropertyDescriptors(e),r={};c9(n,(n,i)=>{let a;(a=t(n,i,e))!==!1&&(r[i]=a||n)}),Object.defineProperties(e,r)},XXt=e=>{YXt(e,(t,n)=>{if(a9(e)&&[`arguments`,`caller`,`callee`].indexOf(n)!==-1)return!1;let r=e[n];if(a9(r)){if(t.enumerable=!1,`writable`in t){t.writable=!1;return}t.set||=()=>{throw Error(`Can not rewrite read-only method '`+n+`'`)}}})},ZXt=(e,t)=>{let n={},r=e=>{e.forEach(e=>{n[e]=!0})};return n9(e)?r(e):r(String(e).split(t)),n},QXt=()=>{},$Xt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function eZt(e){return!!(e&&a9(e.append)&&e[hXt]===`FormData`&&e[Q7])}var tZt=e=>{let t=Array(10),n=(e,r)=>{if(o9(e)){if(t.indexOf(e)>=0)return;if(i9(e))return e;if(!(`toJSON`in e)){t[r]=e;let i=n9(e)?[]:{};return c9(e,(e,t)=>{let a=n(e,r+1);!r9(a)&&(i[t]=a)}),t[r]=void 0,i}}return e};return n(e,0)},nZt=e9(`AsyncFunction`),rZt=e=>e&&(o9(e)||a9(e))&&a9(e.then)&&a9(e.catch),iZt=((e,t)=>e?setImmediate:t?((e,t)=>(l9.addEventListener(`message`,({source:n,data:r})=>{n===l9&&r===e&&t.length&&t.shift()()},!1),n=>{t.push(n),l9.postMessage(e,`*`)}))(`axios@${Math.random()}`,[]):e=>setTimeout(e))(typeof setImmediate==`function`,a9(l9.postMessage)),$={isArray:n9,isArrayBuffer:gXt,isBuffer:i9,isFormData:DXt,isArrayBufferView:_Xt,isString:vXt,isNumber:yXt,isBoolean:bXt,isObject:o9,isPlainObject:s9,isEmptyObject:xXt,isReadableStream:kXt,isRequest:AXt,isResponse:jXt,isHeaders:MXt,isUndefined:r9,isDate:SXt,isFile:CXt,isBlob:wXt,isRegExp:JXt,isFunction:a9,isStream:EXt,isURLSearchParams:OXt,isTypedArray:HXt,isFileList:TXt,forEach:c9,merge:u9,extend:IXt,trim:NXt,stripBOM:LXt,inherits:RXt,toFlatObject:zXt,kindOf:$7,kindOfTest:e9,endsWith:BXt,toArray:VXt,forEachEntry:UXt,matchAll:WXt,isHTMLForm:GXt,hasOwnProperty:qXt,hasOwnProp:qXt,reduceDescriptors:YXt,freezeMethods:XXt,toObjectSet:ZXt,toCamelCase:KXt,noop:QXt,toFiniteNumber:$Xt,findKey:PXt,global:l9,isContextDefined:FXt,isSpecCompliantForm:eZt,toJSONObject:tZt,isAsyncFn:nZt,isThenable:rZt,setImmediate:iZt,asap:typeof queueMicrotask<`u`?queueMicrotask.bind(l9):typeof process<`u`&&process.nextTick||iZt,isIterable:e=>e!=null&&a9(e[Q7])},d9=class e extends Error{static from(t,n,r,i,a,o){let s=new e(t.message,n||t.code,r,i,a);return s.cause=t,s.name=t.name,o&&Object.assign(s,o),s}constructor(e,t,n,r,i){super(e),this.name=`AxiosError`,this.isAxiosError=!0,t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$.toJSONObject(this.config),code:this.code,status:this.status}}};d9.ERR_BAD_OPTION_VALUE=`ERR_BAD_OPTION_VALUE`,d9.ERR_BAD_OPTION=`ERR_BAD_OPTION`,d9.ECONNABORTED=`ECONNABORTED`,d9.ETIMEDOUT=`ETIMEDOUT`,d9.ERR_NETWORK=`ERR_NETWORK`,d9.ERR_FR_TOO_MANY_REDIRECTS=`ERR_FR_TOO_MANY_REDIRECTS`,d9.ERR_DEPRECATED=`ERR_DEPRECATED`,d9.ERR_BAD_RESPONSE=`ERR_BAD_RESPONSE`,d9.ERR_BAD_REQUEST=`ERR_BAD_REQUEST`,d9.ERR_CANCELED=`ERR_CANCELED`,d9.ERR_NOT_SUPPORT=`ERR_NOT_SUPPORT`,d9.ERR_INVALID_URL=`ERR_INVALID_URL`;function f9(e){return $.isPlainObject(e)||$.isArray(e)}function aZt(e){return $.endsWith(e,`[]`)?e.slice(0,-2):e}function oZt(e,t,n){return e?e.concat(t).map(function(e,t){return e=aZt(e),!n&&t?`[`+e+`]`:e}).join(n?`.`:``):t}function sZt(e){return $.isArray(e)&&!e.some(f9)}var cZt=$.toFlatObject($,{},null,function(e){return/^is[A-Z]/.test(e)});function p9(e,t,n){if(!$.isObject(e))throw TypeError(`target must be an object`);t||=new FormData,n=$.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(e,t){return!$.isUndefined(t[e])});let r=n.metaTokens,i=n.visitor||l,a=n.dots,o=n.indexes,s=(n.Blob||typeof Blob<`u`&&Blob)&&$.isSpecCompliantForm(t);if(!$.isFunction(i))throw TypeError(`visitor must be a function`);function c(e){if(e===null)return``;if($.isDate(e))return e.toISOString();if($.isBoolean(e))return e.toString();if(!s&&$.isBlob(e))throw new d9(`Blob is not supported. Use a Buffer instead.`);return $.isArrayBuffer(e)||$.isTypedArray(e)?s&&typeof Blob==`function`?new Blob([e]):Buffer.from(e):e}function l(e,n,i){let s=e;if(e&&!i&&typeof e==`object`){if($.endsWith(n,`{}`))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if($.isArray(e)&&sZt(e)||($.isFileList(e)||$.endsWith(n,`[]`))&&(s=$.toArray(e)))return n=aZt(n),s.forEach(function(e,r){!($.isUndefined(e)||e===null)&&t.append(o===!0?oZt([n],r,a):o===null?n:n+`[]`,c(e))}),!1}return f9(e)?!0:(t.append(oZt(i,n,a),c(e)),!1)}let u=[],d=Object.assign(cZt,{defaultVisitor:l,convertValue:c,isVisitable:f9});function f(e,n){if(!$.isUndefined(e)){if(u.indexOf(e)!==-1)throw Error(`Circular reference detected in `+n.join(`.`));u.push(e),$.forEach(e,function(e,r){(!($.isUndefined(e)||e===null)&&i.call(t,e,$.isString(r)?r.trim():r,n,d))===!0&&f(e,n?n.concat(r):[r])}),u.pop()}}if(!$.isObject(e))throw TypeError(`data must be an object`);return f(e),t}function lZt(e){let t={"!":`%21`,"'":`%27`,"(":`%28`,")":`%29`,"~":`%7E`,"%20":`+`,"%00":`\0`};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(e){return t[e]})}function m9(e,t){this._pairs=[],e&&p9(e,this,t)}var uZt=m9.prototype;uZt.append=function(e,t){this._pairs.push([e,t])},uZt.toString=function(e){let t=e?function(t){return e.call(this,t,lZt)}:lZt;return this._pairs.map(function(e){return t(e[0])+`=`+t(e[1])},``).join(`&`)};function dZt(e){return encodeURIComponent(e).replace(/%3A/gi,`:`).replace(/%24/g,`$`).replace(/%2C/gi,`,`).replace(/%20/g,`+`)}function fZt(e,t,n){if(!t)return e;let r=n&&n.encode||dZt,i=$.isFunction(n)?{serialize:n}:n,a=i&&i.serialize,o;if(o=a?a(t,i):$.isURLSearchParams(t)?t.toString():new m9(t,i).toString(r),o){let t=e.indexOf(`#`);t!==-1&&(e=e.slice(0,t)),e+=(e.indexOf(`?`)===-1?`?`:`&`)+o}return e}var pZt=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&=[]}forEach(e){$.forEach(this.handlers,function(t){t!==null&&e(t)})}},h9={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},mZt={isBrowser:!0,classes:{URLSearchParams:typeof URLSearchParams<`u`?URLSearchParams:m9,FormData:typeof FormData<`u`?FormData:null,Blob:typeof Blob<`u`?Blob:null},protocols:[`http`,`https`,`file`,`blob`,`url`,`data`]},hZt=i({hasBrowserEnv:()=>g9,hasStandardBrowserEnv:()=>gZt,hasStandardBrowserWebWorkerEnv:()=>_Zt,navigator:()=>_9,origin:()=>vZt}),g9=typeof window<`u`&&typeof document<`u`,_9=typeof navigator==`object`&&navigator||void 0,gZt=g9&&(!_9||[`ReactNative`,`NativeScript`,`NS`].indexOf(_9.product)<0),_Zt=typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope&&typeof self.importScripts==`function`,vZt=g9&&window.location.href||`http://localhost`,v9={...hZt,...mZt};function yZt(e,t){return p9(e,new v9.classes.URLSearchParams,{visitor:function(e,t,n,r){return v9.isNode&&$.isBuffer(e)?(this.append(t,e.toString(`base64`)),!1):r.defaultVisitor.apply(this,arguments)},...t})}function bZt(e){return $.matchAll(/\w+|\[(\w*)]/g,e).map(e=>e[0]===`[]`?``:e[1]||e[0])}function xZt(e){let t={},n=Object.keys(e),r,i=n.length,a;for(r=0;r<i;r++)a=n[r],t[a]=e[a];return t}function SZt(e){function t(e,n,r,i){let a=e[i++];if(a===`__proto__`)return!0;let o=Number.isFinite(+a),s=i>=e.length;return a=!a&&$.isArray(r)?r.length:a,s?($.hasOwnProp(r,a)?r[a]=[r[a],n]:r[a]=n,!o):((!r[a]||!$.isObject(r[a]))&&(r[a]=[]),t(e,n,r[a],i)&&$.isArray(r[a])&&(r[a]=xZt(r[a])),!o)}if($.isFormData(e)&&$.isFunction(e.entries)){let n={};return $.forEachEntry(e,(e,r)=>{t(bZt(e),r,n,0)}),n}return null}function CZt(e,t,n){if($.isString(e))try{return(t||JSON.parse)(e),$.trim(e)}catch(e){if(e.name!==`SyntaxError`)throw e}return(n||JSON.stringify)(e)}var y9={transitional:h9,adapter:[`xhr`,`http`,`fetch`],transformRequest:[function(e,t){let n=t.getContentType()||``,r=n.indexOf(`application/json`)>-1,i=$.isObject(e);if(i&&$.isHTMLForm(e)&&(e=new FormData(e)),$.isFormData(e))return r?JSON.stringify(SZt(e)):e;if($.isArrayBuffer(e)||$.isBuffer(e)||$.isStream(e)||$.isFile(e)||$.isBlob(e)||$.isReadableStream(e))return e;if($.isArrayBufferView(e))return e.buffer;if($.isURLSearchParams(e))return t.setContentType(`application/x-www-form-urlencoded;charset=utf-8`,!1),e.toString();let a;if(i){if(n.indexOf(`application/x-www-form-urlencoded`)>-1)return yZt(e,this.formSerializer).toString();if((a=$.isFileList(e))||n.indexOf(`multipart/form-data`)>-1){let t=this.env&&this.env.FormData;return p9(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||r?(t.setContentType(`application/json`,!1),CZt(e)):e}],transformResponse:[function(e){let t=this.transitional||y9.transitional,n=t&&t.forcedJSONParsing,r=this.responseType===`json`;if($.isResponse(e)||$.isReadableStream(e))return e;if(e&&$.isString(e)&&(n&&!this.responseType||r)){let n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e,this.parseReviver)}catch(e){if(n)throw e.name===`SyntaxError`?d9.from(e,d9.ERR_BAD_RESPONSE,this,null,this.response):e}}return e}],timeout:0,xsrfCookieName:`XSRF-TOKEN`,xsrfHeaderName:`X-XSRF-TOKEN`,maxContentLength:-1,maxBodyLength:-1,env:{FormData:v9.classes.FormData,Blob:v9.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:`application/json, text/plain, */*`,"Content-Type":void 0}}};$.forEach([`delete`,`get`,`head`,`post`,`put`,`patch`],e=>{y9.headers[e]={}});var wZt=$.toObjectSet([`age`,`authorization`,`content-length`,`content-type`,`etag`,`expires`,`from`,`host`,`if-modified-since`,`if-unmodified-since`,`last-modified`,`location`,`max-forwards`,`proxy-authorization`,`referer`,`retry-after`,`user-agent`]),TZt=e=>{let t={},n,r,i;return e&&e.split(`
1583
1583
  `).forEach(function(e){i=e.indexOf(`:`),n=e.substring(0,i).trim().toLowerCase(),r=e.substring(i+1).trim(),!(!n||t[n]&&wZt[n])&&(n===`set-cookie`?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+`, `+r:r)}),t},EZt=Symbol(`internals`);function b9(e){return e&&String(e).trim().toLowerCase()}function x9(e){return e===!1||e==null?e:$.isArray(e)?e.map(x9):String(e)}function DZt(e){let t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}var OZt=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function S9(e,t,n,r,i){if($.isFunction(r))return r.call(this,t,n);if(i&&(t=n),$.isString(t)){if($.isString(r))return t.indexOf(r)!==-1;if($.isRegExp(r))return r.test(t)}}function kZt(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function AZt(e,t){let n=$.toCamelCase(` `+t);[`get`,`set`,`has`].forEach(r=>{Object.defineProperty(e,r+n,{value:function(e,n,i){return this[r].call(this,t,e,n,i)},configurable:!0})})}var C9=class{constructor(e){e&&this.set(e)}set(e,t,n){let r=this;function i(e,t,n){let i=b9(t);if(!i)throw Error(`header name must be a non-empty string`);let a=$.findKey(r,i);(!a||r[a]===void 0||n===!0||n===void 0&&r[a]!==!1)&&(r[a||t]=x9(e))}let a=(e,t)=>$.forEach(e,(e,n)=>i(e,n,t));if($.isPlainObject(e)||e instanceof this.constructor)a(e,t);else if($.isString(e)&&(e=e.trim())&&!OZt(e))a(TZt(e),t);else if($.isObject(e)&&$.isIterable(e)){let n={},r,i;for(let t of e){if(!$.isArray(t))throw TypeError(`Object iterator must return a key-value pair`);n[i=t[0]]=(r=n[i])?$.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}a(n,t)}else e!=null&&i(t,e,n);return this}get(e,t){if(e=b9(e),e){let n=$.findKey(this,e);if(n){let e=this[n];if(!t)return e;if(t===!0)return DZt(e);if($.isFunction(t))return t.call(this,e,n);if($.isRegExp(t))return t.exec(e);throw TypeError(`parser must be boolean|regexp|function`)}}}has(e,t){if(e=b9(e),e){let n=$.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||S9(this,this[n],n,t)))}return!1}delete(e,t){let n=this,r=!1;function i(e){if(e=b9(e),e){let i=$.findKey(n,e);i&&(!t||S9(n,n[i],i,t))&&(delete n[i],r=!0)}}return $.isArray(e)?e.forEach(i):i(e),r}clear(e){let t=Object.keys(this),n=t.length,r=!1;for(;n--;){let i=t[n];(!e||S9(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){let t=this,n={};return $.forEach(this,(r,i)=>{let a=$.findKey(n,i);if(a){t[a]=x9(r),delete t[i];return}let o=e?kZt(i):String(i).trim();o!==i&&delete t[i],t[o]=x9(r),n[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return $.forEach(this,(n,r)=>{n!=null&&n!==!1&&(t[r]=e&&$.isArray(n)?n.join(`, `):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+`: `+t).join(`