@signalwire/cfb 0.0.14-dev.202507011410.e8eab87.0 → 0.0.14

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.
Files changed (2) hide show
  1. package/dist/main.js +25 -25
  2. package/package.json +6 -6
package/dist/main.js CHANGED
@@ -1,8 +1,8 @@
1
- (function(go,vs){typeof exports=="object"&&typeof module<"u"?vs(exports):typeof define=="function"&&define.amd?define(["exports"],vs):(go=typeof globalThis<"u"?globalThis:go||self,vs(go.CFB={}))})(this,function(go){"use strict";/**
2
- * Visual Builder v0.0.13 [e8eab87] (https://signalwire.com)
3
- * Copyright 2018-2025 SignalWire.
1
+ (function(go,ys){typeof exports=="object"&&typeof module<"u"?ys(exports):typeof define=="function"&&define.amd?define(["exports"],ys):(go=typeof globalThis<"u"?globalThis:go||self,ys(go.CFB={}))})(this,function(go){"use strict";/**
2
+ * Visual Builder v0.0.13 [4bbeb66] (https://signalwire.com)
3
+ * Copyright 2018-2026 SignalWire.
4
4
  */
5
- function vs(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(s,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Bi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lc={exports:{}},xs={},ac={exports:{}},Te={};/**
5
+ function ys(e,t){for(var r=0;r<t.length;r++){const s=t[r];if(typeof s!="string"&&!Array.isArray(s)){for(const i in s)if(i!=="default"&&!(i in e)){const a=Object.getOwnPropertyDescriptor(s,i);a&&Object.defineProperty(e,i,a.get?a:{enumerable:!0,get:()=>s[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Hi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lc={exports:{}},vs={},ac={exports:{}},Te={};/**
6
6
  * @license React
7
7
  * react.production.min.js
8
8
  *
@@ -10,7 +10,7 @@ function vs(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var Gf;function nv(){if(Gf)return Te;Gf=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.iterator;function E(D){return D===null||typeof D!="object"?null:(D=y&&D[y]||D["@@iterator"],typeof D=="function"?D:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function S(D,Q,oe){this.props=D,this.context=Q,this.refs=w,this.updater=oe||x}S.prototype.isReactComponent={},S.prototype.setState=function(D,Q){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,Q,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=S.prototype;function R(D,Q,oe){this.props=D,this.context=Q,this.refs=w,this.updater=oe||x}var P=R.prototype=new N;P.constructor=R,_(P,S.prototype),P.isPureReactComponent=!0;var C=Array.isArray,I=Object.prototype.hasOwnProperty,L={current:null},U={key:!0,ref:!0,__self:!0,__source:!0};function G(D,Q,oe){var re,le={},ue=null,fe=null;if(Q!=null)for(re in Q.ref!==void 0&&(fe=Q.ref),Q.key!==void 0&&(ue=""+Q.key),Q)I.call(Q,re)&&!U.hasOwnProperty(re)&&(le[re]=Q[re]);var de=arguments.length-2;if(de===1)le.children=oe;else if(1<de){for(var me=Array(de),Re=0;Re<de;Re++)me[Re]=arguments[Re+2];le.children=me}if(D&&D.defaultProps)for(re in de=D.defaultProps,de)le[re]===void 0&&(le[re]=de[re]);return{$$typeof:e,type:D,key:ue,ref:fe,props:le,_owner:L.current}}function X(D,Q){return{$$typeof:e,type:D.type,key:Q,ref:D.ref,props:D.props,_owner:D._owner}}function H(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function q(D){var Q={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(oe){return Q[oe]})}var ee=/\/+/g;function z(D,Q){return typeof D=="object"&&D!==null&&D.key!=null?q(""+D.key):Q.toString(36)}function A(D,Q,oe,re,le){var ue=typeof D;(ue==="undefined"||ue==="boolean")&&(D=null);var fe=!1;if(D===null)fe=!0;else switch(ue){case"string":case"number":fe=!0;break;case"object":switch(D.$$typeof){case e:case t:fe=!0}}if(fe)return fe=D,le=le(fe),D=re===""?"."+z(fe,0):re,C(le)?(oe="",D!=null&&(oe=D.replace(ee,"$&/")+"/"),A(le,Q,oe,"",function(Re){return Re})):le!=null&&(H(le)&&(le=X(le,oe+(!le.key||fe&&fe.key===le.key?"":(""+le.key).replace(ee,"$&/")+"/")+D)),Q.push(le)),1;if(fe=0,re=re===""?".":re+":",C(D))for(var de=0;de<D.length;de++){ue=D[de];var me=re+z(ue,de);fe+=A(ue,Q,oe,me,le)}else if(me=E(D),typeof me=="function")for(D=me.call(D),de=0;!(ue=D.next()).done;)ue=ue.value,me=re+z(ue,de++),fe+=A(ue,Q,oe,me,le);else if(ue==="object")throw Q=String(D),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return fe}function F(D,Q,oe){if(D==null)return D;var re=[],le=0;return A(D,re,"","",function(ue){return Q.call(oe,ue,le++)}),re}function $(D){if(D._status===-1){var Q=D._result;Q=Q(),Q.then(function(oe){(D._status===0||D._status===-1)&&(D._status=1,D._result=oe)},function(oe){(D._status===0||D._status===-1)&&(D._status=2,D._result=oe)}),D._status===-1&&(D._status=0,D._result=Q)}if(D._status===1)return D._result.default;throw D._result}var Y={current:null},M={transition:null},V={ReactCurrentDispatcher:Y,ReactCurrentBatchConfig:M,ReactCurrentOwner:L};function B(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:F,forEach:function(D,Q,oe){F(D,function(){Q.apply(this,arguments)},oe)},count:function(D){var Q=0;return F(D,function(){Q++}),Q},toArray:function(D){return F(D,function(Q){return Q})||[]},only:function(D){if(!H(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},Te.Component=S,Te.Fragment=n,Te.Profiler=i,Te.PureComponent=R,Te.StrictMode=s,Te.Suspense=f,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=V,Te.act=B,Te.cloneElement=function(D,Q,oe){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var re=_({},D.props),le=D.key,ue=D.ref,fe=D._owner;if(Q!=null){if(Q.ref!==void 0&&(ue=Q.ref,fe=L.current),Q.key!==void 0&&(le=""+Q.key),D.type&&D.type.defaultProps)var de=D.type.defaultProps;for(me in Q)I.call(Q,me)&&!U.hasOwnProperty(me)&&(re[me]=Q[me]===void 0&&de!==void 0?de[me]:Q[me])}var me=arguments.length-2;if(me===1)re.children=oe;else if(1<me){de=Array(me);for(var Re=0;Re<me;Re++)de[Re]=arguments[Re+2];re.children=de}return{$$typeof:e,type:D.type,key:le,ref:ue,props:re,_owner:fe}},Te.createContext=function(D){return D={$$typeof:c,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},D.Provider={$$typeof:l,_context:D},D.Consumer=D},Te.createElement=G,Te.createFactory=function(D){var Q=G.bind(null,D);return Q.type=D,Q},Te.createRef=function(){return{current:null}},Te.forwardRef=function(D){return{$$typeof:u,render:D}},Te.isValidElement=H,Te.lazy=function(D){return{$$typeof:m,_payload:{_status:-1,_result:D},_init:$}},Te.memo=function(D,Q){return{$$typeof:p,type:D,compare:Q===void 0?null:Q}},Te.startTransition=function(D){var Q=M.transition;M.transition={};try{D()}finally{M.transition=Q}},Te.unstable_act=B,Te.useCallback=function(D,Q){return Y.current.useCallback(D,Q)},Te.useContext=function(D){return Y.current.useContext(D)},Te.useDebugValue=function(){},Te.useDeferredValue=function(D){return Y.current.useDeferredValue(D)},Te.useEffect=function(D,Q){return Y.current.useEffect(D,Q)},Te.useId=function(){return Y.current.useId()},Te.useImperativeHandle=function(D,Q,oe){return Y.current.useImperativeHandle(D,Q,oe)},Te.useInsertionEffect=function(D,Q){return Y.current.useInsertionEffect(D,Q)},Te.useLayoutEffect=function(D,Q){return Y.current.useLayoutEffect(D,Q)},Te.useMemo=function(D,Q){return Y.current.useMemo(D,Q)},Te.useReducer=function(D,Q,oe){return Y.current.useReducer(D,Q,oe)},Te.useRef=function(D){return Y.current.useRef(D)},Te.useState=function(D){return Y.current.useState(D)},Te.useSyncExternalStore=function(D,Q,oe){return Y.current.useSyncExternalStore(D,Q,oe)},Te.useTransition=function(){return Y.current.useTransition()},Te.version="18.3.1",Te}var Yf;function Ss(){return Yf||(Yf=1,ac.exports=nv()),ac.exports}/**
13
+ */var Gf;function nv(){if(Gf)return Te;Gf=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),E=Symbol.iterator;function v(k){return k===null||typeof k!="object"?null:(k=E&&k[E]||k["@@iterator"],typeof k=="function"?k:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function S(k,Y,re){this.props=k,this.context=Y,this.refs=w,this.updater=re||x}S.prototype.isReactComponent={},S.prototype.setState=function(k,Y){if(typeof k!="object"&&typeof k!="function"&&k!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,k,Y,"setState")},S.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function N(){}N.prototype=S.prototype;function O(k,Y,re){this.props=k,this.context=Y,this.refs=w,this.updater=re||x}var D=O.prototype=new N;D.constructor=O,_(D,S.prototype),D.isPureReactComponent=!0;var T=Array.isArray,A=Object.prototype.hasOwnProperty,L={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function K(k,Y,re){var oe,le={},de=null,he=null;if(Y!=null)for(oe in Y.ref!==void 0&&(he=Y.ref),Y.key!==void 0&&(de=""+Y.key),Y)A.call(Y,oe)&&!F.hasOwnProperty(oe)&&(le[oe]=Y[oe]);var ue=arguments.length-2;if(ue===1)le.children=re;else if(1<ue){for(var me=Array(ue),Re=0;Re<ue;Re++)me[Re]=arguments[Re+2];le.children=me}if(k&&k.defaultProps)for(oe in ue=k.defaultProps,ue)le[oe]===void 0&&(le[oe]=ue[oe]);return{$$typeof:e,type:k,key:de,ref:he,props:le,_owner:L.current}}function Q(k,Y){return{$$typeof:e,type:k.type,key:Y,ref:k.ref,props:k.props,_owner:k._owner}}function X(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function ee(k){var Y={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(re){return Y[re]})}var ne=/\/+/g;function W(k,Y){return typeof k=="object"&&k!==null&&k.key!=null?ee(""+k.key):Y.toString(36)}function I(k,Y,re,oe,le){var de=typeof k;(de==="undefined"||de==="boolean")&&(k=null);var he=!1;if(k===null)he=!0;else switch(de){case"string":case"number":he=!0;break;case"object":switch(k.$$typeof){case e:case t:he=!0}}if(he)return he=k,le=le(he),k=oe===""?"."+W(he,0):oe,T(le)?(re="",k!=null&&(re=k.replace(ne,"$&/")+"/"),I(le,Y,re,"",function(Re){return Re})):le!=null&&(X(le)&&(le=Q(le,re+(!le.key||he&&he.key===le.key?"":(""+le.key).replace(ne,"$&/")+"/")+k)),Y.push(le)),1;if(he=0,oe=oe===""?".":oe+":",T(k))for(var ue=0;ue<k.length;ue++){de=k[ue];var me=oe+W(de,ue);he+=I(de,Y,re,me,le)}else if(me=v(k),typeof me=="function")for(k=me.call(k),ue=0;!(de=k.next()).done;)de=de.value,me=oe+W(de,ue++),he+=I(de,Y,re,me,le);else if(de==="object")throw Y=String(k),Error("Objects are not valid as a React child (found: "+(Y==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":Y)+"). If you meant to render a collection of children, use an array instead.");return he}function V(k,Y,re){if(k==null)return k;var oe=[],le=0;return I(k,oe,"","",function(de){return Y.call(re,de,le++)}),oe}function j(k){if(k._status===-1){var Y=k._result;Y=Y(),Y.then(function(re){(k._status===0||k._status===-1)&&(k._status=1,k._result=re)},function(re){(k._status===0||k._status===-1)&&(k._status=2,k._result=re)}),k._status===-1&&(k._status=0,k._result=Y)}if(k._status===1)return k._result.default;throw k._result}var B={current:null},U={transition:null},$={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:U,ReactCurrentOwner:L};function z(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:V,forEach:function(k,Y,re){V(k,function(){Y.apply(this,arguments)},re)},count:function(k){var Y=0;return V(k,function(){Y++}),Y},toArray:function(k){return V(k,function(Y){return Y})||[]},only:function(k){if(!X(k))throw Error("React.Children.only expected to receive a single React element child.");return k}},Te.Component=S,Te.Fragment=r,Te.Profiler=i,Te.PureComponent=O,Te.StrictMode=s,Te.Suspense=f,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$,Te.act=z,Te.cloneElement=function(k,Y,re){if(k==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+k+".");var oe=_({},k.props),le=k.key,de=k.ref,he=k._owner;if(Y!=null){if(Y.ref!==void 0&&(de=Y.ref,he=L.current),Y.key!==void 0&&(le=""+Y.key),k.type&&k.type.defaultProps)var ue=k.type.defaultProps;for(me in Y)A.call(Y,me)&&!F.hasOwnProperty(me)&&(oe[me]=Y[me]===void 0&&ue!==void 0?ue[me]:Y[me])}var me=arguments.length-2;if(me===1)oe.children=re;else if(1<me){ue=Array(me);for(var Re=0;Re<me;Re++)ue[Re]=arguments[Re+2];oe.children=ue}return{$$typeof:e,type:k.type,key:le,ref:de,props:oe,_owner:he}},Te.createContext=function(k){return k={$$typeof:c,_currentValue:k,_currentValue2:k,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},k.Provider={$$typeof:a,_context:k},k.Consumer=k},Te.createElement=K,Te.createFactory=function(k){var Y=K.bind(null,k);return Y.type=k,Y},Te.createRef=function(){return{current:null}},Te.forwardRef=function(k){return{$$typeof:u,render:k}},Te.isValidElement=X,Te.lazy=function(k){return{$$typeof:m,_payload:{_status:-1,_result:k},_init:j}},Te.memo=function(k,Y){return{$$typeof:p,type:k,compare:Y===void 0?null:Y}},Te.startTransition=function(k){var Y=U.transition;U.transition={};try{k()}finally{U.transition=Y}},Te.unstable_act=z,Te.useCallback=function(k,Y){return B.current.useCallback(k,Y)},Te.useContext=function(k){return B.current.useContext(k)},Te.useDebugValue=function(){},Te.useDeferredValue=function(k){return B.current.useDeferredValue(k)},Te.useEffect=function(k,Y){return B.current.useEffect(k,Y)},Te.useId=function(){return B.current.useId()},Te.useImperativeHandle=function(k,Y,re){return B.current.useImperativeHandle(k,Y,re)},Te.useInsertionEffect=function(k,Y){return B.current.useInsertionEffect(k,Y)},Te.useLayoutEffect=function(k,Y){return B.current.useLayoutEffect(k,Y)},Te.useMemo=function(k,Y){return B.current.useMemo(k,Y)},Te.useReducer=function(k,Y,re){return B.current.useReducer(k,Y,re)},Te.useRef=function(k){return B.current.useRef(k)},Te.useState=function(k){return B.current.useState(k)},Te.useSyncExternalStore=function(k,Y,re){return B.current.useSyncExternalStore(k,Y,re)},Te.useTransition=function(){return B.current.useTransition()},Te.version="18.3.1",Te}var Yf;function xs(){return Yf||(Yf=1,ac.exports=nv()),ac.exports}/**
14
14
  * @license React
15
15
  * react-jsx-runtime.production.min.js
16
16
  *
@@ -18,7 +18,7 @@ function vs(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
18
18
  *
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
- */var Kf;function rv(){if(Kf)return xs;Kf=1;var e=Ss(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var m,y={},E=null,x=null;p!==void 0&&(E=""+p),f.key!==void 0&&(E=""+f.key),f.ref!==void 0&&(x=f.ref);for(m in f)s.call(f,m)&&!l.hasOwnProperty(m)&&(y[m]=f[m]);if(u&&u.defaultProps)for(m in f=u.defaultProps,f)y[m]===void 0&&(y[m]=f[m]);return{$$typeof:t,type:u,key:E,ref:x,props:y,_owner:i.current}}return xs.Fragment=n,xs.jsx=c,xs.jsxs=c,xs}var Xf;function ov(){return Xf||(Xf=1,lc.exports=rv()),lc.exports}var h=ov(),sv=Object.create,cc=Object.defineProperty,iv=Object.getOwnPropertyDescriptor,lv=Object.getOwnPropertyNames,av=Object.getPrototypeOf,cv=Object.prototype.hasOwnProperty,uv=(e,t,n)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dv=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fv=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lv(t))!cv.call(e,i)&&i!==n&&cc(e,i,{get:()=>t[i],enumerable:!(s=iv(t,i))||s.enumerable});return e},pv=(e,t,n)=>(n=e!=null?sv(av(e)):{},fv(cc(n,"default",{value:e,enumerable:!0}),e)),uc=(e,t,n)=>uv(e,typeof t!="symbol"?t+"":t,n),hv=dv((e,t)=>{(function(n,s){typeof define=="function"&&define.amd?define(s):typeof t=="object"&&t.exports?t.exports=s():n.log=s()})(e,function(){var n=function(){},s="undefined",i=typeof window!==s&&typeof window.navigator!==s&&/Trident\/|MSIE /.test(window.navigator.userAgent),l=["trace","debug","info","warn","error"];function c(S,N){var R=S[N];if(typeof R.bind=="function")return R.bind(S);try{return Function.prototype.bind.call(R,S)}catch{return function(){return Function.prototype.apply.apply(R,[S,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(S){return S==="debug"&&(S="log"),typeof console===s?!1:S==="trace"&&i?u:console[S]!==void 0?c(console,S):console.log!==void 0?c(console,"log"):n}function p(S,N){for(var R=0;R<l.length;R++){var P=l[R];this[P]=R<S?n:this.methodFactory(P,S,N)}this.log=this.debug}function m(S,N,R){return function(){typeof console!==s&&(p.call(this,N,R),this[S].apply(this,arguments))}}function y(S,N,R){return f(S)||m.apply(this,arguments)}function E(S,N,R){var P=this,C;N=N??"WARN";var I="loglevel";typeof S=="string"?I+=":"+S:typeof S=="symbol"&&(I=void 0);function L(H){var q=(l[H]||"silent").toUpperCase();if(!(typeof window===s||!I)){try{window.localStorage[I]=q;return}catch{}try{window.document.cookie=encodeURIComponent(I)+"="+q+";"}catch{}}}function U(){var H;if(!(typeof window===s||!I)){try{H=window.localStorage[I]}catch{}if(typeof H===s)try{var q=window.document.cookie,ee=q.indexOf(encodeURIComponent(I)+"=");ee!==-1&&(H=/^([^;]+)/.exec(q.slice(ee))[1])}catch{}return P.levels[H]===void 0&&(H=void 0),H}}function G(){if(!(typeof window===s||!I)){try{window.localStorage.removeItem(I);return}catch{}try{window.document.cookie=encodeURIComponent(I)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}P.name=S,P.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},P.methodFactory=R||y,P.getLevel=function(){return C},P.setLevel=function(H,q){if(typeof H=="string"&&P.levels[H.toUpperCase()]!==void 0&&(H=P.levels[H.toUpperCase()]),typeof H=="number"&&H>=0&&H<=P.levels.SILENT){if(C=H,q!==!1&&L(H),p.call(P,H,S),typeof console===s&&H<P.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+H},P.setDefaultLevel=function(H){N=H,U()||P.setLevel(H,!1)},P.resetLevel=function(){P.setLevel(N,!1),G()},P.enableAll=function(H){P.setLevel(P.levels.TRACE,H)},P.disableAll=function(H){P.setLevel(P.levels.SILENT,H)};var X=U();X==null&&(X=N),P.setLevel(X,!1)}var x=new E,_={};x.getLogger=function(S){if(typeof S!="symbol"&&typeof S!="string"||S==="")throw new TypeError("You must supply a name when creating a logger.");var N=_[S];return N||(N=_[S]=new E(S,x.getLevel(),x.methodFactory)),N};var w=typeof window!==s?window.log:void 0;return x.noConflict=function(){return typeof window!==s&&window.log===x&&(window.log=w),x},x.getLoggers=function(){return _},x.default=x,x})}),mv="/api/ai/ai_agents",gv="/api/swml_scripts",yv=pv(hv()),Ev=()=>new Date().toISOString(),_s=yv.default.getLogger("signalwire"),vv=_s.methodFactory;_s.methodFactory=(e,t,n)=>{let s=vv(e,t,n);return function(...i){i.unshift(Ev(),"-"),s(...i)}};var xv=_s.getLevel();_s.setLevel(xv);var Qe=()=>_s,Sv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_v=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Sv[n[e]&63];return t},dc=Qe(),wv=e=>typeof e=="object"&&e!==null&&"id"in e&&"type"in e&&"data"in e&&"position"in e,Nv=e=>{if(!wv(e))throw dc.error("nodeToDBShape: Invalid node",e),new Error;return{data:e.data,id:e.id,position:e.position,type:e.type}},Rv=e=>typeof e=="object"&&e!==null&&"id"in e&&"source"in e&&"sourceHandle"in e&&"target"in e&&"targetHandle"in e,Tv=e=>{if(!Rv(e))throw dc.error("edgeToDBShape: Invalid edge",e),new Error;return{id:e.id,source:e.source,sourceHandle:e.sourceHandle??null,target:e.target,targetHandle:e.targetHandle??null}},Qf=e=>{var t;return(t=e==null?void 0:e.trim())==null?void 0:t.toLowerCase()},yo=e=>e.replace(/\s/g,""),fc=e=>{if(!(!e||typeof e=="string"&&e.trim().length===0))try{return JSON.parse(e)}catch{return typeof e=="string"?e.trim():e}},pc=e=>typeof e=="string"?e.trim():typeof e=="number"&&isNaN(e)||e==null||typeof e=="object"||typeof e=="function"||typeof e=="symbol"?"":String(e),Ov=e=>e.split(",").map(t=>t.trim()).filter(Boolean),zi=e=>{let t=fc(e);return t&&typeof t=="object"&&Object.keys(t).length?t:void 0},Le=()=>_v(),hc=(e,t)=>{try{let n=new URL(e);return t&&(Object.entries(t).forEach(([s,i])=>{i&&n.searchParams.set(s,String(i))}),n.searchParams.sort()),n.toString()}catch(n){throw dc.error("buildUrlWithParams",n),n}},qf=e=>{let t=e===void 0?void 0:parseInt(e,10);return t===void 0||Number.isNaN(t)||t<=0?void 0:t},mc=({callStateEvents:e,callStateUrl:t,connections:n,defaultFrom:s,defaultTimeout:i,callOrder:l})=>{let c=qf(i),u=yo(s),f=Ov(e),p=t==null?void 0:t.trim(),m=n.map(({connectConfirmUrl:E,connectConfirmEnabled:x,connectFrom:_,connectTimeout:w,connectTo:S})=>({call_state_events:f.length>0?f:void 0,call_state_url:p||void 0,confirm:x?E:void 0,from:yo(_)||u||"%{call.from}",timeout:qf(w)??c,to:yo(S)}));m.length||m.push({from:"%{call.from}",timeout:void 0,to:""});let y={switch:{case:{connected:[]},default:[{switch:{case:{busy:[],decline:[],error:[],noAnswer:[]},default:["hangup"],variable:"connect_failed_reason"}}],variable:"connect_result"}};switch(l){case"single":return[{connect:m[0]},y];case"serial":return[{connect:{serial:m}},y];case"parallel":return[{connect:{parallel:m}},y];default:return Qe().warn(`The type '${l}' is not supported yet.`),[{connect:m[0]},y]}},Cv=/\bmale\b/i,Av=/\bfemale\b/i,Iv=e=>{if(e){if(Av.test(e))return"female";if(Cv.test(e))return"male"}},Jf=(e,t)=>{if(typeof e=="object"&&!Array.isArray(e)){t.language&&(e.say_language=t.language);let n=Iv(t.gender);n&&(e.say_gender=n),t.voice&&(e.say_voice=t.voice)}return e},Zf=(e,t)=>{var n,s;if(typeof e=="object"&&!Array.isArray(e)){let i="url"in e?e.url:e.play,l,c=(n=t.text)==null?void 0:n.trim();if(Array.isArray(t.url)){let u=t.url.map(f=>f==null?void 0:f.trim()).filter(Boolean);l=(u==null?void 0:u.length)===1?u[0]:u}else l=(s=t.url)==null?void 0:s.trim();(!t.selected||t.selected==="url")&&l?i=l:(!t.selected||t.selected==="text")&&c&&(i=`say:${c}`),"url"in e?e.url=i:e.play=i}return e},bv={aiAgent:({data:{agent:e}})=>({ai:{agent:e}}),answer:({data:{maxDuration:e}})=>e?{answer:{max_duration:e}}:"answer",cond:()=>({cond:[]}),condRequest:({data:e})=>[{request:{body:fc(e.body),connect_timeout:e.connectTimeout,headers:zi(e.headers),method:e.method,save_variables:e.saveVariables,timeout:e.timeout,url:e.url}},{switch:{case:{success:[]},default:[],variable:"request_result"}}],executeSWML:({data:e})=>({execute:{dest:e.dest,meta:zi(e.meta),params:zi(e.params),result:[]}}),forwardAddress:({data:e})=>mc(e),forwardPhone:({data:e})=>mc(e),forwardResource:({data:e})=>mc(e),handleCall:()=>"start",hangup:({data:{reason:e}})=>e?{hangup:{reason:e}}:"hangup",play:({data:e})=>{let{volume:t}=e,n=Jf(Zf({url:"say:Unknown TTS"},e),e);return t&&(n.volume=t),{play:n}},promptPlay:({data:e})=>{let{digitTimeout:t,initialTimeout:n,options:s,volume:i}=e,l=Jf(Zf({play:"say:Unknown value"},e),e);i&&(l.volume=i),n&&(l.initial_timeout=parseInt(n,10)),t&&(l.digit_timeout=parseInt(t,10));let c=s.reduce((u,f)=>{let p=Qf(f.command);p&&u.speechHints.push(p);let m=yo(f.digit);return m&&(u.maxDigits=Math.max(u.maxDigits,m.length)),u},{maxDigits:-1,speechHints:[]});return c.speechHints.length&&(l.speech_hints=c.speechHints,l.speech_language="en-US"),c.maxDigits>0&&(l.max_digits=c.maxDigits),[{prompt:l},{switch:{case:{failed:[{play:"say:Error while gathering input."},"hangup"],no_input:[],no_match:[]},default:[{switch:{case:{},default:[],variable:"prompt_value"}}],variable:"prompt_result"}}]},record:({data:e})=>{var n;let t={beep:e.beep,direction:e.direction,format:e.format,input_sensitivity:e.inputSensitivity,stereo:e.stereo,terminators:((n=e.terminators)==null?void 0:n.trim())||void 0};return e.endSilenceTimeout&&(t.end_silence_timeout=parseInt(e.endSilenceTimeout,10)),e.initialTimeout&&(t.initial_timeout=parseInt(e.initialTimeout,10)),e.maxLength&&(t.max_length=parseInt(e.maxLength,10)),{record:t}},recordCallStart:({data:e})=>{var t;return{record_call:{beep:e.beep,control_id:e.controlId,direction:e.direction,format:e.format,input_sensitivity:e.inputSensitivity,stereo:e.stereo,terminators:((t=e.terminators)==null?void 0:t.trim())||void 0}}},recordCallStop:({data:e})=>({stop_record_call:e.controlId}),request:({data:e})=>[{request:{body:fc(e.body),connect_timeout:e.connectTimeout,headers:zi(e.headers),method:e.method,save_variables:e.saveVariables,timeout:e.timeout,url:e.url}},{switch:{case:{success:[]},default:[],variable:"request_result"}}],sendSms:({data:e})=>{let{fromNumber:t,toNumber:n,body:s}=e;return{send_sms:{body:s,from_number:yo(t),to_number:yo(n)}}},set:({data:{variables:e}})=>{let t={};return e.forEach(({key:n,value:s})=>{t[n]=s}),{set:t}},unset:({data:{variables:e}})=>({unset:e.map(({key:t})=>t)})},Ur=e=>{try{return bv[e.__type](e.node)}catch(t){throw Qe().error("Unknown Verb",e),t}},Lv="1.0.0",Dv=e=>{let t=Qe(),n=new Set,s=new Map,i=new Set,l=new Map([["main",[]]]),c=new Map,u="",f=C=>l.has(C),p=C=>i.has(C),m=C=>i.add(C);e.nodes.forEach(C=>{s.set(C.id,{children:[],node:C}),C.type==="handleCall"&&(u=C.id)}),e.edges.forEach(C=>{let I=s.get(C.source),L=s.get(C.target);if(!I||!L)return t.warn("Invalid edge:",C);I.children.push(C.target),C.sourceHandle&&c.set(C.sourceHandle,L),n.has(C.target)&&l.set(C.target,[]),n.add(C.target)});let y=[...l.keys()],E=(C,I)=>{var U,G,X;let L=c.get(I.id);if(L){let H=[];l.set(I.id,H),I.digit&&(C[I.digit]=H);let q=Qf(I.command);q&&(C[q]=H);let ee=f(L.node.id);if(ee){let z={transfer:L.node.id};I.digit&&((U=C[I.digit])==null||U.push(z)),q&&!((G=C[q])!=null&&G.includes(z))&&((X=C[q])==null||X.push(z))}N({current:L,sectionName:ee?L.node.id:I.id})}return C},x=(C,I)=>{var U;let L=c.get(I.id);if(L){let G=[];l.set(I.id,G),C[I.result]=G;let X=f(L.node.id);X&&((U=C[I.result])==null||U.push({transfer:L.node.id})),N({current:L,sectionName:X?L.node.id:I.id})}return C},_={else:(C,I)=>{if(I.result==="success")return C;let L=c.get(I.id);if(L){let U=[];l.set(I.id,U),C=U;let G=f(L.node.id);G&&C.push({transfer:L.node.id}),N({current:L,sectionName:G?L.node.id:I.id})}return C},then:(C,I)=>{if(I.result!=="success")return C;let L=c.get(I.id);if(L){let U=[];l.set(I.id,U),C=U;let G=f(L.node.id);G&&C.push({transfer:L.node.id}),N({current:L,sectionName:G?L.node.id:I.id})}return C}},w={fallback:C=>{let I=c.get(C),L={else:[]};if(I){let U=[];l.set(C,U),L.else=U;let G=f(I.node.id);G&&L.else.push({transfer:I.node.id}),N({current:I,sectionName:G?I.node.id:C})}return L},options:(C,I)=>{let L=c.get(I.id),U={then:[],when:I.value};if(L){let G=[];l.set(I.id,G),U.then=G;let X=f(L.node.id);X&&U.then.push({transfer:L.node.id}),C.push(U),N({current:L,sectionName:X?L.node.id:I.id})}return C}},S=C=>{let I=c.get(C),L=[];if(I){let U=[];l.set(C,U),L=U;let G=f(I.node.id);G&&L.push({transfer:I.node.id}),N({current:I,sectionName:G?I.node.id:C})}return L},N=({sectionName:C,current:I})=>{var U,G,X;if(p(I.node.id))return;m(I.node.id);let L=l.get(C);if(!L){t.warn("Unknown section name:",C);return}switch(I.node.type){case"promptPlay":{let H=Ur({__type:I.node.type,node:I.node});if(!Array.isArray(H)){t.warn("Invalid gather node",H);return}(G=(U=I.node.data)==null?void 0:U.results)!=null&&G.length&&(H[1].switch.case={...H[1].switch.case,...I.node.data.results.reduce(x,{})}),H[1].switch.default[0].switch.case=I.node.data.options.reduce(E,{}),(X=H[1].switch.case)!=null&&X.no_match&&(H[1].switch.default[0].switch.default=H[1].switch.case.no_match),L.push(...H);return}case"cond":{let H=Ur({__type:I.node.type,node:I.node});H.cond=I.node.data.options.reduce(w.options,[]),H.cond.push(w.fallback(I.node.data.fallback)),L.push(H);return}case"condRequest":{let H=Ur({__type:I.node.type,node:I.node}),q=I.node.data.options.reduce(w.options,[]),ee=w.fallback(I.node.data.fallback),z={cond:[...q,ee]};H[1].switch.case.success=[z],H[1].switch.default=S(I.node.data.error),L.push(...H);return}case"executeSWML":{let H=Ur({__type:I.node.type,node:I.node}),q=I.node.data.options.reduce(w.options,[]),ee=w.fallback(I.node.data.fallback);H.execute.result=[...q,ee],L.push(H);return}case"forwardPhone":case"forwardAddress":case"forwardResource":{let H=Ur({__type:I.node.type,node:I.node});if(!Array.isArray(H)){t.warn("Invalid connect node",H);return}I.node.data.options.length&&(H[1].switch.case.connected=I.node.data.options.reduce(_.then,[]),H[1].switch.default[0].switch.case=I.node.data.options.filter(q=>q.result!=="success").reduce(x,{})),L.push(...H);return}case"request":{let H=Ur({__type:I.node.type,node:I.node});if(!Array.isArray(H)){t.warn("Invalid request node",H);return}H[1].switch.case.success=I.node.data.options.reduce(_.then,[]),H[1].switch.default=I.node.data.options.reduce(_.else,[]),L.push(...H);return}default:{let H=Ur({__type:I.node.type,node:I.node});I.node.type!=="handleCall"&&L.push(H),I.children.forEach(q=>{let ee=s.get(q);if(!ee)return t.warn("Invalid Child Node",q);let z=f(q);z&&L.push({transfer:q}),N({current:ee,sectionName:z?q:C})});break}}},R=s.get(u);R&&N({current:R,sectionName:"main"});let P={};return y.forEach(C=>{let I=l.get(C);I&&(P[C]=I)}),t.debug("sections",JSON.stringify(P)),{sections:P,version:Lv}},kv=class ev extends Error{constructor(t,n){super(n),this.code=t,this.message=n,uc(this,"name","AuthError"),Object.setPrototypeOf(this,ev.prototype)}},Pv=class tv extends Error{constructor(t,n,s){super(n),this.code=t,this.message=n,this.response=s,uc(this,"name","HttpError"),Object.setPrototypeOf(this,tv.prototype)}};async function Mv(e,t){let n=await fetch(e,t);if(!n.ok){if(n.status===401)throw new kv(n.status,"Unauthorized");let s;try{s=await n.json()}catch{}let i=s!=null&&s.errors?JSON.stringify(s.errors):`Error Code: ${n.status}`;throw new Pv(n.status,i,s)}try{n.parsedBody??(n.parsedBody=await n.json())}catch{}return n}var jv=({timeout:e=3e4,...t},n=Mv)=>async(s,i)=>{let l={...i!=null&&i.body?{"Content-Type":"application/json"}:{},...t.headers,...i==null?void 0:i.headers},c=Fv({...t,...i,headers:l});c.credentials="same-origin";let u;if(e){let f=new AbortController,p=f.signal;c.signal=p,u=setTimeout(()=>{f.abort()},e)}try{return{body:(await n(Vv({searchParams:i==null?void 0:i.searchParams,url:s}),c)).parsedBody}}finally{u&&clearTimeout(u)}},Uv=e=>typeof e=="string"?e:JSON.stringify(e),Fv=e=>Object.entries(e).reduce((t,[n,s])=>n==="body"?{...t,body:Uv(s)}:s!=null?{...t,[n]:s}:t,{}),Vv=({url:e,searchParams:t})=>{let n=new URL(e);return t&&Object.entries(t).forEach(([s,i])=>{i!=null&&n.searchParams.append(s,i)}),n.toString()},gc=e=>{let t=Qe(),n=jv(e);return{deployFlow:async s=>{if(!e.deployFlowURL)throw new Error("deployFlowURL is not defined");let i={document_version:s.documentVersion},l=await n(e.deployFlowURL,{body:i,method:"POST"});return t.info("deployFlow",l.body),l.body},getAiAgents:async()=>{try{if(!e.getAiAgentsURL)throw new Error("getAiAgentsURL is not defined");let{body:s}=await n(e.getAiAgentsURL);return t.info("getAiAgents",s),s}catch(s){throw t.error("Could not load AI agents. URL:",e.getAiAgentsURL),s}},getFlow:async()=>{try{if(!e.getFlowURL)throw new Error("getFlowURL is not defined");let{body:s}=await n(e.getFlowURL);return t.info("getFlow",s),s}catch(s){if(t.error("Could not load flow. URL:",e.getFlowURL),s instanceof Error)throw s;return{}}},getFlowVersions:async(s={})=>{if(!e.deployFlowURL)throw new Error("deployFlowURL is not defined");let{pageNumber:i,pageSize:l}=s,c=hc(e.deployFlowURL,{page_number:i,page_size:l});try{let{body:u}=await n(c);return t.info("getFlowVersions",u),u.data}catch(u){throw t.error("Could not load flow versions. URL:",c),u}},getSwmlScripts:async(s={})=>{try{if(!e.getSwmlScriptsURL)throw new Error("getSwmlScriptsURL is not defined");let{ids:i,name:l}=s,c=hc(e.getSwmlScriptsURL,{ids:i,name:l}),{body:u}=await n(c);return t.info("getSwmlScripts",u),u}catch(i){throw t.error("Could not load SWML scripts. URL:",e.getSwmlScriptsURL),i}},putFlow:async s=>{if(!e.updateFlowURL)throw new Error("updateFlowURL is not defined");let i={type:"call_flow",document_version:s.documentVersion+1,flow_data:{flowDataVersion:s.flowDataVersion,nodes:s.nodes.map(Nv),edges:s.edges.map(Tv)},relayml:Dv({nodes:s.nodes,edges:s.edges})},l=await n(e.updateFlowURL,{body:i,method:"PUT"});return t.info("putFlow",l.body),l.body}}},yc=[{from:"0.0.0",to:"0.0.1",run:e=>(e.nodes=e.nodes.map(t=>("missingRequiredParams"in t.data&&delete t.data.missingRequiredParams,t.data.initial=!1,"initialTimeout"in t.data&&(t.data.initialTimeout=pc(t.data.initialTimeout)),(t.type==="play"||t.type==="promptPlay")&&"selected"in t.data&&!t.data.selected&&(t.data.url?t.data.selected="url":t.data.text&&(t.data.selected="text")),t)),e)},{from:"0.0.1",to:"0.0.2",run:e=>(e.nodes=e.nodes.map(t=>{if("terminators"in t.data){let{terminators:n=""}=t.data;n.trim()||delete t.data.terminators}return t}),e)},{from:"0.0.2",to:"0.0.3",run:e=>(e.nodes=e.nodes.map(t=>{if(t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource"){let{destinations:n=[],destinationType:s,initial:i,options:l,sessionTimeout:c,type:u,valid:f}=t.data,p=n.map(m=>({connectFrom:"",connectTimeout:"",connectTo:m,id:Le()}));t.data={callOrder:u,connections:p,defaultFrom:"",defaultTimeout:c?`${c}`:"",destinationType:s,initial:i,options:l,valid:f===void 0||f}}return t}),e)},{from:"0.0.3",to:"0.0.4",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="answer"||t.type==="handleCall"||t.type==="hangup")&&(t.data.valid=!0),t)),e)},{from:"0.0.4",to:"0.0.5",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&(t.data={callStateEvents:"",callStateUrl:"",...t.data}),t)),e)},{from:"0.0.5",to:"0.0.6",run:e=>(e&&"builderVersion"in e&&typeof e.builderVersion=="string"&&(e.flowDataVersion=e.builderVersion,delete e.builderVersion),e)},{from:"0.0.6",to:"0.0.7",run:e=>(e.nodes=e.nodes.map(t=>{if((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&"connections"in t.data&&"connections"in t.data){let n=()=>({connectFrom:"",connectTimeout:"",connectTo:"",id:Le()});t.data.connections.length===0&&(t.data.connections=[n()],t.data.valid=!1)}return t}),e)},{from:"0.0.7",to:"0.0.8",run:e=>(e.nodes=e.nodes.map(t=>(t.type==="promptPlay"&&!("digitTimeout"in t.data)&&(t.data={...t.data,digitTimeout:""}),t)),e)},{from:"0.0.8",to:"0.0.9",run:e=>(e.nodes=e.nodes.map(t=>(t.type==="record"&&(t.data={endSilenceTimeout:"",initialTimeout:"",maxLength:"",...t.data}),t)),e)},{from:"0.0.9",to:"0.0.10",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&"connections"in t.data&&"connections"in t.data&&(t.data.connections=t.data.connections.map(n=>({connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",...n}))),t)),e)}],$v=e=>{let t=yc.findIndex(n=>n.from===e);return t>=0?yc.slice(t):yc},ep=class{constructor({dbRecord:e}){uc(this,"dbRecord"),this.dbRecord=e}get logger(){return Qe()}get flowData(){return this.dbRecord.flow_data}set flowData(e){this.dbRecord.flow_data=e}updateToVersion(e){this.flowData&&("builderVersion"in this.flowData?this.flowData.builderVersion=e:"flowDataVersion"in this.flowData&&(this.flowData.flowDataVersion=e))}versionFrom(){let e="";return this.flowData&&("builderVersion"in this.flowData?e=this.flowData.builderVersion:"flowDataVersion"in this.flowData&&(e=this.flowData.flowDataVersion)),e}migrateTo(e){let t=this.versionFrom();if(this.flowData&&t!==e){this.logger.info(`Migrate data from "${t}" to "${e}"`);let n=$v(t);for(let{run:s,to:i}of n){try{this.flowData=s(this.flowData),this.updateToVersion(i)}catch(l){console.error("Run migration:",l)}if(i===e)break}this.logger.debug("Migrated flow data",this.flowData)}else this.logger.info("Flow data up to date. No need to migrate!");return this.dbRecord}},b=Ss();const ne=Bi(b),tp=vs({__proto__:null,default:ne},[b]);var Wi={},Ec={exports:{}},Tt={},vc={exports:{}},xc={};/**
21
+ */var Kf;function rv(){if(Kf)return vs;Kf=1;var e=xs(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var m,E={},v=null,x=null;p!==void 0&&(v=""+p),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(x=f.ref);for(m in f)s.call(f,m)&&!a.hasOwnProperty(m)&&(E[m]=f[m]);if(u&&u.defaultProps)for(m in f=u.defaultProps,f)E[m]===void 0&&(E[m]=f[m]);return{$$typeof:t,type:u,key:v,ref:x,props:E,_owner:i.current}}return vs.Fragment=r,vs.jsx=c,vs.jsxs=c,vs}var Xf;function ov(){return Xf||(Xf=1,lc.exports=rv()),lc.exports}var h=ov(),sv=Object.create,cc=Object.defineProperty,iv=Object.getOwnPropertyDescriptor,lv=Object.getOwnPropertyNames,av=Object.getPrototypeOf,cv=Object.prototype.hasOwnProperty,uv=(e,t,r)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dv=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),fv=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lv(t))!cv.call(e,i)&&i!==r&&cc(e,i,{get:()=>t[i],enumerable:!(s=iv(t,i))||s.enumerable});return e},pv=(e,t,r)=>(r=e!=null?sv(av(e)):{},fv(cc(r,"default",{value:e,enumerable:!0}),e)),uc=(e,t,r)=>uv(e,typeof t!="symbol"?t+"":t,r),hv=dv((e,t)=>{(function(r,s){typeof define=="function"&&define.amd?define(s):typeof t=="object"&&t.exports?t.exports=s():r.log=s()})(e,function(){var r=function(){},s="undefined",i=typeof window!==s&&typeof window.navigator!==s&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function c(S,N){var O=S[N];if(typeof O.bind=="function")return O.bind(S);try{return Function.prototype.bind.call(O,S)}catch{return function(){return Function.prototype.apply.apply(O,[S,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function f(S){return S==="debug"&&(S="log"),typeof console===s?!1:S==="trace"&&i?u:console[S]!==void 0?c(console,S):console.log!==void 0?c(console,"log"):r}function p(S,N){for(var O=0;O<a.length;O++){var D=a[O];this[D]=O<S?r:this.methodFactory(D,S,N)}this.log=this.debug}function m(S,N,O){return function(){typeof console!==s&&(p.call(this,N,O),this[S].apply(this,arguments))}}function E(S,N,O){return f(S)||m.apply(this,arguments)}function v(S,N,O){var D=this,T;N=N??"WARN";var A="loglevel";typeof S=="string"?A+=":"+S:typeof S=="symbol"&&(A=void 0);function L(X){var ee=(a[X]||"silent").toUpperCase();if(!(typeof window===s||!A)){try{window.localStorage[A]=ee;return}catch{}try{window.document.cookie=encodeURIComponent(A)+"="+ee+";"}catch{}}}function F(){var X;if(!(typeof window===s||!A)){try{X=window.localStorage[A]}catch{}if(typeof X===s)try{var ee=window.document.cookie,ne=ee.indexOf(encodeURIComponent(A)+"=");ne!==-1&&(X=/^([^;]+)/.exec(ee.slice(ne))[1])}catch{}return D.levels[X]===void 0&&(X=void 0),X}}function K(){if(!(typeof window===s||!A)){try{window.localStorage.removeItem(A);return}catch{}try{window.document.cookie=encodeURIComponent(A)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}D.name=S,D.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},D.methodFactory=O||E,D.getLevel=function(){return T},D.setLevel=function(X,ee){if(typeof X=="string"&&D.levels[X.toUpperCase()]!==void 0&&(X=D.levels[X.toUpperCase()]),typeof X=="number"&&X>=0&&X<=D.levels.SILENT){if(T=X,ee!==!1&&L(X),p.call(D,X,S),typeof console===s&&X<D.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+X},D.setDefaultLevel=function(X){N=X,F()||D.setLevel(X,!1)},D.resetLevel=function(){D.setLevel(N,!1),K()},D.enableAll=function(X){D.setLevel(D.levels.TRACE,X)},D.disableAll=function(X){D.setLevel(D.levels.SILENT,X)};var Q=F();Q==null&&(Q=N),D.setLevel(Q,!1)}var x=new v,_={};x.getLogger=function(S){if(typeof S!="symbol"&&typeof S!="string"||S==="")throw new TypeError("You must supply a name when creating a logger.");var N=_[S];return N||(N=_[S]=new v(S,x.getLevel(),x.methodFactory)),N};var w=typeof window!==s?window.log:void 0;return x.noConflict=function(){return typeof window!==s&&window.log===x&&(window.log=w),x},x.getLoggers=function(){return _},x.default=x,x})}),mv="/api/ai/ai_agents",gv="/api/swml_scripts",Ev=pv(hv()),yv=()=>new Date().toISOString(),Ss=Ev.default.getLogger("signalwire"),vv=Ss.methodFactory;Ss.methodFactory=(e,t,r)=>{let s=vv(e,t,r);return function(...i){i.unshift(yv(),"-"),s(...i)}};var xv=Ss.getLevel();Ss.setLevel(xv);var Qe=()=>Ss,Sv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",_v=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Sv[r[e]&63];return t},dc=Qe(),wv=e=>typeof e=="object"&&e!==null&&"id"in e&&"type"in e&&"data"in e&&"position"in e,Nv=e=>{if(!wv(e))throw dc.error("nodeToDBShape: Invalid node",e),new Error;return{data:e.data,id:e.id,position:e.position,type:e.type}},Rv=e=>typeof e=="object"&&e!==null&&"id"in e&&"source"in e&&"sourceHandle"in e&&"target"in e&&"targetHandle"in e,Tv=e=>{if(!Rv(e))throw dc.error("edgeToDBShape: Invalid edge",e),new Error;return{id:e.id,source:e.source,sourceHandle:e.sourceHandle??null,target:e.target,targetHandle:e.targetHandle??null}},Qf=e=>e?.trim()?.toLowerCase(),Eo=e=>e.replace(/\s/g,""),fc=e=>{if(!(!e||typeof e=="string"&&e.trim().length===0))try{return JSON.parse(e)}catch{return typeof e=="string"?e.trim():e}},pc=e=>typeof e=="string"?e.trim():typeof e=="number"&&isNaN(e)||e==null||typeof e=="object"||typeof e=="function"||typeof e=="symbol"?"":String(e),Ov=e=>e.split(",").map(t=>t.trim()).filter(Boolean),Bi=e=>{let t=fc(e);return t&&typeof t=="object"&&Object.keys(t).length?t:void 0},Le=()=>_v(),hc=(e,t)=>{try{let r=new URL(e);return t&&(Object.entries(t).forEach(([s,i])=>{i&&r.searchParams.set(s,String(i))}),r.searchParams.sort()),r.toString()}catch(r){throw dc.error("buildUrlWithParams",r),r}},qf=e=>{let t=e===void 0?void 0:parseInt(e,10);return t===void 0||Number.isNaN(t)||t<=0?void 0:t},mc=({callStateEvents:e,callStateUrl:t,connections:r,defaultFrom:s,defaultTimeout:i,callOrder:a})=>{let c=qf(i),u=Eo(s),f=Ov(e),p=t?.trim(),m=r.map(({connectConfirmUrl:v,connectConfirmEnabled:x,connectFrom:_,connectTimeout:w,connectTo:S})=>({call_state_events:f.length>0?f:void 0,call_state_url:p||void 0,confirm:x?v:void 0,from:Eo(_)||u||"%{call.from}",timeout:qf(w)??c,to:Eo(S)}));m.length||m.push({from:"%{call.from}",timeout:void 0,to:""});let E={switch:{case:{connected:[]},default:[{switch:{case:{busy:[],decline:[],error:[],noAnswer:[]},default:["hangup"],variable:"connect_failed_reason"}}],variable:"connect_result"}};switch(a){case"single":return[{connect:m[0]},E];case"serial":return[{connect:{serial:m}},E];case"parallel":return[{connect:{parallel:m}},E];default:return Qe().warn(`The type '${a}' is not supported yet.`),[{connect:m[0]},E]}},Cv=/\bmale\b/i,Av=/\bfemale\b/i,Iv=e=>{if(e){if(Av.test(e))return"female";if(Cv.test(e))return"male"}},Zf=(e,t)=>{if(typeof e=="object"&&!Array.isArray(e)){t.language&&(e.say_language=t.language);let r=Iv(t.gender);r&&(e.say_gender=r),t.voice&&(e.say_voice=t.voice)}return e},Jf=(e,t)=>{if(typeof e=="object"&&!Array.isArray(e)){let r="url"in e?e.url:e.play,s,i=t.text?.trim();if(Array.isArray(t.url)){let a=t.url.map(c=>c?.trim()).filter(Boolean);s=a?.length===1?a[0]:a}else s=t.url?.trim();(!t.selected||t.selected==="url")&&s?r=s:(!t.selected||t.selected==="text")&&i&&(r=`say:${i}`),"url"in e?e.url=r:e.play=r}return e},bv={aiAgent:({data:{agent:e}})=>({ai:{agent:e}}),answer:({data:{maxDuration:e}})=>e?{answer:{max_duration:e}}:"answer",cond:()=>({cond:[]}),condRequest:({data:e})=>[{request:{body:fc(e.body),connect_timeout:e.connectTimeout,headers:Bi(e.headers),method:e.method,save_variables:e.saveVariables,timeout:e.timeout,url:e.url}},{switch:{case:{success:[]},default:[],variable:"request_result"}}],executeSWML:({data:e})=>({execute:{dest:e.dest,meta:Bi(e.meta),params:Bi(e.params),result:[]}}),forwardAddress:({data:e})=>mc(e),forwardPhone:({data:e})=>mc(e),forwardResource:({data:e})=>mc(e),handleCall:()=>"start",hangup:({data:{reason:e}})=>e?{hangup:{reason:e}}:"hangup",play:({data:e})=>{let{volume:t}=e,r=Zf(Jf({url:"say:Unknown TTS"},e),e);return t&&(r.volume=t),{play:r}},promptPlay:({data:e})=>{let{digitTimeout:t,initialTimeout:r,options:s,volume:i}=e,a=Zf(Jf({play:"say:Unknown value"},e),e);i&&(a.volume=i),r&&(a.initial_timeout=parseInt(r,10)),t&&(a.digit_timeout=parseInt(t,10));let c=s.reduce((u,f)=>{let p=Qf(f.command);p&&u.speechHints.push(p);let m=Eo(f.digit);return m&&(u.maxDigits=Math.max(u.maxDigits,m.length)),u},{maxDigits:-1,speechHints:[]});return c.speechHints.length&&(a.speech_hints=c.speechHints,a.speech_language="en-US"),c.maxDigits>0&&(a.max_digits=c.maxDigits),[{prompt:a},{switch:{case:{failed:[{play:"say:Error while gathering input."},"hangup"],no_input:[],no_match:[]},default:[{switch:{case:{},default:[],variable:"prompt_value"}}],variable:"prompt_result"}}]},record:({data:e})=>{let t={beep:e.beep,direction:e.direction,format:e.format,input_sensitivity:e.inputSensitivity,stereo:e.stereo,terminators:e.terminators?.trim()||void 0};return e.endSilenceTimeout&&(t.end_silence_timeout=parseInt(e.endSilenceTimeout,10)),e.initialTimeout&&(t.initial_timeout=parseInt(e.initialTimeout,10)),e.maxLength&&(t.max_length=parseInt(e.maxLength,10)),{record:t}},recordCallStart:({data:e})=>({record_call:{beep:e.beep,control_id:e.controlId,direction:e.direction,format:e.format,input_sensitivity:e.inputSensitivity,stereo:e.stereo,terminators:e.terminators?.trim()||void 0}}),recordCallStop:({data:e})=>({stop_record_call:e.controlId}),request:({data:e})=>[{request:{body:fc(e.body),connect_timeout:e.connectTimeout,headers:Bi(e.headers),method:e.method,save_variables:e.saveVariables,timeout:e.timeout,url:e.url}},{switch:{case:{success:[]},default:[],variable:"request_result"}}],sendSms:({data:e})=>{let{fromNumber:t,toNumber:r,body:s}=e;return{send_sms:{body:s,from_number:Eo(t),to_number:Eo(r)}}},set:({data:{variables:e}})=>{let t={};return e.forEach(({key:r,value:s})=>{t[r]=s}),{set:t}},unset:({data:{variables:e}})=>({unset:e.map(({key:t})=>t)})},Ur=e=>{try{return bv[e.__type](e.node)}catch(t){throw Qe().error("Unknown Verb",e),t}},Lv="1.0.0",Dv=e=>{let t=Qe(),r=new Set,s=new Map,i=new Set,a=new Map([["main",[]]]),c=new Map,u="",f=T=>a.has(T),p=T=>i.has(T),m=T=>i.add(T);e.nodes.forEach(T=>{s.set(T.id,{children:[],node:T}),T.type==="handleCall"&&(u=T.id)}),e.edges.forEach(T=>{let A=s.get(T.source),L=s.get(T.target);if(!A||!L)return t.warn("Invalid edge:",T);A.children.push(T.target),T.sourceHandle&&c.set(T.sourceHandle,L),r.has(T.target)&&a.set(T.target,[]),r.add(T.target)});let E=[...a.keys()],v=(T,A)=>{let L=c.get(A.id);if(L){let F=[];a.set(A.id,F),A.digit&&(T[A.digit]=F);let K=Qf(A.command);K&&(T[K]=F);let Q=f(L.node.id);if(Q){let X={transfer:L.node.id};A.digit&&T[A.digit]?.push(X),K&&!T[K]?.includes(X)&&T[K]?.push(X)}N({current:L,sectionName:Q?L.node.id:A.id})}return T},x=(T,A)=>{let L=c.get(A.id);if(L){let F=[];a.set(A.id,F),T[A.result]=F;let K=f(L.node.id);K&&T[A.result]?.push({transfer:L.node.id}),N({current:L,sectionName:K?L.node.id:A.id})}return T},_={else:(T,A)=>{if(A.result==="success")return T;let L=c.get(A.id);if(L){let F=[];a.set(A.id,F),T=F;let K=f(L.node.id);K&&T.push({transfer:L.node.id}),N({current:L,sectionName:K?L.node.id:A.id})}return T},then:(T,A)=>{if(A.result!=="success")return T;let L=c.get(A.id);if(L){let F=[];a.set(A.id,F),T=F;let K=f(L.node.id);K&&T.push({transfer:L.node.id}),N({current:L,sectionName:K?L.node.id:A.id})}return T}},w={fallback:T=>{let A=c.get(T),L={else:[]};if(A){let F=[];a.set(T,F),L.else=F;let K=f(A.node.id);K&&L.else.push({transfer:A.node.id}),N({current:A,sectionName:K?A.node.id:T})}return L},options:(T,A)=>{let L=c.get(A.id),F={then:[],when:A.value};if(L){let K=[];a.set(A.id,K),F.then=K;let Q=f(L.node.id);Q&&F.then.push({transfer:L.node.id}),T.push(F),N({current:L,sectionName:Q?L.node.id:A.id})}return T}},S=T=>{let A=c.get(T),L=[];if(A){let F=[];a.set(T,F),L=F;let K=f(A.node.id);K&&L.push({transfer:A.node.id}),N({current:A,sectionName:K?A.node.id:T})}return L},N=({sectionName:T,current:A})=>{if(p(A.node.id))return;m(A.node.id);let L=a.get(T);if(!L){t.warn("Unknown section name:",T);return}switch(A.node.type){case"promptPlay":{let F=Ur({__type:A.node.type,node:A.node});if(!Array.isArray(F)){t.warn("Invalid gather node",F);return}A.node.data?.results?.length&&(F[1].switch.case={...F[1].switch.case,...A.node.data.results.reduce(x,{})}),F[1].switch.default[0].switch.case=A.node.data.options.reduce(v,{}),F[1].switch.case?.no_match&&(F[1].switch.default[0].switch.default=F[1].switch.case.no_match),L.push(...F);return}case"cond":{let F=Ur({__type:A.node.type,node:A.node});F.cond=A.node.data.options.reduce(w.options,[]),F.cond.push(w.fallback(A.node.data.fallback)),L.push(F);return}case"condRequest":{let F=Ur({__type:A.node.type,node:A.node}),K=A.node.data.options.reduce(w.options,[]),Q=w.fallback(A.node.data.fallback),X={cond:[...K,Q]};F[1].switch.case.success=[X],F[1].switch.default=S(A.node.data.error),L.push(...F);return}case"executeSWML":{let F=Ur({__type:A.node.type,node:A.node}),K=A.node.data.options.reduce(w.options,[]),Q=w.fallback(A.node.data.fallback);F.execute.result=[...K,Q],L.push(F);return}case"forwardPhone":case"forwardAddress":case"forwardResource":{let F=Ur({__type:A.node.type,node:A.node});if(!Array.isArray(F)){t.warn("Invalid connect node",F);return}A.node.data.options.length&&(F[1].switch.case.connected=A.node.data.options.reduce(_.then,[]),F[1].switch.default[0].switch.case=A.node.data.options.filter(K=>K.result!=="success").reduce(x,{})),L.push(...F);return}case"request":{let F=Ur({__type:A.node.type,node:A.node});if(!Array.isArray(F)){t.warn("Invalid request node",F);return}F[1].switch.case.success=A.node.data.options.reduce(_.then,[]),F[1].switch.default=A.node.data.options.reduce(_.else,[]),L.push(...F);return}default:{let F=Ur({__type:A.node.type,node:A.node});A.node.type!=="handleCall"&&L.push(F),A.children.forEach(K=>{let Q=s.get(K);if(!Q)return t.warn("Invalid Child Node",K);let X=f(K);X&&L.push({transfer:K}),N({current:Q,sectionName:X?K:T})});break}}},O=s.get(u);O&&N({current:O,sectionName:"main"});let D={};return E.forEach(T=>{let A=a.get(T);A&&(D[T]=A)}),t.debug("sections",JSON.stringify(D)),{sections:D,version:Lv}},kv=class ev extends Error{constructor(t,r){super(r),this.code=t,this.message=r,uc(this,"name","AuthError"),Object.setPrototypeOf(this,ev.prototype)}},Mv=class tv extends Error{constructor(t,r,s){super(r),this.code=t,this.message=r,this.response=s,uc(this,"name","HttpError"),Object.setPrototypeOf(this,tv.prototype)}};async function Pv(e,t){let r=await fetch(e,t);if(!r.ok){if(r.status===401)throw new kv(r.status,"Unauthorized");let s;try{s=await r.json()}catch{}let i=s?.errors?JSON.stringify(s.errors):`Error Code: ${r.status}`;throw new Mv(r.status,i,s)}try{r.parsedBody??(r.parsedBody=await r.json())}catch{}return r}var Uv=({timeout:e=3e4,...t},r=Pv)=>async(s,i)=>{let a={...i?.body?{"Content-Type":"application/json"}:{},...t.headers,...i?.headers},c=jv({...t,...i,headers:a});c.credentials="same-origin";let u;if(e){let f=new AbortController,p=f.signal;c.signal=p,u=setTimeout(()=>{f.abort()},e)}try{return{body:(await r(Vv({searchParams:i?.searchParams,url:s}),c)).parsedBody}}finally{u&&clearTimeout(u)}},Fv=e=>typeof e=="string"?e:JSON.stringify(e),jv=e=>Object.entries(e).reduce((t,[r,s])=>r==="body"?{...t,body:Fv(s)}:s!=null?{...t,[r]:s}:t,{}),Vv=({url:e,searchParams:t})=>{let r=new URL(e);return t&&Object.entries(t).forEach(([s,i])=>{i!=null&&r.searchParams.append(s,i)}),r.toString()},gc=e=>{let t=Qe(),r=Uv(e);return{deployFlow:async s=>{if(!e.deployFlowURL)throw new Error("deployFlowURL is not defined");let i={document_version:s.documentVersion},a=await r(e.deployFlowURL,{body:i,method:"POST"});return t.info("deployFlow",a.body),a.body},getAiAgents:async()=>{try{if(!e.getAiAgentsURL)throw new Error("getAiAgentsURL is not defined");let{body:s}=await r(e.getAiAgentsURL);return t.info("getAiAgents",s),s}catch(s){throw t.error("Could not load AI agents. URL:",e.getAiAgentsURL),s}},getFlow:async()=>{try{if(!e.getFlowURL)throw new Error("getFlowURL is not defined");let{body:s}=await r(e.getFlowURL);return t.info("getFlow",s),s}catch(s){if(t.error("Could not load flow. URL:",e.getFlowURL),s instanceof Error)throw s;return{}}},getFlowVersions:async(s={})=>{if(!e.deployFlowURL)throw new Error("deployFlowURL is not defined");let{pageNumber:i,pageSize:a}=s,c=hc(e.deployFlowURL,{page_number:i,page_size:a});try{let{body:u}=await r(c);return t.info("getFlowVersions",u),u.data}catch(u){throw t.error("Could not load flow versions. URL:",c),u}},getSwmlScripts:async(s={})=>{try{if(!e.getSwmlScriptsURL)throw new Error("getSwmlScriptsURL is not defined");let{ids:i,name:a}=s,c=hc(e.getSwmlScriptsURL,{ids:i,name:a}),{body:u}=await r(c);return t.info("getSwmlScripts",u),u}catch(i){throw t.error("Could not load SWML scripts. URL:",e.getSwmlScriptsURL),i}},putFlow:async s=>{if(!e.updateFlowURL)throw new Error("updateFlowURL is not defined");let i={type:"call_flow",document_version:s.documentVersion+1,flow_data:{flowDataVersion:s.flowDataVersion,nodes:s.nodes.map(Nv),edges:s.edges.map(Tv)},relayml:Dv({nodes:s.nodes,edges:s.edges})},a=await r(e.updateFlowURL,{body:i,method:"PUT"});return t.info("putFlow",a.body),a.body}}},Ec=[{from:"0.0.0",to:"0.0.1",run:e=>(e.nodes=e.nodes.map(t=>("missingRequiredParams"in t.data&&delete t.data.missingRequiredParams,t.data.initial=!1,"initialTimeout"in t.data&&(t.data.initialTimeout=pc(t.data.initialTimeout)),(t.type==="play"||t.type==="promptPlay")&&"selected"in t.data&&!t.data.selected&&(t.data.url?t.data.selected="url":t.data.text&&(t.data.selected="text")),t)),e)},{from:"0.0.1",to:"0.0.2",run:e=>(e.nodes=e.nodes.map(t=>{if("terminators"in t.data){let{terminators:r=""}=t.data;r.trim()||delete t.data.terminators}return t}),e)},{from:"0.0.2",to:"0.0.3",run:e=>(e.nodes=e.nodes.map(t=>{if(t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource"){let{destinations:r=[],destinationType:s,initial:i,options:a,sessionTimeout:c,type:u,valid:f}=t.data,p=r.map(m=>({connectFrom:"",connectTimeout:"",connectTo:m,id:Le()}));t.data={callOrder:u,connections:p,defaultFrom:"",defaultTimeout:c?`${c}`:"",destinationType:s,initial:i,options:a,valid:f===void 0||f}}return t}),e)},{from:"0.0.3",to:"0.0.4",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="answer"||t.type==="handleCall"||t.type==="hangup")&&(t.data.valid=!0),t)),e)},{from:"0.0.4",to:"0.0.5",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&(t.data={callStateEvents:"",callStateUrl:"",...t.data}),t)),e)},{from:"0.0.5",to:"0.0.6",run:e=>(e&&"builderVersion"in e&&typeof e.builderVersion=="string"&&(e.flowDataVersion=e.builderVersion,delete e.builderVersion),e)},{from:"0.0.6",to:"0.0.7",run:e=>(e.nodes=e.nodes.map(t=>{if((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&"connections"in t.data&&"connections"in t.data){let r=()=>({connectFrom:"",connectTimeout:"",connectTo:"",id:Le()});t.data.connections.length===0&&(t.data.connections=[r()],t.data.valid=!1)}return t}),e)},{from:"0.0.7",to:"0.0.8",run:e=>(e.nodes=e.nodes.map(t=>(t.type==="promptPlay"&&!("digitTimeout"in t.data)&&(t.data={...t.data,digitTimeout:""}),t)),e)},{from:"0.0.8",to:"0.0.9",run:e=>(e.nodes=e.nodes.map(t=>(t.type==="record"&&(t.data={endSilenceTimeout:"",initialTimeout:"",maxLength:"",...t.data}),t)),e)},{from:"0.0.9",to:"0.0.10",run:e=>(e.nodes=e.nodes.map(t=>((t.type==="forwardAddress"||t.type==="forwardPhone"||t.type==="forwardResource")&&"connections"in t.data&&"connections"in t.data&&(t.data.connections=t.data.connections.map(r=>({connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",...r}))),t)),e)}],$v=e=>{let t=Ec.findIndex(r=>r.from===e);return t>=0?Ec.slice(t):Ec},ep=class{constructor({dbRecord:e}){uc(this,"dbRecord"),this.dbRecord=e}get logger(){return Qe()}get flowData(){return this.dbRecord.flow_data}set flowData(e){this.dbRecord.flow_data=e}updateToVersion(e){this.flowData&&("builderVersion"in this.flowData?this.flowData.builderVersion=e:"flowDataVersion"in this.flowData&&(this.flowData.flowDataVersion=e))}versionFrom(){let e="";return this.flowData&&("builderVersion"in this.flowData?e=this.flowData.builderVersion:"flowDataVersion"in this.flowData&&(e=this.flowData.flowDataVersion)),e}migrateTo(e){let t=this.versionFrom();if(this.flowData&&t!==e){this.logger.info(`Migrate data from "${t}" to "${e}"`);let r=$v(t);for(let{run:s,to:i}of r){try{this.flowData=s(this.flowData),this.updateToVersion(i)}catch(a){console.error("Run migration:",a)}if(i===e)break}this.logger.debug("Migrated flow data",this.flowData)}else this.logger.info("Flow data up to date. No need to migrate!");return this.dbRecord}},b=xs();const te=Hi(b),tp=ys({__proto__:null,default:te},[b]);var zi={},yc={exports:{}},Tt={},vc={exports:{}},xc={};/**
22
22
  * @license React
23
23
  * scheduler.production.min.js
24
24
  *
@@ -26,7 +26,7 @@ function vs(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
26
26
  *
27
27
  * This source code is licensed under the MIT license found in the
28
28
  * LICENSE file in the root directory of this source tree.
29
- */var np;function Hv(){return np||(np=1,function(e){function t(M,V){var B=M.length;M.push(V);e:for(;0<B;){var D=B-1>>>1,Q=M[D];if(0<i(Q,V))M[D]=V,M[B]=Q,B=D;else break e}}function n(M){return M.length===0?null:M[0]}function s(M){if(M.length===0)return null;var V=M[0],B=M.pop();if(B!==V){M[0]=B;e:for(var D=0,Q=M.length,oe=Q>>>1;D<oe;){var re=2*(D+1)-1,le=M[re],ue=re+1,fe=M[ue];if(0>i(le,B))ue<Q&&0>i(fe,le)?(M[D]=fe,M[ue]=B,D=ue):(M[D]=le,M[re]=B,D=re);else if(ue<Q&&0>i(fe,B))M[D]=fe,M[ue]=B,D=ue;else break e}}return V}function i(M,V){var B=M.sortIndex-V.sortIndex;return B!==0?B:M.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],m=1,y=null,E=3,x=!1,_=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(M){for(var V=n(p);V!==null;){if(V.callback===null)s(p);else if(V.startTime<=M)s(p),V.sortIndex=V.expirationTime,t(f,V);else break;V=n(p)}}function C(M){if(w=!1,P(M),!_)if(n(f)!==null)_=!0,$(I);else{var V=n(p);V!==null&&Y(C,V.startTime-M)}}function I(M,V){_=!1,w&&(w=!1,N(G),G=-1),x=!0;var B=E;try{for(P(V),y=n(f);y!==null&&(!(y.expirationTime>V)||M&&!q());){var D=y.callback;if(typeof D=="function"){y.callback=null,E=y.priorityLevel;var Q=D(y.expirationTime<=V);V=e.unstable_now(),typeof Q=="function"?y.callback=Q:y===n(f)&&s(f),P(V)}else s(f);y=n(f)}if(y!==null)var oe=!0;else{var re=n(p);re!==null&&Y(C,re.startTime-V),oe=!1}return oe}finally{y=null,E=B,x=!1}}var L=!1,U=null,G=-1,X=5,H=-1;function q(){return!(e.unstable_now()-H<X)}function ee(){if(U!==null){var M=e.unstable_now();H=M;var V=!0;try{V=U(!0,M)}finally{V?z():(L=!1,U=null)}}else L=!1}var z;if(typeof R=="function")z=function(){R(ee)};else if(typeof MessageChannel<"u"){var A=new MessageChannel,F=A.port2;A.port1.onmessage=ee,z=function(){F.postMessage(null)}}else z=function(){S(ee,0)};function $(M){U=M,L||(L=!0,z())}function Y(M,V){G=S(function(){M(e.unstable_now())},V)}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(M){M.callback=null},e.unstable_continueExecution=function(){_||x||(_=!0,$(I))},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return E},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(M){switch(E){case 1:case 2:case 3:var V=3;break;default:V=E}var B=E;E=V;try{return M()}finally{E=B}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(M,V){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var B=E;E=M;try{return V()}finally{E=B}},e.unstable_scheduleCallback=function(M,V,B){var D=e.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?D+B:D):B=D,M){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=B+Q,M={id:m++,callback:V,priorityLevel:M,startTime:B,expirationTime:Q,sortIndex:-1},B>D?(M.sortIndex=B,t(p,M),n(f)===null&&M===n(p)&&(w?(N(G),G=-1):w=!0,Y(C,B-D))):(M.sortIndex=Q,t(f,M),_||x||(_=!0,$(I))),M},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(M){var V=E;return function(){var B=E;E=V;try{return M.apply(this,arguments)}finally{E=B}}}}(xc)),xc}var rp;function Bv(){return rp||(rp=1,vc.exports=Hv()),vc.exports}/**
29
+ */var np;function Hv(){return np||(np=1,function(e){function t(U,$){var z=U.length;U.push($);e:for(;0<z;){var k=z-1>>>1,Y=U[k];if(0<i(Y,$))U[k]=$,U[z]=Y,z=k;else break e}}function r(U){return U.length===0?null:U[0]}function s(U){if(U.length===0)return null;var $=U[0],z=U.pop();if(z!==$){U[0]=z;e:for(var k=0,Y=U.length,re=Y>>>1;k<re;){var oe=2*(k+1)-1,le=U[oe],de=oe+1,he=U[de];if(0>i(le,z))de<Y&&0>i(he,le)?(U[k]=he,U[de]=z,k=de):(U[k]=le,U[oe]=z,k=oe);else if(de<Y&&0>i(he,z))U[k]=he,U[de]=z,k=de;else break e}}return $}function i(U,$){var z=U.sortIndex-$.sortIndex;return z!==0?z:U.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],m=1,E=null,v=3,x=!1,_=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function D(U){for(var $=r(p);$!==null;){if($.callback===null)s(p);else if($.startTime<=U)s(p),$.sortIndex=$.expirationTime,t(f,$);else break;$=r(p)}}function T(U){if(w=!1,D(U),!_)if(r(f)!==null)_=!0,j(A);else{var $=r(p);$!==null&&B(T,$.startTime-U)}}function A(U,$){_=!1,w&&(w=!1,N(K),K=-1),x=!0;var z=v;try{for(D($),E=r(f);E!==null&&(!(E.expirationTime>$)||U&&!ee());){var k=E.callback;if(typeof k=="function"){E.callback=null,v=E.priorityLevel;var Y=k(E.expirationTime<=$);$=e.unstable_now(),typeof Y=="function"?E.callback=Y:E===r(f)&&s(f),D($)}else s(f);E=r(f)}if(E!==null)var re=!0;else{var oe=r(p);oe!==null&&B(T,oe.startTime-$),re=!1}return re}finally{E=null,v=z,x=!1}}var L=!1,F=null,K=-1,Q=5,X=-1;function ee(){return!(e.unstable_now()-X<Q)}function ne(){if(F!==null){var U=e.unstable_now();X=U;var $=!0;try{$=F(!0,U)}finally{$?W():(L=!1,F=null)}}else L=!1}var W;if(typeof O=="function")W=function(){O(ne)};else if(typeof MessageChannel<"u"){var I=new MessageChannel,V=I.port2;I.port1.onmessage=ne,W=function(){V.postMessage(null)}}else W=function(){S(ne,0)};function j(U){F=U,L||(L=!0,W())}function B(U,$){K=S(function(){U(e.unstable_now())},$)}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(U){U.callback=null},e.unstable_continueExecution=function(){_||x||(_=!0,j(A))},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(U){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var z=v;v=$;try{return U()}finally{v=z}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(U,$){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var z=v;v=U;try{return $()}finally{v=z}},e.unstable_scheduleCallback=function(U,$,z){var k=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?k+z:k):z=k,U){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=z+Y,U={id:m++,callback:$,priorityLevel:U,startTime:z,expirationTime:Y,sortIndex:-1},z>k?(U.sortIndex=z,t(p,U),r(f)===null&&U===r(p)&&(w?(N(K),K=-1):w=!0,B(T,z-k))):(U.sortIndex=Y,t(f,U),_||x||(_=!0,j(A))),U},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(U){var $=v;return function(){var z=v;v=$;try{return U.apply(this,arguments)}finally{v=z}}}}(xc)),xc}var rp;function Bv(){return rp||(rp=1,vc.exports=Hv()),vc.exports}/**
30
30
  * @license React
31
31
  * react-dom.production.min.js
32
32
  *
@@ -34,14 +34,14 @@ function vs(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&
34
34
  *
35
35
  * This source code is licensed under the MIT license found in the
36
36
  * LICENSE file in the root directory of this source tree.
37
- */var op;function zv(){if(op)return Tt;op=1;var e=Ss(),t=Bv();function n(r){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+r,a=1;a<arguments.length;a++)o+="&args[]="+encodeURIComponent(arguments[a]);return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function l(r,o){c(r,o),c(r+"Capture",o)}function c(r,o){for(i[r]=o,r=0;r<o.length;r++)s.add(o[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[: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]*$/,m={},y={};function E(r){return f.call(y,r)?!0:f.call(m,r)?!1:p.test(r)?y[r]=!0:(m[r]=!0,!1)}function x(r,o,a,d){if(a!==null&&a.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return d?!1:a!==null?!a.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function _(r,o,a,d){if(o===null||typeof o>"u"||x(r,o,a,d))return!0;if(d)return!1;if(a!==null)switch(a.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function w(r,o,a,d,g,v,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=d,this.attributeNamespace=g,this.mustUseProperty=a,this.propertyName=r,this.type=o,this.sanitizeURL=v,this.removeEmptyString=T}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){S[r]=new w(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var o=r[0];S[o]=new w(o,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){S[r]=new w(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){S[r]=new w(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){S[r]=new w(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){S[r]=new w(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){S[r]=new w(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){S[r]=new w(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){S[r]=new w(r,5,!1,r.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function R(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var o=r.replace(N,R);S[o]=new w(o,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var o=r.replace(N,R);S[o]=new w(o,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var o=r.replace(N,R);S[o]=new w(o,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){S[r]=new w(r,1,!1,r.toLowerCase(),null,!1,!1)}),S.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){S[r]=new w(r,1,!1,r.toLowerCase(),null,!0,!0)});function P(r,o,a,d){var g=S.hasOwnProperty(o)?S[o]:null;(g!==null?g.type!==0:d||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(_(o,a,g,d)&&(a=null),d||g===null?E(o)&&(a===null?r.removeAttribute(o):r.setAttribute(o,""+a)):g.mustUseProperty?r[g.propertyName]=a===null?g.type===3?!1:"":a:(o=g.attributeName,d=g.attributeNamespace,a===null?r.removeAttribute(o):(g=g.type,a=g===3||g===4&&a===!0?"":""+a,d?r.setAttributeNS(d,o,a):r.setAttribute(o,a))))}var C=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,I=Symbol.for("react.element"),L=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),G=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),H=Symbol.for("react.provider"),q=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Y=Symbol.for("react.offscreen"),M=Symbol.iterator;function V(r){return r===null||typeof r!="object"?null:(r=M&&r[M]||r["@@iterator"],typeof r=="function"?r:null)}var B=Object.assign,D;function Q(r){if(D===void 0)try{throw Error()}catch(a){var o=a.stack.trim().match(/\n( *(at )?)/);D=o&&o[1]||""}return`
38
- `+D+r}var oe=!1;function re(r,o){if(!r||oe)return"";oe=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(te){var d=te}Reflect.construct(r,[],o)}else{try{o.call()}catch(te){d=te}r.call(o.prototype)}else{try{throw Error()}catch(te){d=te}r()}}catch(te){if(te&&d&&typeof te.stack=="string"){for(var g=te.stack.split(`
39
- `),v=d.stack.split(`
40
- `),T=g.length-1,j=v.length-1;1<=T&&0<=j&&g[T]!==v[j];)j--;for(;1<=T&&0<=j;T--,j--)if(g[T]!==v[j]){if(T!==1||j!==1)do if(T--,j--,0>j||g[T]!==v[j]){var W=`
41
- `+g[T].replace(" at new "," at ");return r.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",r.displayName)),W}while(1<=T&&0<=j);break}}}finally{oe=!1,Error.prepareStackTrace=a}return(r=r?r.displayName||r.name:"")?Q(r):""}function le(r){switch(r.tag){case 5:return Q(r.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return r=re(r.type,!1),r;case 11:return r=re(r.type.render,!1),r;case 1:return r=re(r.type,!0),r;default:return""}}function ue(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case U:return"Fragment";case L:return"Portal";case X:return"Profiler";case G:return"StrictMode";case z:return"Suspense";case A:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case q:return(r.displayName||"Context")+".Consumer";case H:return(r._context.displayName||"Context")+".Provider";case ee:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case F:return o=r.displayName||null,o!==null?o:ue(r.type)||"Memo";case $:o=r._payload,r=r._init;try{return ue(r(o))}catch{}}return null}function fe(r){var o=r.type;switch(r.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=o.render,r=r.displayName||r.name||"",o.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(o);case 8:return o===G?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function de(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function me(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Re(r){var o=me(r)?"checked":"value",a=Object.getOwnPropertyDescriptor(r.constructor.prototype,o),d=""+r[o];if(!r.hasOwnProperty(o)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var g=a.get,v=a.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return g.call(this)},set:function(T){d=""+T,v.call(this,T)}}),Object.defineProperty(r,o,{enumerable:a.enumerable}),{getValue:function(){return d},setValue:function(T){d=""+T},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function Me(r){r._valueTracker||(r._valueTracker=Re(r))}function Ze(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var a=o.getValue(),d="";return r&&(d=me(r)?r.checked?"true":"false":r.value),r=d,r!==a?(o.setValue(r),!0):!1}function wt(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Be(r,o){var a=o.checked;return B({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:a??r._wrapperState.initialChecked})}function je(r,o){var a=o.defaultValue==null?"":o.defaultValue,d=o.checked!=null?o.checked:o.defaultChecked;a=de(o.value!=null?o.value:a),r._wrapperState={initialChecked:d,initialValue:a,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ft(r,o){o=o.checked,o!=null&&P(r,"checked",o,!1)}function pt(r,o){ft(r,o);var a=de(o.value),d=o.type;if(a!=null)d==="number"?(a===0&&r.value===""||r.value!=a)&&(r.value=""+a):r.value!==""+a&&(r.value=""+a);else if(d==="submit"||d==="reset"){r.removeAttribute("value");return}o.hasOwnProperty("value")?un(r,o.type,a):o.hasOwnProperty("defaultValue")&&un(r,o.type,de(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(r.defaultChecked=!!o.defaultChecked)}function we(r,o,a){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var d=o.type;if(!(d!=="submit"&&d!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+r._wrapperState.initialValue,a||o===r.value||(r.value=o),r.defaultValue=o}a=r.name,a!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,a!==""&&(r.name=a)}function un(r,o,a){(o!=="number"||wt(r.ownerDocument)!==r)&&(a==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+a&&(r.defaultValue=""+a))}var Bt=Array.isArray;function qt(r,o,a,d){if(r=r.options,o){o={};for(var g=0;g<a.length;g++)o["$"+a[g]]=!0;for(a=0;a<r.length;a++)g=o.hasOwnProperty("$"+r[a].value),r[a].selected!==g&&(r[a].selected=g),g&&d&&(r[a].defaultSelected=!0)}else{for(a=""+de(a),o=null,g=0;g<r.length;g++){if(r[g].value===a){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}o!==null||r[g].disabled||(o=r[g])}o!==null&&(o.selected=!0)}}function Cn(r,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return B({},o,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function An(r,o){var a=o.value;if(a==null){if(a=o.children,o=o.defaultValue,a!=null){if(o!=null)throw Error(n(92));if(Bt(a)){if(1<a.length)throw Error(n(93));a=a[0]}o=a}o==null&&(o=""),a=o}r._wrapperState={initialValue:de(a)}}function dn(r,o){var a=de(o.value),d=de(o.defaultValue);a!=null&&(a=""+a,a!==r.value&&(r.value=a),o.defaultValue==null&&r.defaultValue!==a&&(r.defaultValue=a)),d!=null&&(r.defaultValue=""+d)}function Wn(r){var o=r.textContent;o===r._wrapperState.initialValue&&o!==""&&o!==null&&(r.value=o)}function fn(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function pn(r,o){return r==null||r==="http://www.w3.org/1999/xhtml"?fn(o):r==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var In,Gn=function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,a,d,g){MSApp.execUnsafeLocalFunction(function(){return r(o,a,d,g)})}:r}(function(r,o){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=o;else{for(In=In||document.createElement("div"),In.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=In.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;o.firstChild;)r.appendChild(o.firstChild)}});function Ke(r,o){if(o){var a=r.firstChild;if(a&&a===r.lastChild&&a.nodeType===3){a.nodeValue=o;return}}r.textContent=o}var ot={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Yn=["Webkit","ms","Moz","O"];Object.keys(ot).forEach(function(r){Yn.forEach(function(o){o=o+r.charAt(0).toUpperCase()+r.substring(1),ot[o]=ot[r]})});function bn(r,o,a){return o==null||typeof o=="boolean"||o===""?"":a||typeof o!="number"||o===0||ot.hasOwnProperty(r)&&ot[r]?(""+o).trim():o+"px"}function Ln(r,o){r=r.style;for(var a in o)if(o.hasOwnProperty(a)){var d=a.indexOf("--")===0,g=bn(a,o[a],d);a==="float"&&(a="cssFloat"),d?r.setProperty(a,g):r[a]=g}}var hn=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Lt(r,o){if(o){if(hn[r]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function Kn(r,o){if(r.indexOf("-")===-1)return typeof o.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var qr=null;function Xn(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Jr=null,Qn=null,Dt=null;function zl(r){if(r=Ci(r)){if(typeof Jr!="function")throw Error(n(280));var o=r.stateNode;o&&(o=_a(o),Jr(r.stateNode,r.type,o))}}function Wl(r){Qn?Dt?Dt.push(r):Dt=[r]:Qn=r}function Gl(){if(Qn){var r=Qn,o=Dt;if(Dt=Qn=null,zl(r),o)for(r=0;r<o.length;r++)zl(o[r])}}function Yl(r,o){return r(o)}function Kl(){}var oi=!1;function Xl(r,o,a){if(oi)return r(o,a);oi=!0;try{return Yl(r,o,a)}finally{oi=!1,(Qn!==null||Dt!==null)&&(Kl(),Gl())}}function Zr(r,o){var a=r.stateNode;if(a===null)return null;var d=_a(a);if(d===null)return null;a=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(a&&typeof a!="function")throw Error(n(231,o,typeof a));return a}var si=!1;if(u)try{var eo={};Object.defineProperty(eo,"passive",{get:function(){si=!0}}),window.addEventListener("test",eo,eo),window.removeEventListener("test",eo,eo)}catch{si=!1}function sd(r,o,a,d,g,v,T,j,W){var te=Array.prototype.slice.call(arguments,3);try{o.apply(a,te)}catch(ie){this.onError(ie)}}var to=!1,Xo=null,no=!1,ii=null,id={onError:function(r){to=!0,Xo=r}};function ld(r,o,a,d,g,v,T,j,W){to=!1,Xo=null,sd.apply(id,arguments)}function ad(r,o,a,d,g,v,T,j,W){if(ld.apply(this,arguments),to){if(to){var te=Xo;to=!1,Xo=null}else throw Error(n(198));no||(no=!0,ii=te)}}function qn(r){var o=r,a=r;if(r.alternate)for(;o.return;)o=o.return;else{r=o;do o=r,(o.flags&4098)!==0&&(a=o.return),r=o.return;while(r)}return o.tag===3?a:null}function Ql(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function ql(r){if(qn(r)!==r)throw Error(n(188))}function cd(r){var o=r.alternate;if(!o){if(o=qn(r),o===null)throw Error(n(188));return o!==r?null:r}for(var a=r,d=o;;){var g=a.return;if(g===null)break;var v=g.alternate;if(v===null){if(d=g.return,d!==null){a=d;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===a)return ql(g),r;if(v===d)return ql(g),o;v=v.sibling}throw Error(n(188))}if(a.return!==d.return)a=g,d=v;else{for(var T=!1,j=g.child;j;){if(j===a){T=!0,a=g,d=v;break}if(j===d){T=!0,d=g,a=v;break}j=j.sibling}if(!T){for(j=v.child;j;){if(j===a){T=!0,a=v,d=g;break}if(j===d){T=!0,d=v,a=g;break}j=j.sibling}if(!T)throw Error(n(189))}}if(a.alternate!==d)throw Error(n(190))}if(a.tag!==3)throw Error(n(188));return a.stateNode.current===a?r:o}function li(r){return r=cd(r),r!==null?Jl(r):null}function Jl(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var o=Jl(r);if(o!==null)return o;r=r.sibling}return null}var Zl=t.unstable_scheduleCallback,ea=t.unstable_cancelCallback,ud=t.unstable_shouldYield,dd=t.unstable_requestPaint,We=t.unstable_now,ta=t.unstable_getCurrentPriorityLevel,ai=t.unstable_ImmediatePriority,na=t.unstable_UserBlockingPriority,Qo=t.unstable_NormalPriority,ci=t.unstable_LowPriority,Ay=t.unstable_IdlePriority,ra=null,Dn=null;function nI(r){if(Dn&&typeof Dn.onCommitFiberRoot=="function")try{Dn.onCommitFiberRoot(ra,r,void 0,(r.current.flags&128)===128)}catch{}}var mn=Math.clz32?Math.clz32:sI,rI=Math.log,oI=Math.LN2;function sI(r){return r>>>=0,r===0?32:31-(rI(r)/oI|0)|0}var oa=64,sa=4194304;function ui(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function ia(r,o){var a=r.pendingLanes;if(a===0)return 0;var d=0,g=r.suspendedLanes,v=r.pingedLanes,T=a&268435455;if(T!==0){var j=T&~g;j!==0?d=ui(j):(v&=T,v!==0&&(d=ui(v)))}else T=a&~g,T!==0?d=ui(T):v!==0&&(d=ui(v));if(d===0)return 0;if(o!==0&&o!==d&&(o&g)===0&&(g=d&-d,v=o&-o,g>=v||g===16&&(v&4194240)!==0))return o;if((d&4)!==0&&(d|=a&16),o=r.entangledLanes,o!==0)for(r=r.entanglements,o&=d;0<o;)a=31-mn(o),g=1<<a,d|=r[a],o&=~g;return d}function iI(r,o){switch(r){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function lI(r,o){for(var a=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,v=r.pendingLanes;0<v;){var T=31-mn(v),j=1<<T,W=g[T];W===-1?((j&a)===0||(j&d)!==0)&&(g[T]=iI(j,o)):W<=o&&(r.expiredLanes|=j),v&=~j}}function fd(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Iy(){var r=oa;return oa<<=1,(oa&4194240)===0&&(oa=64),r}function pd(r){for(var o=[],a=0;31>a;a++)o.push(r);return o}function di(r,o,a){r.pendingLanes|=o,o!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,o=31-mn(o),r[o]=a}function aI(r,o){var a=r.pendingLanes&~o;r.pendingLanes=o,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=o,r.mutableReadLanes&=o,r.entangledLanes&=o,o=r.entanglements;var d=r.eventTimes;for(r=r.expirationTimes;0<a;){var g=31-mn(a),v=1<<g;o[g]=0,d[g]=-1,r[g]=-1,a&=~v}}function hd(r,o){var a=r.entangledLanes|=o;for(r=r.entanglements;a;){var d=31-mn(a),g=1<<d;g&o|r[d]&o&&(r[d]|=o),a&=~g}}var ke=0;function by(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Ly,md,Dy,ky,Py,gd=!1,la=[],vr=null,xr=null,Sr=null,fi=new Map,pi=new Map,_r=[],cI="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function My(r,o){switch(r){case"focusin":case"focusout":vr=null;break;case"dragenter":case"dragleave":xr=null;break;case"mouseover":case"mouseout":Sr=null;break;case"pointerover":case"pointerout":fi.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":pi.delete(o.pointerId)}}function hi(r,o,a,d,g,v){return r===null||r.nativeEvent!==v?(r={blockedOn:o,domEventName:a,eventSystemFlags:d,nativeEvent:v,targetContainers:[g]},o!==null&&(o=Ci(o),o!==null&&md(o)),r):(r.eventSystemFlags|=d,o=r.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),r)}function uI(r,o,a,d,g){switch(o){case"focusin":return vr=hi(vr,r,o,a,d,g),!0;case"dragenter":return xr=hi(xr,r,o,a,d,g),!0;case"mouseover":return Sr=hi(Sr,r,o,a,d,g),!0;case"pointerover":var v=g.pointerId;return fi.set(v,hi(fi.get(v)||null,r,o,a,d,g)),!0;case"gotpointercapture":return v=g.pointerId,pi.set(v,hi(pi.get(v)||null,r,o,a,d,g)),!0}return!1}function jy(r){var o=ro(r.target);if(o!==null){var a=qn(o);if(a!==null){if(o=a.tag,o===13){if(o=Ql(a),o!==null){r.blockedOn=o,Py(r.priority,function(){Dy(a)});return}}else if(o===3&&a.stateNode.current.memoizedState.isDehydrated){r.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}r.blockedOn=null}function aa(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var a=Ed(r.domEventName,r.eventSystemFlags,o[0],r.nativeEvent);if(a===null){a=r.nativeEvent;var d=new a.constructor(a.type,a);qr=d,a.target.dispatchEvent(d),qr=null}else return o=Ci(a),o!==null&&md(o),r.blockedOn=a,!1;o.shift()}return!0}function Uy(r,o,a){aa(r)&&a.delete(o)}function dI(){gd=!1,vr!==null&&aa(vr)&&(vr=null),xr!==null&&aa(xr)&&(xr=null),Sr!==null&&aa(Sr)&&(Sr=null),fi.forEach(Uy),pi.forEach(Uy)}function mi(r,o){r.blockedOn===o&&(r.blockedOn=null,gd||(gd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,dI)))}function gi(r){function o(g){return mi(g,r)}if(0<la.length){mi(la[0],r);for(var a=1;a<la.length;a++){var d=la[a];d.blockedOn===r&&(d.blockedOn=null)}}for(vr!==null&&mi(vr,r),xr!==null&&mi(xr,r),Sr!==null&&mi(Sr,r),fi.forEach(o),pi.forEach(o),a=0;a<_r.length;a++)d=_r[a],d.blockedOn===r&&(d.blockedOn=null);for(;0<_r.length&&(a=_r[0],a.blockedOn===null);)jy(a),a.blockedOn===null&&_r.shift()}var qo=C.ReactCurrentBatchConfig,ca=!0;function fI(r,o,a,d){var g=ke,v=qo.transition;qo.transition=null;try{ke=1,yd(r,o,a,d)}finally{ke=g,qo.transition=v}}function pI(r,o,a,d){var g=ke,v=qo.transition;qo.transition=null;try{ke=4,yd(r,o,a,d)}finally{ke=g,qo.transition=v}}function yd(r,o,a,d){if(ca){var g=Ed(r,o,a,d);if(g===null)Pd(r,o,d,ua,a),My(r,d);else if(uI(g,r,o,a,d))d.stopPropagation();else if(My(r,d),o&4&&-1<cI.indexOf(r)){for(;g!==null;){var v=Ci(g);if(v!==null&&Ly(v),v=Ed(r,o,a,d),v===null&&Pd(r,o,d,ua,a),v===g)break;g=v}g!==null&&d.stopPropagation()}else Pd(r,o,d,null,a)}}var ua=null;function Ed(r,o,a,d){if(ua=null,r=Xn(d),r=ro(r),r!==null)if(o=qn(r),o===null)r=null;else if(a=o.tag,a===13){if(r=Ql(o),r!==null)return r;r=null}else if(a===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null);return ua=r,null}function Fy(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ta()){case ai:return 1;case na:return 4;case Qo:case ci:return 16;case Ay:return 536870912;default:return 16}default:return 16}}var wr=null,vd=null,da=null;function Vy(){if(da)return da;var r,o=vd,a=o.length,d,g="value"in wr?wr.value:wr.textContent,v=g.length;for(r=0;r<a&&o[r]===g[r];r++);var T=a-r;for(d=1;d<=T&&o[a-d]===g[v-d];d++);return da=g.slice(r,1<d?1-d:void 0)}function fa(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function pa(){return!0}function $y(){return!1}function zt(r){function o(a,d,g,v,T){this._reactName=a,this._targetInst=g,this.type=d,this.nativeEvent=v,this.target=T,this.currentTarget=null;for(var j in r)r.hasOwnProperty(j)&&(a=r[j],this[j]=a?a(v):v[j]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?pa:$y,this.isPropagationStopped=$y,this}return B(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=pa)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),o}var Jo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xd=zt(Jo),yi=B({},Jo,{view:0,detail:0}),hI=zt(yi),Sd,_d,Ei,ha=B({},yi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nd,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Ei&&(Ei&&r.type==="mousemove"?(Sd=r.screenX-Ei.screenX,_d=r.screenY-Ei.screenY):_d=Sd=0,Ei=r),Sd)},movementY:function(r){return"movementY"in r?r.movementY:_d}}),Hy=zt(ha),mI=B({},ha,{dataTransfer:0}),gI=zt(mI),yI=B({},yi,{relatedTarget:0}),wd=zt(yI),EI=B({},Jo,{animationName:0,elapsedTime:0,pseudoElement:0}),vI=zt(EI),xI=B({},Jo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),SI=zt(xI),_I=B({},Jo,{data:0}),By=zt(_I),wI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NI={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"},RI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function TI(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=RI[r])?!!o[r]:!1}function Nd(){return TI}var OI=B({},yi,{key:function(r){if(r.key){var o=wI[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=fa(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?NI[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nd,charCode:function(r){return r.type==="keypress"?fa(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?fa(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),CI=zt(OI),AI=B({},ha,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zy=zt(AI),II=B({},yi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nd}),bI=zt(II),LI=B({},Jo,{propertyName:0,elapsedTime:0,pseudoElement:0}),DI=zt(LI),kI=B({},ha,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),PI=zt(kI),MI=[9,13,27,32],Rd=u&&"CompositionEvent"in window,vi=null;u&&"documentMode"in document&&(vi=document.documentMode);var jI=u&&"TextEvent"in window&&!vi,Wy=u&&(!Rd||vi&&8<vi&&11>=vi),Gy=" ",Yy=!1;function Ky(r,o){switch(r){case"keyup":return MI.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Xy(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Zo=!1;function UI(r,o){switch(r){case"compositionend":return Xy(o);case"keypress":return o.which!==32?null:(Yy=!0,Gy);case"textInput":return r=o.data,r===Gy&&Yy?null:r;default:return null}}function FI(r,o){if(Zo)return r==="compositionend"||!Rd&&Ky(r,o)?(r=Vy(),da=vd=wr=null,Zo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Wy&&o.locale!=="ko"?null:o.data;default:return null}}var VI={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 Qy(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!VI[r.type]:o==="textarea"}function qy(r,o,a,d){Wl(d),o=va(o,"onChange"),0<o.length&&(a=new xd("onChange","change",null,a,d),r.push({event:a,listeners:o}))}var xi=null,Si=null;function $I(r){mE(r,0)}function ma(r){var o=os(r);if(Ze(o))return r}function HI(r,o){if(r==="change")return o}var Jy=!1;if(u){var Td;if(u){var Od="oninput"in document;if(!Od){var Zy=document.createElement("div");Zy.setAttribute("oninput","return;"),Od=typeof Zy.oninput=="function"}Td=Od}else Td=!1;Jy=Td&&(!document.documentMode||9<document.documentMode)}function eE(){xi&&(xi.detachEvent("onpropertychange",tE),Si=xi=null)}function tE(r){if(r.propertyName==="value"&&ma(Si)){var o=[];qy(o,Si,r,Xn(r)),Xl($I,o)}}function BI(r,o,a){r==="focusin"?(eE(),xi=o,Si=a,xi.attachEvent("onpropertychange",tE)):r==="focusout"&&eE()}function zI(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ma(Si)}function WI(r,o){if(r==="click")return ma(o)}function GI(r,o){if(r==="input"||r==="change")return ma(o)}function YI(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var gn=typeof Object.is=="function"?Object.is:YI;function _i(r,o){if(gn(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var a=Object.keys(r),d=Object.keys(o);if(a.length!==d.length)return!1;for(d=0;d<a.length;d++){var g=a[d];if(!f.call(o,g)||!gn(r[g],o[g]))return!1}return!0}function nE(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function rE(r,o){var a=nE(r);r=0;for(var d;a;){if(a.nodeType===3){if(d=r+a.textContent.length,r<=o&&d>=o)return{node:a,offset:o-r};r=d}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=nE(a)}}function oE(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?oE(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function sE(){for(var r=window,o=wt();o instanceof r.HTMLIFrameElement;){try{var a=typeof o.contentWindow.location.href=="string"}catch{a=!1}if(a)r=o.contentWindow;else break;o=wt(r.document)}return o}function Cd(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}function KI(r){var o=sE(),a=r.focusedElem,d=r.selectionRange;if(o!==a&&a&&a.ownerDocument&&oE(a.ownerDocument.documentElement,a)){if(d!==null&&Cd(a)){if(o=d.start,r=d.end,r===void 0&&(r=o),"selectionStart"in a)a.selectionStart=o,a.selectionEnd=Math.min(r,a.value.length);else if(r=(o=a.ownerDocument||document)&&o.defaultView||window,r.getSelection){r=r.getSelection();var g=a.textContent.length,v=Math.min(d.start,g);d=d.end===void 0?v:Math.min(d.end,g),!r.extend&&v>d&&(g=d,d=v,v=g),g=rE(a,v);var T=rE(a,d);g&&T&&(r.rangeCount!==1||r.anchorNode!==g.node||r.anchorOffset!==g.offset||r.focusNode!==T.node||r.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),r.removeAllRanges(),v>d?(r.addRange(o),r.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),r.addRange(o)))}}for(o=[],r=a;r=r.parentNode;)r.nodeType===1&&o.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof a.focus=="function"&&a.focus(),a=0;a<o.length;a++)r=o[a],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var XI=u&&"documentMode"in document&&11>=document.documentMode,es=null,Ad=null,wi=null,Id=!1;function iE(r,o,a){var d=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Id||es==null||es!==wt(d)||(d=es,"selectionStart"in d&&Cd(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),wi&&_i(wi,d)||(wi=d,d=va(Ad,"onSelect"),0<d.length&&(o=new xd("onSelect","select",null,o,a),r.push({event:o,listeners:d}),o.target=es)))}function ga(r,o){var a={};return a[r.toLowerCase()]=o.toLowerCase(),a["Webkit"+r]="webkit"+o,a["Moz"+r]="moz"+o,a}var ts={animationend:ga("Animation","AnimationEnd"),animationiteration:ga("Animation","AnimationIteration"),animationstart:ga("Animation","AnimationStart"),transitionend:ga("Transition","TransitionEnd")},bd={},lE={};u&&(lE=document.createElement("div").style,"AnimationEvent"in window||(delete ts.animationend.animation,delete ts.animationiteration.animation,delete ts.animationstart.animation),"TransitionEvent"in window||delete ts.transitionend.transition);function ya(r){if(bd[r])return bd[r];if(!ts[r])return r;var o=ts[r],a;for(a in o)if(o.hasOwnProperty(a)&&a in lE)return bd[r]=o[a];return r}var aE=ya("animationend"),cE=ya("animationiteration"),uE=ya("animationstart"),dE=ya("transitionend"),fE=new Map,pE="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Nr(r,o){fE.set(r,o),l(o,[r])}for(var Ld=0;Ld<pE.length;Ld++){var Dd=pE[Ld],QI=Dd.toLowerCase(),qI=Dd[0].toUpperCase()+Dd.slice(1);Nr(QI,"on"+qI)}Nr(aE,"onAnimationEnd"),Nr(cE,"onAnimationIteration"),Nr(uE,"onAnimationStart"),Nr("dblclick","onDoubleClick"),Nr("focusin","onFocus"),Nr("focusout","onBlur"),Nr(dE,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ni="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(" "),JI=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ni));function hE(r,o,a){var d=r.type||"unknown-event";r.currentTarget=a,ad(d,o,void 0,r),r.currentTarget=null}function mE(r,o){o=(o&4)!==0;for(var a=0;a<r.length;a++){var d=r[a],g=d.event;d=d.listeners;e:{var v=void 0;if(o)for(var T=d.length-1;0<=T;T--){var j=d[T],W=j.instance,te=j.currentTarget;if(j=j.listener,W!==v&&g.isPropagationStopped())break e;hE(g,j,te),v=W}else for(T=0;T<d.length;T++){if(j=d[T],W=j.instance,te=j.currentTarget,j=j.listener,W!==v&&g.isPropagationStopped())break e;hE(g,j,te),v=W}}}if(no)throw r=ii,no=!1,ii=null,r}function Fe(r,o){var a=o[$d];a===void 0&&(a=o[$d]=new Set);var d=r+"__bubble";a.has(d)||(gE(o,r,2,!1),a.add(d))}function kd(r,o,a){var d=0;o&&(d|=4),gE(a,r,d,o)}var Ea="_reactListening"+Math.random().toString(36).slice(2);function Ri(r){if(!r[Ea]){r[Ea]=!0,s.forEach(function(a){a!=="selectionchange"&&(JI.has(a)||kd(a,!1,r),kd(a,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Ea]||(o[Ea]=!0,kd("selectionchange",!1,o))}}function gE(r,o,a,d){switch(Fy(o)){case 1:var g=fI;break;case 4:g=pI;break;default:g=yd}a=g.bind(null,o,a,r),g=void 0,!si||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(o,a,{capture:!0,passive:g}):r.addEventListener(o,a,!0):g!==void 0?r.addEventListener(o,a,{passive:g}):r.addEventListener(o,a,!1)}function Pd(r,o,a,d,g){var v=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var T=d.tag;if(T===3||T===4){var j=d.stateNode.containerInfo;if(j===g||j.nodeType===8&&j.parentNode===g)break;if(T===4)for(T=d.return;T!==null;){var W=T.tag;if((W===3||W===4)&&(W=T.stateNode.containerInfo,W===g||W.nodeType===8&&W.parentNode===g))return;T=T.return}for(;j!==null;){if(T=ro(j),T===null)return;if(W=T.tag,W===5||W===6){d=v=T;continue e}j=j.parentNode}}d=d.return}Xl(function(){var te=v,ie=Xn(a),ae=[];e:{var se=fE.get(r);if(se!==void 0){var pe=xd,ge=r;switch(r){case"keypress":if(fa(a)===0)break e;case"keydown":case"keyup":pe=CI;break;case"focusin":ge="focus",pe=wd;break;case"focusout":ge="blur",pe=wd;break;case"beforeblur":case"afterblur":pe=wd;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":pe=Hy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=gI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=bI;break;case aE:case cE:case uE:pe=vI;break;case dE:pe=DI;break;case"scroll":pe=hI;break;case"wheel":pe=PI;break;case"copy":case"cut":case"paste":pe=SI;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=zy}var ye=(o&4)!==0,et=!ye&&r==="scroll",J=ye?se!==null?se+"Capture":null:se;ye=[];for(var K=te,Z;K!==null;){Z=K;var ce=Z.stateNode;if(Z.tag===5&&ce!==null&&(Z=ce,J!==null&&(ce=Zr(K,J),ce!=null&&ye.push(Ti(K,ce,Z)))),et)break;K=K.return}0<ye.length&&(se=new pe(se,ge,null,a,ie),ae.push({event:se,listeners:ye}))}}if((o&7)===0){e:{if(se=r==="mouseover"||r==="pointerover",pe=r==="mouseout"||r==="pointerout",se&&a!==qr&&(ge=a.relatedTarget||a.fromElement)&&(ro(ge)||ge[Jn]))break e;if((pe||se)&&(se=ie.window===ie?ie:(se=ie.ownerDocument)?se.defaultView||se.parentWindow:window,pe?(ge=a.relatedTarget||a.toElement,pe=te,ge=ge?ro(ge):null,ge!==null&&(et=qn(ge),ge!==et||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(pe=null,ge=te),pe!==ge)){if(ye=Hy,ce="onMouseLeave",J="onMouseEnter",K="mouse",(r==="pointerout"||r==="pointerover")&&(ye=zy,ce="onPointerLeave",J="onPointerEnter",K="pointer"),et=pe==null?se:os(pe),Z=ge==null?se:os(ge),se=new ye(ce,K+"leave",pe,a,ie),se.target=et,se.relatedTarget=Z,ce=null,ro(ie)===te&&(ye=new ye(J,K+"enter",ge,a,ie),ye.target=Z,ye.relatedTarget=et,ce=ye),et=ce,pe&&ge)t:{for(ye=pe,J=ge,K=0,Z=ye;Z;Z=ns(Z))K++;for(Z=0,ce=J;ce;ce=ns(ce))Z++;for(;0<K-Z;)ye=ns(ye),K--;for(;0<Z-K;)J=ns(J),Z--;for(;K--;){if(ye===J||J!==null&&ye===J.alternate)break t;ye=ns(ye),J=ns(J)}ye=null}else ye=null;pe!==null&&yE(ae,se,pe,ye,!1),ge!==null&&et!==null&&yE(ae,et,ge,ye,!0)}}e:{if(se=te?os(te):window,pe=se.nodeName&&se.nodeName.toLowerCase(),pe==="select"||pe==="input"&&se.type==="file")var ve=HI;else if(Qy(se))if(Jy)ve=GI;else{ve=zI;var Se=BI}else(pe=se.nodeName)&&pe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(ve=WI);if(ve&&(ve=ve(r,te))){qy(ae,ve,a,ie);break e}Se&&Se(r,se,te),r==="focusout"&&(Se=se._wrapperState)&&Se.controlled&&se.type==="number"&&un(se,"number",se.value)}switch(Se=te?os(te):window,r){case"focusin":(Qy(Se)||Se.contentEditable==="true")&&(es=Se,Ad=te,wi=null);break;case"focusout":wi=Ad=es=null;break;case"mousedown":Id=!0;break;case"contextmenu":case"mouseup":case"dragend":Id=!1,iE(ae,a,ie);break;case"selectionchange":if(XI)break;case"keydown":case"keyup":iE(ae,a,ie)}var _e;if(Rd)e:{switch(r){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Zo?Ky(r,a)&&(Ne="onCompositionEnd"):r==="keydown"&&a.keyCode===229&&(Ne="onCompositionStart");Ne&&(Wy&&a.locale!=="ko"&&(Zo||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Zo&&(_e=Vy()):(wr=ie,vd="value"in wr?wr.value:wr.textContent,Zo=!0)),Se=va(te,Ne),0<Se.length&&(Ne=new By(Ne,r,null,a,ie),ae.push({event:Ne,listeners:Se}),_e?Ne.data=_e:(_e=Xy(a),_e!==null&&(Ne.data=_e)))),(_e=jI?UI(r,a):FI(r,a))&&(te=va(te,"onBeforeInput"),0<te.length&&(ie=new By("onBeforeInput","beforeinput",null,a,ie),ae.push({event:ie,listeners:te}),ie.data=_e))}mE(ae,o)})}function Ti(r,o,a){return{instance:r,listener:o,currentTarget:a}}function va(r,o){for(var a=o+"Capture",d=[];r!==null;){var g=r,v=g.stateNode;g.tag===5&&v!==null&&(g=v,v=Zr(r,a),v!=null&&d.unshift(Ti(r,v,g)),v=Zr(r,o),v!=null&&d.push(Ti(r,v,g))),r=r.return}return d}function ns(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function yE(r,o,a,d,g){for(var v=o._reactName,T=[];a!==null&&a!==d;){var j=a,W=j.alternate,te=j.stateNode;if(W!==null&&W===d)break;j.tag===5&&te!==null&&(j=te,g?(W=Zr(a,v),W!=null&&T.unshift(Ti(a,W,j))):g||(W=Zr(a,v),W!=null&&T.push(Ti(a,W,j)))),a=a.return}T.length!==0&&r.push({event:o,listeners:T})}var ZI=/\r\n?/g,eb=/\u0000|\uFFFD/g;function EE(r){return(typeof r=="string"?r:""+r).replace(ZI,`
42
- `).replace(eb,"")}function xa(r,o,a){if(o=EE(o),EE(r)!==o&&a)throw Error(n(425))}function Sa(){}var Md=null,jd=null;function Ud(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Fd=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,vE=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof vE<"u"?function(r){return vE.resolve(null).then(r).catch(rb)}:Fd;function rb(r){setTimeout(function(){throw r})}function Vd(r,o){var a=o,d=0;do{var g=a.nextSibling;if(r.removeChild(a),g&&g.nodeType===8)if(a=g.data,a==="/$"){if(d===0){r.removeChild(g),gi(o);return}d--}else a!=="$"&&a!=="$?"&&a!=="$!"||d++;a=g}while(a);gi(o)}function Rr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return r}function xE(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var a=r.data;if(a==="$"||a==="$!"||a==="$?"){if(o===0)return r;o--}else a==="/$"&&o++}r=r.previousSibling}return null}var rs=Math.random().toString(36).slice(2),kn="__reactFiber$"+rs,Oi="__reactProps$"+rs,Jn="__reactContainer$"+rs,$d="__reactEvents$"+rs,ob="__reactListeners$"+rs,sb="__reactHandles$"+rs;function ro(r){var o=r[kn];if(o)return o;for(var a=r.parentNode;a;){if(o=a[Jn]||a[kn]){if(a=o.alternate,o.child!==null||a!==null&&a.child!==null)for(r=xE(r);r!==null;){if(a=r[kn])return a;r=xE(r)}return o}r=a,a=r.parentNode}return null}function Ci(r){return r=r[kn]||r[Jn],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function os(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function _a(r){return r[Oi]||null}var Hd=[],ss=-1;function Tr(r){return{current:r}}function Ve(r){0>ss||(r.current=Hd[ss],Hd[ss]=null,ss--)}function Ue(r,o){ss++,Hd[ss]=r.current,r.current=o}var Or={},yt=Tr(Or),kt=Tr(!1),oo=Or;function is(r,o){var a=r.type.contextTypes;if(!a)return Or;var d=r.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===o)return d.__reactInternalMemoizedMaskedChildContext;var g={},v;for(v in a)g[v]=o[v];return d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=o,r.__reactInternalMemoizedMaskedChildContext=g),g}function Pt(r){return r=r.childContextTypes,r!=null}function wa(){Ve(kt),Ve(yt)}function SE(r,o,a){if(yt.current!==Or)throw Error(n(168));Ue(yt,o),Ue(kt,a)}function _E(r,o,a){var d=r.stateNode;if(o=o.childContextTypes,typeof d.getChildContext!="function")return a;d=d.getChildContext();for(var g in d)if(!(g in o))throw Error(n(108,fe(r)||"Unknown",g));return B({},a,d)}function Na(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Or,oo=yt.current,Ue(yt,r),Ue(kt,kt.current),!0}function wE(r,o,a){var d=r.stateNode;if(!d)throw Error(n(169));a?(r=_E(r,o,oo),d.__reactInternalMemoizedMergedChildContext=r,Ve(kt),Ve(yt),Ue(yt,r)):Ve(kt),Ue(kt,a)}var Zn=null,Ra=!1,Bd=!1;function NE(r){Zn===null?Zn=[r]:Zn.push(r)}function ib(r){Ra=!0,NE(r)}function Cr(){if(!Bd&&Zn!==null){Bd=!0;var r=0,o=ke;try{var a=Zn;for(ke=1;r<a.length;r++){var d=a[r];do d=d(!0);while(d!==null)}Zn=null,Ra=!1}catch(g){throw Zn!==null&&(Zn=Zn.slice(r+1)),Zl(ai,Cr),g}finally{ke=o,Bd=!1}}return null}var ls=[],as=0,Ta=null,Oa=0,Jt=[],Zt=0,so=null,er=1,tr="";function io(r,o){ls[as++]=Oa,ls[as++]=Ta,Ta=r,Oa=o}function RE(r,o,a){Jt[Zt++]=er,Jt[Zt++]=tr,Jt[Zt++]=so,so=r;var d=er;r=tr;var g=32-mn(d)-1;d&=~(1<<g),a+=1;var v=32-mn(o)+g;if(30<v){var T=g-g%5;v=(d&(1<<T)-1).toString(32),d>>=T,g-=T,er=1<<32-mn(o)+g|a<<g|d,tr=v+r}else er=1<<v|a<<g|d,tr=r}function zd(r){r.return!==null&&(io(r,1),RE(r,1,0))}function Wd(r){for(;r===Ta;)Ta=ls[--as],ls[as]=null,Oa=ls[--as],ls[as]=null;for(;r===so;)so=Jt[--Zt],Jt[Zt]=null,tr=Jt[--Zt],Jt[Zt]=null,er=Jt[--Zt],Jt[Zt]=null}var Wt=null,Gt=null,ze=!1,yn=null;function TE(r,o){var a=rn(5,null,null,0);a.elementType="DELETED",a.stateNode=o,a.return=r,o=r.deletions,o===null?(r.deletions=[a],r.flags|=16):o.push(a)}function OE(r,o){switch(r.tag){case 5:var a=r.type;return o=o.nodeType!==1||a.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(r.stateNode=o,Wt=r,Gt=Rr(o.firstChild),!0):!1;case 6:return o=r.pendingProps===""||o.nodeType!==3?null:o,o!==null?(r.stateNode=o,Wt=r,Gt=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(a=so!==null?{id:er,overflow:tr}:null,r.memoizedState={dehydrated:o,treeContext:a,retryLane:1073741824},a=rn(18,null,null,0),a.stateNode=o,a.return=r,r.child=a,Wt=r,Gt=null,!0):!1;default:return!1}}function Gd(r){return(r.mode&1)!==0&&(r.flags&128)===0}function Yd(r){if(ze){var o=Gt;if(o){var a=o;if(!OE(r,o)){if(Gd(r))throw Error(n(418));o=Rr(a.nextSibling);var d=Wt;o&&OE(r,o)?TE(d,a):(r.flags=r.flags&-4097|2,ze=!1,Wt=r)}}else{if(Gd(r))throw Error(n(418));r.flags=r.flags&-4097|2,ze=!1,Wt=r}}}function CE(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Wt=r}function Ca(r){if(r!==Wt)return!1;if(!ze)return CE(r),ze=!0,!1;var o;if((o=r.tag!==3)&&!(o=r.tag!==5)&&(o=r.type,o=o!=="head"&&o!=="body"&&!Ud(r.type,r.memoizedProps)),o&&(o=Gt)){if(Gd(r))throw AE(),Error(n(418));for(;o;)TE(r,o),o=Rr(o.nextSibling)}if(CE(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,o=0;r;){if(r.nodeType===8){var a=r.data;if(a==="/$"){if(o===0){Gt=Rr(r.nextSibling);break e}o--}else a!=="$"&&a!=="$!"&&a!=="$?"||o++}r=r.nextSibling}Gt=null}}else Gt=Wt?Rr(r.stateNode.nextSibling):null;return!0}function AE(){for(var r=Gt;r;)r=Rr(r.nextSibling)}function cs(){Gt=Wt=null,ze=!1}function Kd(r){yn===null?yn=[r]:yn.push(r)}var lb=C.ReactCurrentBatchConfig;function En(r,o){if(r&&r.defaultProps){o=B({},o),r=r.defaultProps;for(var a in r)o[a]===void 0&&(o[a]=r[a]);return o}return o}var Aa=Tr(null),Ia=null,us=null,Xd=null;function Qd(){Xd=us=Ia=null}function qd(r){var o=Aa.current;Ve(Aa),r._currentValue=o}function Jd(r,o,a){for(;r!==null;){var d=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),r===a)break;r=r.return}}function ds(r,o){Ia=r,Xd=us=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&o)!==0&&(Mt=!0),r.firstContext=null)}function en(r){var o=r._currentValue;if(Xd!==r)if(r={context:r,memoizedValue:o,next:null},us===null){if(Ia===null)throw Error(n(308));us=r,Ia.dependencies={lanes:0,firstContext:r}}else us=us.next=r;return o}var lo=null;function Zd(r){lo===null?lo=[r]:lo.push(r)}function IE(r,o,a,d){var g=o.interleaved;return g===null?(a.next=a,Zd(o)):(a.next=g.next,g.next=a),o.interleaved=a,nr(r,d)}function nr(r,o){r.lanes|=o;var a=r.alternate;for(a!==null&&(a.lanes|=o),a=r,r=r.return;r!==null;)r.childLanes|=o,a=r.alternate,a!==null&&(a.childLanes|=o),a=r,r=r.return;return a.tag===3?a.stateNode:null}var Ar=!1;function ef(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bE(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function rr(r,o){return{eventTime:r,lane:o,tag:0,payload:null,callback:null,next:null}}function Ir(r,o,a){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Ae&2)!==0){var g=d.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),d.pending=o,nr(r,a)}return g=d.interleaved,g===null?(o.next=o,Zd(d)):(o.next=g.next,g.next=o),d.interleaved=o,nr(r,a)}function ba(r,o,a){if(o=o.updateQueue,o!==null&&(o=o.shared,(a&4194240)!==0)){var d=o.lanes;d&=r.pendingLanes,a|=d,o.lanes=a,hd(r,a)}}function LE(r,o){var a=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,a===d)){var g=null,v=null;if(a=a.firstBaseUpdate,a!==null){do{var T={eventTime:a.eventTime,lane:a.lane,tag:a.tag,payload:a.payload,callback:a.callback,next:null};v===null?g=v=T:v=v.next=T,a=a.next}while(a!==null);v===null?g=v=o:v=v.next=o}else g=v=o;a={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:d.shared,effects:d.effects},r.updateQueue=a;return}r=a.lastBaseUpdate,r===null?a.firstBaseUpdate=o:r.next=o,a.lastBaseUpdate=o}function La(r,o,a,d){var g=r.updateQueue;Ar=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,j=g.shared.pending;if(j!==null){g.shared.pending=null;var W=j,te=W.next;W.next=null,T===null?v=te:T.next=te,T=W;var ie=r.alternate;ie!==null&&(ie=ie.updateQueue,j=ie.lastBaseUpdate,j!==T&&(j===null?ie.firstBaseUpdate=te:j.next=te,ie.lastBaseUpdate=W))}if(v!==null){var ae=g.baseState;T=0,ie=te=W=null,j=v;do{var se=j.lane,pe=j.eventTime;if((d&se)===se){ie!==null&&(ie=ie.next={eventTime:pe,lane:0,tag:j.tag,payload:j.payload,callback:j.callback,next:null});e:{var ge=r,ye=j;switch(se=o,pe=a,ye.tag){case 1:if(ge=ye.payload,typeof ge=="function"){ae=ge.call(pe,ae,se);break e}ae=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=ye.payload,se=typeof ge=="function"?ge.call(pe,ae,se):ge,se==null)break e;ae=B({},ae,se);break e;case 2:Ar=!0}}j.callback!==null&&j.lane!==0&&(r.flags|=64,se=g.effects,se===null?g.effects=[j]:se.push(j))}else pe={eventTime:pe,lane:se,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ie===null?(te=ie=pe,W=ae):ie=ie.next=pe,T|=se;if(j=j.next,j===null){if(j=g.shared.pending,j===null)break;se=j,j=se.next,se.next=null,g.lastBaseUpdate=se,g.shared.pending=null}}while(!0);if(ie===null&&(W=ae),g.baseState=W,g.firstBaseUpdate=te,g.lastBaseUpdate=ie,o=g.shared.interleaved,o!==null){g=o;do T|=g.lane,g=g.next;while(g!==o)}else v===null&&(g.shared.lanes=0);uo|=T,r.lanes=T,r.memoizedState=ae}}function DE(r,o,a){if(r=o.effects,o.effects=null,r!==null)for(o=0;o<r.length;o++){var d=r[o],g=d.callback;if(g!==null){if(d.callback=null,d=a,typeof g!="function")throw Error(n(191,g));g.call(d)}}}var kE=new e.Component().refs;function tf(r,o,a,d){o=r.memoizedState,a=a(d,o),a=a==null?o:B({},o,a),r.memoizedState=a,r.lanes===0&&(r.updateQueue.baseState=a)}var Da={isMounted:function(r){return(r=r._reactInternals)?qn(r)===r:!1},enqueueSetState:function(r,o,a){r=r._reactInternals;var d=Rt(),g=kr(r),v=rr(d,g);v.payload=o,a!=null&&(v.callback=a),o=Ir(r,v,g),o!==null&&(Sn(o,r,g,d),ba(o,r,g))},enqueueReplaceState:function(r,o,a){r=r._reactInternals;var d=Rt(),g=kr(r),v=rr(d,g);v.tag=1,v.payload=o,a!=null&&(v.callback=a),o=Ir(r,v,g),o!==null&&(Sn(o,r,g,d),ba(o,r,g))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var a=Rt(),d=kr(r),g=rr(a,d);g.tag=2,o!=null&&(g.callback=o),o=Ir(r,g,d),o!==null&&(Sn(o,r,d,a),ba(o,r,d))}};function PE(r,o,a,d,g,v,T){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,T):o.prototype&&o.prototype.isPureReactComponent?!_i(a,d)||!_i(g,v):!0}function ME(r,o,a){var d=!1,g=Or,v=o.contextType;return typeof v=="object"&&v!==null?v=en(v):(g=Pt(o)?oo:yt.current,d=o.contextTypes,v=(d=d!=null)?is(r,g):Or),o=new o(a,v),r.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Da,r.stateNode=o,o._reactInternals=r,d&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=g,r.__reactInternalMemoizedMaskedChildContext=v),o}function jE(r,o,a,d){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(a,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(a,d),o.state!==r&&Da.enqueueReplaceState(o,o.state,null)}function nf(r,o,a,d){var g=r.stateNode;g.props=a,g.state=r.memoizedState,g.refs=kE,ef(r);var v=o.contextType;typeof v=="object"&&v!==null?g.context=en(v):(v=Pt(o)?oo:yt.current,g.context=is(r,v)),g.state=r.memoizedState,v=o.getDerivedStateFromProps,typeof v=="function"&&(tf(r,o,v,a),g.state=r.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Da.enqueueReplaceState(g,g.state,null),La(r,a,g,d),g.state=r.memoizedState),typeof g.componentDidMount=="function"&&(r.flags|=4194308)}function Ai(r,o,a){if(r=a.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(a._owner){if(a=a._owner,a){if(a.tag!==1)throw Error(n(309));var d=a.stateNode}if(!d)throw Error(n(147,r));var g=d,v=""+r;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===v?o.ref:(o=function(T){var j=g.refs;j===kE&&(j=g.refs={}),T===null?delete j[v]:j[v]=T},o._stringRef=v,o)}if(typeof r!="string")throw Error(n(284));if(!a._owner)throw Error(n(290,r))}return r}function ka(r,o){throw r=Object.prototype.toString.call(o),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r))}function UE(r){var o=r._init;return o(r._payload)}function FE(r){function o(J,K){if(r){var Z=J.deletions;Z===null?(J.deletions=[K],J.flags|=16):Z.push(K)}}function a(J,K){if(!r)return null;for(;K!==null;)o(J,K),K=K.sibling;return null}function d(J,K){for(J=new Map;K!==null;)K.key!==null?J.set(K.key,K):J.set(K.index,K),K=K.sibling;return J}function g(J,K){return J=Mr(J,K),J.index=0,J.sibling=null,J}function v(J,K,Z){return J.index=Z,r?(Z=J.alternate,Z!==null?(Z=Z.index,Z<K?(J.flags|=2,K):Z):(J.flags|=2,K)):(J.flags|=1048576,K)}function T(J){return r&&J.alternate===null&&(J.flags|=2),J}function j(J,K,Z,ce){return K===null||K.tag!==6?(K=Vf(Z,J.mode,ce),K.return=J,K):(K=g(K,Z),K.return=J,K)}function W(J,K,Z,ce){var ve=Z.type;return ve===U?ie(J,K,Z.props.children,ce,Z.key):K!==null&&(K.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===$&&UE(ve)===K.type)?(ce=g(K,Z.props),ce.ref=Ai(J,K,Z),ce.return=J,ce):(ce=Za(Z.type,Z.key,Z.props,null,J.mode,ce),ce.ref=Ai(J,K,Z),ce.return=J,ce)}function te(J,K,Z,ce){return K===null||K.tag!==4||K.stateNode.containerInfo!==Z.containerInfo||K.stateNode.implementation!==Z.implementation?(K=$f(Z,J.mode,ce),K.return=J,K):(K=g(K,Z.children||[]),K.return=J,K)}function ie(J,K,Z,ce,ve){return K===null||K.tag!==7?(K=mo(Z,J.mode,ce,ve),K.return=J,K):(K=g(K,Z),K.return=J,K)}function ae(J,K,Z){if(typeof K=="string"&&K!==""||typeof K=="number")return K=Vf(""+K,J.mode,Z),K.return=J,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case I:return Z=Za(K.type,K.key,K.props,null,J.mode,Z),Z.ref=Ai(J,null,K),Z.return=J,Z;case L:return K=$f(K,J.mode,Z),K.return=J,K;case $:var ce=K._init;return ae(J,ce(K._payload),Z)}if(Bt(K)||V(K))return K=mo(K,J.mode,Z,null),K.return=J,K;ka(J,K)}return null}function se(J,K,Z,ce){var ve=K!==null?K.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number")return ve!==null?null:j(J,K,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case I:return Z.key===ve?W(J,K,Z,ce):null;case L:return Z.key===ve?te(J,K,Z,ce):null;case $:return ve=Z._init,se(J,K,ve(Z._payload),ce)}if(Bt(Z)||V(Z))return ve!==null?null:ie(J,K,Z,ce,null);ka(J,Z)}return null}function pe(J,K,Z,ce,ve){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return J=J.get(Z)||null,j(K,J,""+ce,ve);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case I:return J=J.get(ce.key===null?Z:ce.key)||null,W(K,J,ce,ve);case L:return J=J.get(ce.key===null?Z:ce.key)||null,te(K,J,ce,ve);case $:var Se=ce._init;return pe(J,K,Z,Se(ce._payload),ve)}if(Bt(ce)||V(ce))return J=J.get(Z)||null,ie(K,J,ce,ve,null);ka(K,ce)}return null}function ge(J,K,Z,ce){for(var ve=null,Se=null,_e=K,Ne=K=0,ct=null;_e!==null&&Ne<Z.length;Ne++){_e.index>Ne?(ct=_e,_e=null):ct=_e.sibling;var be=se(J,_e,Z[Ne],ce);if(be===null){_e===null&&(_e=ct);break}r&&_e&&be.alternate===null&&o(J,_e),K=v(be,K,Ne),Se===null?ve=be:Se.sibling=be,Se=be,_e=ct}if(Ne===Z.length)return a(J,_e),ze&&io(J,Ne),ve;if(_e===null){for(;Ne<Z.length;Ne++)_e=ae(J,Z[Ne],ce),_e!==null&&(K=v(_e,K,Ne),Se===null?ve=_e:Se.sibling=_e,Se=_e);return ze&&io(J,Ne),ve}for(_e=d(J,_e);Ne<Z.length;Ne++)ct=pe(_e,J,Ne,Z[Ne],ce),ct!==null&&(r&&ct.alternate!==null&&_e.delete(ct.key===null?Ne:ct.key),K=v(ct,K,Ne),Se===null?ve=ct:Se.sibling=ct,Se=ct);return r&&_e.forEach(function(jr){return o(J,jr)}),ze&&io(J,Ne),ve}function ye(J,K,Z,ce){var ve=V(Z);if(typeof ve!="function")throw Error(n(150));if(Z=ve.call(Z),Z==null)throw Error(n(151));for(var Se=ve=null,_e=K,Ne=K=0,ct=null,be=Z.next();_e!==null&&!be.done;Ne++,be=Z.next()){_e.index>Ne?(ct=_e,_e=null):ct=_e.sibling;var jr=se(J,_e,be.value,ce);if(jr===null){_e===null&&(_e=ct);break}r&&_e&&jr.alternate===null&&o(J,_e),K=v(jr,K,Ne),Se===null?ve=jr:Se.sibling=jr,Se=jr,_e=ct}if(be.done)return a(J,_e),ze&&io(J,Ne),ve;if(_e===null){for(;!be.done;Ne++,be=Z.next())be=ae(J,be.value,ce),be!==null&&(K=v(be,K,Ne),Se===null?ve=be:Se.sibling=be,Se=be);return ze&&io(J,Ne),ve}for(_e=d(J,_e);!be.done;Ne++,be=Z.next())be=pe(_e,J,Ne,be.value,ce),be!==null&&(r&&be.alternate!==null&&_e.delete(be.key===null?Ne:be.key),K=v(be,K,Ne),Se===null?ve=be:Se.sibling=be,Se=be);return r&&_e.forEach(function(Vb){return o(J,Vb)}),ze&&io(J,Ne),ve}function et(J,K,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===U&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case I:e:{for(var ve=Z.key,Se=K;Se!==null;){if(Se.key===ve){if(ve=Z.type,ve===U){if(Se.tag===7){a(J,Se.sibling),K=g(Se,Z.props.children),K.return=J,J=K;break e}}else if(Se.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===$&&UE(ve)===Se.type){a(J,Se.sibling),K=g(Se,Z.props),K.ref=Ai(J,Se,Z),K.return=J,J=K;break e}a(J,Se);break}else o(J,Se);Se=Se.sibling}Z.type===U?(K=mo(Z.props.children,J.mode,ce,Z.key),K.return=J,J=K):(ce=Za(Z.type,Z.key,Z.props,null,J.mode,ce),ce.ref=Ai(J,K,Z),ce.return=J,J=ce)}return T(J);case L:e:{for(Se=Z.key;K!==null;){if(K.key===Se)if(K.tag===4&&K.stateNode.containerInfo===Z.containerInfo&&K.stateNode.implementation===Z.implementation){a(J,K.sibling),K=g(K,Z.children||[]),K.return=J,J=K;break e}else{a(J,K);break}else o(J,K);K=K.sibling}K=$f(Z,J.mode,ce),K.return=J,J=K}return T(J);case $:return Se=Z._init,et(J,K,Se(Z._payload),ce)}if(Bt(Z))return ge(J,K,Z,ce);if(V(Z))return ye(J,K,Z,ce);ka(J,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"?(Z=""+Z,K!==null&&K.tag===6?(a(J,K.sibling),K=g(K,Z),K.return=J,J=K):(a(J,K),K=Vf(Z,J.mode,ce),K.return=J,J=K),T(J)):a(J,K)}return et}var fs=FE(!0),VE=FE(!1),Ii={},Pn=Tr(Ii),bi=Tr(Ii),Li=Tr(Ii);function ao(r){if(r===Ii)throw Error(n(174));return r}function rf(r,o){switch(Ue(Li,o),Ue(bi,r),Ue(Pn,Ii),r=o.nodeType,r){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:pn(null,"");break;default:r=r===8?o.parentNode:o,o=r.namespaceURI||null,r=r.tagName,o=pn(o,r)}Ve(Pn),Ue(Pn,o)}function ps(){Ve(Pn),Ve(bi),Ve(Li)}function $E(r){ao(Li.current);var o=ao(Pn.current),a=pn(o,r.type);o!==a&&(Ue(bi,r),Ue(Pn,a))}function of(r){bi.current===r&&(Ve(Pn),Ve(bi))}var Ge=Tr(0);function Pa(r){for(var o=r;o!==null;){if(o.tag===13){var a=o.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||a.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var sf=[];function lf(){for(var r=0;r<sf.length;r++)sf[r]._workInProgressVersionPrimary=null;sf.length=0}var Ma=C.ReactCurrentDispatcher,af=C.ReactCurrentBatchConfig,co=0,Ye=null,st=null,lt=null,ja=!1,Di=!1,ki=0,ab=0;function Et(){throw Error(n(321))}function cf(r,o){if(o===null)return!1;for(var a=0;a<o.length&&a<r.length;a++)if(!gn(r[a],o[a]))return!1;return!0}function uf(r,o,a,d,g,v){if(co=v,Ye=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ma.current=r===null||r.memoizedState===null?fb:pb,r=a(d,g),Di){v=0;do{if(Di=!1,ki=0,25<=v)throw Error(n(301));v+=1,lt=st=null,o.updateQueue=null,Ma.current=hb,r=a(d,g)}while(Di)}if(Ma.current=Va,o=st!==null&&st.next!==null,co=0,lt=st=Ye=null,ja=!1,o)throw Error(n(300));return r}function df(){var r=ki!==0;return ki=0,r}function Mn(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?Ye.memoizedState=lt=r:lt=lt.next=r,lt}function tn(){if(st===null){var r=Ye.alternate;r=r!==null?r.memoizedState:null}else r=st.next;var o=lt===null?Ye.memoizedState:lt.next;if(o!==null)lt=o,st=r;else{if(r===null)throw Error(n(310));st=r,r={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},lt===null?Ye.memoizedState=lt=r:lt=lt.next=r}return lt}function Pi(r,o){return typeof o=="function"?o(r):o}function ff(r){var o=tn(),a=o.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var d=st,g=d.baseQueue,v=a.pending;if(v!==null){if(g!==null){var T=g.next;g.next=v.next,v.next=T}d.baseQueue=g=v,a.pending=null}if(g!==null){v=g.next,d=d.baseState;var j=T=null,W=null,te=v;do{var ie=te.lane;if((co&ie)===ie)W!==null&&(W=W.next={lane:0,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),d=te.hasEagerState?te.eagerState:r(d,te.action);else{var ae={lane:ie,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null};W===null?(j=W=ae,T=d):W=W.next=ae,Ye.lanes|=ie,uo|=ie}te=te.next}while(te!==null&&te!==v);W===null?T=d:W.next=j,gn(d,o.memoizedState)||(Mt=!0),o.memoizedState=d,o.baseState=T,o.baseQueue=W,a.lastRenderedState=d}if(r=a.interleaved,r!==null){g=r;do v=g.lane,Ye.lanes|=v,uo|=v,g=g.next;while(g!==r)}else g===null&&(a.lanes=0);return[o.memoizedState,a.dispatch]}function pf(r){var o=tn(),a=o.queue;if(a===null)throw Error(n(311));a.lastRenderedReducer=r;var d=a.dispatch,g=a.pending,v=o.memoizedState;if(g!==null){a.pending=null;var T=g=g.next;do v=r(v,T.action),T=T.next;while(T!==g);gn(v,o.memoizedState)||(Mt=!0),o.memoizedState=v,o.baseQueue===null&&(o.baseState=v),a.lastRenderedState=v}return[v,d]}function HE(){}function BE(r,o){var a=Ye,d=tn(),g=o(),v=!gn(d.memoizedState,g);if(v&&(d.memoizedState=g,Mt=!0),d=d.queue,hf(GE.bind(null,a,d,r),[r]),d.getSnapshot!==o||v||lt!==null&&lt.memoizedState.tag&1){if(a.flags|=2048,Mi(9,WE.bind(null,a,d,g,o),void 0,null),at===null)throw Error(n(349));(co&30)!==0||zE(a,o,g)}return g}function zE(r,o,a){r.flags|=16384,r={getSnapshot:o,value:a},o=Ye.updateQueue,o===null?(o={lastEffect:null,stores:null},Ye.updateQueue=o,o.stores=[r]):(a=o.stores,a===null?o.stores=[r]:a.push(r))}function WE(r,o,a,d){o.value=a,o.getSnapshot=d,YE(o)&&KE(r)}function GE(r,o,a){return a(function(){YE(o)&&KE(r)})}function YE(r){var o=r.getSnapshot;r=r.value;try{var a=o();return!gn(r,a)}catch{return!0}}function KE(r){var o=nr(r,1);o!==null&&Sn(o,r,1,-1)}function XE(r){var o=Mn();return typeof r=="function"&&(r=r()),o.memoizedState=o.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:r},o.queue=r,r=r.dispatch=db.bind(null,Ye,r),[o.memoizedState,r]}function Mi(r,o,a,d){return r={tag:r,create:o,destroy:a,deps:d,next:null},o=Ye.updateQueue,o===null?(o={lastEffect:null,stores:null},Ye.updateQueue=o,o.lastEffect=r.next=r):(a=o.lastEffect,a===null?o.lastEffect=r.next=r:(d=a.next,a.next=r,r.next=d,o.lastEffect=r)),r}function QE(){return tn().memoizedState}function Ua(r,o,a,d){var g=Mn();Ye.flags|=r,g.memoizedState=Mi(1|o,a,void 0,d===void 0?null:d)}function Fa(r,o,a,d){var g=tn();d=d===void 0?null:d;var v=void 0;if(st!==null){var T=st.memoizedState;if(v=T.destroy,d!==null&&cf(d,T.deps)){g.memoizedState=Mi(o,a,v,d);return}}Ye.flags|=r,g.memoizedState=Mi(1|o,a,v,d)}function qE(r,o){return Ua(8390656,8,r,o)}function hf(r,o){return Fa(2048,8,r,o)}function JE(r,o){return Fa(4,2,r,o)}function ZE(r,o){return Fa(4,4,r,o)}function e0(r,o){if(typeof o=="function")return r=r(),o(r),function(){o(null)};if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function t0(r,o,a){return a=a!=null?a.concat([r]):null,Fa(4,4,e0.bind(null,o,r),a)}function mf(){}function n0(r,o){var a=tn();o=o===void 0?null:o;var d=a.memoizedState;return d!==null&&o!==null&&cf(o,d[1])?d[0]:(a.memoizedState=[r,o],r)}function r0(r,o){var a=tn();o=o===void 0?null:o;var d=a.memoizedState;return d!==null&&o!==null&&cf(o,d[1])?d[0]:(r=r(),a.memoizedState=[r,o],r)}function o0(r,o,a){return(co&21)===0?(r.baseState&&(r.baseState=!1,Mt=!0),r.memoizedState=a):(gn(a,o)||(a=Iy(),Ye.lanes|=a,uo|=a,r.baseState=!0),o)}function cb(r,o){var a=ke;ke=a!==0&&4>a?a:4,r(!0);var d=af.transition;af.transition={};try{r(!1),o()}finally{ke=a,af.transition=d}}function s0(){return tn().memoizedState}function ub(r,o,a){var d=kr(r);if(a={lane:d,action:a,hasEagerState:!1,eagerState:null,next:null},i0(r))l0(o,a);else if(a=IE(r,o,a,d),a!==null){var g=Rt();Sn(a,r,d,g),a0(a,o,d)}}function db(r,o,a){var d=kr(r),g={lane:d,action:a,hasEagerState:!1,eagerState:null,next:null};if(i0(r))l0(o,g);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=o.lastRenderedReducer,v!==null))try{var T=o.lastRenderedState,j=v(T,a);if(g.hasEagerState=!0,g.eagerState=j,gn(j,T)){var W=o.interleaved;W===null?(g.next=g,Zd(o)):(g.next=W.next,W.next=g),o.interleaved=g;return}}catch{}finally{}a=IE(r,o,g,d),a!==null&&(g=Rt(),Sn(a,r,d,g),a0(a,o,d))}}function i0(r){var o=r.alternate;return r===Ye||o!==null&&o===Ye}function l0(r,o){Di=ja=!0;var a=r.pending;a===null?o.next=o:(o.next=a.next,a.next=o),r.pending=o}function a0(r,o,a){if((a&4194240)!==0){var d=o.lanes;d&=r.pendingLanes,a|=d,o.lanes=a,hd(r,a)}}var Va={readContext:en,useCallback:Et,useContext:Et,useEffect:Et,useImperativeHandle:Et,useInsertionEffect:Et,useLayoutEffect:Et,useMemo:Et,useReducer:Et,useRef:Et,useState:Et,useDebugValue:Et,useDeferredValue:Et,useTransition:Et,useMutableSource:Et,useSyncExternalStore:Et,useId:Et,unstable_isNewReconciler:!1},fb={readContext:en,useCallback:function(r,o){return Mn().memoizedState=[r,o===void 0?null:o],r},useContext:en,useEffect:qE,useImperativeHandle:function(r,o,a){return a=a!=null?a.concat([r]):null,Ua(4194308,4,e0.bind(null,o,r),a)},useLayoutEffect:function(r,o){return Ua(4194308,4,r,o)},useInsertionEffect:function(r,o){return Ua(4,2,r,o)},useMemo:function(r,o){var a=Mn();return o=o===void 0?null:o,r=r(),a.memoizedState=[r,o],r},useReducer:function(r,o,a){var d=Mn();return o=a!==void 0?a(o):o,d.memoizedState=d.baseState=o,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:o},d.queue=r,r=r.dispatch=ub.bind(null,Ye,r),[d.memoizedState,r]},useRef:function(r){var o=Mn();return r={current:r},o.memoizedState=r},useState:XE,useDebugValue:mf,useDeferredValue:function(r){return Mn().memoizedState=r},useTransition:function(){var r=XE(!1),o=r[0];return r=cb.bind(null,r[1]),Mn().memoizedState=r,[o,r]},useMutableSource:function(){},useSyncExternalStore:function(r,o,a){var d=Ye,g=Mn();if(ze){if(a===void 0)throw Error(n(407));a=a()}else{if(a=o(),at===null)throw Error(n(349));(co&30)!==0||zE(d,o,a)}g.memoizedState=a;var v={value:a,getSnapshot:o};return g.queue=v,qE(GE.bind(null,d,v,r),[r]),d.flags|=2048,Mi(9,WE.bind(null,d,v,a,o),void 0,null),a},useId:function(){var r=Mn(),o=at.identifierPrefix;if(ze){var a=tr,d=er;a=(d&~(1<<32-mn(d)-1)).toString(32)+a,o=":"+o+"R"+a,a=ki++,0<a&&(o+="H"+a.toString(32)),o+=":"}else a=ab++,o=":"+o+"r"+a.toString(32)+":";return r.memoizedState=o},unstable_isNewReconciler:!1},pb={readContext:en,useCallback:n0,useContext:en,useEffect:hf,useImperativeHandle:t0,useInsertionEffect:JE,useLayoutEffect:ZE,useMemo:r0,useReducer:ff,useRef:QE,useState:function(){return ff(Pi)},useDebugValue:mf,useDeferredValue:function(r){var o=tn();return o0(o,st.memoizedState,r)},useTransition:function(){var r=ff(Pi)[0],o=tn().memoizedState;return[r,o]},useMutableSource:HE,useSyncExternalStore:BE,useId:s0,unstable_isNewReconciler:!1},hb={readContext:en,useCallback:n0,useContext:en,useEffect:hf,useImperativeHandle:t0,useInsertionEffect:JE,useLayoutEffect:ZE,useMemo:r0,useReducer:pf,useRef:QE,useState:function(){return pf(Pi)},useDebugValue:mf,useDeferredValue:function(r){var o=tn();return st===null?o.memoizedState=r:o0(o,st.memoizedState,r)},useTransition:function(){var r=pf(Pi)[0],o=tn().memoizedState;return[r,o]},useMutableSource:HE,useSyncExternalStore:BE,useId:s0,unstable_isNewReconciler:!1};function hs(r,o){try{var a="",d=o;do a+=le(d),d=d.return;while(d);var g=a}catch(v){g=`
43
- Error generating stack: `+v.message+`
44
- `+v.stack}return{value:r,source:o,stack:g,digest:null}}function gf(r,o,a){return{value:r,source:null,stack:a??null,digest:o??null}}function yf(r,o){try{console.error(o.value)}catch(a){setTimeout(function(){throw a})}}var mb=typeof WeakMap=="function"?WeakMap:Map;function c0(r,o,a){a=rr(-1,a),a.tag=3,a.payload={element:null};var d=o.value;return a.callback=function(){Ya||(Ya=!0,Lf=d),yf(r,o)},a}function u0(r,o,a){a=rr(-1,a),a.tag=3;var d=r.type.getDerivedStateFromError;if(typeof d=="function"){var g=o.value;a.payload=function(){return d(g)},a.callback=function(){yf(r,o)}}var v=r.stateNode;return v!==null&&typeof v.componentDidCatch=="function"&&(a.callback=function(){yf(r,o),typeof d!="function"&&(Lr===null?Lr=new Set([this]):Lr.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),a}function d0(r,o,a){var d=r.pingCache;if(d===null){d=r.pingCache=new mb;var g=new Set;d.set(o,g)}else g=d.get(o),g===void 0&&(g=new Set,d.set(o,g));g.has(a)||(g.add(a),r=Ab.bind(null,r,o,a),o.then(r,r))}function f0(r){do{var o;if((o=r.tag===13)&&(o=r.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return r;r=r.return}while(r!==null);return null}function p0(r,o,a,d,g){return(r.mode&1)===0?(r===o?r.flags|=65536:(r.flags|=128,a.flags|=131072,a.flags&=-52805,a.tag===1&&(a.alternate===null?a.tag=17:(o=rr(-1,1),o.tag=2,Ir(a,o,1))),a.lanes|=1),r):(r.flags|=65536,r.lanes=g,r)}var gb=C.ReactCurrentOwner,Mt=!1;function Nt(r,o,a,d){o.child=r===null?VE(o,null,a,d):fs(o,r.child,a,d)}function h0(r,o,a,d,g){a=a.render;var v=o.ref;return ds(o,g),d=uf(r,o,a,d,v,g),a=df(),r!==null&&!Mt?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,or(r,o,g)):(ze&&a&&zd(o),o.flags|=1,Nt(r,o,d,g),o.child)}function m0(r,o,a,d,g){if(r===null){var v=a.type;return typeof v=="function"&&!Ff(v)&&v.defaultProps===void 0&&a.compare===null&&a.defaultProps===void 0?(o.tag=15,o.type=v,g0(r,o,v,d,g)):(r=Za(a.type,null,d,o,o.mode,g),r.ref=o.ref,r.return=o,o.child=r)}if(v=r.child,(r.lanes&g)===0){var T=v.memoizedProps;if(a=a.compare,a=a!==null?a:_i,a(T,d)&&r.ref===o.ref)return or(r,o,g)}return o.flags|=1,r=Mr(v,d),r.ref=o.ref,r.return=o,o.child=r}function g0(r,o,a,d,g){if(r!==null){var v=r.memoizedProps;if(_i(v,d)&&r.ref===o.ref)if(Mt=!1,o.pendingProps=d=v,(r.lanes&g)!==0)(r.flags&131072)!==0&&(Mt=!0);else return o.lanes=r.lanes,or(r,o,g)}return Ef(r,o,a,d,g)}function y0(r,o,a){var d=o.pendingProps,g=d.children,v=r!==null?r.memoizedState:null;if(d.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ue(gs,Yt),Yt|=a;else{if((a&1073741824)===0)return r=v!==null?v.baseLanes|a:a,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:r,cachePool:null,transitions:null},o.updateQueue=null,Ue(gs,Yt),Yt|=r,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=v!==null?v.baseLanes:a,Ue(gs,Yt),Yt|=d}else v!==null?(d=v.baseLanes|a,o.memoizedState=null):d=a,Ue(gs,Yt),Yt|=d;return Nt(r,o,g,a),o.child}function E0(r,o){var a=o.ref;(r===null&&a!==null||r!==null&&r.ref!==a)&&(o.flags|=512,o.flags|=2097152)}function Ef(r,o,a,d,g){var v=Pt(a)?oo:yt.current;return v=is(o,v),ds(o,g),a=uf(r,o,a,d,v,g),d=df(),r!==null&&!Mt?(o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~g,or(r,o,g)):(ze&&d&&zd(o),o.flags|=1,Nt(r,o,a,g),o.child)}function v0(r,o,a,d,g){if(Pt(a)){var v=!0;Na(o)}else v=!1;if(ds(o,g),o.stateNode===null)Ha(r,o),ME(o,a,d),nf(o,a,d,g),d=!0;else if(r===null){var T=o.stateNode,j=o.memoizedProps;T.props=j;var W=T.context,te=a.contextType;typeof te=="object"&&te!==null?te=en(te):(te=Pt(a)?oo:yt.current,te=is(o,te));var ie=a.getDerivedStateFromProps,ae=typeof ie=="function"||typeof T.getSnapshotBeforeUpdate=="function";ae||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(j!==d||W!==te)&&jE(o,T,d,te),Ar=!1;var se=o.memoizedState;T.state=se,La(o,d,T,g),W=o.memoizedState,j!==d||se!==W||kt.current||Ar?(typeof ie=="function"&&(tf(o,a,ie,d),W=o.memoizedState),(j=Ar||PE(o,a,j,d,se,W,te))?(ae||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=W),T.props=d,T.state=W,T.context=te,d=j):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{T=o.stateNode,bE(r,o),j=o.memoizedProps,te=o.type===o.elementType?j:En(o.type,j),T.props=te,ae=o.pendingProps,se=T.context,W=a.contextType,typeof W=="object"&&W!==null?W=en(W):(W=Pt(a)?oo:yt.current,W=is(o,W));var pe=a.getDerivedStateFromProps;(ie=typeof pe=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(j!==ae||se!==W)&&jE(o,T,d,W),Ar=!1,se=o.memoizedState,T.state=se,La(o,d,T,g);var ge=o.memoizedState;j!==ae||se!==ge||kt.current||Ar?(typeof pe=="function"&&(tf(o,a,pe,d),ge=o.memoizedState),(te=Ar||PE(o,a,te,d,se,ge,W)||!1)?(ie||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(d,ge,W),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(d,ge,W)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||j===r.memoizedProps&&se===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&se===r.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=ge),T.props=d,T.state=ge,T.context=W,d=te):(typeof T.componentDidUpdate!="function"||j===r.memoizedProps&&se===r.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||j===r.memoizedProps&&se===r.memoizedState||(o.flags|=1024),d=!1)}return vf(r,o,a,d,v,g)}function vf(r,o,a,d,g,v){E0(r,o);var T=(o.flags&128)!==0;if(!d&&!T)return g&&wE(o,a,!1),or(r,o,v);d=o.stateNode,gb.current=o;var j=T&&typeof a.getDerivedStateFromError!="function"?null:d.render();return o.flags|=1,r!==null&&T?(o.child=fs(o,r.child,null,v),o.child=fs(o,null,j,v)):Nt(r,o,j,v),o.memoizedState=d.state,g&&wE(o,a,!0),o.child}function x0(r){var o=r.stateNode;o.pendingContext?SE(r,o.pendingContext,o.pendingContext!==o.context):o.context&&SE(r,o.context,!1),rf(r,o.containerInfo)}function S0(r,o,a,d,g){return cs(),Kd(g),o.flags|=256,Nt(r,o,a,d),o.child}var xf={dehydrated:null,treeContext:null,retryLane:0};function Sf(r){return{baseLanes:r,cachePool:null,transitions:null}}function _0(r,o,a){var d=o.pendingProps,g=Ge.current,v=!1,T=(o.flags&128)!==0,j;if((j=T)||(j=r!==null&&r.memoizedState===null?!1:(g&2)!==0),j?(v=!0,o.flags&=-129):(r===null||r.memoizedState!==null)&&(g|=1),Ue(Ge,g&1),r===null)return Yd(o),r=o.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((o.mode&1)===0?o.lanes=1:r.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=d.children,r=d.fallback,v?(d=o.mode,v=o.child,T={mode:"hidden",children:T},(d&1)===0&&v!==null?(v.childLanes=0,v.pendingProps=T):v=ec(T,d,0,null),r=mo(r,d,a,null),v.return=o,r.return=o,v.sibling=r,o.child=v,o.child.memoizedState=Sf(a),o.memoizedState=xf,r):_f(o,T));if(g=r.memoizedState,g!==null&&(j=g.dehydrated,j!==null))return yb(r,o,T,d,j,g,a);if(v){v=d.fallback,T=o.mode,g=r.child,j=g.sibling;var W={mode:"hidden",children:d.children};return(T&1)===0&&o.child!==g?(d=o.child,d.childLanes=0,d.pendingProps=W,o.deletions=null):(d=Mr(g,W),d.subtreeFlags=g.subtreeFlags&14680064),j!==null?v=Mr(j,v):(v=mo(v,T,a,null),v.flags|=2),v.return=o,d.return=o,d.sibling=v,o.child=d,d=v,v=o.child,T=r.child.memoizedState,T=T===null?Sf(a):{baseLanes:T.baseLanes|a,cachePool:null,transitions:T.transitions},v.memoizedState=T,v.childLanes=r.childLanes&~a,o.memoizedState=xf,d}return v=r.child,r=v.sibling,d=Mr(v,{mode:"visible",children:d.children}),(o.mode&1)===0&&(d.lanes=a),d.return=o,d.sibling=null,r!==null&&(a=o.deletions,a===null?(o.deletions=[r],o.flags|=16):a.push(r)),o.child=d,o.memoizedState=null,d}function _f(r,o){return o=ec({mode:"visible",children:o},r.mode,0,null),o.return=r,r.child=o}function $a(r,o,a,d){return d!==null&&Kd(d),fs(o,r.child,null,a),r=_f(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function yb(r,o,a,d,g,v,T){if(a)return o.flags&256?(o.flags&=-257,d=gf(Error(n(422))),$a(r,o,T,d)):o.memoizedState!==null?(o.child=r.child,o.flags|=128,null):(v=d.fallback,g=o.mode,d=ec({mode:"visible",children:d.children},g,0,null),v=mo(v,g,T,null),v.flags|=2,d.return=o,v.return=o,d.sibling=v,o.child=d,(o.mode&1)!==0&&fs(o,r.child,null,T),o.child.memoizedState=Sf(T),o.memoizedState=xf,v);if((o.mode&1)===0)return $a(r,o,T,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var j=d.dgst;return d=j,v=Error(n(419)),d=gf(v,d,void 0),$a(r,o,T,d)}if(j=(T&r.childLanes)!==0,Mt||j){if(d=at,d!==null){switch(T&-T){case 4:g=2;break;case 16:g=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(d.suspendedLanes|T))!==0?0:g,g!==0&&g!==v.retryLane&&(v.retryLane=g,nr(r,g),Sn(d,r,g,-1))}return Uf(),d=gf(Error(n(421))),$a(r,o,T,d)}return g.data==="$?"?(o.flags|=128,o.child=r.child,o=Ib.bind(null,r),g._reactRetry=o,null):(r=v.treeContext,Gt=Rr(g.nextSibling),Wt=o,ze=!0,yn=null,r!==null&&(Jt[Zt++]=er,Jt[Zt++]=tr,Jt[Zt++]=so,er=r.id,tr=r.overflow,so=o),o=_f(o,d.children),o.flags|=4096,o)}function w0(r,o,a){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o),Jd(r.return,o,a)}function wf(r,o,a,d,g){var v=r.memoizedState;v===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:a,tailMode:g}:(v.isBackwards=o,v.rendering=null,v.renderingStartTime=0,v.last=d,v.tail=a,v.tailMode=g)}function N0(r,o,a){var d=o.pendingProps,g=d.revealOrder,v=d.tail;if(Nt(r,o,d.children,a),d=Ge.current,(d&2)!==0)d=d&1|2,o.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&w0(r,a,o);else if(r.tag===19)w0(r,a,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}d&=1}if(Ue(Ge,d),(o.mode&1)===0)o.memoizedState=null;else switch(g){case"forwards":for(a=o.child,g=null;a!==null;)r=a.alternate,r!==null&&Pa(r)===null&&(g=a),a=a.sibling;a=g,a===null?(g=o.child,o.child=null):(g=a.sibling,a.sibling=null),wf(o,!1,g,a,v);break;case"backwards":for(a=null,g=o.child,o.child=null;g!==null;){if(r=g.alternate,r!==null&&Pa(r)===null){o.child=g;break}r=g.sibling,g.sibling=a,a=g,g=r}wf(o,!0,a,null,v);break;case"together":wf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Ha(r,o){(o.mode&1)===0&&r!==null&&(r.alternate=null,o.alternate=null,o.flags|=2)}function or(r,o,a){if(r!==null&&(o.dependencies=r.dependencies),uo|=o.lanes,(a&o.childLanes)===0)return null;if(r!==null&&o.child!==r.child)throw Error(n(153));if(o.child!==null){for(r=o.child,a=Mr(r,r.pendingProps),o.child=a,a.return=o;r.sibling!==null;)r=r.sibling,a=a.sibling=Mr(r,r.pendingProps),a.return=o;a.sibling=null}return o.child}function Eb(r,o,a){switch(o.tag){case 3:x0(o),cs();break;case 5:$E(o);break;case 1:Pt(o.type)&&Na(o);break;case 4:rf(o,o.stateNode.containerInfo);break;case 10:var d=o.type._context,g=o.memoizedProps.value;Ue(Aa,d._currentValue),d._currentValue=g;break;case 13:if(d=o.memoizedState,d!==null)return d.dehydrated!==null?(Ue(Ge,Ge.current&1),o.flags|=128,null):(a&o.child.childLanes)!==0?_0(r,o,a):(Ue(Ge,Ge.current&1),r=or(r,o,a),r!==null?r.sibling:null);Ue(Ge,Ge.current&1);break;case 19:if(d=(a&o.childLanes)!==0,(r.flags&128)!==0){if(d)return N0(r,o,a);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Ue(Ge,Ge.current),d)break;return null;case 22:case 23:return o.lanes=0,y0(r,o,a)}return or(r,o,a)}var R0,Nf,T0,O0;R0=function(r,o){for(var a=o.child;a!==null;){if(a.tag===5||a.tag===6)r.appendChild(a.stateNode);else if(a.tag!==4&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===o)break;for(;a.sibling===null;){if(a.return===null||a.return===o)return;a=a.return}a.sibling.return=a.return,a=a.sibling}},Nf=function(){},T0=function(r,o,a,d){var g=r.memoizedProps;if(g!==d){r=o.stateNode,ao(Pn.current);var v=null;switch(a){case"input":g=Be(r,g),d=Be(r,d),v=[];break;case"select":g=B({},g,{value:void 0}),d=B({},d,{value:void 0}),v=[];break;case"textarea":g=Cn(r,g),d=Cn(r,d),v=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(r.onclick=Sa)}Lt(a,d);var T;a=null;for(te in g)if(!d.hasOwnProperty(te)&&g.hasOwnProperty(te)&&g[te]!=null)if(te==="style"){var j=g[te];for(T in j)j.hasOwnProperty(T)&&(a||(a={}),a[T]="")}else te!=="dangerouslySetInnerHTML"&&te!=="children"&&te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&te!=="autoFocus"&&(i.hasOwnProperty(te)?v||(v=[]):(v=v||[]).push(te,null));for(te in d){var W=d[te];if(j=g!=null?g[te]:void 0,d.hasOwnProperty(te)&&W!==j&&(W!=null||j!=null))if(te==="style")if(j){for(T in j)!j.hasOwnProperty(T)||W&&W.hasOwnProperty(T)||(a||(a={}),a[T]="");for(T in W)W.hasOwnProperty(T)&&j[T]!==W[T]&&(a||(a={}),a[T]=W[T])}else a||(v||(v=[]),v.push(te,a)),a=W;else te==="dangerouslySetInnerHTML"?(W=W?W.__html:void 0,j=j?j.__html:void 0,W!=null&&j!==W&&(v=v||[]).push(te,W)):te==="children"?typeof W!="string"&&typeof W!="number"||(v=v||[]).push(te,""+W):te!=="suppressContentEditableWarning"&&te!=="suppressHydrationWarning"&&(i.hasOwnProperty(te)?(W!=null&&te==="onScroll"&&Fe("scroll",r),v||j===W||(v=[])):(v=v||[]).push(te,W))}a&&(v=v||[]).push("style",a);var te=v;(o.updateQueue=te)&&(o.flags|=4)}},O0=function(r,o,a,d){a!==d&&(o.flags|=4)};function ji(r,o){if(!ze)switch(r.tailMode){case"hidden":o=r.tail;for(var a=null;o!==null;)o.alternate!==null&&(a=o),o=o.sibling;a===null?r.tail=null:a.sibling=null;break;case"collapsed":a=r.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function vt(r){var o=r.alternate!==null&&r.alternate.child===r.child,a=0,d=0;if(o)for(var g=r.child;g!==null;)a|=g.lanes|g.childLanes,d|=g.subtreeFlags&14680064,d|=g.flags&14680064,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)a|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=d,r.childLanes=a,o}function vb(r,o,a){var d=o.pendingProps;switch(Wd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(o),null;case 1:return Pt(o.type)&&wa(),vt(o),null;case 3:return d=o.stateNode,ps(),Ve(kt),Ve(yt),lf(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(r===null||r.child===null)&&(Ca(o)?o.flags|=4:r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,yn!==null&&(Pf(yn),yn=null))),Nf(r,o),vt(o),null;case 5:of(o);var g=ao(Li.current);if(a=o.type,r!==null&&o.stateNode!=null)T0(r,o,a,d,g),r.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!d){if(o.stateNode===null)throw Error(n(166));return vt(o),null}if(r=ao(Pn.current),Ca(o)){d=o.stateNode,a=o.type;var v=o.memoizedProps;switch(d[kn]=o,d[Oi]=v,r=(o.mode&1)!==0,a){case"dialog":Fe("cancel",d),Fe("close",d);break;case"iframe":case"object":case"embed":Fe("load",d);break;case"video":case"audio":for(g=0;g<Ni.length;g++)Fe(Ni[g],d);break;case"source":Fe("error",d);break;case"img":case"image":case"link":Fe("error",d),Fe("load",d);break;case"details":Fe("toggle",d);break;case"input":je(d,v),Fe("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!v.multiple},Fe("invalid",d);break;case"textarea":An(d,v),Fe("invalid",d)}Lt(a,v),g=null;for(var T in v)if(v.hasOwnProperty(T)){var j=v[T];T==="children"?typeof j=="string"?d.textContent!==j&&(v.suppressHydrationWarning!==!0&&xa(d.textContent,j,r),g=["children",j]):typeof j=="number"&&d.textContent!==""+j&&(v.suppressHydrationWarning!==!0&&xa(d.textContent,j,r),g=["children",""+j]):i.hasOwnProperty(T)&&j!=null&&T==="onScroll"&&Fe("scroll",d)}switch(a){case"input":Me(d),we(d,v,!0);break;case"textarea":Me(d),Wn(d);break;case"select":case"option":break;default:typeof v.onClick=="function"&&(d.onclick=Sa)}d=g,o.updateQueue=d,d!==null&&(o.flags|=4)}else{T=g.nodeType===9?g:g.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=fn(a)),r==="http://www.w3.org/1999/xhtml"?a==="script"?(r=T.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof d.is=="string"?r=T.createElement(a,{is:d.is}):(r=T.createElement(a),a==="select"&&(T=r,d.multiple?T.multiple=!0:d.size&&(T.size=d.size))):r=T.createElementNS(r,a),r[kn]=o,r[Oi]=d,R0(r,o,!1,!1),o.stateNode=r;e:{switch(T=Kn(a,d),a){case"dialog":Fe("cancel",r),Fe("close",r),g=d;break;case"iframe":case"object":case"embed":Fe("load",r),g=d;break;case"video":case"audio":for(g=0;g<Ni.length;g++)Fe(Ni[g],r);g=d;break;case"source":Fe("error",r),g=d;break;case"img":case"image":case"link":Fe("error",r),Fe("load",r),g=d;break;case"details":Fe("toggle",r),g=d;break;case"input":je(r,d),g=Be(r,d),Fe("invalid",r);break;case"option":g=d;break;case"select":r._wrapperState={wasMultiple:!!d.multiple},g=B({},d,{value:void 0}),Fe("invalid",r);break;case"textarea":An(r,d),g=Cn(r,d),Fe("invalid",r);break;default:g=d}Lt(a,g),j=g;for(v in j)if(j.hasOwnProperty(v)){var W=j[v];v==="style"?Ln(r,W):v==="dangerouslySetInnerHTML"?(W=W?W.__html:void 0,W!=null&&Gn(r,W)):v==="children"?typeof W=="string"?(a!=="textarea"||W!=="")&&Ke(r,W):typeof W=="number"&&Ke(r,""+W):v!=="suppressContentEditableWarning"&&v!=="suppressHydrationWarning"&&v!=="autoFocus"&&(i.hasOwnProperty(v)?W!=null&&v==="onScroll"&&Fe("scroll",r):W!=null&&P(r,v,W,T))}switch(a){case"input":Me(r),we(r,d,!1);break;case"textarea":Me(r),Wn(r);break;case"option":d.value!=null&&r.setAttribute("value",""+de(d.value));break;case"select":r.multiple=!!d.multiple,v=d.value,v!=null?qt(r,!!d.multiple,v,!1):d.defaultValue!=null&&qt(r,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(r.onclick=Sa)}switch(a){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return vt(o),null;case 6:if(r&&o.stateNode!=null)O0(r,o,r.memoizedProps,d);else{if(typeof d!="string"&&o.stateNode===null)throw Error(n(166));if(a=ao(Li.current),ao(Pn.current),Ca(o)){if(d=o.stateNode,a=o.memoizedProps,d[kn]=o,(v=d.nodeValue!==a)&&(r=Wt,r!==null))switch(r.tag){case 3:xa(d.nodeValue,a,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&xa(d.nodeValue,a,(r.mode&1)!==0)}v&&(o.flags|=4)}else d=(a.nodeType===9?a:a.ownerDocument).createTextNode(d),d[kn]=o,o.stateNode=d}return vt(o),null;case 13:if(Ve(Ge),d=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(ze&&Gt!==null&&(o.mode&1)!==0&&(o.flags&128)===0)AE(),cs(),o.flags|=98560,v=!1;else if(v=Ca(o),d!==null&&d.dehydrated!==null){if(r===null){if(!v)throw Error(n(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(n(317));v[kn]=o}else cs(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),v=!1}else yn!==null&&(Pf(yn),yn=null),v=!0;if(!v)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=a,o):(d=d!==null,d!==(r!==null&&r.memoizedState!==null)&&d&&(o.child.flags|=8192,(o.mode&1)!==0&&(r===null||(Ge.current&1)!==0?it===0&&(it=3):Uf())),o.updateQueue!==null&&(o.flags|=4),vt(o),null);case 4:return ps(),Nf(r,o),r===null&&Ri(o.stateNode.containerInfo),vt(o),null;case 10:return qd(o.type._context),vt(o),null;case 17:return Pt(o.type)&&wa(),vt(o),null;case 19:if(Ve(Ge),v=o.memoizedState,v===null)return vt(o),null;if(d=(o.flags&128)!==0,T=v.rendering,T===null)if(d)ji(v,!1);else{if(it!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(T=Pa(r),T!==null){for(o.flags|=128,ji(v,!1),d=T.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),o.subtreeFlags=0,d=a,a=o.child;a!==null;)v=a,r=d,v.flags&=14680066,T=v.alternate,T===null?(v.childLanes=0,v.lanes=r,v.child=null,v.subtreeFlags=0,v.memoizedProps=null,v.memoizedState=null,v.updateQueue=null,v.dependencies=null,v.stateNode=null):(v.childLanes=T.childLanes,v.lanes=T.lanes,v.child=T.child,v.subtreeFlags=0,v.deletions=null,v.memoizedProps=T.memoizedProps,v.memoizedState=T.memoizedState,v.updateQueue=T.updateQueue,v.type=T.type,r=T.dependencies,v.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),a=a.sibling;return Ue(Ge,Ge.current&1|2),o.child}r=r.sibling}v.tail!==null&&We()>ys&&(o.flags|=128,d=!0,ji(v,!1),o.lanes=4194304)}else{if(!d)if(r=Pa(T),r!==null){if(o.flags|=128,d=!0,a=r.updateQueue,a!==null&&(o.updateQueue=a,o.flags|=4),ji(v,!0),v.tail===null&&v.tailMode==="hidden"&&!T.alternate&&!ze)return vt(o),null}else 2*We()-v.renderingStartTime>ys&&a!==1073741824&&(o.flags|=128,d=!0,ji(v,!1),o.lanes=4194304);v.isBackwards?(T.sibling=o.child,o.child=T):(a=v.last,a!==null?a.sibling=T:o.child=T,v.last=T)}return v.tail!==null?(o=v.tail,v.rendering=o,v.tail=o.sibling,v.renderingStartTime=We(),o.sibling=null,a=Ge.current,Ue(Ge,d?a&1|2:a&1),o):(vt(o),null);case 22:case 23:return jf(),d=o.memoizedState!==null,r!==null&&r.memoizedState!==null!==d&&(o.flags|=8192),d&&(o.mode&1)!==0?(Yt&1073741824)!==0&&(vt(o),o.subtreeFlags&6&&(o.flags|=8192)):vt(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function xb(r,o){switch(Wd(o),o.tag){case 1:return Pt(o.type)&&wa(),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return ps(),Ve(kt),Ve(yt),lf(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 5:return of(o),null;case 13:if(Ve(Ge),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(n(340));cs()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return Ve(Ge),null;case 4:return ps(),null;case 10:return qd(o.type._context),null;case 22:case 23:return jf(),null;case 24:return null;default:return null}}var Ba=!1,xt=!1,Sb=typeof WeakSet=="function"?WeakSet:Set,he=null;function ms(r,o){var a=r.ref;if(a!==null)if(typeof a=="function")try{a(null)}catch(d){Xe(r,o,d)}else a.current=null}function Rf(r,o,a){try{a()}catch(d){Xe(r,o,d)}}var C0=!1;function _b(r,o){if(Md=ca,r=sE(),Cd(r)){if("selectionStart"in r)var a={start:r.selectionStart,end:r.selectionEnd};else e:{a=(a=r.ownerDocument)&&a.defaultView||window;var d=a.getSelection&&a.getSelection();if(d&&d.rangeCount!==0){a=d.anchorNode;var g=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{a.nodeType,v.nodeType}catch{a=null;break e}var T=0,j=-1,W=-1,te=0,ie=0,ae=r,se=null;t:for(;;){for(var pe;ae!==a||g!==0&&ae.nodeType!==3||(j=T+g),ae!==v||d!==0&&ae.nodeType!==3||(W=T+d),ae.nodeType===3&&(T+=ae.nodeValue.length),(pe=ae.firstChild)!==null;)se=ae,ae=pe;for(;;){if(ae===r)break t;if(se===a&&++te===g&&(j=T),se===v&&++ie===d&&(W=T),(pe=ae.nextSibling)!==null)break;ae=se,se=ae.parentNode}ae=pe}a=j===-1||W===-1?null:{start:j,end:W}}else a=null}a=a||{start:0,end:0}}else a=null;for(jd={focusedElem:r,selectionRange:a},ca=!1,he=o;he!==null;)if(o=he,r=o.child,(o.subtreeFlags&1028)!==0&&r!==null)r.return=o,he=r;else for(;he!==null;){o=he;try{var ge=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var ye=ge.memoizedProps,et=ge.memoizedState,J=o.stateNode,K=J.getSnapshotBeforeUpdate(o.elementType===o.type?ye:En(o.type,ye),et);J.__reactInternalSnapshotBeforeUpdate=K}break;case 3:var Z=o.stateNode.containerInfo;Z.nodeType===1?Z.textContent="":Z.nodeType===9&&Z.documentElement&&Z.removeChild(Z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ce){Xe(o,o.return,ce)}if(r=o.sibling,r!==null){r.return=o.return,he=r;break}he=o.return}return ge=C0,C0=!1,ge}function Ui(r,o,a){var d=o.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&r)===r){var v=g.destroy;g.destroy=void 0,v!==void 0&&Rf(o,a,v)}g=g.next}while(g!==d)}}function za(r,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var a=o=o.next;do{if((a.tag&r)===r){var d=a.create;a.destroy=d()}a=a.next}while(a!==o)}}function Tf(r){var o=r.ref;if(o!==null){var a=r.stateNode;switch(r.tag){case 5:r=a;break;default:r=a}typeof o=="function"?o(r):o.current=r}}function A0(r){var o=r.alternate;o!==null&&(r.alternate=null,A0(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&(delete o[kn],delete o[Oi],delete o[$d],delete o[ob],delete o[sb])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function I0(r){return r.tag===5||r.tag===3||r.tag===4}function b0(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||I0(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Of(r,o,a){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?a.nodeType===8?a.parentNode.insertBefore(r,o):a.insertBefore(r,o):(a.nodeType===8?(o=a.parentNode,o.insertBefore(r,a)):(o=a,o.appendChild(r)),a=a._reactRootContainer,a!=null||o.onclick!==null||(o.onclick=Sa));else if(d!==4&&(r=r.child,r!==null))for(Of(r,o,a),r=r.sibling;r!==null;)Of(r,o,a),r=r.sibling}function Cf(r,o,a){var d=r.tag;if(d===5||d===6)r=r.stateNode,o?a.insertBefore(r,o):a.appendChild(r);else if(d!==4&&(r=r.child,r!==null))for(Cf(r,o,a),r=r.sibling;r!==null;)Cf(r,o,a),r=r.sibling}var ht=null,vn=!1;function br(r,o,a){for(a=a.child;a!==null;)L0(r,o,a),a=a.sibling}function L0(r,o,a){if(Dn&&typeof Dn.onCommitFiberUnmount=="function")try{Dn.onCommitFiberUnmount(ra,a)}catch{}switch(a.tag){case 5:xt||ms(a,o);case 6:var d=ht,g=vn;ht=null,br(r,o,a),ht=d,vn=g,ht!==null&&(vn?(r=ht,a=a.stateNode,r.nodeType===8?r.parentNode.removeChild(a):r.removeChild(a)):ht.removeChild(a.stateNode));break;case 18:ht!==null&&(vn?(r=ht,a=a.stateNode,r.nodeType===8?Vd(r.parentNode,a):r.nodeType===1&&Vd(r,a),gi(r)):Vd(ht,a.stateNode));break;case 4:d=ht,g=vn,ht=a.stateNode.containerInfo,vn=!0,br(r,o,a),ht=d,vn=g;break;case 0:case 11:case 14:case 15:if(!xt&&(d=a.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var v=g,T=v.destroy;v=v.tag,T!==void 0&&((v&2)!==0||(v&4)!==0)&&Rf(a,o,T),g=g.next}while(g!==d)}br(r,o,a);break;case 1:if(!xt&&(ms(a,o),d=a.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=a.memoizedProps,d.state=a.memoizedState,d.componentWillUnmount()}catch(j){Xe(a,o,j)}br(r,o,a);break;case 21:br(r,o,a);break;case 22:a.mode&1?(xt=(d=xt)||a.memoizedState!==null,br(r,o,a),xt=d):br(r,o,a);break;default:br(r,o,a)}}function D0(r){var o=r.updateQueue;if(o!==null){r.updateQueue=null;var a=r.stateNode;a===null&&(a=r.stateNode=new Sb),o.forEach(function(d){var g=bb.bind(null,r,d);a.has(d)||(a.add(d),d.then(g,g))})}}function xn(r,o){var a=o.deletions;if(a!==null)for(var d=0;d<a.length;d++){var g=a[d];try{var v=r,T=o,j=T;e:for(;j!==null;){switch(j.tag){case 5:ht=j.stateNode,vn=!1;break e;case 3:ht=j.stateNode.containerInfo,vn=!0;break e;case 4:ht=j.stateNode.containerInfo,vn=!0;break e}j=j.return}if(ht===null)throw Error(n(160));L0(v,T,g),ht=null,vn=!1;var W=g.alternate;W!==null&&(W.return=null),g.return=null}catch(te){Xe(g,o,te)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)k0(o,r),o=o.sibling}function k0(r,o){var a=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(xn(o,r),jn(r),d&4){try{Ui(3,r,r.return),za(3,r)}catch(ye){Xe(r,r.return,ye)}try{Ui(5,r,r.return)}catch(ye){Xe(r,r.return,ye)}}break;case 1:xn(o,r),jn(r),d&512&&a!==null&&ms(a,a.return);break;case 5:if(xn(o,r),jn(r),d&512&&a!==null&&ms(a,a.return),r.flags&32){var g=r.stateNode;try{Ke(g,"")}catch(ye){Xe(r,r.return,ye)}}if(d&4&&(g=r.stateNode,g!=null)){var v=r.memoizedProps,T=a!==null?a.memoizedProps:v,j=r.type,W=r.updateQueue;if(r.updateQueue=null,W!==null)try{j==="input"&&v.type==="radio"&&v.name!=null&&ft(g,v),Kn(j,T);var te=Kn(j,v);for(T=0;T<W.length;T+=2){var ie=W[T],ae=W[T+1];ie==="style"?Ln(g,ae):ie==="dangerouslySetInnerHTML"?Gn(g,ae):ie==="children"?Ke(g,ae):P(g,ie,ae,te)}switch(j){case"input":pt(g,v);break;case"textarea":dn(g,v);break;case"select":var se=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!v.multiple;var pe=v.value;pe!=null?qt(g,!!v.multiple,pe,!1):se!==!!v.multiple&&(v.defaultValue!=null?qt(g,!!v.multiple,v.defaultValue,!0):qt(g,!!v.multiple,v.multiple?[]:"",!1))}g[Oi]=v}catch(ye){Xe(r,r.return,ye)}}break;case 6:if(xn(o,r),jn(r),d&4){if(r.stateNode===null)throw Error(n(162));g=r.stateNode,v=r.memoizedProps;try{g.nodeValue=v}catch(ye){Xe(r,r.return,ye)}}break;case 3:if(xn(o,r),jn(r),d&4&&a!==null&&a.memoizedState.isDehydrated)try{gi(o.containerInfo)}catch(ye){Xe(r,r.return,ye)}break;case 4:xn(o,r),jn(r);break;case 13:xn(o,r),jn(r),g=r.child,g.flags&8192&&(v=g.memoizedState!==null,g.stateNode.isHidden=v,!v||g.alternate!==null&&g.alternate.memoizedState!==null||(bf=We())),d&4&&D0(r);break;case 22:if(ie=a!==null&&a.memoizedState!==null,r.mode&1?(xt=(te=xt)||ie,xn(o,r),xt=te):xn(o,r),jn(r),d&8192){if(te=r.memoizedState!==null,(r.stateNode.isHidden=te)&&!ie&&(r.mode&1)!==0)for(he=r,ie=r.child;ie!==null;){for(ae=he=ie;he!==null;){switch(se=he,pe=se.child,se.tag){case 0:case 11:case 14:case 15:Ui(4,se,se.return);break;case 1:ms(se,se.return);var ge=se.stateNode;if(typeof ge.componentWillUnmount=="function"){d=se,a=se.return;try{o=d,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(ye){Xe(d,a,ye)}}break;case 5:ms(se,se.return);break;case 22:if(se.memoizedState!==null){j0(ae);continue}}pe!==null?(pe.return=se,he=pe):j0(ae)}ie=ie.sibling}e:for(ie=null,ae=r;;){if(ae.tag===5){if(ie===null){ie=ae;try{g=ae.stateNode,te?(v=g.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none"):(j=ae.stateNode,W=ae.memoizedProps.style,T=W!=null&&W.hasOwnProperty("display")?W.display:null,j.style.display=bn("display",T))}catch(ye){Xe(r,r.return,ye)}}}else if(ae.tag===6){if(ie===null)try{ae.stateNode.nodeValue=te?"":ae.memoizedProps}catch(ye){Xe(r,r.return,ye)}}else if((ae.tag!==22&&ae.tag!==23||ae.memoizedState===null||ae===r)&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===r)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===r)break e;ie===ae&&(ie=null),ae=ae.return}ie===ae&&(ie=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:xn(o,r),jn(r),d&4&&D0(r);break;case 21:break;default:xn(o,r),jn(r)}}function jn(r){var o=r.flags;if(o&2){try{e:{for(var a=r.return;a!==null;){if(I0(a)){var d=a;break e}a=a.return}throw Error(n(160))}switch(d.tag){case 5:var g=d.stateNode;d.flags&32&&(Ke(g,""),d.flags&=-33);var v=b0(r);Cf(r,v,g);break;case 3:case 4:var T=d.stateNode.containerInfo,j=b0(r);Of(r,j,T);break;default:throw Error(n(161))}}catch(W){Xe(r,r.return,W)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function wb(r,o,a){he=r,P0(r)}function P0(r,o,a){for(var d=(r.mode&1)!==0;he!==null;){var g=he,v=g.child;if(g.tag===22&&d){var T=g.memoizedState!==null||Ba;if(!T){var j=g.alternate,W=j!==null&&j.memoizedState!==null||xt;j=Ba;var te=xt;if(Ba=T,(xt=W)&&!te)for(he=g;he!==null;)T=he,W=T.child,T.tag===22&&T.memoizedState!==null?U0(g):W!==null?(W.return=T,he=W):U0(g);for(;v!==null;)he=v,P0(v),v=v.sibling;he=g,Ba=j,xt=te}M0(r)}else(g.subtreeFlags&8772)!==0&&v!==null?(v.return=g,he=v):M0(r)}}function M0(r){for(;he!==null;){var o=he;if((o.flags&8772)!==0){var a=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:xt||za(5,o);break;case 1:var d=o.stateNode;if(o.flags&4&&!xt)if(a===null)d.componentDidMount();else{var g=o.elementType===o.type?a.memoizedProps:En(o.type,a.memoizedProps);d.componentDidUpdate(g,a.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var v=o.updateQueue;v!==null&&DE(o,v,d);break;case 3:var T=o.updateQueue;if(T!==null){if(a=null,o.child!==null)switch(o.child.tag){case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}DE(o,T,a)}break;case 5:var j=o.stateNode;if(a===null&&o.flags&4){a=j;var W=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":W.autoFocus&&a.focus();break;case"img":W.src&&(a.src=W.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var te=o.alternate;if(te!==null){var ie=te.memoizedState;if(ie!==null){var ae=ie.dehydrated;ae!==null&&gi(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}xt||o.flags&512&&Tf(o)}catch(se){Xe(o,o.return,se)}}if(o===r){he=null;break}if(a=o.sibling,a!==null){a.return=o.return,he=a;break}he=o.return}}function j0(r){for(;he!==null;){var o=he;if(o===r){he=null;break}var a=o.sibling;if(a!==null){a.return=o.return,he=a;break}he=o.return}}function U0(r){for(;he!==null;){var o=he;try{switch(o.tag){case 0:case 11:case 15:var a=o.return;try{za(4,o)}catch(W){Xe(o,a,W)}break;case 1:var d=o.stateNode;if(typeof d.componentDidMount=="function"){var g=o.return;try{d.componentDidMount()}catch(W){Xe(o,g,W)}}var v=o.return;try{Tf(o)}catch(W){Xe(o,v,W)}break;case 5:var T=o.return;try{Tf(o)}catch(W){Xe(o,T,W)}}}catch(W){Xe(o,o.return,W)}if(o===r){he=null;break}var j=o.sibling;if(j!==null){j.return=o.return,he=j;break}he=o.return}}var Nb=Math.ceil,Wa=C.ReactCurrentDispatcher,Af=C.ReactCurrentOwner,nn=C.ReactCurrentBatchConfig,Ae=0,at=null,rt=null,mt=0,Yt=0,gs=Tr(0),it=0,Fi=null,uo=0,Ga=0,If=0,Vi=null,jt=null,bf=0,ys=1/0,sr=null,Ya=!1,Lf=null,Lr=null,Ka=!1,Dr=null,Xa=0,$i=0,Df=null,Qa=-1,qa=0;function Rt(){return(Ae&6)!==0?We():Qa!==-1?Qa:Qa=We()}function kr(r){return(r.mode&1)===0?1:(Ae&2)!==0&&mt!==0?mt&-mt:lb.transition!==null?(qa===0&&(qa=Iy()),qa):(r=ke,r!==0||(r=window.event,r=r===void 0?16:Fy(r.type)),r)}function Sn(r,o,a,d){if(50<$i)throw $i=0,Df=null,Error(n(185));di(r,a,d),((Ae&2)===0||r!==at)&&(r===at&&((Ae&2)===0&&(Ga|=a),it===4&&Pr(r,mt)),Ut(r,d),a===1&&Ae===0&&(o.mode&1)===0&&(ys=We()+500,Ra&&Cr()))}function Ut(r,o){var a=r.callbackNode;lI(r,o);var d=ia(r,r===at?mt:0);if(d===0)a!==null&&ea(a),r.callbackNode=null,r.callbackPriority=0;else if(o=d&-d,r.callbackPriority!==o){if(a!=null&&ea(a),o===1)r.tag===0?ib(V0.bind(null,r)):NE(V0.bind(null,r)),nb(function(){(Ae&6)===0&&Cr()}),a=null;else{switch(by(d)){case 1:a=ai;break;case 4:a=na;break;case 16:a=Qo;break;case 536870912:a=Ay;break;default:a=Qo}a=K0(a,F0.bind(null,r))}r.callbackPriority=o,r.callbackNode=a}}function F0(r,o){if(Qa=-1,qa=0,(Ae&6)!==0)throw Error(n(327));var a=r.callbackNode;if(Es()&&r.callbackNode!==a)return null;var d=ia(r,r===at?mt:0);if(d===0)return null;if((d&30)!==0||(d&r.expiredLanes)!==0||o)o=Ja(r,d);else{o=d;var g=Ae;Ae|=2;var v=H0();(at!==r||mt!==o)&&(sr=null,ys=We()+500,po(r,o));do try{Ob();break}catch(j){$0(r,j)}while(!0);Qd(),Wa.current=v,Ae=g,rt!==null?o=0:(at=null,mt=0,o=it)}if(o!==0){if(o===2&&(g=fd(r),g!==0&&(d=g,o=kf(r,g))),o===1)throw a=Fi,po(r,0),Pr(r,d),Ut(r,We()),a;if(o===6)Pr(r,d);else{if(g=r.current.alternate,(d&30)===0&&!Rb(g)&&(o=Ja(r,d),o===2&&(v=fd(r),v!==0&&(d=v,o=kf(r,v))),o===1))throw a=Fi,po(r,0),Pr(r,d),Ut(r,We()),a;switch(r.finishedWork=g,r.finishedLanes=d,o){case 0:case 1:throw Error(n(345));case 2:ho(r,jt,sr);break;case 3:if(Pr(r,d),(d&130023424)===d&&(o=bf+500-We(),10<o)){if(ia(r,0)!==0)break;if(g=r.suspendedLanes,(g&d)!==d){Rt(),r.pingedLanes|=r.suspendedLanes&g;break}r.timeoutHandle=Fd(ho.bind(null,r,jt,sr),o);break}ho(r,jt,sr);break;case 4:if(Pr(r,d),(d&4194240)===d)break;for(o=r.eventTimes,g=-1;0<d;){var T=31-mn(d);v=1<<T,T=o[T],T>g&&(g=T),d&=~v}if(d=g,d=We()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*Nb(d/1960))-d,10<d){r.timeoutHandle=Fd(ho.bind(null,r,jt,sr),d);break}ho(r,jt,sr);break;case 5:ho(r,jt,sr);break;default:throw Error(n(329))}}}return Ut(r,We()),r.callbackNode===a?F0.bind(null,r):null}function kf(r,o){var a=Vi;return r.current.memoizedState.isDehydrated&&(po(r,o).flags|=256),r=Ja(r,o),r!==2&&(o=jt,jt=a,o!==null&&Pf(o)),r}function Pf(r){jt===null?jt=r:jt.push.apply(jt,r)}function Rb(r){for(var o=r;;){if(o.flags&16384){var a=o.updateQueue;if(a!==null&&(a=a.stores,a!==null))for(var d=0;d<a.length;d++){var g=a[d],v=g.getSnapshot;g=g.value;try{if(!gn(v(),g))return!1}catch{return!1}}}if(a=o.child,o.subtreeFlags&16384&&a!==null)a.return=o,o=a;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Pr(r,o){for(o&=~If,o&=~Ga,r.suspendedLanes|=o,r.pingedLanes&=~o,r=r.expirationTimes;0<o;){var a=31-mn(o),d=1<<a;r[a]=-1,o&=~d}}function V0(r){if((Ae&6)!==0)throw Error(n(327));Es();var o=ia(r,0);if((o&1)===0)return Ut(r,We()),null;var a=Ja(r,o);if(r.tag!==0&&a===2){var d=fd(r);d!==0&&(o=d,a=kf(r,d))}if(a===1)throw a=Fi,po(r,0),Pr(r,o),Ut(r,We()),a;if(a===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=o,ho(r,jt,sr),Ut(r,We()),null}function Mf(r,o){var a=Ae;Ae|=1;try{return r(o)}finally{Ae=a,Ae===0&&(ys=We()+500,Ra&&Cr())}}function fo(r){Dr!==null&&Dr.tag===0&&(Ae&6)===0&&Es();var o=Ae;Ae|=1;var a=nn.transition,d=ke;try{if(nn.transition=null,ke=1,r)return r()}finally{ke=d,nn.transition=a,Ae=o,(Ae&6)===0&&Cr()}}function jf(){Yt=gs.current,Ve(gs)}function po(r,o){r.finishedWork=null,r.finishedLanes=0;var a=r.timeoutHandle;if(a!==-1&&(r.timeoutHandle=-1,tb(a)),rt!==null)for(a=rt.return;a!==null;){var d=a;switch(Wd(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&wa();break;case 3:ps(),Ve(kt),Ve(yt),lf();break;case 5:of(d);break;case 4:ps();break;case 13:Ve(Ge);break;case 19:Ve(Ge);break;case 10:qd(d.type._context);break;case 22:case 23:jf()}a=a.return}if(at=r,rt=r=Mr(r.current,null),mt=Yt=o,it=0,Fi=null,If=Ga=uo=0,jt=Vi=null,lo!==null){for(o=0;o<lo.length;o++)if(a=lo[o],d=a.interleaved,d!==null){a.interleaved=null;var g=d.next,v=a.pending;if(v!==null){var T=v.next;v.next=g,d.next=T}a.pending=d}lo=null}return r}function $0(r,o){do{var a=rt;try{if(Qd(),Ma.current=Va,ja){for(var d=Ye.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}ja=!1}if(co=0,lt=st=Ye=null,Di=!1,ki=0,Af.current=null,a===null||a.return===null){it=1,Fi=o,rt=null;break}e:{var v=r,T=a.return,j=a,W=o;if(o=mt,j.flags|=32768,W!==null&&typeof W=="object"&&typeof W.then=="function"){var te=W,ie=j,ae=ie.tag;if((ie.mode&1)===0&&(ae===0||ae===11||ae===15)){var se=ie.alternate;se?(ie.updateQueue=se.updateQueue,ie.memoizedState=se.memoizedState,ie.lanes=se.lanes):(ie.updateQueue=null,ie.memoizedState=null)}var pe=f0(T);if(pe!==null){pe.flags&=-257,p0(pe,T,j,v,o),pe.mode&1&&d0(v,te,o),o=pe,W=te;var ge=o.updateQueue;if(ge===null){var ye=new Set;ye.add(W),o.updateQueue=ye}else ge.add(W);break e}else{if((o&1)===0){d0(v,te,o),Uf();break e}W=Error(n(426))}}else if(ze&&j.mode&1){var et=f0(T);if(et!==null){(et.flags&65536)===0&&(et.flags|=256),p0(et,T,j,v,o),Kd(hs(W,j));break e}}v=W=hs(W,j),it!==4&&(it=2),Vi===null?Vi=[v]:Vi.push(v),v=T;do{switch(v.tag){case 3:v.flags|=65536,o&=-o,v.lanes|=o;var J=c0(v,W,o);LE(v,J);break e;case 1:j=W;var K=v.type,Z=v.stateNode;if((v.flags&128)===0&&(typeof K.getDerivedStateFromError=="function"||Z!==null&&typeof Z.componentDidCatch=="function"&&(Lr===null||!Lr.has(Z)))){v.flags|=65536,o&=-o,v.lanes|=o;var ce=u0(v,j,o);LE(v,ce);break e}}v=v.return}while(v!==null)}z0(a)}catch(ve){o=ve,rt===a&&a!==null&&(rt=a=a.return);continue}break}while(!0)}function H0(){var r=Wa.current;return Wa.current=Va,r===null?Va:r}function Uf(){(it===0||it===3||it===2)&&(it=4),at===null||(uo&268435455)===0&&(Ga&268435455)===0||Pr(at,mt)}function Ja(r,o){var a=Ae;Ae|=2;var d=H0();(at!==r||mt!==o)&&(sr=null,po(r,o));do try{Tb();break}catch(g){$0(r,g)}while(!0);if(Qd(),Ae=a,Wa.current=d,rt!==null)throw Error(n(261));return at=null,mt=0,it}function Tb(){for(;rt!==null;)B0(rt)}function Ob(){for(;rt!==null&&!ud();)B0(rt)}function B0(r){var o=Y0(r.alternate,r,Yt);r.memoizedProps=r.pendingProps,o===null?z0(r):rt=o,Af.current=null}function z0(r){var o=r;do{var a=o.alternate;if(r=o.return,(o.flags&32768)===0){if(a=vb(a,o,Yt),a!==null){rt=a;return}}else{if(a=xb(a,o),a!==null){a.flags&=32767,rt=a;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{it=6,rt=null;return}}if(o=o.sibling,o!==null){rt=o;return}rt=o=r}while(o!==null);it===0&&(it=5)}function ho(r,o,a){var d=ke,g=nn.transition;try{nn.transition=null,ke=1,Cb(r,o,a,d)}finally{nn.transition=g,ke=d}return null}function Cb(r,o,a,d){do Es();while(Dr!==null);if((Ae&6)!==0)throw Error(n(327));a=r.finishedWork;var g=r.finishedLanes;if(a===null)return null;if(r.finishedWork=null,r.finishedLanes=0,a===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var v=a.lanes|a.childLanes;if(aI(r,v),r===at&&(rt=at=null,mt=0),(a.subtreeFlags&2064)===0&&(a.flags&2064)===0||Ka||(Ka=!0,K0(Qo,function(){return Es(),null})),v=(a.flags&15990)!==0,(a.subtreeFlags&15990)!==0||v){v=nn.transition,nn.transition=null;var T=ke;ke=1;var j=Ae;Ae|=4,Af.current=null,_b(r,a),k0(a,r),KI(jd),ca=!!Md,jd=Md=null,r.current=a,wb(a),dd(),Ae=j,ke=T,nn.transition=v}else r.current=a;if(Ka&&(Ka=!1,Dr=r,Xa=g),v=r.pendingLanes,v===0&&(Lr=null),nI(a.stateNode),Ut(r,We()),o!==null)for(d=r.onRecoverableError,a=0;a<o.length;a++)g=o[a],d(g.value,{componentStack:g.stack,digest:g.digest});if(Ya)throw Ya=!1,r=Lf,Lf=null,r;return(Xa&1)!==0&&r.tag!==0&&Es(),v=r.pendingLanes,(v&1)!==0?r===Df?$i++:($i=0,Df=r):$i=0,Cr(),null}function Es(){if(Dr!==null){var r=by(Xa),o=nn.transition,a=ke;try{if(nn.transition=null,ke=16>r?16:r,Dr===null)var d=!1;else{if(r=Dr,Dr=null,Xa=0,(Ae&6)!==0)throw Error(n(331));var g=Ae;for(Ae|=4,he=r.current;he!==null;){var v=he,T=v.child;if((he.flags&16)!==0){var j=v.deletions;if(j!==null){for(var W=0;W<j.length;W++){var te=j[W];for(he=te;he!==null;){var ie=he;switch(ie.tag){case 0:case 11:case 15:Ui(8,ie,v)}var ae=ie.child;if(ae!==null)ae.return=ie,he=ae;else for(;he!==null;){ie=he;var se=ie.sibling,pe=ie.return;if(A0(ie),ie===te){he=null;break}if(se!==null){se.return=pe,he=se;break}he=pe}}}var ge=v.alternate;if(ge!==null){var ye=ge.child;if(ye!==null){ge.child=null;do{var et=ye.sibling;ye.sibling=null,ye=et}while(ye!==null)}}he=v}}if((v.subtreeFlags&2064)!==0&&T!==null)T.return=v,he=T;else e:for(;he!==null;){if(v=he,(v.flags&2048)!==0)switch(v.tag){case 0:case 11:case 15:Ui(9,v,v.return)}var J=v.sibling;if(J!==null){J.return=v.return,he=J;break e}he=v.return}}var K=r.current;for(he=K;he!==null;){T=he;var Z=T.child;if((T.subtreeFlags&2064)!==0&&Z!==null)Z.return=T,he=Z;else e:for(T=K;he!==null;){if(j=he,(j.flags&2048)!==0)try{switch(j.tag){case 0:case 11:case 15:za(9,j)}}catch(ve){Xe(j,j.return,ve)}if(j===T){he=null;break e}var ce=j.sibling;if(ce!==null){ce.return=j.return,he=ce;break e}he=j.return}}if(Ae=g,Cr(),Dn&&typeof Dn.onPostCommitFiberRoot=="function")try{Dn.onPostCommitFiberRoot(ra,r)}catch{}d=!0}return d}finally{ke=a,nn.transition=o}}return!1}function W0(r,o,a){o=hs(a,o),o=c0(r,o,1),r=Ir(r,o,1),o=Rt(),r!==null&&(di(r,1,o),Ut(r,o))}function Xe(r,o,a){if(r.tag===3)W0(r,r,a);else for(;o!==null;){if(o.tag===3){W0(o,r,a);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Lr===null||!Lr.has(d))){r=hs(a,r),r=u0(o,r,1),o=Ir(o,r,1),r=Rt(),o!==null&&(di(o,1,r),Ut(o,r));break}}o=o.return}}function Ab(r,o,a){var d=r.pingCache;d!==null&&d.delete(o),o=Rt(),r.pingedLanes|=r.suspendedLanes&a,at===r&&(mt&a)===a&&(it===4||it===3&&(mt&130023424)===mt&&500>We()-bf?po(r,0):If|=a),Ut(r,o)}function G0(r,o){o===0&&((r.mode&1)===0?o=1:(o=sa,sa<<=1,(sa&130023424)===0&&(sa=4194304)));var a=Rt();r=nr(r,o),r!==null&&(di(r,o,a),Ut(r,a))}function Ib(r){var o=r.memoizedState,a=0;o!==null&&(a=o.retryLane),G0(r,a)}function bb(r,o){var a=0;switch(r.tag){case 13:var d=r.stateNode,g=r.memoizedState;g!==null&&(a=g.retryLane);break;case 19:d=r.stateNode;break;default:throw Error(n(314))}d!==null&&d.delete(o),G0(r,a)}var Y0;Y0=function(r,o,a){if(r!==null)if(r.memoizedProps!==o.pendingProps||kt.current)Mt=!0;else{if((r.lanes&a)===0&&(o.flags&128)===0)return Mt=!1,Eb(r,o,a);Mt=(r.flags&131072)!==0}else Mt=!1,ze&&(o.flags&1048576)!==0&&RE(o,Oa,o.index);switch(o.lanes=0,o.tag){case 2:var d=o.type;Ha(r,o),r=o.pendingProps;var g=is(o,yt.current);ds(o,a),g=uf(null,o,d,r,g,a);var v=df();return o.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Pt(d)?(v=!0,Na(o)):v=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,ef(o),g.updater=Da,o.stateNode=g,g._reactInternals=o,nf(o,d,r,a),o=vf(null,o,d,!0,v,a)):(o.tag=0,ze&&v&&zd(o),Nt(null,o,g,a),o=o.child),o;case 16:d=o.elementType;e:{switch(Ha(r,o),r=o.pendingProps,g=d._init,d=g(d._payload),o.type=d,g=o.tag=Db(d),r=En(d,r),g){case 0:o=Ef(null,o,d,r,a);break e;case 1:o=v0(null,o,d,r,a);break e;case 11:o=h0(null,o,d,r,a);break e;case 14:o=m0(null,o,d,En(d.type,r),a);break e}throw Error(n(306,d,""))}return o;case 0:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:En(d,g),Ef(r,o,d,g,a);case 1:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:En(d,g),v0(r,o,d,g,a);case 3:e:{if(x0(o),r===null)throw Error(n(387));d=o.pendingProps,v=o.memoizedState,g=v.element,bE(r,o),La(o,d,null,a);var T=o.memoizedState;if(d=T.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=v,o.memoizedState=v,o.flags&256){g=hs(Error(n(423)),o),o=S0(r,o,d,a,g);break e}else if(d!==g){g=hs(Error(n(424)),o),o=S0(r,o,d,a,g);break e}else for(Gt=Rr(o.stateNode.containerInfo.firstChild),Wt=o,ze=!0,yn=null,a=VE(o,null,d,a),o.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(cs(),d===g){o=or(r,o,a);break e}Nt(r,o,d,a)}o=o.child}return o;case 5:return $E(o),r===null&&Yd(o),d=o.type,g=o.pendingProps,v=r!==null?r.memoizedProps:null,T=g.children,Ud(d,g)?T=null:v!==null&&Ud(d,v)&&(o.flags|=32),E0(r,o),Nt(r,o,T,a),o.child;case 6:return r===null&&Yd(o),null;case 13:return _0(r,o,a);case 4:return rf(o,o.stateNode.containerInfo),d=o.pendingProps,r===null?o.child=fs(o,null,d,a):Nt(r,o,d,a),o.child;case 11:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:En(d,g),h0(r,o,d,g,a);case 7:return Nt(r,o,o.pendingProps,a),o.child;case 8:return Nt(r,o,o.pendingProps.children,a),o.child;case 12:return Nt(r,o,o.pendingProps.children,a),o.child;case 10:e:{if(d=o.type._context,g=o.pendingProps,v=o.memoizedProps,T=g.value,Ue(Aa,d._currentValue),d._currentValue=T,v!==null)if(gn(v.value,T)){if(v.children===g.children&&!kt.current){o=or(r,o,a);break e}}else for(v=o.child,v!==null&&(v.return=o);v!==null;){var j=v.dependencies;if(j!==null){T=v.child;for(var W=j.firstContext;W!==null;){if(W.context===d){if(v.tag===1){W=rr(-1,a&-a),W.tag=2;var te=v.updateQueue;if(te!==null){te=te.shared;var ie=te.pending;ie===null?W.next=W:(W.next=ie.next,ie.next=W),te.pending=W}}v.lanes|=a,W=v.alternate,W!==null&&(W.lanes|=a),Jd(v.return,a,o),j.lanes|=a;break}W=W.next}}else if(v.tag===10)T=v.type===o.type?null:v.child;else if(v.tag===18){if(T=v.return,T===null)throw Error(n(341));T.lanes|=a,j=T.alternate,j!==null&&(j.lanes|=a),Jd(T,a,o),T=v.sibling}else T=v.child;if(T!==null)T.return=v;else for(T=v;T!==null;){if(T===o){T=null;break}if(v=T.sibling,v!==null){v.return=T.return,T=v;break}T=T.return}v=T}Nt(r,o,g.children,a),o=o.child}return o;case 9:return g=o.type,d=o.pendingProps.children,ds(o,a),g=en(g),d=d(g),o.flags|=1,Nt(r,o,d,a),o.child;case 14:return d=o.type,g=En(d,o.pendingProps),g=En(d.type,g),m0(r,o,d,g,a);case 15:return g0(r,o,o.type,o.pendingProps,a);case 17:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:En(d,g),Ha(r,o),o.tag=1,Pt(d)?(r=!0,Na(o)):r=!1,ds(o,a),ME(o,d,g),nf(o,d,g,a),vf(null,o,d,!0,r,a);case 19:return N0(r,o,a);case 22:return y0(r,o,a)}throw Error(n(156,o.tag))};function K0(r,o){return Zl(r,o)}function Lb(r,o,a,d){this.tag=r,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(r,o,a,d){return new Lb(r,o,a,d)}function Ff(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Db(r){if(typeof r=="function")return Ff(r)?1:0;if(r!=null){if(r=r.$$typeof,r===ee)return 11;if(r===F)return 14}return 2}function Mr(r,o){var a=r.alternate;return a===null?(a=rn(r.tag,o,r.key,r.mode),a.elementType=r.elementType,a.type=r.type,a.stateNode=r.stateNode,a.alternate=r,r.alternate=a):(a.pendingProps=o,a.type=r.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=r.flags&14680064,a.childLanes=r.childLanes,a.lanes=r.lanes,a.child=r.child,a.memoizedProps=r.memoizedProps,a.memoizedState=r.memoizedState,a.updateQueue=r.updateQueue,o=r.dependencies,a.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},a.sibling=r.sibling,a.index=r.index,a.ref=r.ref,a}function Za(r,o,a,d,g,v){var T=2;if(d=r,typeof r=="function")Ff(r)&&(T=1);else if(typeof r=="string")T=5;else e:switch(r){case U:return mo(a.children,g,v,o);case G:T=8,g|=8;break;case X:return r=rn(12,a,o,g|2),r.elementType=X,r.lanes=v,r;case z:return r=rn(13,a,o,g),r.elementType=z,r.lanes=v,r;case A:return r=rn(19,a,o,g),r.elementType=A,r.lanes=v,r;case Y:return ec(a,g,v,o);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case H:T=10;break e;case q:T=9;break e;case ee:T=11;break e;case F:T=14;break e;case $:T=16,d=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return o=rn(T,a,o,g),o.elementType=r,o.type=d,o.lanes=v,o}function mo(r,o,a,d){return r=rn(7,r,d,o),r.lanes=a,r}function ec(r,o,a,d){return r=rn(22,r,d,o),r.elementType=Y,r.lanes=a,r.stateNode={isHidden:!1},r}function Vf(r,o,a){return r=rn(6,r,null,o),r.lanes=a,r}function $f(r,o,a){return o=rn(4,r.children!==null?r.children:[],r.key,o),o.lanes=a,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}function kb(r,o,a,d,g){this.tag=o,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pd(0),this.expirationTimes=pd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pd(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Hf(r,o,a,d,g,v,T,j,W){return r=new kb(r,o,a,j,W),o===1?(o=1,v===!0&&(o|=8)):o=0,v=rn(3,null,null,o),r.current=v,v.stateNode=r,v.memoizedState={element:d,isDehydrated:a,cache:null,transitions:null,pendingSuspenseBoundaries:null},ef(v),r}function Pb(r,o,a){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:L,key:d==null?null:""+d,children:r,containerInfo:o,implementation:a}}function X0(r){if(!r)return Or;r=r._reactInternals;e:{if(qn(r)!==r||r.tag!==1)throw Error(n(170));var o=r;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Pt(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(r.tag===1){var a=r.type;if(Pt(a))return _E(r,a,o)}return o}function Q0(r,o,a,d,g,v,T,j,W){return r=Hf(a,d,!0,r,g,v,T,j,W),r.context=X0(null),a=r.current,d=Rt(),g=kr(a),v=rr(d,g),v.callback=o??null,Ir(a,v,g),r.current.lanes=g,di(r,g,d),Ut(r,d),r}function tc(r,o,a,d){var g=o.current,v=Rt(),T=kr(g);return a=X0(a),o.context===null?o.context=a:o.pendingContext=a,o=rr(v,T),o.payload={element:r},d=d===void 0?null:d,d!==null&&(o.callback=d),r=Ir(g,o,T),r!==null&&(Sn(r,g,T,v),ba(r,g,T)),T}function nc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function q0(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var a=r.retryLane;r.retryLane=a!==0&&a<o?a:o}}function Bf(r,o){q0(r,o),(r=r.alternate)&&q0(r,o)}function Mb(){return null}var J0=typeof reportError=="function"?reportError:function(r){console.error(r)};function zf(r){this._internalRoot=r}rc.prototype.render=zf.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(n(409));tc(r,o,null,null)},rc.prototype.unmount=zf.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;fo(function(){tc(null,r,null,null)}),o[Jn]=null}};function rc(r){this._internalRoot=r}rc.prototype.unstable_scheduleHydration=function(r){if(r){var o=ky();r={blockedOn:null,target:r,priority:o};for(var a=0;a<_r.length&&o!==0&&o<_r[a].priority;a++);_r.splice(a,0,r),a===0&&jy(r)}};function Wf(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function oc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Z0(){}function jb(r,o,a,d,g){if(g){if(typeof d=="function"){var v=d;d=function(){var te=nc(T);v.call(te)}}var T=Q0(o,d,r,0,null,!1,!1,"",Z0);return r._reactRootContainer=T,r[Jn]=T.current,Ri(r.nodeType===8?r.parentNode:r),fo(),T}for(;g=r.lastChild;)r.removeChild(g);if(typeof d=="function"){var j=d;d=function(){var te=nc(W);j.call(te)}}var W=Hf(r,0,!1,null,null,!1,!1,"",Z0);return r._reactRootContainer=W,r[Jn]=W.current,Ri(r.nodeType===8?r.parentNode:r),fo(function(){tc(o,W,a,d)}),W}function sc(r,o,a,d,g){var v=a._reactRootContainer;if(v){var T=v;if(typeof g=="function"){var j=g;g=function(){var W=nc(T);j.call(W)}}tc(o,T,r,g)}else T=jb(a,o,r,g,d);return nc(T)}Ly=function(r){switch(r.tag){case 3:var o=r.stateNode;if(o.current.memoizedState.isDehydrated){var a=ui(o.pendingLanes);a!==0&&(hd(o,a|1),Ut(o,We()),(Ae&6)===0&&(ys=We()+500,Cr()))}break;case 13:fo(function(){var d=nr(r,1);if(d!==null){var g=Rt();Sn(d,r,1,g)}}),Bf(r,1)}},md=function(r){if(r.tag===13){var o=nr(r,134217728);if(o!==null){var a=Rt();Sn(o,r,134217728,a)}Bf(r,134217728)}},Dy=function(r){if(r.tag===13){var o=kr(r),a=nr(r,o);if(a!==null){var d=Rt();Sn(a,r,o,d)}Bf(r,o)}},ky=function(){return ke},Py=function(r,o){var a=ke;try{return ke=r,o()}finally{ke=a}},Jr=function(r,o,a){switch(o){case"input":if(pt(r,a),o=a.name,a.type==="radio"&&o!=null){for(a=r;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<a.length;o++){var d=a[o];if(d!==r&&d.form===r.form){var g=_a(d);if(!g)throw Error(n(90));Ze(d),pt(d,g)}}}break;case"textarea":dn(r,a);break;case"select":o=a.value,o!=null&&qt(r,!!a.multiple,o,!1)}},Yl=Mf,Kl=fo;var Ub={usingClientEntryPoint:!1,Events:[Ci,os,_a,Wl,Gl,Mf]},Hi={findFiberByHostInstance:ro,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},Fb={bundleType:Hi.bundleType,version:Hi.version,rendererPackageName:Hi.rendererPackageName,rendererConfig:Hi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=li(r),r===null?null:r.stateNode},findFiberByHostInstance:Hi.findFiberByHostInstance||Mb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ic.isDisabled&&ic.supportsFiber)try{ra=ic.inject(Fb),Dn=ic}catch{}}return Tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ub,Tt.createPortal=function(r,o){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wf(o))throw Error(n(200));return Pb(r,o,null,a)},Tt.createRoot=function(r,o){if(!Wf(r))throw Error(n(299));var a=!1,d="",g=J0;return o!=null&&(o.unstable_strictMode===!0&&(a=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Hf(r,1,!1,null,null,a,!1,d,g),r[Jn]=o.current,Ri(r.nodeType===8?r.parentNode:r),new zf(o)},Tt.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=li(o),r=r===null?null:r.stateNode,r},Tt.flushSync=function(r){return fo(r)},Tt.hydrate=function(r,o,a){if(!oc(o))throw Error(n(200));return sc(null,r,o,!0,a)},Tt.hydrateRoot=function(r,o,a){if(!Wf(r))throw Error(n(405));var d=a!=null&&a.hydratedSources||null,g=!1,v="",T=J0;if(a!=null&&(a.unstable_strictMode===!0&&(g=!0),a.identifierPrefix!==void 0&&(v=a.identifierPrefix),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),o=Q0(o,null,r,1,a??null,g,!1,v,T),r[Jn]=o.current,Ri(r),d)for(r=0;r<d.length;r++)a=d[r],g=a._getVersion,g=g(a._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[a,g]:o.mutableSourceEagerHydrationData.push(a,g);return new rc(o)},Tt.render=function(r,o,a){if(!oc(o))throw Error(n(200));return sc(null,r,o,!1,a)},Tt.unmountComponentAtNode=function(r){if(!oc(r))throw Error(n(40));return r._reactRootContainer?(fo(function(){sc(null,null,r,!1,function(){r._reactRootContainer=null,r[Jn]=null})}),!0):!1},Tt.unstable_batchedUpdates=Mf,Tt.unstable_renderSubtreeIntoContainer=function(r,o,a,d){if(!oc(a))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return sc(r,o,a,!1,d)},Tt.version="18.2.0-next-9e3b772b8-20220608",Tt}var sp;function ip(){if(sp)return Ec.exports;sp=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Ec.exports=zv(),Ec.exports}var lp;function Wv(){if(lp)return Wi;lp=1;var e=ip();return Wi.createRoot=e.createRoot,Wi.hydrateRoot=e.hydrateRoot,Wi}var Gv=Wv();const Yv=Bi(Gv);function St(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,s;n<e.length;n++)(s=St(e[n]))!==""&&(t+=(t&&" ")+s);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Sc={exports:{}},_c={},wc={exports:{}},Nc={};/**
37
+ */var op;function zv(){if(op)return Tt;op=1;var e=xs(),t=Bv();function r(n){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+n,l=1;l<arguments.length;l++)o+="&args[]="+encodeURIComponent(arguments[l]);return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,i={};function a(n,o){c(n,o),c(n+"Capture",o)}function c(n,o){for(i[n]=o,n=0;n<o.length;n++)s.add(o[n])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[: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]*$/,m={},E={};function v(n){return f.call(E,n)?!0:f.call(m,n)?!1:p.test(n)?E[n]=!0:(m[n]=!0,!1)}function x(n,o,l,d){if(l!==null&&l.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return d?!1:l!==null?!l.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function _(n,o,l,d){if(o===null||typeof o>"u"||x(n,o,l,d))return!0;if(d)return!1;if(l!==null)switch(l.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function w(n,o,l,d,g,y,R){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=d,this.attributeNamespace=g,this.mustUseProperty=l,this.propertyName=n,this.type=o,this.sanitizeURL=y,this.removeEmptyString=R}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){S[n]=new w(n,0,!1,n,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var o=n[0];S[o]=new w(o,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){S[n]=new w(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){S[n]=new w(n,2,!1,n,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){S[n]=new w(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){S[n]=new w(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){S[n]=new w(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){S[n]=new w(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){S[n]=new w(n,5,!1,n.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function O(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var o=n.replace(N,O);S[o]=new w(o,1,!1,n,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var o=n.replace(N,O);S[o]=new w(o,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(n){var o=n.replace(N,O);S[o]=new w(o,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){S[n]=new w(n,1,!1,n.toLowerCase(),null,!1,!1)}),S.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){S[n]=new w(n,1,!1,n.toLowerCase(),null,!0,!0)});function D(n,o,l,d){var g=S.hasOwnProperty(o)?S[o]:null;(g!==null?g.type!==0:d||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(_(o,l,g,d)&&(l=null),d||g===null?v(o)&&(l===null?n.removeAttribute(o):n.setAttribute(o,""+l)):g.mustUseProperty?n[g.propertyName]=l===null?g.type===3?!1:"":l:(o=g.attributeName,d=g.attributeNamespace,l===null?n.removeAttribute(o):(g=g.type,l=g===3||g===4&&l===!0?"":""+l,d?n.setAttributeNS(d,o,l):n.setAttribute(o,l))))}var T=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,A=Symbol.for("react.element"),L=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),Q=Symbol.for("react.profiler"),X=Symbol.for("react.provider"),ee=Symbol.for("react.context"),ne=Symbol.for("react.forward_ref"),W=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),U=Symbol.iterator;function $(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var z=Object.assign,k;function Y(n){if(k===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);k=o&&o[1]||""}return`
38
+ `+k+n}var re=!1;function oe(n,o){if(!n||re)return"";re=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(J){var d=J}Reflect.construct(n,[],o)}else{try{o.call()}catch(J){d=J}n.call(o.prototype)}else{try{throw Error()}catch(J){d=J}n()}}catch(J){if(J&&d&&typeof J.stack=="string"){for(var g=J.stack.split(`
39
+ `),y=d.stack.split(`
40
+ `),R=g.length-1,P=y.length-1;1<=R&&0<=P&&g[R]!==y[P];)P--;for(;1<=R&&0<=P;R--,P--)if(g[R]!==y[P]){if(R!==1||P!==1)do if(R--,P--,0>P||g[R]!==y[P]){var H=`
41
+ `+g[R].replace(" at new "," at ");return n.displayName&&H.includes("<anonymous>")&&(H=H.replace("<anonymous>",n.displayName)),H}while(1<=R&&0<=P);break}}}finally{re=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?Y(n):""}function le(n){switch(n.tag){case 5:return Y(n.type);case 16:return Y("Lazy");case 13:return Y("Suspense");case 19:return Y("SuspenseList");case 0:case 2:case 15:return n=oe(n.type,!1),n;case 11:return n=oe(n.type.render,!1),n;case 1:return n=oe(n.type,!0),n;default:return""}}function de(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case F:return"Fragment";case L:return"Portal";case Q:return"Profiler";case K:return"StrictMode";case W:return"Suspense";case I:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case ee:return(n.displayName||"Context")+".Consumer";case X:return(n._context.displayName||"Context")+".Provider";case ne:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case V:return o=n.displayName||null,o!==null?o:de(n.type)||"Memo";case j:o=n._payload,n=n._init;try{return de(n(o))}catch{}}return null}function he(n){var o=n.type;switch(n.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=o.render,n=n.displayName||n.name||"",o.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return de(o);case 8:return o===K?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ue(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function me(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Re(n){var o=me(n)?"checked":"value",l=Object.getOwnPropertyDescriptor(n.constructor.prototype,o),d=""+n[o];if(!n.hasOwnProperty(o)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var g=l.get,y=l.set;return Object.defineProperty(n,o,{configurable:!0,get:function(){return g.call(this)},set:function(R){d=""+R,y.call(this,R)}}),Object.defineProperty(n,o,{enumerable:l.enumerable}),{getValue:function(){return d},setValue:function(R){d=""+R},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function Pe(n){n._valueTracker||(n._valueTracker=Re(n))}function Je(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var l=o.getValue(),d="";return n&&(d=me(n)?n.checked?"true":"false":n.value),n=d,n!==l?(o.setValue(n),!0):!1}function wt(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function Be(n,o){var l=o.checked;return z({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function Ue(n,o){var l=o.defaultValue==null?"":o.defaultValue,d=o.checked!=null?o.checked:o.defaultChecked;l=ue(o.value!=null?o.value:l),n._wrapperState={initialChecked:d,initialValue:l,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function ft(n,o){o=o.checked,o!=null&&D(n,"checked",o,!1)}function pt(n,o){ft(n,o);var l=ue(o.value),d=o.type;if(l!=null)d==="number"?(l===0&&n.value===""||n.value!=l)&&(n.value=""+l):n.value!==""+l&&(n.value=""+l);else if(d==="submit"||d==="reset"){n.removeAttribute("value");return}o.hasOwnProperty("value")?un(n,o.type,l):o.hasOwnProperty("defaultValue")&&un(n,o.type,ue(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(n.defaultChecked=!!o.defaultChecked)}function we(n,o,l){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var d=o.type;if(!(d!=="submit"&&d!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+n._wrapperState.initialValue,l||o===n.value||(n.value=o),n.defaultValue=o}l=n.name,l!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,l!==""&&(n.name=l)}function un(n,o,l){(o!=="number"||wt(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var Ht=Array.isArray;function Qt(n,o,l,d){if(n=n.options,o){o={};for(var g=0;g<l.length;g++)o["$"+l[g]]=!0;for(l=0;l<n.length;l++)g=o.hasOwnProperty("$"+n[l].value),n[l].selected!==g&&(n[l].selected=g),g&&d&&(n[l].defaultSelected=!0)}else{for(l=""+ue(l),o=null,g=0;g<n.length;g++){if(n[g].value===l){n[g].selected=!0,d&&(n[g].defaultSelected=!0);return}o!==null||n[g].disabled||(o=n[g])}o!==null&&(o.selected=!0)}}function Cn(n,o){if(o.dangerouslySetInnerHTML!=null)throw Error(r(91));return z({},o,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function An(n,o){var l=o.value;if(l==null){if(l=o.children,o=o.defaultValue,l!=null){if(o!=null)throw Error(r(92));if(Ht(l)){if(1<l.length)throw Error(r(93));l=l[0]}o=l}o==null&&(o=""),l=o}n._wrapperState={initialValue:ue(l)}}function dn(n,o){var l=ue(o.value),d=ue(o.defaultValue);l!=null&&(l=""+l,l!==n.value&&(n.value=l),o.defaultValue==null&&n.defaultValue!==l&&(n.defaultValue=l)),d!=null&&(n.defaultValue=""+d)}function zn(n){var o=n.textContent;o===n._wrapperState.initialValue&&o!==""&&o!==null&&(n.value=o)}function fn(n){switch(n){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function pn(n,o){return n==null||n==="http://www.w3.org/1999/xhtml"?fn(o):n==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var In,Wn=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,l,d,g){MSApp.execUnsafeLocalFunction(function(){return n(o,l,d,g)})}:n}(function(n,o){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=o;else{for(In=In||document.createElement("div"),In.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=In.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;o.firstChild;)n.appendChild(o.firstChild)}});function Ke(n,o){if(o){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=o;return}}n.textContent=o}var it={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Gn=["Webkit","ms","Moz","O"];Object.keys(it).forEach(function(n){Gn.forEach(function(o){o=o+n.charAt(0).toUpperCase()+n.substring(1),it[o]=it[n]})});function bn(n,o,l){return o==null||typeof o=="boolean"||o===""?"":l||typeof o!="number"||o===0||it.hasOwnProperty(n)&&it[n]?(""+o).trim():o+"px"}function Yn(n,o){n=n.style;for(var l in o)if(o.hasOwnProperty(l)){var d=l.indexOf("--")===0,g=bn(l,o[l],d);l==="float"&&(l="cssFloat"),d?n.setProperty(l,g):n[l]=g}}var qt=z({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function hn(n,o){if(o){if(qt[n]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(r(137,n));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(r(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(r(61))}if(o.style!=null&&typeof o.style!="object")throw Error(r(62))}}function Qr(n,o){if(n.indexOf("-")===-1)return typeof o.is=="string";switch(n){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 qr=null;function Kn(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Zr=null,Xn=null,Lt=null;function zl(n){if(n=Oi(n)){if(typeof Zr!="function")throw Error(r(280));var o=n.stateNode;o&&(o=_a(o),Zr(n.stateNode,n.type,o))}}function Wl(n){Xn?Lt?Lt.push(n):Lt=[n]:Xn=n}function Gl(){if(Xn){var n=Xn,o=Lt;if(Lt=Xn=null,zl(n),o)for(n=0;n<o.length;n++)zl(o[n])}}function Yl(n,o){return n(o)}function Kl(){}var ri=!1;function Xl(n,o,l){if(ri)return n(o,l);ri=!0;try{return Yl(n,o,l)}finally{ri=!1,(Xn!==null||Lt!==null)&&(Kl(),Gl())}}function Jr(n,o){var l=n.stateNode;if(l===null)return null;var d=_a(l);if(d===null)return null;l=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(l&&typeof l!="function")throw Error(r(231,o,typeof l));return l}var oi=!1;if(u)try{var eo={};Object.defineProperty(eo,"passive",{get:function(){oi=!0}}),window.addEventListener("test",eo,eo),window.removeEventListener("test",eo,eo)}catch{oi=!1}function sd(n,o,l,d,g,y,R,P,H){var J=Array.prototype.slice.call(arguments,3);try{o.apply(l,J)}catch(ie){this.onError(ie)}}var to=!1,Ko=null,no=!1,si=null,id={onError:function(n){to=!0,Ko=n}};function ld(n,o,l,d,g,y,R,P,H){to=!1,Ko=null,sd.apply(id,arguments)}function ad(n,o,l,d,g,y,R,P,H){if(ld.apply(this,arguments),to){if(to){var J=Ko;to=!1,Ko=null}else throw Error(r(198));no||(no=!0,si=J)}}function Qn(n){var o=n,l=n;if(n.alternate)for(;o.return;)o=o.return;else{n=o;do o=n,(o.flags&4098)!==0&&(l=o.return),n=o.return;while(n)}return o.tag===3?l:null}function Ql(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function ql(n){if(Qn(n)!==n)throw Error(r(188))}function cd(n){var o=n.alternate;if(!o){if(o=Qn(n),o===null)throw Error(r(188));return o!==n?null:n}for(var l=n,d=o;;){var g=l.return;if(g===null)break;var y=g.alternate;if(y===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===y.child){for(y=g.child;y;){if(y===l)return ql(g),n;if(y===d)return ql(g),o;y=y.sibling}throw Error(r(188))}if(l.return!==d.return)l=g,d=y;else{for(var R=!1,P=g.child;P;){if(P===l){R=!0,l=g,d=y;break}if(P===d){R=!0,d=g,l=y;break}P=P.sibling}if(!R){for(P=y.child;P;){if(P===l){R=!0,l=y,d=g;break}if(P===d){R=!0,d=y,l=g;break}P=P.sibling}if(!R)throw Error(r(189))}}if(l.alternate!==d)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?n:o}function ii(n){return n=cd(n),n!==null?Zl(n):null}function Zl(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var o=Zl(n);if(o!==null)return o;n=n.sibling}return null}var Jl=t.unstable_scheduleCallback,ea=t.unstable_cancelCallback,ud=t.unstable_shouldYield,dd=t.unstable_requestPaint,We=t.unstable_now,ta=t.unstable_getCurrentPriorityLevel,li=t.unstable_ImmediatePriority,na=t.unstable_UserBlockingPriority,Xo=t.unstable_NormalPriority,ai=t.unstable_LowPriority,AE=t.unstable_IdlePriority,ra=null,Ln=null;function n2(n){if(Ln&&typeof Ln.onCommitFiberRoot=="function")try{Ln.onCommitFiberRoot(ra,n,void 0,(n.current.flags&128)===128)}catch{}}var mn=Math.clz32?Math.clz32:s2,r2=Math.log,o2=Math.LN2;function s2(n){return n>>>=0,n===0?32:31-(r2(n)/o2|0)|0}var oa=64,sa=4194304;function ci(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function ia(n,o){var l=n.pendingLanes;if(l===0)return 0;var d=0,g=n.suspendedLanes,y=n.pingedLanes,R=l&268435455;if(R!==0){var P=R&~g;P!==0?d=ci(P):(y&=R,y!==0&&(d=ci(y)))}else R=l&~g,R!==0?d=ci(R):y!==0&&(d=ci(y));if(d===0)return 0;if(o!==0&&o!==d&&(o&g)===0&&(g=d&-d,y=o&-o,g>=y||g===16&&(y&4194240)!==0))return o;if((d&4)!==0&&(d|=l&16),o=n.entangledLanes,o!==0)for(n=n.entanglements,o&=d;0<o;)l=31-mn(o),g=1<<l,d|=n[l],o&=~g;return d}function i2(n,o){switch(n){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function l2(n,o){for(var l=n.suspendedLanes,d=n.pingedLanes,g=n.expirationTimes,y=n.pendingLanes;0<y;){var R=31-mn(y),P=1<<R,H=g[R];H===-1?((P&l)===0||(P&d)!==0)&&(g[R]=i2(P,o)):H<=o&&(n.expiredLanes|=P),y&=~P}}function fd(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function IE(){var n=oa;return oa<<=1,(oa&4194240)===0&&(oa=64),n}function pd(n){for(var o=[],l=0;31>l;l++)o.push(n);return o}function ui(n,o,l){n.pendingLanes|=o,o!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,o=31-mn(o),n[o]=l}function a2(n,o){var l=n.pendingLanes&~o;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=o,n.mutableReadLanes&=o,n.entangledLanes&=o,o=n.entanglements;var d=n.eventTimes;for(n=n.expirationTimes;0<l;){var g=31-mn(l),y=1<<g;o[g]=0,d[g]=-1,n[g]=-1,l&=~y}}function hd(n,o){var l=n.entangledLanes|=o;for(n=n.entanglements;l;){var d=31-mn(l),g=1<<d;g&o|n[d]&o&&(n[d]|=o),l&=~g}}var ke=0;function bE(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var LE,md,DE,kE,ME,gd=!1,la=[],yr=null,vr=null,xr=null,di=new Map,fi=new Map,Sr=[],c2="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function PE(n,o){switch(n){case"focusin":case"focusout":yr=null;break;case"dragenter":case"dragleave":vr=null;break;case"mouseover":case"mouseout":xr=null;break;case"pointerover":case"pointerout":di.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":fi.delete(o.pointerId)}}function pi(n,o,l,d,g,y){return n===null||n.nativeEvent!==y?(n={blockedOn:o,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[g]},o!==null&&(o=Oi(o),o!==null&&md(o)),n):(n.eventSystemFlags|=d,o=n.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),n)}function u2(n,o,l,d,g){switch(o){case"focusin":return yr=pi(yr,n,o,l,d,g),!0;case"dragenter":return vr=pi(vr,n,o,l,d,g),!0;case"mouseover":return xr=pi(xr,n,o,l,d,g),!0;case"pointerover":var y=g.pointerId;return di.set(y,pi(di.get(y)||null,n,o,l,d,g)),!0;case"gotpointercapture":return y=g.pointerId,fi.set(y,pi(fi.get(y)||null,n,o,l,d,g)),!0}return!1}function UE(n){var o=ro(n.target);if(o!==null){var l=Qn(o);if(l!==null){if(o=l.tag,o===13){if(o=Ql(l),o!==null){n.blockedOn=o,ME(n.priority,function(){DE(l)});return}}else if(o===3&&l.stateNode.current.memoizedState.isDehydrated){n.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}n.blockedOn=null}function aa(n){if(n.blockedOn!==null)return!1;for(var o=n.targetContainers;0<o.length;){var l=yd(n.domEventName,n.eventSystemFlags,o[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var d=new l.constructor(l.type,l);qr=d,l.target.dispatchEvent(d),qr=null}else return o=Oi(l),o!==null&&md(o),n.blockedOn=l,!1;o.shift()}return!0}function FE(n,o,l){aa(n)&&l.delete(o)}function d2(){gd=!1,yr!==null&&aa(yr)&&(yr=null),vr!==null&&aa(vr)&&(vr=null),xr!==null&&aa(xr)&&(xr=null),di.forEach(FE),fi.forEach(FE)}function hi(n,o){n.blockedOn===o&&(n.blockedOn=null,gd||(gd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,d2)))}function mi(n){function o(g){return hi(g,n)}if(0<la.length){hi(la[0],n);for(var l=1;l<la.length;l++){var d=la[l];d.blockedOn===n&&(d.blockedOn=null)}}for(yr!==null&&hi(yr,n),vr!==null&&hi(vr,n),xr!==null&&hi(xr,n),di.forEach(o),fi.forEach(o),l=0;l<Sr.length;l++)d=Sr[l],d.blockedOn===n&&(d.blockedOn=null);for(;0<Sr.length&&(l=Sr[0],l.blockedOn===null);)UE(l),l.blockedOn===null&&Sr.shift()}var Qo=T.ReactCurrentBatchConfig,ca=!0;function f2(n,o,l,d){var g=ke,y=Qo.transition;Qo.transition=null;try{ke=1,Ed(n,o,l,d)}finally{ke=g,Qo.transition=y}}function p2(n,o,l,d){var g=ke,y=Qo.transition;Qo.transition=null;try{ke=4,Ed(n,o,l,d)}finally{ke=g,Qo.transition=y}}function Ed(n,o,l,d){if(ca){var g=yd(n,o,l,d);if(g===null)Md(n,o,d,ua,l),PE(n,d);else if(u2(g,n,o,l,d))d.stopPropagation();else if(PE(n,d),o&4&&-1<c2.indexOf(n)){for(;g!==null;){var y=Oi(g);if(y!==null&&LE(y),y=yd(n,o,l,d),y===null&&Md(n,o,d,ua,l),y===g)break;g=y}g!==null&&d.stopPropagation()}else Md(n,o,d,null,l)}}var ua=null;function yd(n,o,l,d){if(ua=null,n=Kn(d),n=ro(n),n!==null)if(o=Qn(n),o===null)n=null;else if(l=o.tag,l===13){if(n=Ql(o),n!==null)return n;n=null}else if(l===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;n=null}else o!==n&&(n=null);return ua=n,null}function jE(n){switch(n){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(ta()){case li:return 1;case na:return 4;case Xo:case ai:return 16;case AE:return 536870912;default:return 16}default:return 16}}var _r=null,vd=null,da=null;function VE(){if(da)return da;var n,o=vd,l=o.length,d,g="value"in _r?_r.value:_r.textContent,y=g.length;for(n=0;n<l&&o[n]===g[n];n++);var R=l-n;for(d=1;d<=R&&o[l-d]===g[y-d];d++);return da=g.slice(n,1<d?1-d:void 0)}function fa(n){var o=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&o===13&&(n=13)):n=o,n===10&&(n=13),32<=n||n===13?n:0}function pa(){return!0}function $E(){return!1}function Bt(n){function o(l,d,g,y,R){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=y,this.target=R,this.currentTarget=null;for(var P in n)n.hasOwnProperty(P)&&(l=n[P],this[P]=l?l(y):y[P]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?pa:$E,this.isPropagationStopped=$E,this}return z(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=pa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=pa)},persist:function(){},isPersistent:pa}),o}var qo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},xd=Bt(qo),gi=z({},qo,{view:0,detail:0}),h2=Bt(gi),Sd,_d,Ei,ha=z({},gi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Nd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Ei&&(Ei&&n.type==="mousemove"?(Sd=n.screenX-Ei.screenX,_d=n.screenY-Ei.screenY):_d=Sd=0,Ei=n),Sd)},movementY:function(n){return"movementY"in n?n.movementY:_d}}),HE=Bt(ha),m2=z({},ha,{dataTransfer:0}),g2=Bt(m2),E2=z({},gi,{relatedTarget:0}),wd=Bt(E2),y2=z({},qo,{animationName:0,elapsedTime:0,pseudoElement:0}),v2=Bt(y2),x2=z({},qo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),S2=Bt(x2),_2=z({},qo,{data:0}),BE=Bt(_2),w2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N2={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"},R2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function T2(n){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(n):(n=R2[n])?!!o[n]:!1}function Nd(){return T2}var O2=z({},gi,{key:function(n){if(n.key){var o=w2[n.key]||n.key;if(o!=="Unidentified")return o}return n.type==="keypress"?(n=fa(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?N2[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Nd,charCode:function(n){return n.type==="keypress"?fa(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?fa(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),C2=Bt(O2),A2=z({},ha,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zE=Bt(A2),I2=z({},gi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Nd}),b2=Bt(I2),L2=z({},qo,{propertyName:0,elapsedTime:0,pseudoElement:0}),D2=Bt(L2),k2=z({},ha,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),M2=Bt(k2),P2=[9,13,27,32],Rd=u&&"CompositionEvent"in window,yi=null;u&&"documentMode"in document&&(yi=document.documentMode);var U2=u&&"TextEvent"in window&&!yi,WE=u&&(!Rd||yi&&8<yi&&11>=yi),GE=" ",YE=!1;function KE(n,o){switch(n){case"keyup":return P2.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function XE(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Zo=!1;function F2(n,o){switch(n){case"compositionend":return XE(o);case"keypress":return o.which!==32?null:(YE=!0,GE);case"textInput":return n=o.data,n===GE&&YE?null:n;default:return null}}function j2(n,o){if(Zo)return n==="compositionend"||!Rd&&KE(n,o)?(n=VE(),da=vd=_r=null,Zo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return WE&&o.locale!=="ko"?null:o.data;default:return null}}var V2={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 QE(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o==="input"?!!V2[n.type]:o==="textarea"}function qE(n,o,l,d){Wl(d),o=va(o,"onChange"),0<o.length&&(l=new xd("onChange","change",null,l,d),n.push({event:l,listeners:o}))}var vi=null,xi=null;function $2(n){my(n,0)}function ma(n){var o=rs(n);if(Je(o))return n}function H2(n,o){if(n==="change")return o}var ZE=!1;if(u){var Td;if(u){var Od="oninput"in document;if(!Od){var JE=document.createElement("div");JE.setAttribute("oninput","return;"),Od=typeof JE.oninput=="function"}Td=Od}else Td=!1;ZE=Td&&(!document.documentMode||9<document.documentMode)}function ey(){vi&&(vi.detachEvent("onpropertychange",ty),xi=vi=null)}function ty(n){if(n.propertyName==="value"&&ma(xi)){var o=[];qE(o,xi,n,Kn(n)),Xl($2,o)}}function B2(n,o,l){n==="focusin"?(ey(),vi=o,xi=l,vi.attachEvent("onpropertychange",ty)):n==="focusout"&&ey()}function z2(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ma(xi)}function W2(n,o){if(n==="click")return ma(o)}function G2(n,o){if(n==="input"||n==="change")return ma(o)}function Y2(n,o){return n===o&&(n!==0||1/n===1/o)||n!==n&&o!==o}var gn=typeof Object.is=="function"?Object.is:Y2;function Si(n,o){if(gn(n,o))return!0;if(typeof n!="object"||n===null||typeof o!="object"||o===null)return!1;var l=Object.keys(n),d=Object.keys(o);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!f.call(o,g)||!gn(n[g],o[g]))return!1}return!0}function ny(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function ry(n,o){var l=ny(n);n=0;for(var d;l;){if(l.nodeType===3){if(d=n+l.textContent.length,n<=o&&d>=o)return{node:l,offset:o-n};n=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=ny(l)}}function oy(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?oy(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function sy(){for(var n=window,o=wt();o instanceof n.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)n=o.contentWindow;else break;o=wt(n.document)}return o}function Cd(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o&&(o==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||o==="textarea"||n.contentEditable==="true")}function K2(n){var o=sy(),l=n.focusedElem,d=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&oy(l.ownerDocument.documentElement,l)){if(d!==null&&Cd(l)){if(o=d.start,n=d.end,n===void 0&&(n=o),"selectionStart"in l)l.selectionStart=o,l.selectionEnd=Math.min(n,l.value.length);else if(n=(o=l.ownerDocument||document)&&o.defaultView||window,n.getSelection){n=n.getSelection();var g=l.textContent.length,y=Math.min(d.start,g);d=d.end===void 0?y:Math.min(d.end,g),!n.extend&&y>d&&(g=d,d=y,y=g),g=ry(l,y);var R=ry(l,d);g&&R&&(n.rangeCount!==1||n.anchorNode!==g.node||n.anchorOffset!==g.offset||n.focusNode!==R.node||n.focusOffset!==R.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),n.removeAllRanges(),y>d?(n.addRange(o),n.extend(R.node,R.offset)):(o.setEnd(R.node,R.offset),n.addRange(o)))}}for(o=[],n=l;n=n.parentNode;)n.nodeType===1&&o.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<o.length;l++)n=o[l],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var X2=u&&"documentMode"in document&&11>=document.documentMode,Jo=null,Ad=null,_i=null,Id=!1;function iy(n,o,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Id||Jo==null||Jo!==wt(d)||(d=Jo,"selectionStart"in d&&Cd(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),_i&&Si(_i,d)||(_i=d,d=va(Ad,"onSelect"),0<d.length&&(o=new xd("onSelect","select",null,o,l),n.push({event:o,listeners:d}),o.target=Jo)))}function ga(n,o){var l={};return l[n.toLowerCase()]=o.toLowerCase(),l["Webkit"+n]="webkit"+o,l["Moz"+n]="moz"+o,l}var es={animationend:ga("Animation","AnimationEnd"),animationiteration:ga("Animation","AnimationIteration"),animationstart:ga("Animation","AnimationStart"),transitionend:ga("Transition","TransitionEnd")},bd={},ly={};u&&(ly=document.createElement("div").style,"AnimationEvent"in window||(delete es.animationend.animation,delete es.animationiteration.animation,delete es.animationstart.animation),"TransitionEvent"in window||delete es.transitionend.transition);function Ea(n){if(bd[n])return bd[n];if(!es[n])return n;var o=es[n],l;for(l in o)if(o.hasOwnProperty(l)&&l in ly)return bd[n]=o[l];return n}var ay=Ea("animationend"),cy=Ea("animationiteration"),uy=Ea("animationstart"),dy=Ea("transitionend"),fy=new Map,py="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function wr(n,o){fy.set(n,o),a(o,[n])}for(var Ld=0;Ld<py.length;Ld++){var Dd=py[Ld],Q2=Dd.toLowerCase(),q2=Dd[0].toUpperCase()+Dd.slice(1);wr(Q2,"on"+q2)}wr(ay,"onAnimationEnd"),wr(cy,"onAnimationIteration"),wr(uy,"onAnimationStart"),wr("dblclick","onDoubleClick"),wr("focusin","onFocus"),wr("focusout","onBlur"),wr(dy,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),a("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),a("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),a("onBeforeInput",["compositionend","keypress","textInput","paste"]),a("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),a("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wi="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(" "),Z2=new Set("cancel close invalid load scroll toggle".split(" ").concat(wi));function hy(n,o,l){var d=n.type||"unknown-event";n.currentTarget=l,ad(d,o,void 0,n),n.currentTarget=null}function my(n,o){o=(o&4)!==0;for(var l=0;l<n.length;l++){var d=n[l],g=d.event;d=d.listeners;e:{var y=void 0;if(o)for(var R=d.length-1;0<=R;R--){var P=d[R],H=P.instance,J=P.currentTarget;if(P=P.listener,H!==y&&g.isPropagationStopped())break e;hy(g,P,J),y=H}else for(R=0;R<d.length;R++){if(P=d[R],H=P.instance,J=P.currentTarget,P=P.listener,H!==y&&g.isPropagationStopped())break e;hy(g,P,J),y=H}}}if(no)throw n=si,no=!1,si=null,n}function je(n,o){var l=o[$d];l===void 0&&(l=o[$d]=new Set);var d=n+"__bubble";l.has(d)||(gy(o,n,2,!1),l.add(d))}function kd(n,o,l){var d=0;o&&(d|=4),gy(l,n,d,o)}var ya="_reactListening"+Math.random().toString(36).slice(2);function Ni(n){if(!n[ya]){n[ya]=!0,s.forEach(function(l){l!=="selectionchange"&&(Z2.has(l)||kd(l,!1,n),kd(l,!0,n))});var o=n.nodeType===9?n:n.ownerDocument;o===null||o[ya]||(o[ya]=!0,kd("selectionchange",!1,o))}}function gy(n,o,l,d){switch(jE(o)){case 1:var g=f2;break;case 4:g=p2;break;default:g=Ed}l=g.bind(null,o,l,n),g=void 0,!oi||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(g=!0),d?g!==void 0?n.addEventListener(o,l,{capture:!0,passive:g}):n.addEventListener(o,l,!0):g!==void 0?n.addEventListener(o,l,{passive:g}):n.addEventListener(o,l,!1)}function Md(n,o,l,d,g){var y=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var R=d.tag;if(R===3||R===4){var P=d.stateNode.containerInfo;if(P===g||P.nodeType===8&&P.parentNode===g)break;if(R===4)for(R=d.return;R!==null;){var H=R.tag;if((H===3||H===4)&&(H=R.stateNode.containerInfo,H===g||H.nodeType===8&&H.parentNode===g))return;R=R.return}for(;P!==null;){if(R=ro(P),R===null)return;if(H=R.tag,H===5||H===6){d=y=R;continue e}P=P.parentNode}}d=d.return}Xl(function(){var J=y,ie=Kn(l),ae=[];e:{var se=fy.get(n);if(se!==void 0){var fe=xd,ge=n;switch(n){case"keypress":if(fa(l)===0)break e;case"keydown":case"keyup":fe=C2;break;case"focusin":ge="focus",fe=wd;break;case"focusout":ge="blur",fe=wd;break;case"beforeblur":case"afterblur":fe=wd;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=HE;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=g2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=b2;break;case ay:case cy:case uy:fe=v2;break;case dy:fe=D2;break;case"scroll":fe=h2;break;case"wheel":fe=M2;break;case"copy":case"cut":case"paste":fe=S2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=zE}var Ee=(o&4)!==0,et=!Ee&&n==="scroll",q=Ee?se!==null?se+"Capture":null:se;Ee=[];for(var G=J,Z;G!==null;){Z=G;var ce=Z.stateNode;if(Z.tag===5&&ce!==null&&(Z=ce,q!==null&&(ce=Jr(G,q),ce!=null&&Ee.push(Ri(G,ce,Z)))),et)break;G=G.return}0<Ee.length&&(se=new fe(se,ge,null,l,ie),ae.push({event:se,listeners:Ee}))}}if((o&7)===0){e:{if(se=n==="mouseover"||n==="pointerover",fe=n==="mouseout"||n==="pointerout",se&&l!==qr&&(ge=l.relatedTarget||l.fromElement)&&(ro(ge)||ge[qn]))break e;if((fe||se)&&(se=ie.window===ie?ie:(se=ie.ownerDocument)?se.defaultView||se.parentWindow:window,fe?(ge=l.relatedTarget||l.toElement,fe=J,ge=ge?ro(ge):null,ge!==null&&(et=Qn(ge),ge!==et||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(fe=null,ge=J),fe!==ge)){if(Ee=HE,ce="onMouseLeave",q="onMouseEnter",G="mouse",(n==="pointerout"||n==="pointerover")&&(Ee=zE,ce="onPointerLeave",q="onPointerEnter",G="pointer"),et=fe==null?se:rs(fe),Z=ge==null?se:rs(ge),se=new Ee(ce,G+"leave",fe,l,ie),se.target=et,se.relatedTarget=Z,ce=null,ro(ie)===J&&(Ee=new Ee(q,G+"enter",ge,l,ie),Ee.target=Z,Ee.relatedTarget=et,ce=Ee),et=ce,fe&&ge)t:{for(Ee=fe,q=ge,G=0,Z=Ee;Z;Z=ts(Z))G++;for(Z=0,ce=q;ce;ce=ts(ce))Z++;for(;0<G-Z;)Ee=ts(Ee),G--;for(;0<Z-G;)q=ts(q),Z--;for(;G--;){if(Ee===q||q!==null&&Ee===q.alternate)break t;Ee=ts(Ee),q=ts(q)}Ee=null}else Ee=null;fe!==null&&Ey(ae,se,fe,Ee,!1),ge!==null&&et!==null&&Ey(ae,et,ge,Ee,!0)}}e:{if(se=J?rs(J):window,fe=se.nodeName&&se.nodeName.toLowerCase(),fe==="select"||fe==="input"&&se.type==="file")var ve=H2;else if(QE(se))if(ZE)ve=G2;else{ve=z2;var Se=B2}else(fe=se.nodeName)&&fe.toLowerCase()==="input"&&(se.type==="checkbox"||se.type==="radio")&&(ve=W2);if(ve&&(ve=ve(n,J))){qE(ae,ve,l,ie);break e}Se&&Se(n,se,J),n==="focusout"&&(Se=se._wrapperState)&&Se.controlled&&se.type==="number"&&un(se,"number",se.value)}switch(Se=J?rs(J):window,n){case"focusin":(QE(Se)||Se.contentEditable==="true")&&(Jo=Se,Ad=J,_i=null);break;case"focusout":_i=Ad=Jo=null;break;case"mousedown":Id=!0;break;case"contextmenu":case"mouseup":case"dragend":Id=!1,iy(ae,l,ie);break;case"selectionchange":if(X2)break;case"keydown":case"keyup":iy(ae,l,ie)}var _e;if(Rd)e:{switch(n){case"compositionstart":var Ne="onCompositionStart";break e;case"compositionend":Ne="onCompositionEnd";break e;case"compositionupdate":Ne="onCompositionUpdate";break e}Ne=void 0}else Zo?KE(n,l)&&(Ne="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(WE&&l.locale!=="ko"&&(Zo||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&Zo&&(_e=VE()):(_r=ie,vd="value"in _r?_r.value:_r.textContent,Zo=!0)),Se=va(J,Ne),0<Se.length&&(Ne=new BE(Ne,n,null,l,ie),ae.push({event:Ne,listeners:Se}),_e?Ne.data=_e:(_e=XE(l),_e!==null&&(Ne.data=_e)))),(_e=U2?F2(n,l):j2(n,l))&&(J=va(J,"onBeforeInput"),0<J.length&&(ie=new BE("onBeforeInput","beforeinput",null,l,ie),ae.push({event:ie,listeners:J}),ie.data=_e))}my(ae,o)})}function Ri(n,o,l){return{instance:n,listener:o,currentTarget:l}}function va(n,o){for(var l=o+"Capture",d=[];n!==null;){var g=n,y=g.stateNode;g.tag===5&&y!==null&&(g=y,y=Jr(n,l),y!=null&&d.unshift(Ri(n,y,g)),y=Jr(n,o),y!=null&&d.push(Ri(n,y,g))),n=n.return}return d}function ts(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Ey(n,o,l,d,g){for(var y=o._reactName,R=[];l!==null&&l!==d;){var P=l,H=P.alternate,J=P.stateNode;if(H!==null&&H===d)break;P.tag===5&&J!==null&&(P=J,g?(H=Jr(l,y),H!=null&&R.unshift(Ri(l,H,P))):g||(H=Jr(l,y),H!=null&&R.push(Ri(l,H,P)))),l=l.return}R.length!==0&&n.push({event:o,listeners:R})}var J2=/\r\n?/g,eb=/\u0000|\uFFFD/g;function yy(n){return(typeof n=="string"?n:""+n).replace(J2,`
42
+ `).replace(eb,"")}function xa(n,o,l){if(o=yy(o),yy(n)!==o&&l)throw Error(r(425))}function Sa(){}var Pd=null,Ud=null;function Fd(n,o){return n==="textarea"||n==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var jd=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,vy=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof vy<"u"?function(n){return vy.resolve(null).then(n).catch(rb)}:jd;function rb(n){setTimeout(function(){throw n})}function Vd(n,o){var l=o,d=0;do{var g=l.nextSibling;if(n.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"){if(d===0){n.removeChild(g),mi(o);return}d--}else l!=="$"&&l!=="$?"&&l!=="$!"||d++;l=g}while(l);mi(o)}function Nr(n){for(;n!=null;n=n.nextSibling){var o=n.nodeType;if(o===1||o===3)break;if(o===8){if(o=n.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return n}function xy(n){n=n.previousSibling;for(var o=0;n;){if(n.nodeType===8){var l=n.data;if(l==="$"||l==="$!"||l==="$?"){if(o===0)return n;o--}else l==="/$"&&o++}n=n.previousSibling}return null}var ns=Math.random().toString(36).slice(2),Dn="__reactFiber$"+ns,Ti="__reactProps$"+ns,qn="__reactContainer$"+ns,$d="__reactEvents$"+ns,ob="__reactListeners$"+ns,sb="__reactHandles$"+ns;function ro(n){var o=n[Dn];if(o)return o;for(var l=n.parentNode;l;){if(o=l[qn]||l[Dn]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(n=xy(n);n!==null;){if(l=n[Dn])return l;n=xy(n)}return o}n=l,l=n.parentNode}return null}function Oi(n){return n=n[Dn]||n[qn],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function rs(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function _a(n){return n[Ti]||null}var Hd=[],os=-1;function Rr(n){return{current:n}}function Ve(n){0>os||(n.current=Hd[os],Hd[os]=null,os--)}function Fe(n,o){os++,Hd[os]=n.current,n.current=o}var Tr={},Et=Rr(Tr),Dt=Rr(!1),oo=Tr;function ss(n,o){var l=n.type.contextTypes;if(!l)return Tr;var d=n.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===o)return d.__reactInternalMemoizedMaskedChildContext;var g={},y;for(y in l)g[y]=o[y];return d&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=o,n.__reactInternalMemoizedMaskedChildContext=g),g}function kt(n){return n=n.childContextTypes,n!=null}function wa(){Ve(Dt),Ve(Et)}function Sy(n,o,l){if(Et.current!==Tr)throw Error(r(168));Fe(Et,o),Fe(Dt,l)}function _y(n,o,l){var d=n.stateNode;if(o=o.childContextTypes,typeof d.getChildContext!="function")return l;d=d.getChildContext();for(var g in d)if(!(g in o))throw Error(r(108,he(n)||"Unknown",g));return z({},l,d)}function Na(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Tr,oo=Et.current,Fe(Et,n),Fe(Dt,Dt.current),!0}function wy(n,o,l){var d=n.stateNode;if(!d)throw Error(r(169));l?(n=_y(n,o,oo),d.__reactInternalMemoizedMergedChildContext=n,Ve(Dt),Ve(Et),Fe(Et,n)):Ve(Dt),Fe(Dt,l)}var Zn=null,Ra=!1,Bd=!1;function Ny(n){Zn===null?Zn=[n]:Zn.push(n)}function ib(n){Ra=!0,Ny(n)}function Or(){if(!Bd&&Zn!==null){Bd=!0;var n=0,o=ke;try{var l=Zn;for(ke=1;n<l.length;n++){var d=l[n];do d=d(!0);while(d!==null)}Zn=null,Ra=!1}catch(g){throw Zn!==null&&(Zn=Zn.slice(n+1)),Jl(li,Or),g}finally{ke=o,Bd=!1}}return null}var is=[],ls=0,Ta=null,Oa=0,Zt=[],Jt=0,so=null,Jn=1,er="";function io(n,o){is[ls++]=Oa,is[ls++]=Ta,Ta=n,Oa=o}function Ry(n,o,l){Zt[Jt++]=Jn,Zt[Jt++]=er,Zt[Jt++]=so,so=n;var d=Jn;n=er;var g=32-mn(d)-1;d&=~(1<<g),l+=1;var y=32-mn(o)+g;if(30<y){var R=g-g%5;y=(d&(1<<R)-1).toString(32),d>>=R,g-=R,Jn=1<<32-mn(o)+g|l<<g|d,er=y+n}else Jn=1<<y|l<<g|d,er=n}function zd(n){n.return!==null&&(io(n,1),Ry(n,1,0))}function Wd(n){for(;n===Ta;)Ta=is[--ls],is[ls]=null,Oa=is[--ls],is[ls]=null;for(;n===so;)so=Zt[--Jt],Zt[Jt]=null,er=Zt[--Jt],Zt[Jt]=null,Jn=Zt[--Jt],Zt[Jt]=null}var zt=null,Wt=null,ze=!1,En=null;function Ty(n,o){var l=rn(5,null,null,0);l.elementType="DELETED",l.stateNode=o,l.return=n,o=n.deletions,o===null?(n.deletions=[l],n.flags|=16):o.push(l)}function Oy(n,o){switch(n.tag){case 5:var l=n.type;return o=o.nodeType!==1||l.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(n.stateNode=o,zt=n,Wt=Nr(o.firstChild),!0):!1;case 6:return o=n.pendingProps===""||o.nodeType!==3?null:o,o!==null?(n.stateNode=o,zt=n,Wt=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(l=so!==null?{id:Jn,overflow:er}:null,n.memoizedState={dehydrated:o,treeContext:l,retryLane:1073741824},l=rn(18,null,null,0),l.stateNode=o,l.return=n,n.child=l,zt=n,Wt=null,!0):!1;default:return!1}}function Gd(n){return(n.mode&1)!==0&&(n.flags&128)===0}function Yd(n){if(ze){var o=Wt;if(o){var l=o;if(!Oy(n,o)){if(Gd(n))throw Error(r(418));o=Nr(l.nextSibling);var d=zt;o&&Oy(n,o)?Ty(d,l):(n.flags=n.flags&-4097|2,ze=!1,zt=n)}}else{if(Gd(n))throw Error(r(418));n.flags=n.flags&-4097|2,ze=!1,zt=n}}}function Cy(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;zt=n}function Ca(n){if(n!==zt)return!1;if(!ze)return Cy(n),ze=!0,!1;var o;if((o=n.tag!==3)&&!(o=n.tag!==5)&&(o=n.type,o=o!=="head"&&o!=="body"&&!Fd(n.type,n.memoizedProps)),o&&(o=Wt)){if(Gd(n))throw Ay(),Error(r(418));for(;o;)Ty(n,o),o=Nr(o.nextSibling)}if(Cy(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));e:{for(n=n.nextSibling,o=0;n;){if(n.nodeType===8){var l=n.data;if(l==="/$"){if(o===0){Wt=Nr(n.nextSibling);break e}o--}else l!=="$"&&l!=="$!"&&l!=="$?"||o++}n=n.nextSibling}Wt=null}}else Wt=zt?Nr(n.stateNode.nextSibling):null;return!0}function Ay(){for(var n=Wt;n;)n=Nr(n.nextSibling)}function as(){Wt=zt=null,ze=!1}function Kd(n){En===null?En=[n]:En.push(n)}var lb=T.ReactCurrentBatchConfig;function yn(n,o){if(n&&n.defaultProps){o=z({},o),n=n.defaultProps;for(var l in n)o[l]===void 0&&(o[l]=n[l]);return o}return o}var Aa=Rr(null),Ia=null,cs=null,Xd=null;function Qd(){Xd=cs=Ia=null}function qd(n){var o=Aa.current;Ve(Aa),n._currentValue=o}function Zd(n,o,l){for(;n!==null;){var d=n.alternate;if((n.childLanes&o)!==o?(n.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),n===l)break;n=n.return}}function us(n,o){Ia=n,Xd=cs=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&o)!==0&&(Mt=!0),n.firstContext=null)}function en(n){var o=n._currentValue;if(Xd!==n)if(n={context:n,memoizedValue:o,next:null},cs===null){if(Ia===null)throw Error(r(308));cs=n,Ia.dependencies={lanes:0,firstContext:n}}else cs=cs.next=n;return o}var lo=null;function Jd(n){lo===null?lo=[n]:lo.push(n)}function Iy(n,o,l,d){var g=o.interleaved;return g===null?(l.next=l,Jd(o)):(l.next=g.next,g.next=l),o.interleaved=l,tr(n,d)}function tr(n,o){n.lanes|=o;var l=n.alternate;for(l!==null&&(l.lanes|=o),l=n,n=n.return;n!==null;)n.childLanes|=o,l=n.alternate,l!==null&&(l.childLanes|=o),l=n,n=n.return;return l.tag===3?l.stateNode:null}var Cr=!1;function ef(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function by(n,o){n=n.updateQueue,o.updateQueue===n&&(o.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function nr(n,o){return{eventTime:n,lane:o,tag:0,payload:null,callback:null,next:null}}function Ar(n,o,l){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(Ae&2)!==0){var g=d.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),d.pending=o,tr(n,l)}return g=d.interleaved,g===null?(o.next=o,Jd(d)):(o.next=g.next,g.next=o),d.interleaved=o,tr(n,l)}function ba(n,o,l){if(o=o.updateQueue,o!==null&&(o=o.shared,(l&4194240)!==0)){var d=o.lanes;d&=n.pendingLanes,l|=d,o.lanes=l,hd(n,l)}}function Ly(n,o){var l=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var R={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};y===null?g=y=R:y=y.next=R,l=l.next}while(l!==null);y===null?g=y=o:y=y.next=o}else g=y=o;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:d.shared,effects:d.effects},n.updateQueue=l;return}n=l.lastBaseUpdate,n===null?l.firstBaseUpdate=o:n.next=o,l.lastBaseUpdate=o}function La(n,o,l,d){var g=n.updateQueue;Cr=!1;var y=g.firstBaseUpdate,R=g.lastBaseUpdate,P=g.shared.pending;if(P!==null){g.shared.pending=null;var H=P,J=H.next;H.next=null,R===null?y=J:R.next=J,R=H;var ie=n.alternate;ie!==null&&(ie=ie.updateQueue,P=ie.lastBaseUpdate,P!==R&&(P===null?ie.firstBaseUpdate=J:P.next=J,ie.lastBaseUpdate=H))}if(y!==null){var ae=g.baseState;R=0,ie=J=H=null,P=y;do{var se=P.lane,fe=P.eventTime;if((d&se)===se){ie!==null&&(ie=ie.next={eventTime:fe,lane:0,tag:P.tag,payload:P.payload,callback:P.callback,next:null});e:{var ge=n,Ee=P;switch(se=o,fe=l,Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ae=ge.call(fe,ae,se);break e}ae=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,se=typeof ge=="function"?ge.call(fe,ae,se):ge,se==null)break e;ae=z({},ae,se);break e;case 2:Cr=!0}}P.callback!==null&&P.lane!==0&&(n.flags|=64,se=g.effects,se===null?g.effects=[P]:se.push(P))}else fe={eventTime:fe,lane:se,tag:P.tag,payload:P.payload,callback:P.callback,next:null},ie===null?(J=ie=fe,H=ae):ie=ie.next=fe,R|=se;if(P=P.next,P===null){if(P=g.shared.pending,P===null)break;se=P,P=se.next,se.next=null,g.lastBaseUpdate=se,g.shared.pending=null}}while(!0);if(ie===null&&(H=ae),g.baseState=H,g.firstBaseUpdate=J,g.lastBaseUpdate=ie,o=g.shared.interleaved,o!==null){g=o;do R|=g.lane,g=g.next;while(g!==o)}else y===null&&(g.shared.lanes=0);uo|=R,n.lanes=R,n.memoizedState=ae}}function Dy(n,o,l){if(n=o.effects,o.effects=null,n!==null)for(o=0;o<n.length;o++){var d=n[o],g=d.callback;if(g!==null){if(d.callback=null,d=l,typeof g!="function")throw Error(r(191,g));g.call(d)}}}var ky=new e.Component().refs;function tf(n,o,l,d){o=n.memoizedState,l=l(d,o),l=l==null?o:z({},o,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Da={isMounted:function(n){return(n=n._reactInternals)?Qn(n)===n:!1},enqueueSetState:function(n,o,l){n=n._reactInternals;var d=Rt(),g=Dr(n),y=nr(d,g);y.payload=o,l!=null&&(y.callback=l),o=Ar(n,y,g),o!==null&&(Sn(o,n,g,d),ba(o,n,g))},enqueueReplaceState:function(n,o,l){n=n._reactInternals;var d=Rt(),g=Dr(n),y=nr(d,g);y.tag=1,y.payload=o,l!=null&&(y.callback=l),o=Ar(n,y,g),o!==null&&(Sn(o,n,g,d),ba(o,n,g))},enqueueForceUpdate:function(n,o){n=n._reactInternals;var l=Rt(),d=Dr(n),g=nr(l,d);g.tag=2,o!=null&&(g.callback=o),o=Ar(n,g,d),o!==null&&(Sn(o,n,d,l),ba(o,n,d))}};function My(n,o,l,d,g,y,R){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,y,R):o.prototype&&o.prototype.isPureReactComponent?!Si(l,d)||!Si(g,y):!0}function Py(n,o,l){var d=!1,g=Tr,y=o.contextType;return typeof y=="object"&&y!==null?y=en(y):(g=kt(o)?oo:Et.current,d=o.contextTypes,y=(d=d!=null)?ss(n,g):Tr),o=new o(l,y),n.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Da,n.stateNode=o,o._reactInternals=n,d&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=g,n.__reactInternalMemoizedMaskedChildContext=y),o}function Uy(n,o,l,d){n=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(l,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(l,d),o.state!==n&&Da.enqueueReplaceState(o,o.state,null)}function nf(n,o,l,d){var g=n.stateNode;g.props=l,g.state=n.memoizedState,g.refs=ky,ef(n);var y=o.contextType;typeof y=="object"&&y!==null?g.context=en(y):(y=kt(o)?oo:Et.current,g.context=ss(n,y)),g.state=n.memoizedState,y=o.getDerivedStateFromProps,typeof y=="function"&&(tf(n,o,y,l),g.state=n.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(o=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),o!==g.state&&Da.enqueueReplaceState(g,g.state,null),La(n,l,g,d),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308)}function Ci(n,o,l){if(n=l.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(l._owner){if(l=l._owner,l){if(l.tag!==1)throw Error(r(309));var d=l.stateNode}if(!d)throw Error(r(147,n));var g=d,y=""+n;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===y?o.ref:(o=function(R){var P=g.refs;P===ky&&(P=g.refs={}),R===null?delete P[y]:P[y]=R},o._stringRef=y,o)}if(typeof n!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,n))}return n}function ka(n,o){throw n=Object.prototype.toString.call(o),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":n))}function Fy(n){var o=n._init;return o(n._payload)}function jy(n){function o(q,G){if(n){var Z=q.deletions;Z===null?(q.deletions=[G],q.flags|=16):Z.push(G)}}function l(q,G){if(!n)return null;for(;G!==null;)o(q,G),G=G.sibling;return null}function d(q,G){for(q=new Map;G!==null;)G.key!==null?q.set(G.key,G):q.set(G.index,G),G=G.sibling;return q}function g(q,G){return q=Mr(q,G),q.index=0,q.sibling=null,q}function y(q,G,Z){return q.index=Z,n?(Z=q.alternate,Z!==null?(Z=Z.index,Z<G?(q.flags|=2,G):Z):(q.flags|=2,G)):(q.flags|=1048576,G)}function R(q){return n&&q.alternate===null&&(q.flags|=2),q}function P(q,G,Z,ce){return G===null||G.tag!==6?(G=Vf(Z,q.mode,ce),G.return=q,G):(G=g(G,Z),G.return=q,G)}function H(q,G,Z,ce){var ve=Z.type;return ve===F?ie(q,G,Z.props.children,ce,Z.key):G!==null&&(G.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===j&&Fy(ve)===G.type)?(ce=g(G,Z.props),ce.ref=Ci(q,G,Z),ce.return=q,ce):(ce=Ja(Z.type,Z.key,Z.props,null,q.mode,ce),ce.ref=Ci(q,G,Z),ce.return=q,ce)}function J(q,G,Z,ce){return G===null||G.tag!==4||G.stateNode.containerInfo!==Z.containerInfo||G.stateNode.implementation!==Z.implementation?(G=$f(Z,q.mode,ce),G.return=q,G):(G=g(G,Z.children||[]),G.return=q,G)}function ie(q,G,Z,ce,ve){return G===null||G.tag!==7?(G=mo(Z,q.mode,ce,ve),G.return=q,G):(G=g(G,Z),G.return=q,G)}function ae(q,G,Z){if(typeof G=="string"&&G!==""||typeof G=="number")return G=Vf(""+G,q.mode,Z),G.return=q,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case A:return Z=Ja(G.type,G.key,G.props,null,q.mode,Z),Z.ref=Ci(q,null,G),Z.return=q,Z;case L:return G=$f(G,q.mode,Z),G.return=q,G;case j:var ce=G._init;return ae(q,ce(G._payload),Z)}if(Ht(G)||$(G))return G=mo(G,q.mode,Z,null),G.return=q,G;ka(q,G)}return null}function se(q,G,Z,ce){var ve=G!==null?G.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number")return ve!==null?null:P(q,G,""+Z,ce);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case A:return Z.key===ve?H(q,G,Z,ce):null;case L:return Z.key===ve?J(q,G,Z,ce):null;case j:return ve=Z._init,se(q,G,ve(Z._payload),ce)}if(Ht(Z)||$(Z))return ve!==null?null:ie(q,G,Z,ce,null);ka(q,Z)}return null}function fe(q,G,Z,ce,ve){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return q=q.get(Z)||null,P(G,q,""+ce,ve);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case A:return q=q.get(ce.key===null?Z:ce.key)||null,H(G,q,ce,ve);case L:return q=q.get(ce.key===null?Z:ce.key)||null,J(G,q,ce,ve);case j:var Se=ce._init;return fe(q,G,Z,Se(ce._payload),ve)}if(Ht(ce)||$(ce))return q=q.get(Z)||null,ie(G,q,ce,ve,null);ka(G,ce)}return null}function ge(q,G,Z,ce){for(var ve=null,Se=null,_e=G,Ne=G=0,ct=null;_e!==null&&Ne<Z.length;Ne++){_e.index>Ne?(ct=_e,_e=null):ct=_e.sibling;var be=se(q,_e,Z[Ne],ce);if(be===null){_e===null&&(_e=ct);break}n&&_e&&be.alternate===null&&o(q,_e),G=y(be,G,Ne),Se===null?ve=be:Se.sibling=be,Se=be,_e=ct}if(Ne===Z.length)return l(q,_e),ze&&io(q,Ne),ve;if(_e===null){for(;Ne<Z.length;Ne++)_e=ae(q,Z[Ne],ce),_e!==null&&(G=y(_e,G,Ne),Se===null?ve=_e:Se.sibling=_e,Se=_e);return ze&&io(q,Ne),ve}for(_e=d(q,_e);Ne<Z.length;Ne++)ct=fe(_e,q,Ne,Z[Ne],ce),ct!==null&&(n&&ct.alternate!==null&&_e.delete(ct.key===null?Ne:ct.key),G=y(ct,G,Ne),Se===null?ve=ct:Se.sibling=ct,Se=ct);return n&&_e.forEach(function(Pr){return o(q,Pr)}),ze&&io(q,Ne),ve}function Ee(q,G,Z,ce){var ve=$(Z);if(typeof ve!="function")throw Error(r(150));if(Z=ve.call(Z),Z==null)throw Error(r(151));for(var Se=ve=null,_e=G,Ne=G=0,ct=null,be=Z.next();_e!==null&&!be.done;Ne++,be=Z.next()){_e.index>Ne?(ct=_e,_e=null):ct=_e.sibling;var Pr=se(q,_e,be.value,ce);if(Pr===null){_e===null&&(_e=ct);break}n&&_e&&Pr.alternate===null&&o(q,_e),G=y(Pr,G,Ne),Se===null?ve=Pr:Se.sibling=Pr,Se=Pr,_e=ct}if(be.done)return l(q,_e),ze&&io(q,Ne),ve;if(_e===null){for(;!be.done;Ne++,be=Z.next())be=ae(q,be.value,ce),be!==null&&(G=y(be,G,Ne),Se===null?ve=be:Se.sibling=be,Se=be);return ze&&io(q,Ne),ve}for(_e=d(q,_e);!be.done;Ne++,be=Z.next())be=fe(_e,q,Ne,be.value,ce),be!==null&&(n&&be.alternate!==null&&_e.delete(be.key===null?Ne:be.key),G=y(be,G,Ne),Se===null?ve=be:Se.sibling=be,Se=be);return n&&_e.forEach(function(Vb){return o(q,Vb)}),ze&&io(q,Ne),ve}function et(q,G,Z,ce){if(typeof Z=="object"&&Z!==null&&Z.type===F&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case A:e:{for(var ve=Z.key,Se=G;Se!==null;){if(Se.key===ve){if(ve=Z.type,ve===F){if(Se.tag===7){l(q,Se.sibling),G=g(Se,Z.props.children),G.return=q,q=G;break e}}else if(Se.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===j&&Fy(ve)===Se.type){l(q,Se.sibling),G=g(Se,Z.props),G.ref=Ci(q,Se,Z),G.return=q,q=G;break e}l(q,Se);break}else o(q,Se);Se=Se.sibling}Z.type===F?(G=mo(Z.props.children,q.mode,ce,Z.key),G.return=q,q=G):(ce=Ja(Z.type,Z.key,Z.props,null,q.mode,ce),ce.ref=Ci(q,G,Z),ce.return=q,q=ce)}return R(q);case L:e:{for(Se=Z.key;G!==null;){if(G.key===Se)if(G.tag===4&&G.stateNode.containerInfo===Z.containerInfo&&G.stateNode.implementation===Z.implementation){l(q,G.sibling),G=g(G,Z.children||[]),G.return=q,q=G;break e}else{l(q,G);break}else o(q,G);G=G.sibling}G=$f(Z,q.mode,ce),G.return=q,q=G}return R(q);case j:return Se=Z._init,et(q,G,Se(Z._payload),ce)}if(Ht(Z))return ge(q,G,Z,ce);if($(Z))return Ee(q,G,Z,ce);ka(q,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"?(Z=""+Z,G!==null&&G.tag===6?(l(q,G.sibling),G=g(G,Z),G.return=q,q=G):(l(q,G),G=Vf(Z,q.mode,ce),G.return=q,q=G),R(q)):l(q,G)}return et}var ds=jy(!0),Vy=jy(!1),Ai={},kn=Rr(Ai),Ii=Rr(Ai),bi=Rr(Ai);function ao(n){if(n===Ai)throw Error(r(174));return n}function rf(n,o){switch(Fe(bi,o),Fe(Ii,n),Fe(kn,Ai),n=o.nodeType,n){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:pn(null,"");break;default:n=n===8?o.parentNode:o,o=n.namespaceURI||null,n=n.tagName,o=pn(o,n)}Ve(kn),Fe(kn,o)}function fs(){Ve(kn),Ve(Ii),Ve(bi)}function $y(n){ao(bi.current);var o=ao(kn.current),l=pn(o,n.type);o!==l&&(Fe(Ii,n),Fe(kn,l))}function of(n){Ii.current===n&&(Ve(kn),Ve(Ii))}var Ge=Rr(0);function Ma(n){for(var o=n;o!==null;){if(o.tag===13){var l=o.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||l.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var sf=[];function lf(){for(var n=0;n<sf.length;n++)sf[n]._workInProgressVersionPrimary=null;sf.length=0}var Pa=T.ReactCurrentDispatcher,af=T.ReactCurrentBatchConfig,co=0,Ye=null,ot=null,lt=null,Ua=!1,Li=!1,Di=0,ab=0;function yt(){throw Error(r(321))}function cf(n,o){if(o===null)return!1;for(var l=0;l<o.length&&l<n.length;l++)if(!gn(n[l],o[l]))return!1;return!0}function uf(n,o,l,d,g,y){if(co=y,Ye=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Pa.current=n===null||n.memoizedState===null?fb:pb,n=l(d,g),Li){y=0;do{if(Li=!1,Di=0,25<=y)throw Error(r(301));y+=1,lt=ot=null,o.updateQueue=null,Pa.current=hb,n=l(d,g)}while(Li)}if(Pa.current=Va,o=ot!==null&&ot.next!==null,co=0,lt=ot=Ye=null,Ua=!1,o)throw Error(r(300));return n}function df(){var n=Di!==0;return Di=0,n}function Mn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return lt===null?Ye.memoizedState=lt=n:lt=lt.next=n,lt}function tn(){if(ot===null){var n=Ye.alternate;n=n!==null?n.memoizedState:null}else n=ot.next;var o=lt===null?Ye.memoizedState:lt.next;if(o!==null)lt=o,ot=n;else{if(n===null)throw Error(r(310));ot=n,n={memoizedState:ot.memoizedState,baseState:ot.baseState,baseQueue:ot.baseQueue,queue:ot.queue,next:null},lt===null?Ye.memoizedState=lt=n:lt=lt.next=n}return lt}function ki(n,o){return typeof o=="function"?o(n):o}function ff(n){var o=tn(),l=o.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var d=ot,g=d.baseQueue,y=l.pending;if(y!==null){if(g!==null){var R=g.next;g.next=y.next,y.next=R}d.baseQueue=g=y,l.pending=null}if(g!==null){y=g.next,d=d.baseState;var P=R=null,H=null,J=y;do{var ie=J.lane;if((co&ie)===ie)H!==null&&(H=H.next={lane:0,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),d=J.hasEagerState?J.eagerState:n(d,J.action);else{var ae={lane:ie,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null};H===null?(P=H=ae,R=d):H=H.next=ae,Ye.lanes|=ie,uo|=ie}J=J.next}while(J!==null&&J!==y);H===null?R=d:H.next=P,gn(d,o.memoizedState)||(Mt=!0),o.memoizedState=d,o.baseState=R,o.baseQueue=H,l.lastRenderedState=d}if(n=l.interleaved,n!==null){g=n;do y=g.lane,Ye.lanes|=y,uo|=y,g=g.next;while(g!==n)}else g===null&&(l.lanes=0);return[o.memoizedState,l.dispatch]}function pf(n){var o=tn(),l=o.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var d=l.dispatch,g=l.pending,y=o.memoizedState;if(g!==null){l.pending=null;var R=g=g.next;do y=n(y,R.action),R=R.next;while(R!==g);gn(y,o.memoizedState)||(Mt=!0),o.memoizedState=y,o.baseQueue===null&&(o.baseState=y),l.lastRenderedState=y}return[y,d]}function Hy(){}function By(n,o){var l=Ye,d=tn(),g=o(),y=!gn(d.memoizedState,g);if(y&&(d.memoizedState=g,Mt=!0),d=d.queue,hf(Gy.bind(null,l,d,n),[n]),d.getSnapshot!==o||y||lt!==null&&lt.memoizedState.tag&1){if(l.flags|=2048,Mi(9,Wy.bind(null,l,d,g,o),void 0,null),at===null)throw Error(r(349));(co&30)!==0||zy(l,o,g)}return g}function zy(n,o,l){n.flags|=16384,n={getSnapshot:o,value:l},o=Ye.updateQueue,o===null?(o={lastEffect:null,stores:null},Ye.updateQueue=o,o.stores=[n]):(l=o.stores,l===null?o.stores=[n]:l.push(n))}function Wy(n,o,l,d){o.value=l,o.getSnapshot=d,Yy(o)&&Ky(n)}function Gy(n,o,l){return l(function(){Yy(o)&&Ky(n)})}function Yy(n){var o=n.getSnapshot;n=n.value;try{var l=o();return!gn(n,l)}catch{return!0}}function Ky(n){var o=tr(n,1);o!==null&&Sn(o,n,1,-1)}function Xy(n){var o=Mn();return typeof n=="function"&&(n=n()),o.memoizedState=o.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:n},o.queue=n,n=n.dispatch=db.bind(null,Ye,n),[o.memoizedState,n]}function Mi(n,o,l,d){return n={tag:n,create:o,destroy:l,deps:d,next:null},o=Ye.updateQueue,o===null?(o={lastEffect:null,stores:null},Ye.updateQueue=o,o.lastEffect=n.next=n):(l=o.lastEffect,l===null?o.lastEffect=n.next=n:(d=l.next,l.next=n,n.next=d,o.lastEffect=n)),n}function Qy(){return tn().memoizedState}function Fa(n,o,l,d){var g=Mn();Ye.flags|=n,g.memoizedState=Mi(1|o,l,void 0,d===void 0?null:d)}function ja(n,o,l,d){var g=tn();d=d===void 0?null:d;var y=void 0;if(ot!==null){var R=ot.memoizedState;if(y=R.destroy,d!==null&&cf(d,R.deps)){g.memoizedState=Mi(o,l,y,d);return}}Ye.flags|=n,g.memoizedState=Mi(1|o,l,y,d)}function qy(n,o){return Fa(8390656,8,n,o)}function hf(n,o){return ja(2048,8,n,o)}function Zy(n,o){return ja(4,2,n,o)}function Jy(n,o){return ja(4,4,n,o)}function e0(n,o){if(typeof o=="function")return n=n(),o(n),function(){o(null)};if(o!=null)return n=n(),o.current=n,function(){o.current=null}}function t0(n,o,l){return l=l!=null?l.concat([n]):null,ja(4,4,e0.bind(null,o,n),l)}function mf(){}function n0(n,o){var l=tn();o=o===void 0?null:o;var d=l.memoizedState;return d!==null&&o!==null&&cf(o,d[1])?d[0]:(l.memoizedState=[n,o],n)}function r0(n,o){var l=tn();o=o===void 0?null:o;var d=l.memoizedState;return d!==null&&o!==null&&cf(o,d[1])?d[0]:(n=n(),l.memoizedState=[n,o],n)}function o0(n,o,l){return(co&21)===0?(n.baseState&&(n.baseState=!1,Mt=!0),n.memoizedState=l):(gn(l,o)||(l=IE(),Ye.lanes|=l,uo|=l,n.baseState=!0),o)}function cb(n,o){var l=ke;ke=l!==0&&4>l?l:4,n(!0);var d=af.transition;af.transition={};try{n(!1),o()}finally{ke=l,af.transition=d}}function s0(){return tn().memoizedState}function ub(n,o,l){var d=Dr(n);if(l={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null},i0(n))l0(o,l);else if(l=Iy(n,o,l,d),l!==null){var g=Rt();Sn(l,n,d,g),a0(l,o,d)}}function db(n,o,l){var d=Dr(n),g={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null};if(i0(n))l0(o,g);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=o.lastRenderedReducer,y!==null))try{var R=o.lastRenderedState,P=y(R,l);if(g.hasEagerState=!0,g.eagerState=P,gn(P,R)){var H=o.interleaved;H===null?(g.next=g,Jd(o)):(g.next=H.next,H.next=g),o.interleaved=g;return}}catch{}finally{}l=Iy(n,o,g,d),l!==null&&(g=Rt(),Sn(l,n,d,g),a0(l,o,d))}}function i0(n){var o=n.alternate;return n===Ye||o!==null&&o===Ye}function l0(n,o){Li=Ua=!0;var l=n.pending;l===null?o.next=o:(o.next=l.next,l.next=o),n.pending=o}function a0(n,o,l){if((l&4194240)!==0){var d=o.lanes;d&=n.pendingLanes,l|=d,o.lanes=l,hd(n,l)}}var Va={readContext:en,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useInsertionEffect:yt,useLayoutEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useMutableSource:yt,useSyncExternalStore:yt,useId:yt,unstable_isNewReconciler:!1},fb={readContext:en,useCallback:function(n,o){return Mn().memoizedState=[n,o===void 0?null:o],n},useContext:en,useEffect:qy,useImperativeHandle:function(n,o,l){return l=l!=null?l.concat([n]):null,Fa(4194308,4,e0.bind(null,o,n),l)},useLayoutEffect:function(n,o){return Fa(4194308,4,n,o)},useInsertionEffect:function(n,o){return Fa(4,2,n,o)},useMemo:function(n,o){var l=Mn();return o=o===void 0?null:o,n=n(),l.memoizedState=[n,o],n},useReducer:function(n,o,l){var d=Mn();return o=l!==void 0?l(o):o,d.memoizedState=d.baseState=o,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:o},d.queue=n,n=n.dispatch=ub.bind(null,Ye,n),[d.memoizedState,n]},useRef:function(n){var o=Mn();return n={current:n},o.memoizedState=n},useState:Xy,useDebugValue:mf,useDeferredValue:function(n){return Mn().memoizedState=n},useTransition:function(){var n=Xy(!1),o=n[0];return n=cb.bind(null,n[1]),Mn().memoizedState=n,[o,n]},useMutableSource:function(){},useSyncExternalStore:function(n,o,l){var d=Ye,g=Mn();if(ze){if(l===void 0)throw Error(r(407));l=l()}else{if(l=o(),at===null)throw Error(r(349));(co&30)!==0||zy(d,o,l)}g.memoizedState=l;var y={value:l,getSnapshot:o};return g.queue=y,qy(Gy.bind(null,d,y,n),[n]),d.flags|=2048,Mi(9,Wy.bind(null,d,y,l,o),void 0,null),l},useId:function(){var n=Mn(),o=at.identifierPrefix;if(ze){var l=er,d=Jn;l=(d&~(1<<32-mn(d)-1)).toString(32)+l,o=":"+o+"R"+l,l=Di++,0<l&&(o+="H"+l.toString(32)),o+=":"}else l=ab++,o=":"+o+"r"+l.toString(32)+":";return n.memoizedState=o},unstable_isNewReconciler:!1},pb={readContext:en,useCallback:n0,useContext:en,useEffect:hf,useImperativeHandle:t0,useInsertionEffect:Zy,useLayoutEffect:Jy,useMemo:r0,useReducer:ff,useRef:Qy,useState:function(){return ff(ki)},useDebugValue:mf,useDeferredValue:function(n){var o=tn();return o0(o,ot.memoizedState,n)},useTransition:function(){var n=ff(ki)[0],o=tn().memoizedState;return[n,o]},useMutableSource:Hy,useSyncExternalStore:By,useId:s0,unstable_isNewReconciler:!1},hb={readContext:en,useCallback:n0,useContext:en,useEffect:hf,useImperativeHandle:t0,useInsertionEffect:Zy,useLayoutEffect:Jy,useMemo:r0,useReducer:pf,useRef:Qy,useState:function(){return pf(ki)},useDebugValue:mf,useDeferredValue:function(n){var o=tn();return ot===null?o.memoizedState=n:o0(o,ot.memoizedState,n)},useTransition:function(){var n=pf(ki)[0],o=tn().memoizedState;return[n,o]},useMutableSource:Hy,useSyncExternalStore:By,useId:s0,unstable_isNewReconciler:!1};function ps(n,o){try{var l="",d=o;do l+=le(d),d=d.return;while(d);var g=l}catch(y){g=`
43
+ Error generating stack: `+y.message+`
44
+ `+y.stack}return{value:n,source:o,stack:g,digest:null}}function gf(n,o,l){return{value:n,source:null,stack:l??null,digest:o??null}}function Ef(n,o){try{console.error(o.value)}catch(l){setTimeout(function(){throw l})}}var mb=typeof WeakMap=="function"?WeakMap:Map;function c0(n,o,l){l=nr(-1,l),l.tag=3,l.payload={element:null};var d=o.value;return l.callback=function(){Ya||(Ya=!0,Lf=d),Ef(n,o)},l}function u0(n,o,l){l=nr(-1,l),l.tag=3;var d=n.type.getDerivedStateFromError;if(typeof d=="function"){var g=o.value;l.payload=function(){return d(g)},l.callback=function(){Ef(n,o)}}var y=n.stateNode;return y!==null&&typeof y.componentDidCatch=="function"&&(l.callback=function(){Ef(n,o),typeof d!="function"&&(br===null?br=new Set([this]):br.add(this));var R=o.stack;this.componentDidCatch(o.value,{componentStack:R!==null?R:""})}),l}function d0(n,o,l){var d=n.pingCache;if(d===null){d=n.pingCache=new mb;var g=new Set;d.set(o,g)}else g=d.get(o),g===void 0&&(g=new Set,d.set(o,g));g.has(l)||(g.add(l),n=Ab.bind(null,n,o,l),o.then(n,n))}function f0(n){do{var o;if((o=n.tag===13)&&(o=n.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return n;n=n.return}while(n!==null);return null}function p0(n,o,l,d,g){return(n.mode&1)===0?(n===o?n.flags|=65536:(n.flags|=128,l.flags|=131072,l.flags&=-52805,l.tag===1&&(l.alternate===null?l.tag=17:(o=nr(-1,1),o.tag=2,Ar(l,o,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=g,n)}var gb=T.ReactCurrentOwner,Mt=!1;function Nt(n,o,l,d){o.child=n===null?Vy(o,null,l,d):ds(o,n.child,l,d)}function h0(n,o,l,d,g){l=l.render;var y=o.ref;return us(o,g),d=uf(n,o,l,d,y,g),l=df(),n!==null&&!Mt?(o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~g,rr(n,o,g)):(ze&&l&&zd(o),o.flags|=1,Nt(n,o,d,g),o.child)}function m0(n,o,l,d,g){if(n===null){var y=l.type;return typeof y=="function"&&!jf(y)&&y.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(o.tag=15,o.type=y,g0(n,o,y,d,g)):(n=Ja(l.type,null,d,o,o.mode,g),n.ref=o.ref,n.return=o,o.child=n)}if(y=n.child,(n.lanes&g)===0){var R=y.memoizedProps;if(l=l.compare,l=l!==null?l:Si,l(R,d)&&n.ref===o.ref)return rr(n,o,g)}return o.flags|=1,n=Mr(y,d),n.ref=o.ref,n.return=o,o.child=n}function g0(n,o,l,d,g){if(n!==null){var y=n.memoizedProps;if(Si(y,d)&&n.ref===o.ref)if(Mt=!1,o.pendingProps=d=y,(n.lanes&g)!==0)(n.flags&131072)!==0&&(Mt=!0);else return o.lanes=n.lanes,rr(n,o,g)}return yf(n,o,l,d,g)}function E0(n,o,l){var d=o.pendingProps,g=d.children,y=n!==null?n.memoizedState:null;if(d.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Fe(ms,Gt),Gt|=l;else{if((l&1073741824)===0)return n=y!==null?y.baseLanes|l:l,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:n,cachePool:null,transitions:null},o.updateQueue=null,Fe(ms,Gt),Gt|=n,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=y!==null?y.baseLanes:l,Fe(ms,Gt),Gt|=d}else y!==null?(d=y.baseLanes|l,o.memoizedState=null):d=l,Fe(ms,Gt),Gt|=d;return Nt(n,o,g,l),o.child}function y0(n,o){var l=o.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(o.flags|=512,o.flags|=2097152)}function yf(n,o,l,d,g){var y=kt(l)?oo:Et.current;return y=ss(o,y),us(o,g),l=uf(n,o,l,d,y,g),d=df(),n!==null&&!Mt?(o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~g,rr(n,o,g)):(ze&&d&&zd(o),o.flags|=1,Nt(n,o,l,g),o.child)}function v0(n,o,l,d,g){if(kt(l)){var y=!0;Na(o)}else y=!1;if(us(o,g),o.stateNode===null)Ha(n,o),Py(o,l,d),nf(o,l,d,g),d=!0;else if(n===null){var R=o.stateNode,P=o.memoizedProps;R.props=P;var H=R.context,J=l.contextType;typeof J=="object"&&J!==null?J=en(J):(J=kt(l)?oo:Et.current,J=ss(o,J));var ie=l.getDerivedStateFromProps,ae=typeof ie=="function"||typeof R.getSnapshotBeforeUpdate=="function";ae||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(P!==d||H!==J)&&Uy(o,R,d,J),Cr=!1;var se=o.memoizedState;R.state=se,La(o,d,R,g),H=o.memoizedState,P!==d||se!==H||Dt.current||Cr?(typeof ie=="function"&&(tf(o,l,ie,d),H=o.memoizedState),(P=Cr||My(o,l,P,d,se,H,J))?(ae||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(o.flags|=4194308)):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=H),R.props=d,R.state=H,R.context=J,d=P):(typeof R.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{R=o.stateNode,by(n,o),P=o.memoizedProps,J=o.type===o.elementType?P:yn(o.type,P),R.props=J,ae=o.pendingProps,se=R.context,H=l.contextType,typeof H=="object"&&H!==null?H=en(H):(H=kt(l)?oo:Et.current,H=ss(o,H));var fe=l.getDerivedStateFromProps;(ie=typeof fe=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(P!==ae||se!==H)&&Uy(o,R,d,H),Cr=!1,se=o.memoizedState,R.state=se,La(o,d,R,g);var ge=o.memoizedState;P!==ae||se!==ge||Dt.current||Cr?(typeof fe=="function"&&(tf(o,l,fe,d),ge=o.memoizedState),(J=Cr||My(o,l,J,d,se,ge,H)||!1)?(ie||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(d,ge,H),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(d,ge,H)),typeof R.componentDidUpdate=="function"&&(o.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof R.componentDidUpdate!="function"||P===n.memoizedProps&&se===n.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||P===n.memoizedProps&&se===n.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=ge),R.props=d,R.state=ge,R.context=H,d=J):(typeof R.componentDidUpdate!="function"||P===n.memoizedProps&&se===n.memoizedState||(o.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||P===n.memoizedProps&&se===n.memoizedState||(o.flags|=1024),d=!1)}return vf(n,o,l,d,y,g)}function vf(n,o,l,d,g,y){y0(n,o);var R=(o.flags&128)!==0;if(!d&&!R)return g&&wy(o,l,!1),rr(n,o,y);d=o.stateNode,gb.current=o;var P=R&&typeof l.getDerivedStateFromError!="function"?null:d.render();return o.flags|=1,n!==null&&R?(o.child=ds(o,n.child,null,y),o.child=ds(o,null,P,y)):Nt(n,o,P,y),o.memoizedState=d.state,g&&wy(o,l,!0),o.child}function x0(n){var o=n.stateNode;o.pendingContext?Sy(n,o.pendingContext,o.pendingContext!==o.context):o.context&&Sy(n,o.context,!1),rf(n,o.containerInfo)}function S0(n,o,l,d,g){return as(),Kd(g),o.flags|=256,Nt(n,o,l,d),o.child}var xf={dehydrated:null,treeContext:null,retryLane:0};function Sf(n){return{baseLanes:n,cachePool:null,transitions:null}}function _0(n,o,l){var d=o.pendingProps,g=Ge.current,y=!1,R=(o.flags&128)!==0,P;if((P=R)||(P=n!==null&&n.memoizedState===null?!1:(g&2)!==0),P?(y=!0,o.flags&=-129):(n===null||n.memoizedState!==null)&&(g|=1),Fe(Ge,g&1),n===null)return Yd(o),n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?((o.mode&1)===0?o.lanes=1:n.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(R=d.children,n=d.fallback,y?(d=o.mode,y=o.child,R={mode:"hidden",children:R},(d&1)===0&&y!==null?(y.childLanes=0,y.pendingProps=R):y=ec(R,d,0,null),n=mo(n,d,l,null),y.return=o,n.return=o,y.sibling=n,o.child=y,o.child.memoizedState=Sf(l),o.memoizedState=xf,n):_f(o,R));if(g=n.memoizedState,g!==null&&(P=g.dehydrated,P!==null))return Eb(n,o,R,d,P,g,l);if(y){y=d.fallback,R=o.mode,g=n.child,P=g.sibling;var H={mode:"hidden",children:d.children};return(R&1)===0&&o.child!==g?(d=o.child,d.childLanes=0,d.pendingProps=H,o.deletions=null):(d=Mr(g,H),d.subtreeFlags=g.subtreeFlags&14680064),P!==null?y=Mr(P,y):(y=mo(y,R,l,null),y.flags|=2),y.return=o,d.return=o,d.sibling=y,o.child=d,d=y,y=o.child,R=n.child.memoizedState,R=R===null?Sf(l):{baseLanes:R.baseLanes|l,cachePool:null,transitions:R.transitions},y.memoizedState=R,y.childLanes=n.childLanes&~l,o.memoizedState=xf,d}return y=n.child,n=y.sibling,d=Mr(y,{mode:"visible",children:d.children}),(o.mode&1)===0&&(d.lanes=l),d.return=o,d.sibling=null,n!==null&&(l=o.deletions,l===null?(o.deletions=[n],o.flags|=16):l.push(n)),o.child=d,o.memoizedState=null,d}function _f(n,o){return o=ec({mode:"visible",children:o},n.mode,0,null),o.return=n,n.child=o}function $a(n,o,l,d){return d!==null&&Kd(d),ds(o,n.child,null,l),n=_f(o,o.pendingProps.children),n.flags|=2,o.memoizedState=null,n}function Eb(n,o,l,d,g,y,R){if(l)return o.flags&256?(o.flags&=-257,d=gf(Error(r(422))),$a(n,o,R,d)):o.memoizedState!==null?(o.child=n.child,o.flags|=128,null):(y=d.fallback,g=o.mode,d=ec({mode:"visible",children:d.children},g,0,null),y=mo(y,g,R,null),y.flags|=2,d.return=o,y.return=o,d.sibling=y,o.child=d,(o.mode&1)!==0&&ds(o,n.child,null,R),o.child.memoizedState=Sf(R),o.memoizedState=xf,y);if((o.mode&1)===0)return $a(n,o,R,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var P=d.dgst;return d=P,y=Error(r(419)),d=gf(y,d,void 0),$a(n,o,R,d)}if(P=(R&n.childLanes)!==0,Mt||P){if(d=at,d!==null){switch(R&-R){case 4:g=2;break;case 16:g=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:g=32;break;case 536870912:g=268435456;break;default:g=0}g=(g&(d.suspendedLanes|R))!==0?0:g,g!==0&&g!==y.retryLane&&(y.retryLane=g,tr(n,g),Sn(d,n,g,-1))}return Ff(),d=gf(Error(r(421))),$a(n,o,R,d)}return g.data==="$?"?(o.flags|=128,o.child=n.child,o=Ib.bind(null,n),g._reactRetry=o,null):(n=y.treeContext,Wt=Nr(g.nextSibling),zt=o,ze=!0,En=null,n!==null&&(Zt[Jt++]=Jn,Zt[Jt++]=er,Zt[Jt++]=so,Jn=n.id,er=n.overflow,so=o),o=_f(o,d.children),o.flags|=4096,o)}function w0(n,o,l){n.lanes|=o;var d=n.alternate;d!==null&&(d.lanes|=o),Zd(n.return,o,l)}function wf(n,o,l,d,g){var y=n.memoizedState;y===null?n.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g}:(y.isBackwards=o,y.rendering=null,y.renderingStartTime=0,y.last=d,y.tail=l,y.tailMode=g)}function N0(n,o,l){var d=o.pendingProps,g=d.revealOrder,y=d.tail;if(Nt(n,o,d.children,l),d=Ge.current,(d&2)!==0)d=d&1|2,o.flags|=128;else{if(n!==null&&(n.flags&128)!==0)e:for(n=o.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&w0(n,l,o);else if(n.tag===19)w0(n,l,o);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===o)break e;for(;n.sibling===null;){if(n.return===null||n.return===o)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}d&=1}if(Fe(Ge,d),(o.mode&1)===0)o.memoizedState=null;else switch(g){case"forwards":for(l=o.child,g=null;l!==null;)n=l.alternate,n!==null&&Ma(n)===null&&(g=l),l=l.sibling;l=g,l===null?(g=o.child,o.child=null):(g=l.sibling,l.sibling=null),wf(o,!1,g,l,y);break;case"backwards":for(l=null,g=o.child,o.child=null;g!==null;){if(n=g.alternate,n!==null&&Ma(n)===null){o.child=g;break}n=g.sibling,g.sibling=l,l=g,g=n}wf(o,!0,l,null,y);break;case"together":wf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Ha(n,o){(o.mode&1)===0&&n!==null&&(n.alternate=null,o.alternate=null,o.flags|=2)}function rr(n,o,l){if(n!==null&&(o.dependencies=n.dependencies),uo|=o.lanes,(l&o.childLanes)===0)return null;if(n!==null&&o.child!==n.child)throw Error(r(153));if(o.child!==null){for(n=o.child,l=Mr(n,n.pendingProps),o.child=l,l.return=o;n.sibling!==null;)n=n.sibling,l=l.sibling=Mr(n,n.pendingProps),l.return=o;l.sibling=null}return o.child}function yb(n,o,l){switch(o.tag){case 3:x0(o),as();break;case 5:$y(o);break;case 1:kt(o.type)&&Na(o);break;case 4:rf(o,o.stateNode.containerInfo);break;case 10:var d=o.type._context,g=o.memoizedProps.value;Fe(Aa,d._currentValue),d._currentValue=g;break;case 13:if(d=o.memoizedState,d!==null)return d.dehydrated!==null?(Fe(Ge,Ge.current&1),o.flags|=128,null):(l&o.child.childLanes)!==0?_0(n,o,l):(Fe(Ge,Ge.current&1),n=rr(n,o,l),n!==null?n.sibling:null);Fe(Ge,Ge.current&1);break;case 19:if(d=(l&o.childLanes)!==0,(n.flags&128)!==0){if(d)return N0(n,o,l);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Fe(Ge,Ge.current),d)break;return null;case 22:case 23:return o.lanes=0,E0(n,o,l)}return rr(n,o,l)}var R0,Nf,T0,O0;R0=function(n,o){for(var l=o.child;l!==null;){if(l.tag===5||l.tag===6)n.appendChild(l.stateNode);else if(l.tag!==4&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===o)break;for(;l.sibling===null;){if(l.return===null||l.return===o)return;l=l.return}l.sibling.return=l.return,l=l.sibling}},Nf=function(){},T0=function(n,o,l,d){var g=n.memoizedProps;if(g!==d){n=o.stateNode,ao(kn.current);var y=null;switch(l){case"input":g=Be(n,g),d=Be(n,d),y=[];break;case"select":g=z({},g,{value:void 0}),d=z({},d,{value:void 0}),y=[];break;case"textarea":g=Cn(n,g),d=Cn(n,d),y=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(n.onclick=Sa)}hn(l,d);var R;l=null;for(J in g)if(!d.hasOwnProperty(J)&&g.hasOwnProperty(J)&&g[J]!=null)if(J==="style"){var P=g[J];for(R in P)P.hasOwnProperty(R)&&(l||(l={}),l[R]="")}else J!=="dangerouslySetInnerHTML"&&J!=="children"&&J!=="suppressContentEditableWarning"&&J!=="suppressHydrationWarning"&&J!=="autoFocus"&&(i.hasOwnProperty(J)?y||(y=[]):(y=y||[]).push(J,null));for(J in d){var H=d[J];if(P=g?.[J],d.hasOwnProperty(J)&&H!==P&&(H!=null||P!=null))if(J==="style")if(P){for(R in P)!P.hasOwnProperty(R)||H&&H.hasOwnProperty(R)||(l||(l={}),l[R]="");for(R in H)H.hasOwnProperty(R)&&P[R]!==H[R]&&(l||(l={}),l[R]=H[R])}else l||(y||(y=[]),y.push(J,l)),l=H;else J==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,P=P?P.__html:void 0,H!=null&&P!==H&&(y=y||[]).push(J,H)):J==="children"?typeof H!="string"&&typeof H!="number"||(y=y||[]).push(J,""+H):J!=="suppressContentEditableWarning"&&J!=="suppressHydrationWarning"&&(i.hasOwnProperty(J)?(H!=null&&J==="onScroll"&&je("scroll",n),y||P===H||(y=[])):(y=y||[]).push(J,H))}l&&(y=y||[]).push("style",l);var J=y;(o.updateQueue=J)&&(o.flags|=4)}},O0=function(n,o,l,d){l!==d&&(o.flags|=4)};function Pi(n,o){if(!ze)switch(n.tailMode){case"hidden":o=n.tail;for(var l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?n.tail=null:l.sibling=null;break;case"collapsed":l=n.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?o||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function vt(n){var o=n.alternate!==null&&n.alternate.child===n.child,l=0,d=0;if(o)for(var g=n.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&14680064,d|=g.flags&14680064,g.return=n,g=g.sibling;else for(g=n.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=n,g=g.sibling;return n.subtreeFlags|=d,n.childLanes=l,o}function vb(n,o,l){var d=o.pendingProps;switch(Wd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(o),null;case 1:return kt(o.type)&&wa(),vt(o),null;case 3:return d=o.stateNode,fs(),Ve(Dt),Ve(Et),lf(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(n===null||n.child===null)&&(Ca(o)?o.flags|=4:n===null||n.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,En!==null&&(Mf(En),En=null))),Nf(n,o),vt(o),null;case 5:of(o);var g=ao(bi.current);if(l=o.type,n!==null&&o.stateNode!=null)T0(n,o,l,d,g),n.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!d){if(o.stateNode===null)throw Error(r(166));return vt(o),null}if(n=ao(kn.current),Ca(o)){d=o.stateNode,l=o.type;var y=o.memoizedProps;switch(d[Dn]=o,d[Ti]=y,n=(o.mode&1)!==0,l){case"dialog":je("cancel",d),je("close",d);break;case"iframe":case"object":case"embed":je("load",d);break;case"video":case"audio":for(g=0;g<wi.length;g++)je(wi[g],d);break;case"source":je("error",d);break;case"img":case"image":case"link":je("error",d),je("load",d);break;case"details":je("toggle",d);break;case"input":Ue(d,y),je("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!y.multiple},je("invalid",d);break;case"textarea":An(d,y),je("invalid",d)}hn(l,y),g=null;for(var R in y)if(y.hasOwnProperty(R)){var P=y[R];R==="children"?typeof P=="string"?d.textContent!==P&&(y.suppressHydrationWarning!==!0&&xa(d.textContent,P,n),g=["children",P]):typeof P=="number"&&d.textContent!==""+P&&(y.suppressHydrationWarning!==!0&&xa(d.textContent,P,n),g=["children",""+P]):i.hasOwnProperty(R)&&P!=null&&R==="onScroll"&&je("scroll",d)}switch(l){case"input":Pe(d),we(d,y,!0);break;case"textarea":Pe(d),zn(d);break;case"select":case"option":break;default:typeof y.onClick=="function"&&(d.onclick=Sa)}d=g,o.updateQueue=d,d!==null&&(o.flags|=4)}else{R=g.nodeType===9?g:g.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=fn(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=R.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof d.is=="string"?n=R.createElement(l,{is:d.is}):(n=R.createElement(l),l==="select"&&(R=n,d.multiple?R.multiple=!0:d.size&&(R.size=d.size))):n=R.createElementNS(n,l),n[Dn]=o,n[Ti]=d,R0(n,o,!1,!1),o.stateNode=n;e:{switch(R=Qr(l,d),l){case"dialog":je("cancel",n),je("close",n),g=d;break;case"iframe":case"object":case"embed":je("load",n),g=d;break;case"video":case"audio":for(g=0;g<wi.length;g++)je(wi[g],n);g=d;break;case"source":je("error",n),g=d;break;case"img":case"image":case"link":je("error",n),je("load",n),g=d;break;case"details":je("toggle",n),g=d;break;case"input":Ue(n,d),g=Be(n,d),je("invalid",n);break;case"option":g=d;break;case"select":n._wrapperState={wasMultiple:!!d.multiple},g=z({},d,{value:void 0}),je("invalid",n);break;case"textarea":An(n,d),g=Cn(n,d),je("invalid",n);break;default:g=d}hn(l,g),P=g;for(y in P)if(P.hasOwnProperty(y)){var H=P[y];y==="style"?Yn(n,H):y==="dangerouslySetInnerHTML"?(H=H?H.__html:void 0,H!=null&&Wn(n,H)):y==="children"?typeof H=="string"?(l!=="textarea"||H!=="")&&Ke(n,H):typeof H=="number"&&Ke(n,""+H):y!=="suppressContentEditableWarning"&&y!=="suppressHydrationWarning"&&y!=="autoFocus"&&(i.hasOwnProperty(y)?H!=null&&y==="onScroll"&&je("scroll",n):H!=null&&D(n,y,H,R))}switch(l){case"input":Pe(n),we(n,d,!1);break;case"textarea":Pe(n),zn(n);break;case"option":d.value!=null&&n.setAttribute("value",""+ue(d.value));break;case"select":n.multiple=!!d.multiple,y=d.value,y!=null?Qt(n,!!d.multiple,y,!1):d.defaultValue!=null&&Qt(n,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(n.onclick=Sa)}switch(l){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}}d&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return vt(o),null;case 6:if(n&&o.stateNode!=null)O0(n,o,n.memoizedProps,d);else{if(typeof d!="string"&&o.stateNode===null)throw Error(r(166));if(l=ao(bi.current),ao(kn.current),Ca(o)){if(d=o.stateNode,l=o.memoizedProps,d[Dn]=o,(y=d.nodeValue!==l)&&(n=zt,n!==null))switch(n.tag){case 3:xa(d.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&xa(d.nodeValue,l,(n.mode&1)!==0)}y&&(o.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[Dn]=o,o.stateNode=d}return vt(o),null;case 13:if(Ve(Ge),d=o.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(ze&&Wt!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Ay(),as(),o.flags|=98560,y=!1;else if(y=Ca(o),d!==null&&d.dehydrated!==null){if(n===null){if(!y)throw Error(r(318));if(y=o.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(r(317));y[Dn]=o}else as(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),y=!1}else En!==null&&(Mf(En),En=null),y=!0;if(!y)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=l,o):(d=d!==null,d!==(n!==null&&n.memoizedState!==null)&&d&&(o.child.flags|=8192,(o.mode&1)!==0&&(n===null||(Ge.current&1)!==0?st===0&&(st=3):Ff())),o.updateQueue!==null&&(o.flags|=4),vt(o),null);case 4:return fs(),Nf(n,o),n===null&&Ni(o.stateNode.containerInfo),vt(o),null;case 10:return qd(o.type._context),vt(o),null;case 17:return kt(o.type)&&wa(),vt(o),null;case 19:if(Ve(Ge),y=o.memoizedState,y===null)return vt(o),null;if(d=(o.flags&128)!==0,R=y.rendering,R===null)if(d)Pi(y,!1);else{if(st!==0||n!==null&&(n.flags&128)!==0)for(n=o.child;n!==null;){if(R=Ma(n),R!==null){for(o.flags|=128,Pi(y,!1),d=R.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),o.subtreeFlags=0,d=l,l=o.child;l!==null;)y=l,n=d,y.flags&=14680066,R=y.alternate,R===null?(y.childLanes=0,y.lanes=n,y.child=null,y.subtreeFlags=0,y.memoizedProps=null,y.memoizedState=null,y.updateQueue=null,y.dependencies=null,y.stateNode=null):(y.childLanes=R.childLanes,y.lanes=R.lanes,y.child=R.child,y.subtreeFlags=0,y.deletions=null,y.memoizedProps=R.memoizedProps,y.memoizedState=R.memoizedState,y.updateQueue=R.updateQueue,y.type=R.type,n=R.dependencies,y.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return Fe(Ge,Ge.current&1|2),o.child}n=n.sibling}y.tail!==null&&We()>gs&&(o.flags|=128,d=!0,Pi(y,!1),o.lanes=4194304)}else{if(!d)if(n=Ma(R),n!==null){if(o.flags|=128,d=!0,l=n.updateQueue,l!==null&&(o.updateQueue=l,o.flags|=4),Pi(y,!0),y.tail===null&&y.tailMode==="hidden"&&!R.alternate&&!ze)return vt(o),null}else 2*We()-y.renderingStartTime>gs&&l!==1073741824&&(o.flags|=128,d=!0,Pi(y,!1),o.lanes=4194304);y.isBackwards?(R.sibling=o.child,o.child=R):(l=y.last,l!==null?l.sibling=R:o.child=R,y.last=R)}return y.tail!==null?(o=y.tail,y.rendering=o,y.tail=o.sibling,y.renderingStartTime=We(),o.sibling=null,l=Ge.current,Fe(Ge,d?l&1|2:l&1),o):(vt(o),null);case 22:case 23:return Uf(),d=o.memoizedState!==null,n!==null&&n.memoizedState!==null!==d&&(o.flags|=8192),d&&(o.mode&1)!==0?(Gt&1073741824)!==0&&(vt(o),o.subtreeFlags&6&&(o.flags|=8192)):vt(o),null;case 24:return null;case 25:return null}throw Error(r(156,o.tag))}function xb(n,o){switch(Wd(o),o.tag){case 1:return kt(o.type)&&wa(),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return fs(),Ve(Dt),Ve(Et),lf(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 5:return of(o),null;case 13:if(Ve(Ge),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(r(340));as()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return Ve(Ge),null;case 4:return fs(),null;case 10:return qd(o.type._context),null;case 22:case 23:return Uf(),null;case 24:return null;default:return null}}var Ba=!1,xt=!1,Sb=typeof WeakSet=="function"?WeakSet:Set,pe=null;function hs(n,o){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){Xe(n,o,d)}else l.current=null}function Rf(n,o,l){try{l()}catch(d){Xe(n,o,d)}}var C0=!1;function _b(n,o){if(Pd=ca,n=sy(),Cd(n)){if("selectionStart"in n)var l={start:n.selectionStart,end:n.selectionEnd};else e:{l=(l=n.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var R=0,P=-1,H=-1,J=0,ie=0,ae=n,se=null;t:for(;;){for(var fe;ae!==l||g!==0&&ae.nodeType!==3||(P=R+g),ae!==y||d!==0&&ae.nodeType!==3||(H=R+d),ae.nodeType===3&&(R+=ae.nodeValue.length),(fe=ae.firstChild)!==null;)se=ae,ae=fe;for(;;){if(ae===n)break t;if(se===l&&++J===g&&(P=R),se===y&&++ie===d&&(H=R),(fe=ae.nextSibling)!==null)break;ae=se,se=ae.parentNode}ae=fe}l=P===-1||H===-1?null:{start:P,end:H}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ud={focusedElem:n,selectionRange:l},ca=!1,pe=o;pe!==null;)if(o=pe,n=o.child,(o.subtreeFlags&1028)!==0&&n!==null)n.return=o,pe=n;else for(;pe!==null;){o=pe;try{var ge=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ge!==null){var Ee=ge.memoizedProps,et=ge.memoizedState,q=o.stateNode,G=q.getSnapshotBeforeUpdate(o.elementType===o.type?Ee:yn(o.type,Ee),et);q.__reactInternalSnapshotBeforeUpdate=G}break;case 3:var Z=o.stateNode.containerInfo;Z.nodeType===1?Z.textContent="":Z.nodeType===9&&Z.documentElement&&Z.removeChild(Z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ce){Xe(o,o.return,ce)}if(n=o.sibling,n!==null){n.return=o.return,pe=n;break}pe=o.return}return ge=C0,C0=!1,ge}function Ui(n,o,l){var d=o.updateQueue;if(d=d!==null?d.lastEffect:null,d!==null){var g=d=d.next;do{if((g.tag&n)===n){var y=g.destroy;g.destroy=void 0,y!==void 0&&Rf(o,l,y)}g=g.next}while(g!==d)}}function za(n,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var l=o=o.next;do{if((l.tag&n)===n){var d=l.create;l.destroy=d()}l=l.next}while(l!==o)}}function Tf(n){var o=n.ref;if(o!==null){var l=n.stateNode;switch(n.tag){case 5:n=l;break;default:n=l}typeof o=="function"?o(n):o.current=n}}function A0(n){var o=n.alternate;o!==null&&(n.alternate=null,A0(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&(delete o[Dn],delete o[Ti],delete o[$d],delete o[ob],delete o[sb])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function I0(n){return n.tag===5||n.tag===3||n.tag===4}function b0(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||I0(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Of(n,o,l){var d=n.tag;if(d===5||d===6)n=n.stateNode,o?l.nodeType===8?l.parentNode.insertBefore(n,o):l.insertBefore(n,o):(l.nodeType===8?(o=l.parentNode,o.insertBefore(n,l)):(o=l,o.appendChild(n)),l=l._reactRootContainer,l!=null||o.onclick!==null||(o.onclick=Sa));else if(d!==4&&(n=n.child,n!==null))for(Of(n,o,l),n=n.sibling;n!==null;)Of(n,o,l),n=n.sibling}function Cf(n,o,l){var d=n.tag;if(d===5||d===6)n=n.stateNode,o?l.insertBefore(n,o):l.appendChild(n);else if(d!==4&&(n=n.child,n!==null))for(Cf(n,o,l),n=n.sibling;n!==null;)Cf(n,o,l),n=n.sibling}var ht=null,vn=!1;function Ir(n,o,l){for(l=l.child;l!==null;)L0(n,o,l),l=l.sibling}function L0(n,o,l){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(ra,l)}catch{}switch(l.tag){case 5:xt||hs(l,o);case 6:var d=ht,g=vn;ht=null,Ir(n,o,l),ht=d,vn=g,ht!==null&&(vn?(n=ht,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):ht.removeChild(l.stateNode));break;case 18:ht!==null&&(vn?(n=ht,l=l.stateNode,n.nodeType===8?Vd(n.parentNode,l):n.nodeType===1&&Vd(n,l),mi(n)):Vd(ht,l.stateNode));break;case 4:d=ht,g=vn,ht=l.stateNode.containerInfo,vn=!0,Ir(n,o,l),ht=d,vn=g;break;case 0:case 11:case 14:case 15:if(!xt&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var y=g,R=y.destroy;y=y.tag,R!==void 0&&((y&2)!==0||(y&4)!==0)&&Rf(l,o,R),g=g.next}while(g!==d)}Ir(n,o,l);break;case 1:if(!xt&&(hs(l,o),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(P){Xe(l,o,P)}Ir(n,o,l);break;case 21:Ir(n,o,l);break;case 22:l.mode&1?(xt=(d=xt)||l.memoizedState!==null,Ir(n,o,l),xt=d):Ir(n,o,l);break;default:Ir(n,o,l)}}function D0(n){var o=n.updateQueue;if(o!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new Sb),o.forEach(function(d){var g=bb.bind(null,n,d);l.has(d)||(l.add(d),d.then(g,g))})}}function xn(n,o){var l=o.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d];try{var y=n,R=o,P=R;e:for(;P!==null;){switch(P.tag){case 5:ht=P.stateNode,vn=!1;break e;case 3:ht=P.stateNode.containerInfo,vn=!0;break e;case 4:ht=P.stateNode.containerInfo,vn=!0;break e}P=P.return}if(ht===null)throw Error(r(160));L0(y,R,g),ht=null,vn=!1;var H=g.alternate;H!==null&&(H.return=null),g.return=null}catch(J){Xe(g,o,J)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)k0(o,n),o=o.sibling}function k0(n,o){var l=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(xn(o,n),Pn(n),d&4){try{Ui(3,n,n.return),za(3,n)}catch(Ee){Xe(n,n.return,Ee)}try{Ui(5,n,n.return)}catch(Ee){Xe(n,n.return,Ee)}}break;case 1:xn(o,n),Pn(n),d&512&&l!==null&&hs(l,l.return);break;case 5:if(xn(o,n),Pn(n),d&512&&l!==null&&hs(l,l.return),n.flags&32){var g=n.stateNode;try{Ke(g,"")}catch(Ee){Xe(n,n.return,Ee)}}if(d&4&&(g=n.stateNode,g!=null)){var y=n.memoizedProps,R=l!==null?l.memoizedProps:y,P=n.type,H=n.updateQueue;if(n.updateQueue=null,H!==null)try{P==="input"&&y.type==="radio"&&y.name!=null&&ft(g,y),Qr(P,R);var J=Qr(P,y);for(R=0;R<H.length;R+=2){var ie=H[R],ae=H[R+1];ie==="style"?Yn(g,ae):ie==="dangerouslySetInnerHTML"?Wn(g,ae):ie==="children"?Ke(g,ae):D(g,ie,ae,J)}switch(P){case"input":pt(g,y);break;case"textarea":dn(g,y);break;case"select":var se=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!y.multiple;var fe=y.value;fe!=null?Qt(g,!!y.multiple,fe,!1):se!==!!y.multiple&&(y.defaultValue!=null?Qt(g,!!y.multiple,y.defaultValue,!0):Qt(g,!!y.multiple,y.multiple?[]:"",!1))}g[Ti]=y}catch(Ee){Xe(n,n.return,Ee)}}break;case 6:if(xn(o,n),Pn(n),d&4){if(n.stateNode===null)throw Error(r(162));g=n.stateNode,y=n.memoizedProps;try{g.nodeValue=y}catch(Ee){Xe(n,n.return,Ee)}}break;case 3:if(xn(o,n),Pn(n),d&4&&l!==null&&l.memoizedState.isDehydrated)try{mi(o.containerInfo)}catch(Ee){Xe(n,n.return,Ee)}break;case 4:xn(o,n),Pn(n);break;case 13:xn(o,n),Pn(n),g=n.child,g.flags&8192&&(y=g.memoizedState!==null,g.stateNode.isHidden=y,!y||g.alternate!==null&&g.alternate.memoizedState!==null||(bf=We())),d&4&&D0(n);break;case 22:if(ie=l!==null&&l.memoizedState!==null,n.mode&1?(xt=(J=xt)||ie,xn(o,n),xt=J):xn(o,n),Pn(n),d&8192){if(J=n.memoizedState!==null,(n.stateNode.isHidden=J)&&!ie&&(n.mode&1)!==0)for(pe=n,ie=n.child;ie!==null;){for(ae=pe=ie;pe!==null;){switch(se=pe,fe=se.child,se.tag){case 0:case 11:case 14:case 15:Ui(4,se,se.return);break;case 1:hs(se,se.return);var ge=se.stateNode;if(typeof ge.componentWillUnmount=="function"){d=se,l=se.return;try{o=d,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(Ee){Xe(d,l,Ee)}}break;case 5:hs(se,se.return);break;case 22:if(se.memoizedState!==null){U0(ae);continue}}fe!==null?(fe.return=se,pe=fe):U0(ae)}ie=ie.sibling}e:for(ie=null,ae=n;;){if(ae.tag===5){if(ie===null){ie=ae;try{g=ae.stateNode,J?(y=g.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none"):(P=ae.stateNode,H=ae.memoizedProps.style,R=H!=null&&H.hasOwnProperty("display")?H.display:null,P.style.display=bn("display",R))}catch(Ee){Xe(n,n.return,Ee)}}}else if(ae.tag===6){if(ie===null)try{ae.stateNode.nodeValue=J?"":ae.memoizedProps}catch(Ee){Xe(n,n.return,Ee)}}else if((ae.tag!==22&&ae.tag!==23||ae.memoizedState===null||ae===n)&&ae.child!==null){ae.child.return=ae,ae=ae.child;continue}if(ae===n)break e;for(;ae.sibling===null;){if(ae.return===null||ae.return===n)break e;ie===ae&&(ie=null),ae=ae.return}ie===ae&&(ie=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:xn(o,n),Pn(n),d&4&&D0(n);break;case 21:break;default:xn(o,n),Pn(n)}}function Pn(n){var o=n.flags;if(o&2){try{e:{for(var l=n.return;l!==null;){if(I0(l)){var d=l;break e}l=l.return}throw Error(r(160))}switch(d.tag){case 5:var g=d.stateNode;d.flags&32&&(Ke(g,""),d.flags&=-33);var y=b0(n);Cf(n,y,g);break;case 3:case 4:var R=d.stateNode.containerInfo,P=b0(n);Of(n,P,R);break;default:throw Error(r(161))}}catch(H){Xe(n,n.return,H)}n.flags&=-3}o&4096&&(n.flags&=-4097)}function wb(n,o,l){pe=n,M0(n)}function M0(n,o,l){for(var d=(n.mode&1)!==0;pe!==null;){var g=pe,y=g.child;if(g.tag===22&&d){var R=g.memoizedState!==null||Ba;if(!R){var P=g.alternate,H=P!==null&&P.memoizedState!==null||xt;P=Ba;var J=xt;if(Ba=R,(xt=H)&&!J)for(pe=g;pe!==null;)R=pe,H=R.child,R.tag===22&&R.memoizedState!==null?F0(g):H!==null?(H.return=R,pe=H):F0(g);for(;y!==null;)pe=y,M0(y),y=y.sibling;pe=g,Ba=P,xt=J}P0(n)}else(g.subtreeFlags&8772)!==0&&y!==null?(y.return=g,pe=y):P0(n)}}function P0(n){for(;pe!==null;){var o=pe;if((o.flags&8772)!==0){var l=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:xt||za(5,o);break;case 1:var d=o.stateNode;if(o.flags&4&&!xt)if(l===null)d.componentDidMount();else{var g=o.elementType===o.type?l.memoizedProps:yn(o.type,l.memoizedProps);d.componentDidUpdate(g,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var y=o.updateQueue;y!==null&&Dy(o,y,d);break;case 3:var R=o.updateQueue;if(R!==null){if(l=null,o.child!==null)switch(o.child.tag){case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}Dy(o,R,l)}break;case 5:var P=o.stateNode;if(l===null&&o.flags&4){l=P;var H=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":H.autoFocus&&l.focus();break;case"img":H.src&&(l.src=H.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var J=o.alternate;if(J!==null){var ie=J.memoizedState;if(ie!==null){var ae=ie.dehydrated;ae!==null&&mi(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}xt||o.flags&512&&Tf(o)}catch(se){Xe(o,o.return,se)}}if(o===n){pe=null;break}if(l=o.sibling,l!==null){l.return=o.return,pe=l;break}pe=o.return}}function U0(n){for(;pe!==null;){var o=pe;if(o===n){pe=null;break}var l=o.sibling;if(l!==null){l.return=o.return,pe=l;break}pe=o.return}}function F0(n){for(;pe!==null;){var o=pe;try{switch(o.tag){case 0:case 11:case 15:var l=o.return;try{za(4,o)}catch(H){Xe(o,l,H)}break;case 1:var d=o.stateNode;if(typeof d.componentDidMount=="function"){var g=o.return;try{d.componentDidMount()}catch(H){Xe(o,g,H)}}var y=o.return;try{Tf(o)}catch(H){Xe(o,y,H)}break;case 5:var R=o.return;try{Tf(o)}catch(H){Xe(o,R,H)}}}catch(H){Xe(o,o.return,H)}if(o===n){pe=null;break}var P=o.sibling;if(P!==null){P.return=o.return,pe=P;break}pe=o.return}}var Nb=Math.ceil,Wa=T.ReactCurrentDispatcher,Af=T.ReactCurrentOwner,nn=T.ReactCurrentBatchConfig,Ae=0,at=null,rt=null,mt=0,Gt=0,ms=Rr(0),st=0,Fi=null,uo=0,Ga=0,If=0,ji=null,Pt=null,bf=0,gs=1/0,or=null,Ya=!1,Lf=null,br=null,Ka=!1,Lr=null,Xa=0,Vi=0,Df=null,Qa=-1,qa=0;function Rt(){return(Ae&6)!==0?We():Qa!==-1?Qa:Qa=We()}function Dr(n){return(n.mode&1)===0?1:(Ae&2)!==0&&mt!==0?mt&-mt:lb.transition!==null?(qa===0&&(qa=IE()),qa):(n=ke,n!==0||(n=window.event,n=n===void 0?16:jE(n.type)),n)}function Sn(n,o,l,d){if(50<Vi)throw Vi=0,Df=null,Error(r(185));ui(n,l,d),((Ae&2)===0||n!==at)&&(n===at&&((Ae&2)===0&&(Ga|=l),st===4&&kr(n,mt)),Ut(n,d),l===1&&Ae===0&&(o.mode&1)===0&&(gs=We()+500,Ra&&Or()))}function Ut(n,o){var l=n.callbackNode;l2(n,o);var d=ia(n,n===at?mt:0);if(d===0)l!==null&&ea(l),n.callbackNode=null,n.callbackPriority=0;else if(o=d&-d,n.callbackPriority!==o){if(l!=null&&ea(l),o===1)n.tag===0?ib(V0.bind(null,n)):Ny(V0.bind(null,n)),nb(function(){(Ae&6)===0&&Or()}),l=null;else{switch(bE(d)){case 1:l=li;break;case 4:l=na;break;case 16:l=Xo;break;case 536870912:l=AE;break;default:l=Xo}l=K0(l,j0.bind(null,n))}n.callbackPriority=o,n.callbackNode=l}}function j0(n,o){if(Qa=-1,qa=0,(Ae&6)!==0)throw Error(r(327));var l=n.callbackNode;if(Es()&&n.callbackNode!==l)return null;var d=ia(n,n===at?mt:0);if(d===0)return null;if((d&30)!==0||(d&n.expiredLanes)!==0||o)o=Za(n,d);else{o=d;var g=Ae;Ae|=2;var y=H0();(at!==n||mt!==o)&&(or=null,gs=We()+500,po(n,o));do try{Ob();break}catch(P){$0(n,P)}while(!0);Qd(),Wa.current=y,Ae=g,rt!==null?o=0:(at=null,mt=0,o=st)}if(o!==0){if(o===2&&(g=fd(n),g!==0&&(d=g,o=kf(n,g))),o===1)throw l=Fi,po(n,0),kr(n,d),Ut(n,We()),l;if(o===6)kr(n,d);else{if(g=n.current.alternate,(d&30)===0&&!Rb(g)&&(o=Za(n,d),o===2&&(y=fd(n),y!==0&&(d=y,o=kf(n,y))),o===1))throw l=Fi,po(n,0),kr(n,d),Ut(n,We()),l;switch(n.finishedWork=g,n.finishedLanes=d,o){case 0:case 1:throw Error(r(345));case 2:ho(n,Pt,or);break;case 3:if(kr(n,d),(d&130023424)===d&&(o=bf+500-We(),10<o)){if(ia(n,0)!==0)break;if(g=n.suspendedLanes,(g&d)!==d){Rt(),n.pingedLanes|=n.suspendedLanes&g;break}n.timeoutHandle=jd(ho.bind(null,n,Pt,or),o);break}ho(n,Pt,or);break;case 4:if(kr(n,d),(d&4194240)===d)break;for(o=n.eventTimes,g=-1;0<d;){var R=31-mn(d);y=1<<R,R=o[R],R>g&&(g=R),d&=~y}if(d=g,d=We()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*Nb(d/1960))-d,10<d){n.timeoutHandle=jd(ho.bind(null,n,Pt,or),d);break}ho(n,Pt,or);break;case 5:ho(n,Pt,or);break;default:throw Error(r(329))}}}return Ut(n,We()),n.callbackNode===l?j0.bind(null,n):null}function kf(n,o){var l=ji;return n.current.memoizedState.isDehydrated&&(po(n,o).flags|=256),n=Za(n,o),n!==2&&(o=Pt,Pt=l,o!==null&&Mf(o)),n}function Mf(n){Pt===null?Pt=n:Pt.push.apply(Pt,n)}function Rb(n){for(var o=n;;){if(o.flags&16384){var l=o.updateQueue;if(l!==null&&(l=l.stores,l!==null))for(var d=0;d<l.length;d++){var g=l[d],y=g.getSnapshot;g=g.value;try{if(!gn(y(),g))return!1}catch{return!1}}}if(l=o.child,o.subtreeFlags&16384&&l!==null)l.return=o,o=l;else{if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function kr(n,o){for(o&=~If,o&=~Ga,n.suspendedLanes|=o,n.pingedLanes&=~o,n=n.expirationTimes;0<o;){var l=31-mn(o),d=1<<l;n[l]=-1,o&=~d}}function V0(n){if((Ae&6)!==0)throw Error(r(327));Es();var o=ia(n,0);if((o&1)===0)return Ut(n,We()),null;var l=Za(n,o);if(n.tag!==0&&l===2){var d=fd(n);d!==0&&(o=d,l=kf(n,d))}if(l===1)throw l=Fi,po(n,0),kr(n,o),Ut(n,We()),l;if(l===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=o,ho(n,Pt,or),Ut(n,We()),null}function Pf(n,o){var l=Ae;Ae|=1;try{return n(o)}finally{Ae=l,Ae===0&&(gs=We()+500,Ra&&Or())}}function fo(n){Lr!==null&&Lr.tag===0&&(Ae&6)===0&&Es();var o=Ae;Ae|=1;var l=nn.transition,d=ke;try{if(nn.transition=null,ke=1,n)return n()}finally{ke=d,nn.transition=l,Ae=o,(Ae&6)===0&&Or()}}function Uf(){Gt=ms.current,Ve(ms)}function po(n,o){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,tb(l)),rt!==null)for(l=rt.return;l!==null;){var d=l;switch(Wd(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&wa();break;case 3:fs(),Ve(Dt),Ve(Et),lf();break;case 5:of(d);break;case 4:fs();break;case 13:Ve(Ge);break;case 19:Ve(Ge);break;case 10:qd(d.type._context);break;case 22:case 23:Uf()}l=l.return}if(at=n,rt=n=Mr(n.current,null),mt=Gt=o,st=0,Fi=null,If=Ga=uo=0,Pt=ji=null,lo!==null){for(o=0;o<lo.length;o++)if(l=lo[o],d=l.interleaved,d!==null){l.interleaved=null;var g=d.next,y=l.pending;if(y!==null){var R=y.next;y.next=g,d.next=R}l.pending=d}lo=null}return n}function $0(n,o){do{var l=rt;try{if(Qd(),Pa.current=Va,Ua){for(var d=Ye.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}Ua=!1}if(co=0,lt=ot=Ye=null,Li=!1,Di=0,Af.current=null,l===null||l.return===null){st=1,Fi=o,rt=null;break}e:{var y=n,R=l.return,P=l,H=o;if(o=mt,P.flags|=32768,H!==null&&typeof H=="object"&&typeof H.then=="function"){var J=H,ie=P,ae=ie.tag;if((ie.mode&1)===0&&(ae===0||ae===11||ae===15)){var se=ie.alternate;se?(ie.updateQueue=se.updateQueue,ie.memoizedState=se.memoizedState,ie.lanes=se.lanes):(ie.updateQueue=null,ie.memoizedState=null)}var fe=f0(R);if(fe!==null){fe.flags&=-257,p0(fe,R,P,y,o),fe.mode&1&&d0(y,J,o),o=fe,H=J;var ge=o.updateQueue;if(ge===null){var Ee=new Set;Ee.add(H),o.updateQueue=Ee}else ge.add(H);break e}else{if((o&1)===0){d0(y,J,o),Ff();break e}H=Error(r(426))}}else if(ze&&P.mode&1){var et=f0(R);if(et!==null){(et.flags&65536)===0&&(et.flags|=256),p0(et,R,P,y,o),Kd(ps(H,P));break e}}y=H=ps(H,P),st!==4&&(st=2),ji===null?ji=[y]:ji.push(y),y=R;do{switch(y.tag){case 3:y.flags|=65536,o&=-o,y.lanes|=o;var q=c0(y,H,o);Ly(y,q);break e;case 1:P=H;var G=y.type,Z=y.stateNode;if((y.flags&128)===0&&(typeof G.getDerivedStateFromError=="function"||Z!==null&&typeof Z.componentDidCatch=="function"&&(br===null||!br.has(Z)))){y.flags|=65536,o&=-o,y.lanes|=o;var ce=u0(y,P,o);Ly(y,ce);break e}}y=y.return}while(y!==null)}z0(l)}catch(ve){o=ve,rt===l&&l!==null&&(rt=l=l.return);continue}break}while(!0)}function H0(){var n=Wa.current;return Wa.current=Va,n===null?Va:n}function Ff(){(st===0||st===3||st===2)&&(st=4),at===null||(uo&268435455)===0&&(Ga&268435455)===0||kr(at,mt)}function Za(n,o){var l=Ae;Ae|=2;var d=H0();(at!==n||mt!==o)&&(or=null,po(n,o));do try{Tb();break}catch(g){$0(n,g)}while(!0);if(Qd(),Ae=l,Wa.current=d,rt!==null)throw Error(r(261));return at=null,mt=0,st}function Tb(){for(;rt!==null;)B0(rt)}function Ob(){for(;rt!==null&&!ud();)B0(rt)}function B0(n){var o=Y0(n.alternate,n,Gt);n.memoizedProps=n.pendingProps,o===null?z0(n):rt=o,Af.current=null}function z0(n){var o=n;do{var l=o.alternate;if(n=o.return,(o.flags&32768)===0){if(l=vb(l,o,Gt),l!==null){rt=l;return}}else{if(l=xb(l,o),l!==null){l.flags&=32767,rt=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{st=6,rt=null;return}}if(o=o.sibling,o!==null){rt=o;return}rt=o=n}while(o!==null);st===0&&(st=5)}function ho(n,o,l){var d=ke,g=nn.transition;try{nn.transition=null,ke=1,Cb(n,o,l,d)}finally{nn.transition=g,ke=d}return null}function Cb(n,o,l,d){do Es();while(Lr!==null);if((Ae&6)!==0)throw Error(r(327));l=n.finishedWork;var g=n.finishedLanes;if(l===null)return null;if(n.finishedWork=null,n.finishedLanes=0,l===n.current)throw Error(r(177));n.callbackNode=null,n.callbackPriority=0;var y=l.lanes|l.childLanes;if(a2(n,y),n===at&&(rt=at=null,mt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||Ka||(Ka=!0,K0(Xo,function(){return Es(),null})),y=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||y){y=nn.transition,nn.transition=null;var R=ke;ke=1;var P=Ae;Ae|=4,Af.current=null,_b(n,l),k0(l,n),K2(Ud),ca=!!Pd,Ud=Pd=null,n.current=l,wb(l),dd(),Ae=P,ke=R,nn.transition=y}else n.current=l;if(Ka&&(Ka=!1,Lr=n,Xa=g),y=n.pendingLanes,y===0&&(br=null),n2(l.stateNode),Ut(n,We()),o!==null)for(d=n.onRecoverableError,l=0;l<o.length;l++)g=o[l],d(g.value,{componentStack:g.stack,digest:g.digest});if(Ya)throw Ya=!1,n=Lf,Lf=null,n;return(Xa&1)!==0&&n.tag!==0&&Es(),y=n.pendingLanes,(y&1)!==0?n===Df?Vi++:(Vi=0,Df=n):Vi=0,Or(),null}function Es(){if(Lr!==null){var n=bE(Xa),o=nn.transition,l=ke;try{if(nn.transition=null,ke=16>n?16:n,Lr===null)var d=!1;else{if(n=Lr,Lr=null,Xa=0,(Ae&6)!==0)throw Error(r(331));var g=Ae;for(Ae|=4,pe=n.current;pe!==null;){var y=pe,R=y.child;if((pe.flags&16)!==0){var P=y.deletions;if(P!==null){for(var H=0;H<P.length;H++){var J=P[H];for(pe=J;pe!==null;){var ie=pe;switch(ie.tag){case 0:case 11:case 15:Ui(8,ie,y)}var ae=ie.child;if(ae!==null)ae.return=ie,pe=ae;else for(;pe!==null;){ie=pe;var se=ie.sibling,fe=ie.return;if(A0(ie),ie===J){pe=null;break}if(se!==null){se.return=fe,pe=se;break}pe=fe}}}var ge=y.alternate;if(ge!==null){var Ee=ge.child;if(Ee!==null){ge.child=null;do{var et=Ee.sibling;Ee.sibling=null,Ee=et}while(Ee!==null)}}pe=y}}if((y.subtreeFlags&2064)!==0&&R!==null)R.return=y,pe=R;else e:for(;pe!==null;){if(y=pe,(y.flags&2048)!==0)switch(y.tag){case 0:case 11:case 15:Ui(9,y,y.return)}var q=y.sibling;if(q!==null){q.return=y.return,pe=q;break e}pe=y.return}}var G=n.current;for(pe=G;pe!==null;){R=pe;var Z=R.child;if((R.subtreeFlags&2064)!==0&&Z!==null)Z.return=R,pe=Z;else e:for(R=G;pe!==null;){if(P=pe,(P.flags&2048)!==0)try{switch(P.tag){case 0:case 11:case 15:za(9,P)}}catch(ve){Xe(P,P.return,ve)}if(P===R){pe=null;break e}var ce=P.sibling;if(ce!==null){ce.return=P.return,pe=ce;break e}pe=P.return}}if(Ae=g,Or(),Ln&&typeof Ln.onPostCommitFiberRoot=="function")try{Ln.onPostCommitFiberRoot(ra,n)}catch{}d=!0}return d}finally{ke=l,nn.transition=o}}return!1}function W0(n,o,l){o=ps(l,o),o=c0(n,o,1),n=Ar(n,o,1),o=Rt(),n!==null&&(ui(n,1,o),Ut(n,o))}function Xe(n,o,l){if(n.tag===3)W0(n,n,l);else for(;o!==null;){if(o.tag===3){W0(o,n,l);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(br===null||!br.has(d))){n=ps(l,n),n=u0(o,n,1),o=Ar(o,n,1),n=Rt(),o!==null&&(ui(o,1,n),Ut(o,n));break}}o=o.return}}function Ab(n,o,l){var d=n.pingCache;d!==null&&d.delete(o),o=Rt(),n.pingedLanes|=n.suspendedLanes&l,at===n&&(mt&l)===l&&(st===4||st===3&&(mt&130023424)===mt&&500>We()-bf?po(n,0):If|=l),Ut(n,o)}function G0(n,o){o===0&&((n.mode&1)===0?o=1:(o=sa,sa<<=1,(sa&130023424)===0&&(sa=4194304)));var l=Rt();n=tr(n,o),n!==null&&(ui(n,o,l),Ut(n,l))}function Ib(n){var o=n.memoizedState,l=0;o!==null&&(l=o.retryLane),G0(n,l)}function bb(n,o){var l=0;switch(n.tag){case 13:var d=n.stateNode,g=n.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=n.stateNode;break;default:throw Error(r(314))}d!==null&&d.delete(o),G0(n,l)}var Y0;Y0=function(n,o,l){if(n!==null)if(n.memoizedProps!==o.pendingProps||Dt.current)Mt=!0;else{if((n.lanes&l)===0&&(o.flags&128)===0)return Mt=!1,yb(n,o,l);Mt=(n.flags&131072)!==0}else Mt=!1,ze&&(o.flags&1048576)!==0&&Ry(o,Oa,o.index);switch(o.lanes=0,o.tag){case 2:var d=o.type;Ha(n,o),n=o.pendingProps;var g=ss(o,Et.current);us(o,l),g=uf(null,o,d,n,g,l);var y=df();return o.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,kt(d)?(y=!0,Na(o)):y=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,ef(o),g.updater=Da,o.stateNode=g,g._reactInternals=o,nf(o,d,n,l),o=vf(null,o,d,!0,y,l)):(o.tag=0,ze&&y&&zd(o),Nt(null,o,g,l),o=o.child),o;case 16:d=o.elementType;e:{switch(Ha(n,o),n=o.pendingProps,g=d._init,d=g(d._payload),o.type=d,g=o.tag=Db(d),n=yn(d,n),g){case 0:o=yf(null,o,d,n,l);break e;case 1:o=v0(null,o,d,n,l);break e;case 11:o=h0(null,o,d,n,l);break e;case 14:o=m0(null,o,d,yn(d.type,n),l);break e}throw Error(r(306,d,""))}return o;case 0:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:yn(d,g),yf(n,o,d,g,l);case 1:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:yn(d,g),v0(n,o,d,g,l);case 3:e:{if(x0(o),n===null)throw Error(r(387));d=o.pendingProps,y=o.memoizedState,g=y.element,by(n,o),La(o,d,null,l);var R=o.memoizedState;if(d=R.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},o.updateQueue.baseState=y,o.memoizedState=y,o.flags&256){g=ps(Error(r(423)),o),o=S0(n,o,d,l,g);break e}else if(d!==g){g=ps(Error(r(424)),o),o=S0(n,o,d,l,g);break e}else for(Wt=Nr(o.stateNode.containerInfo.firstChild),zt=o,ze=!0,En=null,l=Vy(o,null,d,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(as(),d===g){o=rr(n,o,l);break e}Nt(n,o,d,l)}o=o.child}return o;case 5:return $y(o),n===null&&Yd(o),d=o.type,g=o.pendingProps,y=n!==null?n.memoizedProps:null,R=g.children,Fd(d,g)?R=null:y!==null&&Fd(d,y)&&(o.flags|=32),y0(n,o),Nt(n,o,R,l),o.child;case 6:return n===null&&Yd(o),null;case 13:return _0(n,o,l);case 4:return rf(o,o.stateNode.containerInfo),d=o.pendingProps,n===null?o.child=ds(o,null,d,l):Nt(n,o,d,l),o.child;case 11:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:yn(d,g),h0(n,o,d,g,l);case 7:return Nt(n,o,o.pendingProps,l),o.child;case 8:return Nt(n,o,o.pendingProps.children,l),o.child;case 12:return Nt(n,o,o.pendingProps.children,l),o.child;case 10:e:{if(d=o.type._context,g=o.pendingProps,y=o.memoizedProps,R=g.value,Fe(Aa,d._currentValue),d._currentValue=R,y!==null)if(gn(y.value,R)){if(y.children===g.children&&!Dt.current){o=rr(n,o,l);break e}}else for(y=o.child,y!==null&&(y.return=o);y!==null;){var P=y.dependencies;if(P!==null){R=y.child;for(var H=P.firstContext;H!==null;){if(H.context===d){if(y.tag===1){H=nr(-1,l&-l),H.tag=2;var J=y.updateQueue;if(J!==null){J=J.shared;var ie=J.pending;ie===null?H.next=H:(H.next=ie.next,ie.next=H),J.pending=H}}y.lanes|=l,H=y.alternate,H!==null&&(H.lanes|=l),Zd(y.return,l,o),P.lanes|=l;break}H=H.next}}else if(y.tag===10)R=y.type===o.type?null:y.child;else if(y.tag===18){if(R=y.return,R===null)throw Error(r(341));R.lanes|=l,P=R.alternate,P!==null&&(P.lanes|=l),Zd(R,l,o),R=y.sibling}else R=y.child;if(R!==null)R.return=y;else for(R=y;R!==null;){if(R===o){R=null;break}if(y=R.sibling,y!==null){y.return=R.return,R=y;break}R=R.return}y=R}Nt(n,o,g.children,l),o=o.child}return o;case 9:return g=o.type,d=o.pendingProps.children,us(o,l),g=en(g),d=d(g),o.flags|=1,Nt(n,o,d,l),o.child;case 14:return d=o.type,g=yn(d,o.pendingProps),g=yn(d.type,g),m0(n,o,d,g,l);case 15:return g0(n,o,o.type,o.pendingProps,l);case 17:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:yn(d,g),Ha(n,o),o.tag=1,kt(d)?(n=!0,Na(o)):n=!1,us(o,l),Py(o,d,g),nf(o,d,g,l),vf(null,o,d,!0,n,l);case 19:return N0(n,o,l);case 22:return E0(n,o,l)}throw Error(r(156,o.tag))};function K0(n,o){return Jl(n,o)}function Lb(n,o,l,d){this.tag=n,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function rn(n,o,l,d){return new Lb(n,o,l,d)}function jf(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Db(n){if(typeof n=="function")return jf(n)?1:0;if(n!=null){if(n=n.$$typeof,n===ne)return 11;if(n===V)return 14}return 2}function Mr(n,o){var l=n.alternate;return l===null?(l=rn(n.tag,o,n.key,n.mode),l.elementType=n.elementType,l.type=n.type,l.stateNode=n.stateNode,l.alternate=n,n.alternate=l):(l.pendingProps=o,l.type=n.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=n.flags&14680064,l.childLanes=n.childLanes,l.lanes=n.lanes,l.child=n.child,l.memoizedProps=n.memoizedProps,l.memoizedState=n.memoizedState,l.updateQueue=n.updateQueue,o=n.dependencies,l.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},l.sibling=n.sibling,l.index=n.index,l.ref=n.ref,l}function Ja(n,o,l,d,g,y){var R=2;if(d=n,typeof n=="function")jf(n)&&(R=1);else if(typeof n=="string")R=5;else e:switch(n){case F:return mo(l.children,g,y,o);case K:R=8,g|=8;break;case Q:return n=rn(12,l,o,g|2),n.elementType=Q,n.lanes=y,n;case W:return n=rn(13,l,o,g),n.elementType=W,n.lanes=y,n;case I:return n=rn(19,l,o,g),n.elementType=I,n.lanes=y,n;case B:return ec(l,g,y,o);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case X:R=10;break e;case ee:R=9;break e;case ne:R=11;break e;case V:R=14;break e;case j:R=16,d=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return o=rn(R,l,o,g),o.elementType=n,o.type=d,o.lanes=y,o}function mo(n,o,l,d){return n=rn(7,n,d,o),n.lanes=l,n}function ec(n,o,l,d){return n=rn(22,n,d,o),n.elementType=B,n.lanes=l,n.stateNode={isHidden:!1},n}function Vf(n,o,l){return n=rn(6,n,null,o),n.lanes=l,n}function $f(n,o,l){return o=rn(4,n.children!==null?n.children:[],n.key,o),o.lanes=l,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}function kb(n,o,l,d,g){this.tag=o,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pd(0),this.expirationTimes=pd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pd(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function Hf(n,o,l,d,g,y,R,P,H){return n=new kb(n,o,l,P,H),o===1?(o=1,y===!0&&(o|=8)):o=0,y=rn(3,null,null,o),n.current=y,y.stateNode=n,y.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},ef(y),n}function Mb(n,o,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:L,key:d==null?null:""+d,children:n,containerInfo:o,implementation:l}}function X0(n){if(!n)return Tr;n=n._reactInternals;e:{if(Qn(n)!==n||n.tag!==1)throw Error(r(170));var o=n;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(kt(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(r(171))}if(n.tag===1){var l=n.type;if(kt(l))return _y(n,l,o)}return o}function Q0(n,o,l,d,g,y,R,P,H){return n=Hf(l,d,!0,n,g,y,R,P,H),n.context=X0(null),l=n.current,d=Rt(),g=Dr(l),y=nr(d,g),y.callback=o??null,Ar(l,y,g),n.current.lanes=g,ui(n,g,d),Ut(n,d),n}function tc(n,o,l,d){var g=o.current,y=Rt(),R=Dr(g);return l=X0(l),o.context===null?o.context=l:o.pendingContext=l,o=nr(y,R),o.payload={element:n},d=d===void 0?null:d,d!==null&&(o.callback=d),n=Ar(g,o,R),n!==null&&(Sn(n,g,R,y),ba(n,g,R)),R}function nc(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function q0(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<o?l:o}}function Bf(n,o){q0(n,o),(n=n.alternate)&&q0(n,o)}function Pb(){return null}var Z0=typeof reportError=="function"?reportError:function(n){console.error(n)};function zf(n){this._internalRoot=n}rc.prototype.render=zf.prototype.render=function(n){var o=this._internalRoot;if(o===null)throw Error(r(409));tc(n,o,null,null)},rc.prototype.unmount=zf.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var o=n.containerInfo;fo(function(){tc(null,n,null,null)}),o[qn]=null}};function rc(n){this._internalRoot=n}rc.prototype.unstable_scheduleHydration=function(n){if(n){var o=kE();n={blockedOn:null,target:n,priority:o};for(var l=0;l<Sr.length&&o!==0&&o<Sr[l].priority;l++);Sr.splice(l,0,n),l===0&&UE(n)}};function Wf(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function oc(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function J0(){}function Ub(n,o,l,d,g){if(g){if(typeof d=="function"){var y=d;d=function(){var J=nc(R);y.call(J)}}var R=Q0(o,d,n,0,null,!1,!1,"",J0);return n._reactRootContainer=R,n[qn]=R.current,Ni(n.nodeType===8?n.parentNode:n),fo(),R}for(;g=n.lastChild;)n.removeChild(g);if(typeof d=="function"){var P=d;d=function(){var J=nc(H);P.call(J)}}var H=Hf(n,0,!1,null,null,!1,!1,"",J0);return n._reactRootContainer=H,n[qn]=H.current,Ni(n.nodeType===8?n.parentNode:n),fo(function(){tc(o,H,l,d)}),H}function sc(n,o,l,d,g){var y=l._reactRootContainer;if(y){var R=y;if(typeof g=="function"){var P=g;g=function(){var H=nc(R);P.call(H)}}tc(o,R,n,g)}else R=Ub(l,o,n,g,d);return nc(R)}LE=function(n){switch(n.tag){case 3:var o=n.stateNode;if(o.current.memoizedState.isDehydrated){var l=ci(o.pendingLanes);l!==0&&(hd(o,l|1),Ut(o,We()),(Ae&6)===0&&(gs=We()+500,Or()))}break;case 13:fo(function(){var d=tr(n,1);if(d!==null){var g=Rt();Sn(d,n,1,g)}}),Bf(n,1)}},md=function(n){if(n.tag===13){var o=tr(n,134217728);if(o!==null){var l=Rt();Sn(o,n,134217728,l)}Bf(n,134217728)}},DE=function(n){if(n.tag===13){var o=Dr(n),l=tr(n,o);if(l!==null){var d=Rt();Sn(l,n,o,d)}Bf(n,o)}},kE=function(){return ke},ME=function(n,o){var l=ke;try{return ke=n,o()}finally{ke=l}},Zr=function(n,o,l){switch(o){case"input":if(pt(n,l),o=l.name,l.type==="radio"&&o!=null){for(l=n;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<l.length;o++){var d=l[o];if(d!==n&&d.form===n.form){var g=_a(d);if(!g)throw Error(r(90));Je(d),pt(d,g)}}}break;case"textarea":dn(n,l);break;case"select":o=l.value,o!=null&&Qt(n,!!l.multiple,o,!1)}},Yl=Pf,Kl=fo;var Fb={usingClientEntryPoint:!1,Events:[Oi,rs,_a,Wl,Gl,Pf]},$i={findFiberByHostInstance:ro,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},jb={bundleType:$i.bundleType,version:$i.version,rendererPackageName:$i.rendererPackageName,rendererConfig:$i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:T.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=ii(n),n===null?null:n.stateNode},findFiberByHostInstance:$i.findFiberByHostInstance||Pb,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0-next-9e3b772b8-20220608"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ic.isDisabled&&ic.supportsFiber)try{ra=ic.inject(jb),Ln=ic}catch{}}return Tt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Fb,Tt.createPortal=function(n,o){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wf(o))throw Error(r(200));return Mb(n,o,null,l)},Tt.createRoot=function(n,o){if(!Wf(n))throw Error(r(299));var l=!1,d="",g=Z0;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=Hf(n,1,!1,null,null,l,!1,d,g),n[qn]=o.current,Ni(n.nodeType===8?n.parentNode:n),new zf(o)},Tt.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var o=n._reactInternals;if(o===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=ii(o),n=n===null?null:n.stateNode,n},Tt.flushSync=function(n){return fo(n)},Tt.hydrate=function(n,o,l){if(!oc(o))throw Error(r(200));return sc(null,n,o,!0,l)},Tt.hydrateRoot=function(n,o,l){if(!Wf(n))throw Error(r(405));var d=l!=null&&l.hydratedSources||null,g=!1,y="",R=Z0;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onRecoverableError!==void 0&&(R=l.onRecoverableError)),o=Q0(o,null,n,1,l??null,g,!1,y,R),n[qn]=o.current,Ni(n),d)for(n=0;n<d.length;n++)l=d[n],g=l._getVersion,g=g(l._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[l,g]:o.mutableSourceEagerHydrationData.push(l,g);return new rc(o)},Tt.render=function(n,o,l){if(!oc(o))throw Error(r(200));return sc(null,n,o,!1,l)},Tt.unmountComponentAtNode=function(n){if(!oc(n))throw Error(r(40));return n._reactRootContainer?(fo(function(){sc(null,null,n,!1,function(){n._reactRootContainer=null,n[qn]=null})}),!0):!1},Tt.unstable_batchedUpdates=Pf,Tt.unstable_renderSubtreeIntoContainer=function(n,o,l,d){if(!oc(l))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return sc(n,o,l,!1,d)},Tt.version="18.2.0-next-9e3b772b8-20220608",Tt}var sp;function ip(){if(sp)return yc.exports;sp=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),yc.exports=zv(),yc.exports}var lp;function Wv(){if(lp)return zi;lp=1;var e=ip();return zi.createRoot=e.createRoot,zi.hydrateRoot=e.hydrateRoot,zi}var Gv=Wv();const Yv=Hi(Gv);function St(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,s;r<e.length;r++)(s=St(e[r]))!==""&&(t+=(t&&" ")+s);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var Sc={exports:{}},_c={},wc={exports:{}},Nc={};/**
45
45
  * @license React
46
46
  * use-sync-external-store-shim.production.min.js
47
47
  *
@@ -49,7 +49,7 @@ Error generating stack: `+v.message+`
49
49
  *
50
50
  * This source code is licensed under the MIT license found in the
51
51
  * LICENSE file in the root directory of this source tree.
52
- */var ap;function Kv(){if(ap)return Nc;ap=1;var e=Ss();function t(y,E){return y===E&&(y!==0||1/y===1/E)||y!==y&&E!==E}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,l=e.useLayoutEffect,c=e.useDebugValue;function u(y,E){var x=E(),_=s({inst:{value:x,getSnapshot:E}}),w=_[0].inst,S=_[1];return l(function(){w.value=x,w.getSnapshot=E,f(w)&&S({inst:w})},[y,x,E]),i(function(){return f(w)&&S({inst:w}),y(function(){f(w)&&S({inst:w})})},[y]),c(x),x}function f(y){var E=y.getSnapshot;y=y.value;try{var x=E();return!n(y,x)}catch{return!0}}function p(y,E){return E()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Nc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Nc}var cp;function Xv(){return cp||(cp=1,wc.exports=Kv()),wc.exports}/**
52
+ */var ap;function Kv(){if(ap)return Nc;ap=1;var e=xs();function t(E,v){return E===v&&(E!==0||1/E===1/v)||E!==E&&v!==v}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function u(E,v){var x=v(),_=s({inst:{value:x,getSnapshot:v}}),w=_[0].inst,S=_[1];return a(function(){w.value=x,w.getSnapshot=v,f(w)&&S({inst:w})},[E,x,v]),i(function(){return f(w)&&S({inst:w}),E(function(){f(w)&&S({inst:w})})},[E]),c(x),x}function f(E){var v=E.getSnapshot;E=E.value;try{var x=v();return!r(E,x)}catch{return!0}}function p(E,v){return v()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Nc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Nc}var cp;function Xv(){return cp||(cp=1,wc.exports=Kv()),wc.exports}/**
53
53
  * @license React
54
54
  * use-sync-external-store-shim/with-selector.production.min.js
55
55
  *
@@ -57,14 +57,14 @@ Error generating stack: `+v.message+`
57
57
  *
58
58
  * This source code is licensed under the MIT license found in the
59
59
  * LICENSE file in the root directory of this source tree.
60
- */var up;function Qv(){if(up)return _c;up=1;var e=Ss(),t=Xv();function n(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var s=typeof Object.is=="function"?Object.is:n,i=t.useSyncExternalStore,l=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return _c.useSyncExternalStoreWithSelector=function(p,m,y,E,x){var _=l(null);if(_.current===null){var w={hasValue:!1,value:null};_.current=w}else w=_.current;_=u(function(){function N(L){if(!R){if(R=!0,P=L,L=E(L),x!==void 0&&w.hasValue){var U=w.value;if(x(U,L))return C=U}return C=L}if(U=C,s(P,L))return U;var G=E(L);return x!==void 0&&x(U,G)?U:(P=L,C=G)}var R=!1,P,C,I=y===void 0?null:y;return[function(){return N(m())},I===null?void 0:function(){return N(I())}]},[m,y,E,x]);var S=i(p,_[0],_[1]);return c(function(){w.hasValue=!0,w.value=S},[S]),f(S),S},_c}var dp;function qv(){return dp||(dp=1,Sc.exports=Qv()),Sc.exports}var Jv=qv();const fp=Bi(Jv),Zv={},pp=e=>{let t;const n=new Set,s=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const y=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(E=>E(t,y))}},i=()=>t,u={setState:s,getState:i,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Zv?"staging":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}};return t=e(s,i,u),u},hp=e=>e?pp(e):pp,{useDebugValue:ex}=ne,{useSyncExternalStoreWithSelector:tx}=fp;function mp(e,t=e.getState,n){const s=tx(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return ex(s),s}const gp=(e,t)=>{const n=hp(e),s=(i,l=t)=>mp(n,i,l);return Object.assign(s,n),s},nx=(e,t)=>e?gp(e,t):gp;function gt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let s=0;s<n.length;s++)if(!Object.prototype.hasOwnProperty.call(t,n[s])||!Object.is(e[n[s]],t[n[s]]))return!1;return!0}var rx={value:()=>{}};function Gi(){for(var e=0,t=arguments.length,n={},s;e<t;++e){if(!(s=arguments[e]+"")||s in n||/[\s.]/.test(s))throw new Error("illegal type: "+s);n[s]=[]}return new Yi(n)}function Yi(e){this._=e}function ox(e,t){return e.trim().split(/^|\s+/).map(function(n){var s="",i=n.indexOf(".");if(i>=0&&(s=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Yi.prototype=Gi.prototype={constructor:Yi,on:function(e,t){var n=this._,s=ox(e+"",n),i,l=-1,c=s.length;if(arguments.length<2){for(;++l<c;)if((i=(e=s[l]).type)&&(i=sx(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<c;)if(i=(e=s[l]).type)n[i]=yp(n[i],e.name,t);else if(t==null)for(i in n)n[i]=yp(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yi(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),s=0,i,l;s<i;++s)n[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],s=0,i=l.length;s<i;++s)l[s].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,l=s.length;i<l;++i)s[i].value.apply(t,n)}};function sx(e,t){for(var n=0,s=e.length,i;n<s;++n)if((i=e[n]).name===t)return i.value}function yp(e,t,n){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=rx,e=e.slice(0,s).concat(e.slice(s+1));break}return n!=null&&e.push({name:t,value:n}),e}var Rc="http://www.w3.org/1999/xhtml";const Ep={svg:"http://www.w3.org/2000/svg",xhtml:Rc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ki(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ep.hasOwnProperty(t)?{space:Ep[t],local:e}:e}function ix(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Rc&&t.documentElement.namespaceURI===Rc?t.createElement(e):t.createElementNS(n,e)}}function lx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vp(e){var t=Ki(e);return(t.local?lx:ix)(t)}function ax(){}function Tc(e){return e==null?ax:function(){return this.querySelector(e)}}function cx(e){typeof e!="function"&&(e=Tc(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var l=t[i],c=l.length,u=s[i]=new Array(c),f,p,m=0;m<c;++m)(f=l[m])&&(p=e.call(f,f.__data__,m,l))&&("__data__"in f&&(p.__data__=f.__data__),u[m]=p);return new Ft(s,this._parents)}function ux(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dx(){return[]}function xp(e){return e==null?dx:function(){return this.querySelectorAll(e)}}function fx(e){return function(){return ux(e.apply(this,arguments))}}function px(e){typeof e=="function"?e=fx(e):e=xp(e);for(var t=this._groups,n=t.length,s=[],i=[],l=0;l<n;++l)for(var c=t[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),i.push(f));return new Ft(s,i)}function Sp(e){return function(){return this.matches(e)}}function _p(e){return function(t){return t.matches(e)}}var hx=Array.prototype.find;function mx(e){return function(){return hx.call(this.children,e)}}function gx(){return this.firstElementChild}function yx(e){return this.select(e==null?gx:mx(typeof e=="function"?e:_p(e)))}var Ex=Array.prototype.filter;function vx(){return Array.from(this.children)}function xx(e){return function(){return Ex.call(this.children,e)}}function Sx(e){return this.selectAll(e==null?vx:xx(typeof e=="function"?e:_p(e)))}function _x(e){typeof e!="function"&&(e=Sp(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var l=t[i],c=l.length,u=s[i]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Ft(s,this._parents)}function wp(e){return new Array(e.length)}function wx(){return new Ft(this._enter||this._groups.map(wp),this._parents)}function Xi(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Xi.prototype={constructor:Xi,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Nx(e){return function(){return e}}function Rx(e,t,n,s,i,l){for(var c=0,u,f=t.length,p=l.length;c<p;++c)(u=t[c])?(u.__data__=l[c],s[c]=u):n[c]=new Xi(e,l[c]);for(;c<f;++c)(u=t[c])&&(i[c]=u)}function Tx(e,t,n,s,i,l,c){var u,f,p=new Map,m=t.length,y=l.length,E=new Array(m),x;for(u=0;u<m;++u)(f=t[u])&&(E[u]=x=c.call(f,f.__data__,u,t)+"",p.has(x)?i[u]=f:p.set(x,f));for(u=0;u<y;++u)x=c.call(e,l[u],u,l)+"",(f=p.get(x))?(s[u]=f,f.__data__=l[u],p.delete(x)):n[u]=new Xi(e,l[u]);for(u=0;u<m;++u)(f=t[u])&&p.get(E[u])===f&&(i[u]=f)}function Ox(e){return e.__data__}function Cx(e,t){if(!arguments.length)return Array.from(this,Ox);var n=t?Tx:Rx,s=this._parents,i=this._groups;typeof e!="function"&&(e=Nx(e));for(var l=i.length,c=new Array(l),u=new Array(l),f=new Array(l),p=0;p<l;++p){var m=s[p],y=i[p],E=y.length,x=Ax(e.call(m,m&&m.__data__,p,s)),_=x.length,w=u[p]=new Array(_),S=c[p]=new Array(_),N=f[p]=new Array(E);n(m,y,w,S,N,x,t);for(var R=0,P=0,C,I;R<_;++R)if(C=w[R]){for(R>=P&&(P=R+1);!(I=S[P])&&++P<_;);C._next=I||null}}return c=new Ft(c,s),c._enter=u,c._exit=f,c}function Ax(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ix(){return new Ft(this._exit||this._groups.map(wp),this._parents)}function bx(e,t,n){var s=this.enter(),i=this,l=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?l.remove():n(l),s&&i?s.merge(i).order():i}function Lx(e){for(var t=e.selection?e.selection():e,n=this._groups,s=t._groups,i=n.length,l=s.length,c=Math.min(i,l),u=new Array(i),f=0;f<c;++f)for(var p=n[f],m=s[f],y=p.length,E=u[f]=new Array(y),x,_=0;_<y;++_)(x=p[_]||m[_])&&(E[_]=x);for(;f<i;++f)u[f]=n[f];return new Ft(u,this._parents)}function Dx(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var s=e[t],i=s.length-1,l=s[i],c;--i>=0;)(c=s[i])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function kx(e){e||(e=Px);function t(y,E){return y&&E?e(y.__data__,E.__data__):!y-!E}for(var n=this._groups,s=n.length,i=new Array(s),l=0;l<s;++l){for(var c=n[l],u=c.length,f=i[l]=new Array(u),p,m=0;m<u;++m)(p=c[m])&&(f[m]=p);f.sort(t)}return new Ft(i,this._parents).order()}function Px(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Mx(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function jx(){return Array.from(this)}function Ux(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,l=s.length;i<l;++i){var c=s[i];if(c)return c}return null}function Fx(){let e=0;for(const t of this)++e;return e}function Vx(){return!this.node()}function $x(e){for(var t=this._groups,n=0,s=t.length;n<s;++n)for(var i=t[n],l=0,c=i.length,u;l<c;++l)(u=i[l])&&e.call(u,u.__data__,l,i);return this}function Hx(e){return function(){this.removeAttribute(e)}}function Bx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zx(e,t){return function(){this.setAttribute(e,t)}}function Wx(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gx(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Yx(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Kx(e,t){var n=Ki(e);if(arguments.length<2){var s=this.node();return n.local?s.getAttributeNS(n.space,n.local):s.getAttribute(n)}return this.each((t==null?n.local?Bx:Hx:typeof t=="function"?n.local?Yx:Gx:n.local?Wx:zx)(n,t))}function Np(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xx(e){return function(){this.style.removeProperty(e)}}function Qx(e,t,n){return function(){this.style.setProperty(e,t,n)}}function qx(e,t,n){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,n)}}function Jx(e,t,n){return arguments.length>1?this.each((t==null?Xx:typeof t=="function"?qx:Qx)(e,t,n??"")):Eo(this.node(),e)}function Eo(e,t){return e.style.getPropertyValue(t)||Np(e).getComputedStyle(e,null).getPropertyValue(t)}function Zx(e){return function(){delete this[e]}}function eS(e,t){return function(){this[e]=t}}function tS(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nS(e,t){return arguments.length>1?this.each((t==null?Zx:typeof t=="function"?tS:eS)(e,t)):this.node()[e]}function Rp(e){return e.trim().split(/^|\s+/)}function Oc(e){return e.classList||new Tp(e)}function Tp(e){this._node=e,this._names=Rp(e.getAttribute("class")||"")}Tp.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Op(e,t){for(var n=Oc(e),s=-1,i=t.length;++s<i;)n.add(t[s])}function Cp(e,t){for(var n=Oc(e),s=-1,i=t.length;++s<i;)n.remove(t[s])}function rS(e){return function(){Op(this,e)}}function oS(e){return function(){Cp(this,e)}}function sS(e,t){return function(){(t.apply(this,arguments)?Op:Cp)(this,e)}}function iS(e,t){var n=Rp(e+"");if(arguments.length<2){for(var s=Oc(this.node()),i=-1,l=n.length;++i<l;)if(!s.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?sS:t?rS:oS)(n,t))}function lS(){this.textContent=""}function aS(e){return function(){this.textContent=e}}function cS(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function uS(e){return arguments.length?this.each(e==null?lS:(typeof e=="function"?cS:aS)(e)):this.node().textContent}function dS(){this.innerHTML=""}function fS(e){return function(){this.innerHTML=e}}function pS(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function hS(e){return arguments.length?this.each(e==null?dS:(typeof e=="function"?pS:fS)(e)):this.node().innerHTML}function mS(){this.nextSibling&&this.parentNode.appendChild(this)}function gS(){return this.each(mS)}function yS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ES(){return this.each(yS)}function vS(e){var t=typeof e=="function"?e:vp(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function xS(){return null}function SS(e,t){var n=typeof e=="function"?e:vp(e),s=t==null?xS:typeof t=="function"?t:Tc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),s.apply(this,arguments)||null)})}function _S(){var e=this.parentNode;e&&e.removeChild(this)}function wS(){return this.each(_S)}function NS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function RS(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function TS(e){return this.select(e?RS:NS)}function OS(e){return arguments.length?this.property("__data__",e):this.node().__data__}function CS(e){return function(t){e.call(this,t,this.__data__)}}function AS(e){return e.trim().split(/^|\s+/).map(function(t){var n="",s=t.indexOf(".");return s>=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function IS(e){return function(){var t=this.__on;if(t){for(var n=0,s=-1,i=t.length,l;n<i;++n)l=t[n],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++s]=l;++s?t.length=s:delete this.__on}}}function bS(e,t,n){return function(){var s=this.__on,i,l=CS(t);if(s){for(var c=0,u=s.length;c<u;++c)if((i=s[c]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=l,i.options=n),i.value=t;return}}this.addEventListener(e.type,l,n),i={type:e.type,name:e.name,value:t,listener:l,options:n},s?s.push(i):this.__on=[i]}}function LS(e,t,n){var s=AS(e+""),i,l=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,m;f<p;++f)for(i=0,m=u[f];i<l;++i)if((c=s[i]).type===m.type&&c.name===m.name)return m.value}return}for(u=t?bS:IS,i=0;i<l;++i)this.each(u(s[i],t,n));return this}function Ap(e,t,n){var s=Np(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,n):(i=s.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function DS(e,t){return function(){return Ap(this,e,t)}}function kS(e,t){return function(){return Ap(this,e,t.apply(this,arguments))}}function PS(e,t){return this.each((typeof t=="function"?kS:DS)(e,t))}function*MS(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var s=e[t],i=0,l=s.length,c;i<l;++i)(c=s[i])&&(yield c)}var Ip=[null];function Ft(e,t){this._groups=e,this._parents=t}function ws(){return new Ft([[document.documentElement]],Ip)}function jS(){return this}Ft.prototype=ws.prototype={constructor:Ft,select:cx,selectAll:px,selectChild:yx,selectChildren:Sx,filter:_x,data:Cx,enter:wx,exit:Ix,join:bx,merge:Lx,selection:jS,order:Dx,sort:kx,call:Mx,nodes:jx,node:Ux,size:Fx,empty:Vx,each:$x,attr:Kx,style:Jx,property:nS,classed:iS,text:uS,html:hS,raise:gS,lower:ES,append:vS,insert:SS,remove:wS,clone:TS,datum:OS,on:LS,dispatch:PS,[Symbol.iterator]:MS};function on(e){return typeof e=="string"?new Ft([[document.querySelector(e)]],[document.documentElement]):new Ft([[e]],Ip)}function US(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _n(e,t){if(e=US(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var s=n.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const FS={passive:!1},Ns={capture:!0,passive:!1};function Cc(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function bp(e){var t=e.document.documentElement,n=on(e).on("dragstart.drag",vo,Ns);"onselectstart"in t?n.on("selectstart.drag",vo,Ns):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Lp(e,t){var n=e.document.documentElement,s=on(e).on("dragstart.drag",null);t&&(s.on("click.drag",vo,Ns),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in n?s.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Qi=e=>()=>e;function Ac(e,{sourceEvent:t,subject:n,target:s,identifier:i,active:l,x:c,y:u,dx:f,dy:p,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:m}})}Ac.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function VS(e){return!e.ctrlKey&&!e.button}function $S(){return this.parentNode}function HS(e,t){return t??{x:e.x,y:e.y}}function BS(){return navigator.maxTouchPoints||"ontouchstart"in this}function zS(){var e=VS,t=$S,n=HS,s=BS,i={},l=Gi("start","drag","end"),c=0,u,f,p,m,y=0;function E(C){C.on("mousedown.drag",x).filter(s).on("touchstart.drag",S).on("touchmove.drag",N,FS).on("touchend.drag touchcancel.drag",R).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(C,I){if(!(m||!e.call(this,C,I))){var L=P(this,t.call(this,C,I),C,I,"mouse");L&&(on(C.view).on("mousemove.drag",_,Ns).on("mouseup.drag",w,Ns),bp(C.view),Cc(C),p=!1,u=C.clientX,f=C.clientY,L("start",C))}}function _(C){if(vo(C),!p){var I=C.clientX-u,L=C.clientY-f;p=I*I+L*L>y}i.mouse("drag",C)}function w(C){on(C.view).on("mousemove.drag mouseup.drag",null),Lp(C.view,p),vo(C),i.mouse("end",C)}function S(C,I){if(e.call(this,C,I)){var L=C.changedTouches,U=t.call(this,C,I),G=L.length,X,H;for(X=0;X<G;++X)(H=P(this,U,C,I,L[X].identifier,L[X]))&&(Cc(C),H("start",C,L[X]))}}function N(C){var I=C.changedTouches,L=I.length,U,G;for(U=0;U<L;++U)(G=i[I[U].identifier])&&(vo(C),G("drag",C,I[U]))}function R(C){var I=C.changedTouches,L=I.length,U,G;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),U=0;U<L;++U)(G=i[I[U].identifier])&&(Cc(C),G("end",C,I[U]))}function P(C,I,L,U,G,X){var H=l.copy(),q=_n(X||L,I),ee,z,A;if((A=n.call(C,new Ac("beforestart",{sourceEvent:L,target:E,identifier:G,active:c,x:q[0],y:q[1],dx:0,dy:0,dispatch:H}),U))!=null)return ee=A.x-q[0]||0,z=A.y-q[1]||0,function F($,Y,M){var V=q,B;switch($){case"start":i[G]=F,B=c++;break;case"end":delete i[G],--c;case"drag":q=_n(M||Y,I),B=c;break}H.call($,C,new Ac($,{sourceEvent:Y,subject:A,target:E,identifier:G,active:B,x:q[0]+ee,y:q[1]+z,dx:q[0]-V[0],dy:q[1]-V[1],dispatch:H}),U)}}return E.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Qi(!!C),E):e},E.container=function(C){return arguments.length?(t=typeof C=="function"?C:Qi(C),E):t},E.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Qi(C),E):n},E.touchable=function(C){return arguments.length?(s=typeof C=="function"?C:Qi(!!C),E):s},E.on=function(){var C=l.on.apply(l,arguments);return C===l?E:C},E.clickDistance=function(C){return arguments.length?(y=(C=+C)*C,E):Math.sqrt(y)},E}function Ic(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Dp(e,t){var n=Object.create(e.prototype);for(var s in t)n[s]=t[s];return n}function Rs(){}var Ts=.7,qi=1/Ts,xo="\\s*([+-]?\\d+)\\s*",Os="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",WS=/^#([0-9a-f]{3,8})$/,GS=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),YS=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),KS=new RegExp(`^rgba\\(${xo},${xo},${xo},${Os}\\)$`),XS=new RegExp(`^rgba\\(${wn},${wn},${wn},${Os}\\)$`),QS=new RegExp(`^hsl\\(${Os},${wn},${wn}\\)$`),qS=new RegExp(`^hsla\\(${Os},${wn},${wn},${Os}\\)$`),kp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ic(Rs,Cs,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pp,formatHex:Pp,formatHex8:JS,formatHsl:ZS,formatRgb:Mp,toString:Mp});function Pp(){return this.rgb().formatHex()}function JS(){return this.rgb().formatHex8()}function ZS(){return $p(this).formatHsl()}function Mp(){return this.rgb().formatRgb()}function Cs(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=WS.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jp(t):n===3?new Ot(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ji(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ji(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=GS.exec(e))?new Ot(t[1],t[2],t[3],1):(t=YS.exec(e))?new Ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=KS.exec(e))?Ji(t[1],t[2],t[3],t[4]):(t=XS.exec(e))?Ji(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=QS.exec(e))?Vp(t[1],t[2]/100,t[3]/100,1):(t=qS.exec(e))?Vp(t[1],t[2]/100,t[3]/100,t[4]):kp.hasOwnProperty(e)?jp(kp[e]):e==="transparent"?new Ot(NaN,NaN,NaN,0):null}function jp(e){return new Ot(e>>16&255,e>>8&255,e&255,1)}function Ji(e,t,n,s){return s<=0&&(e=t=n=NaN),new Ot(e,t,n,s)}function e_(e){return e instanceof Rs||(e=Cs(e)),e?(e=e.rgb(),new Ot(e.r,e.g,e.b,e.opacity)):new Ot}function bc(e,t,n,s){return arguments.length===1?e_(e):new Ot(e,t,n,s??1)}function Ot(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}Ic(Ot,bc,Dp(Rs,{brighter(e){return e=e==null?qi:Math.pow(qi,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ts:Math.pow(Ts,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ot(Fr(this.r),Fr(this.g),Fr(this.b),Zi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Up,formatHex:Up,formatHex8:t_,formatRgb:Fp,toString:Fp}));function Up(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}`}function t_(){return`#${Vr(this.r)}${Vr(this.g)}${Vr(this.b)}${Vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fp(){const e=Zi(this.opacity);return`${e===1?"rgb(":"rgba("}${Fr(this.r)}, ${Fr(this.g)}, ${Fr(this.b)}${e===1?")":`, ${e})`}`}function Zi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vr(e){return e=Fr(e),(e<16?"0":"")+e.toString(16)}function Vp(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sn(e,t,n,s)}function $p(e){if(e instanceof sn)return new sn(e.h,e.s,e.l,e.opacity);if(e instanceof Rs||(e=Cs(e)),!e)return new sn;if(e instanceof sn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,i=Math.min(t,n,s),l=Math.max(t,n,s),c=NaN,u=l-i,f=(l+i)/2;return u?(t===l?c=(n-s)/u+(n<s)*6:n===l?c=(s-t)/u+2:c=(t-n)/u+4,u/=f<.5?l+i:2-l-i,c*=60):u=f>0&&f<1?0:c,new sn(c,u,f,e.opacity)}function n_(e,t,n,s){return arguments.length===1?$p(e):new sn(e,t,n,s??1)}function sn(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}Ic(sn,n_,Dp(Rs,{brighter(e){return e=e==null?qi:Math.pow(qi,e),new sn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ts:Math.pow(Ts,e),new sn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,i=2*n-s;return new Ot(Lc(e>=240?e-240:e+120,i,s),Lc(e,i,s),Lc(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new sn(Hp(this.h),el(this.s),el(this.l),Zi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zi(this.opacity);return`${e===1?"hsl(":"hsla("}${Hp(this.h)}, ${el(this.s)*100}%, ${el(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hp(e){return e=(e||0)%360,e<0?e+360:e}function el(e){return Math.max(0,Math.min(1,e||0))}function Lc(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Bp=e=>()=>e;function r_(e,t){return function(n){return e+n*t}}function o_(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function s_(e){return(e=+e)==1?zp:function(t,n){return n-t?o_(t,n,e):Bp(isNaN(t)?n:t)}}function zp(e,t){var n=t-e;return n?r_(e,n):Bp(isNaN(e)?t:e)}const Wp=function e(t){var n=s_(t);function s(i,l){var c=n((i=bc(i)).r,(l=bc(l)).r),u=n(i.g,l.g),f=n(i.b,l.b),p=zp(i.opacity,l.opacity);return function(m){return i.r=c(m),i.g=u(m),i.b=f(m),i.opacity=p(m),i+""}}return s.gamma=e,s}(1);function ir(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Dc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kc=new RegExp(Dc.source,"g");function i_(e){return function(){return e}}function l_(e){return function(t){return e(t)+""}}function a_(e,t){var n=Dc.lastIndex=kc.lastIndex=0,s,i,l,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Dc.exec(e))&&(i=kc.exec(t));)(l=i.index)>n&&(l=t.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(s=s[0])===(i=i[0])?u[c]?u[c]+=i:u[++c]=i:(u[++c]=null,f.push({i:c,x:ir(s,i)})),n=kc.lastIndex;return n<t.length&&(l=t.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?f[0]?l_(f[0].x):i_(t):(t=f.length,function(p){for(var m=0,y;m<t;++m)u[(y=f[m]).i]=y.x(p);return u.join("")})}var Gp=180/Math.PI,Pc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yp(e,t,n,s,i,l){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*n+t*s)&&(n-=e*f,s-=t*f),(u=Math.sqrt(n*n+s*s))&&(n/=u,s/=u,f/=u),e*s<t*n&&(e=-e,t=-t,f=-f,c=-c),{translateX:i,translateY:l,rotate:Math.atan2(t,e)*Gp,skewX:Math.atan(f)*Gp,scaleX:c,scaleY:u}}var tl;function c_(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Pc:Yp(t.a,t.b,t.c,t.d,t.e,t.f)}function u_(e){return e==null||(tl||(tl=document.createElementNS("http://www.w3.org/2000/svg","g")),tl.setAttribute("transform",e),!(e=tl.transform.baseVal.consolidate()))?Pc:(e=e.matrix,Yp(e.a,e.b,e.c,e.d,e.e,e.f))}function Kp(e,t,n,s){function i(p){return p.length?p.pop()+" ":""}function l(p,m,y,E,x,_){if(p!==y||m!==E){var w=x.push("translate(",null,t,null,n);_.push({i:w-4,x:ir(p,y)},{i:w-2,x:ir(m,E)})}else(y||E)&&x.push("translate("+y+t+E+n)}function c(p,m,y,E){p!==m?(p-m>180?m+=360:m-p>180&&(p+=360),E.push({i:y.push(i(y)+"rotate(",null,s)-2,x:ir(p,m)})):m&&y.push(i(y)+"rotate("+m+s)}function u(p,m,y,E){p!==m?E.push({i:y.push(i(y)+"skewX(",null,s)-2,x:ir(p,m)}):m&&y.push(i(y)+"skewX("+m+s)}function f(p,m,y,E,x,_){if(p!==y||m!==E){var w=x.push(i(x)+"scale(",null,",",null,")");_.push({i:w-4,x:ir(p,y)},{i:w-2,x:ir(m,E)})}else(y!==1||E!==1)&&x.push(i(x)+"scale("+y+","+E+")")}return function(p,m){var y=[],E=[];return p=e(p),m=e(m),l(p.translateX,p.translateY,m.translateX,m.translateY,y,E),c(p.rotate,m.rotate,y,E),u(p.skewX,m.skewX,y,E),f(p.scaleX,p.scaleY,m.scaleX,m.scaleY,y,E),p=m=null,function(x){for(var _=-1,w=E.length,S;++_<w;)y[(S=E[_]).i]=S.x(x);return y.join("")}}}var d_=Kp(c_,"px, ","px)","deg)"),f_=Kp(u_,", ",")",")"),p_=1e-12;function Xp(e){return((e=Math.exp(e))+1/e)/2}function h_(e){return((e=Math.exp(e))-1/e)/2}function m_(e){return((e=Math.exp(2*e))-1)/(e+1)}const g_=function e(t,n,s){function i(l,c){var u=l[0],f=l[1],p=l[2],m=c[0],y=c[1],E=c[2],x=m-u,_=y-f,w=x*x+_*_,S,N;if(w<p_)N=Math.log(E/p)/t,S=function(U){return[u+U*x,f+U*_,p*Math.exp(t*U*N)]};else{var R=Math.sqrt(w),P=(E*E-p*p+s*w)/(2*p*n*R),C=(E*E-p*p-s*w)/(2*E*n*R),I=Math.log(Math.sqrt(P*P+1)-P),L=Math.log(Math.sqrt(C*C+1)-C);N=(L-I)/t,S=function(U){var G=U*N,X=Xp(I),H=p/(n*R)*(X*m_(t*G+I)-h_(I));return[u+H*x,f+H*_,p*X/Xp(t*G+I)]}}return S.duration=N*1e3*t/Math.SQRT2,S}return i.rho=function(l){var c=Math.max(.001,+l),u=c*c,f=u*u;return e(c,u,f)},i}(Math.SQRT2,2,4);var So=0,As=0,Is=0,Qp=1e3,nl,bs,rl=0,$r=0,ol=0,Ls=typeof performance=="object"&&performance.now?performance:Date,qp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Mc(){return $r||(qp(y_),$r=Ls.now()+ol)}function y_(){$r=0}function sl(){this._call=this._time=this._next=null}sl.prototype=Jp.prototype={constructor:sl,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Mc():+n)+(t==null?0:+t),!this._next&&bs!==this&&(bs?bs._next=this:nl=this,bs=this),this._call=e,this._time=n,jc()},stop:function(){this._call&&(this._call=null,this._time=1/0,jc())}};function Jp(e,t,n){var s=new sl;return s.restart(e,t,n),s}function E_(){Mc(),++So;for(var e=nl,t;e;)(t=$r-e._time)>=0&&e._call.call(void 0,t),e=e._next;--So}function Zp(){$r=(rl=Ls.now())+ol,So=As=0;try{E_()}finally{So=0,x_(),$r=0}}function v_(){var e=Ls.now(),t=e-rl;t>Qp&&(ol-=t,rl=e)}function x_(){for(var e,t=nl,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:nl=n);bs=e,jc(s)}function jc(e){if(!So){As&&(As=clearTimeout(As));var t=e-$r;t>24?(e<1/0&&(As=setTimeout(Zp,e-Ls.now()-ol)),Is&&(Is=clearInterval(Is))):(Is||(rl=Ls.now(),Is=setInterval(v_,Qp)),So=1,qp(Zp))}}function eh(e,t,n){var s=new sl;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,n),s}var S_=Gi("start","end","cancel","interrupt"),__=[],th=0,nh=1,Uc=2,il=3,rh=4,Fc=5,ll=6;function al(e,t,n,s,i,l){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;w_(e,n,{name:t,index:s,group:i,on:S_,tween:__,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:th})}function Vc(e,t){var n=ln(e,t);if(n.state>th)throw new Error("too late; already scheduled");return n}function Nn(e,t){var n=ln(e,t);if(n.state>il)throw new Error("too late; already running");return n}function ln(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function w_(e,t,n){var s=e.__transition,i;s[t]=n,n.timer=Jp(l,0,n.time);function l(p){n.state=nh,n.timer.restart(c,n.delay,n.time),n.delay<=p&&c(p-n.delay)}function c(p){var m,y,E,x;if(n.state!==nh)return f();for(m in s)if(x=s[m],x.name===n.name){if(x.state===il)return eh(c);x.state===rh?(x.state=ll,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete s[m]):+m<t&&(x.state=ll,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete s[m])}if(eh(function(){n.state===il&&(n.state=rh,n.timer.restart(u,n.delay,n.time),u(p))}),n.state=Uc,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Uc){for(n.state=il,i=new Array(E=n.tween.length),m=0,y=-1;m<E;++m)(x=n.tween[m].value.call(e,e.__data__,n.index,n.group))&&(i[++y]=x);i.length=y+1}}function u(p){for(var m=p<n.duration?n.ease.call(null,p/n.duration):(n.timer.restart(f),n.state=Fc,1),y=-1,E=i.length;++y<E;)i[y].call(e,m);n.state===Fc&&(n.on.call("end",e,e.__data__,n.index,n.group),f())}function f(){n.state=ll,n.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function cl(e,t){var n=e.__transition,s,i,l=!0,c;if(n){t=t==null?null:t+"";for(c in n){if((s=n[c]).name!==t){l=!1;continue}i=s.state>Uc&&s.state<Fc,s.state=ll,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete n[c]}l&&delete e.__transition}}function N_(e){return this.each(function(){cl(this,e)})}function R_(e,t){var n,s;return function(){var i=Nn(this,e),l=i.tween;if(l!==n){s=n=l;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}i.tween=s}}function T_(e,t,n){var s,i;if(typeof n!="function")throw new Error;return function(){var l=Nn(this,e),c=l.tween;if(c!==s){i=(s=c).slice();for(var u={name:t,value:n},f=0,p=i.length;f<p;++f)if(i[f].name===t){i[f]=u;break}f===p&&i.push(u)}l.tween=i}}function O_(e,t){var n=this._id;if(e+="",arguments.length<2){for(var s=ln(this.node(),n).tween,i=0,l=s.length,c;i<l;++i)if((c=s[i]).name===e)return c.value;return null}return this.each((t==null?R_:T_)(n,e,t))}function $c(e,t,n){var s=e._id;return e.each(function(){var i=Nn(this,s);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return ln(i,s).value[t]}}function oh(e,t){var n;return(typeof t=="number"?ir:t instanceof Cs?Wp:(n=Cs(t))?(t=n,Wp):a_)(e,t)}function C_(e){return function(){this.removeAttribute(e)}}function A_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function I_(e,t,n){var s,i=n+"",l;return function(){var c=this.getAttribute(e);return c===i?null:c===s?l:l=t(s=c,n)}}function b_(e,t,n){var s,i=n+"",l;return function(){var c=this.getAttributeNS(e.space,e.local);return c===i?null:c===s?l:l=t(s=c,n)}}function L_(e,t,n){var s,i,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===i?l:(i=f,l=t(s=c,u)))}}function D_(e,t,n){var s,i,l;return function(){var c,u=n(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===i?l:(i=f,l=t(s=c,u)))}}function k_(e,t){var n=Ki(e),s=n==="transform"?f_:oh;return this.attrTween(e,typeof t=="function"?(n.local?D_:L_)(n,s,$c(this,"attr."+e,t)):t==null?(n.local?A_:C_)(n):(n.local?b_:I_)(n,s,t))}function P_(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function M_(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function j_(e,t){var n,s;function i(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&M_(e,l)),n}return i._value=t,i}function U_(e,t){var n,s;function i(){var l=t.apply(this,arguments);return l!==s&&(n=(s=l)&&P_(e,l)),n}return i._value=t,i}function F_(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var s=Ki(e);return this.tween(n,(s.local?j_:U_)(s,t))}function V_(e,t){return function(){Vc(this,e).delay=+t.apply(this,arguments)}}function $_(e,t){return t=+t,function(){Vc(this,e).delay=t}}function H_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?V_:$_)(t,e)):ln(this.node(),t).delay}function B_(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function z_(e,t){return t=+t,function(){Nn(this,e).duration=t}}function W_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?B_:z_)(t,e)):ln(this.node(),t).duration}function G_(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function Y_(e){var t=this._id;return arguments.length?this.each(G_(t,e)):ln(this.node(),t).ease}function K_(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Nn(this,e).ease=n}}function X_(e){if(typeof e!="function")throw new Error;return this.each(K_(this._id,e))}function Q_(e){typeof e!="function"&&(e=Sp(e));for(var t=this._groups,n=t.length,s=new Array(n),i=0;i<n;++i)for(var l=t[i],c=l.length,u=s[i]=[],f,p=0;p<c;++p)(f=l[p])&&e.call(f,f.__data__,p,l)&&u.push(f);return new Un(s,this._parents,this._name,this._id)}function q_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,s=t.length,i=n.length,l=Math.min(s,i),c=new Array(s),u=0;u<l;++u)for(var f=t[u],p=n[u],m=f.length,y=c[u]=new Array(m),E,x=0;x<m;++x)(E=f[x]||p[x])&&(y[x]=E);for(;u<s;++u)c[u]=t[u];return new Un(c,this._parents,this._name,this._id)}function J_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Z_(e,t,n){var s,i,l=J_(t)?Vc:Nn;return function(){var c=l(this,e),u=c.on;u!==s&&(i=(s=u).copy()).on(t,n),c.on=i}}function ew(e,t){var n=this._id;return arguments.length<2?ln(this.node(),n).on.on(e):this.each(Z_(n,e,t))}function tw(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nw(){return this.on("end.remove",tw(this._id))}function rw(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Tc(e));for(var s=this._groups,i=s.length,l=new Array(i),c=0;c<i;++c)for(var u=s[c],f=u.length,p=l[c]=new Array(f),m,y,E=0;E<f;++E)(m=u[E])&&(y=e.call(m,m.__data__,E,u))&&("__data__"in m&&(y.__data__=m.__data__),p[E]=y,al(p[E],t,n,E,p,ln(m,n)));return new Un(l,this._parents,t,n)}function ow(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xp(e));for(var s=this._groups,i=s.length,l=[],c=[],u=0;u<i;++u)for(var f=s[u],p=f.length,m,y=0;y<p;++y)if(m=f[y]){for(var E=e.call(m,m.__data__,y,f),x,_=ln(m,n),w=0,S=E.length;w<S;++w)(x=E[w])&&al(x,t,n,w,E,_);l.push(E),c.push(m)}return new Un(l,c,t,n)}var sw=ws.prototype.constructor;function iw(){return new sw(this._groups,this._parents)}function lw(e,t){var n,s,i;return function(){var l=Eo(this,e),c=(this.style.removeProperty(e),Eo(this,e));return l===c?null:l===n&&c===s?i:i=t(n=l,s=c)}}function sh(e){return function(){this.style.removeProperty(e)}}function aw(e,t,n){var s,i=n+"",l;return function(){var c=Eo(this,e);return c===i?null:c===s?l:l=t(s=c,n)}}function cw(e,t,n){var s,i,l;return function(){var c=Eo(this,e),u=n(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),Eo(this,e))),c===f?null:c===s&&f===i?l:(i=f,l=t(s=c,u))}}function uw(e,t){var n,s,i,l="style."+t,c="end."+l,u;return function(){var f=Nn(this,e),p=f.on,m=f.value[l]==null?u||(u=sh(t)):void 0;(p!==n||i!==m)&&(s=(n=p).copy()).on(c,i=m),f.on=s}}function dw(e,t,n){var s=(e+="")=="transform"?d_:oh;return t==null?this.styleTween(e,lw(e,s)).on("end.style."+e,sh(e)):typeof t=="function"?this.styleTween(e,cw(e,s,$c(this,"style."+e,t))).each(uw(this._id,e)):this.styleTween(e,aw(e,s,t),n).on("end.style."+e,null)}function fw(e,t,n){return function(s){this.style.setProperty(e,t.call(this,s),n)}}function pw(e,t,n){var s,i;function l(){var c=t.apply(this,arguments);return c!==i&&(s=(i=c)&&fw(e,c,n)),s}return l._value=t,l}function hw(e,t,n){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,pw(e,t,n??""))}function mw(e){return function(){this.textContent=e}}function gw(e){return function(){var t=e(this);this.textContent=t??""}}function yw(e){return this.tween("text",typeof e=="function"?gw($c(this,"text",e)):mw(e==null?"":e+""))}function Ew(e){return function(t){this.textContent=e.call(this,t)}}function vw(e){var t,n;function s(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Ew(i)),t}return s._value=e,s}function xw(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,vw(e))}function Sw(){for(var e=this._name,t=this._id,n=ih(),s=this._groups,i=s.length,l=0;l<i;++l)for(var c=s[l],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var m=ln(f,t);al(f,e,n,p,c,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Un(s,this._parents,e,n)}function _w(){var e,t,n=this,s=n._id,i=n.size();return new Promise(function(l,c){var u={value:c},f={value:function(){--i===0&&l()}};n.each(function(){var p=Nn(this,s),m=p.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),i===0&&l()})}var ww=0;function Un(e,t,n,s){this._groups=e,this._parents=t,this._name=n,this._id=s}function ih(){return++ww}var Fn=ws.prototype;Un.prototype={constructor:Un,select:rw,selectAll:ow,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:Q_,merge:q_,selection:iw,transition:Sw,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:ew,attr:k_,attrTween:F_,style:dw,styleTween:hw,text:yw,textTween:xw,remove:nw,tween:O_,delay:H_,duration:W_,ease:Y_,easeVarying:X_,end:_w,[Symbol.iterator]:Fn[Symbol.iterator]};function Nw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Rw={time:null,delay:0,duration:250,ease:Nw};function Tw(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Ow(e){var t,n;e instanceof Un?(t=e._id,e=e._name):(t=ih(),(n=Rw).time=Mc(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,l=0;l<i;++l)for(var c=s[l],u=c.length,f,p=0;p<u;++p)(f=c[p])&&al(f,e,t,p,c,n||Tw(f,t));return new Un(s,this._parents,e,t)}ws.prototype.interrupt=N_,ws.prototype.transition=Ow;const ul=e=>()=>e;function Cw(e,{sourceEvent:t,target:n,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function Vn(e,t,n){this.k=e,this.x=t,this.y=n}Vn.prototype={constructor:Vn,scale:function(e){return e===1?this:new Vn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Vn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var lr=new Vn(1,0,0);Vn.prototype;function Hc(e){e.stopImmediatePropagation()}function Ds(e){e.preventDefault(),e.stopImmediatePropagation()}function Aw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Iw(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function lh(){return this.__zoom||lr}function bw(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Lw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dw(e,t,n){var s=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],l=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),c>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function kw(){var e=Aw,t=Iw,n=Dw,s=bw,i=Lw,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=g_,p=Gi("start","zoom","end"),m,y,E,x=500,_=150,w=0,S=10;function N(A){A.property("__zoom",lh).on("wheel.zoom",G,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",H).filter(i).on("touchstart.zoom",q).on("touchmove.zoom",ee).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(A,F,$,Y){var M=A.selection?A.selection():A;M.property("__zoom",lh),A!==M?I(A,F,$,Y):M.interrupt().each(function(){L(this,arguments).event(Y).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},N.scaleBy=function(A,F,$,Y){N.scaleTo(A,function(){var M=this.__zoom.k,V=typeof F=="function"?F.apply(this,arguments):F;return M*V},$,Y)},N.scaleTo=function(A,F,$,Y){N.transform(A,function(){var M=t.apply(this,arguments),V=this.__zoom,B=$==null?C(M):typeof $=="function"?$.apply(this,arguments):$,D=V.invert(B),Q=typeof F=="function"?F.apply(this,arguments):F;return n(P(R(V,Q),B,D),M,c)},$,Y)},N.translateBy=function(A,F,$,Y){N.transform(A,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof $=="function"?$.apply(this,arguments):$),t.apply(this,arguments),c)},null,Y)},N.translateTo=function(A,F,$,Y,M){N.transform(A,function(){var V=t.apply(this,arguments),B=this.__zoom,D=Y==null?C(V):typeof Y=="function"?Y.apply(this,arguments):Y;return n(lr.translate(D[0],D[1]).scale(B.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof $=="function"?-$.apply(this,arguments):-$),V,c)},Y,M)};function R(A,F){return F=Math.max(l[0],Math.min(l[1],F)),F===A.k?A:new Vn(F,A.x,A.y)}function P(A,F,$){var Y=F[0]-$[0]*A.k,M=F[1]-$[1]*A.k;return Y===A.x&&M===A.y?A:new Vn(A.k,Y,M)}function C(A){return[(+A[0][0]+ +A[1][0])/2,(+A[0][1]+ +A[1][1])/2]}function I(A,F,$,Y){A.on("start.zoom",function(){L(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(Y).end()}).tween("zoom",function(){var M=this,V=arguments,B=L(M,V).event(Y),D=t.apply(M,V),Q=$==null?C(D):typeof $=="function"?$.apply(M,V):$,oe=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),re=M.__zoom,le=typeof F=="function"?F.apply(M,V):F,ue=f(re.invert(Q).concat(oe/re.k),le.invert(Q).concat(oe/le.k));return function(fe){if(fe===1)fe=le;else{var de=ue(fe),me=oe/de[2];fe=new Vn(me,Q[0]-de[0]*me,Q[1]-de[1]*me)}B.zoom(null,fe)}})}function L(A,F,$){return!$&&A.__zooming||new U(A,F)}function U(A,F){this.that=A,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(A,F),this.taps=0}U.prototype={event:function(A){return A&&(this.sourceEvent=A),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(A,F){return this.mouse&&A!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&A!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&A!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(A){var F=on(this.that).datum();p.call(A,this.that,new Cw(A,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:p}),F)}};function G(A,...F){if(!e.apply(this,arguments))return;var $=L(this,F).event(A),Y=this.__zoom,M=Math.max(l[0],Math.min(l[1],Y.k*Math.pow(2,s.apply(this,arguments)))),V=_n(A);if($.wheel)($.mouse[0][0]!==V[0]||$.mouse[0][1]!==V[1])&&($.mouse[1]=Y.invert($.mouse[0]=V)),clearTimeout($.wheel);else{if(Y.k===M)return;$.mouse=[V,Y.invert(V)],cl(this),$.start()}Ds(A),$.wheel=setTimeout(B,_),$.zoom("mouse",n(P(R(Y,M),$.mouse[0],$.mouse[1]),$.extent,c));function B(){$.wheel=null,$.end()}}function X(A,...F){if(E||!e.apply(this,arguments))return;var $=A.currentTarget,Y=L(this,F,!0).event(A),M=on(A.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",oe,!0),V=_n(A,$),B=A.clientX,D=A.clientY;bp(A.view),Hc(A),Y.mouse=[V,this.__zoom.invert(V)],cl(this),Y.start();function Q(re){if(Ds(re),!Y.moved){var le=re.clientX-B,ue=re.clientY-D;Y.moved=le*le+ue*ue>w}Y.event(re).zoom("mouse",n(P(Y.that.__zoom,Y.mouse[0]=_n(re,$),Y.mouse[1]),Y.extent,c))}function oe(re){M.on("mousemove.zoom mouseup.zoom",null),Lp(re.view,Y.moved),Ds(re),Y.event(re).end()}}function H(A,...F){if(e.apply(this,arguments)){var $=this.__zoom,Y=_n(A.changedTouches?A.changedTouches[0]:A,this),M=$.invert(Y),V=$.k*(A.shiftKey?.5:2),B=n(P(R($,V),Y,M),t.apply(this,F),c);Ds(A),u>0?on(this).transition().duration(u).call(I,B,Y,A):on(this).call(N.transform,B,Y,A)}}function q(A,...F){if(e.apply(this,arguments)){var $=A.touches,Y=$.length,M=L(this,F,A.changedTouches.length===Y).event(A),V,B,D,Q;for(Hc(A),B=0;B<Y;++B)D=$[B],Q=_n(D,this),Q=[Q,this.__zoom.invert(Q),D.identifier],M.touch0?!M.touch1&&M.touch0[2]!==Q[2]&&(M.touch1=Q,M.taps=0):(M.touch0=Q,V=!0,M.taps=1+!!m);m&&(m=clearTimeout(m)),V&&(M.taps<2&&(y=Q[0],m=setTimeout(function(){m=null},x)),cl(this),M.start())}}function ee(A,...F){if(this.__zooming){var $=L(this,F).event(A),Y=A.changedTouches,M=Y.length,V,B,D,Q;for(Ds(A),V=0;V<M;++V)B=Y[V],D=_n(B,this),$.touch0&&$.touch0[2]===B.identifier?$.touch0[0]=D:$.touch1&&$.touch1[2]===B.identifier&&($.touch1[0]=D);if(B=$.that.__zoom,$.touch1){var oe=$.touch0[0],re=$.touch0[1],le=$.touch1[0],ue=$.touch1[1],fe=(fe=le[0]-oe[0])*fe+(fe=le[1]-oe[1])*fe,de=(de=ue[0]-re[0])*de+(de=ue[1]-re[1])*de;B=R(B,Math.sqrt(fe/de)),D=[(oe[0]+le[0])/2,(oe[1]+le[1])/2],Q=[(re[0]+ue[0])/2,(re[1]+ue[1])/2]}else if($.touch0)D=$.touch0[0],Q=$.touch0[1];else return;$.zoom("touch",n(P(B,D,Q),$.extent,c))}}function z(A,...F){if(this.__zooming){var $=L(this,F).event(A),Y=A.changedTouches,M=Y.length,V,B;for(Hc(A),E&&clearTimeout(E),E=setTimeout(function(){E=null},x),V=0;V<M;++V)B=Y[V],$.touch0&&$.touch0[2]===B.identifier?delete $.touch0:$.touch1&&$.touch1[2]===B.identifier&&delete $.touch1;if($.touch1&&!$.touch0&&($.touch0=$.touch1,delete $.touch1),$.touch0)$.touch0[1]=this.__zoom.invert($.touch0[0]);else if($.end(),$.taps===2&&(B=_n(B,this),Math.hypot(y[0]-B[0],y[1]-B[1])<S)){var D=on(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return N.wheelDelta=function(A){return arguments.length?(s=typeof A=="function"?A:ul(+A),N):s},N.filter=function(A){return arguments.length?(e=typeof A=="function"?A:ul(!!A),N):e},N.touchable=function(A){return arguments.length?(i=typeof A=="function"?A:ul(!!A),N):i},N.extent=function(A){return arguments.length?(t=typeof A=="function"?A:ul([[+A[0][0],+A[0][1]],[+A[1][0],+A[1][1]]]),N):t},N.scaleExtent=function(A){return arguments.length?(l[0]=+A[0],l[1]=+A[1],N):[l[0],l[1]]},N.translateExtent=function(A){return arguments.length?(c[0][0]=+A[0][0],c[1][0]=+A[1][0],c[0][1]=+A[0][1],c[1][1]=+A[1][1],N):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},N.constrain=function(A){return arguments.length?(n=A,N):n},N.duration=function(A){return arguments.length?(u=+A,N):u},N.interpolate=function(A){return arguments.length?(f=A,N):f},N.on=function(){var A=p.on.apply(p,arguments);return A===p?N:A},N.clickDistance=function(A){return arguments.length?(w=(A=+A)*A,N):Math.sqrt(w)},N.tapDistance=function(A){return arguments.length?(S=+A,N):S},N}var Bc=ip();const dl=b.createContext(null),Pw=dl.Provider,$n={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},ah=$n.error001();function Pe(e,t){const n=b.useContext(dl);if(n===null)throw new Error(ah);return mp(n,e,t)}const tt=()=>{const e=b.useContext(dl);if(e===null)throw new Error(ah);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Mw=e=>e.userSelectionActive?"none":"all";function ks({position:e,children:t,className:n,style:s,...i}){const l=Pe(Mw),c=`${e}`.split("-");return ne.createElement("div",{className:St(["react-flow__panel",n,...c]),style:{...s,pointerEvents:l},...i},t)}function jw({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:ne.createElement(ks,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},ne.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Uw=({x:e,y:t,label:n,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:l={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...m})=>{const y=b.useRef(null),[E,x]=b.useState({x:0,y:0,width:0,height:0}),_=St(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(y.current){const w=y.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:ne.createElement("g",{transform:`translate(${e-E.width/2} ${t-E.height/2})`,className:_,visibility:E.width?"visible":"hidden",...m},i&&ne.createElement("rect",{width:E.width+2*c[0],x:-c[0],y:-c[1],height:E.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),ne.createElement("text",{className:"react-flow__edge-text",y:E.height/2,dy:"0.3em",ref:y,style:s},n),f)};var Fw=b.memo(Uw);const zc=e=>({width:e.offsetWidth,height:e.offsetHeight}),_o=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Wc=(e={x:0,y:0},t)=>({x:_o(e.x,t[0][0],t[1][0]),y:_o(e.y,t[0][1],t[1][1])}),ch=(e,t,n)=>e<t?_o(Math.abs(e-t),1,50)/50:e>n?-_o(Math.abs(e-n),1,50)/50:0,uh=(e,t)=>{const n=ch(e.x,35,t.width-35)*20,s=ch(e.y,35,t.height-35)*20;return[n,s]},dh=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Vw=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Gc=({x:e,y:t,width:n,height:s})=>({x:e,y:t,x2:e+n,y2:t+s}),$w=({x:e,y:t,x2:n,y2:s})=>({x:e,y:t,width:n-e,height:s-t}),fh=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Yc=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*s)},Hw=e=>Kt(e.width)&&Kt(e.height)&&Kt(e.x)&&Kt(e.y),Kt=e=>!isNaN(e)&&isFinite(e),nt=Symbol.for("internals"),ph=["Enter"," ","Escape"],Bw=(e,t)=>{},zw=e=>"nativeEvent"in e;function Kc(e){var i,l;const t=zw(e)?e.nativeEvent:e,n=((l=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:l[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const hh=e=>"clientX"in e,ar=(e,t)=>{var l,c;const n=hh(e),s=n?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,i=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:s-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},fl=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},wo=({id:e,path:t,labelX:n,labelY:s,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:x=20})=>ne.createElement(ne.Fragment,null,ne.createElement("path",{id:e,style:m,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:y,markerStart:E}),x&&ne.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),i&&Kt(n)&&Kt(s)?ne.createElement(Fw,{x:n,y:s,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);wo.displayName="BaseEdge";function Ps(e,t,n){return n===void 0?n:s=>{const i=t().edges.find(l=>l.id===e);i&&n(s,{...i})}}function mh({sourceX:e,sourceY:t,targetX:n,targetY:s}){const i=Math.abs(n-e)/2,l=n<e?n+i:n-i,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[l,u,i,c]}function gh({sourceX:e,sourceY:t,targetX:n,targetY:s,sourceControlX:i,sourceControlY:l,targetControlX:c,targetControlY:u}){const f=e*.125+i*.375+c*.375+n*.125,p=t*.125+l*.375+u*.375+s*.125,m=Math.abs(f-e),y=Math.abs(p-t);return[f,p,m,y]}var cr;(function(e){e.Strict="strict",e.Loose="loose"})(cr||(cr={}));var Hr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Hr||(Hr={}));var Ms;(function(e){e.Partial="partial",e.Full="full"})(Ms||(Ms={}));var ur;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(ur||(ur={}));var js;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(js||(js={}));var xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xe||(xe={}));function yh({pos:e,x1:t,y1:n,x2:s,y2:i}){return e===xe.Left||e===xe.Right?[.5*(t+s),n]:[t,.5*(n+i)]}function Eh({sourceX:e,sourceY:t,sourcePosition:n=xe.Bottom,targetX:s,targetY:i,targetPosition:l=xe.Top}){const[c,u]=yh({pos:n,x1:e,y1:t,x2:s,y2:i}),[f,p]=yh({pos:l,x1:s,y1:i,x2:e,y2:t}),[m,y,E,x]=gh({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${i}`,m,y,E,x]}const Xc=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=xe.Bottom,targetPosition:l=xe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:y,style:E,markerEnd:x,markerStart:_,interactionWidth:w})=>{const[S,N,R]=Eh({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:l});return ne.createElement(wo,{path:S,labelX:N,labelY:R,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:y,style:E,markerEnd:x,markerStart:_,interactionWidth:w})});Xc.displayName="SimpleBezierEdge";const vh={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},Ww=({source:e,sourcePosition:t=xe.Bottom,target:n})=>t===xe.Left||t===xe.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},xh=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Gw({source:e,sourcePosition:t=xe.Bottom,target:n,targetPosition:s=xe.Top,center:i,offset:l}){const c=vh[t],u=vh[s],f={x:e.x+c.x*l,y:e.y+c.y*l},p={x:n.x+u.x*l,y:n.y+u.y*l},m=Ww({source:f,sourcePosition:t,target:p}),y=m.x!==0?"x":"y",E=m[y];let x=[],_,w;const S={x:0,y:0},N={x:0,y:0},[R,P,C,I]=mh({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(c[y]*u[y]===-1){_=i.x||R,w=i.y||P;const U=[{x:_,y:f.y},{x:_,y:p.y}],G=[{x:f.x,y:w},{x:p.x,y:w}];c[y]===E?x=y==="x"?U:G:x=y==="x"?G:U}else{const U=[{x:f.x,y:p.y}],G=[{x:p.x,y:f.y}];if(y==="x"?x=c.x===E?G:U:x=c.y===E?U:G,t===s){const z=Math.abs(e[y]-n[y]);if(z<=l){const A=Math.min(l-1,l-z);c[y]===E?S[y]=(f[y]>e[y]?-1:1)*A:N[y]=(p[y]>n[y]?-1:1)*A}}if(t!==s){const z=y==="x"?"y":"x",A=c[y]===u[z],F=f[z]>p[z],$=f[z]<p[z];(c[y]===1&&(!A&&F||A&&$)||c[y]!==1&&(!A&&$||A&&F))&&(x=y==="x"?U:G)}const X={x:f.x+S.x,y:f.y+S.y},H={x:p.x+N.x,y:p.y+N.y},q=Math.max(Math.abs(X.x-x[0].x),Math.abs(H.x-x[0].x)),ee=Math.max(Math.abs(X.y-x[0].y),Math.abs(H.y-x[0].y));q>=ee?(_=(X.x+H.x)/2,w=x[0].y):(_=x[0].x,w=(X.y+H.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...x,{x:p.x+N.x,y:p.y+N.y},n],_,w,C,I]}function Yw(e,t,n,s){const i=Math.min(xh(e,t)/2,xh(t,n)/2,s),{x:l,y:c}=t;if(e.x===l&&l===n.x||e.y===c&&c===n.y)return`L${l} ${c}`;if(e.y===c){const p=e.x<n.x?-1:1,m=e.y<n.y?1:-1;return`L ${l+i*p},${c}Q ${l},${c} ${l},${c+i*m}`}const u=e.x<n.x?1:-1,f=e.y<n.y?-1:1;return`L ${l},${c+i*f}Q ${l},${c} ${l+i*u},${c}`}function Us({sourceX:e,sourceY:t,sourcePosition:n=xe.Bottom,targetX:s,targetY:i,targetPosition:l=xe.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[m,y,E,x,_]=Gw({source:{x:e,y:t},sourcePosition:n,target:{x:s,y:i},targetPosition:l,center:{x:u,y:f},offset:p});return[m.reduce((S,N,R)=>{let P="";return R>0&&R<m.length-1?P=Yw(m[R-1],N,m[R+1],c):P=`${R===0?"M":"L"}${N.x} ${N.y}`,S+=P,S},""),y,E,x,_]}const pl=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,sourcePosition:y=xe.Bottom,targetPosition:E=xe.Top,markerEnd:x,markerStart:_,pathOptions:w,interactionWidth:S})=>{const[N,R,P]=Us({sourceX:e,sourceY:t,sourcePosition:y,targetX:n,targetY:s,targetPosition:E,borderRadius:w==null?void 0:w.borderRadius,offset:w==null?void 0:w.offset});return ne.createElement(wo,{path:N,labelX:R,labelY:P,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:_,interactionWidth:S})});pl.displayName="SmoothStepEdge";const Qc=b.memo(e=>{var t;return ne.createElement(pl,{...e,pathOptions:b.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});Qc.displayName="StepEdge";function Kw({sourceX:e,sourceY:t,targetX:n,targetY:s}){const[i,l,c,u]=mh({sourceX:e,sourceY:t,targetX:n,targetY:s});return[`M ${e},${t}L ${n},${s}`,i,l,c,u]}const qc=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:x})=>{const[_,w,S]=Kw({sourceX:e,sourceY:t,targetX:n,targetY:s});return ne.createElement(wo,{path:_,labelX:w,labelY:S,label:i,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:y,markerStart:E,interactionWidth:x})});qc.displayName="StraightEdge";function hl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Sh({pos:e,x1:t,y1:n,x2:s,y2:i,c:l}){switch(e){case xe.Left:return[t-hl(t-s,l),n];case xe.Right:return[t+hl(s-t,l),n];case xe.Top:return[t,n-hl(n-i,l)];case xe.Bottom:return[t,n+hl(i-n,l)]}}function _h({sourceX:e,sourceY:t,sourcePosition:n=xe.Bottom,targetX:s,targetY:i,targetPosition:l=xe.Top,curvature:c=.25}){const[u,f]=Sh({pos:n,x1:e,y1:t,x2:s,y2:i,c}),[p,m]=Sh({pos:l,x1:s,y1:i,x2:e,y2:t,c}),[y,E,x,_]=gh({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:m});return[`M${e},${t} C${u},${f} ${p},${m} ${s},${i}`,y,E,x,_]}const ml=b.memo(({sourceX:e,sourceY:t,targetX:n,targetY:s,sourcePosition:i=xe.Bottom,targetPosition:l=xe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:y,style:E,markerEnd:x,markerStart:_,pathOptions:w,interactionWidth:S})=>{const[N,R,P]=_h({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:s,targetPosition:l,curvature:w==null?void 0:w.curvature});return ne.createElement(wo,{path:N,labelX:R,labelY:P,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:y,style:E,markerEnd:x,markerStart:_,interactionWidth:S})});ml.displayName="BezierEdge";const Jc=b.createContext(null),Xw=Jc.Provider;Jc.Consumer;const Qw=()=>b.useContext(Jc),qw=e=>"id"in e&&"source"in e&&"target"in e,wh=({source:e,sourceHandle:t,target:n,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${n}${s||""}`,Zc=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,Jw=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Nh=(e,t)=>{if(!e.source||!e.target)return t;let n;return qw(e)?n={...e}:n={...e,id:wh(e)},Jw(n,t)?t:t.concat(n)},Zw=(e,t,n,s={shouldReplaceId:!0})=>{const{id:i,...l}=e;if(!t.source||!t.target||!n.find(f=>f.id===i))return n;const u={...l,id:s.shouldReplaceId?wh(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(f=>f.id!==i).concat(u)},eu=({x:e,y:t},[n,s,i],l,[c,u])=>{const f={x:(e-n)/i,y:(t-s)/i};return l?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},Rh=({x:e,y:t},[n,s,i])=>({x:e*i+n,y:t*i+s}),No=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-s}:i}},tu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((s,i)=>{const{x:l,y:c}=No(i,t).positionAbsolute;return Vw(s,Gc({x:l,y:c,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $w(n)},Th=(e,t,[n,s,i]=[0,0,1],l=!1,c=!1,u=[0,0])=>{const f={x:(t.x-n)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(m=>{const{width:y,height:E,selectable:x=!0,hidden:_=!1}=m;if(c&&!x||_)return!1;const{positionAbsolute:w}=No(m,u),S={x:w.x,y:w.y,width:y||0,height:E||0},N=Yc(f,S),R=typeof y>"u"||typeof E>"u"||y===null||E===null,P=l&&N>0,C=(y||0)*(E||0);(R||P||N>=C||m.dragging)&&p.push(m)}),p},Oh=(e,t)=>{const n=e.map(s=>s.id);return t.filter(s=>n.includes(s.source)||n.includes(s.target))},Ch=(e,t,n,s,i,l=.1)=>{const c=t/(e.width*(1+l)),u=n/(e.height*(1+l)),f=Math.min(c,u),p=_o(f,s,i),m=e.x+e.width/2,y=e.y+e.height/2,E=t/2-m*p,x=n/2-y*p;return{x:E,y:x,zoom:p}},Br=(e,t=0)=>e.transition().duration(t);function Ah(e,t,n,s){return(t[n]||[]).reduce((i,l)=>{var c,u;return`${e.id}-${l.id}-${n}`!==s&&i.push({id:l.id||null,type:n,nodeId:e.id,x:(((c=e.positionAbsolute)==null?void 0:c.x)??0)+l.x+l.width/2,y:(((u=e.positionAbsolute)==null?void 0:u.y)??0)+l.y+l.height/2}),i},[])}function eN(e,t,n,s,i,l){const{x:c,y:u}=ar(e),p=t.elementsFromPoint(c,u).find(_=>_.classList.contains("react-flow__handle"));if(p){const _=p.getAttribute("data-nodeid");if(_){const w=nu(void 0,p),S=p.getAttribute("data-handleid"),N=l({nodeId:_,id:S,type:w});if(N){const R=i.find(P=>P.nodeId===_&&P.type===w&&P.id===S);return{handle:{id:S,type:w,nodeId:_,x:(R==null?void 0:R.x)||n.x,y:(R==null?void 0:R.y)||n.y},validHandleResult:N}}}}let m=[],y=1/0;if(i.forEach(_=>{const w=Math.sqrt((_.x-n.x)**2+(_.y-n.y)**2);if(w<=s){const S=l(_);w<=y&&(w<y?m=[{handle:_,validHandleResult:S}]:w===y&&m.push({handle:_,validHandleResult:S}),y=w)}}),!m.length)return{handle:null,validHandleResult:Ih()};if(m.length===1)return m[0];const E=m.some(({validHandleResult:_})=>_.isValid),x=m.some(({handle:_})=>_.type==="target");return m.find(({handle:_,validHandleResult:w})=>x?_.type==="target":E?w.isValid:!0)||m[0]}const tN={source:null,target:null,sourceHandle:null,targetHandle:null},Ih=()=>({handleDomNode:null,isValid:!1,connection:tN,endHandle:null});function bh(e,t,n,s,i,l,c){const u=i==="target",f=c.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),p={...Ih(),handleDomNode:f};if(f){const m=nu(void 0,f),y=f.getAttribute("data-nodeid"),E=f.getAttribute("data-handleid"),x=f.classList.contains("connectable"),_=f.classList.contains("connectableend"),w={source:u?y:n,sourceHandle:u?E:s,target:u?n:y,targetHandle:u?s:E};p.connection=w,x&&_&&(t===cr.Strict?u&&m==="source"||!u&&m==="target":y!==n||E!==s)&&(p.endHandle={nodeId:y,handleId:E,type:m},p.isValid=l(w))}return p}function nN({nodes:e,nodeId:t,handleId:n,handleType:s}){return e.reduce((i,l)=>{if(l[nt]){const{handleBounds:c}=l[nt];let u=[],f=[];c&&(u=Ah(l,c,"source",`${t}-${n}-${s}`),f=Ah(l,c,"target",`${t}-${n}-${s}`)),i.push(...u,...f)}return i},[])}function nu(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ru(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function rN(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Lh({event:e,handleId:t,nodeId:n,onConnect:s,isTarget:i,getState:l,setState:c,isValidConnection:u,edgeUpdaterType:f,onEdgeUpdateEnd:p}){const m=dh(e.target),{connectionMode:y,domNode:E,autoPanOnConnect:x,connectionRadius:_,onConnectStart:w,panBy:S,getNodes:N,cancelConnection:R}=l();let P=0,C;const{x:I,y:L}=ar(e),U=m==null?void 0:m.elementFromPoint(I,L),G=nu(f,U),X=E==null?void 0:E.getBoundingClientRect();if(!X||!G)return;let H,q=ar(e,X),ee=!1,z=null,A=!1,F=null;const $=nN({nodes:N(),nodeId:n,handleId:t,handleType:G}),Y=()=>{if(!x)return;const[B,D]=uh(q,X);S({x:B,y:D}),P=requestAnimationFrame(Y)};c({connectionPosition:q,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:G,connectionStartHandle:{nodeId:n,handleId:t,type:G},connectionEndHandle:null}),w==null||w(e,{nodeId:n,handleId:t,handleType:G});function M(B){const{transform:D}=l();q=ar(B,X);const{handle:Q,validHandleResult:oe}=eN(B,m,eu(q,D,!1,[1,1]),_,$,re=>bh(re,y,n,t,i?"target":"source",u,m));if(C=Q,ee||(Y(),ee=!0),F=oe.handleDomNode,z=oe.connection,A=oe.isValid,c({connectionPosition:C&&A?Rh({x:C.x,y:C.y},D):q,connectionStatus:rN(!!C,A),connectionEndHandle:oe.endHandle}),!C&&!A&&!F)return ru(H);z.source!==z.target&&F&&(ru(H),H=F,F.classList.add("connecting","react-flow__handle-connecting"),F.classList.toggle("valid",A),F.classList.toggle("react-flow__handle-valid",A))}function V(B){var D,Q;(C||F)&&z&&A&&(s==null||s(z)),(Q=(D=l()).onConnectEnd)==null||Q.call(D,B),f&&(p==null||p(B)),ru(H),R(),cancelAnimationFrame(P),ee=!1,A=!1,z=null,F=null,m.removeEventListener("mousemove",M),m.removeEventListener("mouseup",V),m.removeEventListener("touchmove",M),m.removeEventListener("touchend",V)}m.addEventListener("mousemove",M),m.addEventListener("mouseup",V),m.addEventListener("touchmove",M),m.addEventListener("touchend",V)}const Dh=()=>!0,oN=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),sN=(e,t,n)=>s=>{const{connectionStartHandle:i,connectionEndHandle:l,connectionClickStartHandle:c}=s;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.handleId)===t&&(l==null?void 0:l.type)===n,clickConnecting:(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.handleId)===t&&(c==null?void 0:c.type)===n}},kh=b.forwardRef(({type:e="source",position:t=xe.Top,isValidConnection:n,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:m,onTouchStart:y,...E},x)=>{var X,H;const _=c||null,w=e==="target",S=tt(),N=Qw(),{connectOnClick:R,noPanClassName:P}=Pe(oN,gt),{connecting:C,clickConnecting:I}=Pe(sN(N,_,e),gt);N||(H=(X=S.getState()).onError)==null||H.call(X,"010",$n.error010());const L=q=>{const{defaultEdgeOptions:ee,onConnect:z,hasDefaultEdges:A}=S.getState(),F={...ee,...q};if(A){const{edges:$,setEdges:Y}=S.getState();Y(Nh(F,$))}z==null||z(F),u==null||u(F)},U=q=>{if(!N)return;const ee=hh(q);i&&(ee&&q.button===0||!ee)&&Lh({event:q,handleId:_,nodeId:N,onConnect:L,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||Dh}),ee?m==null||m(q):y==null||y(q)},G=q=>{const{onClickConnectStart:ee,onClickConnectEnd:z,connectionClickStartHandle:A,connectionMode:F,isValidConnection:$}=S.getState();if(!N||!A&&!i)return;if(!A){ee==null||ee(q,{nodeId:N,handleId:_,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:N,type:e,handleId:_}});return}const Y=dh(q.target),M=n||$||Dh,{connection:V,isValid:B}=bh({nodeId:N,id:_,type:e},F,A.nodeId,A.handleId||null,A.type,M,Y);B&&L(V),z==null||z(q),S.setState({connectionClickStartHandle:null})};return ne.createElement("div",{"data-handleid":_,"data-nodeid":N,"data-handlepos":t,"data-id":`${N}-${_}-${e}`,className:St(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",P,p,{source:!w,target:w,connectable:s,connectablestart:i,connectableend:l,connecting:I,connectionindicator:s&&(i&&!C||l&&C)}]),onMouseDown:U,onTouchStart:U,onClick:R?G:void 0,ref:x,...E},f)});kh.displayName="Handle";var Ro=b.memo(kh);const Ph=({data:e,isConnectable:t,targetPosition:n=xe.Top,sourcePosition:s=xe.Bottom})=>ne.createElement(ne.Fragment,null,ne.createElement(Ro,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,ne.createElement(Ro,{type:"source",position:s,isConnectable:t}));Ph.displayName="DefaultNode";var ou=b.memo(Ph);const Mh=({data:e,isConnectable:t,sourcePosition:n=xe.Bottom})=>ne.createElement(ne.Fragment,null,e==null?void 0:e.label,ne.createElement(Ro,{type:"source",position:n,isConnectable:t}));Mh.displayName="InputNode";var jh=b.memo(Mh);const Uh=({data:e,isConnectable:t,targetPosition:n=xe.Top})=>ne.createElement(ne.Fragment,null,ne.createElement(Ro,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label);Uh.displayName="OutputNode";var Fh=b.memo(Uh);const su=()=>null;su.displayName="GroupNode";const iN=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),gl=e=>e.id;function lN(e,t){return gt(e.selectedNodes.map(gl),t.selectedNodes.map(gl))&&gt(e.selectedEdges.map(gl),t.selectedEdges.map(gl))}const Vh=b.memo(({onSelectionChange:e})=>{const t=tt(),{selectedNodes:n,selectedEdges:s}=Pe(iN,lN);return b.useEffect(()=>{const i={nodes:n,edges:s};e==null||e(i),t.getState().onSelectionChange.forEach(l=>l(i))},[n,s,e]),null});Vh.displayName="SelectionListener";const aN=e=>!!e.onSelectionChange;function cN({onSelectionChange:e}){const t=Pe(aN);return e||t?ne.createElement(Vh,{onSelectionChange:e}):null}const uN=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function To(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Oe(e,t,n){b.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const dN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:i,onConnectStart:l,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:m,nodesFocusable:y,edgesFocusable:E,edgesUpdatable:x,elevateNodesOnSelect:_,minZoom:w,maxZoom:S,nodeExtent:N,onNodesChange:R,onEdgesChange:P,elementsSelectable:C,connectionMode:I,snapGrid:L,snapToGrid:U,translateExtent:G,connectOnClick:X,defaultEdgeOptions:H,fitView:q,fitViewOptions:ee,onNodesDelete:z,onEdgesDelete:A,onNodeDrag:F,onNodeDragStart:$,onNodeDragStop:Y,onSelectionDrag:M,onSelectionDragStart:V,onSelectionDragStop:B,noPanClassName:D,nodeOrigin:Q,rfId:oe,autoPanOnConnect:re,autoPanOnNodeDrag:le,onError:ue,connectionRadius:fe,isValidConnection:de,nodeDragThreshold:me})=>{const{setNodes:Re,setEdges:Me,setDefaultNodesAndEdges:Ze,setMinZoom:wt,setMaxZoom:Be,setTranslateExtent:je,setNodeExtent:ft,reset:pt}=Pe(uN,gt),we=tt();return b.useEffect(()=>{const un=s==null?void 0:s.map(Bt=>({...Bt,...H}));return Ze(n,un),()=>{pt()}},[]),Oe("defaultEdgeOptions",H,we.setState),Oe("connectionMode",I,we.setState),Oe("onConnect",i,we.setState),Oe("onConnectStart",l,we.setState),Oe("onConnectEnd",c,we.setState),Oe("onClickConnectStart",u,we.setState),Oe("onClickConnectEnd",f,we.setState),Oe("nodesDraggable",p,we.setState),Oe("nodesConnectable",m,we.setState),Oe("nodesFocusable",y,we.setState),Oe("edgesFocusable",E,we.setState),Oe("edgesUpdatable",x,we.setState),Oe("elementsSelectable",C,we.setState),Oe("elevateNodesOnSelect",_,we.setState),Oe("snapToGrid",U,we.setState),Oe("snapGrid",L,we.setState),Oe("onNodesChange",R,we.setState),Oe("onEdgesChange",P,we.setState),Oe("connectOnClick",X,we.setState),Oe("fitViewOnInit",q,we.setState),Oe("fitViewOnInitOptions",ee,we.setState),Oe("onNodesDelete",z,we.setState),Oe("onEdgesDelete",A,we.setState),Oe("onNodeDrag",F,we.setState),Oe("onNodeDragStart",$,we.setState),Oe("onNodeDragStop",Y,we.setState),Oe("onSelectionDrag",M,we.setState),Oe("onSelectionDragStart",V,we.setState),Oe("onSelectionDragStop",B,we.setState),Oe("noPanClassName",D,we.setState),Oe("nodeOrigin",Q,we.setState),Oe("rfId",oe,we.setState),Oe("autoPanOnConnect",re,we.setState),Oe("autoPanOnNodeDrag",le,we.setState),Oe("onError",ue,we.setState),Oe("connectionRadius",fe,we.setState),Oe("isValidConnection",de,we.setState),Oe("nodeDragThreshold",me,we.setState),To(e,Re),To(t,Me),To(w,wt),To(S,Be),To(G,je),To(N,ft),null},$h={display:"none"},fN={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Hh="react-flow__node-desc",Bh="react-flow__edge-desc",pN="react-flow__aria-live",hN=e=>e.ariaLiveMessage;function mN({rfId:e}){const t=Pe(hN);return ne.createElement("div",{id:`${pN}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:fN},t)}function gN({rfId:e,disableKeyboardA11y:t}){return ne.createElement(ne.Fragment,null,ne.createElement("div",{id:`${Hh}-${e}`,style:$h},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),ne.createElement("div",{id:`${Bh}-${e}`,style:$h},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ne.createElement(mN,{rfId:e}))}var Oo=(e=null,t={actInsideInputWithModifier:!0})=>{const[n,s]=b.useState(!1),i=b.useRef(!1),l=b.useRef(new Set([])),[c,u]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(y=>typeof y=="string").map(y=>y.split("+")),m=p.reduce((y,E)=>y.concat(...E),[]);return[p,m]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=(t==null?void 0:t.target)||f;if(e!==null){const m=x=>{if(i.current=x.ctrlKey||x.metaKey||x.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Kc(x))return!1;const w=Wh(x.code,u);l.current.add(x[w]),zh(c,l.current,!1)&&(x.preventDefault(),s(!0))},y=x=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Kc(x))return!1;const w=Wh(x.code,u);zh(c,l.current,!0)?(s(!1),l.current.clear()):l.current.delete(x[w]),x.key==="Meta"&&l.current.clear(),i.current=!1},E=()=>{l.current.clear(),s(!1)};return p==null||p.addEventListener("keydown",m),p==null||p.addEventListener("keyup",y),window.addEventListener("blur",E),()=>{p==null||p.removeEventListener("keydown",m),p==null||p.removeEventListener("keyup",y),window.removeEventListener("blur",E)}}},[e,s]),n};function zh(e,t,n){return e.filter(s=>n||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Wh(e,t){return t.includes(e)?"code":"key"}function Gh(e,t,n,s){var c,u;if(!e.parentNode)return n;const i=t.get(e.parentNode),l=No(i,s);return Gh(i,t,{x:(n.x??0)+l.x,y:(n.y??0)+l.y,z:(((c=i[nt])==null?void 0:c.z)??0)>(n.z??0)?((u=i[nt])==null?void 0:u.z)??0:n.z??0},s)}function Yh(e,t,n){e.forEach(s=>{var i;if(s.parentNode&&!e.has(s.parentNode))throw new Error(`Parent node ${s.parentNode} not found`);if(s.parentNode||n!=null&&n[s.id]){const{x:l,y:c,z:u}=Gh(s,e,{...s.position,z:((i=s[nt])==null?void 0:i.z)??0},t);s.positionAbsolute={x:l,y:c},s[nt].z=u,n!=null&&n[s.id]&&(s[nt].isParent=!0)}})}function iu(e,t,n,s){const i=new Map,l={},c=s?1e3:0;return e.forEach(u=>{var y;const f=(Kt(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),m={width:p==null?void 0:p.width,height:p==null?void 0:p.height,...u,positionAbsolute:{x:u.position.x,y:u.position.y}};u.parentNode&&(m.parentNode=u.parentNode,l[u.parentNode]=!0),Object.defineProperty(m,nt,{enumerable:!1,value:{handleBounds:(y=p==null?void 0:p[nt])==null?void 0:y.handleBounds,z:f}}),i.set(u.id,m)}),Yh(i,n,l),i}function Kh(e,t={}){const{getNodes:n,width:s,height:i,minZoom:l,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:m,nodeOrigin:y}=e(),E=t.initial&&!p&&m;if(u&&f&&(E||!t.initial)){const _=n().filter(S=>{var R;const N=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return(R=t.nodes)!=null&&R.length?N&&t.nodes.some(P=>P.id===S.id):N}),w=_.every(S=>S.width&&S.height);if(_.length>0&&w){const S=tu(_,y),{x:N,y:R,zoom:P}=Ch(S,s,i,t.minZoom??l,t.maxZoom??c,t.padding??.1),C=lr.translate(N,R).scale(P);return typeof t.duration=="number"&&t.duration>0?u.transform(Br(f,t.duration),C):u.transform(f,C),!0}}return!1}function yN(e,t){return e.forEach(n=>{const s=t.get(n.id);s&&t.set(s.id,{...s,[nt]:s[nt],selected:n.selected})}),new Map(t)}function EN(e,t){return t.map(n=>{const s=e.find(i=>i.id===n.id);return s&&(n.selected=s.selected),n})}function yl({changedNodes:e,changedEdges:t,get:n,set:s}){const{nodeInternals:i,edges:l,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=n();e!=null&&e.length&&(f&&s({nodeInternals:yN(e,i)}),c==null||c(e)),t!=null&&t.length&&(p&&s({edges:EN(t,l)}),u==null||u(t))}const Co=()=>{},vN={zoomIn:Co,zoomOut:Co,zoomTo:Co,getZoom:()=>1,setViewport:Co,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Co,fitBounds:Co,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},xN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),SN=()=>{const e=tt(),{d3Zoom:t,d3Selection:n}=Pe(xN,gt);return b.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(Br(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(Br(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,l)=>t.scaleTo(Br(n,l==null?void 0:l.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,l)=>{const[c,u,f]=e.getState().transform,p=lr.translate(i.x??c,i.y??u).scale(i.zoom??f);t.transform(Br(n,l==null?void 0:l.duration),p)},getViewport:()=>{const[i,l,c]=e.getState().transform;return{x:i,y:l,zoom:c}},fitView:i=>Kh(e.getState,i),setCenter:(i,l,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),m=typeof(c==null?void 0:c.zoom)<"u"?c.zoom:p,y=u/2-i*m,E=f/2-l*m,x=lr.translate(y,E).scale(m);t.transform(Br(n,c==null?void 0:c.duration),x)},fitBounds:(i,l)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:m,y,zoom:E}=Ch(i,c,u,f,p,(l==null?void 0:l.padding)??.1),x=lr.translate(m,y).scale(E);t.transform(Br(n,l==null?void 0:l.duration),x)},project:i=>{const{transform:l,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),eu(i,l,c,u)},screenToFlowPosition:i=>{const{transform:l,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return i;const{x:p,y:m}=f.getBoundingClientRect(),y={x:i.x-p,y:i.y-m};return eu(y,l,c,u)},flowToScreenPosition:i=>{const{transform:l,domNode:c}=e.getState();if(!c)return i;const{x:u,y:f}=c.getBoundingClientRect(),p=Rh(i,l);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:vN,[t,n])};function lu(){const e=SN(),t=tt(),n=b.useCallback(()=>t.getState().getNodes().map(w=>({...w})),[]),s=b.useCallback(w=>t.getState().nodeInternals.get(w),[]),i=b.useCallback(()=>{const{edges:w=[]}=t.getState();return w.map(S=>({...S}))},[]),l=b.useCallback(w=>{const{edges:S=[]}=t.getState();return S.find(N=>N.id===w)},[]),c=b.useCallback(w=>{const{getNodes:S,setNodes:N,hasDefaultNodes:R,onNodesChange:P}=t.getState(),C=S(),I=typeof w=="function"?w(C):w;if(R)N(I);else if(P){const L=I.length===0?C.map(U=>({type:"remove",id:U.id})):I.map(U=>({item:U,type:"reset"}));P(L)}},[]),u=b.useCallback(w=>{const{edges:S=[],setEdges:N,hasDefaultEdges:R,onEdgesChange:P}=t.getState(),C=typeof w=="function"?w(S):w;if(R)N(C);else if(P){const I=C.length===0?S.map(L=>({type:"remove",id:L.id})):C.map(L=>({item:L,type:"reset"}));P(I)}},[]),f=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:N,setNodes:R,hasDefaultNodes:P,onNodesChange:C}=t.getState();if(P){const L=[...N(),...S];R(L)}else if(C){const I=S.map(L=>({item:L,type:"add"}));C(I)}},[]),p=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:N=[],setEdges:R,hasDefaultEdges:P,onEdgesChange:C}=t.getState();if(P)R([...N,...S]);else if(C){const I=S.map(L=>({item:L,type:"add"}));C(I)}},[]),m=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:N}=t.getState(),[R,P,C]=N;return{nodes:w().map(I=>({...I})),edges:S.map(I=>({...I})),viewport:{x:R,y:P,zoom:C}}},[]),y=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:N,getNodes:R,edges:P,hasDefaultNodes:C,hasDefaultEdges:I,onNodesDelete:L,onEdgesDelete:U,onNodesChange:G,onEdgesChange:X}=t.getState(),H=(w||[]).map(F=>F.id),q=(S||[]).map(F=>F.id),ee=R().reduce((F,$)=>{const Y=!H.includes($.id)&&$.parentNode&&F.find(V=>V.id===$.parentNode);return(typeof $.deletable=="boolean"?$.deletable:!0)&&(H.includes($.id)||Y)&&F.push($),F},[]),z=P.filter(F=>typeof F.deletable=="boolean"?F.deletable:!0),A=z.filter(F=>q.includes(F.id));if(ee||A){const F=Oh(ee,z),$=[...A,...F],Y=$.reduce((M,V)=>(M.includes(V.id)||M.push(V.id),M),[]);if((I||C)&&(I&&t.setState({edges:P.filter(M=>!Y.includes(M.id))}),C&&(ee.forEach(M=>{N.delete(M.id)}),t.setState({nodeInternals:new Map(N)}))),Y.length>0&&(U==null||U($),X&&X(Y.map(M=>({id:M,type:"remove"})))),ee.length>0&&(L==null||L(ee),G)){const M=ee.map(V=>({id:V.id,type:"remove"}));G(M)}}},[]),E=b.useCallback(w=>{const S=Hw(w),N=S?null:t.getState().nodeInternals.get(w.id);return[S?w:fh(N),N,S]},[]),x=b.useCallback((w,S=!0,N)=>{const[R,P,C]=E(w);return R?(N||t.getState().getNodes()).filter(I=>{if(!C&&(I.id===P.id||!I.positionAbsolute))return!1;const L=fh(I),U=Yc(L,R);return S&&U>0||U>=R.width*R.height}):[]},[]),_=b.useCallback((w,S,N=!0)=>{const[R]=E(w);if(!R)return!1;const P=Yc(R,S);return N&&P>0||P>=R.width*R.height},[]);return b.useMemo(()=>({...e,getNodes:n,getNode:s,getEdges:i,getEdge:l,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:m,deleteElements:y,getIntersectingNodes:x,isNodeIntersecting:_}),[e,n,s,i,l,c,u,f,p,m,y,x,_])}const _N={actInsideInputWithModifier:!1};var wN=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=tt(),{deleteElements:s}=lu(),i=Oo(e,_N),l=Oo(t);b.useEffect(()=>{if(i){const{edges:c,getNodes:u}=n.getState(),f=u().filter(m=>m.selected),p=c.filter(m=>m.selected);s({nodes:f,edges:p}),n.setState({nodesSelectionActive:!1})}},[i]),b.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])};function NN(e){const t=tt();b.useEffect(()=>{let n;const s=()=>{var l,c;if(!e.current)return;const i=zc(e.current);(i.height===0||i.width===0)&&((c=(l=t.getState()).onError)==null||c.call(l,"004",$n.error004())),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(n=new ResizeObserver(()=>s()),n.observe(e.current)),()=>{window.removeEventListener("resize",s),n&&e.current&&n.unobserve(e.current)}},[])}const au={position:"absolute",width:"100%",height:"100%",top:0,left:0},RN=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,El=e=>({x:e.x,y:e.y,zoom:e.k}),Ao=(e,t)=>e.target.closest(`.${t}`),Xh=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Qh=e=>{const t=e.ctrlKey&&fl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},TN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),ON=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:l=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Hr.Free,zoomOnDoubleClick:p=!0,elementsSelectable:m,panOnDrag:y=!0,defaultViewport:E,translateExtent:x,minZoom:_,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:N=!0,children:R,noWheelClassName:P,noPanClassName:C})=>{const I=b.useRef(),L=tt(),U=b.useRef(!1),G=b.useRef(!1),X=b.useRef(null),H=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:q,d3Selection:ee,d3ZoomHandler:z,userSelectionActive:A}=Pe(TN,gt),F=Oo(S),$=b.useRef(0),Y=b.useRef(!1),M=b.useRef();return NN(X),b.useEffect(()=>{if(X.current){const V=X.current.getBoundingClientRect(),B=kw().scaleExtent([_,w]).translateExtent(x),D=on(X.current).call(B),Q=lr.translate(E.x,E.y).scale(_o(E.zoom,_,w)),oe=[[0,0],[V.width,V.height]],re=B.constrain()(Q,oe,x);B.transform(D,re),B.wheelDelta(Qh),L.setState({d3Zoom:B,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[re.x,re.y,re.k],domNode:X.current.closest(".react-flow")})}},[]),b.useEffect(()=>{ee&&q&&(c&&!F&&!A?ee.on("wheel.zoom",V=>{if(Ao(V,P))return!1;V.preventDefault(),V.stopImmediatePropagation();const B=ee.property("__zoom").k||1,D=fl();if(V.ctrlKey&&l&&D){const me=_n(V),Re=Qh(V),Me=B*Math.pow(2,Re);q.scaleTo(ee,Me,me,V);return}const Q=V.deltaMode===1?20:1;let oe=f===Hr.Vertical?0:V.deltaX*Q,re=f===Hr.Horizontal?0:V.deltaY*Q;!D&&V.shiftKey&&f!==Hr.Vertical&&(oe=V.deltaY*Q,re=0),q.translateBy(ee,-(oe/B)*u,-(re/B)*u,{internal:!0});const le=El(ee.property("__zoom")),{onViewportChangeStart:ue,onViewportChange:fe,onViewportChangeEnd:de}=L.getState();clearTimeout(M.current),Y.current||(Y.current=!0,t==null||t(V,le),ue==null||ue(le)),Y.current&&(e==null||e(V,le),fe==null||fe(le),M.current=setTimeout(()=>{n==null||n(V,le),de==null||de(le),Y.current=!1},150))},{passive:!1}):typeof z<"u"&&ee.on("wheel.zoom",function(V,B){if(!N||Ao(V,P))return null;V.preventDefault(),z.call(this,V,B)},{passive:!1}))},[A,c,f,ee,q,z,F,l,N,P,t,e,n]),b.useEffect(()=>{q&&q.on("start",V=>{var Q,oe;if(!V.sourceEvent||V.sourceEvent.internal)return null;$.current=(Q=V.sourceEvent)==null?void 0:Q.button;const{onViewportChangeStart:B}=L.getState(),D=El(V.transform);U.current=!0,H.current=D,((oe=V.sourceEvent)==null?void 0:oe.type)==="mousedown"&&L.setState({paneDragging:!0}),B==null||B(D),t==null||t(V.sourceEvent,D)})},[q,t]),b.useEffect(()=>{q&&(A&&!U.current?q.on("zoom",null):A||q.on("zoom",V=>{var D;const{onViewportChange:B}=L.getState();if(L.setState({transform:[V.transform.x,V.transform.y,V.transform.k]}),G.current=!!(s&&Xh(y,$.current??0)),(e||B)&&!((D=V.sourceEvent)!=null&&D.internal)){const Q=El(V.transform);B==null||B(Q),e==null||e(V.sourceEvent,Q)}}))},[A,q,e,y,s]),b.useEffect(()=>{q&&q.on("end",V=>{if(!V.sourceEvent||V.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=L.getState();if(U.current=!1,L.setState({paneDragging:!1}),s&&Xh(y,$.current??0)&&!G.current&&s(V.sourceEvent),G.current=!1,(n||B)&&RN(H.current,V.transform)){const D=El(V.transform);H.current=D,clearTimeout(I.current),I.current=setTimeout(()=>{B==null||B(D),n==null||n(V.sourceEvent,D)},c?150:0)}})},[q,c,y,n,s]),b.useEffect(()=>{q&&q.filter(V=>{const B=F||i,D=l&&V.ctrlKey;if((y===!0||Array.isArray(y)&&y.includes(1))&&V.button===1&&V.type==="mousedown"&&(Ao(V,"react-flow__node")||Ao(V,"react-flow__edge")))return!0;if(!y&&!B&&!c&&!p&&!l||A||!p&&V.type==="dblclick"||Ao(V,P)&&V.type==="wheel"||Ao(V,C)&&(V.type!=="wheel"||c&&V.type==="wheel"&&!F)||!l&&V.ctrlKey&&V.type==="wheel"||!B&&!c&&!D&&V.type==="wheel"||!y&&(V.type==="mousedown"||V.type==="touchstart")||Array.isArray(y)&&!y.includes(V.button)&&(V.type==="mousedown"||V.type==="touchstart"))return!1;const Q=Array.isArray(y)&&y.includes(V.button)||!V.button||V.button<=1;return(!V.ctrlKey||V.type==="wheel")&&Q})},[A,q,i,l,c,p,y,m,F]),ne.createElement("div",{className:"react-flow__renderer",ref:X,style:au},R)},CN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function AN(){const{userSelectionActive:e,userSelectionRect:t}=Pe(CN,gt);return e&&t?ne.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function qh(e,t){const n=e.find(s=>s.id===t.parentNode);if(n){const s=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(s>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,s>0&&(n.style.width+=s),i>0&&(n.style.height+=i),t.position.x<0){const l=Math.abs(t.position.x);n.position.x=n.position.x-l,n.style.width+=l,t.position.x=0}if(t.position.y<0){const l=Math.abs(t.position.y);n.position.y=n.position.y-l,n.style.height+=l,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function Jh(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const n=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const l=e.filter(u=>u.id===i.id);if(l.length===0)return s.push(i),s;const c={...i};for(const u of l)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&qh(s,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&qh(s,c);break}case"remove":return s}return s.push(c),s},n)}function Zh(e,t){return Jh(e,t)}function IN(e,t){return Jh(e,t)}const dr=(e,t)=>({id:e,type:"select",selected:t});function Io(e,t){return e.reduce((n,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,n.push(dr(s.id,!0))):s.selected&&!i&&(s.selected=!1,n.push(dr(s.id,!1))),n},[])}const cu=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},bN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),em=b.memo(({isSelecting:e,selectionMode:t=Ms.Full,panOnDrag:n,onSelectionStart:s,onSelectionEnd:i,onPaneClick:l,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:y})=>{const E=b.useRef(null),x=tt(),_=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:N,elementsSelectable:R,dragging:P}=Pe(bN,gt),C=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,w.current=0},I=z=>{l==null||l(z),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},L=z=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){z.preventDefault();return}c==null||c(z)},U=u?z=>u(z):void 0,G=z=>{const{resetSelectedElements:A,domNode:F}=x.getState();if(S.current=F==null?void 0:F.getBoundingClientRect(),!R||!e||z.button!==0||z.target!==E.current||!S.current)return;const{x:$,y:Y}=ar(z,S.current);A(),x.setState({userSelectionRect:{width:0,height:0,startX:$,startY:Y,x:$,y:Y}}),s==null||s(z)},X=z=>{const{userSelectionRect:A,nodeInternals:F,edges:$,transform:Y,onNodesChange:M,onEdgesChange:V,nodeOrigin:B,getNodes:D}=x.getState();if(!e||!S.current||!A)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Q=ar(z,S.current),oe=A.startX??0,re=A.startY??0,le={...A,x:Q.x<oe?Q.x:oe,y:Q.y<re?Q.y:re,width:Math.abs(Q.x-oe),height:Math.abs(Q.y-re)},ue=D(),fe=Th(F,le,Y,t===Ms.Partial,!0,B),de=Oh(fe,$).map(Re=>Re.id),me=fe.map(Re=>Re.id);if(_.current!==me.length){_.current=me.length;const Re=Io(ue,me);Re.length&&(M==null||M(Re))}if(w.current!==de.length){w.current=de.length;const Re=Io($,de);Re.length&&(V==null||V(Re))}x.setState({userSelectionRect:le})},H=z=>{if(z.button!==0)return;const{userSelectionRect:A}=x.getState();!N&&A&&z.target===E.current&&(I==null||I(z)),x.setState({nodesSelectionActive:_.current>0}),C(),i==null||i(z)},q=z=>{N&&(x.setState({nodesSelectionActive:_.current>0}),i==null||i(z)),C()},ee=R&&(e||N);return ne.createElement("div",{className:St(["react-flow__pane",{dragging:P,selection:e}]),onClick:ee?void 0:cu(I,E),onContextMenu:cu(L,E),onWheel:cu(U,E),onMouseEnter:ee?void 0:f,onMouseDown:ee?G:void 0,onMouseMove:ee?X:p,onMouseUp:ee?H:void 0,onMouseLeave:ee?q:m,ref:E,style:au},y,ne.createElement(AN,null))});em.displayName="Pane";function tm(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:tm(n,t):!1}function nm(e,t,n){let s=e;do{if(s!=null&&s.matches(t))return!0;if(s===n.current)return!1;s=s.parentElement}while(s);return!1}function LN(e,t,n,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||!tm(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var l,c;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((l=i.positionAbsolute)==null?void 0:l.x)??0),y:n.y-(((c=i.positionAbsolute)==null?void 0:c.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height,expandParent:i.expandParent}})}function DN(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function rm(e,t,n,s,i=[0,0],l){const c=DN(e,e.extent||s);let u=c;if(e.extent==="parent"&&!e.expandParent)if(e.parentNode&&e.width&&e.height){const m=n.get(e.parentNode),{x:y,y:E}=No(m,i).positionAbsolute;u=m&&Kt(y)&&Kt(E)&&Kt(m.width)&&Kt(m.height)?[[y+e.width*i[0],E+e.height*i[1]],[y+m.width-e.width+e.width*i[0],E+m.height-e.height+e.height*i[1]]]:u}else l==null||l("005",$n.error005()),u=c;else if(e.extent&&e.parentNode&&e.extent!=="parent"){const m=n.get(e.parentNode),{x:y,y:E}=No(m,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+E],[e.extent[1][0]+y,e.extent[1][1]+E]]}let f={x:0,y:0};if(e.parentNode){const m=n.get(e.parentNode);f=No(m,i).positionAbsolute}const p=u&&u!=="parent"?Wc(t,u):t;return{position:{x:p.x-f.x,y:p.y-f.y},positionAbsolute:p}}function uu({nodeId:e,dragItems:t,nodeInternals:n}){const s=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const om=(e,t,n,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const l=Array.from(i),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return l.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/n,y:(p.top-c.top-u.y)/n,...zc(f)}})};function Fs(e,t,n){return n===void 0?n:s=>{const i=t().nodeInternals.get(e);i&&n(s,{...i})}}function du({id:e,store:t,unselect:n=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:l,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f==null||f("012",$n.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(n||p.selected&&c)&&(l({nodes:[p],edges:[]}),requestAnimationFrame(()=>{var m;return(m=s==null?void 0:s.current)==null?void 0:m.blur()})):i([e])}function kN(){const e=tt();return b.useCallback(({sourceEvent:n})=>{const{transform:s,snapGrid:i,snapToGrid:l}=e.getState(),c=n.touches?n.touches[0].clientX:n.clientX,u=n.touches?n.touches[0].clientY:n.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:l?i[0]*Math.round(f.x/i[0]):f.x,ySnapped:l?i[1]*Math.round(f.y/i[1]):f.y,...f}},[])}function fu(e){return(t,n,s)=>e==null?void 0:e(t,s)}function sm({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:s,nodeId:i,isSelectable:l,selectNodesOnDrag:c}){const u=tt(),[f,p]=b.useState(!1),m=b.useRef([]),y=b.useRef({x:null,y:null}),E=b.useRef(0),x=b.useRef(null),_=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),N=b.useRef(!1),R=kN();return b.useEffect(()=>{if(e!=null&&e.current){const P=on(e.current),C=({x:U,y:G})=>{const{nodeInternals:X,onNodeDrag:H,onSelectionDrag:q,updateNodePositions:ee,nodeExtent:z,snapGrid:A,snapToGrid:F,nodeOrigin:$,onError:Y}=u.getState();y.current={x:U,y:G};let M=!1,V={x:0,y:0,x2:0,y2:0};if(m.current.length>1&&z){const D=tu(m.current,$);V=Gc(D)}if(m.current=m.current.map(D=>{const Q={x:U-D.distance.x,y:G-D.distance.y};F&&(Q.x=A[0]*Math.round(Q.x/A[0]),Q.y=A[1]*Math.round(Q.y/A[1]));const oe=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];m.current.length>1&&z&&!D.extent&&(oe[0][0]=D.positionAbsolute.x-V.x+z[0][0],oe[1][0]=D.positionAbsolute.x+(D.width??0)-V.x2+z[1][0],oe[0][1]=D.positionAbsolute.y-V.y+z[0][1],oe[1][1]=D.positionAbsolute.y+(D.height??0)-V.y2+z[1][1]);const re=rm(D,Q,X,oe,$,Y);return M=M||D.position.x!==re.position.x||D.position.y!==re.position.y,D.position=re.position,D.positionAbsolute=re.positionAbsolute,D}),!M)return;ee(m.current,!0,!0),p(!0);const B=i?H:fu(q);if(B&&w.current){const[D,Q]=uu({nodeId:i,dragItems:m.current,nodeInternals:X});B(w.current,D,Q)}},I=()=>{if(!x.current)return;const[U,G]=uh(_.current,x.current);if(U!==0||G!==0){const{transform:X,panBy:H}=u.getState();y.current.x=(y.current.x??0)-U/X[2],y.current.y=(y.current.y??0)-G/X[2],H({x:U,y:G})&&C(y.current)}E.current=requestAnimationFrame(I)},L=U=>{var $;const{nodeInternals:G,multiSelectionActive:X,nodesDraggable:H,unselectNodesAndEdges:q,onNodeDragStart:ee,onSelectionDragStart:z}=u.getState();N.current=!0;const A=i?ee:fu(z);(!c||!l)&&!X&&i&&(($=G.get(i))!=null&&$.selected||q()),i&&l&&c&&du({id:i,store:u,nodeRef:e});const F=R(U);if(y.current=F,m.current=LN(G,H,F,i),A&&m.current){const[Y,M]=uu({nodeId:i,dragItems:m.current,nodeInternals:G});A(U.sourceEvent,Y,M)}};if(t)P.on(".drag",null);else{const U=zS().on("start",G=>{const{domNode:X,nodeDragThreshold:H}=u.getState();H===0&&L(G);const q=R(G);y.current=q,x.current=(X==null?void 0:X.getBoundingClientRect())||null,_.current=ar(G.sourceEvent,x.current)}).on("drag",G=>{var ee,z;const X=R(G),{autoPanOnNodeDrag:H,nodeDragThreshold:q}=u.getState();if(!S.current&&N.current&&H&&(S.current=!0,I()),!N.current){const A=X.xSnapped-(((ee=y==null?void 0:y.current)==null?void 0:ee.x)??0),F=X.ySnapped-(((z=y==null?void 0:y.current)==null?void 0:z.y)??0);Math.sqrt(A*A+F*F)>q&&L(G)}(y.current.x!==X.xSnapped||y.current.y!==X.ySnapped)&&m.current&&N.current&&(w.current=G.sourceEvent,_.current=ar(G.sourceEvent,x.current),C(X))}).on("end",G=>{if(N.current&&(p(!1),S.current=!1,N.current=!1,cancelAnimationFrame(E.current),m.current)){const{updateNodePositions:X,nodeInternals:H,onNodeDragStop:q,onSelectionDragStop:ee}=u.getState(),z=i?q:fu(ee);if(X(m.current,!1,!1),z){const[A,F]=uu({nodeId:i,dragItems:m.current,nodeInternals:H});z(G.sourceEvent,A,F)}}}).filter(G=>{const X=G.target;return!G.button&&(!n||!nm(X,`.${n}`,e))&&(!s||nm(X,s,e))});return P.call(U),()=>{P.on(".drag",null)}}}},[e,t,n,s,l,u,i,c,R]),f}function im(){const e=tt();return b.useCallback(n=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:l,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:m}=e.getState(),y=c().filter(R=>R.selected&&(R.draggable||m&&typeof R.draggable>"u")),E=u?f[0]:5,x=u?f[1]:5,_=n.isShiftPressed?4:1,w=n.x*E*_,S=n.y*x*_,N=y.map(R=>{if(R.positionAbsolute){const P={x:R.positionAbsolute.x+w,y:R.positionAbsolute.y+S};u&&(P.x=f[0]*Math.round(P.x/f[0]),P.y=f[1]*Math.round(P.y/f[1]));const{positionAbsolute:C,position:I}=rm(R,P,s,i,void 0,p);R.position=I,R.positionAbsolute=C}return R});l(N,!0,!1)},[])}const bo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Vs=e=>{const t=({id:n,type:s,data:i,xPos:l,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:m,onMouseEnter:y,onMouseMove:E,onMouseLeave:x,onContextMenu:_,onDoubleClick:w,style:S,className:N,isDraggable:R,isSelectable:P,isConnectable:C,isFocusable:I,selectNodesOnDrag:L,sourcePosition:U,targetPosition:G,hidden:X,resizeObserver:H,dragHandle:q,zIndex:ee,isParent:z,noDragClassName:A,noPanClassName:F,initialized:$,disableKeyboardA11y:Y,ariaLabel:M,rfId:V})=>{const B=tt(),D=b.useRef(null),Q=b.useRef(U),oe=b.useRef(G),re=b.useRef(s),le=P||R||m||y||E||x,ue=im(),fe=Fs(n,B.getState,y),de=Fs(n,B.getState,E),me=Fs(n,B.getState,x),Re=Fs(n,B.getState,_),Me=Fs(n,B.getState,w),Ze=je=>{const{nodeDragThreshold:ft}=B.getState();if(P&&(!L||!R||ft>0)&&du({id:n,store:B,nodeRef:D}),m){const pt=B.getState().nodeInternals.get(n);pt&&m(je,{...pt})}},wt=je=>{if(!Kc(je))if(ph.includes(je.key)&&P){const ft=je.key==="Escape";du({id:n,store:B,unselect:ft,nodeRef:D})}else!Y&&R&&p&&Object.prototype.hasOwnProperty.call(bo,je.key)&&(B.setState({ariaLiveMessage:`Moved selected node ${je.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~l}, y: ${~~c}`}),ue({x:bo[je.key].x,y:bo[je.key].y,isShiftPressed:je.shiftKey}))};b.useEffect(()=>{if(D.current&&!X){const je=D.current;return H==null||H.observe(je),()=>H==null?void 0:H.unobserve(je)}},[X]),b.useEffect(()=>{const je=re.current!==s,ft=Q.current!==U,pt=oe.current!==G;D.current&&(je||ft||pt)&&(je&&(re.current=s),ft&&(Q.current=U),pt&&(oe.current=G),B.getState().updateNodeDimensions([{id:n,nodeElement:D.current,forceUpdate:!0}]))},[n,s,U,G]);const Be=sm({nodeRef:D,disabled:X||!R,noDragClassName:A,handleSelector:q,nodeId:n,isSelectable:P,selectNodesOnDrag:L});return X?null:ne.createElement("div",{className:St(["react-flow__node",`react-flow__node-${s}`,{[F]:R},N,{selected:p,selectable:P,parent:z,dragging:Be}]),ref:D,style:{zIndex:ee,transform:`translate(${u}px,${f}px)`,pointerEvents:le?"all":"none",visibility:$?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:fe,onMouseMove:de,onMouseLeave:me,onContextMenu:Re,onClick:Ze,onDoubleClick:Me,onKeyDown:I?wt:void 0,tabIndex:I?0:void 0,role:I?"button":void 0,"aria-describedby":Y?void 0:`${Hh}-${V}`,"aria-label":M},ne.createElement(Xw,{value:n},ne.createElement(e,{id:n,data:i,type:s,xPos:l,yPos:c,selected:p,isConnectable:C,sourcePosition:U,targetPosition:G,dragging:Be,dragHandle:q,zIndex:ee})))};return t.displayName="NodeWrapper",b.memo(t)};const PN=e=>{const t=e.getNodes().filter(n=>n.selected);return{...tu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function MN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const s=tt(),{width:i,height:l,x:c,y:u,transformString:f,userSelectionActive:p}=Pe(PN,gt),m=im(),y=b.useRef(null);if(b.useEffect(()=>{var _;n||(_=y.current)==null||_.focus({preventScroll:!0})},[n]),sm({nodeRef:y}),p||!i||!l)return null;const E=e?_=>{const w=s.getState().getNodes().filter(S=>S.selected);e(_,w)}:void 0,x=_=>{Object.prototype.hasOwnProperty.call(bo,_.key)&&m({x:bo[_.key].x,y:bo[_.key].y,isShiftPressed:_.shiftKey})};return ne.createElement("div",{className:St(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ne.createElement("div",{ref:y,className:"react-flow__nodesselection-rect",onContextMenu:E,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:i,height:l,top:u,left:c}}))}var jN=b.memo(MN);const UN=e=>e.nodesSelectionActive,lm=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:l,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:m,selectionKeyCode:y,selectionOnDrag:E,selectionMode:x,onSelectionStart:_,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:N,zoomActivationKeyCode:R,elementsSelectable:P,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:L,panOnScrollSpeed:U,panOnScrollMode:G,zoomOnDoubleClick:X,panOnDrag:H,defaultViewport:q,translateExtent:ee,minZoom:z,maxZoom:A,preventScrolling:F,onSelectionContextMenu:$,noWheelClassName:Y,noPanClassName:M,disableKeyboardA11y:V})=>{const B=Pe(UN),D=Oo(y),Q=Oo(N),oe=Q||H,re=Q||L,le=D||E&&oe!==!0;return wN({deleteKeyCode:u,multiSelectionKeyCode:S}),ne.createElement(ON,{onMove:f,onMoveStart:p,onMoveEnd:m,onPaneContextMenu:l,elementsSelectable:P,zoomOnScroll:C,zoomOnPinch:I,panOnScroll:re,panOnScrollSpeed:U,panOnScrollMode:G,zoomOnDoubleClick:X,panOnDrag:!D&&oe,defaultViewport:q,translateExtent:ee,minZoom:z,maxZoom:A,zoomActivationKeyCode:R,preventScrolling:F,noWheelClassName:Y,noPanClassName:M},ne.createElement(em,{onSelectionStart:_,onSelectionEnd:w,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:oe,isSelecting:!!le,selectionMode:x},e,B&&ne.createElement(jN,{onSelectionContextMenu:$,noPanClassName:M,disableKeyboardA11y:V})))};lm.displayName="FlowRenderer";var FN=b.memo(lm);function VN(e){return Pe(b.useCallback(n=>e?Th(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function $N(e){const t={input:Vs(e.input||jh),default:Vs(e.default||ou),output:Vs(e.output||Fh),group:Vs(e.group||su)},n={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,l)=>(i[l]=Vs(e[l]||ou),i),n);return{...t,...s}}const HN=({x:e,y:t,width:n,height:s,origin:i})=>!n||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-s*i[1]},BN=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),am=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:l,onError:c}=Pe(BN,gt),u=VN(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const m=new ResizeObserver(y=>{const E=y.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));l(E)});return f.current=m,m},[]);return b.useEffect(()=>()=>{var m;(m=f==null?void 0:f.current)==null||m.disconnect()},[]),ne.createElement("div",{className:"react-flow__nodes",style:au},u.map(m=>{var I,L;let y=m.type||"default";e.nodeTypes[y]||(c==null||c("003",$n.error003(y)),y="default");const E=e.nodeTypes[y]||e.nodeTypes.default,x=!!(m.draggable||t&&typeof m.draggable>"u"),_=!!(m.selectable||i&&typeof m.selectable>"u"),w=!!(m.connectable||n&&typeof m.connectable>"u"),S=!!(m.focusable||s&&typeof m.focusable>"u"),N=e.nodeExtent?Wc(m.positionAbsolute,e.nodeExtent):m.positionAbsolute,R=(N==null?void 0:N.x)??0,P=(N==null?void 0:N.y)??0,C=HN({x:R,y:P,width:m.width??0,height:m.height??0,origin:e.nodeOrigin});return ne.createElement(E,{key:m.id,id:m.id,className:m.className,style:m.style,type:y,data:m.data,sourcePosition:m.sourcePosition||xe.Bottom,targetPosition:m.targetPosition||xe.Top,hidden:m.hidden,xPos:R,yPos:P,xPosOrigin:C.x,yPosOrigin:C.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!m.selected,isDraggable:x,isSelectable:_,isConnectable:w,isFocusable:S,resizeObserver:p,dragHandle:m.dragHandle,zIndex:((I=m[nt])==null?void 0:I.z)??0,isParent:!!((L=m[nt])!=null&&L.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!m.width&&!!m.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:m.ariaLabel})}))};am.displayName="NodeRenderer";var zN=b.memo(am);const WN=(e,t,n)=>n===xe.Left?e-t:n===xe.Right?e+t:e,GN=(e,t,n)=>n===xe.Top?e-t:n===xe.Bottom?e+t:e,cm="react-flow__edgeupdater",um=({position:e,centerX:t,centerY:n,radius:s=10,onMouseDown:i,onMouseEnter:l,onMouseOut:c,type:u})=>ne.createElement("circle",{onMouseDown:i,onMouseEnter:l,onMouseOut:c,className:St([cm,`${cm}-${u}`]),cx:WN(t,s,e),cy:GN(n,s,e),r:s,stroke:"transparent",fill:"transparent"}),YN=()=>!0;var Lo=e=>{const t=({id:n,className:s,type:i,data:l,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:m,labelStyle:y,labelShowBg:E,labelBgStyle:x,labelBgPadding:_,labelBgBorderRadius:w,style:S,source:N,target:R,sourceX:P,sourceY:C,targetX:I,targetY:L,sourcePosition:U,targetPosition:G,elementsSelectable:X,hidden:H,sourceHandleId:q,targetHandleId:ee,onContextMenu:z,onMouseEnter:A,onMouseMove:F,onMouseLeave:$,edgeUpdaterRadius:Y,onEdgeUpdate:M,onEdgeUpdateStart:V,onEdgeUpdateEnd:B,markerEnd:D,markerStart:Q,rfId:oe,ariaLabel:re,isFocusable:le,isUpdatable:ue,pathOptions:fe,interactionWidth:de})=>{const me=b.useRef(null),[Re,Me]=b.useState(!1),[Ze,wt]=b.useState(!1),Be=tt(),je=b.useMemo(()=>`url(#${Zc(Q,oe)})`,[Q,oe]),ft=b.useMemo(()=>`url(#${Zc(D,oe)})`,[D,oe]);if(H)return null;const pt=Ke=>{var Lt;const{edges:ot,addSelectedEdges:Yn,unselectNodesAndEdges:bn,multiSelectionActive:Ln}=Be.getState(),hn=ot.find(Kn=>Kn.id===n);hn&&(X&&(Be.setState({nodesSelectionActive:!1}),hn.selected&&Ln?(bn({nodes:[],edges:[hn]}),(Lt=me.current)==null||Lt.blur()):Yn([n])),c&&c(Ke,hn))},we=Ps(n,Be.getState,u),un=Ps(n,Be.getState,z),Bt=Ps(n,Be.getState,A),qt=Ps(n,Be.getState,F),Cn=Ps(n,Be.getState,$),An=(Ke,ot)=>{if(Ke.button!==0)return;const{edges:Yn,isValidConnection:bn}=Be.getState(),Ln=ot?R:N,hn=(ot?ee:q)||null,Lt=ot?"target":"source",Kn=bn||YN,qr=ot,Xn=Yn.find(Dt=>Dt.id===n);wt(!0),V==null||V(Ke,Xn,Lt);const Jr=Dt=>{wt(!1),B==null||B(Dt,Xn,Lt)};Lh({event:Ke,handleId:hn,nodeId:Ln,onConnect:Dt=>M==null?void 0:M(Xn,Dt),isTarget:qr,getState:Be.getState,setState:Be.setState,isValidConnection:Kn,edgeUpdaterType:Lt,onEdgeUpdateEnd:Jr})},dn=Ke=>An(Ke,!0),Wn=Ke=>An(Ke,!1),fn=()=>Me(!0),pn=()=>Me(!1),In=!X&&!c,Gn=Ke=>{var ot;if(ph.includes(Ke.key)&&X){const{unselectNodesAndEdges:Yn,addSelectedEdges:bn,edges:Ln}=Be.getState();Ke.key==="Escape"?((ot=me.current)==null||ot.blur(),Yn({edges:[Ln.find(Lt=>Lt.id===n)]})):bn([n])}};return ne.createElement("g",{className:St(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:f,animated:p,inactive:In,updating:Re}]),onClick:pt,onDoubleClick:we,onContextMenu:un,onMouseEnter:Bt,onMouseMove:qt,onMouseLeave:Cn,onKeyDown:le?Gn:void 0,tabIndex:le?0:void 0,role:le?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":re===null?void 0:re||`Edge from ${N} to ${R}`,"aria-describedby":le?`${Bh}-${oe}`:void 0,ref:me},!Ze&&ne.createElement(e,{id:n,source:N,target:R,selected:f,animated:p,label:m,labelStyle:y,labelShowBg:E,labelBgStyle:x,labelBgPadding:_,labelBgBorderRadius:w,data:l,style:S,sourceX:P,sourceY:C,targetX:I,targetY:L,sourcePosition:U,targetPosition:G,sourceHandleId:q,targetHandleId:ee,markerStart:je,markerEnd:ft,pathOptions:fe,interactionWidth:de}),ue&&ne.createElement(ne.Fragment,null,(ue==="source"||ue===!0)&&ne.createElement(um,{position:U,centerX:P,centerY:C,radius:Y,onMouseDown:dn,onMouseEnter:fn,onMouseOut:pn,type:"source"}),(ue==="target"||ue===!0)&&ne.createElement(um,{position:G,centerX:I,centerY:L,radius:Y,onMouseDown:Wn,onMouseEnter:fn,onMouseOut:pn,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function KN(e){const t={default:Lo(e.default||ml),straight:Lo(e.bezier||qc),step:Lo(e.step||Qc),smoothstep:Lo(e.step||pl),simplebezier:Lo(e.simplebezier||Xc)},n={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,l)=>(i[l]=Lo(e[l]||ml),i),n);return{...t,...s}}function dm(e,t,n=null){const s=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,l=(n==null?void 0:n.width)||t.width,c=(n==null?void 0:n.height)||t.height;switch(e){case xe.Top:return{x:s+l/2,y:i};case xe.Right:return{x:s+l,y:i+c/2};case xe.Bottom:return{x:s+l/2,y:i+c};case xe.Left:return{x:s,y:i+c/2}}}function fm(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const XN=(e,t,n,s,i,l)=>{const c=dm(n,e,t),u=dm(l,s,i);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function QN({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:s,targetWidth:i,targetHeight:l,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+s,t.y+l)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const m=Gc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),y=Math.max(0,Math.min(m.x2,p.x2)-Math.max(m.x,p.x)),E=Math.max(0,Math.min(m.y2,p.y2)-Math.max(m.y,p.y));return Math.ceil(y*E)>0}function pm(e){var s,i,l,c,u;const t=((s=e==null?void 0:e[nt])==null?void 0:s.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((l=e==null?void 0:e.positionAbsolute)==null?void 0:l.y)<"u";return[{x:((c=e==null?void 0:e.positionAbsolute)==null?void 0:c.x)||0,y:((u=e==null?void 0:e.positionAbsolute)==null?void 0:u.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const qN=[{level:0,isMaxLevel:!0,edges:[]}];function JN(e,t,n=!1){let s=-1;const i=e.reduce((c,u)=>{var m,y;const f=Kt(u.zIndex);let p=f?u.zIndex:0;if(n){const E=t.get(u.target),x=t.get(u.source),_=u.selected||(E==null?void 0:E.selected)||(x==null?void 0:x.selected),w=Math.max(((m=x==null?void 0:x[nt])==null?void 0:m.z)||0,((y=E==null?void 0:E[nt])==null?void 0:y.z)||0,1e3);p=(f?u.zIndex:0)+(_?w:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),l=Object.entries(i).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return l.length===0?qN:l}function ZN(e,t,n){const s=Pe(b.useCallback(i=>e?i.edges.filter(l=>{const c=t.get(l.source),u=t.get(l.target);return(c==null?void 0:c.width)&&(c==null?void 0:c.height)&&(u==null?void 0:u.width)&&(u==null?void 0:u.height)&&QN({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return JN(s,t,n)}const eR=({color:e="none",strokeWidth:t=1})=>ne.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),tR=({color:e="none",strokeWidth:t=1})=>ne.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),hm={[js.Arrow]:eR,[js.ArrowClosed]:tR};function nR(e){const t=tt();return b.useMemo(()=>{var i,l;return Object.prototype.hasOwnProperty.call(hm,e)?hm[e]:((l=(i=t.getState()).onError)==null||l.call(i,"009",$n.error009(e)),null)},[e])}const rR=({id:e,type:t,color:n,width:s=12.5,height:i=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=nR(t);return f?ne.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0"},ne.createElement(f,{color:n,strokeWidth:c})):null},oR=({defaultColor:e,rfId:t})=>n=>{const s=[];return n.edges.reduce((i,l)=>([l.markerStart,l.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Zc(c,t);s.includes(u)||(i.push({id:u,color:c.color||e,...c}),s.push(u))}}),i),[]).sort((i,l)=>i.id.localeCompare(l.id))},mm=({defaultColor:e,rfId:t})=>{const n=Pe(b.useCallback(oR({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((l,c)=>l.id!==i[c].id)));return ne.createElement("defs",null,n.map(s=>ne.createElement(rR,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};mm.displayName="MarkerDefinitions";var sR=b.memo(mm);const iR=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),gm=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:s,edgeTypes:i,noPanClassName:l,onEdgeUpdate:c,onEdgeContextMenu:u,onEdgeMouseEnter:f,onEdgeMouseMove:p,onEdgeMouseLeave:m,onEdgeClick:y,edgeUpdaterRadius:E,onEdgeDoubleClick:x,onEdgeUpdateStart:_,onEdgeUpdateEnd:w,children:S})=>{const{edgesFocusable:N,edgesUpdatable:R,elementsSelectable:P,width:C,height:I,connectionMode:L,nodeInternals:U,onError:G}=Pe(iR,gt),X=ZN(t,U,n);return C?ne.createElement(ne.Fragment,null,X.map(({level:H,edges:q,isMaxLevel:ee})=>ne.createElement("svg",{key:H,style:{zIndex:H},width:C,height:I,className:"react-flow__edges react-flow__container"},ee&&ne.createElement(sR,{defaultColor:e,rfId:s}),ne.createElement("g",null,q.map(z=>{const[A,F,$]=pm(U.get(z.source)),[Y,M,V]=pm(U.get(z.target));if(!$||!V)return null;let B=z.type||"default";i[B]||(G==null||G("011",$n.error011(B)),B="default");const D=i[B]||i.default,Q=L===cr.Strict?M.target:(M.target??[]).concat(M.source??[]),oe=fm(F.source,z.sourceHandle),re=fm(Q,z.targetHandle),le=(oe==null?void 0:oe.position)||xe.Bottom,ue=(re==null?void 0:re.position)||xe.Top,fe=!!(z.focusable||N&&typeof z.focusable>"u"),de=typeof c<"u"&&(z.updatable||R&&typeof z.updatable>"u");if(!oe||!re)return G==null||G("008",$n.error008(oe,z)),null;const{sourceX:me,sourceY:Re,targetX:Me,targetY:Ze}=XN(A,oe,le,Y,re,ue);return ne.createElement(D,{key:z.id,id:z.id,className:St([z.className,l]),type:B,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:me,sourceY:Re,targetX:Me,targetY:Ze,sourcePosition:le,targetPosition:ue,elementsSelectable:P,onEdgeUpdate:c,onContextMenu:u,onMouseEnter:f,onMouseMove:p,onMouseLeave:m,onClick:y,edgeUpdaterRadius:E,onEdgeDoubleClick:x,onEdgeUpdateStart:_,onEdgeUpdateEnd:w,rfId:s,ariaLabel:z.ariaLabel,isFocusable:fe,isUpdatable:de,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth})})))),S):null};gm.displayName="EdgeRenderer";var lR=b.memo(gm);const aR=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function cR({children:e}){const t=Pe(aR);return ne.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function uR(e){const t=lu(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const dR={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},ym=({nodeId:e,handleType:t,style:n,type:s=ur.Bezier,CustomComponent:i,connectionStatus:l})=>{var L,U,G;const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:m}=Pe(b.useCallback(X=>({fromNode:X.nodeInternals.get(e),handleId:X.connectionHandleId,toX:(X.connectionPosition.x-X.transform[0])/X.transform[2],toY:(X.connectionPosition.y-X.transform[1])/X.transform[2],connectionMode:X.connectionMode}),[e]),gt),y=(L=c==null?void 0:c[nt])==null?void 0:L.handleBounds;let E=y==null?void 0:y[t];if(m===cr.Loose&&(E=E||(y==null?void 0:y[t==="source"?"target":"source"])),!c||!E)return null;const x=u?E.find(X=>X.id===u):E[0],_=x?x.x+x.width/2:(c.width??0)/2,w=x?x.y+x.height/2:c.height??0,S=(((U=c.positionAbsolute)==null?void 0:U.x)??0)+_,N=(((G=c.positionAbsolute)==null?void 0:G.y)??0)+w,R=x==null?void 0:x.position,P=R?dR[R]:null;if(!R||!P)return null;if(i)return ne.createElement(i,{connectionLineType:s,connectionLineStyle:n,fromNode:c,fromHandle:x,fromX:S,fromY:N,toX:f,toY:p,fromPosition:R,toPosition:P,connectionStatus:l});let C="";const I={sourceX:S,sourceY:N,sourcePosition:R,targetX:f,targetY:p,targetPosition:P};return s===ur.Bezier?[C]=_h(I):s===ur.Step?[C]=Us({...I,borderRadius:0}):s===ur.SmoothStep?[C]=Us(I):s===ur.SimpleBezier?[C]=Eh(I):C=`M${S},${N} ${f},${p}`,ne.createElement("path",{d:C,fill:"none",className:"react-flow__connection-path",style:n})};ym.displayName="ConnectionLine";const fR=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function pR({containerStyle:e,style:t,type:n,component:s}){const{nodeId:i,handleType:l,nodesConnectable:c,width:u,height:f,connectionStatus:p}=Pe(fR,gt);return!(i&&l&&u&&c)?null:ne.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},ne.createElement("g",{className:St(["react-flow__connection",p])},ne.createElement(ym,{nodeId:i,handleType:l,style:t,type:n,CustomComponent:s,connectionStatus:p})))}function Em(e,t){return b.useRef(null),tt(),b.useMemo(()=>t(e),[e])}const vm=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:s,onMoveEnd:i,onInit:l,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:m,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:x,onSelectionContextMenu:_,onSelectionStart:w,onSelectionEnd:S,connectionLineType:N,connectionLineStyle:R,connectionLineComponent:P,connectionLineContainerStyle:C,selectionKeyCode:I,selectionOnDrag:L,selectionMode:U,multiSelectionKeyCode:G,panActivationKeyCode:X,zoomActivationKeyCode:H,deleteKeyCode:q,onlyRenderVisibleElements:ee,elementsSelectable:z,selectNodesOnDrag:A,defaultViewport:F,translateExtent:$,minZoom:Y,maxZoom:M,preventScrolling:V,defaultMarkerColor:B,zoomOnScroll:D,zoomOnPinch:Q,panOnScroll:oe,panOnScrollSpeed:re,panOnScrollMode:le,zoomOnDoubleClick:ue,panOnDrag:fe,onPaneClick:de,onPaneMouseEnter:me,onPaneMouseMove:Re,onPaneMouseLeave:Me,onPaneScroll:Ze,onPaneContextMenu:wt,onEdgeUpdate:Be,onEdgeContextMenu:je,onEdgeMouseEnter:ft,onEdgeMouseMove:pt,onEdgeMouseLeave:we,edgeUpdaterRadius:un,onEdgeUpdateStart:Bt,onEdgeUpdateEnd:qt,noDragClassName:Cn,noWheelClassName:An,noPanClassName:dn,elevateEdgesOnSelect:Wn,disableKeyboardA11y:fn,nodeOrigin:pn,nodeExtent:In,rfId:Gn})=>{const Ke=Em(e,$N),ot=Em(t,KN);return uR(l),ne.createElement(FN,{onPaneClick:de,onPaneMouseEnter:me,onPaneMouseMove:Re,onPaneMouseLeave:Me,onPaneContextMenu:wt,onPaneScroll:Ze,deleteKeyCode:q,selectionKeyCode:I,selectionOnDrag:L,selectionMode:U,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:G,panActivationKeyCode:X,zoomActivationKeyCode:H,elementsSelectable:z,onMove:n,onMoveStart:s,onMoveEnd:i,zoomOnScroll:D,zoomOnPinch:Q,zoomOnDoubleClick:ue,panOnScroll:oe,panOnScrollSpeed:re,panOnScrollMode:le,panOnDrag:fe,defaultViewport:F,translateExtent:$,minZoom:Y,maxZoom:M,onSelectionContextMenu:_,preventScrolling:V,noDragClassName:Cn,noWheelClassName:An,noPanClassName:dn,disableKeyboardA11y:fn},ne.createElement(cR,null,ne.createElement(lR,{edgeTypes:ot,onEdgeClick:u,onEdgeDoubleClick:p,onEdgeUpdate:Be,onlyRenderVisibleElements:ee,onEdgeContextMenu:je,onEdgeMouseEnter:ft,onEdgeMouseMove:pt,onEdgeMouseLeave:we,onEdgeUpdateStart:Bt,onEdgeUpdateEnd:qt,edgeUpdaterRadius:un,defaultMarkerColor:B,noPanClassName:dn,elevateEdgesOnSelect:!!Wn,disableKeyboardA11y:fn,rfId:Gn},ne.createElement(pR,{style:R,type:N,component:P,containerStyle:C})),ne.createElement("div",{className:"react-flow__edgelabel-renderer"}),ne.createElement(zN,{nodeTypes:Ke,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:m,onNodeMouseMove:y,onNodeMouseLeave:E,onNodeContextMenu:x,selectNodesOnDrag:A,onlyRenderVisibleElements:ee,noPanClassName:dn,noDragClassName:Cn,disableKeyboardA11y:fn,nodeOrigin:pn,nodeExtent:In,rfId:Gn})))};vm.displayName="GraphView";var hR=b.memo(vm);const pu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],fr={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:pu,nodeExtent:pu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:cr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Bw,isValidConnection:void 0},mR=()=>nx((e,t)=>({...fr,setNodes:n=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:l}=t();e({nodeInternals:iu(n,s,i,l)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:s={}}=t();e({edges:n.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(n,s)=>{const i=typeof n<"u",l=typeof s<"u",c=i?iu(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:l?s:[],hasDefaultNodes:i,hasDefaultEdges:l})},updateNodeDimensions:n=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:l,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),m=f==null?void 0:f.querySelector(".react-flow__viewport");if(!m)return;const y=window.getComputedStyle(m),{m22:E}=new window.DOMMatrixReadOnly(y.transform),x=n.reduce((w,S)=>{const N=i.get(S.id);if(N){const R=zc(S.nodeElement);!!(R.width&&R.height&&(N.width!==R.width||N.height!==R.height||S.forceUpdate))&&(i.set(N.id,{...N,[nt]:{...N[nt],handleBounds:{source:om(".source",S.nodeElement,E,p),target:om(".target",S.nodeElement,E,p)}},...R}),w.push({id:N.id,type:"dimensions",dimensions:R}))}return w},[]);Yh(i,p);const _=c||l&&!c&&Kh(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),(x==null?void 0:x.length)>0&&(s==null||s(x))},updateNodePositions:(n,s=!0,i=!1)=>{const{triggerNodeChanges:l}=t(),c=n.map(u=>{const f={id:u.id,type:"position",dragging:i};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});l(c)},triggerNodeChanges:n=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:l,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(n!=null&&n.length){if(l){const p=Zh(n,u()),m=iu(p,i,c,f);e({nodeInternals:m})}s==null||s(n)}},addSelectedNodes:n=>{const{multiSelectionActive:s,edges:i,getNodes:l}=t();let c,u=null;s?c=n.map(f=>dr(f,!0)):(c=Io(l(),n),u=Io(i,[])),yl({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:s,edges:i,getNodes:l}=t();let c,u=null;s?c=n.map(f=>dr(f,!0)):(c=Io(i,n),u=Io(l(),[])),yl({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:s}={})=>{const{edges:i,getNodes:l}=t(),c=n||l(),u=s||i,f=c.map(m=>(m.selected=!1,dr(m.id,!1))),p=u.map(m=>dr(m.id,!1));yl({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:s,maxZoom:i}=t();s==null||s.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:s,minZoom:i}=t();s==null||s.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var s;(s=t().d3Zoom)==null||s.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:s}=t(),l=s().filter(u=>u.selected).map(u=>dr(u.id,!1)),c=n.filter(u=>u.selected).map(u=>dr(u.id,!1));yl({changedNodes:l,changedEdges:c,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=Wc(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(s)})},panBy:n=>{const{transform:s,width:i,height:l,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!n.x&&!n.y)return!1;const p=lr.translate(s[0]+n.x,s[1]+n.y).scale(s[2]),m=[[0,0],[i,l]],y=c==null?void 0:c.constrain()(p,m,f);return c.transform(u,y),s[0]!==y.x||s[1]!==y.y||s[2]!==y.k},cancelConnection:()=>e({connectionNodeId:fr.connectionNodeId,connectionHandleId:fr.connectionHandleId,connectionHandleType:fr.connectionHandleType,connectionStatus:fr.connectionStatus,connectionStartHandle:fr.connectionStartHandle,connectionEndHandle:fr.connectionEndHandle}),reset:()=>e({...fr})}),Object.is),hu=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=mR()),ne.createElement(Pw,{value:t.current},e)};hu.displayName="ReactFlowProvider";const xm=({children:e})=>b.useContext(dl)?ne.createElement(ne.Fragment,null,e):ne.createElement(hu,null,e);xm.displayName="ReactFlowWrapper";const gR={input:jh,default:ou,output:Fh,group:su},yR={default:ml,straight:qc,step:Qc,smoothstep:pl,simplebezier:Xc},ER=[0,0],vR=[15,15],xR={x:0,y:0,zoom:1},SR={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Sm=b.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:s,className:i,nodeTypes:l=gR,edgeTypes:c=yR,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:m,onMoveStart:y,onMoveEnd:E,onConnect:x,onConnectStart:_,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,onNodeMouseEnter:R,onNodeMouseMove:P,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:L,onNodeDragStart:U,onNodeDrag:G,onNodeDragStop:X,onNodesDelete:H,onEdgesDelete:q,onSelectionChange:ee,onSelectionDragStart:z,onSelectionDrag:A,onSelectionDragStop:F,onSelectionContextMenu:$,onSelectionStart:Y,onSelectionEnd:M,connectionMode:V=cr.Strict,connectionLineType:B=ur.Bezier,connectionLineStyle:D,connectionLineComponent:Q,connectionLineContainerStyle:oe,deleteKeyCode:re="Backspace",selectionKeyCode:le="Shift",selectionOnDrag:ue=!1,selectionMode:fe=Ms.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:me=fl()?"Meta":"Control",zoomActivationKeyCode:Re=fl()?"Meta":"Control",snapToGrid:Me=!1,snapGrid:Ze=vR,onlyRenderVisibleElements:wt=!1,selectNodesOnDrag:Be=!0,nodesDraggable:je,nodesConnectable:ft,nodesFocusable:pt,nodeOrigin:we=ER,edgesFocusable:un,edgesUpdatable:Bt,elementsSelectable:qt,defaultViewport:Cn=xR,minZoom:An=.5,maxZoom:dn=2,translateExtent:Wn=pu,preventScrolling:fn=!0,nodeExtent:pn,defaultMarkerColor:In="#b1b1b7",zoomOnScroll:Gn=!0,zoomOnPinch:Ke=!0,panOnScroll:ot=!1,panOnScrollSpeed:Yn=.5,panOnScrollMode:bn=Hr.Free,zoomOnDoubleClick:Ln=!0,panOnDrag:hn=!0,onPaneClick:Lt,onPaneMouseEnter:Kn,onPaneMouseMove:qr,onPaneMouseLeave:Xn,onPaneScroll:Jr,onPaneContextMenu:Qn,children:Dt,onEdgeUpdate:zl,onEdgeContextMenu:Wl,onEdgeDoubleClick:Gl,onEdgeMouseEnter:Yl,onEdgeMouseMove:Kl,onEdgeMouseLeave:oi,onEdgeUpdateStart:Xl,onEdgeUpdateEnd:Zr,edgeUpdaterRadius:si=10,onNodesChange:eo,onEdgesChange:sd,noDragClassName:to="nodrag",noWheelClassName:Xo="nowheel",noPanClassName:no="nopan",fitView:ii=!1,fitViewOptions:id,connectOnClick:ld=!0,attributionPosition:ad,proOptions:qn,defaultEdgeOptions:Ql,elevateNodesOnSelect:ql=!0,elevateEdgesOnSelect:cd=!1,disableKeyboardA11y:li=!1,autoPanOnConnect:Jl=!0,autoPanOnNodeDrag:Zl=!0,connectionRadius:ea=20,isValidConnection:ud,onError:dd,style:We,id:ta,nodeDragThreshold:ai,...na},Qo)=>{const ci=ta||"1";return ne.createElement("div",{...na,style:{...We,...SR},ref:Qo,className:St(["react-flow",i]),"data-testid":"rf__wrapper",id:ta},ne.createElement(xm,null,ne.createElement(hR,{onInit:p,onMove:m,onMoveStart:y,onMoveEnd:E,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:R,onNodeMouseMove:P,onNodeMouseLeave:C,onNodeContextMenu:I,onNodeDoubleClick:L,nodeTypes:l,edgeTypes:c,connectionLineType:B,connectionLineStyle:D,connectionLineComponent:Q,connectionLineContainerStyle:oe,selectionKeyCode:le,selectionOnDrag:ue,selectionMode:fe,deleteKeyCode:re,multiSelectionKeyCode:me,panActivationKeyCode:de,zoomActivationKeyCode:Re,onlyRenderVisibleElements:wt,selectNodesOnDrag:Be,defaultViewport:Cn,translateExtent:Wn,minZoom:An,maxZoom:dn,preventScrolling:fn,zoomOnScroll:Gn,zoomOnPinch:Ke,zoomOnDoubleClick:Ln,panOnScroll:ot,panOnScrollSpeed:Yn,panOnScrollMode:bn,panOnDrag:hn,onPaneClick:Lt,onPaneMouseEnter:Kn,onPaneMouseMove:qr,onPaneMouseLeave:Xn,onPaneScroll:Jr,onPaneContextMenu:Qn,onSelectionContextMenu:$,onSelectionStart:Y,onSelectionEnd:M,onEdgeUpdate:zl,onEdgeContextMenu:Wl,onEdgeDoubleClick:Gl,onEdgeMouseEnter:Yl,onEdgeMouseMove:Kl,onEdgeMouseLeave:oi,onEdgeUpdateStart:Xl,onEdgeUpdateEnd:Zr,edgeUpdaterRadius:si,defaultMarkerColor:In,noDragClassName:to,noWheelClassName:Xo,noPanClassName:no,elevateEdgesOnSelect:cd,rfId:ci,disableKeyboardA11y:li,nodeOrigin:we,nodeExtent:pn}),ne.createElement(dN,{nodes:e,edges:t,defaultNodes:n,defaultEdges:s,onConnect:x,onConnectStart:_,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,nodesDraggable:je,nodesConnectable:ft,nodesFocusable:pt,edgesFocusable:un,edgesUpdatable:Bt,elementsSelectable:qt,elevateNodesOnSelect:ql,minZoom:An,maxZoom:dn,nodeExtent:pn,onNodesChange:eo,onEdgesChange:sd,snapToGrid:Me,snapGrid:Ze,connectionMode:V,translateExtent:Wn,connectOnClick:ld,defaultEdgeOptions:Ql,fitView:ii,fitViewOptions:id,onNodesDelete:H,onEdgesDelete:q,onNodeDragStart:U,onNodeDrag:G,onNodeDragStop:X,onSelectionDrag:A,onSelectionDragStart:z,onSelectionDragStop:F,noPanClassName:no,nodeOrigin:we,rfId:ci,autoPanOnConnect:Jl,autoPanOnNodeDrag:Zl,onError:dd,connectionRadius:ea,isValidConnection:ud,nodeDragThreshold:ai}),ne.createElement(cN,{onSelectionChange:ee}),Dt,ne.createElement(jw,{proOptions:qn,position:ad}),ne.createElement(gN,{rfId:ci,disableKeyboardA11y:li})))});Sm.displayName="ReactFlow";const _R=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function wR({children:e}){const t=Pe(_R);return t?Bc.createPortal(e,t):null}function NR(){const e=tt();return b.useCallback(t=>{const{domNode:n,updateNodeDimensions:s}=e.getState(),l=(Array.isArray(t)?t:[t]).reduce((c,u)=>{const f=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${u}"]`);return f&&c.push({id:u,nodeElement:f,forceUpdate:!0}),c},[]);requestAnimationFrame(()=>s(l))},[])}function RR({onStart:e,onChange:t,onEnd:n}){const s=tt();b.useEffect(()=>{s.setState({onViewportChangeStart:e})},[e]),b.useEffect(()=>{s.setState({onViewportChange:t})},[t]),b.useEffect(()=>{s.setState({onViewportChangeEnd:n})},[n])}const TR=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(n=>e.includeHiddenNodes?!0:!n.hidden).every(n=>{var s;return((s=n[nt])==null?void 0:s.handleBounds)!==void 0}),OR={includeHiddenNodes:!1};function CR(e=OR){return Pe(TR(e))}function AR(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ne.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function IR(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ne.createElement("path",{d:"M0 0h32v4.2H0z"}))}function bR(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ne.createElement("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 LR(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ne.createElement("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 DR(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},ne.createElement("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"}))}const $s=({children:e,className:t,...n})=>ne.createElement("button",{type:"button",className:St(["react-flow__controls-button",t]),...n},e);$s.displayName="ControlButton";const kR=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),_m=({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:m,position:y="bottom-left"})=>{const E=tt(),[x,_]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:N}=Pe(kR,gt),{zoomIn:R,zoomOut:P,fitView:C}=lu();if(b.useEffect(()=>{_(!0)},[]),!x)return null;const I=()=>{R(),l==null||l()},L=()=>{P(),c==null||c()},U=()=>{C(i),u==null||u()},G=()=>{E.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),f==null||f(!w)};return ne.createElement(ks,{className:St(["react-flow__controls",p]),position:y,style:e,"data-testid":"rf__controls"},t&&ne.createElement(ne.Fragment,null,ne.createElement($s,{onClick:I,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N},ne.createElement(AR,null)),ne.createElement($s,{onClick:L,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ne.createElement(IR,null))),n&&ne.createElement($s,{className:"react-flow__controls-fitview",onClick:U,title:"fit view","aria-label":"fit view"},ne.createElement(bR,null)),s&&ne.createElement($s,{className:"react-flow__controls-interactive",onClick:G,title:"toggle interactivity","aria-label":"toggle interactivity"},w?ne.createElement(DR,null):ne.createElement(LR,null)),m)};_m.displayName="Controls";var PR=b.memo(_m),Xt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Xt||(Xt={}));function MR({color:e,dimensions:t,lineWidth:n}){return ne.createElement("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function jR({color:e,radius:t}){return ne.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const UR={[Xt.Dots]:"#91919a",[Xt.Lines]:"#eee",[Xt.Cross]:"#e2e2e2"},FR={[Xt.Dots]:1,[Xt.Lines]:1,[Xt.Cross]:6},VR=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function wm({id:e,variant:t=Xt.Dots,gap:n=20,size:s,lineWidth:i=1,offset:l=2,color:c,style:u,className:f}){const p=b.useRef(null),{transform:m,patternId:y}=Pe(VR,gt),E=c||UR[t],x=s||FR[t],_=t===Xt.Dots,w=t===Xt.Cross,S=Array.isArray(n)?n:[n,n],N=[S[0]*m[2]||1,S[1]*m[2]||1],R=x*m[2],P=w?[R,R]:N,C=_?[R/l,R/l]:[P[0]/l,P[1]/l];return ne.createElement("svg",{className:St(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},ne.createElement("pattern",{id:y+e,x:m[0]%N[0],y:m[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`},_?ne.createElement(jR,{color:E,radius:R/l}):ne.createElement(MR,{dimensions:P,color:E,lineWidth:i})),ne.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${y+e})`}))}wm.displayName="Background";var $R=b.memo(wm);const Nm={},{useDebugValue:HR}=ne,{useSyncExternalStoreWithSelector:BR}=fp;let Rm=!1;function zR(e,t=e.getState,n){(Nm?"staging":void 0)!=="production"&&n&&!Rm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Rm=!0);const s=BR(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return HR(s),s}const Tm=e=>{(Nm?"staging":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?hp(e):e,n=(s,i)=>zR(t,s,i);return Object.assign(n,t),n},Do=e=>e?Tm(e):Tm,WR=!1,GR="staging",YR="0.0.13",Hs="0.0.10",Om=230,KR=640,Cm=20,ko={markerEnd:{height:20,type:js.ArrowClosed,width:20},style:{stroke:"inherit",strokeWidth:1.5},type:"floating"},XR="422",QR="404",Am="document-sync",mu=1e3,qR=1e3,JR=300,ZR=5e3,Im=300,e1="Shift+Backspace",t1="Meta",n1="Shift",vl=25,gu={duration:mu,includeHiddenNodes:!1,padding:.3},yu=()=>{const e={},t=document.querySelector('meta[name="csrf-token"]');return t&&(e["X-CSRF-Token"]=t==null?void 0:t.content),e},r1=(e,t)=>{var l;const n=new Blob([JSON.stringify({edges:t,nodes:e},null,2)],{type:"application/json"}),s=window.URL.createObjectURL(n),i=window.open();(l=i==null?void 0:i.location)!=null&&l.href&&(i.location.href=s)},bm=e=>({...e,...ko}),Lm=e=>e.type==="handleCall"?{...e,deletable:!1}:e,Dm=e=>e==="success"?"positive":"negative",o1=e=>e.toLowerCase().replace(/ /g,"-"),Vt=e=>typeof e=="string"?e.trim():e,km=(e,t,n)=>e.sort((s,i)=>{const l=s[n],c=i[n];if(typeof l=="string"&&typeof c=="string")return l.toLowerCase().localeCompare(c.toLowerCase());if(typeof l=="number"&&typeof c=="number")return l-c;throw new Error(`sort fn can only sort strings & numbers, but got ${typeof l} and ${typeof c}`)}),s1=e=>{try{return new URL(e).pathname.split("/").at(-1)}catch{return""}};function Pm(e,t){const n=[{divisor:1,threshold:60,unit:"second"},{divisor:60,threshold:3600,unit:"minute"},{divisor:3600,threshold:86400,unit:"hour"},{divisor:86400,threshold:86400,unit:"day"}],s=new Intl.RelativeTimeFormat(e,{numeric:"always",...t});return function(l,c={}){const{excludeUnits:u={}}=c,f=new Date().getTime(),p=new Date(l).getTime(),m=Math.floor((f-p)/1e3),y=n.filter(({unit:w})=>!u[w]),{divisor:E,unit:x}=y.find(({threshold:w})=>Math.abs(m)<w)??y[y.length-1],_=Math.floor(m/E);return s.format(-_,x)}}function Mm(e){return new Promise(t=>setTimeout(t,e))}const i1=(e,t,n)=>{const s=e==="ArrowDown";if(!t)return s?n[0]:n[n.length-1];const i=n.findIndex(u=>u.id===t),l=s?i+1:i-1;if(l<0||l>=n.length)return;const c=n[l];if(!c)throw new Error(`Could not find option at index ${l}`);return c},jm=(e,t,n)=>{const s=e.find(i=>{if(t in i)return i[t]===n});if(!s)throw new Error(`Could not find option with id ${t}`);return s},l1=e=>Object.keys(e),Eu=()=>({callOrder:"single",callStateEvents:"",callStateUrl:"",connections:[{connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:Le()}],defaultFrom:"",defaultTimeout:"",destinationType:"phone",options:[{id:Le(),result:"success"},{id:Le(),result:"noAnswer"},{id:Le(),result:"busy"},{id:Le(),result:"decline"},{id:Le(),result:"error"}]}),Um={aiAgent:()=>({agent:""}),answer:()=>({valid:!0}),cond:()=>({fallback:Le(),options:[{id:Le(),value:""}]}),condRequest:()=>({body:"",error:Le(),fallback:Le(),headers:"",method:"POST",options:[{id:Le(),value:""}],url:""}),executeSWML:()=>({dest:"",fallback:Le(),meta:"",options:[{id:Le(),value:""}],params:""}),forwardAddress:()=>({...Eu(),destinationType:"address"}),forwardPhone:()=>({...Eu(),destinationType:"phone"}),forwardResource:()=>({...Eu(),destinationType:"resource"}),handleCall:()=>({valid:!0}),hangup:()=>({valid:!0}),play:()=>({selected:"",text:"",url:""}),promptPlay:()=>({digitTimeout:"",initialTimeout:"",options:[{command:"",digit:"",id:Le()}],results:[{id:Le(),result:"no_match"},{id:Le(),result:"no_input"}],selected:"",text:"",url:""}),record:()=>({beep:!1,endSilenceTimeout:"",format:"wav",initialTimeout:"",maxLength:"",stereo:!1,terminators:"",valid:!0}),recordCallStart:()=>({beep:!1,controlId:Le(),format:"wav",label:"",stereo:!1,terminators:""}),recordCallStop:()=>({controlId:""}),request:()=>({body:"",headers:"",method:"POST",options:[{id:Le(),result:"success"},{id:Le(),result:"failed"}],url:""}),sendSms:()=>({body:"",fromNumber:"",media:[],region:"",tags:[],toNumber:""}),set:()=>({variables:[{duplicate:!1,id:Le(),key:"",value:""}]}),unset:()=>({variables:[]})},a1={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class xl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||a1,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,s,i){return i&&!this.debug?null:(typeof t[0]=="string"&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new xl(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new xl(this.logger,t)}}var Rn=new xl;class Sl{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(s=>{this.observers[s]=this.observers[s]||[],this.observers[s].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(s=>s!==n)}}emit(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),i=1;i<n;i++)s[i-1]=arguments[i];this.observers[t]&&[].concat(this.observers[t]).forEach(c=>{c(...s)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(c=>{c.apply(c,[t,...s])})}}function Bs(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});return n.resolve=e,n.reject=t,n}function Fm(e){return e==null?"":""+e}function c1(e,t,n){e.forEach(s=>{t[s]&&(n[s]=t[s])})}function vu(e,t,n){function s(c){return c&&c.indexOf("###")>-1?c.replace(/###/g,"."):c}function i(){return!e||typeof e=="string"}const l=typeof t!="string"?[].concat(t):t.split(".");for(;l.length>1;){if(i())return{};const c=s(l.shift());!e[c]&&n&&(e[c]=new n),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={}}return i()?{}:{obj:e,k:s(l.shift())}}function Vm(e,t,n){const{obj:s,k:i}=vu(e,t,Object);s[i]=n}function u1(e,t,n,s){const{obj:i,k:l}=vu(e,t,Object);i[l]=i[l]||[],i[l].push(n)}function _l(e,t){const{obj:n,k:s}=vu(e,t);if(n)return n[s]}function d1(e,t,n){const s=_l(e,n);return s!==void 0?s:_l(t,n)}function $m(e,t,n){for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?typeof e[s]=="string"||e[s]instanceof String||typeof t[s]=="string"||t[s]instanceof String?n&&(e[s]=t[s]):$m(e[s],t[s],n):e[s]=t[s]);return e}function Po(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var f1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function p1(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>f1[t]):e}const h1=[" ",",","?","!",";"];function m1(e,t,n){t=t||"",n=n||"";const s=h1.filter(c=>t.indexOf(c)<0&&n.indexOf(c)<0);if(s.length===0)return!0;const i=new RegExp(`(${s.map(c=>c==="?"?"\\?":c).join("|")})`);let l=!i.test(e);if(!l){const c=e.indexOf(n);c>0&&!i.test(e.substring(0,c))&&(l=!0)}return l}function wl(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const s=t.split(n);let i=e;for(let l=0;l<s.length;++l){if(!i||typeof i[s[l]]=="string"&&l+1<s.length)return;if(i[s[l]]===void 0){let c=2,u=s.slice(l,l+c).join(n),f=i[u];for(;f===void 0&&s.length>l+c;)c++,u=s.slice(l,l+c).join(n),f=i[u];if(f===void 0)return;if(f===null)return null;if(t.endsWith(u)){if(typeof f=="string")return f;if(u&&typeof f[u]=="string")return f[u]}const p=s.slice(l+c).join(n);return p?wl(f,p,n):void 0}i=i[s[l]]}return i}function Nl(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Hm extends Sl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const l=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let u=[t,n];s&&typeof s!="string"&&(u=u.concat(s)),s&&typeof s=="string"&&(u=u.concat(l?s.split(l):s)),t.indexOf(".")>-1&&(u=t.split("."));const f=_l(this.data,u);return f||!c||typeof s!="string"?f:wl(this.data&&this.data[t]&&this.data[t][n],s,l)}addResource(t,n,s,i){let l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator;let u=[t,n];s&&(u=u.concat(c?s.split(c):s)),t.indexOf(".")>-1&&(u=t.split("."),i=n,n=u[1]),this.addNamespaces(n),Vm(this.data,u,i),l.silent||this.emit("added",t,n,s,i)}addResources(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const l in s)(typeof s[l]=="string"||Object.prototype.toString.apply(s[l])==="[object Array]")&&this.addResource(t,n,l,s[l],{silent:!0});i.silent||this.emit("added",t,n,s)}addResourceBundle(t,n,s,i,l){let c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},u=[t,n];t.indexOf(".")>-1&&(u=t.split("."),i=s,s=n,n=u[1]),this.addNamespaces(n);let f=_l(this.data,u)||{};i?$m(f,s,l):f={...f,...s},Vm(this.data,u,f),c.silent||this.emit("added",t,n,s)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var Bm={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,s,i){return e.forEach(l=>{this.processors[l]&&(t=this.processors[l].process(t,n,s,i))}),t}};const zm={};class Rl extends Sl{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),c1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Rn.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const s=this.resolve(t,n);return s&&s.res!==void 0}extractFromKey(t,n){let s=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let l=n.ns||this.options.defaultNS||[];const c=s&&t.indexOf(s)>-1,u=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!m1(t,s,i);if(c&&!u){const f=t.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:t,namespaces:l};const p=t.split(s);(s!==i||s===i&&this.options.ns.indexOf(p[0])>-1)&&(l=p.shift()),t=p.join(i)}return typeof l=="string"&&(l=[l]),{key:t,namespaces:l}}translate(t,n,s){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,l=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:c,namespaces:u}=this.extractFromKey(t[t.length-1],n),f=u[u.length-1],p=n.lng||this.language,m=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(m){const C=n.nsSeparator||this.options.nsSeparator;return i?{res:`${f}${C}${c}`,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:f,usedParams:this.getUsedParamsDetails(n)}:`${f}${C}${c}`}return i?{res:c,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:f,usedParams:this.getUsedParamsDetails(n)}:c}const y=this.resolve(t,n);let E=y&&y.res;const x=y&&y.usedKey||c,_=y&&y.exactUsedKey||c,w=Object.prototype.toString.apply(E),S=["[object Number]","[object Function]","[object RegExp]"],N=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,R=!this.i18nFormat||this.i18nFormat.handleAsObject;if(R&&E&&(typeof E!="string"&&typeof E!="boolean"&&typeof E!="number")&&S.indexOf(w)<0&&!(typeof N=="string"&&w==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,E,{...n,ns:u}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(y.res=C,y.usedParams=this.getUsedParamsDetails(n),y):C}if(l){const C=w==="[object Array]",I=C?[]:{},L=C?_:x;for(const U in E)if(Object.prototype.hasOwnProperty.call(E,U)){const G=`${L}${l}${U}`;I[U]=this.translate(G,{...n,joinArrays:!1,ns:u}),I[U]===G&&(I[U]=E[U])}E=I}}else if(R&&typeof N=="string"&&w==="[object Array]")E=E.join(N),E&&(E=this.extendTranslation(E,t,n,s));else{let C=!1,I=!1;const L=n.count!==void 0&&typeof n.count!="string",U=Rl.hasDefaultValue(n),G=L?this.pluralResolver.getSuffix(p,n.count,n):"",X=n.ordinal&&L?this.pluralResolver.getSuffix(p,n.count,{ordinal:!1}):"",H=n[`defaultValue${G}`]||n[`defaultValue${X}`]||n.defaultValue;!this.isValidLookup(E)&&U&&(C=!0,E=H),this.isValidLookup(E)||(I=!0,E=c);const ee=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&I?void 0:E,z=U&&H!==E&&this.options.updateMissing;if(I||C||z){if(this.logger.log(z?"updateKey":"missingKey",p,f,c,z?H:E),l){const Y=this.resolve(c,{...n,keySeparator:!1});Y&&Y.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 A=[];const F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&F&&F[0])for(let Y=0;Y<F.length;Y++)A.push(F[Y]);else this.options.saveMissingTo==="all"?A=this.languageUtils.toResolveHierarchy(n.lng||this.language):A.push(n.lng||this.language);const $=(Y,M,V)=>{const B=U&&V!==E?V:ee;this.options.missingKeyHandler?this.options.missingKeyHandler(Y,f,M,B,z,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(Y,f,M,B,z,n),this.emit("missingKey",Y,f,M,E)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?A.forEach(Y=>{this.pluralResolver.getSuffixes(Y,n).forEach(M=>{$([Y],c+M,n[`defaultValue${M}`]||H)})}):$(A,c,H))}E=this.extendTranslation(E,t,n,y,s),I&&E===c&&this.options.appendNamespaceToMissingKey&&(E=`${f}:${c}`),(I||C)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?E=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}:${c}`:c,C?E:void 0):E=this.options.parseMissingKeyHandler(E))}return i?(y.res=E,y.usedParams=this.getUsedParamsDetails(n),y):E}extendTranslation(t,n,s,i,l){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const p=typeof t=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(p){const E=t.match(this.interpolator.nestingRegexp);m=E&&E.length}let y=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(y={...this.options.interpolation.defaultVariables,...y}),t=this.interpolator.interpolate(t,y,s.lng||this.language,s),p){const E=t.match(this.interpolator.nestingRegexp),x=E&&E.length;m<x&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(s.lng=i.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var E=arguments.length,x=new Array(E),_=0;_<E;_++)x[_]=arguments[_];return l&&l[0]===x[0]&&!s.context?(c.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${n[0]}`),null):c.translate(...x,n)},s)),s.interpolation&&this.interpolator.reset()}const u=s.postProcess||this.options.postProcess,f=typeof u=="string"?[u]:u;return t!=null&&f&&f.length&&s.applyPostProcessor!==!1&&(t=Bm.handle(f,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,i,l,c,u;return typeof t=="string"&&(t=[t]),t.forEach(f=>{if(this.isValidLookup(s))return;const p=this.extractFromKey(f,n),m=p.key;i=m;let y=p.namespaces;this.options.fallbackNS&&(y=y.concat(this.options.fallbackNS));const E=n.count!==void 0&&typeof n.count!="string",x=E&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),_=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);y.forEach(S=>{this.isValidLookup(s)||(u=S,!zm[`${w[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(u)&&(zm[`${w[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${w.join(", ")}" won't get resolved as namespace "${u}" 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!!!")),w.forEach(N=>{if(this.isValidLookup(s))return;c=N;const R=[m];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(R,m,N,S,n);else{let C;E&&(C=this.pluralResolver.getSuffix(N,n.count,n));const I=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(E&&(R.push(m+C),n.ordinal&&C.indexOf(L)===0&&R.push(m+C.replace(L,this.options.pluralSeparator)),x&&R.push(m+I)),_){const U=`${m}${this.options.contextSeparator}${n.context}`;R.push(U),E&&(R.push(U+C),n.ordinal&&C.indexOf(L)===0&&R.push(U+C.replace(L,this.options.pluralSeparator)),x&&R.push(U+I))}}let P;for(;P=R.pop();)this.isValidLookup(s)||(l=P,s=this.getResource(N,S,P,n))}))})}),{res:s,usedKey:i,exactUsedKey:l,usedLng:c,usedNS:u}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,s,i):this.resourceStore.getResource(t,n,s,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&typeof t.replace!="string";let i=s?t.replace:t;if(s&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const l of n)delete i[l]}return i}static hasDefaultValue(t){const n="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&n===s.substring(0,n.length)&&t[s]!==void 0)return!0;return!1}}function xu(e){return e.charAt(0).toUpperCase()+e.slice(1)}class Wm{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Rn.create("languageUtils")}getScriptPartFromCode(t){if(t=Nl(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Nl(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let s=t.split("-");return this.options.lowerCaseLng?s=s.map(i=>i.toLowerCase()):s.length===2?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),n.indexOf(s[1].toLowerCase())>-1&&(s[1]=xu(s[1].toLowerCase()))):s.length===3&&(s[0]=s[0].toLowerCase(),s[1].length===2&&(s[1]=s[1].toUpperCase()),s[0]!=="sgn"&&s[2].length===2&&(s[2]=s[2].toUpperCase()),n.indexOf(s[1].toLowerCase())>-1&&(s[1]=xu(s[1].toLowerCase())),n.indexOf(s[2].toLowerCase())>-1&&(s[2]=xu(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(s=>{if(n)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(s=>{if(n)return;const i=this.getLanguagePartFromCode(s);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(l=>{if(l===i)return l;if(!(l.indexOf("-")<0&&i.indexOf("-")<0)&&l.indexOf(i)===0)return l})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let s=t[n];return s||(s=t[this.getScriptPartFromCode(n)]),s||(s=t[this.formatLanguageCode(n)]),s||(s=t[this.getLanguagePartFromCode(n)]),s||(s=t.default),s||[]}toResolveHierarchy(t,n){const s=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],l=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&l(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&l(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&l(this.getLanguagePartFromCode(t))):typeof t=="string"&&l(this.formatLanguageCode(t)),s.forEach(c=>{i.indexOf(c)<0&&l(this.formatLanguageCode(c))}),i}}let g1=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],y1={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const E1=["v1","v2","v3"],v1=["v4"],Gm={zero:0,one:1,two:2,few:3,many:4,other:5};function x1(){const e={};return g1.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:y1[t.fc]}})}),e}class S1{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=Rn.create("pluralResolver"),(!this.options.compatibilityJSON||v1.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=x1()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Nl(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(t,n);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(t,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,s).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(t,n);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((i,l)=>Gm[i]-Gm[l]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):s.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,s);return i?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const s=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const l=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:l():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?l():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!E1.includes(this.options.compatibilityJSON)}}function Ym(e,t,n){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,l=d1(e,t,n);return!l&&i&&typeof n=="string"&&(l=wl(e,n,s),l===void 0&&(l=wl(t,n,s))),l}class _1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Rn.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:p1,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Po(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Po(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Po(n.nestingPrefix):n.nestingPrefixEscaped||Po("$t("),this.nestingSuffix=n.nestingSuffix?Po(n.nestingSuffix):n.nestingSuffixEscaped||Po(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const s=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(s,"g")}interpolate(t,n,s,i){let l,c,u;const f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(_){return _.replace(/\$/g,"$$$$")}const m=_=>{if(_.indexOf(this.formatSeparator)<0){const R=Ym(n,f,_,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,s,{...i,...n,interpolationkey:_}):R}const w=_.split(this.formatSeparator),S=w.shift().trim(),N=w.join(this.formatSeparator).trim();return this.format(Ym(n,f,S,this.options.keySeparator,this.options.ignoreJSONStructure),N,s,{...i,...n,interpolationkey:S})};this.resetRegExp();const y=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,E=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:_=>p(_)},{regex:this.regexp,safeValue:_=>this.escapeValue?p(this.escape(_)):p(_)}].forEach(_=>{for(u=0;l=_.regex.exec(t);){const w=l[1].trim();if(c=m(w),c===void 0)if(typeof y=="function"){const N=y(t,l,i);c=typeof N=="string"?N:""}else if(i&&Object.prototype.hasOwnProperty.call(i,w))c="";else if(E){c=l[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),c="";else typeof c!="string"&&!this.useRawValueToEscape&&(c=Fm(c));const S=_.safeValue(c);if(t=t.replace(l[0],S),E?(_.regex.lastIndex+=c.length,_.regex.lastIndex-=l[0].length):_.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),t}nest(t,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,l,c;function u(f,p){const m=this.nestingOptionsSeparator;if(f.indexOf(m)<0)return f;const y=f.split(new RegExp(`${m}[ ]*{`));let E=`{${y[1]}`;f=y[0],E=this.interpolate(E,c);const x=E.match(/'/g),_=E.match(/"/g);(x&&x.length%2===0&&!_||_.length%2!==0)&&(E=E.replace(/'/g,'"'));try{c=JSON.parse(E),p&&(c={...p,...c})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${f}`,w),`${f}${m}${E}`}return delete c.defaultValue,f}for(;i=this.nestingRegexp.exec(t);){let f=[];c={...s},c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;let p=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const m=i[1].split(this.formatSeparator).map(y=>y.trim());i[1]=m.shift(),f=m,p=!0}if(l=n(u.call(this,i[1].trim(),c),c),l&&i[0]===t&&typeof l!="string")return l;typeof l!="string"&&(l=Fm(l)),l||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),l=""),p&&(l=f.reduce((m,y)=>this.format(m,y,s.lng,{...s,interpolationkey:i[1].trim()}),l.trim())),t=t.replace(i[0],l),this.regexp.lastIndex=0}return t}}function w1(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const s=e.split("(");t=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(c=>{if(!c)return;const[u,...f]=c.split(":"),p=f.join(":").trim().replace(/^'+|'+$/g,"");n[u.trim()]||(n[u.trim()]=p),p==="false"&&(n[u.trim()]=!1),p==="true"&&(n[u.trim()]=!0),isNaN(p)||(n[u.trim()]=parseInt(p,10))})}return{formatName:t,formatOptions:n}}function Mo(e){const t={};return function(s,i,l){const c=i+JSON.stringify(l);let u=t[c];return u||(u=e(Nl(i),l),t[c]=u),u(s)}}class N1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Rn.create("formatter"),this.options=t,this.formats={number:Mo((n,s)=>{const i=new Intl.NumberFormat(n,{...s});return l=>i.format(l)}),currency:Mo((n,s)=>{const i=new Intl.NumberFormat(n,{...s,style:"currency"});return l=>i.format(l)}),datetime:Mo((n,s)=>{const i=new Intl.DateTimeFormat(n,{...s});return l=>i.format(l)}),relativetime:Mo((n,s)=>{const i=new Intl.RelativeTimeFormat(n,{...s});return l=>i.format(l,s.range||"day")}),list:Mo((n,s)=>{const i=new Intl.ListFormat(n,{...s});return l=>i.format(l)})},this.init(t)}init(t){const s=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=s.formatSeparator?s.formatSeparator:s.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Mo(n)}format(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((u,f)=>{const{formatName:p,formatOptions:m}=w1(f);if(this.formats[p]){let y=u;try{const E=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},x=E.locale||E.lng||i.locale||i.lng||s;y=this.formats[p](u,x,{...m,...i,...E})}catch(E){this.logger.warn(E)}return y}else this.logger.warn(`there was no format function for ${p}`);return u},t)}}function R1(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class T1 extends Sl{constructor(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=Rn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(s,i.backend,i)}queueLoad(t,n,s,i){const l={},c={},u={},f={};return t.forEach(p=>{let m=!0;n.forEach(y=>{const E=`${p}|${y}`;!s.reload&&this.store.hasResourceBundle(p,y)?this.state[E]=2:this.state[E]<0||(this.state[E]===1?c[E]===void 0&&(c[E]=!0):(this.state[E]=1,m=!1,c[E]===void 0&&(c[E]=!0),l[E]===void 0&&(l[E]=!0),f[y]===void 0&&(f[y]=!0)))}),m||(u[p]=!0)}),(Object.keys(l).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(l),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}loaded(t,n,s){const i=t.split("|"),l=i[0],c=i[1];n&&this.emit("failedLoading",l,c,n),s&&this.store.addResourceBundle(l,c,s),this.state[t]=n?-1:2;const u={};this.queue.forEach(f=>{u1(f.loaded,[l],c),R1(f,t),n&&f.errors.push(n),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(p=>{u[p]||(u[p]={});const m=f.loaded[p];m.length&&m.forEach(y=>{u[p][y]===void 0&&(u[p][y]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(f=>!f.done)}read(t,n,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!t.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:s,tried:i,wait:l,callback:c});return}this.readingCalls++;const u=(p,m)=>{if(this.readingCalls--,this.waitingReads.length>0){const y=this.waitingReads.shift();this.read(y.lng,y.ns,y.fcName,y.tried,y.wait,y.callback)}if(p&&m&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,s,i+1,l*2,c)},l);return}c(p,m)},f=this.backend[s].bind(this.backend);if(f.length===2){try{const p=f(t,n);p&&typeof p.then=="function"?p.then(m=>u(null,m)).catch(u):u(null,p)}catch(p){u(p)}return}return f(t,n,u)}prepareLoading(t,n){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const l=this.queueLoad(t,n,s,i);if(!l.toLoad.length)return l.pending.length||i(),null;l.toLoad.forEach(c=>{this.loadOne(c)})}load(t,n,s){this.prepareLoading(t,n,{},s)}reload(t,n,s){this.prepareLoading(t,n,{reload:!0},s)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const s=t.split("|"),i=s[0],l=s[1];this.read(i,l,"read",void 0,void 0,(c,u)=>{c&&this.logger.warn(`${n}loading namespace ${l} for language ${i} failed`,c),!c&&u&&this.logger.log(`${n}loaded namespace ${l} for language ${i}`,u),this.loaded(t,c,u)})}saveMissing(t,n,s,i,l){let c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},u=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${s}" as the namespace "${n}" 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(!(s==null||s==="")){if(this.backend&&this.backend.create){const f={...c,isUpdate:l},p=this.backend.create.bind(this.backend);if(p.length<6)try{let m;p.length===5?m=p(t,n,s,i,f):m=p(t,n,s,i),m&&typeof m.then=="function"?m.then(y=>u(null,y)).catch(u):u(null,m)}catch(m){u(m)}else p(t,n,s,i,u,f)}!t||!t[0]||this.store.addResource(t[0],n,s,i)}}}function Km(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",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:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const s=t[3]||t[2];Object.keys(s).forEach(i=>{n[i]=s[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,s)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Xm(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Tl(){}function O1(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class zs extends Sl{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Xm(t),this.services={},this.logger=Rn,this.modules={external:[]},O1(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(s=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=Km();this.options={...i,...this.options,...Xm(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function l(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?Rn.init(l(this.modules.logger),this.options):Rn.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:typeof Intl<"u"&&(m=N1);const y=new Wm(this.options);this.store=new Hm(this.options.resources,this.options);const E=this.services;E.logger=Rn,E.resourceStore=this.store,E.languageUtils=y,E.pluralResolver=new S1(y,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),m&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(E.formatter=l(m),E.formatter.init(E,this.options),this.options.interpolation.format=E.formatter.format.bind(E.formatter)),E.interpolator=new _1(this.options),E.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},E.backendConnector=new T1(l(this.modules.backend),E.resourceStore,E,this.options),E.backendConnector.on("*",function(x){for(var _=arguments.length,w=new Array(_>1?_-1:0),S=1;S<_;S++)w[S-1]=arguments[S];t.emit(x,...w)}),this.modules.languageDetector&&(E.languageDetector=l(this.modules.languageDetector),E.languageDetector.init&&E.languageDetector.init(E,this.options.detection,this.options)),this.modules.i18nFormat&&(E.i18nFormat=l(this.modules.i18nFormat),E.i18nFormat.init&&E.i18nFormat.init(this)),this.translator=new Rl(this.services,this.options),this.translator.on("*",function(x){for(var _=arguments.length,w=new Array(_>1?_-1:0),S=1;S<_;S++)w[S-1]=arguments[S];t.emit(x,...w)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Tl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[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(m=>{this[m]=function(){return t.store[m](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=function(){return t.store[m](...arguments),t}});const f=Bs(),p=()=>{const m=(y,E)=>{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),f.resolve(E),s(y,E)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initImmediate?p():setTimeout(p,0),f}loadResources(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tl;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(s=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const l=[],c=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(p=>{p!=="cimode"&&l.indexOf(p)<0&&l.push(p)})};i?c(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>c(f)),this.options.preload&&this.options.preload.forEach(u=>c(u)),this.services.backendConnector.load(l,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(u)})}else s(null)}reloadResources(t,n,s){const i=Bs();return t||(t=this.languages),n||(n=this.options.ns),s||(s=Tl),this.services.backendConnector.reload(t,n,l=>{i.resolve(),s(l)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Bm.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n<this.languages.length;n++){const s=this.languages[n];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}changeLanguage(t,n){var s=this;this.isLanguageChangingTo=t;const i=Bs();this.emit("languageChanging",t);const l=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},c=(f,p)=>{p?(l(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,i.resolve(function(){return s.t(...arguments)}),n&&n(f,function(){return s.t(...arguments)})},u=f=>{!t&&!f&&this.services.languageDetector&&(f=[]);const p=typeof f=="string"?f:this.services.languageUtils.getBestMatchFromCodes(f);p&&(this.language||l(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(p)),this.loadResources(p,m=>{c(m,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),i}getFixedT(t,n,s){var i=this;const l=function(c,u){let f;if(typeof u!="object"){for(var p=arguments.length,m=new Array(p>2?p-2:0),y=2;y<p;y++)m[y-2]=arguments[y];f=i.options.overloadTranslationOptionHandler([c,u].concat(m))}else f={...u};f.lng=f.lng||l.lng,f.lngs=f.lngs||l.lngs,f.ns=f.ns||l.ns,f.keyPrefix=f.keyPrefix||s||l.keyPrefix;const E=i.options.keySeparator||".";let x;return f.keyPrefix&&Array.isArray(c)?x=c.map(_=>`${f.keyPrefix}${E}${_}`):x=f.keyPrefix?`${f.keyPrefix}${E}${c}`:c,i.t(x,f)};return typeof t=="string"?l.lng=t:l.lngs=t,l.ns=n,l.keyPrefix=s,l}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};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;const s=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,l=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const c=(u,f)=>{const p=this.services.backendConnector.state[`${u}|${f}`];return p===-1||p===2};if(n.precheck){const u=n.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(s,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(s,t)&&(!i||c(l,t)))}loadNamespaces(t,n){const s=Bs();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),n&&n(i)}),s):(n&&n(),Promise.resolve())}loadLanguages(t,n){const s=Bs();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],l=t.filter(c=>i.indexOf(c)<0);return l.length?(this.options.preload=i.concat(l),this.loadResources(c=>{s.resolve(),n&&n(c)}),s):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["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"],s=this.services&&this.services.languageUtils||new Wm(Km());return n.indexOf(s.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new zs(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Tl;const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},l=new zs(i);return(t.debug!==void 0||t.prefix!==void 0)&&(l.logger=l.logger.clone(t)),["store","services","language"].forEach(u=>{l[u]=this[u]}),l.services={...this.services},l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},s&&(l.store=new Hm(this.store.data,i),l.services.resourceStore=l.store),l.translator=new Rl(l.services,i),l.translator.on("*",function(u){for(var f=arguments.length,p=new Array(f>1?f-1:0),m=1;m<f;m++)p[m-1]=arguments[m];l.emit(u,...p)}),l.init(i,n),l.translator.options=i,l.translator.backendConnector.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const ut=zs.createInstance();ut.createInstance=zs.createInstance,ut.createInstance,ut.dir,ut.init,ut.loadResources,ut.reloadResources,ut.use,ut.changeLanguage,ut.getFixedT;const k=ut.t;ut.exists,ut.setDefaultNamespace,ut.hasLoadedNamespace,ut.loadNamespaces,ut.loadLanguages;function C1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ws(e){"@babel/helpers - typeof";return Ws=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ws(e)}function A1(e,t){if(Ws(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(Ws(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function I1(e){var t=A1(e,"string");return Ws(t)=="symbol"?t:t+""}function b1(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,I1(s.key),s)}}function L1(e,t,n){return t&&b1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Qm=[],D1=Qm.forEach,k1=Qm.slice;function P1(e){return D1.call(k1.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var qm=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,M1=function(t,n,s){var i=s||{};i.path=i.path||"/";var l=encodeURIComponent(n),c="".concat(t,"=").concat(l);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");c+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!qm.test(i.domain))throw new TypeError("option domain is invalid");c+="; Domain=".concat(i.domain)}if(i.path){if(!qm.test(i.path))throw new TypeError("option path is invalid");c+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");c+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(c+="; HttpOnly"),i.secure&&(c+="; Secure"),i.sameSite){var f=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(f){case!0:c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"strict":c+="; SameSite=Strict";break;case"none":c+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return c},Jm={create:function(t,n,s,i){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(l.expires=new Date,l.expires.setTime(l.expires.getTime()+s*60*1e3)),i&&(l.domain=i),document.cookie=M1(t,encodeURIComponent(n),l)},read:function(t){for(var n="".concat(t,"="),s=document.cookie.split(";"),i=0;i<s.length;i++){for(var l=s[i];l.charAt(0)===" ";)l=l.substring(1,l.length);if(l.indexOf(n)===0)return l.substring(n.length,l.length)}return null},remove:function(t){this.create(t,"",-1)}},j1={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var s=Jm.read(t.lookupCookie);s&&(n=s)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Jm.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},U1={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var s=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=s.substring(1),l=i.split("&"),c=0;c<l.length;c++){var u=l[c].indexOf("=");if(u>0){var f=l[c].substring(0,u);f===t.lookupQuerystring&&(n=l[c].substring(u+1))}}}return n}},Gs=null,Zm=function(){if(Gs!==null)return Gs;try{Gs=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Gs=!1}return Gs},F1={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Zm()){var s=window.localStorage.getItem(t.lookupLocalStorage);s&&(n=s)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Zm()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Ys=null,eg=function(){if(Ys!==null)return Ys;try{Ys=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Ys=!1}return Ys},V1={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&eg()){var s=window.sessionStorage.getItem(t.lookupSessionStorage);s&&(n=s)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&eg()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},$1={name:"navigator",lookup:function(t){var n=[];if(typeof navigator<"u"){if(navigator.languages)for(var s=0;s<navigator.languages.length;s++)n.push(navigator.languages[s]);navigator.userLanguage&&n.push(navigator.userLanguage),navigator.language&&n.push(navigator.language)}return n.length>0?n:void 0}},H1={name:"htmlTag",lookup:function(t){var n,s=t.htmlTag||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(n=s.getAttribute("lang")),n}},B1={name:"path",lookup:function(t){var n;if(typeof window<"u"){var s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(s instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof s[t.lookupFromPathIndex]!="string")return;n=s[t.lookupFromPathIndex].replace("/","")}else n=s[0].replace("/","")}return n}},z1={name:"subdomain",lookup:function(t){var n=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,s=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[n]}};function W1(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var tg=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};C1(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return L1(e,[{key:"init",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=P1(s,this.options||{},W1()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(l){return l.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(j1),this.addDetector(U1),this.addDetector(F1),this.addDetector(V1),this.addDetector($1),this.addDetector(H1),this.addDetector(B1),this.addDetector(z1)}},{key:"addDetector",value:function(n){this.detectors[n.name]=n}},{key:"detect",value:function(n){var s=this;n||(n=this.options.order);var i=[];return n.forEach(function(l){if(s.detectors[l]){var c=s.detectors[l].lookup(s.options);c&&typeof c=="string"&&(c=[c]),c&&(i=i.concat(c))}}),i=i.map(function(l){return s.options.convertDetectedLanguage(l)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,s){var i=this;s||(s=this.options.caches),s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||s.forEach(function(l){i.detectors[l]&&i.detectors[l].cacheUserLanguage(n,i.options)}))}}]),e}();tg.type="languageDetector";function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Su.apply(null,arguments)}var _u,ng;function G1(){return ng||(ng=1,_u={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}),_u}var Y1=G1();const K1=Bi(Y1);var X1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function rg(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},n=e.match(/<\/?([^\s]+?)[/\s>]/);if(n&&(t.name=n[1],(K1[n[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var s=e.indexOf("-->");return{type:"comment",comment:s!==-1?e.slice(4,s):""}}for(var i=new RegExp(X1),l=null;(l=i.exec(e))!==null;)if(l[0].trim())if(l[1]){var c=l[1].trim(),u=[c,""];c.indexOf("=")>-1&&(u=c.split("=")),t.attrs[u[0]]=u[1],i.lastIndex--}else l[2]&&(t.attrs[l[2]]=l[3].trim().substring(1,l[3].length-1));return t}var Q1=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,q1=/^\s*$/,J1=Object.create(null);function og(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(n){var s=[];for(var i in n)s.push(i+'="'+n[i]+'"');return s.length?" "+s.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(og,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var Z1={parse:function(e,t){t||(t={}),t.components||(t.components=J1);var n,s=[],i=[],l=-1,c=!1;if(e.indexOf("<")!==0){var u=e.indexOf("<");s.push({type:"text",content:u===-1?e:e.substring(0,u)})}return e.replace(Q1,function(f,p){if(c){if(f!=="</"+n.name+">")return;c=!1}var m,y=f.charAt(1)!=="/",E=f.startsWith("<!--"),x=p+f.length,_=e.charAt(x);if(E){var w=rg(f);return l<0?(s.push(w),s):((m=i[l]).children.push(w),s)}if(y&&(l++,(n=rg(f)).type==="tag"&&t.components[n.name]&&(n.type="component",c=!0),n.voidElement||c||!_||_==="<"||n.children.push({type:"text",content:e.slice(x,e.indexOf("<",x))}),l===0&&s.push(n),(m=i[l-1])&&m.children.push(n),i[l]=n),(!y||n.voidElement)&&(l>-1&&(n.voidElement||n.name===f.slice(2,-1))&&(l--,n=l===-1?s:i[l]),!c&&_!=="<"&&_)){m=l===-1?s:i[l].children;var S=e.indexOf("<",x),N=e.slice(x,S===-1?void 0:S);q1.test(N)&&(N=" "),(S>-1&&l+m.length>=0||N!==" ")&&m.push({type:"text",content:N})}}),s},stringify:function(e){return e.reduce(function(t,n){return t+og("",n)},"")}};function Ol(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const sg={};function eT(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&sg[t[0]]||(typeof t[0]=="string"&&(sg[t[0]]=new Date),Ol(...t))}const tT=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,nT={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},rT=e=>nT[e];let wu={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(tT,rT)};function oT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wu={...wu,...e}}function sT(){return wu}let ig;function iT(e){ig=e}function lg(){return ig}function Nu(e,t){if(!e)return!1;const n=e.props?e.props.children:e.children;return t?n.length>0:!!n}function Ru(e){if(!e)return[];const t=e.props?e.props.children:e.children;return e.props&&e.props.i18nIsDynamicList?jo(t):t}function lT(e){return Object.prototype.toString.call(e)!=="[object Array]"?!1:e.every(t=>b.isValidElement(t))}function jo(e){return Array.isArray(e)?e:[e]}function aT(e,t){const n={...t};return n.props=Object.assign(e.props,t.props),n}function ag(e,t){if(!e)return"";let n="";const s=jo(e),i=t.transSupportBasicHtmlNodes&&t.transKeepBasicHtmlNodesFor?t.transKeepBasicHtmlNodesFor:[];return s.forEach((l,c)=>{if(typeof l=="string")n+=`${l}`;else if(b.isValidElement(l)){const u=Object.keys(l.props).length,f=i.indexOf(l.type)>-1,p=l.props.children;if(!p&&f&&u===0)n+=`<${l.type}/>`;else if(!p&&(!f||u!==0))n+=`<${c}></${c}>`;else if(l.props.i18nIsDynamicList)n+=`<${c}></${c}>`;else if(f&&u===1&&typeof p=="string")n+=`<${l.type}>${p}</${l.type}>`;else{const m=ag(p,t);n+=`<${c}>${m}</${c}>`}}else if(l===null)Ol("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof l=="object"){const{format:u,...f}=l,p=Object.keys(f);if(p.length===1){const m=u?`${p[0]}, ${u}`:p[0];n+=`{{${m}}}`}else Ol("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",l)}else Ol("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",l)}),n}function cT(e,t,n,s,i,l){if(t==="")return[];const c=s.transKeepBasicHtmlNodesFor||[],u=t&&new RegExp(c.map(S=>`<${S}`).join("|")).test(t);if(!e&&!u&&!l)return[t];const f={};function p(S){jo(S).forEach(R=>{typeof R!="string"&&(Nu(R)?p(Ru(R)):typeof R=="object"&&!b.isValidElement(R)&&Object.assign(f,R))})}p(e);const m=Z1.parse(`<0>${t}</0>`),y={...f,...i};function E(S,N,R){const P=Ru(S),C=_(P,N.children,R);return lT(P)&&C.length===0||S.props&&S.props.i18nIsDynamicList?P:C}function x(S,N,R,P,C){S.dummy?(S.children=N,R.push(b.cloneElement(S,{key:P},C?void 0:N))):R.push(...b.Children.map([S],I=>{const L={...I.props};return delete L.i18nIsDynamicList,ne.createElement(I.type,Su({},L,{key:P,ref:I.ref},C?{}:{children:N}))}))}function _(S,N,R){const P=jo(S);return jo(N).reduce((I,L,U)=>{const G=L.children&&L.children[0]&&L.children[0].content&&n.services.interpolator.interpolate(L.children[0].content,y,n.language);if(L.type==="tag"){let X=P[parseInt(L.name,10)];R.length===1&&!X&&(X=R[0][L.name]),X||(X={});const H=Object.keys(L.attrs).length!==0?aT({props:L.attrs},X):X,q=b.isValidElement(H),ee=q&&Nu(L,!0)&&!L.voidElement,z=u&&typeof H=="object"&&H.dummy&&!q,A=typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,L.name);if(typeof H=="string"){const F=n.services.interpolator.interpolate(H,y,n.language);I.push(F)}else if(Nu(H)||ee){const F=E(H,L,R);x(H,F,I,U)}else if(z){const F=_(P,L.children,R);x(H,F,I,U)}else if(Number.isNaN(parseFloat(L.name)))if(A){const F=E(H,L,R);x(H,F,I,U,L.voidElement)}else if(s.transSupportBasicHtmlNodes&&c.indexOf(L.name)>-1)if(L.voidElement)I.push(b.createElement(L.name,{key:`${L.name}-${U}`}));else{const F=_(P,L.children,R);I.push(b.createElement(L.name,{key:`${L.name}-${U}`},F))}else if(L.voidElement)I.push(`<${L.name} />`);else{const F=_(P,L.children,R);I.push(`<${L.name}>${F}</${L.name}>`)}else if(typeof H=="object"&&!q){const F=L.children[0]?G:null;F&&I.push(F)}else x(H,G,I,U,L.children.length!==1||!G)}else if(L.type==="text"){const X=s.transWrapTextNodes,H=l?s.unescape(n.services.interpolator.interpolate(L.content,y,n.language)):n.services.interpolator.interpolate(L.content,y,n.language);X?I.push(b.createElement(X,{key:`${L.name}-${U}`},H)):I.push(H)}return I},[])}const w=_([{dummy:!0,children:e||[]}],m,jo(e||[]));return Ru(w[0])}function uT(e){let{children:t,count:n,parent:s,i18nKey:i,context:l,tOptions:c={},values:u,defaults:f,components:p,ns:m,i18n:y,t:E,shouldUnescape:x,..._}=e;const w=y||lg();if(!w)return eT("You will need to pass in an i18next instance by using i18nextReactModule"),t;const S=E||w.t.bind(w)||(ee=>ee);l&&(c.context=l);const N={...sT(),...w.options&&w.options.react};let R=m||S.ns||w.options&&w.options.defaultNS;R=typeof R=="string"?[R]:R||["translation"];const P=ag(t,N),C=f||P||N.transEmptyNodeValue||i,{hashTransKey:I}=N,L=i||(I?I(P||C):P||C);w.options&&w.options.interpolation&&w.options.interpolation.defaultVariables&&(u=u&&Object.keys(u).length>0?{...u,...w.options.interpolation.defaultVariables}:{...w.options.interpolation.defaultVariables});const U=u?c.interpolation:{interpolation:{...c.interpolation,prefix:"#$?",suffix:"?$#"}},G={...c,count:n,...u,...U,defaultValue:C,ns:R},X=L?S(L,G):C;p&&Object.keys(p).forEach(ee=>{const z=p[ee];if(typeof z.type=="function"||!z.props||!z.props.children||X.indexOf(`${ee}/>`)<0&&X.indexOf(`${ee} />`)<0)return;function A(){return ne.createElement(ne.Fragment,null,z)}p[ee]=ne.createElement(A,null)});const H=cT(p||t,X,w,N,G,x),q=s!==void 0?s:N.defaultTransParent;return q?b.createElement(q,_,H):H}const dT={type:"3rdParty",init(e){oT(e.options.react),iT(e)}},fT=b.createContext();function pT(e){let{children:t,count:n,parent:s,i18nKey:i,context:l,tOptions:c={},values:u,defaults:f,components:p,ns:m,i18n:y,t:E,shouldUnescape:x,..._}=e;const{i18n:w,defaultNS:S}=b.useContext(fT)||{},N=y||w||lg(),R=E||N&&N.t.bind(N);return uT({children:t,count:n,parent:s,i18nKey:i,context:l,tOptions:c,values:u,defaults:f,components:p,ns:m||R&&R.ns||S||N&&N.options&&N.options.defaultNS,i18n:N,t:E,shouldUnescape:x,..._})}var hT={prefix:"fas",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"]},mT={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"]},gT={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},yT={prefix:"fas",iconName:"circle-dot",icon:[512,512,[128280,"dot-circle"],"f192","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-352a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"]},ET=yT,vT={prefix:"fas",iconName:"circle-check",icon:[512,512,[61533,"check-circle"],"f058","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]},xT={prefix:"fas",iconName:"arrows-rotate",icon:[512,512,[128472,"refresh","sync"],"f021","M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160H352c-17.7 0-32 14.3-32 32s14.3 32 32 32H463.5c0 0 0 0 0 0h.4c17.7 0 32-14.3 32-32V80c0-17.7-14.3-32-32-32s-32 14.3-32 32v35.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5zM39 289.3c-5 1.5-9.8 4.2-13.7 8.2c-4 4-6.7 8.8-8.1 14c-.3 1.2-.6 2.5-.8 3.8c-.3 1.7-.4 3.4-.4 5.1V432c0 17.7 14.3 32 32 32s32-14.3 32-32V396.9l17.6 17.5 0 0c87.5 87.4 229.3 87.4 316.7 0c24.4-24.4 42.1-53.1 52.9-83.7c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.5 62.5-163.8 62.5-226.3 0l-.1-.1L125.6 352H160c17.7 0 32-14.3 32-32s-14.3-32-32-32H48.4c-1.6 0-3.2 .1-4.8 .3s-3.1 .5-4.6 1z"]},ST={prefix:"fas",iconName:"arrow-turn-down-right",icon:[512,512,[],"e3d6","M64 64c0-17.7-14.3-32-32-32S0 46.3 0 64V224c0 53 43 96 96 96H402.7l-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256H96c-17.7 0-32-14.3-32-32V64z"]},_T={prefix:"fas",iconName:"arrow-right",icon:[448,512,[8594],"f061","M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"]},wT={prefix:"fas",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},NT={prefix:"fas",iconName:"arrow-left",icon:[448,512,[8592],"f060","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]},RT={prefix:"fas",iconName:"circle-small",icon:[320,512,[],"e122","M0 256a160 160 0 1 1 320 0A160 160 0 1 1 0 256z"]},TT={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"]},OT={prefix:"fas",iconName:"bolt",icon:[448,512,[9889,"zap"],"f0e7","M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z"]},CT={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]},AT={prefix:"fas",iconName:"clock-rotate-left",icon:[512,512,["history"],"f1da","M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"]},IT={prefix:"fas",iconName:"triangle-exclamation",icon:[512,512,[9888,"exclamation-triangle","warning"],"f071","M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"]},bT={prefix:"fas",iconName:"circle-xmark",icon:[512,512,[61532,"times-circle","xmark-circle"],"f057","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]};const LT={"arrow-left":NT,"arrow-right":_T,"arrow-turn-down-right":ST,"arrows-rotate":xT,bars:mT,bolt:OT,"circle-check":vT,"circle-exclamation":gT,"circle-info":TT,"circle-question":wT,"circle-small":RT,"circle-xmark":bT,"clock-rotate-left":AT,"dot-circle":ET,"trash-can":hT,"triangle-exclamation":IT,xmark:CT},Ce=b.forwardRef(function({className:t="",size:n="",tag:s},i){const l=LT[s];return l?h.jsx("svg",{"aria-hidden":"true","data-prefix":l.prefix,"data-icon":s,className:`svg-inline--fa fa-${s} ${n?`fa-${n}`:""} ${t}`,focusable:"false",ref:i,role:"img",viewBox:`0 0 ${l.icon[0]} ${l.icon[1]}`,xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:l.icon[4],fill:"currentColor"})}):(Qe().debug(`Unknown icon: ${s}`),null)}),Uo=({className:e="",confirm:t=!0,handleDelete:n,label:s,scale:i=1,show:l=!0,showLabel:c=!1,size:u})=>{const[f,p]=b.useState(!1),[m,y]=b.useState(i);i!==m&&(p(!1),y(i));const E=_=>{_.preventDefault(),p(w=>!w)},x=_=>{_.preventDefault(),n(_)};return h.jsx(yr,{enable:t,open:f,onOpenChange:p,placement:"top",scale:i,trigger:h.jsxs("button",{className:`${l?"visible opacity-100":"invisible opacity-0"} text-xs text-foreground/20 hover:text-negative group-hover/node-wrapper:visible group-hover/node-wrapper:animate-delay-opacity ${e}`,onClick:_=>E(_),type:"button",children:[h.jsx(Ce,{tag:"trash-can",size:u})," ",h.jsx("span",{className:`${c?"whitespace-nowrap text-foreground/40 underline hover:text-negative":"sr-only"}`,children:s})]}),children:h.jsxs("div",{className:"text-xs font-semibold",children:[h.jsx("p",{className:"w-full pb-2 text-center",children:k(O.ARE_YOU_SURE)}),h.jsxs("div",{className:"align-center flex justify-between gap-2",children:[h.jsx("button",{className:"rounded bg-secondary py-1 px-2",onClick:_=>E(_),children:k(O.CANCEL)}),h.jsx("button",{className:"rounded bg-negative py-1 px-2",onClick:_=>x(_),children:k(O.DELETE)})]})]})})},DT=e=>{const t=Ee(n=>n.viewport.zoom);return h.jsx(Uo,{scale:t,...e})},kT=Qe(),PT=100,MT=100,cg=({children:e,className:t="",onClickListItem:n})=>{const s=Ee(p=>p.nodes),i=Ee(p=>p.reactFlowInstance),l=Ee(p=>p.validationWarnings),{setSelectedNodes:c}=Je();if(l.size===0)return null;const u=Array.from(l.values());u.sort((p,m)=>k(p.nodeTitle).toLowerCase().localeCompare(k(m.nodeTitle).toLowerCase()));const f=p=>{var x,_;const m=s.find(w=>w.id===p);if(!m){kT.error(`Node with id ${p} not found`);return}const y=((x=i==null?void 0:i.getNode(p))==null?void 0:x.height)??MT,E=((_=i==null?void 0:i.getNode(p))==null?void 0:_.width)??Om;i==null||i.fitBounds({height:y+PT,width:E,x:m.position.x,y:m.position.y},{duration:mu}),setTimeout(()=>c([m.id]),mu),n==null||n()};return h.jsxs("div",{className:`hidden max-h-60 flex-col sm:flex ${t}`,children:[e,h.jsxs("p",{className:"mb-2 text-xs",children:[k(O.NUMBER_OF_VALIDATION_WARNINGS,{count:u.length}),":"]}),h.jsx("div",{className:"flex-auto overflow-y-auto",children:h.jsx("ol",{className:"list-inside",children:u.map(p=>h.jsxs("li",{className:"mb-2 text-xs",children:[h.jsx("button",{className:"text-warning underline",onClick:()=>f(p.nodeId),children:k(p.nodeTitle)}),h.jsxs("ol",{className:"my-1 ml-4 flex list-inside flex-col gap-y-1",children:[!p.connected&&h.jsx("li",{children:k(O.NOT_CONNECTED_TO_FLOW)}),!p.valid&&h.jsx("li",{children:k(O.INVALID_SETTINGS)})]})]},p.id))})})]})},Ks=e=>{const{className:t="",direction:n="from",valid:s=!0,...i}=e,l=n==="from";return h.jsxs("div",{className:`relative ${t} ${s?"":"invalid"}`,children:[h.jsx("input",{className:`w-full !pl-5 ${s?"":"invalid"}`,placeholder:k(l?O.FROM:O.TO),...i}),h.jsx(Ce,{className:"absolute left-[.25rem] top-[.5rem] text-foreground/40",tag:l?"arrow-left":"arrow-right"})]})},jT=({children:e})=>h.jsx("span",{className:"whitespace-wrap inline-block",children:h.jsx("code",{className:"mr-[0.5ch] whitespace-pre-wrap rounded-md bg-background p-0 px-[0.5ch] text-sm leading-4 tracking-tighter text-foreground",children:e})}),Qt=({children:e})=>h.jsxs("section",{className:"flex gap-2 overflow-hidden px-4 pb-3 text-xs leading-5",children:[h.jsx("div",{className:"shrink-0 pl-1 text-secondary",children:h.jsx(Ce,{size:"lg",tag:"arrow-turn-down-right"})}),h.jsx("div",{className:"w-full overflow-hidden",children:e})]}),UT=({connected:e=!1,deletable:t=!0,isRoot:n=!1,nodeId:s,nodeTitle:i,selected:l=!1})=>{const{removeNode:c}=Je(),u=Ee(p=>p.isEdgeConnecting),f=(p=>p?"bg-positive/10 text-positive":e?"bg-focus/30 text-primary":"bg-foreground/10 text-foreground/50")(n);return h.jsxs("div",{className:"flex w-full items-center justify-start gap-x-2 p-4",children:[h.jsx("div",{className:`${f} flex h-5 w-5 shrink-0 items-center justify-center rounded-full`,children:h.jsx(Ce,{tag:"circle-small"})}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h2",{className:"text-xs font-semibold",children:i}),!e&&h.jsxs("div",{className:"flex items-center justify-start text-tiny font-semibold leading-[14px] text-secondary",children:[h.jsx(Ce,{className:"px-1 text-warning",size:"lg",tag:"bolt"}),k(O.NOT_CONNECTED_TO_FLOW)]})]}),t&&!u&&h.jsx(DT,{handleDelete:()=>c(s),label:k(O.REMOVE_NODE,{title:i}),show:l})]})},FT=({valid:e})=>e?null:h.jsx("div",{className:"m-4 mt-0 inline-block",children:h.jsxs("div",{className:"flex items-start justify-start gap-2 rounded bg-negative/10 px-2 py-1 text-xs text-negative",children:[h.jsx(yr,{placement:"bottom",trigger:h.jsx("div",{role:"tooltip",tabIndex:0,children:h.jsx(Ce,{size:"lg",tag:"triangle-exclamation"})}),children:k(O.INFO_INVALID_SETTINGS)}),k(O.INVALID_SETTINGS)]})}),VT=({nodeId:e,valid:t})=>{const{deleteValidationWarning:n,getTargetEdges:s,partialUpdateValidationWarning:i}=Je(),[l,c]=b.useState(!1);return b.useEffect(()=>{let u;const f=()=>{n(e),typeof u=="function"&&u()},p=()=>{const m=Ee.getState().nodes.find(y=>y.id===e);if(!m)f();else{const y=s(e).length>0;c(y),i(e,{connected:y,nodeId:e,nodeType:m.type,valid:t})}};return p(),u=Ee.subscribe((m,y)=>{const E=m.nodes.length!==y.nodes.length,x=m.edges.length!==y.edges.length,_=m.isEdgeUpdateSuccessful!==y.isEdgeUpdateSuccessful;(x||E||_)&&p()}),()=>{f()}},[n,s,e,i,t]),{isConnectedToFlow:l}},$T=({id:e,isConnectable:t})=>{if(!e)throw new Error("TargetHandle: id is required");return h.jsx("div",{className:"absolute left-0 top-5 h-3 w-3 -translate-x-1/2",children:h.jsx(Ro,{className:"-left-[2px] h-full w-full border-2 border-foreground/40 bg-background transition-colors hover:border-foreground/80",id:`target-${e}`,isConnectable:t,position:xe.Left,type:"target"})})},dt=({children:e,id:t,isConnectable:n=!0,isRoot:s=!1,nodeTitle:i,selected:l,deletable:c=!0,showValidation:u=!0,target:f=!0,valid:p=!0})=>{const{isConnectedToFlow:m}=VT({nodeId:t,valid:p});return h.jsx("section",{className:`${l?"!border-focus":""} group/node-wrapper rounded-xl border-2 border-background shadow-[0_4px_12px_0_rgba(0,0,0,0.08)] transition-[visibility]`,children:h.jsxs("div",{className:"group/node-wrapper relative rounded-xl bg-background",style:{width:Om},children:[f&&t&&h.jsx($T,{id:t,isConnectable:n}),h.jsx(UT,{connected:!f||m,deletable:c,isRoot:s,nodeId:t,nodeTitle:i,selected:l}),u&&h.jsx(FT,{valid:p}),e]})})},HT=({children:e,handleClick:t,...n})=>{const s=i=>{(i.key==="Backspace"||i.key==="Delete")&&(i.stopPropagation(),t==null||t())};return h.jsx("li",{"aria-selected":"true",tabIndex:0,role:"option",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/20 p-1 pl-2 text-xs font-medium text-foreground",children:[e,h.jsxs("button",{className:"px-1",onClick:t,onKeyDown:s,type:"button",...n,children:[h.jsx("span",{className:"sr-only",children:"Remove"}),h.jsx(Ce,{tag:"xmark",size:"xs"})]})]})})},ug=({data:e})=>{let t=e.selected&&e[e.selected].trim();return t&&e.selected==="url"&&(t=s1(t)||k(O.PLAY_AUDIO)),t?h.jsx(Qt,{children:h.jsx("div",{className:"max-w-max",children:e.selected==="url"?h.jsx("a",{className:"break-words text-primary underline line-clamp-2",href:e.url,target:"_blank",rel:"noopener noreferrer",children:t}):h.jsx("p",{className:"break-words line-clamp-2",children:t})})}):null},dg=e=>{const{children:t,className:n="",disabled:s=!1,...i}=e;return h.jsxs("div",{className:`chevron-down relative mb-2 after:rotate-0 after:transition-transform focus-within:after:rotate-180
61
- ${s?"after:border-t-foreground/40":"after:border-t-foreground"}`,children:[h.jsx("select",{className:`pr-8 ${n}`,disabled:s,...i,children:t}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_SELECTION_REQUIRED)})]})},Tn=e=>{const{label:t="",id:n="",...s}=e,i=b.useId(),l=n||i;return h.jsxs(h.Fragment,{children:[t&&h.jsx("label",{className:"block pb-1 font-medium",htmlFor:l,children:t}),h.jsx(dg,{id:l,...s})]})},BT=({label:e,vars:t={}})=>h.jsx(pT,{components:{a:h.jsx("a",{className:"underline hover:text-background/80",href:t.linkTo||"#",target:"_blank",rel:"noopener noreferrer"}),code:h.jsx(jT,{}),p:h.jsx("p",{className:"mb-2"})},i18nKey:e}),zT={disabled:"border-disabled cursor-not-allowed",negative:"border-negative hover:bg-negative",positive:"border-positive hover:bg-positive"},an=({color:e="positive",enabled:t=!0,id:n,isConnectable:s})=>{if(!n)throw new Error("SourceHandle: id is required");const i=t?e:"disabled",l=Ee(m=>m.updatingSourceHandleId),f=!Ee(m=>m.edges.some(y=>y.sourceHandle===n))||l===n,p=f&&s&&t;return h.jsx("div",{className:`absolute right-0 top-1/2 h-3 w-3 -translate-y-1/2 translate-x-1/2 ${p?"":"nodrag cursor-not-allowed"}`,children:h.jsx(Ro,{className:`-right-[2px] h-full w-full border-2 bg-background transition-colors ${zT[i]??""}`,id:n,isConnectable:f&&s&&t,position:xe.Right,type:"source"})})},Fo=({children:e})=>h.jsx("div",{className:"flex w-full flex-col items-start text-xs",children:e}),cn=({color:e="positive",enabled:t=!0,id:n,isConnectable:s,optionSubtitle:i="",optionTitle:l})=>h.jsxs("div",{className:"relative w-full min-w-[104px] whitespace-nowrap border-t border-foreground/10 py-3",children:[h.jsx("div",{className:"flex flex-col items-start justify-center px-4",children:h.jsxs("div",{className:`${t?"":"text-disabled"} min-h-[1rem] w-full overflow-hidden`,children:[l,i?h.jsx("span",{className:"block text-xxs text-secondary",children:i}):null]})}),h.jsx(an,{color:e,enabled:t,id:n,isConnectable:s})]}),WT=({checked:e=!1,name:t,onClick:n,...s})=>h.jsxs("button",{"aria-checked":e?"true":"false",className:`${e?"bg-primary":"bg-secondary"} relative inline-flex h-4 w-6 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out`,name:t,onClick:n,role:"switch",type:"button",...s,children:[h.jsx("span",{className:"sr-only",children:k(e?O.ON:O.OFF)}),h.jsx("span",{className:`pointer-events-none inline-block h-3 w-3 ${e?"translate-x-2":"translate-x-0"} transform rounded-full bg-white shadow transition duration-200 ease-in-out`})]}),Cl=({checked:e,clickHandler:t,name:n,subtitle:s,title:i,...l})=>h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsxs("div",{className:"flex flex-grow flex-col",children:[h.jsx("span",{className:"text-xs font-medium",children:i}),s&&h.jsx("span",{className:"text-xxs text-foreground/50",children:s})]}),h.jsx(WT,{checked:e,name:n,onClick:t,...l})]}),Hn=({errorText:e,label:t,name:n,onChange:s,required:i,valid:l,value:c,...u})=>h.jsxs(h.Fragment,{children:[t!=null&&t.trim()?h.jsx("div",{className:"pb-1",children:t}):null,h.jsx("textarea",{"aria-invalid":l?void 0:"true",className:`peer min-h-[77px] w-full resize-y ${l?"":"invalid"}`,inputMode:"text",minLength:1,name:n,onChange:s,required:i,value:c,...u}),h.jsx("p",{className:"requirements",role:"alert",children:e})]});function pr(e){return fg(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Bn(e){var t;return(t=(fg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fg(e){return e instanceof Node||e instanceof Ct(e).Node}function $e(e){return e instanceof Element||e instanceof Ct(e).Element}function $t(e){return e instanceof HTMLElement||e instanceof Ct(e).HTMLElement}function Tu(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}function Xs(e){const{overflow:t,overflowX:n,overflowY:s,display:i}=Ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!["inline","contents"].includes(i)}function GT(e){return["table","td","th"].includes(pr(e))}function Ou(e){const t=Cu(),n=Ht(e);return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(n.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(n.contain||"").includes(s))}function YT(e){let t=zr(e);for(;$t(t)&&!Vo(t);){if(Ou(t))return t;t=zr(t)}return null}function Cu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vo(e){return["html","body","#document"].includes(pr(e))}function Ht(e){return Ct(e).getComputedStyle(e)}function Al(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function zr(e){if(pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tu(e)&&e.host||Bn(e);return Tu(t)?t.host:t}function pg(e){const t=zr(e);return Vo(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&Xs(t)?t:pg(t)}function hr(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=pg(e),l=i===((s=e.ownerDocument)==null?void 0:s.body),c=Ct(i);return l?t.concat(c,c.visualViewport||[],Xs(i)?i:[],c.frameElement&&n?hr(c.frameElement):[]):t.concat(i,hr(i,[],n))}function hg(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function mr(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Tu(n)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function mg(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function KT(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:s}=t;return n+"/"+s}).join(" "):navigator.userAgent}function XT(e){return!qT()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function QT(){return/apple/i.test(navigator.vendor)}function qT(){const e=/android/i;return e.test(mg())||e.test(KT())}function JT(){return mg().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function gg(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function ZT(e){return"nativeEvent"in e}function eO(e){return e.matches("html,body")}function Wr(e){return(e==null?void 0:e.ownerDocument)||document}function Au(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Gr(e){return"composedPath"in e?e.composedPath()[0]:e.target}const tO="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function nO(e){return $t(e)&&e.matches(tO)}const $o=Math.min,Yr=Math.max,Il=Math.round,bl=Math.floor,gr=e=>({x:e,y:e}),rO={left:"right",right:"left",bottom:"top",top:"bottom"},oO={start:"end",end:"start"};function Iu(e,t,n){return Yr(e,$o(t,n))}function Qs(e,t){return typeof e=="function"?e(t):e}function Kr(e){return e.split("-")[0]}function qs(e){return e.split("-")[1]}function yg(e){return e==="x"?"y":"x"}function bu(e){return e==="y"?"height":"width"}function Ll(e){return["top","bottom"].includes(Kr(e))?"y":"x"}function Lu(e){return yg(Ll(e))}function sO(e,t,n){n===void 0&&(n=!1);const s=qs(e),i=Lu(e),l=bu(i);let c=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Dl(c)),[c,Dl(c)]}function iO(e){const t=Dl(e);return[Du(e),t,Du(t)]}function Du(e){return e.replace(/start|end/g,t=>oO[t])}function lO(e,t,n){const s=["left","right"],i=["right","left"],l=["top","bottom"],c=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:s:t?s:i;case"left":case"right":return t?l:c;default:return[]}}function aO(e,t,n,s){const i=qs(e);let l=lO(Kr(e),n==="start",s);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(Du)))),l}function Dl(e){return e.replace(/left|right|bottom|top/g,t=>rO[t])}function cO(e){return{top:0,right:0,bottom:0,left:0,...e}}function Eg(e){return typeof e!="number"?cO(e):{top:e,right:e,bottom:e,left:e}}function kl(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function vg(e,t,n){let{reference:s,floating:i}=e;const l=Ll(t),c=Lu(t),u=bu(c),f=Kr(t),p=l==="y",m=s.x+s.width/2-i.width/2,y=s.y+s.height/2-i.height/2,E=s[u]/2-i[u]/2;let x;switch(f){case"top":x={x:m,y:s.y-i.height};break;case"bottom":x={x:m,y:s.y+s.height};break;case"right":x={x:s.x+s.width,y};break;case"left":x={x:s.x-i.width,y};break;default:x={x:s.x,y:s.y}}switch(qs(t)){case"start":x[c]-=E*(n&&p?-1:1);break;case"end":x[c]+=E*(n&&p?-1:1);break}return x}const uO=async(e,t,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:l=[],platform:c}=n,u=l.filter(Boolean),f=await(c.isRTL==null?void 0:c.isRTL(t));let p=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:m,y}=vg(p,s,f),E=s,x={},_=0;for(let w=0;w<u.length;w++){const{name:S,fn:N}=u[w],{x:R,y:P,data:C,reset:I}=await N({x:m,y,initialPlacement:s,placement:E,strategy:i,middlewareData:x,rects:p,platform:c,elements:{reference:e,floating:t}});if(m=R??m,y=P??y,x={...x,[S]:{...x[S],...C}},I&&_<=50){_++,typeof I=="object"&&(I.placement&&(E=I.placement),I.rects&&(p=I.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):I.rects),{x:m,y}=vg(p,E,f)),w=-1;continue}}return{x:m,y,placement:E,strategy:i,middlewareData:x}};async function xg(e,t){var n;t===void 0&&(t={});const{x:s,y:i,platform:l,rects:c,elements:u,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:m="viewport",elementContext:y="floating",altBoundary:E=!1,padding:x=0}=Qs(t,e),_=Eg(x),S=u[E?y==="floating"?"reference":"floating":y],N=kl(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(S)))==null||n?S:S.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:p,rootBoundary:m,strategy:f})),R=y==="floating"?{...c.floating,x:s,y:i}:c.reference,P=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),C=await(l.isElement==null?void 0:l.isElement(P))?await(l.getScale==null?void 0:l.getScale(P))||{x:1,y:1}:{x:1,y:1},I=kl(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({rect:R,offsetParent:P,strategy:f}):R);return{top:(N.top-I.top+_.top)/C.y,bottom:(I.bottom-N.bottom+_.bottom)/C.y,left:(N.left-I.left+_.left)/C.x,right:(I.right-N.right+_.right)/C.x}}const Sg=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:i,rects:l,platform:c,elements:u,middlewareData:f}=t,{element:p,padding:m=0}=Qs(e,t)||{};if(p==null)return{};const y=Eg(m),E={x:n,y:s},x=Lu(i),_=bu(x),w=await c.getDimensions(p),S=x==="y",N=S?"top":"left",R=S?"bottom":"right",P=S?"clientHeight":"clientWidth",C=l.reference[_]+l.reference[x]-E[x]-l.floating[_],I=E[x]-l.reference[x],L=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p));let U=L?L[P]:0;(!U||!await(c.isElement==null?void 0:c.isElement(L)))&&(U=u.floating[P]||l.floating[_]);const G=C/2-I/2,X=U/2-w[_]/2-1,H=$o(y[N],X),q=$o(y[R],X),ee=H,z=U-w[_]-q,A=U/2-w[_]/2+G,F=Iu(ee,A,z),$=!f.arrow&&qs(i)!=null&&A!=F&&l.reference[_]/2-(A<ee?H:q)-w[_]/2<0,Y=$?A<ee?A-ee:A-z:0;return{[x]:E[x]+Y,data:{[x]:F,centerOffset:A-F-Y,...$&&{alignmentOffset:Y}},reset:$}}}),dO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:i,middlewareData:l,rects:c,initialPlacement:u,platform:f,elements:p}=t,{mainAxis:m=!0,crossAxis:y=!0,fallbackPlacements:E,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:w=!0,...S}=Qs(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const N=Kr(i),R=Kr(u)===u,P=await(f.isRTL==null?void 0:f.isRTL(p.floating)),C=E||(R||!w?[Dl(u)]:iO(u));!E&&_!=="none"&&C.push(...aO(u,w,_,P));const I=[u,...C],L=await xg(t,S),U=[];let G=((s=l.flip)==null?void 0:s.overflows)||[];if(m&&U.push(L[N]),y){const ee=sO(i,c,P);U.push(L[ee[0]],L[ee[1]])}if(G=[...G,{placement:i,overflows:U}],!U.every(ee=>ee<=0)){var X,H;const ee=(((X=l.flip)==null?void 0:X.index)||0)+1,z=I[ee];if(z)return{data:{index:ee,overflows:G},reset:{placement:z}};let A=(H=G.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:H.placement;if(!A)switch(x){case"bestFit":{var q;const F=(q=G.map($=>[$.placement,$.overflows.filter(Y=>Y>0).reduce((Y,M)=>Y+M,0)]).sort(($,Y)=>$[1]-Y[1])[0])==null?void 0:q[0];F&&(A=F);break}case"initialPlacement":A=u;break}if(i!==A)return{reset:{placement:A}}}return{}}}};async function fO(e,t){const{placement:n,platform:s,elements:i}=e,l=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Kr(n),u=qs(n),f=Ll(n)==="y",p=["left","top"].includes(c)?-1:1,m=l&&f?-1:1,y=Qs(t,e);let{mainAxis:E,crossAxis:x,alignmentAxis:_}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...y};return u&&typeof _=="number"&&(x=u==="end"?_*-1:_),f?{x:x*m,y:E*p}:{x:E*p,y:x*m}}const pO=function(e){return{name:"offset",options:e,async fn(t){var n,s;const{x:i,y:l,placement:c,middlewareData:u}=t,f=await fO(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:i+f.x,y:l+f.y,data:{...f,placement:c}}}}},hO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:i}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:N,y:R}=S;return{x:N,y:R}}},...f}=Qs(e,t),p={x:n,y:s},m=await xg(t,f),y=Ll(Kr(i)),E=yg(y);let x=p[E],_=p[y];if(l){const S=E==="y"?"top":"left",N=E==="y"?"bottom":"right",R=x+m[S],P=x-m[N];x=Iu(R,x,P)}if(c){const S=y==="y"?"top":"left",N=y==="y"?"bottom":"right",R=_+m[S],P=_-m[N];_=Iu(R,_,P)}const w=u.fn({...t,[E]:x,[y]:_});return{...w,data:{x:w.x-n,y:w.y-s}}}}};function _g(e){const t=Ht(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=$t(e),l=i?e.offsetWidth:n,c=i?e.offsetHeight:s,u=Il(n)!==l||Il(s)!==c;return u&&(n=l,s=c),{width:n,height:s,$:u}}function ku(e){return $e(e)?e:e.contextElement}function Ho(e){const t=ku(e);if(!$t(t))return gr(1);const n=t.getBoundingClientRect(),{width:s,height:i,$:l}=_g(t);let c=(l?Il(n.width):n.width)/s,u=(l?Il(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const mO=gr(0);function wg(e){const t=Ct(e);return!Cu()||!t.visualViewport?mO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function Xr(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=ku(e);let c=gr(1);t&&(s?$e(s)&&(c=Ho(s)):c=Ho(e));const u=gO(l,n,s)?wg(l):gr(0);let f=(i.left+u.x)/c.x,p=(i.top+u.y)/c.y,m=i.width/c.x,y=i.height/c.y;if(l){const E=Ct(l),x=s&&$e(s)?Ct(s):s;let _=E.frameElement;for(;_&&s&&x!==E;){const w=Ho(_),S=_.getBoundingClientRect(),N=Ht(_),R=S.left+(_.clientLeft+parseFloat(N.paddingLeft))*w.x,P=S.top+(_.clientTop+parseFloat(N.paddingTop))*w.y;f*=w.x,p*=w.y,m*=w.x,y*=w.y,f+=R,p+=P,_=Ct(_).frameElement}}return kl({width:m,height:y,x:f,y:p})}function yO(e){let{rect:t,offsetParent:n,strategy:s}=e;const i=$t(n),l=Bn(n);if(n===l)return t;let c={scrollLeft:0,scrollTop:0},u=gr(1);const f=gr(0);if((i||!i&&s!=="fixed")&&((pr(n)!=="body"||Xs(l))&&(c=Al(n)),$t(n))){const p=Xr(n);u=Ho(n),f.x=p.x+n.clientLeft,f.y=p.y+n.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+f.x,y:t.y*u.y-c.scrollTop*u.y+f.y}}function EO(e){return Array.from(e.getClientRects())}function Ng(e){return Xr(Bn(e)).left+Al(e).scrollLeft}function vO(e){const t=Bn(e),n=Al(e),s=e.ownerDocument.body,i=Yr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),l=Yr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-n.scrollLeft+Ng(e);const u=-n.scrollTop;return Ht(s).direction==="rtl"&&(c+=Yr(t.clientWidth,s.clientWidth)-i),{width:i,height:l,x:c,y:u}}function xO(e,t){const n=Ct(e),s=Bn(e),i=n.visualViewport;let l=s.clientWidth,c=s.clientHeight,u=0,f=0;if(i){l=i.width,c=i.height;const p=Cu();(!p||p&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}return{width:l,height:c,x:u,y:f}}function SO(e,t){const n=Xr(e,!0,t==="fixed"),s=n.top+e.clientTop,i=n.left+e.clientLeft,l=$t(e)?Ho(e):gr(1),c=e.clientWidth*l.x,u=e.clientHeight*l.y,f=i*l.x,p=s*l.y;return{width:c,height:u,x:f,y:p}}function Rg(e,t,n){let s;if(t==="viewport")s=xO(e,n);else if(t==="document")s=vO(Bn(e));else if($e(t))s=SO(t,n);else{const i=wg(e);s={...t,x:t.x-i.x,y:t.y-i.y}}return kl(s)}function Tg(e,t){const n=zr(e);return n===t||!$e(n)||Vo(n)?!1:Ht(n).position==="fixed"||Tg(n,t)}function _O(e,t){const n=t.get(e);if(n)return n;let s=hr(e,[],!1).filter(u=>$e(u)&&pr(u)!=="body"),i=null;const l=Ht(e).position==="fixed";let c=l?zr(e):e;for(;$e(c)&&!Vo(c);){const u=Ht(c),f=Ou(c);!f&&u.position==="fixed"&&(i=null),(l?!f&&!i:!f&&u.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Xs(c)&&!f&&Tg(e,c))?s=s.filter(m=>m!==c):i=u,c=zr(c)}return t.set(e,s),s}function wO(e){let{element:t,boundary:n,rootBoundary:s,strategy:i}=e;const c=[...n==="clippingAncestors"?_O(t,this._c):[].concat(n),s],u=c[0],f=c.reduce((p,m)=>{const y=Rg(t,m,i);return p.top=Yr(y.top,p.top),p.right=$o(y.right,p.right),p.bottom=$o(y.bottom,p.bottom),p.left=Yr(y.left,p.left),p},Rg(t,u,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function NO(e){return _g(e)}function RO(e,t,n){const s=$t(t),i=Bn(t),l=n==="fixed",c=Xr(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const f=gr(0);if(s||!s&&!l)if((pr(t)!=="body"||Xs(i))&&(u=Al(t)),s){const p=Xr(t,!0,l,t);f.x=p.x+t.clientLeft,f.y=p.y+t.clientTop}else i&&(f.x=Ng(i));return{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Og(e,t){return!$t(e)||Ht(e).position==="fixed"?null:t?t(e):e.offsetParent}function Cg(e,t){const n=Ct(e);if(!$t(e))return n;let s=Og(e,t);for(;s&&GT(s)&&Ht(s).position==="static";)s=Og(s,t);return s&&(pr(s)==="html"||pr(s)==="body"&&Ht(s).position==="static"&&!Ou(s))?n:s||YT(e)||n}const TO=async function(e){let{reference:t,floating:n,strategy:s}=e;const i=this.getOffsetParent||Cg,l=this.getDimensions;return{reference:RO(t,await i(n),s),floating:{x:0,y:0,...await l(n)}}};function OO(e){return Ht(e).direction==="rtl"}const CO={convertOffsetParentRelativeRectToViewportRelativeRect:yO,getDocumentElement:Bn,getClippingRect:wO,getOffsetParent:Cg,getElementRects:TO,getClientRects:EO,getDimensions:NO,getScale:Ho,isElement:$e,isRTL:OO};function AO(e,t){let n=null,s;const i=Bn(e);function l(){clearTimeout(s),n&&n.disconnect(),n=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),l();const{left:p,top:m,width:y,height:E}=e.getBoundingClientRect();if(u||t(),!y||!E)return;const x=bl(m),_=bl(i.clientWidth-(p+y)),w=bl(i.clientHeight-(m+E)),S=bl(p),R={rootMargin:-x+"px "+-_+"px "+-w+"px "+-S+"px",threshold:Yr(0,$o(1,f))||1};let P=!0;function C(I){const L=I[0].intersectionRatio;if(L!==f){if(!P)return c();L?c(!1,L):s=setTimeout(()=>{c(!1,1e-7)},100)}P=!1}try{n=new IntersectionObserver(C,{...R,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,R)}n.observe(e)}return c(!0),l}function IO(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,p=ku(e),m=i||l?[...p?hr(p):[],...hr(t)]:[];m.forEach(N=>{i&&N.addEventListener("scroll",n,{passive:!0}),l&&N.addEventListener("resize",n)});const y=p&&u?AO(p,n):null;let E=-1,x=null;c&&(x=new ResizeObserver(N=>{let[R]=N;R&&R.target===p&&x&&(x.unobserve(t),cancelAnimationFrame(E),E=requestAnimationFrame(()=>{x&&x.observe(t)})),n()}),p&&!f&&x.observe(p),x.observe(t));let _,w=f?Xr(e):null;f&&S();function S(){const N=Xr(e);w&&(N.x!==w.x||N.y!==w.y||N.width!==w.width||N.height!==w.height)&&n(),w=N,_=requestAnimationFrame(S)}return n(),()=>{m.forEach(N=>{i&&N.removeEventListener("scroll",n),l&&N.removeEventListener("resize",n)}),y&&y(),x&&x.disconnect(),x=null,f&&cancelAnimationFrame(_)}}const bO=(e,t,n)=>{const s=new Map,i={platform:CO,...n},l={...i.platform,_c:s};return uO(e,t,{...i,platform:l})},LO=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:i}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Sg({element:s.current,padding:i}).fn(n):{}:s?Sg({element:s,padding:i}).fn(n):{}}}};var Pl=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Ml(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!Ml(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=n;s--!==0;){const l=i[s];if(!(l==="_owner"&&e.$$typeof)&&!Ml(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Ag(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ig(e,t){const n=Ag(e);return Math.round(t*n)/n}function bg(e){const t=b.useRef(e);return Pl(()=>{t.current=e}),t}function DO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:i,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:f,open:p}=e,[m,y]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[E,x]=b.useState(s);Ml(E,s)||x(s);const[_,w]=b.useState(null),[S,N]=b.useState(null),R=b.useCallback($=>{$!=L.current&&(L.current=$,w($))},[w]),P=b.useCallback($=>{$!==U.current&&(U.current=$,N($))},[N]),C=l||_,I=c||S,L=b.useRef(null),U=b.useRef(null),G=b.useRef(m),X=bg(f),H=bg(i),q=b.useCallback(()=>{if(!L.current||!U.current)return;const $={placement:t,strategy:n,middleware:E};H.current&&($.platform=H.current),bO(L.current,U.current,$).then(Y=>{const M={...Y,isPositioned:!0};ee.current&&!Ml(G.current,M)&&(G.current=M,Bc.flushSync(()=>{y(M)}))})},[E,t,n,H]);Pl(()=>{p===!1&&G.current.isPositioned&&(G.current.isPositioned=!1,y($=>({...$,isPositioned:!1})))},[p]);const ee=b.useRef(!1);Pl(()=>(ee.current=!0,()=>{ee.current=!1}),[]),Pl(()=>{if(C&&(L.current=C),I&&(U.current=I),C&&I){if(X.current)return X.current(C,I,q);q()}},[C,I,q,X]);const z=b.useMemo(()=>({reference:L,floating:U,setReference:R,setFloating:P}),[R,P]),A=b.useMemo(()=>({reference:C,floating:I}),[C,I]),F=b.useMemo(()=>{const $={position:n,left:0,top:0};if(!A.floating)return $;const Y=Ig(A.floating,m.x),M=Ig(A.floating,m.y);return u?{...$,transform:"translate("+Y+"px, "+M+"px)",...Ag(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:M}},[n,u,A.floating,m.x,m.y]);return b.useMemo(()=>({...m,update:q,refs:z,elements:A,floatingStyles:F}),[m,q,z,A,F])}function Lg(e){return b.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e)}const kO=tp.useInsertionEffect||(e=>e());function Bo(e){const t=b.useRef(()=>{});return kO(()=>{t.current=e}),b.useCallback(function(){for(var n=arguments.length,s=new Array(n),i=0;i<n;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}var Js=typeof document<"u"?b.useLayoutEffect:b.useEffect;let Pu=!1,PO=0;const Dg=()=>"floating-ui-"+PO++;function MO(){const[e,t]=b.useState(()=>Pu?Dg():void 0);return Js(()=>{e==null&&t(Dg())},[]),b.useEffect(()=>{Pu||(Pu=!0)},[]),e}const kg=tp.useId||MO;function jO(){const e=new Map;return{emit(t,n){var s;(s=e.get(t))==null||s.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var s;e.set(t,((s=e.get(t))==null?void 0:s.filter(i=>i!==n))||[])}}}const UO=b.createContext(null),FO=b.createContext(null),Mu=()=>{var e;return((e=b.useContext(UO))==null?void 0:e.id)||null},ju=()=>b.useContext(FO);function Uu(e){return"data-floating-ui-"+e}function Pg(e){const t=b.useRef(e);return Js(()=>{t.current=e}),t}const Mg=Uu("safe-polygon");function Fu(e,t,n){return n&&!gg(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function VO(e,t){t===void 0&&(t={});const{open:n,onOpenChange:s,dataRef:i,events:l,elements:{domReference:c,floating:u},refs:f}=e,{enabled:p=!0,delay:m=0,handleClose:y=null,mouseOnly:E=!1,restMs:x=0,move:_=!0}=t,w=ju(),S=Mu(),N=Pg(y),R=Pg(m),P=b.useRef(),C=b.useRef(),I=b.useRef(),L=b.useRef(),U=b.useRef(!0),G=b.useRef(!1),X=b.useRef(()=>{}),H=b.useCallback(()=>{var A;const F=(A=i.current.openEvent)==null?void 0:A.type;return(F==null?void 0:F.includes("mouse"))&&F!=="mousedown"},[i]);b.useEffect(()=>{if(!p)return;function A(F){let{open:$}=F;$||(clearTimeout(C.current),clearTimeout(L.current),U.current=!0)}return l.on("openchange",A),()=>{l.off("openchange",A)}},[p,l]),b.useEffect(()=>{if(!p||!N.current||!n)return;function A($){H()&&s(!1,$,"hover")}const F=Wr(u).documentElement;return F.addEventListener("mouseleave",A),()=>{F.removeEventListener("mouseleave",A)}},[u,n,s,p,N,i,H]);const q=b.useCallback(function(A,F,$){F===void 0&&(F=!0),$===void 0&&($="hover");const Y=Fu(R.current,"close",P.current);Y&&!I.current?(clearTimeout(C.current),C.current=setTimeout(()=>s(!1,A,$),Y)):F&&(clearTimeout(C.current),s(!1,A,$))},[R,s]),ee=b.useCallback(()=>{X.current(),I.current=void 0},[]),z=b.useCallback(()=>{if(G.current){const A=Wr(f.floating.current).body;A.style.pointerEvents="",A.removeAttribute(Mg),G.current=!1}},[f]);return b.useEffect(()=>{if(!p)return;function A(){return i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1}function F(M){if(clearTimeout(C.current),U.current=!1,E&&!gg(P.current)||x>0&&Fu(R.current,"open")===0)return;const V=Fu(R.current,"open",P.current);V?C.current=setTimeout(()=>{s(!0,M,"hover")},V):s(!0,M,"hover")}function $(M){if(A())return;X.current();const V=Wr(u);if(clearTimeout(L.current),N.current){n||clearTimeout(C.current),I.current=N.current({...e,tree:w,x:M.clientX,y:M.clientY,onClose(){z(),ee(),q(M,!0,"safe-polygon")}});const D=I.current;V.addEventListener("mousemove",D),X.current=()=>{V.removeEventListener("mousemove",D)};return}(P.current==="touch"?!mr(u,M.relatedTarget):!0)&&q(M)}function Y(M){A()||N.current==null||N.current({...e,tree:w,x:M.clientX,y:M.clientY,onClose(){z(),ee(),q(M)}})(M)}if($e(c)){const M=c;return n&&M.addEventListener("mouseleave",Y),u==null||u.addEventListener("mouseleave",Y),_&&M.addEventListener("mousemove",F,{once:!0}),M.addEventListener("mouseenter",F),M.addEventListener("mouseleave",$),()=>{n&&M.removeEventListener("mouseleave",Y),u==null||u.removeEventListener("mouseleave",Y),_&&M.removeEventListener("mousemove",F),M.removeEventListener("mouseenter",F),M.removeEventListener("mouseleave",$)}}},[c,u,p,e,E,x,_,q,ee,z,s,n,w,R,N,i]),Js(()=>{var A;if(p&&n&&(A=N.current)!=null&&A.__options.blockPointerEvents&&H()){const $=Wr(u).body;if($.setAttribute(Mg,""),$.style.pointerEvents="none",G.current=!0,$e(c)&&u){var F;const Y=c,M=w==null||(F=w.nodesRef.current.find(V=>V.id===S))==null||(F=F.context)==null?void 0:F.elements.floating;return M&&(M.style.pointerEvents=""),Y.style.pointerEvents="auto",u.style.pointerEvents="auto",()=>{Y.style.pointerEvents="",u.style.pointerEvents=""}}}},[p,n,S,u,c,w,N,i,H]),Js(()=>{n||(P.current=void 0,ee(),z())},[n,ee,z]),b.useEffect(()=>()=>{ee(),clearTimeout(C.current),clearTimeout(L.current),z()},[p,c,ee,z]),b.useMemo(()=>{if(!p)return{};function A(F){P.current=F.pointerType}return{reference:{onPointerDown:A,onPointerEnter:A,onMouseMove(F){n||x===0||(clearTimeout(L.current),L.current=setTimeout(()=>{U.current||s(!0,F.nativeEvent,"hover")},x))}},floating:{onMouseEnter(){clearTimeout(C.current)},onMouseLeave(F){q(F.nativeEvent,!1)}}}},[p,x,n,s,q])}function jl(e,t){let n=e.filter(i=>{var l;return i.parentId===t&&((l=i.context)==null?void 0:l.open)}),s=n;for(;s.length;)s=e.filter(i=>{var l;return(l=s)==null?void 0:l.some(c=>{var u;return i.parentId===c.id&&((u=i.context)==null?void 0:u.open)})}),n=n.concat(s);return n}const $O={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},HO={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},jg=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function BO(e,t){t===void 0&&(t={});const{open:n,onOpenChange:s,nodeId:i,elements:{reference:l,domReference:c,floating:u},dataRef:f}=e,{enabled:p=!0,escapeKey:m=!0,outsidePress:y=!0,outsidePressEvent:E="pointerdown",referencePress:x=!1,referencePressEvent:_="pointerdown",ancestorScroll:w=!1,bubbles:S,capture:N}=t,R=ju(),P=Bo(typeof y=="function"?y:()=>!1),C=typeof y=="function"?P:y,I=b.useRef(!1),L=b.useRef(!1),{escapeKey:U,outsidePress:G}=jg(S),{escapeKey:X,outsidePress:H}=jg(N),q=Bo(F=>{if(!n||!p||!m||F.key!=="Escape")return;const $=R?jl(R.nodesRef.current,i):[];if(!U&&(F.stopPropagation(),$.length>0)){let Y=!0;if($.forEach(M=>{var V;if((V=M.context)!=null&&V.open&&!M.context.dataRef.current.__escapeKeyBubbles){Y=!1;return}}),!Y)return}s(!1,ZT(F)?F.nativeEvent:F,"escape-key")}),ee=Bo(F=>{var $;const Y=()=>{var M;q(F),(M=Gr(F))==null||M.removeEventListener("keydown",Y)};($=Gr(F))==null||$.addEventListener("keydown",Y)}),z=Bo(F=>{const $=I.current;I.current=!1;const Y=L.current;if(L.current=!1,E==="click"&&Y||$||typeof C=="function"&&!C(F))return;const M=Gr(F),V="["+Uu("inert")+"]",B=Wr(u).querySelectorAll(V);let D=$e(M)?M:null;for(;D&&!Vo(D);){const re=zr(D);if(Vo(re)||!$e(re))break;D=re}if(B.length&&$e(M)&&!eO(M)&&!mr(M,u)&&Array.from(B).every(re=>!mr(D,re)))return;if($t(M)&&u){const re=M.clientWidth>0&&M.scrollWidth>M.clientWidth,le=M.clientHeight>0&&M.scrollHeight>M.clientHeight;let ue=le&&F.offsetX>M.clientWidth;if(le&&Ht(M).direction==="rtl"&&(ue=F.offsetX<=M.offsetWidth-M.clientWidth),ue||re&&F.offsetY>M.clientHeight)return}const Q=R&&jl(R.nodesRef.current,i).some(re=>{var le;return Au(F,(le=re.context)==null?void 0:le.elements.floating)});if(Au(F,u)||Au(F,c)||Q)return;const oe=R?jl(R.nodesRef.current,i):[];if(oe.length>0){let re=!0;if(oe.forEach(le=>{var ue;if((ue=le.context)!=null&&ue.open&&!le.context.dataRef.current.__outsidePressBubbles){re=!1;return}}),!re)return}s(!1,F,"outside-press")}),A=Bo(F=>{var $;const Y=()=>{var M;z(F),(M=Gr(F))==null||M.removeEventListener(E,Y)};($=Gr(F))==null||$.addEventListener(E,Y)});return b.useEffect(()=>{if(!n||!p)return;f.current.__escapeKeyBubbles=U,f.current.__outsidePressBubbles=G;function F(M){s(!1,M,"ancestor-scroll")}const $=Wr(u);m&&$.addEventListener("keydown",X?ee:q,X),C&&$.addEventListener(E,H?A:z,H);let Y=[];return w&&($e(c)&&(Y=hr(c)),$e(u)&&(Y=Y.concat(hr(u))),!$e(l)&&l&&l.contextElement&&(Y=Y.concat(hr(l.contextElement)))),Y=Y.filter(M=>{var V;return M!==((V=$.defaultView)==null?void 0:V.visualViewport)}),Y.forEach(M=>{M.addEventListener("scroll",F,{passive:!0})}),()=>{m&&$.removeEventListener("keydown",X?ee:q,X),C&&$.removeEventListener(E,H?A:z,H),Y.forEach(M=>{M.removeEventListener("scroll",F)})}},[f,u,c,l,m,C,E,n,s,w,p,U,G,q,X,ee,z,H,A]),b.useEffect(()=>{I.current=!1},[C,E]),b.useMemo(()=>p?{reference:{onKeyDown:q,[$O[_]]:F=>{x&&s(!1,F.nativeEvent,"reference-press")}},floating:{onKeyDown:q,onMouseDown(){L.current=!0},onMouseUp(){L.current=!0},[HO[E]]:()=>{I.current=!0}}}:{},[p,x,E,_,s,q])}function zO(e){var t;e===void 0&&(e={});const{open:n=!1,onOpenChange:s,nodeId:i}=e,[l,c]=b.useState(null),u=((t=e.elements)==null?void 0:t.reference)||l,f=DO(e),p=ju(),m=Mu()!=null,y=Bo((I,L,U)=>{I&&(x.current.openEvent=L),_.emit("openchange",{open:I,event:L,reason:U,nested:m}),s==null||s(I,L,U)}),E=b.useRef(null),x=b.useRef({}),_=b.useState(()=>jO())[0],w=kg(),S=b.useCallback(I=>{const L=$e(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),contextElement:I}:I;f.refs.setReference(L)},[f.refs]),N=b.useCallback(I=>{($e(I)||I===null)&&(E.current=I,c(I)),($e(f.refs.reference.current)||f.refs.reference.current===null||I!==null&&!$e(I))&&f.refs.setReference(I)},[f.refs]),R=b.useMemo(()=>({...f.refs,setReference:N,setPositionReference:S,domReference:E}),[f.refs,N,S]),P=b.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),C=b.useMemo(()=>({...f,refs:R,elements:P,dataRef:x,nodeId:i,floatingId:w,events:_,open:n,onOpenChange:y}),[f,i,w,_,n,y,R,P]);return Js(()=>{const I=p==null?void 0:p.nodesRef.current.find(L=>L.id===i);I&&(I.context=C)}),b.useMemo(()=>({...f,context:C,refs:R,elements:P}),[f,R,P,C])}function WO(e,t){t===void 0&&(t={});const{open:n,onOpenChange:s,events:i,refs:l,elements:{floating:c,domReference:u}}=e,{enabled:f=!0,visibleOnly:p=!0}=t,m=b.useRef(!1),y=b.useRef(),E=b.useRef(!0);return b.useEffect(()=>{if(!f)return;const x=Ct(u);function _(){!n&&$t(u)&&u===hg(Wr(u))&&(m.current=!0)}function w(){E.current=!0}return x.addEventListener("blur",_),x.addEventListener("keydown",w,!0),()=>{x.removeEventListener("blur",_),x.removeEventListener("keydown",w,!0)}},[c,u,n,f]),b.useEffect(()=>{if(!f)return;function x(_){let{reason:w}=_;(w==="reference-press"||w==="escape-key")&&(m.current=!0)}return i.on("openchange",x),()=>{i.off("openchange",x)}},[i,f]),b.useEffect(()=>()=>{clearTimeout(y.current)},[]),b.useMemo(()=>f?{reference:{onPointerDown(x){XT(x.nativeEvent)||(E.current=!1)},onMouseLeave(){m.current=!1},onFocus(x){if(m.current)return;const _=Gr(x.nativeEvent);if(p&&$e(_))try{if(QT()&&JT())throw Error();if(!_.matches(":focus-visible"))return}catch{if(!E.current&&!nO(_))return}s(!0,x.nativeEvent,"focus")},onBlur(x){m.current=!1;const _=x.relatedTarget,w=$e(_)&&_.hasAttribute(Uu("focus-guard"))&&_.getAttribute("data-type")==="outside";y.current=window.setTimeout(()=>{const S=hg(u?u.ownerDocument:document);!_&&S===u||mr(l.floating.current,_)||mr(u,_)||w||s(!1,x.nativeEvent,"focus")})}}}:{},[f,p,u,l,s])}const Ug="active",Fg="selected";function Vu(e,t,n){const s=new Map,i=n==="item";let l=e;if(i&&e){const{[Ug]:c,[Fg]:u,...f}=e;l=f}return{...n==="floating"&&{tabIndex:-1},...l,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(f=>{let[p,m]=f;if(!(i&&[Ug,Fg].includes(p)))if(p.indexOf("on")===0){if(s.has(p)||s.set(p,[]),typeof m=="function"){var y;(y=s.get(p))==null||y.push(m),c[p]=function(){for(var E,x=arguments.length,_=new Array(x),w=0;w<x;w++)_[w]=arguments[w];return(E=s.get(p))==null?void 0:E.map(S=>S(..._)).find(S=>S!==void 0)}}}else c[p]=m}),c),{})}}function GO(e){e===void 0&&(e=[]);const t=e,n=b.useCallback(l=>Vu(l,e,"reference"),t),s=b.useCallback(l=>Vu(l,e,"floating"),t),i=b.useCallback(l=>Vu(l,e,"item"),e.map(l=>l==null?void 0:l.item));return b.useMemo(()=>({getReferenceProps:n,getFloatingProps:s,getItemProps:i}),[n,s,i])}const YO=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function KO(e,t){var n;t===void 0&&(t={});const{open:s,floatingId:i}=e,{enabled:l=!0,role:c="dialog"}=t,u=(n=YO.get(c))!=null?n:c,f=kg(),m=Mu()!=null;return b.useMemo(()=>{if(!l)return{};const y={id:i,...u&&{role:u}};return u==="tooltip"||c==="label"?{reference:{["aria-"+(c==="label"?"labelledby":"describedby")]:s?i:void 0},floating:y}:{reference:{"aria-expanded":s?"true":"false","aria-haspopup":u==="alertdialog"?"dialog":u,"aria-controls":s?i:void 0,...u==="listbox"&&{role:"combobox"},...u==="menu"&&{id:f},...u==="menu"&&m&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},floating:{...y,...u==="menu"&&{"aria-labelledby":f}},item(E){let{active:x,selected:_}=E;const w={role:"option",...x&&{id:i+"-option"}};switch(c){case"select":return{...w,"aria-selected":x&&_};case"combobox":return{...w,...x&&{"aria-selected":!0}}}return{}}}},[l,c,u,s,i,f,m])}function Vg(e,t){const[n,s]=e;let i=!1;const l=t.length;for(let c=0,u=l-1;c<l;u=c++){const[f,p]=t[c]||[0,0],[m,y]=t[u]||[0,0];p>=s!=y>=s&&n<=(m-f)*(s-p)/(y-p)+f&&(i=!i)}return i}function XO(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function QO(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:s=!0}=e;let i,l=!1,c=null,u=null,f=performance.now();function p(y,E){const x=performance.now(),_=x-f;if(c===null||u===null||_===0)return c=y,u=E,f=x,null;const w=y-c,S=E-u,R=Math.sqrt(w*w+S*S)/_;return c=y,u=E,f=x,R}const m=y=>{let{x:E,y:x,placement:_,elements:w,onClose:S,nodeId:N,tree:R}=y;return function(C){function I(){clearTimeout(i),S()}if(clearTimeout(i),!w.domReference||!w.floating||_==null||E==null||x==null)return;const{clientX:L,clientY:U}=C,G=[L,U],X=Gr(C),H=C.type==="mouseleave",q=mr(w.floating,X),ee=mr(w.domReference,X),z=w.domReference.getBoundingClientRect(),A=w.floating.getBoundingClientRect(),F=_.split("-")[0],$=E>A.right-A.width/2,Y=x>A.bottom-A.height/2,M=XO(G,z),V=A.width>z.width,B=A.height>z.height,D=(V?z:A).left,Q=(V?z:A).right,oe=(B?z:A).top,re=(B?z:A).bottom;if(q&&(l=!0,!H))return;if(ee&&(l=!1),ee&&!H){l=!0;return}if(H&&$e(C.relatedTarget)&&mr(w.floating,C.relatedTarget)||R&&jl(R.nodesRef.current,N).some(fe=>{let{context:de}=fe;return de==null?void 0:de.open}))return;if(F==="top"&&x>=z.bottom-1||F==="bottom"&&x<=z.top+1||F==="left"&&E>=z.right-1||F==="right"&&E<=z.left+1)return I();let le=[];switch(F){case"top":le=[[D,z.top+1],[D,A.bottom-1],[Q,A.bottom-1],[Q,z.top+1]];break;case"bottom":le=[[D,A.top+1],[D,z.bottom-1],[Q,z.bottom-1],[Q,A.top+1]];break;case"left":le=[[A.right-1,re],[A.right-1,oe],[z.left+1,oe],[z.left+1,re]];break;case"right":le=[[z.right-1,re],[z.right-1,oe],[A.left+1,oe],[A.left+1,re]];break}function ue(fe){let[de,me]=fe;switch(F){case"top":{const Re=[V?de+t/2:$?de+t*4:de-t*4,me+t+1],Me=[V?de-t/2:$?de+t*4:de-t*4,me+t+1],Ze=[[A.left,$||V?A.bottom-t:A.top],[A.right,$?V?A.bottom-t:A.top:A.bottom-t]];return[Re,Me,...Ze]}case"bottom":{const Re=[V?de+t/2:$?de+t*4:de-t*4,me-t],Me=[V?de-t/2:$?de+t*4:de-t*4,me-t],Ze=[[A.left,$||V?A.top+t:A.bottom],[A.right,$?V?A.top+t:A.bottom:A.top+t]];return[Re,Me,...Ze]}case"left":{const Re=[de+t+1,B?me+t/2:Y?me+t*4:me-t*4],Me=[de+t+1,B?me-t/2:Y?me+t*4:me-t*4];return[...[[Y||B?A.right-t:A.left,A.top],[Y?B?A.right-t:A.left:A.right-t,A.bottom]],Re,Me]}case"right":{const Re=[de-t,B?me+t/2:Y?me+t*4:me-t*4],Me=[de-t,B?me-t/2:Y?me+t*4:me-t*4],Ze=[[Y||B?A.left+t:A.right,A.top],[Y?B?A.left+t:A.right:A.left+t,A.bottom]];return[Re,Me,...Ze]}}}if(!Vg([L,U],le)){if(l&&!M)return I();if(!H&&s){const fe=p(C.clientX,C.clientY);if(fe!==null&&fe<.1)return I()}Vg([L,U],ue([E,x]))?!l&&s&&(i=window.setTimeout(I,40)):I()}}};return m.__options={blockPointerEvents:n},m}function qO({arrowPadding:e,escapeKey:t=!0,initialOpen:n=!1,keepOpenOverContent:s=!1,onOpenChange:i,open:l,outsidePress:c=!0,placement:u,role:f="tooltip"}){const p=Ee(L=>L.rootElementId),m=b.useRef(null),[y,E]=b.useState(n),x=l??y,_=i??E,w=zO({middleware:[pO(8),dO({boundary:document.querySelector(`#${p}`)||void 0}),hO({padding:4}),LO({element:m,padding:e??{bottom:0,left:8,right:8,top:8}})],onOpenChange:_,open:x,placement:u,strategy:"fixed",whileElementsMounted:IO}),S=w.context,N=VO(S,{enabled:l==null,handleClose:s?QO():null,move:!1}),R=WO(S,{enabled:l==null}),P=BO(S,{escapeKey:t,outsidePress:c}),C=KO(S,{role:f}),I=GO([N,R,P,C]);return b.useMemo(()=>({arrowRef:m,open:x,setOpen:_,...I,...w}),[x,_,I,w])}const $g=ne.createContext(null),$u=()=>{const e=ne.useContext($g);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},JO=({children:e,...t})=>{const n=qO(t);return h.jsx($g.Provider,{value:n,children:e})},ZO={bottom:"-top-1 before:border-b-0 before:border-r-0",left:"-right-1 before:border-r-0 before:border-t-0",right:"-left-1 before:border-l-0 before:border-b-0",top:"-bottom-1 before:border-t-0 before:border-l-0"},eC=()=>{var c,u;const e=$u(),[t,n]=b.useState(e.middlewareData.arrow);b.useEffect(()=>{e.middlewareData.arrow&&n(e.middlewareData.arrow)},[e.middlewareData.arrow]);const s={left:(t==null?void 0:t.x)!=null?`${t==null?void 0:t.x}px`:"",top:(t==null?void 0:t.y)!=null?`${t==null?void 0:t.y}px`:""},i=((u=(c=e.placement)==null?void 0:c.split("-"))==null?void 0:u[0])||"top",l=`${ZO[i]}`;return h.jsx("div",{ref:e.arrowRef,style:s,className:`tooltip-arrow absolute h-2 w-2 rotate-45 bg-inherit
60
+ */var up;function Qv(){if(up)return _c;up=1;var e=xs(),t=Xv();function r(p,m){return p===m&&(p!==0||1/p===1/m)||p!==p&&m!==m}var s=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,c=e.useEffect,u=e.useMemo,f=e.useDebugValue;return _c.useSyncExternalStoreWithSelector=function(p,m,E,v,x){var _=a(null);if(_.current===null){var w={hasValue:!1,value:null};_.current=w}else w=_.current;_=u(function(){function N(L){if(!O){if(O=!0,D=L,L=v(L),x!==void 0&&w.hasValue){var F=w.value;if(x(F,L))return T=F}return T=L}if(F=T,s(D,L))return F;var K=v(L);return x!==void 0&&x(F,K)?F:(D=L,T=K)}var O=!1,D,T,A=E===void 0?null:E;return[function(){return N(m())},A===null?void 0:function(){return N(A())}]},[m,E,v,x]);var S=i(p,_[0],_[1]);return c(function(){w.hasValue=!0,w.value=S},[S]),f(S),S},_c}var dp;function qv(){return dp||(dp=1,Sc.exports=Qv()),Sc.exports}var Zv=qv();const fp=Hi(Zv),Jv={},pp=e=>{let t;const r=new Set,s=(f,p)=>{const m=typeof f=="function"?f(t):f;if(!Object.is(m,t)){const E=t;t=p??(typeof m!="object"||m===null)?m:Object.assign({},t,m),r.forEach(v=>v(t,E))}},i=()=>t,u={setState:s,getState:i,subscribe:f=>(r.add(f),()=>r.delete(f)),destroy:()=>{(Jv?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return t=e(s,i,u),u},hp=e=>e?pp(e):pp,{useDebugValue:ex}=te,{useSyncExternalStoreWithSelector:tx}=fp;function mp(e,t=e.getState,r){const s=tx(e.subscribe,e.getState,e.getServerState||e.getState,t,r);return ex(s),s}const gp=(e,t)=>{const r=hp(e),s=(i,a=t)=>mp(r,i,a);return Object.assign(s,r),s},nx=(e,t)=>e?gp(e,t):gp;function gt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[s,i]of e)if(!Object.is(i,t.get(s)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=0;s<r.length;s++)if(!Object.prototype.hasOwnProperty.call(t,r[s])||!Object.is(e[r[s]],t[r[s]]))return!1;return!0}var rx={value:()=>{}};function Wi(){for(var e=0,t=arguments.length,r={},s;e<t;++e){if(!(s=arguments[e]+"")||s in r||/[\s.]/.test(s))throw new Error("illegal type: "+s);r[s]=[]}return new Gi(r)}function Gi(e){this._=e}function ox(e,t){return e.trim().split(/^|\s+/).map(function(r){var s="",i=r.indexOf(".");if(i>=0&&(s=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:s}})}Gi.prototype=Wi.prototype={constructor:Gi,on:function(e,t){var r=this._,s=ox(e+"",r),i,a=-1,c=s.length;if(arguments.length<2){for(;++a<c;)if((i=(e=s[a]).type)&&(i=sx(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<c;)if(i=(e=s[a]).type)r[i]=Ep(r[i],e.name,t);else if(t==null)for(i in r)r[i]=Ep(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Gi(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),s=0,i,a;s<i;++s)r[s]=arguments[s+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],s=0,i=a.length;s<i;++s)a[s].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var s=this._[e],i=0,a=s.length;i<a;++i)s[i].value.apply(t,r)}};function sx(e,t){for(var r=0,s=e.length,i;r<s;++r)if((i=e[r]).name===t)return i.value}function Ep(e,t,r){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=rx,e=e.slice(0,s).concat(e.slice(s+1));break}return r!=null&&e.push({name:t,value:r}),e}var Rc="http://www.w3.org/1999/xhtml";const yp={svg:"http://www.w3.org/2000/svg",xhtml:Rc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Yi(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),yp.hasOwnProperty(t)?{space:yp[t],local:e}:e}function ix(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Rc&&t.documentElement.namespaceURI===Rc?t.createElement(e):t.createElementNS(r,e)}}function lx(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vp(e){var t=Yi(e);return(t.local?lx:ix)(t)}function ax(){}function Tc(e){return e==null?ax:function(){return this.querySelector(e)}}function cx(e){typeof e!="function"&&(e=Tc(e));for(var t=this._groups,r=t.length,s=new Array(r),i=0;i<r;++i)for(var a=t[i],c=a.length,u=s[i]=new Array(c),f,p,m=0;m<c;++m)(f=a[m])&&(p=e.call(f,f.__data__,m,a))&&("__data__"in f&&(p.__data__=f.__data__),u[m]=p);return new Ft(s,this._parents)}function ux(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dx(){return[]}function xp(e){return e==null?dx:function(){return this.querySelectorAll(e)}}function fx(e){return function(){return ux(e.apply(this,arguments))}}function px(e){typeof e=="function"?e=fx(e):e=xp(e);for(var t=this._groups,r=t.length,s=[],i=[],a=0;a<r;++a)for(var c=t[a],u=c.length,f,p=0;p<u;++p)(f=c[p])&&(s.push(e.call(f,f.__data__,p,c)),i.push(f));return new Ft(s,i)}function Sp(e){return function(){return this.matches(e)}}function _p(e){return function(t){return t.matches(e)}}var hx=Array.prototype.find;function mx(e){return function(){return hx.call(this.children,e)}}function gx(){return this.firstElementChild}function Ex(e){return this.select(e==null?gx:mx(typeof e=="function"?e:_p(e)))}var yx=Array.prototype.filter;function vx(){return Array.from(this.children)}function xx(e){return function(){return yx.call(this.children,e)}}function Sx(e){return this.selectAll(e==null?vx:xx(typeof e=="function"?e:_p(e)))}function _x(e){typeof e!="function"&&(e=Sp(e));for(var t=this._groups,r=t.length,s=new Array(r),i=0;i<r;++i)for(var a=t[i],c=a.length,u=s[i]=[],f,p=0;p<c;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&u.push(f);return new Ft(s,this._parents)}function wp(e){return new Array(e.length)}function wx(){return new Ft(this._enter||this._groups.map(wp),this._parents)}function Ki(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ki.prototype={constructor:Ki,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Nx(e){return function(){return e}}function Rx(e,t,r,s,i,a){for(var c=0,u,f=t.length,p=a.length;c<p;++c)(u=t[c])?(u.__data__=a[c],s[c]=u):r[c]=new Ki(e,a[c]);for(;c<f;++c)(u=t[c])&&(i[c]=u)}function Tx(e,t,r,s,i,a,c){var u,f,p=new Map,m=t.length,E=a.length,v=new Array(m),x;for(u=0;u<m;++u)(f=t[u])&&(v[u]=x=c.call(f,f.__data__,u,t)+"",p.has(x)?i[u]=f:p.set(x,f));for(u=0;u<E;++u)x=c.call(e,a[u],u,a)+"",(f=p.get(x))?(s[u]=f,f.__data__=a[u],p.delete(x)):r[u]=new Ki(e,a[u]);for(u=0;u<m;++u)(f=t[u])&&p.get(v[u])===f&&(i[u]=f)}function Ox(e){return e.__data__}function Cx(e,t){if(!arguments.length)return Array.from(this,Ox);var r=t?Tx:Rx,s=this._parents,i=this._groups;typeof e!="function"&&(e=Nx(e));for(var a=i.length,c=new Array(a),u=new Array(a),f=new Array(a),p=0;p<a;++p){var m=s[p],E=i[p],v=E.length,x=Ax(e.call(m,m&&m.__data__,p,s)),_=x.length,w=u[p]=new Array(_),S=c[p]=new Array(_),N=f[p]=new Array(v);r(m,E,w,S,N,x,t);for(var O=0,D=0,T,A;O<_;++O)if(T=w[O]){for(O>=D&&(D=O+1);!(A=S[D])&&++D<_;);T._next=A||null}}return c=new Ft(c,s),c._enter=u,c._exit=f,c}function Ax(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ix(){return new Ft(this._exit||this._groups.map(wp),this._parents)}function bx(e,t,r){var s=this.enter(),i=this,a=this.exit();return typeof e=="function"?(s=e(s),s&&(s=s.selection())):s=s.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),s&&i?s.merge(i).order():i}function Lx(e){for(var t=e.selection?e.selection():e,r=this._groups,s=t._groups,i=r.length,a=s.length,c=Math.min(i,a),u=new Array(i),f=0;f<c;++f)for(var p=r[f],m=s[f],E=p.length,v=u[f]=new Array(E),x,_=0;_<E;++_)(x=p[_]||m[_])&&(v[_]=x);for(;f<i;++f)u[f]=r[f];return new Ft(u,this._parents)}function Dx(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var s=e[t],i=s.length-1,a=s[i],c;--i>=0;)(c=s[i])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function kx(e){e||(e=Mx);function t(E,v){return E&&v?e(E.__data__,v.__data__):!E-!v}for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a){for(var c=r[a],u=c.length,f=i[a]=new Array(u),p,m=0;m<u;++m)(p=c[m])&&(f[m]=p);f.sort(t)}return new Ft(i,this._parents).order()}function Mx(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Px(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ux(){return Array.from(this)}function Fx(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var s=e[t],i=0,a=s.length;i<a;++i){var c=s[i];if(c)return c}return null}function jx(){let e=0;for(const t of this)++e;return e}function Vx(){return!this.node()}function $x(e){for(var t=this._groups,r=0,s=t.length;r<s;++r)for(var i=t[r],a=0,c=i.length,u;a<c;++a)(u=i[a])&&e.call(u,u.__data__,a,i);return this}function Hx(e){return function(){this.removeAttribute(e)}}function Bx(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zx(e,t){return function(){this.setAttribute(e,t)}}function Wx(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gx(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Yx(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function Kx(e,t){var r=Yi(e);if(arguments.length<2){var s=this.node();return r.local?s.getAttributeNS(r.space,r.local):s.getAttribute(r)}return this.each((t==null?r.local?Bx:Hx:typeof t=="function"?r.local?Yx:Gx:r.local?Wx:zx)(r,t))}function Np(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xx(e){return function(){this.style.removeProperty(e)}}function Qx(e,t,r){return function(){this.style.setProperty(e,t,r)}}function qx(e,t,r){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,r)}}function Zx(e,t,r){return arguments.length>1?this.each((t==null?Xx:typeof t=="function"?qx:Qx)(e,t,r??"")):yo(this.node(),e)}function yo(e,t){return e.style.getPropertyValue(t)||Np(e).getComputedStyle(e,null).getPropertyValue(t)}function Jx(e){return function(){delete this[e]}}function eS(e,t){return function(){this[e]=t}}function tS(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function nS(e,t){return arguments.length>1?this.each((t==null?Jx:typeof t=="function"?tS:eS)(e,t)):this.node()[e]}function Rp(e){return e.trim().split(/^|\s+/)}function Oc(e){return e.classList||new Tp(e)}function Tp(e){this._node=e,this._names=Rp(e.getAttribute("class")||"")}Tp.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Op(e,t){for(var r=Oc(e),s=-1,i=t.length;++s<i;)r.add(t[s])}function Cp(e,t){for(var r=Oc(e),s=-1,i=t.length;++s<i;)r.remove(t[s])}function rS(e){return function(){Op(this,e)}}function oS(e){return function(){Cp(this,e)}}function sS(e,t){return function(){(t.apply(this,arguments)?Op:Cp)(this,e)}}function iS(e,t){var r=Rp(e+"");if(arguments.length<2){for(var s=Oc(this.node()),i=-1,a=r.length;++i<a;)if(!s.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?sS:t?rS:oS)(r,t))}function lS(){this.textContent=""}function aS(e){return function(){this.textContent=e}}function cS(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function uS(e){return arguments.length?this.each(e==null?lS:(typeof e=="function"?cS:aS)(e)):this.node().textContent}function dS(){this.innerHTML=""}function fS(e){return function(){this.innerHTML=e}}function pS(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function hS(e){return arguments.length?this.each(e==null?dS:(typeof e=="function"?pS:fS)(e)):this.node().innerHTML}function mS(){this.nextSibling&&this.parentNode.appendChild(this)}function gS(){return this.each(mS)}function ES(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function yS(){return this.each(ES)}function vS(e){var t=typeof e=="function"?e:vp(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function xS(){return null}function SS(e,t){var r=typeof e=="function"?e:vp(e),s=t==null?xS:typeof t=="function"?t:Tc(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),s.apply(this,arguments)||null)})}function _S(){var e=this.parentNode;e&&e.removeChild(this)}function wS(){return this.each(_S)}function NS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function RS(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function TS(e){return this.select(e?RS:NS)}function OS(e){return arguments.length?this.property("__data__",e):this.node().__data__}function CS(e){return function(t){e.call(this,t,this.__data__)}}function AS(e){return e.trim().split(/^|\s+/).map(function(t){var r="",s=t.indexOf(".");return s>=0&&(r=t.slice(s+1),t=t.slice(0,s)),{type:t,name:r}})}function IS(e){return function(){var t=this.__on;if(t){for(var r=0,s=-1,i=t.length,a;r<i;++r)a=t[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++s]=a;++s?t.length=s:delete this.__on}}}function bS(e,t,r){return function(){var s=this.__on,i,a=CS(t);if(s){for(var c=0,u=s.length;c<u;++c)if((i=s[c]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=r),i.value=t;return}}this.addEventListener(e.type,a,r),i={type:e.type,name:e.name,value:t,listener:a,options:r},s?s.push(i):this.__on=[i]}}function LS(e,t,r){var s=AS(e+""),i,a=s.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var f=0,p=u.length,m;f<p;++f)for(i=0,m=u[f];i<a;++i)if((c=s[i]).type===m.type&&c.name===m.name)return m.value}return}for(u=t?bS:IS,i=0;i<a;++i)this.each(u(s[i],t,r));return this}function Ap(e,t,r){var s=Np(e),i=s.CustomEvent;typeof i=="function"?i=new i(t,r):(i=s.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function DS(e,t){return function(){return Ap(this,e,t)}}function kS(e,t){return function(){return Ap(this,e,t.apply(this,arguments))}}function MS(e,t){return this.each((typeof t=="function"?kS:DS)(e,t))}function*PS(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var s=e[t],i=0,a=s.length,c;i<a;++i)(c=s[i])&&(yield c)}var Ip=[null];function Ft(e,t){this._groups=e,this._parents=t}function _s(){return new Ft([[document.documentElement]],Ip)}function US(){return this}Ft.prototype=_s.prototype={constructor:Ft,select:cx,selectAll:px,selectChild:Ex,selectChildren:Sx,filter:_x,data:Cx,enter:wx,exit:Ix,join:bx,merge:Lx,selection:US,order:Dx,sort:kx,call:Px,nodes:Ux,node:Fx,size:jx,empty:Vx,each:$x,attr:Kx,style:Zx,property:nS,classed:iS,text:uS,html:hS,raise:gS,lower:yS,append:vS,insert:SS,remove:wS,clone:TS,datum:OS,on:LS,dispatch:MS,[Symbol.iterator]:PS};function on(e){return typeof e=="string"?new Ft([[document.querySelector(e)]],[document.documentElement]):new Ft([[e]],Ip)}function FS(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _n(e,t){if(e=FS(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var s=r.createSVGPoint();return s.x=e.clientX,s.y=e.clientY,s=s.matrixTransform(t.getScreenCTM().inverse()),[s.x,s.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const jS={passive:!1},ws={capture:!0,passive:!1};function Cc(e){e.stopImmediatePropagation()}function vo(e){e.preventDefault(),e.stopImmediatePropagation()}function bp(e){var t=e.document.documentElement,r=on(e).on("dragstart.drag",vo,ws);"onselectstart"in t?r.on("selectstart.drag",vo,ws):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Lp(e,t){var r=e.document.documentElement,s=on(e).on("dragstart.drag",null);t&&(s.on("click.drag",vo,ws),setTimeout(function(){s.on("click.drag",null)},0)),"onselectstart"in r?s.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Xi=e=>()=>e;function Ac(e,{sourceEvent:t,subject:r,target:s,identifier:i,active:a,x:c,y:u,dx:f,dy:p,dispatch:m}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:f,enumerable:!0,configurable:!0},dy:{value:p,enumerable:!0,configurable:!0},_:{value:m}})}Ac.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function VS(e){return!e.ctrlKey&&!e.button}function $S(){return this.parentNode}function HS(e,t){return t??{x:e.x,y:e.y}}function BS(){return navigator.maxTouchPoints||"ontouchstart"in this}function zS(){var e=VS,t=$S,r=HS,s=BS,i={},a=Wi("start","drag","end"),c=0,u,f,p,m,E=0;function v(T){T.on("mousedown.drag",x).filter(s).on("touchstart.drag",S).on("touchmove.drag",N,jS).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,A){if(!(m||!e.call(this,T,A))){var L=D(this,t.call(this,T,A),T,A,"mouse");L&&(on(T.view).on("mousemove.drag",_,ws).on("mouseup.drag",w,ws),bp(T.view),Cc(T),p=!1,u=T.clientX,f=T.clientY,L("start",T))}}function _(T){if(vo(T),!p){var A=T.clientX-u,L=T.clientY-f;p=A*A+L*L>E}i.mouse("drag",T)}function w(T){on(T.view).on("mousemove.drag mouseup.drag",null),Lp(T.view,p),vo(T),i.mouse("end",T)}function S(T,A){if(e.call(this,T,A)){var L=T.changedTouches,F=t.call(this,T,A),K=L.length,Q,X;for(Q=0;Q<K;++Q)(X=D(this,F,T,A,L[Q].identifier,L[Q]))&&(Cc(T),X("start",T,L[Q]))}}function N(T){var A=T.changedTouches,L=A.length,F,K;for(F=0;F<L;++F)(K=i[A[F].identifier])&&(vo(T),K("drag",T,A[F]))}function O(T){var A=T.changedTouches,L=A.length,F,K;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),F=0;F<L;++F)(K=i[A[F].identifier])&&(Cc(T),K("end",T,A[F]))}function D(T,A,L,F,K,Q){var X=a.copy(),ee=_n(Q||L,A),ne,W,I;if((I=r.call(T,new Ac("beforestart",{sourceEvent:L,target:v,identifier:K,active:c,x:ee[0],y:ee[1],dx:0,dy:0,dispatch:X}),F))!=null)return ne=I.x-ee[0]||0,W=I.y-ee[1]||0,function V(j,B,U){var $=ee,z;switch(j){case"start":i[K]=V,z=c++;break;case"end":delete i[K],--c;case"drag":ee=_n(U||B,A),z=c;break}X.call(j,T,new Ac(j,{sourceEvent:B,subject:I,target:v,identifier:K,active:z,x:ee[0]+ne,y:ee[1]+W,dx:ee[0]-$[0],dy:ee[1]-$[1],dispatch:X}),F)}}return v.filter=function(T){return arguments.length?(e=typeof T=="function"?T:Xi(!!T),v):e},v.container=function(T){return arguments.length?(t=typeof T=="function"?T:Xi(T),v):t},v.subject=function(T){return arguments.length?(r=typeof T=="function"?T:Xi(T),v):r},v.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:Xi(!!T),v):s},v.on=function(){var T=a.on.apply(a,arguments);return T===a?v:T},v.clickDistance=function(T){return arguments.length?(E=(T=+T)*T,v):Math.sqrt(E)},v}function Ic(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Dp(e,t){var r=Object.create(e.prototype);for(var s in t)r[s]=t[s];return r}function Ns(){}var Rs=.7,Qi=1/Rs,xo="\\s*([+-]?\\d+)\\s*",Ts="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",WS=/^#([0-9a-f]{3,8})$/,GS=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),YS=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),KS=new RegExp(`^rgba\\(${xo},${xo},${xo},${Ts}\\)$`),XS=new RegExp(`^rgba\\(${wn},${wn},${wn},${Ts}\\)$`),QS=new RegExp(`^hsl\\(${Ts},${wn},${wn}\\)$`),qS=new RegExp(`^hsla\\(${Ts},${wn},${wn},${Ts}\\)$`),kp={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ic(Ns,Os,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Mp,formatHex:Mp,formatHex8:ZS,formatHsl:JS,formatRgb:Pp,toString:Pp});function Mp(){return this.rgb().formatHex()}function ZS(){return this.rgb().formatHex8()}function JS(){return $p(this).formatHsl()}function Pp(){return this.rgb().formatRgb()}function Os(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=WS.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Up(t):r===3?new Ot(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?qi(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?qi(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=GS.exec(e))?new Ot(t[1],t[2],t[3],1):(t=YS.exec(e))?new Ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=KS.exec(e))?qi(t[1],t[2],t[3],t[4]):(t=XS.exec(e))?qi(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=QS.exec(e))?Vp(t[1],t[2]/100,t[3]/100,1):(t=qS.exec(e))?Vp(t[1],t[2]/100,t[3]/100,t[4]):kp.hasOwnProperty(e)?Up(kp[e]):e==="transparent"?new Ot(NaN,NaN,NaN,0):null}function Up(e){return new Ot(e>>16&255,e>>8&255,e&255,1)}function qi(e,t,r,s){return s<=0&&(e=t=r=NaN),new Ot(e,t,r,s)}function e_(e){return e instanceof Ns||(e=Os(e)),e?(e=e.rgb(),new Ot(e.r,e.g,e.b,e.opacity)):new Ot}function bc(e,t,r,s){return arguments.length===1?e_(e):new Ot(e,t,r,s??1)}function Ot(e,t,r,s){this.r=+e,this.g=+t,this.b=+r,this.opacity=+s}Ic(Ot,bc,Dp(Ns,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Rs:Math.pow(Rs,e),new Ot(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ot(Fr(this.r),Fr(this.g),Fr(this.b),Zi(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Fp,formatHex:Fp,formatHex8:t_,formatRgb:jp,toString:jp}));function Fp(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}`}function t_(){return`#${jr(this.r)}${jr(this.g)}${jr(this.b)}${jr((isNaN(this.opacity)?1:this.opacity)*255)}`}function jp(){const e=Zi(this.opacity);return`${e===1?"rgb(":"rgba("}${Fr(this.r)}, ${Fr(this.g)}, ${Fr(this.b)}${e===1?")":`, ${e})`}`}function Zi(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function jr(e){return e=Fr(e),(e<16?"0":"")+e.toString(16)}function Vp(e,t,r,s){return s<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new sn(e,t,r,s)}function $p(e){if(e instanceof sn)return new sn(e.h,e.s,e.l,e.opacity);if(e instanceof Ns||(e=Os(e)),!e)return new sn;if(e instanceof sn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,s=e.b/255,i=Math.min(t,r,s),a=Math.max(t,r,s),c=NaN,u=a-i,f=(a+i)/2;return u?(t===a?c=(r-s)/u+(r<s)*6:r===a?c=(s-t)/u+2:c=(t-r)/u+4,u/=f<.5?a+i:2-a-i,c*=60):u=f>0&&f<1?0:c,new sn(c,u,f,e.opacity)}function n_(e,t,r,s){return arguments.length===1?$p(e):new sn(e,t,r,s??1)}function sn(e,t,r,s){this.h=+e,this.s=+t,this.l=+r,this.opacity=+s}Ic(sn,n_,Dp(Ns,{brighter(e){return e=e==null?Qi:Math.pow(Qi,e),new sn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Rs:Math.pow(Rs,e),new sn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,s=r+(r<.5?r:1-r)*t,i=2*r-s;return new Ot(Lc(e>=240?e-240:e+120,i,s),Lc(e,i,s),Lc(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new sn(Hp(this.h),Ji(this.s),Ji(this.l),Zi(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Zi(this.opacity);return`${e===1?"hsl(":"hsla("}${Hp(this.h)}, ${Ji(this.s)*100}%, ${Ji(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hp(e){return e=(e||0)%360,e<0?e+360:e}function Ji(e){return Math.max(0,Math.min(1,e||0))}function Lc(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Bp=e=>()=>e;function r_(e,t){return function(r){return e+r*t}}function o_(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(s){return Math.pow(e+s*t,r)}}function s_(e){return(e=+e)==1?zp:function(t,r){return r-t?o_(t,r,e):Bp(isNaN(t)?r:t)}}function zp(e,t){var r=t-e;return r?r_(e,r):Bp(isNaN(e)?t:e)}const Wp=function e(t){var r=s_(t);function s(i,a){var c=r((i=bc(i)).r,(a=bc(a)).r),u=r(i.g,a.g),f=r(i.b,a.b),p=zp(i.opacity,a.opacity);return function(m){return i.r=c(m),i.g=u(m),i.b=f(m),i.opacity=p(m),i+""}}return s.gamma=e,s}(1);function sr(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Dc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kc=new RegExp(Dc.source,"g");function i_(e){return function(){return e}}function l_(e){return function(t){return e(t)+""}}function a_(e,t){var r=Dc.lastIndex=kc.lastIndex=0,s,i,a,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Dc.exec(e))&&(i=kc.exec(t));)(a=i.index)>r&&(a=t.slice(r,a),u[c]?u[c]+=a:u[++c]=a),(s=s[0])===(i=i[0])?u[c]?u[c]+=i:u[++c]=i:(u[++c]=null,f.push({i:c,x:sr(s,i)})),r=kc.lastIndex;return r<t.length&&(a=t.slice(r),u[c]?u[c]+=a:u[++c]=a),u.length<2?f[0]?l_(f[0].x):i_(t):(t=f.length,function(p){for(var m=0,E;m<t;++m)u[(E=f[m]).i]=E.x(p);return u.join("")})}var Gp=180/Math.PI,Mc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yp(e,t,r,s,i,a){var c,u,f;return(c=Math.sqrt(e*e+t*t))&&(e/=c,t/=c),(f=e*r+t*s)&&(r-=e*f,s-=t*f),(u=Math.sqrt(r*r+s*s))&&(r/=u,s/=u,f/=u),e*s<t*r&&(e=-e,t=-t,f=-f,c=-c),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*Gp,skewX:Math.atan(f)*Gp,scaleX:c,scaleY:u}}var el;function c_(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Mc:Yp(t.a,t.b,t.c,t.d,t.e,t.f)}function u_(e){return e==null||(el||(el=document.createElementNS("http://www.w3.org/2000/svg","g")),el.setAttribute("transform",e),!(e=el.transform.baseVal.consolidate()))?Mc:(e=e.matrix,Yp(e.a,e.b,e.c,e.d,e.e,e.f))}function Kp(e,t,r,s){function i(p){return p.length?p.pop()+" ":""}function a(p,m,E,v,x,_){if(p!==E||m!==v){var w=x.push("translate(",null,t,null,r);_.push({i:w-4,x:sr(p,E)},{i:w-2,x:sr(m,v)})}else(E||v)&&x.push("translate("+E+t+v+r)}function c(p,m,E,v){p!==m?(p-m>180?m+=360:m-p>180&&(p+=360),v.push({i:E.push(i(E)+"rotate(",null,s)-2,x:sr(p,m)})):m&&E.push(i(E)+"rotate("+m+s)}function u(p,m,E,v){p!==m?v.push({i:E.push(i(E)+"skewX(",null,s)-2,x:sr(p,m)}):m&&E.push(i(E)+"skewX("+m+s)}function f(p,m,E,v,x,_){if(p!==E||m!==v){var w=x.push(i(x)+"scale(",null,",",null,")");_.push({i:w-4,x:sr(p,E)},{i:w-2,x:sr(m,v)})}else(E!==1||v!==1)&&x.push(i(x)+"scale("+E+","+v+")")}return function(p,m){var E=[],v=[];return p=e(p),m=e(m),a(p.translateX,p.translateY,m.translateX,m.translateY,E,v),c(p.rotate,m.rotate,E,v),u(p.skewX,m.skewX,E,v),f(p.scaleX,p.scaleY,m.scaleX,m.scaleY,E,v),p=m=null,function(x){for(var _=-1,w=v.length,S;++_<w;)E[(S=v[_]).i]=S.x(x);return E.join("")}}}var d_=Kp(c_,"px, ","px)","deg)"),f_=Kp(u_,", ",")",")"),p_=1e-12;function Xp(e){return((e=Math.exp(e))+1/e)/2}function h_(e){return((e=Math.exp(e))-1/e)/2}function m_(e){return((e=Math.exp(2*e))-1)/(e+1)}const g_=function e(t,r,s){function i(a,c){var u=a[0],f=a[1],p=a[2],m=c[0],E=c[1],v=c[2],x=m-u,_=E-f,w=x*x+_*_,S,N;if(w<p_)N=Math.log(v/p)/t,S=function(F){return[u+F*x,f+F*_,p*Math.exp(t*F*N)]};else{var O=Math.sqrt(w),D=(v*v-p*p+s*w)/(2*p*r*O),T=(v*v-p*p-s*w)/(2*v*r*O),A=Math.log(Math.sqrt(D*D+1)-D),L=Math.log(Math.sqrt(T*T+1)-T);N=(L-A)/t,S=function(F){var K=F*N,Q=Xp(A),X=p/(r*O)*(Q*m_(t*K+A)-h_(A));return[u+X*x,f+X*_,p*Q/Xp(t*K+A)]}}return S.duration=N*1e3*t/Math.SQRT2,S}return i.rho=function(a){var c=Math.max(.001,+a),u=c*c,f=u*u;return e(c,u,f)},i}(Math.SQRT2,2,4);var So=0,Cs=0,As=0,Qp=1e3,tl,Is,nl=0,Vr=0,rl=0,bs=typeof performance=="object"&&performance.now?performance:Date,qp=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Pc(){return Vr||(qp(E_),Vr=bs.now()+rl)}function E_(){Vr=0}function ol(){this._call=this._time=this._next=null}ol.prototype=Zp.prototype={constructor:ol,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Pc():+r)+(t==null?0:+t),!this._next&&Is!==this&&(Is?Is._next=this:tl=this,Is=this),this._call=e,this._time=r,Uc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uc())}};function Zp(e,t,r){var s=new ol;return s.restart(e,t,r),s}function y_(){Pc(),++So;for(var e=tl,t;e;)(t=Vr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--So}function Jp(){Vr=(nl=bs.now())+rl,So=Cs=0;try{y_()}finally{So=0,x_(),Vr=0}}function v_(){var e=bs.now(),t=e-nl;t>Qp&&(rl-=t,nl=e)}function x_(){for(var e,t=tl,r,s=1/0;t;)t._call?(s>t._time&&(s=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:tl=r);Is=e,Uc(s)}function Uc(e){if(!So){Cs&&(Cs=clearTimeout(Cs));var t=e-Vr;t>24?(e<1/0&&(Cs=setTimeout(Jp,e-bs.now()-rl)),As&&(As=clearInterval(As))):(As||(nl=bs.now(),As=setInterval(v_,Qp)),So=1,qp(Jp))}}function eh(e,t,r){var s=new ol;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,r),s}var S_=Wi("start","end","cancel","interrupt"),__=[],th=0,nh=1,Fc=2,sl=3,rh=4,jc=5,il=6;function ll(e,t,r,s,i,a){var c=e.__transition;if(!c)e.__transition={};else if(r in c)return;w_(e,r,{name:t,index:s,group:i,on:S_,tween:__,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:th})}function Vc(e,t){var r=ln(e,t);if(r.state>th)throw new Error("too late; already scheduled");return r}function Nn(e,t){var r=ln(e,t);if(r.state>sl)throw new Error("too late; already running");return r}function ln(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function w_(e,t,r){var s=e.__transition,i;s[t]=r,r.timer=Zp(a,0,r.time);function a(p){r.state=nh,r.timer.restart(c,r.delay,r.time),r.delay<=p&&c(p-r.delay)}function c(p){var m,E,v,x;if(r.state!==nh)return f();for(m in s)if(x=s[m],x.name===r.name){if(x.state===sl)return eh(c);x.state===rh?(x.state=il,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete s[m]):+m<t&&(x.state=il,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete s[m])}if(eh(function(){r.state===sl&&(r.state=rh,r.timer.restart(u,r.delay,r.time),u(p))}),r.state=Fc,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Fc){for(r.state=sl,i=new Array(v=r.tween.length),m=0,E=-1;m<v;++m)(x=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(i[++E]=x);i.length=E+1}}function u(p){for(var m=p<r.duration?r.ease.call(null,p/r.duration):(r.timer.restart(f),r.state=jc,1),E=-1,v=i.length;++E<v;)i[E].call(e,m);r.state===jc&&(r.on.call("end",e,e.__data__,r.index,r.group),f())}function f(){r.state=il,r.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function al(e,t){var r=e.__transition,s,i,a=!0,c;if(r){t=t==null?null:t+"";for(c in r){if((s=r[c]).name!==t){a=!1;continue}i=s.state>Fc&&s.state<jc,s.state=il,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete r[c]}a&&delete e.__transition}}function N_(e){return this.each(function(){al(this,e)})}function R_(e,t){var r,s;return function(){var i=Nn(this,e),a=i.tween;if(a!==r){s=r=a;for(var c=0,u=s.length;c<u;++c)if(s[c].name===t){s=s.slice(),s.splice(c,1);break}}i.tween=s}}function T_(e,t,r){var s,i;if(typeof r!="function")throw new Error;return function(){var a=Nn(this,e),c=a.tween;if(c!==s){i=(s=c).slice();for(var u={name:t,value:r},f=0,p=i.length;f<p;++f)if(i[f].name===t){i[f]=u;break}f===p&&i.push(u)}a.tween=i}}function O_(e,t){var r=this._id;if(e+="",arguments.length<2){for(var s=ln(this.node(),r).tween,i=0,a=s.length,c;i<a;++i)if((c=s[i]).name===e)return c.value;return null}return this.each((t==null?R_:T_)(r,e,t))}function $c(e,t,r){var s=e._id;return e.each(function(){var i=Nn(this,s);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return ln(i,s).value[t]}}function oh(e,t){var r;return(typeof t=="number"?sr:t instanceof Os?Wp:(r=Os(t))?(t=r,Wp):a_)(e,t)}function C_(e){return function(){this.removeAttribute(e)}}function A_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function I_(e,t,r){var s,i=r+"",a;return function(){var c=this.getAttribute(e);return c===i?null:c===s?a:a=t(s=c,r)}}function b_(e,t,r){var s,i=r+"",a;return function(){var c=this.getAttributeNS(e.space,e.local);return c===i?null:c===s?a:a=t(s=c,r)}}function L_(e,t,r){var s,i,a;return function(){var c,u=r(this),f;return u==null?void this.removeAttribute(e):(c=this.getAttribute(e),f=u+"",c===f?null:c===s&&f===i?a:(i=f,a=t(s=c,u)))}}function D_(e,t,r){var s,i,a;return function(){var c,u=r(this),f;return u==null?void this.removeAttributeNS(e.space,e.local):(c=this.getAttributeNS(e.space,e.local),f=u+"",c===f?null:c===s&&f===i?a:(i=f,a=t(s=c,u)))}}function k_(e,t){var r=Yi(e),s=r==="transform"?f_:oh;return this.attrTween(e,typeof t=="function"?(r.local?D_:L_)(r,s,$c(this,"attr."+e,t)):t==null?(r.local?A_:C_)(r):(r.local?b_:I_)(r,s,t))}function M_(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function P_(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function U_(e,t){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&P_(e,a)),r}return i._value=t,i}function F_(e,t){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&M_(e,a)),r}return i._value=t,i}function j_(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var s=Yi(e);return this.tween(r,(s.local?U_:F_)(s,t))}function V_(e,t){return function(){Vc(this,e).delay=+t.apply(this,arguments)}}function $_(e,t){return t=+t,function(){Vc(this,e).delay=t}}function H_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?V_:$_)(t,e)):ln(this.node(),t).delay}function B_(e,t){return function(){Nn(this,e).duration=+t.apply(this,arguments)}}function z_(e,t){return t=+t,function(){Nn(this,e).duration=t}}function W_(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?B_:z_)(t,e)):ln(this.node(),t).duration}function G_(e,t){if(typeof t!="function")throw new Error;return function(){Nn(this,e).ease=t}}function Y_(e){var t=this._id;return arguments.length?this.each(G_(t,e)):ln(this.node(),t).ease}function K_(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Nn(this,e).ease=r}}function X_(e){if(typeof e!="function")throw new Error;return this.each(K_(this._id,e))}function Q_(e){typeof e!="function"&&(e=Sp(e));for(var t=this._groups,r=t.length,s=new Array(r),i=0;i<r;++i)for(var a=t[i],c=a.length,u=s[i]=[],f,p=0;p<c;++p)(f=a[p])&&e.call(f,f.__data__,p,a)&&u.push(f);return new Un(s,this._parents,this._name,this._id)}function q_(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,s=t.length,i=r.length,a=Math.min(s,i),c=new Array(s),u=0;u<a;++u)for(var f=t[u],p=r[u],m=f.length,E=c[u]=new Array(m),v,x=0;x<m;++x)(v=f[x]||p[x])&&(E[x]=v);for(;u<s;++u)c[u]=t[u];return new Un(c,this._parents,this._name,this._id)}function Z_(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function J_(e,t,r){var s,i,a=Z_(t)?Vc:Nn;return function(){var c=a(this,e),u=c.on;u!==s&&(i=(s=u).copy()).on(t,r),c.on=i}}function ew(e,t){var r=this._id;return arguments.length<2?ln(this.node(),r).on.on(e):this.each(J_(r,e,t))}function tw(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function nw(){return this.on("end.remove",tw(this._id))}function rw(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Tc(e));for(var s=this._groups,i=s.length,a=new Array(i),c=0;c<i;++c)for(var u=s[c],f=u.length,p=a[c]=new Array(f),m,E,v=0;v<f;++v)(m=u[v])&&(E=e.call(m,m.__data__,v,u))&&("__data__"in m&&(E.__data__=m.__data__),p[v]=E,ll(p[v],t,r,v,p,ln(m,r)));return new Un(a,this._parents,t,r)}function ow(e){var t=this._name,r=this._id;typeof e!="function"&&(e=xp(e));for(var s=this._groups,i=s.length,a=[],c=[],u=0;u<i;++u)for(var f=s[u],p=f.length,m,E=0;E<p;++E)if(m=f[E]){for(var v=e.call(m,m.__data__,E,f),x,_=ln(m,r),w=0,S=v.length;w<S;++w)(x=v[w])&&ll(x,t,r,w,v,_);a.push(v),c.push(m)}return new Un(a,c,t,r)}var sw=_s.prototype.constructor;function iw(){return new sw(this._groups,this._parents)}function lw(e,t){var r,s,i;return function(){var a=yo(this,e),c=(this.style.removeProperty(e),yo(this,e));return a===c?null:a===r&&c===s?i:i=t(r=a,s=c)}}function sh(e){return function(){this.style.removeProperty(e)}}function aw(e,t,r){var s,i=r+"",a;return function(){var c=yo(this,e);return c===i?null:c===s?a:a=t(s=c,r)}}function cw(e,t,r){var s,i,a;return function(){var c=yo(this,e),u=r(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),yo(this,e))),c===f?null:c===s&&f===i?a:(i=f,a=t(s=c,u))}}function uw(e,t){var r,s,i,a="style."+t,c="end."+a,u;return function(){var f=Nn(this,e),p=f.on,m=f.value[a]==null?u||(u=sh(t)):void 0;(p!==r||i!==m)&&(s=(r=p).copy()).on(c,i=m),f.on=s}}function dw(e,t,r){var s=(e+="")=="transform"?d_:oh;return t==null?this.styleTween(e,lw(e,s)).on("end.style."+e,sh(e)):typeof t=="function"?this.styleTween(e,cw(e,s,$c(this,"style."+e,t))).each(uw(this._id,e)):this.styleTween(e,aw(e,s,t),r).on("end.style."+e,null)}function fw(e,t,r){return function(s){this.style.setProperty(e,t.call(this,s),r)}}function pw(e,t,r){var s,i;function a(){var c=t.apply(this,arguments);return c!==i&&(s=(i=c)&&fw(e,c,r)),s}return a._value=t,a}function hw(e,t,r){var s="style."+(e+="");if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;return this.tween(s,pw(e,t,r??""))}function mw(e){return function(){this.textContent=e}}function gw(e){return function(){var t=e(this);this.textContent=t??""}}function Ew(e){return this.tween("text",typeof e=="function"?gw($c(this,"text",e)):mw(e==null?"":e+""))}function yw(e){return function(t){this.textContent=e.call(this,t)}}function vw(e){var t,r;function s(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&yw(i)),t}return s._value=e,s}function xw(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,vw(e))}function Sw(){for(var e=this._name,t=this._id,r=ih(),s=this._groups,i=s.length,a=0;a<i;++a)for(var c=s[a],u=c.length,f,p=0;p<u;++p)if(f=c[p]){var m=ln(f,t);ll(f,e,r,p,c,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new Un(s,this._parents,e,r)}function _w(){var e,t,r=this,s=r._id,i=r.size();return new Promise(function(a,c){var u={value:c},f={value:function(){--i===0&&a()}};r.each(function(){var p=Nn(this,s),m=p.on;m!==e&&(t=(e=m).copy(),t._.cancel.push(u),t._.interrupt.push(u),t._.end.push(f)),p.on=t}),i===0&&a()})}var ww=0;function Un(e,t,r,s){this._groups=e,this._parents=t,this._name=r,this._id=s}function ih(){return++ww}var Fn=_s.prototype;Un.prototype={constructor:Un,select:rw,selectAll:ow,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:Q_,merge:q_,selection:iw,transition:Sw,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:ew,attr:k_,attrTween:j_,style:dw,styleTween:hw,text:Ew,textTween:xw,remove:nw,tween:O_,delay:H_,duration:W_,ease:Y_,easeVarying:X_,end:_w,[Symbol.iterator]:Fn[Symbol.iterator]};function Nw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Rw={time:null,delay:0,duration:250,ease:Nw};function Tw(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function Ow(e){var t,r;e instanceof Un?(t=e._id,e=e._name):(t=ih(),(r=Rw).time=Pc(),e=e==null?null:e+"");for(var s=this._groups,i=s.length,a=0;a<i;++a)for(var c=s[a],u=c.length,f,p=0;p<u;++p)(f=c[p])&&ll(f,e,t,p,c,r||Tw(f,t));return new Un(s,this._parents,e,t)}_s.prototype.interrupt=N_,_s.prototype.transition=Ow;const cl=e=>()=>e;function Cw(e,{sourceEvent:t,target:r,transform:s,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:i}})}function jn(e,t,r){this.k=e,this.x=t,this.y=r}jn.prototype={constructor:jn,scale:function(e){return e===1?this:new jn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jn(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ir=new jn(1,0,0);jn.prototype;function Hc(e){e.stopImmediatePropagation()}function Ls(e){e.preventDefault(),e.stopImmediatePropagation()}function Aw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Iw(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function lh(){return this.__zoom||ir}function bw(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Lw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dw(e,t,r){var s=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],c=e.invertY(t[1][1])-r[1][1];return e.translate(i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function kw(){var e=Aw,t=Iw,r=Dw,s=bw,i=Lw,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=g_,p=Wi("start","zoom","end"),m,E,v,x=500,_=150,w=0,S=10;function N(I){I.property("__zoom",lh).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",Q).on("dblclick.zoom",X).filter(i).on("touchstart.zoom",ee).on("touchmove.zoom",ne).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(I,V,j,B){var U=I.selection?I.selection():I;U.property("__zoom",lh),I!==U?A(I,V,j,B):U.interrupt().each(function(){L(this,arguments).event(B).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},N.scaleBy=function(I,V,j,B){N.scaleTo(I,function(){var U=this.__zoom.k,$=typeof V=="function"?V.apply(this,arguments):V;return U*$},j,B)},N.scaleTo=function(I,V,j,B){N.transform(I,function(){var U=t.apply(this,arguments),$=this.__zoom,z=j==null?T(U):typeof j=="function"?j.apply(this,arguments):j,k=$.invert(z),Y=typeof V=="function"?V.apply(this,arguments):V;return r(D(O($,Y),z,k),U,c)},j,B)},N.translateBy=function(I,V,j,B){N.transform(I,function(){return r(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof j=="function"?j.apply(this,arguments):j),t.apply(this,arguments),c)},null,B)},N.translateTo=function(I,V,j,B,U){N.transform(I,function(){var $=t.apply(this,arguments),z=this.__zoom,k=B==null?T($):typeof B=="function"?B.apply(this,arguments):B;return r(ir.translate(k[0],k[1]).scale(z.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof j=="function"?-j.apply(this,arguments):-j),$,c)},B,U)};function O(I,V){return V=Math.max(a[0],Math.min(a[1],V)),V===I.k?I:new jn(V,I.x,I.y)}function D(I,V,j){var B=V[0]-j[0]*I.k,U=V[1]-j[1]*I.k;return B===I.x&&U===I.y?I:new jn(I.k,B,U)}function T(I){return[(+I[0][0]+ +I[1][0])/2,(+I[0][1]+ +I[1][1])/2]}function A(I,V,j,B){I.on("start.zoom",function(){L(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event(B).end()}).tween("zoom",function(){var U=this,$=arguments,z=L(U,$).event(B),k=t.apply(U,$),Y=j==null?T(k):typeof j=="function"?j.apply(U,$):j,re=Math.max(k[1][0]-k[0][0],k[1][1]-k[0][1]),oe=U.__zoom,le=typeof V=="function"?V.apply(U,$):V,de=f(oe.invert(Y).concat(re/oe.k),le.invert(Y).concat(re/le.k));return function(he){if(he===1)he=le;else{var ue=de(he),me=re/ue[2];he=new jn(me,Y[0]-ue[0]*me,Y[1]-ue[1]*me)}z.zoom(null,he)}})}function L(I,V,j){return!j&&I.__zooming||new F(I,V)}function F(I,V){this.that=I,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(I,V),this.taps=0}F.prototype={event:function(I){return I&&(this.sourceEvent=I),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(I,V){return this.mouse&&I!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&I!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&I!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(I){var V=on(this.that).datum();p.call(I,this.that,new Cw(I,{sourceEvent:this.sourceEvent,target:N,transform:this.that.__zoom,dispatch:p}),V)}};function K(I,...V){if(!e.apply(this,arguments))return;var j=L(this,V).event(I),B=this.__zoom,U=Math.max(a[0],Math.min(a[1],B.k*Math.pow(2,s.apply(this,arguments)))),$=_n(I);if(j.wheel)(j.mouse[0][0]!==$[0]||j.mouse[0][1]!==$[1])&&(j.mouse[1]=B.invert(j.mouse[0]=$)),clearTimeout(j.wheel);else{if(B.k===U)return;j.mouse=[$,B.invert($)],al(this),j.start()}Ls(I),j.wheel=setTimeout(z,_),j.zoom("mouse",r(D(O(B,U),j.mouse[0],j.mouse[1]),j.extent,c));function z(){j.wheel=null,j.end()}}function Q(I,...V){if(v||!e.apply(this,arguments))return;var j=I.currentTarget,B=L(this,V,!0).event(I),U=on(I.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",re,!0),$=_n(I,j),z=I.clientX,k=I.clientY;bp(I.view),Hc(I),B.mouse=[$,this.__zoom.invert($)],al(this),B.start();function Y(oe){if(Ls(oe),!B.moved){var le=oe.clientX-z,de=oe.clientY-k;B.moved=le*le+de*de>w}B.event(oe).zoom("mouse",r(D(B.that.__zoom,B.mouse[0]=_n(oe,j),B.mouse[1]),B.extent,c))}function re(oe){U.on("mousemove.zoom mouseup.zoom",null),Lp(oe.view,B.moved),Ls(oe),B.event(oe).end()}}function X(I,...V){if(e.apply(this,arguments)){var j=this.__zoom,B=_n(I.changedTouches?I.changedTouches[0]:I,this),U=j.invert(B),$=j.k*(I.shiftKey?.5:2),z=r(D(O(j,$),B,U),t.apply(this,V),c);Ls(I),u>0?on(this).transition().duration(u).call(A,z,B,I):on(this).call(N.transform,z,B,I)}}function ee(I,...V){if(e.apply(this,arguments)){var j=I.touches,B=j.length,U=L(this,V,I.changedTouches.length===B).event(I),$,z,k,Y;for(Hc(I),z=0;z<B;++z)k=j[z],Y=_n(k,this),Y=[Y,this.__zoom.invert(Y),k.identifier],U.touch0?!U.touch1&&U.touch0[2]!==Y[2]&&(U.touch1=Y,U.taps=0):(U.touch0=Y,$=!0,U.taps=1+!!m);m&&(m=clearTimeout(m)),$&&(U.taps<2&&(E=Y[0],m=setTimeout(function(){m=null},x)),al(this),U.start())}}function ne(I,...V){if(this.__zooming){var j=L(this,V).event(I),B=I.changedTouches,U=B.length,$,z,k,Y;for(Ls(I),$=0;$<U;++$)z=B[$],k=_n(z,this),j.touch0&&j.touch0[2]===z.identifier?j.touch0[0]=k:j.touch1&&j.touch1[2]===z.identifier&&(j.touch1[0]=k);if(z=j.that.__zoom,j.touch1){var re=j.touch0[0],oe=j.touch0[1],le=j.touch1[0],de=j.touch1[1],he=(he=le[0]-re[0])*he+(he=le[1]-re[1])*he,ue=(ue=de[0]-oe[0])*ue+(ue=de[1]-oe[1])*ue;z=O(z,Math.sqrt(he/ue)),k=[(re[0]+le[0])/2,(re[1]+le[1])/2],Y=[(oe[0]+de[0])/2,(oe[1]+de[1])/2]}else if(j.touch0)k=j.touch0[0],Y=j.touch0[1];else return;j.zoom("touch",r(D(z,k,Y),j.extent,c))}}function W(I,...V){if(this.__zooming){var j=L(this,V).event(I),B=I.changedTouches,U=B.length,$,z;for(Hc(I),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),$=0;$<U;++$)z=B[$],j.touch0&&j.touch0[2]===z.identifier?delete j.touch0:j.touch1&&j.touch1[2]===z.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(z=_n(z,this),Math.hypot(E[0]-z[0],E[1]-z[1])<S)){var k=on(this).on("dblclick.zoom");k&&k.apply(this,arguments)}}}return N.wheelDelta=function(I){return arguments.length?(s=typeof I=="function"?I:cl(+I),N):s},N.filter=function(I){return arguments.length?(e=typeof I=="function"?I:cl(!!I),N):e},N.touchable=function(I){return arguments.length?(i=typeof I=="function"?I:cl(!!I),N):i},N.extent=function(I){return arguments.length?(t=typeof I=="function"?I:cl([[+I[0][0],+I[0][1]],[+I[1][0],+I[1][1]]]),N):t},N.scaleExtent=function(I){return arguments.length?(a[0]=+I[0],a[1]=+I[1],N):[a[0],a[1]]},N.translateExtent=function(I){return arguments.length?(c[0][0]=+I[0][0],c[1][0]=+I[1][0],c[0][1]=+I[0][1],c[1][1]=+I[1][1],N):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},N.constrain=function(I){return arguments.length?(r=I,N):r},N.duration=function(I){return arguments.length?(u=+I,N):u},N.interpolate=function(I){return arguments.length?(f=I,N):f},N.on=function(){var I=p.on.apply(p,arguments);return I===p?N:I},N.clickDistance=function(I){return arguments.length?(w=(I=+I)*I,N):Math.sqrt(w)},N.tapDistance=function(I){return arguments.length?(S=+I,N):S},N}var Bc=ip();const ul=b.createContext(null),Mw=ul.Provider,Vn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},ah=Vn.error001();function Me(e,t){const r=b.useContext(ul);if(r===null)throw new Error(ah);return mp(r,e,t)}const tt=()=>{const e=b.useContext(ul);if(e===null)throw new Error(ah);return b.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Pw=e=>e.userSelectionActive?"none":"all";function Ds({position:e,children:t,className:r,style:s,...i}){const a=Me(Pw),c=`${e}`.split("-");return te.createElement("div",{className:St(["react-flow__panel",r,...c]),style:{...s,pointerEvents:a},...i},t)}function Uw({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:te.createElement(Ds,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},te.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Fw=({x:e,y:t,label:r,labelStyle:s={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:f,className:p,...m})=>{const E=b.useRef(null),[v,x]=b.useState({x:0,y:0,width:0,height:0}),_=St(["react-flow__edge-textwrapper",p]);return b.useEffect(()=>{if(E.current){const w=E.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[r]),typeof r>"u"||!r?null:te.createElement("g",{transform:`translate(${e-v.width/2} ${t-v.height/2})`,className:_,visibility:v.width?"visible":"hidden",...m},i&&te.createElement("rect",{width:v.width+2*c[0],x:-c[0],y:-c[1],height:v.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),te.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:E,style:s},r),f)};var jw=b.memo(Fw);const zc=e=>({width:e.offsetWidth,height:e.offsetHeight}),_o=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Wc=(e={x:0,y:0},t)=>({x:_o(e.x,t[0][0],t[1][0]),y:_o(e.y,t[0][1],t[1][1])}),ch=(e,t,r)=>e<t?_o(Math.abs(e-t),1,50)/50:e>r?-_o(Math.abs(e-r),1,50)/50:0,uh=(e,t)=>{const r=ch(e.x,35,t.width-35)*20,s=ch(e.y,35,t.height-35)*20;return[r,s]},dh=e=>e.getRootNode?.()||window?.document,Vw=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Gc=({x:e,y:t,width:r,height:s})=>({x:e,y:t,x2:e+r,y2:t+s}),$w=({x:e,y:t,x2:r,y2:s})=>({x:e,y:t,width:r-e,height:s-t}),fh=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Yc=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),s=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*s)},Hw=e=>Yt(e.width)&&Yt(e.height)&&Yt(e.x)&&Yt(e.y),Yt=e=>!isNaN(e)&&isFinite(e),nt=Symbol.for("internals"),ph=["Enter"," ","Escape"],Bw=(e,t)=>{},zw=e=>"nativeEvent"in e;function Kc(e){const r=(zw(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const hh=e=>"clientX"in e,lr=(e,t)=>{const r=hh(e),s=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:s-(t?.left??0),y:i-(t?.top??0)}},dl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,wo=({id:e,path:t,labelX:r,labelY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:E,markerStart:v,interactionWidth:x=20})=>te.createElement(te.Fragment,null,te.createElement("path",{id:e,style:m,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:E,markerStart:v}),x&&te.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),i&&Yt(r)&&Yt(s)?te.createElement(jw,{x:r,y:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);wo.displayName="BaseEdge";function ks(e,t,r){return r===void 0?r:s=>{const i=t().edges.find(a=>a.id===e);i&&r(s,{...i})}}function mh({sourceX:e,sourceY:t,targetX:r,targetY:s}){const i=Math.abs(r-e)/2,a=r<e?r+i:r-i,c=Math.abs(s-t)/2,u=s<t?s+c:s-c;return[a,u,i,c]}function gh({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:i,sourceControlY:a,targetControlX:c,targetControlY:u}){const f=e*.125+i*.375+c*.375+r*.125,p=t*.125+a*.375+u*.375+s*.125,m=Math.abs(f-e),E=Math.abs(p-t);return[f,p,m,E]}var ar;(function(e){e.Strict="strict",e.Loose="loose"})(ar||(ar={}));var $r;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})($r||($r={}));var Ms;(function(e){e.Partial="partial",e.Full="full"})(Ms||(Ms={}));var cr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(cr||(cr={}));var Ps;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ps||(Ps={}));var xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xe||(xe={}));function Eh({pos:e,x1:t,y1:r,x2:s,y2:i}){return e===xe.Left||e===xe.Right?[.5*(t+s),r]:[t,.5*(r+i)]}function yh({sourceX:e,sourceY:t,sourcePosition:r=xe.Bottom,targetX:s,targetY:i,targetPosition:a=xe.Top}){const[c,u]=Eh({pos:r,x1:e,y1:t,x2:s,y2:i}),[f,p]=Eh({pos:a,x1:s,y1:i,x2:e,y2:t}),[m,E,v,x]=gh({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:c,sourceControlY:u,targetControlX:f,targetControlY:p});return[`M${e},${t} C${c},${u} ${f},${p} ${s},${i}`,m,E,v,x]}const Xc=b.memo(({sourceX:e,sourceY:t,targetX:r,targetY:s,sourcePosition:i=xe.Bottom,targetPosition:a=xe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:v,markerEnd:x,markerStart:_,interactionWidth:w})=>{const[S,N,O]=yh({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:s,targetPosition:a});return te.createElement(wo,{path:S,labelX:N,labelY:O,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:v,markerEnd:x,markerStart:_,interactionWidth:w})});Xc.displayName="SimpleBezierEdge";const vh={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},Ww=({source:e,sourcePosition:t=xe.Bottom,target:r})=>t===xe.Left||t===xe.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},xh=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Gw({source:e,sourcePosition:t=xe.Bottom,target:r,targetPosition:s=xe.Top,center:i,offset:a}){const c=vh[t],u=vh[s],f={x:e.x+c.x*a,y:e.y+c.y*a},p={x:r.x+u.x*a,y:r.y+u.y*a},m=Ww({source:f,sourcePosition:t,target:p}),E=m.x!==0?"x":"y",v=m[E];let x=[],_,w;const S={x:0,y:0},N={x:0,y:0},[O,D,T,A]=mh({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(c[E]*u[E]===-1){_=i.x||O,w=i.y||D;const F=[{x:_,y:f.y},{x:_,y:p.y}],K=[{x:f.x,y:w},{x:p.x,y:w}];c[E]===v?x=E==="x"?F:K:x=E==="x"?K:F}else{const F=[{x:f.x,y:p.y}],K=[{x:p.x,y:f.y}];if(E==="x"?x=c.x===v?K:F:x=c.y===v?F:K,t===s){const W=Math.abs(e[E]-r[E]);if(W<=a){const I=Math.min(a-1,a-W);c[E]===v?S[E]=(f[E]>e[E]?-1:1)*I:N[E]=(p[E]>r[E]?-1:1)*I}}if(t!==s){const W=E==="x"?"y":"x",I=c[E]===u[W],V=f[W]>p[W],j=f[W]<p[W];(c[E]===1&&(!I&&V||I&&j)||c[E]!==1&&(!I&&j||I&&V))&&(x=E==="x"?F:K)}const Q={x:f.x+S.x,y:f.y+S.y},X={x:p.x+N.x,y:p.y+N.y},ee=Math.max(Math.abs(Q.x-x[0].x),Math.abs(X.x-x[0].x)),ne=Math.max(Math.abs(Q.y-x[0].y),Math.abs(X.y-x[0].y));ee>=ne?(_=(Q.x+X.x)/2,w=x[0].y):(_=x[0].x,w=(Q.y+X.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...x,{x:p.x+N.x,y:p.y+N.y},r],_,w,T,A]}function Yw(e,t,r,s){const i=Math.min(xh(e,t)/2,xh(t,r)/2,s),{x:a,y:c}=t;if(e.x===a&&a===r.x||e.y===c&&c===r.y)return`L${a} ${c}`;if(e.y===c){const p=e.x<r.x?-1:1,m=e.y<r.y?1:-1;return`L ${a+i*p},${c}Q ${a},${c} ${a},${c+i*m}`}const u=e.x<r.x?1:-1,f=e.y<r.y?-1:1;return`L ${a},${c+i*f}Q ${a},${c} ${a+i*u},${c}`}function Us({sourceX:e,sourceY:t,sourcePosition:r=xe.Bottom,targetX:s,targetY:i,targetPosition:a=xe.Top,borderRadius:c=5,centerX:u,centerY:f,offset:p=20}){const[m,E,v,x,_]=Gw({source:{x:e,y:t},sourcePosition:r,target:{x:s,y:i},targetPosition:a,center:{x:u,y:f},offset:p});return[m.reduce((S,N,O)=>{let D="";return O>0&&O<m.length-1?D=Yw(m[O-1],N,m[O+1],c):D=`${O===0?"M":"L"}${N.x} ${N.y}`,S+=D,S},""),E,v,x,_]}const fl=b.memo(({sourceX:e,sourceY:t,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,sourcePosition:E=xe.Bottom,targetPosition:v=xe.Top,markerEnd:x,markerStart:_,pathOptions:w,interactionWidth:S})=>{const[N,O,D]=Us({sourceX:e,sourceY:t,sourcePosition:E,targetX:r,targetY:s,targetPosition:v,borderRadius:w?.borderRadius,offset:w?.offset});return te.createElement(wo,{path:N,labelX:O,labelY:D,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:x,markerStart:_,interactionWidth:S})});fl.displayName="SmoothStepEdge";const Qc=b.memo(e=>te.createElement(fl,{...e,pathOptions:b.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Qc.displayName="StepEdge";function Kw({sourceX:e,sourceY:t,targetX:r,targetY:s}){const[i,a,c,u]=mh({sourceX:e,sourceY:t,targetX:r,targetY:s});return[`M ${e},${t}L ${r},${s}`,i,a,c,u]}const qc=b.memo(({sourceX:e,sourceY:t,targetX:r,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:E,markerStart:v,interactionWidth:x})=>{const[_,w,S]=Kw({sourceX:e,sourceY:t,targetX:r,targetY:s});return te.createElement(wo,{path:_,labelX:w,labelY:S,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:E,markerStart:v,interactionWidth:x})});qc.displayName="StraightEdge";function pl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Sh({pos:e,x1:t,y1:r,x2:s,y2:i,c:a}){switch(e){case xe.Left:return[t-pl(t-s,a),r];case xe.Right:return[t+pl(s-t,a),r];case xe.Top:return[t,r-pl(r-i,a)];case xe.Bottom:return[t,r+pl(i-r,a)]}}function _h({sourceX:e,sourceY:t,sourcePosition:r=xe.Bottom,targetX:s,targetY:i,targetPosition:a=xe.Top,curvature:c=.25}){const[u,f]=Sh({pos:r,x1:e,y1:t,x2:s,y2:i,c}),[p,m]=Sh({pos:a,x1:s,y1:i,x2:e,y2:t,c}),[E,v,x,_]=gh({sourceX:e,sourceY:t,targetX:s,targetY:i,sourceControlX:u,sourceControlY:f,targetControlX:p,targetControlY:m});return[`M${e},${t} C${u},${f} ${p},${m} ${s},${i}`,E,v,x,_]}const hl=b.memo(({sourceX:e,sourceY:t,targetX:r,targetY:s,sourcePosition:i=xe.Bottom,targetPosition:a=xe.Top,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:v,markerEnd:x,markerStart:_,pathOptions:w,interactionWidth:S})=>{const[N,O,D]=_h({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:w?.curvature});return te.createElement(wo,{path:N,labelX:O,labelY:D,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:v,markerEnd:x,markerStart:_,interactionWidth:S})});hl.displayName="BezierEdge";const Zc=b.createContext(null),Xw=Zc.Provider;Zc.Consumer;const Qw=()=>b.useContext(Zc),qw=e=>"id"in e&&"source"in e&&"target"in e,wh=({source:e,sourceHandle:t,target:r,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${r}${s||""}`,Jc=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,Zw=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Nh=(e,t)=>{if(!e.source||!e.target)return t;let r;return qw(e)?r={...e}:r={...e,id:wh(e)},Zw(r,t)?t:t.concat(r)},Jw=(e,t,r,s={shouldReplaceId:!0})=>{const{id:i,...a}=e;if(!t.source||!t.target||!r.find(f=>f.id===i))return r;const u={...a,id:s.shouldReplaceId?wh(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(f=>f.id!==i).concat(u)},eu=({x:e,y:t},[r,s,i],a,[c,u])=>{const f={x:(e-r)/i,y:(t-s)/i};return a?{x:c*Math.round(f.x/c),y:u*Math.round(f.y/u)}:f},Rh=({x:e,y:t},[r,s,i])=>({x:e*i+r,y:t*i+s}),No=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],s=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-s};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-s}:i}},tu=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((s,i)=>{const{x:a,y:c}=No(i,t).positionAbsolute;return Vw(s,Gc({x:a,y:c,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $w(r)},Th=(e,t,[r,s,i]=[0,0,1],a=!1,c=!1,u=[0,0])=>{const f={x:(t.x-r)/i,y:(t.y-s)/i,width:t.width/i,height:t.height/i},p=[];return e.forEach(m=>{const{width:E,height:v,selectable:x=!0,hidden:_=!1}=m;if(c&&!x||_)return!1;const{positionAbsolute:w}=No(m,u),S={x:w.x,y:w.y,width:E||0,height:v||0},N=Yc(f,S),O=typeof E>"u"||typeof v>"u"||E===null||v===null,D=a&&N>0,T=(E||0)*(v||0);(O||D||N>=T||m.dragging)&&p.push(m)}),p},Oh=(e,t)=>{const r=e.map(s=>s.id);return t.filter(s=>r.includes(s.source)||r.includes(s.target))},Ch=(e,t,r,s,i,a=.1)=>{const c=t/(e.width*(1+a)),u=r/(e.height*(1+a)),f=Math.min(c,u),p=_o(f,s,i),m=e.x+e.width/2,E=e.y+e.height/2,v=t/2-m*p,x=r/2-E*p;return{x:v,y:x,zoom:p}},Hr=(e,t=0)=>e.transition().duration(t);function Ah(e,t,r,s){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==s&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function eN(e,t,r,s,i,a){const{x:c,y:u}=lr(e),p=t.elementsFromPoint(c,u).find(_=>_.classList.contains("react-flow__handle"));if(p){const _=p.getAttribute("data-nodeid");if(_){const w=nu(void 0,p),S=p.getAttribute("data-handleid"),N=a({nodeId:_,id:S,type:w});if(N){const O=i.find(D=>D.nodeId===_&&D.type===w&&D.id===S);return{handle:{id:S,type:w,nodeId:_,x:O?.x||r.x,y:O?.y||r.y},validHandleResult:N}}}}let m=[],E=1/0;if(i.forEach(_=>{const w=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(w<=s){const S=a(_);w<=E&&(w<E?m=[{handle:_,validHandleResult:S}]:w===E&&m.push({handle:_,validHandleResult:S}),E=w)}}),!m.length)return{handle:null,validHandleResult:Ih()};if(m.length===1)return m[0];const v=m.some(({validHandleResult:_})=>_.isValid),x=m.some(({handle:_})=>_.type==="target");return m.find(({handle:_,validHandleResult:w})=>x?_.type==="target":v?w.isValid:!0)||m[0]}const tN={source:null,target:null,sourceHandle:null,targetHandle:null},Ih=()=>({handleDomNode:null,isValid:!1,connection:tN,endHandle:null});function bh(e,t,r,s,i,a,c){const u=i==="target",f=c.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),p={...Ih(),handleDomNode:f};if(f){const m=nu(void 0,f),E=f.getAttribute("data-nodeid"),v=f.getAttribute("data-handleid"),x=f.classList.contains("connectable"),_=f.classList.contains("connectableend"),w={source:u?E:r,sourceHandle:u?v:s,target:u?r:E,targetHandle:u?s:v};p.connection=w,x&&_&&(t===ar.Strict?u&&m==="source"||!u&&m==="target":E!==r||v!==s)&&(p.endHandle={nodeId:E,handleId:v,type:m},p.isValid=a(w))}return p}function nN({nodes:e,nodeId:t,handleId:r,handleType:s}){return e.reduce((i,a)=>{if(a[nt]){const{handleBounds:c}=a[nt];let u=[],f=[];c&&(u=Ah(a,c,"source",`${t}-${r}-${s}`),f=Ah(a,c,"target",`${t}-${r}-${s}`)),i.push(...u,...f)}return i},[])}function nu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function ru(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function rN(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function Lh({event:e,handleId:t,nodeId:r,onConnect:s,isTarget:i,getState:a,setState:c,isValidConnection:u,edgeUpdaterType:f,onEdgeUpdateEnd:p}){const m=dh(e.target),{connectionMode:E,domNode:v,autoPanOnConnect:x,connectionRadius:_,onConnectStart:w,panBy:S,getNodes:N,cancelConnection:O}=a();let D=0,T;const{x:A,y:L}=lr(e),F=m?.elementFromPoint(A,L),K=nu(f,F),Q=v?.getBoundingClientRect();if(!Q||!K)return;let X,ee=lr(e,Q),ne=!1,W=null,I=!1,V=null;const j=nN({nodes:N(),nodeId:r,handleId:t,handleType:K}),B=()=>{if(!x)return;const[z,k]=uh(ee,Q);S({x:z,y:k}),D=requestAnimationFrame(B)};c({connectionPosition:ee,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:K,connectionStartHandle:{nodeId:r,handleId:t,type:K},connectionEndHandle:null}),w?.(e,{nodeId:r,handleId:t,handleType:K});function U(z){const{transform:k}=a();ee=lr(z,Q);const{handle:Y,validHandleResult:re}=eN(z,m,eu(ee,k,!1,[1,1]),_,j,oe=>bh(oe,E,r,t,i?"target":"source",u,m));if(T=Y,ne||(B(),ne=!0),V=re.handleDomNode,W=re.connection,I=re.isValid,c({connectionPosition:T&&I?Rh({x:T.x,y:T.y},k):ee,connectionStatus:rN(!!T,I),connectionEndHandle:re.endHandle}),!T&&!I&&!V)return ru(X);W.source!==W.target&&V&&(ru(X),X=V,V.classList.add("connecting","react-flow__handle-connecting"),V.classList.toggle("valid",I),V.classList.toggle("react-flow__handle-valid",I))}function $(z){(T||V)&&W&&I&&s?.(W),a().onConnectEnd?.(z),f&&p?.(z),ru(X),O(),cancelAnimationFrame(D),ne=!1,I=!1,W=null,V=null,m.removeEventListener("mousemove",U),m.removeEventListener("mouseup",$),m.removeEventListener("touchmove",U),m.removeEventListener("touchend",$)}m.addEventListener("mousemove",U),m.addEventListener("mouseup",$),m.addEventListener("touchmove",U),m.addEventListener("touchend",$)}const Dh=()=>!0,oN=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),sN=(e,t,r)=>s=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:c}=s;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:c?.nodeId===e&&c?.handleId===t&&c?.type===r}},kh=b.forwardRef(({type:e="source",position:t=xe.Top,isValidConnection:r,isConnectable:s=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:c,onConnect:u,children:f,className:p,onMouseDown:m,onTouchStart:E,...v},x)=>{const _=c||null,w=e==="target",S=tt(),N=Qw(),{connectOnClick:O,noPanClassName:D}=Me(oN,gt),{connecting:T,clickConnecting:A}=Me(sN(N,_,e),gt);N||S.getState().onError?.("010",Vn.error010());const L=Q=>{const{defaultEdgeOptions:X,onConnect:ee,hasDefaultEdges:ne}=S.getState(),W={...X,...Q};if(ne){const{edges:I,setEdges:V}=S.getState();V(Nh(W,I))}ee?.(W),u?.(W)},F=Q=>{if(!N)return;const X=hh(Q);i&&(X&&Q.button===0||!X)&&Lh({event:Q,handleId:_,nodeId:N,onConnect:L,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:r||S.getState().isValidConnection||Dh}),X?m?.(Q):E?.(Q)},K=Q=>{const{onClickConnectStart:X,onClickConnectEnd:ee,connectionClickStartHandle:ne,connectionMode:W,isValidConnection:I}=S.getState();if(!N||!ne&&!i)return;if(!ne){X?.(Q,{nodeId:N,handleId:_,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:N,type:e,handleId:_}});return}const V=dh(Q.target),j=r||I||Dh,{connection:B,isValid:U}=bh({nodeId:N,id:_,type:e},W,ne.nodeId,ne.handleId||null,ne.type,j,V);U&&L(B),ee?.(Q),S.setState({connectionClickStartHandle:null})};return te.createElement("div",{"data-handleid":_,"data-nodeid":N,"data-handlepos":t,"data-id":`${N}-${_}-${e}`,className:St(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",D,p,{source:!w,target:w,connectable:s,connectablestart:i,connectableend:a,connecting:A,connectionindicator:s&&(i&&!T||a&&T)}]),onMouseDown:F,onTouchStart:F,onClick:O?K:void 0,ref:x,...v},f)});kh.displayName="Handle";var Ro=b.memo(kh);const Mh=({data:e,isConnectable:t,targetPosition:r=xe.Top,sourcePosition:s=xe.Bottom})=>te.createElement(te.Fragment,null,te.createElement(Ro,{type:"target",position:r,isConnectable:t}),e?.label,te.createElement(Ro,{type:"source",position:s,isConnectable:t}));Mh.displayName="DefaultNode";var ou=b.memo(Mh);const Ph=({data:e,isConnectable:t,sourcePosition:r=xe.Bottom})=>te.createElement(te.Fragment,null,e?.label,te.createElement(Ro,{type:"source",position:r,isConnectable:t}));Ph.displayName="InputNode";var Uh=b.memo(Ph);const Fh=({data:e,isConnectable:t,targetPosition:r=xe.Top})=>te.createElement(te.Fragment,null,te.createElement(Ro,{type:"target",position:r,isConnectable:t}),e?.label);Fh.displayName="OutputNode";var jh=b.memo(Fh);const su=()=>null;su.displayName="GroupNode";const iN=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),ml=e=>e.id;function lN(e,t){return gt(e.selectedNodes.map(ml),t.selectedNodes.map(ml))&&gt(e.selectedEdges.map(ml),t.selectedEdges.map(ml))}const Vh=b.memo(({onSelectionChange:e})=>{const t=tt(),{selectedNodes:r,selectedEdges:s}=Me(iN,lN);return b.useEffect(()=>{const i={nodes:r,edges:s};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,s,e]),null});Vh.displayName="SelectionListener";const aN=e=>!!e.onSelectionChange;function cN({onSelectionChange:e}){const t=Me(aN);return e||t?te.createElement(Vh,{onSelectionChange:e}):null}const uN=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function To(e,t){b.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Oe(e,t,r){b.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const dN=({nodes:e,edges:t,defaultNodes:r,defaultEdges:s,onConnect:i,onConnectStart:a,onConnectEnd:c,onClickConnectStart:u,onClickConnectEnd:f,nodesDraggable:p,nodesConnectable:m,nodesFocusable:E,edgesFocusable:v,edgesUpdatable:x,elevateNodesOnSelect:_,minZoom:w,maxZoom:S,nodeExtent:N,onNodesChange:O,onEdgesChange:D,elementsSelectable:T,connectionMode:A,snapGrid:L,snapToGrid:F,translateExtent:K,connectOnClick:Q,defaultEdgeOptions:X,fitView:ee,fitViewOptions:ne,onNodesDelete:W,onEdgesDelete:I,onNodeDrag:V,onNodeDragStart:j,onNodeDragStop:B,onSelectionDrag:U,onSelectionDragStart:$,onSelectionDragStop:z,noPanClassName:k,nodeOrigin:Y,rfId:re,autoPanOnConnect:oe,autoPanOnNodeDrag:le,onError:de,connectionRadius:he,isValidConnection:ue,nodeDragThreshold:me})=>{const{setNodes:Re,setEdges:Pe,setDefaultNodesAndEdges:Je,setMinZoom:wt,setMaxZoom:Be,setTranslateExtent:Ue,setNodeExtent:ft,reset:pt}=Me(uN,gt),we=tt();return b.useEffect(()=>{const un=s?.map(Ht=>({...Ht,...X}));return Je(r,un),()=>{pt()}},[]),Oe("defaultEdgeOptions",X,we.setState),Oe("connectionMode",A,we.setState),Oe("onConnect",i,we.setState),Oe("onConnectStart",a,we.setState),Oe("onConnectEnd",c,we.setState),Oe("onClickConnectStart",u,we.setState),Oe("onClickConnectEnd",f,we.setState),Oe("nodesDraggable",p,we.setState),Oe("nodesConnectable",m,we.setState),Oe("nodesFocusable",E,we.setState),Oe("edgesFocusable",v,we.setState),Oe("edgesUpdatable",x,we.setState),Oe("elementsSelectable",T,we.setState),Oe("elevateNodesOnSelect",_,we.setState),Oe("snapToGrid",F,we.setState),Oe("snapGrid",L,we.setState),Oe("onNodesChange",O,we.setState),Oe("onEdgesChange",D,we.setState),Oe("connectOnClick",Q,we.setState),Oe("fitViewOnInit",ee,we.setState),Oe("fitViewOnInitOptions",ne,we.setState),Oe("onNodesDelete",W,we.setState),Oe("onEdgesDelete",I,we.setState),Oe("onNodeDrag",V,we.setState),Oe("onNodeDragStart",j,we.setState),Oe("onNodeDragStop",B,we.setState),Oe("onSelectionDrag",U,we.setState),Oe("onSelectionDragStart",$,we.setState),Oe("onSelectionDragStop",z,we.setState),Oe("noPanClassName",k,we.setState),Oe("nodeOrigin",Y,we.setState),Oe("rfId",re,we.setState),Oe("autoPanOnConnect",oe,we.setState),Oe("autoPanOnNodeDrag",le,we.setState),Oe("onError",de,we.setState),Oe("connectionRadius",he,we.setState),Oe("isValidConnection",ue,we.setState),Oe("nodeDragThreshold",me,we.setState),To(e,Re),To(t,Pe),To(w,wt),To(S,Be),To(K,Ue),To(N,ft),null},$h={display:"none"},fN={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Hh="react-flow__node-desc",Bh="react-flow__edge-desc",pN="react-flow__aria-live",hN=e=>e.ariaLiveMessage;function mN({rfId:e}){const t=Me(hN);return te.createElement("div",{id:`${pN}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:fN},t)}function gN({rfId:e,disableKeyboardA11y:t}){return te.createElement(te.Fragment,null,te.createElement("div",{id:`${Hh}-${e}`,style:$h},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),te.createElement("div",{id:`${Bh}-${e}`,style:$h},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&te.createElement(mN,{rfId:e}))}var Oo=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,s]=b.useState(!1),i=b.useRef(!1),a=b.useRef(new Set([])),[c,u]=b.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(E=>typeof E=="string").map(E=>E.split("+")),m=p.reduce((E,v)=>E.concat(...v),[]);return[p,m]}return[[],[]]},[e]);return b.useEffect(()=>{const f=typeof document<"u"?document:null,p=t?.target||f;if(e!==null){const m=x=>{if(i.current=x.ctrlKey||x.metaKey||x.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Kc(x))return!1;const w=Wh(x.code,u);a.current.add(x[w]),zh(c,a.current,!1)&&(x.preventDefault(),s(!0))},E=x=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Kc(x))return!1;const w=Wh(x.code,u);zh(c,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(x[w]),x.key==="Meta"&&a.current.clear(),i.current=!1},v=()=>{a.current.clear(),s(!1)};return p?.addEventListener("keydown",m),p?.addEventListener("keyup",E),window.addEventListener("blur",v),()=>{p?.removeEventListener("keydown",m),p?.removeEventListener("keyup",E),window.removeEventListener("blur",v)}}},[e,s]),r};function zh(e,t,r){return e.filter(s=>r||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function Wh(e,t){return t.includes(e)?"code":"key"}function Gh(e,t,r,s){if(!e.parentNode)return r;const i=t.get(e.parentNode),a=No(i,s);return Gh(i,t,{x:(r.x??0)+a.x,y:(r.y??0)+a.y,z:(i[nt]?.z??0)>(r.z??0)?i[nt]?.z??0:r.z??0},s)}function Yh(e,t,r){e.forEach(s=>{if(s.parentNode&&!e.has(s.parentNode))throw new Error(`Parent node ${s.parentNode} not found`);if(s.parentNode||r?.[s.id]){const{x:i,y:a,z:c}=Gh(s,e,{...s.position,z:s[nt]?.z??0},t);s.positionAbsolute={x:i,y:a},s[nt].z=c,r?.[s.id]&&(s[nt].isParent=!0)}})}function iu(e,t,r,s){const i=new Map,a={},c=s?1e3:0;return e.forEach(u=>{const f=(Yt(u.zIndex)?u.zIndex:0)+(u.selected?c:0),p=t.get(u.id),m={width:p?.width,height:p?.height,...u,positionAbsolute:{x:u.position.x,y:u.position.y}};u.parentNode&&(m.parentNode=u.parentNode,a[u.parentNode]=!0),Object.defineProperty(m,nt,{enumerable:!1,value:{handleBounds:p?.[nt]?.handleBounds,z:f}}),i.set(u.id,m)}),Yh(i,r,a),i}function Kh(e,t={}){const{getNodes:r,width:s,height:i,minZoom:a,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:m,nodeOrigin:E}=e(),v=t.initial&&!p&&m;if(u&&f&&(v||!t.initial)){const _=r().filter(S=>{const N=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return t.nodes?.length?N&&t.nodes.some(O=>O.id===S.id):N}),w=_.every(S=>S.width&&S.height);if(_.length>0&&w){const S=tu(_,E),{x:N,y:O,zoom:D}=Ch(S,s,i,t.minZoom??a,t.maxZoom??c,t.padding??.1),T=ir.translate(N,O).scale(D);return typeof t.duration=="number"&&t.duration>0?u.transform(Hr(f,t.duration),T):u.transform(f,T),!0}}return!1}function EN(e,t){return e.forEach(r=>{const s=t.get(r.id);s&&t.set(s.id,{...s,[nt]:s[nt],selected:r.selected})}),new Map(t)}function yN(e,t){return t.map(r=>{const s=e.find(i=>i.id===r.id);return s&&(r.selected=s.selected),r})}function gl({changedNodes:e,changedEdges:t,get:r,set:s}){const{nodeInternals:i,edges:a,onNodesChange:c,onEdgesChange:u,hasDefaultNodes:f,hasDefaultEdges:p}=r();e?.length&&(f&&s({nodeInternals:EN(e,i)}),c?.(e)),t?.length&&(p&&s({edges:yN(t,a)}),u?.(t))}const Co=()=>{},vN={zoomIn:Co,zoomOut:Co,zoomTo:Co,getZoom:()=>1,setViewport:Co,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Co,fitBounds:Co,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},xN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),SN=()=>{const e=tt(),{d3Zoom:t,d3Selection:r}=Me(xN,gt);return b.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(Hr(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(Hr(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(Hr(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[c,u,f]=e.getState().transform,p=ir.translate(i.x??c,i.y??u).scale(i.zoom??f);t.transform(Hr(r,a?.duration),p)},getViewport:()=>{const[i,a,c]=e.getState().transform;return{x:i,y:a,zoom:c}},fitView:i=>Kh(e.getState,i),setCenter:(i,a,c)=>{const{width:u,height:f,maxZoom:p}=e.getState(),m=typeof c?.zoom<"u"?c.zoom:p,E=u/2-i*m,v=f/2-a*m,x=ir.translate(E,v).scale(m);t.transform(Hr(r,c?.duration),x)},fitBounds:(i,a)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:m,y:E,zoom:v}=Ch(i,c,u,f,p,a?.padding??.1),x=ir.translate(m,E).scale(v);t.transform(Hr(r,a?.duration),x)},project:i=>{const{transform:a,snapToGrid:c,snapGrid:u}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),eu(i,a,c,u)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:c,snapGrid:u,domNode:f}=e.getState();if(!f)return i;const{x:p,y:m}=f.getBoundingClientRect(),E={x:i.x-p,y:i.y-m};return eu(E,a,c,u)},flowToScreenPosition:i=>{const{transform:a,domNode:c}=e.getState();if(!c)return i;const{x:u,y:f}=c.getBoundingClientRect(),p=Rh(i,a);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:vN,[t,r])};function lu(){const e=SN(),t=tt(),r=b.useCallback(()=>t.getState().getNodes().map(w=>({...w})),[]),s=b.useCallback(w=>t.getState().nodeInternals.get(w),[]),i=b.useCallback(()=>{const{edges:w=[]}=t.getState();return w.map(S=>({...S}))},[]),a=b.useCallback(w=>{const{edges:S=[]}=t.getState();return S.find(N=>N.id===w)},[]),c=b.useCallback(w=>{const{getNodes:S,setNodes:N,hasDefaultNodes:O,onNodesChange:D}=t.getState(),T=S(),A=typeof w=="function"?w(T):w;if(O)N(A);else if(D){const L=A.length===0?T.map(F=>({type:"remove",id:F.id})):A.map(F=>({item:F,type:"reset"}));D(L)}},[]),u=b.useCallback(w=>{const{edges:S=[],setEdges:N,hasDefaultEdges:O,onEdgesChange:D}=t.getState(),T=typeof w=="function"?w(S):w;if(O)N(T);else if(D){const A=T.length===0?S.map(L=>({type:"remove",id:L.id})):T.map(L=>({item:L,type:"reset"}));D(A)}},[]),f=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:N,setNodes:O,hasDefaultNodes:D,onNodesChange:T}=t.getState();if(D){const L=[...N(),...S];O(L)}else if(T){const A=S.map(L=>({item:L,type:"add"}));T(A)}},[]),p=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:N=[],setEdges:O,hasDefaultEdges:D,onEdgesChange:T}=t.getState();if(D)O([...N,...S]);else if(T){const A=S.map(L=>({item:L,type:"add"}));T(A)}},[]),m=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:N}=t.getState(),[O,D,T]=N;return{nodes:w().map(A=>({...A})),edges:S.map(A=>({...A})),viewport:{x:O,y:D,zoom:T}}},[]),E=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:N,getNodes:O,edges:D,hasDefaultNodes:T,hasDefaultEdges:A,onNodesDelete:L,onEdgesDelete:F,onNodesChange:K,onEdgesChange:Q}=t.getState(),X=(w||[]).map(V=>V.id),ee=(S||[]).map(V=>V.id),ne=O().reduce((V,j)=>{const B=!X.includes(j.id)&&j.parentNode&&V.find($=>$.id===j.parentNode);return(typeof j.deletable=="boolean"?j.deletable:!0)&&(X.includes(j.id)||B)&&V.push(j),V},[]),W=D.filter(V=>typeof V.deletable=="boolean"?V.deletable:!0),I=W.filter(V=>ee.includes(V.id));if(ne||I){const V=Oh(ne,W),j=[...I,...V],B=j.reduce((U,$)=>(U.includes($.id)||U.push($.id),U),[]);if((A||T)&&(A&&t.setState({edges:D.filter(U=>!B.includes(U.id))}),T&&(ne.forEach(U=>{N.delete(U.id)}),t.setState({nodeInternals:new Map(N)}))),B.length>0&&(F?.(j),Q&&Q(B.map(U=>({id:U,type:"remove"})))),ne.length>0&&(L?.(ne),K)){const U=ne.map($=>({id:$.id,type:"remove"}));K(U)}}},[]),v=b.useCallback(w=>{const S=Hw(w),N=S?null:t.getState().nodeInternals.get(w.id);return[S?w:fh(N),N,S]},[]),x=b.useCallback((w,S=!0,N)=>{const[O,D,T]=v(w);return O?(N||t.getState().getNodes()).filter(A=>{if(!T&&(A.id===D.id||!A.positionAbsolute))return!1;const L=fh(A),F=Yc(L,O);return S&&F>0||F>=O.width*O.height}):[]},[]),_=b.useCallback((w,S,N=!0)=>{const[O]=v(w);if(!O)return!1;const D=Yc(O,S);return N&&D>0||D>=O.width*O.height},[]);return b.useMemo(()=>({...e,getNodes:r,getNode:s,getEdges:i,getEdge:a,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:m,deleteElements:E,getIntersectingNodes:x,isNodeIntersecting:_}),[e,r,s,i,a,c,u,f,p,m,E,x,_])}const _N={actInsideInputWithModifier:!1};var wN=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=tt(),{deleteElements:s}=lu(),i=Oo(e,_N),a=Oo(t);b.useEffect(()=>{if(i){const{edges:c,getNodes:u}=r.getState(),f=u().filter(m=>m.selected),p=c.filter(m=>m.selected);s({nodes:f,edges:p}),r.setState({nodesSelectionActive:!1})}},[i]),b.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function NN(e){const t=tt();b.useEffect(()=>{let r;const s=()=>{if(!e.current)return;const i=zc(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Vn.error004()),t.setState({width:i.width||500,height:i.height||500})};return s(),window.addEventListener("resize",s),e.current&&(r=new ResizeObserver(()=>s()),r.observe(e.current)),()=>{window.removeEventListener("resize",s),r&&e.current&&r.unobserve(e.current)}},[])}const au={position:"absolute",width:"100%",height:"100%",top:0,left:0},RN=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,El=e=>({x:e.x,y:e.y,zoom:e.k}),Ao=(e,t)=>e.target.closest(`.${t}`),Xh=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Qh=e=>{const t=e.ctrlKey&&dl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},TN=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),ON=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=$r.Free,zoomOnDoubleClick:p=!0,elementsSelectable:m,panOnDrag:E=!0,defaultViewport:v,translateExtent:x,minZoom:_,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:N=!0,children:O,noWheelClassName:D,noPanClassName:T})=>{const A=b.useRef(),L=tt(),F=b.useRef(!1),K=b.useRef(!1),Q=b.useRef(null),X=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:ee,d3Selection:ne,d3ZoomHandler:W,userSelectionActive:I}=Me(TN,gt),V=Oo(S),j=b.useRef(0),B=b.useRef(!1),U=b.useRef();return NN(Q),b.useEffect(()=>{if(Q.current){const $=Q.current.getBoundingClientRect(),z=kw().scaleExtent([_,w]).translateExtent(x),k=on(Q.current).call(z),Y=ir.translate(v.x,v.y).scale(_o(v.zoom,_,w)),re=[[0,0],[$.width,$.height]],oe=z.constrain()(Y,re,x);z.transform(k,oe),z.wheelDelta(Qh),L.setState({d3Zoom:z,d3Selection:k,d3ZoomHandler:k.on("wheel.zoom"),transform:[oe.x,oe.y,oe.k],domNode:Q.current.closest(".react-flow")})}},[]),b.useEffect(()=>{ne&&ee&&(c&&!V&&!I?ne.on("wheel.zoom",$=>{if(Ao($,D))return!1;$.preventDefault(),$.stopImmediatePropagation();const z=ne.property("__zoom").k||1,k=dl();if($.ctrlKey&&a&&k){const me=_n($),Re=Qh($),Pe=z*Math.pow(2,Re);ee.scaleTo(ne,Pe,me,$);return}const Y=$.deltaMode===1?20:1;let re=f===$r.Vertical?0:$.deltaX*Y,oe=f===$r.Horizontal?0:$.deltaY*Y;!k&&$.shiftKey&&f!==$r.Vertical&&(re=$.deltaY*Y,oe=0),ee.translateBy(ne,-(re/z)*u,-(oe/z)*u,{internal:!0});const le=El(ne.property("__zoom")),{onViewportChangeStart:de,onViewportChange:he,onViewportChangeEnd:ue}=L.getState();clearTimeout(U.current),B.current||(B.current=!0,t?.($,le),de?.(le)),B.current&&(e?.($,le),he?.(le),U.current=setTimeout(()=>{r?.($,le),ue?.(le),B.current=!1},150))},{passive:!1}):typeof W<"u"&&ne.on("wheel.zoom",function($,z){if(!N||Ao($,D))return null;$.preventDefault(),W.call(this,$,z)},{passive:!1}))},[I,c,f,ne,ee,W,V,a,N,D,t,e,r]),b.useEffect(()=>{ee&&ee.on("start",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;j.current=$.sourceEvent?.button;const{onViewportChangeStart:z}=L.getState(),k=El($.transform);F.current=!0,X.current=k,$.sourceEvent?.type==="mousedown"&&L.setState({paneDragging:!0}),z?.(k),t?.($.sourceEvent,k)})},[ee,t]),b.useEffect(()=>{ee&&(I&&!F.current?ee.on("zoom",null):I||ee.on("zoom",$=>{const{onViewportChange:z}=L.getState();if(L.setState({transform:[$.transform.x,$.transform.y,$.transform.k]}),K.current=!!(s&&Xh(E,j.current??0)),(e||z)&&!$.sourceEvent?.internal){const k=El($.transform);z?.(k),e?.($.sourceEvent,k)}}))},[I,ee,e,E,s]),b.useEffect(()=>{ee&&ee.on("end",$=>{if(!$.sourceEvent||$.sourceEvent.internal)return null;const{onViewportChangeEnd:z}=L.getState();if(F.current=!1,L.setState({paneDragging:!1}),s&&Xh(E,j.current??0)&&!K.current&&s($.sourceEvent),K.current=!1,(r||z)&&RN(X.current,$.transform)){const k=El($.transform);X.current=k,clearTimeout(A.current),A.current=setTimeout(()=>{z?.(k),r?.($.sourceEvent,k)},c?150:0)}})},[ee,c,E,r,s]),b.useEffect(()=>{ee&&ee.filter($=>{const z=V||i,k=a&&$.ctrlKey;if((E===!0||Array.isArray(E)&&E.includes(1))&&$.button===1&&$.type==="mousedown"&&(Ao($,"react-flow__node")||Ao($,"react-flow__edge")))return!0;if(!E&&!z&&!c&&!p&&!a||I||!p&&$.type==="dblclick"||Ao($,D)&&$.type==="wheel"||Ao($,T)&&($.type!=="wheel"||c&&$.type==="wheel"&&!V)||!a&&$.ctrlKey&&$.type==="wheel"||!z&&!c&&!k&&$.type==="wheel"||!E&&($.type==="mousedown"||$.type==="touchstart")||Array.isArray(E)&&!E.includes($.button)&&($.type==="mousedown"||$.type==="touchstart"))return!1;const Y=Array.isArray(E)&&E.includes($.button)||!$.button||$.button<=1;return(!$.ctrlKey||$.type==="wheel")&&Y})},[I,ee,i,a,c,p,E,m,V]),te.createElement("div",{className:"react-flow__renderer",ref:Q,style:au},O)},CN=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function AN(){const{userSelectionActive:e,userSelectionRect:t}=Me(CN,gt);return e&&t?te.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function qh(e,t){const r=e.find(s=>s.id===t.parentNode);if(r){const s=t.position.x+t.width-r.width,i=t.position.y+t.height-r.height;if(s>0||i>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),t.position.x<0){const a=Math.abs(t.position.x);r.position.x=r.position.x-a,r.style.width+=a,t.position.x=0}if(t.position.y<0){const a=Math.abs(t.position.y);r.position.y=r.position.y-a,r.style.height+=a,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function Zh(e,t){if(e.some(s=>s.type==="reset"))return e.filter(s=>s.type==="reset").map(s=>s.item);const r=e.filter(s=>s.type==="add").map(s=>s.item);return t.reduce((s,i)=>{const a=e.filter(u=>u.id===i.id);if(a.length===0)return s.push(i),s;const c={...i};for(const u of a)if(u)switch(u.type){case"select":{c.selected=u.selected;break}case"position":{typeof u.position<"u"&&(c.position=u.position),typeof u.positionAbsolute<"u"&&(c.positionAbsolute=u.positionAbsolute),typeof u.dragging<"u"&&(c.dragging=u.dragging),c.expandParent&&qh(s,c);break}case"dimensions":{typeof u.dimensions<"u"&&(c.width=u.dimensions.width,c.height=u.dimensions.height),typeof u.updateStyle<"u"&&(c.style={...c.style||{},...u.dimensions}),typeof u.resizing=="boolean"&&(c.resizing=u.resizing),c.expandParent&&qh(s,c);break}case"remove":return s}return s.push(c),s},r)}function Jh(e,t){return Zh(e,t)}function IN(e,t){return Zh(e,t)}const ur=(e,t)=>({id:e,type:"select",selected:t});function Io(e,t){return e.reduce((r,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,r.push(ur(s.id,!0))):s.selected&&!i&&(s.selected=!1,r.push(ur(s.id,!1))),r},[])}const cu=(e,t)=>r=>{r.target===t.current&&e?.(r)},bN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),em=b.memo(({isSelecting:e,selectionMode:t=Ms.Full,panOnDrag:r,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:E})=>{const v=b.useRef(null),x=tt(),_=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:N,elementsSelectable:O,dragging:D}=Me(bN,gt),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,w.current=0},A=W=>{a?.(W),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},L=W=>{if(Array.isArray(r)&&r?.includes(2)){W.preventDefault();return}c?.(W)},F=u?W=>u(W):void 0,K=W=>{const{resetSelectedElements:I,domNode:V}=x.getState();if(S.current=V?.getBoundingClientRect(),!O||!e||W.button!==0||W.target!==v.current||!S.current)return;const{x:j,y:B}=lr(W,S.current);I(),x.setState({userSelectionRect:{width:0,height:0,startX:j,startY:B,x:j,y:B}}),s?.(W)},Q=W=>{const{userSelectionRect:I,nodeInternals:V,edges:j,transform:B,onNodesChange:U,onEdgesChange:$,nodeOrigin:z,getNodes:k}=x.getState();if(!e||!S.current||!I)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Y=lr(W,S.current),re=I.startX??0,oe=I.startY??0,le={...I,x:Y.x<re?Y.x:re,y:Y.y<oe?Y.y:oe,width:Math.abs(Y.x-re),height:Math.abs(Y.y-oe)},de=k(),he=Th(V,le,B,t===Ms.Partial,!0,z),ue=Oh(he,j).map(Re=>Re.id),me=he.map(Re=>Re.id);if(_.current!==me.length){_.current=me.length;const Re=Io(de,me);Re.length&&U?.(Re)}if(w.current!==ue.length){w.current=ue.length;const Re=Io(j,ue);Re.length&&$?.(Re)}x.setState({userSelectionRect:le})},X=W=>{if(W.button!==0)return;const{userSelectionRect:I}=x.getState();!N&&I&&W.target===v.current&&A?.(W),x.setState({nodesSelectionActive:_.current>0}),T(),i?.(W)},ee=W=>{N&&(x.setState({nodesSelectionActive:_.current>0}),i?.(W)),T()},ne=O&&(e||N);return te.createElement("div",{className:St(["react-flow__pane",{dragging:D,selection:e}]),onClick:ne?void 0:cu(A,v),onContextMenu:cu(L,v),onWheel:cu(F,v),onMouseEnter:ne?void 0:f,onMouseDown:ne?K:void 0,onMouseMove:ne?Q:p,onMouseUp:ne?X:void 0,onMouseLeave:ne?ee:m,ref:v,style:au},E,te.createElement(AN,null))});em.displayName="Pane";function tm(e,t){if(!e.parentNode)return!1;const r=t.get(e.parentNode);return r?r.selected?!0:tm(r,t):!1}function nm(e,t,r){let s=e;do{if(s?.matches(t))return!0;if(s===r.current)return!1;s=s.parentElement}while(s);return!1}function LN(e,t,r,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||!tm(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height,expandParent:i.expandParent}))}function DN(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function rm(e,t,r,s,i=[0,0],a){const c=DN(e,e.extent||s);let u=c;if(e.extent==="parent"&&!e.expandParent)if(e.parentNode&&e.width&&e.height){const m=r.get(e.parentNode),{x:E,y:v}=No(m,i).positionAbsolute;u=m&&Yt(E)&&Yt(v)&&Yt(m.width)&&Yt(m.height)?[[E+e.width*i[0],v+e.height*i[1]],[E+m.width-e.width+e.width*i[0],v+m.height-e.height+e.height*i[1]]]:u}else a?.("005",Vn.error005()),u=c;else if(e.extent&&e.parentNode&&e.extent!=="parent"){const m=r.get(e.parentNode),{x:E,y:v}=No(m,i).positionAbsolute;u=[[e.extent[0][0]+E,e.extent[0][1]+v],[e.extent[1][0]+E,e.extent[1][1]+v]]}let f={x:0,y:0};if(e.parentNode){const m=r.get(e.parentNode);f=No(m,i).positionAbsolute}const p=u&&u!=="parent"?Wc(t,u):t;return{position:{x:p.x-f.x,y:p.y-f.y},positionAbsolute:p}}function uu({nodeId:e,dragItems:t,nodeInternals:r}){const s=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?s.find(i=>i.id===e):s[0],s]}const om=(e,t,r,s)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),c=t.getBoundingClientRect(),u={x:c.width*s[0],y:c.height*s[1]};return a.map(f=>{const p=f.getBoundingClientRect();return{id:f.getAttribute("data-handleid"),position:f.getAttribute("data-handlepos"),x:(p.left-c.left-u.x)/r,y:(p.top-c.top-u.y)/r,...zc(f)}})};function Fs(e,t,r){return r===void 0?r:s=>{const i=t().nodeInternals.get(e);i&&r(s,{...i})}}function du({id:e,store:t,unselect:r=!1,nodeRef:s}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:c,nodeInternals:u,onError:f}=t.getState(),p=u.get(e);if(!p){f?.("012",Vn.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&c)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>s?.current?.blur())):i([e])}function kN(){const e=tt();return b.useCallback(({sourceEvent:r})=>{const{transform:s,snapGrid:i,snapToGrid:a}=e.getState(),c=r.touches?r.touches[0].clientX:r.clientX,u=r.touches?r.touches[0].clientY:r.clientY,f={x:(c-s[0])/s[2],y:(u-s[1])/s[2]};return{xSnapped:a?i[0]*Math.round(f.x/i[0]):f.x,ySnapped:a?i[1]*Math.round(f.y/i[1]):f.y,...f}},[])}function fu(e){return(t,r,s)=>e?.(t,s)}function sm({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:c}){const u=tt(),[f,p]=b.useState(!1),m=b.useRef([]),E=b.useRef({x:null,y:null}),v=b.useRef(0),x=b.useRef(null),_=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),N=b.useRef(!1),O=kN();return b.useEffect(()=>{if(e?.current){const D=on(e.current),T=({x:F,y:K})=>{const{nodeInternals:Q,onNodeDrag:X,onSelectionDrag:ee,updateNodePositions:ne,nodeExtent:W,snapGrid:I,snapToGrid:V,nodeOrigin:j,onError:B}=u.getState();E.current={x:F,y:K};let U=!1,$={x:0,y:0,x2:0,y2:0};if(m.current.length>1&&W){const k=tu(m.current,j);$=Gc(k)}if(m.current=m.current.map(k=>{const Y={x:F-k.distance.x,y:K-k.distance.y};V&&(Y.x=I[0]*Math.round(Y.x/I[0]),Y.y=I[1]*Math.round(Y.y/I[1]));const re=[[W[0][0],W[0][1]],[W[1][0],W[1][1]]];m.current.length>1&&W&&!k.extent&&(re[0][0]=k.positionAbsolute.x-$.x+W[0][0],re[1][0]=k.positionAbsolute.x+(k.width??0)-$.x2+W[1][0],re[0][1]=k.positionAbsolute.y-$.y+W[0][1],re[1][1]=k.positionAbsolute.y+(k.height??0)-$.y2+W[1][1]);const oe=rm(k,Y,Q,re,j,B);return U=U||k.position.x!==oe.position.x||k.position.y!==oe.position.y,k.position=oe.position,k.positionAbsolute=oe.positionAbsolute,k}),!U)return;ne(m.current,!0,!0),p(!0);const z=i?X:fu(ee);if(z&&w.current){const[k,Y]=uu({nodeId:i,dragItems:m.current,nodeInternals:Q});z(w.current,k,Y)}},A=()=>{if(!x.current)return;const[F,K]=uh(_.current,x.current);if(F!==0||K!==0){const{transform:Q,panBy:X}=u.getState();E.current.x=(E.current.x??0)-F/Q[2],E.current.y=(E.current.y??0)-K/Q[2],X({x:F,y:K})&&T(E.current)}v.current=requestAnimationFrame(A)},L=F=>{const{nodeInternals:K,multiSelectionActive:Q,nodesDraggable:X,unselectNodesAndEdges:ee,onNodeDragStart:ne,onSelectionDragStart:W}=u.getState();N.current=!0;const I=i?ne:fu(W);(!c||!a)&&!Q&&i&&(K.get(i)?.selected||ee()),i&&a&&c&&du({id:i,store:u,nodeRef:e});const V=O(F);if(E.current=V,m.current=LN(K,X,V,i),I&&m.current){const[j,B]=uu({nodeId:i,dragItems:m.current,nodeInternals:K});I(F.sourceEvent,j,B)}};if(t)D.on(".drag",null);else{const F=zS().on("start",K=>{const{domNode:Q,nodeDragThreshold:X}=u.getState();X===0&&L(K);const ee=O(K);E.current=ee,x.current=Q?.getBoundingClientRect()||null,_.current=lr(K.sourceEvent,x.current)}).on("drag",K=>{const Q=O(K),{autoPanOnNodeDrag:X,nodeDragThreshold:ee}=u.getState();if(!S.current&&N.current&&X&&(S.current=!0,A()),!N.current){const ne=Q.xSnapped-(E?.current?.x??0),W=Q.ySnapped-(E?.current?.y??0);Math.sqrt(ne*ne+W*W)>ee&&L(K)}(E.current.x!==Q.xSnapped||E.current.y!==Q.ySnapped)&&m.current&&N.current&&(w.current=K.sourceEvent,_.current=lr(K.sourceEvent,x.current),T(Q))}).on("end",K=>{if(N.current&&(p(!1),S.current=!1,N.current=!1,cancelAnimationFrame(v.current),m.current)){const{updateNodePositions:Q,nodeInternals:X,onNodeDragStop:ee,onSelectionDragStop:ne}=u.getState(),W=i?ee:fu(ne);if(Q(m.current,!1,!1),W){const[I,V]=uu({nodeId:i,dragItems:m.current,nodeInternals:X});W(K.sourceEvent,I,V)}}}).filter(K=>{const Q=K.target;return!K.button&&(!r||!nm(Q,`.${r}`,e))&&(!s||nm(Q,s,e))});return D.call(F),()=>{D.on(".drag",null)}}}},[e,t,r,s,a,u,i,c,O]),f}function im(){const e=tt();return b.useCallback(r=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:m}=e.getState(),E=c().filter(O=>O.selected&&(O.draggable||m&&typeof O.draggable>"u")),v=u?f[0]:5,x=u?f[1]:5,_=r.isShiftPressed?4:1,w=r.x*v*_,S=r.y*x*_,N=E.map(O=>{if(O.positionAbsolute){const D={x:O.positionAbsolute.x+w,y:O.positionAbsolute.y+S};u&&(D.x=f[0]*Math.round(D.x/f[0]),D.y=f[1]*Math.round(D.y/f[1]));const{positionAbsolute:T,position:A}=rm(O,D,s,i,void 0,p);O.position=A,O.positionAbsolute=T}return O});a(N,!0,!1)},[])}const bo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var js=e=>{const t=({id:r,type:s,data:i,xPos:a,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:m,onMouseEnter:E,onMouseMove:v,onMouseLeave:x,onContextMenu:_,onDoubleClick:w,style:S,className:N,isDraggable:O,isSelectable:D,isConnectable:T,isFocusable:A,selectNodesOnDrag:L,sourcePosition:F,targetPosition:K,hidden:Q,resizeObserver:X,dragHandle:ee,zIndex:ne,isParent:W,noDragClassName:I,noPanClassName:V,initialized:j,disableKeyboardA11y:B,ariaLabel:U,rfId:$})=>{const z=tt(),k=b.useRef(null),Y=b.useRef(F),re=b.useRef(K),oe=b.useRef(s),le=D||O||m||E||v||x,de=im(),he=Fs(r,z.getState,E),ue=Fs(r,z.getState,v),me=Fs(r,z.getState,x),Re=Fs(r,z.getState,_),Pe=Fs(r,z.getState,w),Je=Ue=>{const{nodeDragThreshold:ft}=z.getState();if(D&&(!L||!O||ft>0)&&du({id:r,store:z,nodeRef:k}),m){const pt=z.getState().nodeInternals.get(r);pt&&m(Ue,{...pt})}},wt=Ue=>{if(!Kc(Ue))if(ph.includes(Ue.key)&&D){const ft=Ue.key==="Escape";du({id:r,store:z,unselect:ft,nodeRef:k})}else!B&&O&&p&&Object.prototype.hasOwnProperty.call(bo,Ue.key)&&(z.setState({ariaLiveMessage:`Moved selected node ${Ue.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~c}`}),de({x:bo[Ue.key].x,y:bo[Ue.key].y,isShiftPressed:Ue.shiftKey}))};b.useEffect(()=>{if(k.current&&!Q){const Ue=k.current;return X?.observe(Ue),()=>X?.unobserve(Ue)}},[Q]),b.useEffect(()=>{const Ue=oe.current!==s,ft=Y.current!==F,pt=re.current!==K;k.current&&(Ue||ft||pt)&&(Ue&&(oe.current=s),ft&&(Y.current=F),pt&&(re.current=K),z.getState().updateNodeDimensions([{id:r,nodeElement:k.current,forceUpdate:!0}]))},[r,s,F,K]);const Be=sm({nodeRef:k,disabled:Q||!O,noDragClassName:I,handleSelector:ee,nodeId:r,isSelectable:D,selectNodesOnDrag:L});return Q?null:te.createElement("div",{className:St(["react-flow__node",`react-flow__node-${s}`,{[V]:O},N,{selected:p,selectable:D,parent:W,dragging:Be}]),ref:k,style:{zIndex:ne,transform:`translate(${u}px,${f}px)`,pointerEvents:le?"all":"none",visibility:j?"visible":"hidden",...S},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:he,onMouseMove:ue,onMouseLeave:me,onContextMenu:Re,onClick:Je,onDoubleClick:Pe,onKeyDown:A?wt:void 0,tabIndex:A?0:void 0,role:A?"button":void 0,"aria-describedby":B?void 0:`${Hh}-${$}`,"aria-label":U},te.createElement(Xw,{value:r},te.createElement(e,{id:r,data:i,type:s,xPos:a,yPos:c,selected:p,isConnectable:T,sourcePosition:F,targetPosition:K,dragging:Be,dragHandle:ee,zIndex:ne})))};return t.displayName="NodeWrapper",b.memo(t)};const MN=e=>{const t=e.getNodes().filter(r=>r.selected);return{...tu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function PN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const s=tt(),{width:i,height:a,x:c,y:u,transformString:f,userSelectionActive:p}=Me(MN,gt),m=im(),E=b.useRef(null);if(b.useEffect(()=>{r||E.current?.focus({preventScroll:!0})},[r]),sm({nodeRef:E}),p||!i||!a)return null;const v=e?_=>{const w=s.getState().getNodes().filter(S=>S.selected);e(_,w)}:void 0,x=_=>{Object.prototype.hasOwnProperty.call(bo,_.key)&&m({x:bo[_.key].x,y:bo[_.key].y,isShiftPressed:_.shiftKey})};return te.createElement("div",{className:St(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},te.createElement("div",{ref:E,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:r?void 0:-1,onKeyDown:r?void 0:x,style:{width:i,height:a,top:u,left:c}}))}var UN=b.memo(PN);const FN=e=>e.nodesSelectionActive,lm=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,deleteKeyCode:u,onMove:f,onMoveStart:p,onMoveEnd:m,selectionKeyCode:E,selectionOnDrag:v,selectionMode:x,onSelectionStart:_,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:N,zoomActivationKeyCode:O,elementsSelectable:D,zoomOnScroll:T,zoomOnPinch:A,panOnScroll:L,panOnScrollSpeed:F,panOnScrollMode:K,zoomOnDoubleClick:Q,panOnDrag:X,defaultViewport:ee,translateExtent:ne,minZoom:W,maxZoom:I,preventScrolling:V,onSelectionContextMenu:j,noWheelClassName:B,noPanClassName:U,disableKeyboardA11y:$})=>{const z=Me(FN),k=Oo(E),Y=Oo(N),re=Y||X,oe=Y||L,le=k||v&&re!==!0;return wN({deleteKeyCode:u,multiSelectionKeyCode:S}),te.createElement(ON,{onMove:f,onMoveStart:p,onMoveEnd:m,onPaneContextMenu:a,elementsSelectable:D,zoomOnScroll:T,zoomOnPinch:A,panOnScroll:oe,panOnScrollSpeed:F,panOnScrollMode:K,zoomOnDoubleClick:Q,panOnDrag:!k&&re,defaultViewport:ee,translateExtent:ne,minZoom:W,maxZoom:I,zoomActivationKeyCode:O,preventScrolling:V,noWheelClassName:B,noPanClassName:U},te.createElement(em,{onSelectionStart:_,onSelectionEnd:w,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:re,isSelecting:!!le,selectionMode:x},e,z&&te.createElement(UN,{onSelectionContextMenu:j,noPanClassName:U,disableKeyboardA11y:$})))};lm.displayName="FlowRenderer";var jN=b.memo(lm);function VN(e){return Me(b.useCallback(r=>e?Th(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function $N(e){const t={input:js(e.input||Uh),default:js(e.default||ou),output:js(e.output||jh),group:js(e.group||su)},r={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=js(e[a]||ou),i),r);return{...t,...s}}const HN=({x:e,y:t,width:r,height:s,origin:i})=>!r||!s?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-s*i[1]},BN=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),am=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:c}=Me(BN,gt),u=VN(e.onlyRenderVisibleElements),f=b.useRef(),p=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const m=new ResizeObserver(E=>{const v=E.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));a(v)});return f.current=m,m},[]);return b.useEffect(()=>()=>{f?.current?.disconnect()},[]),te.createElement("div",{className:"react-flow__nodes",style:au},u.map(m=>{let E=m.type||"default";e.nodeTypes[E]||(c?.("003",Vn.error003(E)),E="default");const v=e.nodeTypes[E]||e.nodeTypes.default,x=!!(m.draggable||t&&typeof m.draggable>"u"),_=!!(m.selectable||i&&typeof m.selectable>"u"),w=!!(m.connectable||r&&typeof m.connectable>"u"),S=!!(m.focusable||s&&typeof m.focusable>"u"),N=e.nodeExtent?Wc(m.positionAbsolute,e.nodeExtent):m.positionAbsolute,O=N?.x??0,D=N?.y??0,T=HN({x:O,y:D,width:m.width??0,height:m.height??0,origin:e.nodeOrigin});return te.createElement(v,{key:m.id,id:m.id,className:m.className,style:m.style,type:E,data:m.data,sourcePosition:m.sourcePosition||xe.Bottom,targetPosition:m.targetPosition||xe.Top,hidden:m.hidden,xPos:O,yPos:D,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!m.selected,isDraggable:x,isSelectable:_,isConnectable:w,isFocusable:S,resizeObserver:p,dragHandle:m.dragHandle,zIndex:m[nt]?.z??0,isParent:!!m[nt]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!m.width&&!!m.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:m.ariaLabel})}))};am.displayName="NodeRenderer";var zN=b.memo(am);const WN=(e,t,r)=>r===xe.Left?e-t:r===xe.Right?e+t:e,GN=(e,t,r)=>r===xe.Top?e-t:r===xe.Bottom?e+t:e,cm="react-flow__edgeupdater",um=({position:e,centerX:t,centerY:r,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:c,type:u})=>te.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:c,className:St([cm,`${cm}-${u}`]),cx:WN(t,s,e),cy:GN(r,s,e),r:s,stroke:"transparent",fill:"transparent"}),YN=()=>!0;var Lo=e=>{const t=({id:r,className:s,type:i,data:a,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:m,labelStyle:E,labelShowBg:v,labelBgStyle:x,labelBgPadding:_,labelBgBorderRadius:w,style:S,source:N,target:O,sourceX:D,sourceY:T,targetX:A,targetY:L,sourcePosition:F,targetPosition:K,elementsSelectable:Q,hidden:X,sourceHandleId:ee,targetHandleId:ne,onContextMenu:W,onMouseEnter:I,onMouseMove:V,onMouseLeave:j,edgeUpdaterRadius:B,onEdgeUpdate:U,onEdgeUpdateStart:$,onEdgeUpdateEnd:z,markerEnd:k,markerStart:Y,rfId:re,ariaLabel:oe,isFocusable:le,isUpdatable:de,pathOptions:he,interactionWidth:ue})=>{const me=b.useRef(null),[Re,Pe]=b.useState(!1),[Je,wt]=b.useState(!1),Be=tt(),Ue=b.useMemo(()=>`url(#${Jc(Y,re)})`,[Y,re]),ft=b.useMemo(()=>`url(#${Jc(k,re)})`,[k,re]);if(X)return null;const pt=Ke=>{const{edges:it,addSelectedEdges:Gn,unselectNodesAndEdges:bn,multiSelectionActive:Yn}=Be.getState(),qt=it.find(hn=>hn.id===r);qt&&(Q&&(Be.setState({nodesSelectionActive:!1}),qt.selected&&Yn?(bn({nodes:[],edges:[qt]}),me.current?.blur()):Gn([r])),c&&c(Ke,qt))},we=ks(r,Be.getState,u),un=ks(r,Be.getState,W),Ht=ks(r,Be.getState,I),Qt=ks(r,Be.getState,V),Cn=ks(r,Be.getState,j),An=(Ke,it)=>{if(Ke.button!==0)return;const{edges:Gn,isValidConnection:bn}=Be.getState(),Yn=it?O:N,qt=(it?ne:ee)||null,hn=it?"target":"source",Qr=bn||YN,qr=it,Kn=Gn.find(Lt=>Lt.id===r);wt(!0),$?.(Ke,Kn,hn);const Zr=Lt=>{wt(!1),z?.(Lt,Kn,hn)};Lh({event:Ke,handleId:qt,nodeId:Yn,onConnect:Lt=>U?.(Kn,Lt),isTarget:qr,getState:Be.getState,setState:Be.setState,isValidConnection:Qr,edgeUpdaterType:hn,onEdgeUpdateEnd:Zr})},dn=Ke=>An(Ke,!0),zn=Ke=>An(Ke,!1),fn=()=>Pe(!0),pn=()=>Pe(!1),In=!Q&&!c,Wn=Ke=>{if(ph.includes(Ke.key)&&Q){const{unselectNodesAndEdges:it,addSelectedEdges:Gn,edges:bn}=Be.getState();Ke.key==="Escape"?(me.current?.blur(),it({edges:[bn.find(qt=>qt.id===r)]})):Gn([r])}};return te.createElement("g",{className:St(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:f,animated:p,inactive:In,updating:Re}]),onClick:pt,onDoubleClick:we,onContextMenu:un,onMouseEnter:Ht,onMouseMove:Qt,onMouseLeave:Cn,onKeyDown:le?Wn:void 0,tabIndex:le?0:void 0,role:le?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":oe===null?void 0:oe||`Edge from ${N} to ${O}`,"aria-describedby":le?`${Bh}-${re}`:void 0,ref:me},!Je&&te.createElement(e,{id:r,source:N,target:O,selected:f,animated:p,label:m,labelStyle:E,labelShowBg:v,labelBgStyle:x,labelBgPadding:_,labelBgBorderRadius:w,data:a,style:S,sourceX:D,sourceY:T,targetX:A,targetY:L,sourcePosition:F,targetPosition:K,sourceHandleId:ee,targetHandleId:ne,markerStart:Ue,markerEnd:ft,pathOptions:he,interactionWidth:ue}),de&&te.createElement(te.Fragment,null,(de==="source"||de===!0)&&te.createElement(um,{position:F,centerX:D,centerY:T,radius:B,onMouseDown:dn,onMouseEnter:fn,onMouseOut:pn,type:"source"}),(de==="target"||de===!0)&&te.createElement(um,{position:K,centerX:A,centerY:L,radius:B,onMouseDown:zn,onMouseEnter:fn,onMouseOut:pn,type:"target"})))};return t.displayName="EdgeWrapper",b.memo(t)};function KN(e){const t={default:Lo(e.default||hl),straight:Lo(e.bezier||qc),step:Lo(e.step||Qc),smoothstep:Lo(e.step||fl),simplebezier:Lo(e.simplebezier||Xc)},r={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=Lo(e[a]||hl),i),r);return{...t,...s}}function dm(e,t,r=null){const s=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,c=r?.height||t.height;switch(e){case xe.Top:return{x:s+a/2,y:i};case xe.Right:return{x:s+a,y:i+c/2};case xe.Bottom:return{x:s+a/2,y:i+c};case xe.Left:return{x:s,y:i+c/2}}}function fm(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const XN=(e,t,r,s,i,a)=>{const c=dm(r,e,t),u=dm(a,s,i);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function QN({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:s,targetWidth:i,targetHeight:a,width:c,height:u,transform:f}){const p={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+s,t.y+a)};p.x===p.x2&&(p.x2+=1),p.y===p.y2&&(p.y2+=1);const m=Gc({x:(0-f[0])/f[2],y:(0-f[1])/f[2],width:c/f[2],height:u/f[2]}),E=Math.max(0,Math.min(m.x2,p.x2)-Math.max(m.x,p.x)),v=Math.max(0,Math.min(m.y2,p.y2)-Math.max(m.y,p.y));return Math.ceil(E*v)>0}function pm(e){const t=e?.[nt]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const qN=[{level:0,isMaxLevel:!0,edges:[]}];function ZN(e,t,r=!1){let s=-1;const i=e.reduce((c,u)=>{const f=Yt(u.zIndex);let p=f?u.zIndex:0;if(r){const m=t.get(u.target),E=t.get(u.source),v=u.selected||m?.selected||E?.selected,x=Math.max(E?.[nt]?.z||0,m?.[nt]?.z||0,1e3);p=(f?u.zIndex:0)+(v?x:0)}return c[p]?c[p].push(u):c[p]=[u],s=p>s?p:s,c},{}),a=Object.entries(i).map(([c,u])=>{const f=+c;return{edges:u,level:f,isMaxLevel:f===s}});return a.length===0?qN:a}function JN(e,t,r){const s=Me(b.useCallback(i=>e?i.edges.filter(a=>{const c=t.get(a.source),u=t.get(a.target);return c?.width&&c?.height&&u?.width&&u?.height&&QN({sourcePos:c.positionAbsolute||{x:0,y:0},targetPos:u.positionAbsolute||{x:0,y:0},sourceWidth:c.width,sourceHeight:c.height,targetWidth:u.width,targetHeight:u.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return ZN(s,t,r)}const eR=({color:e="none",strokeWidth:t=1})=>te.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),tR=({color:e="none",strokeWidth:t=1})=>te.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),hm={[Ps.Arrow]:eR,[Ps.ArrowClosed]:tR};function nR(e){const t=tt();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(hm,e)?hm[e]:(t.getState().onError?.("009",Vn.error009(e)),null),[e])}const rR=({id:e,type:t,color:r,width:s=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const f=nR(t);return f?te.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${s}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0"},te.createElement(f,{color:r,strokeWidth:c})):null},oR=({defaultColor:e,rfId:t})=>r=>{const s=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(c=>{if(c&&typeof c=="object"){const u=Jc(c,t);s.includes(u)||(i.push({id:u,color:c.color||e,...c}),s.push(u))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},mm=({defaultColor:e,rfId:t})=>{const r=Me(b.useCallback(oR({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,c)=>a.id!==i[c].id)));return te.createElement("defs",null,r.map(s=>te.createElement(rR,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient})))};mm.displayName="MarkerDefinitions";var sR=b.memo(mm);const iR=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),gm=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeUpdate:c,onEdgeContextMenu:u,onEdgeMouseEnter:f,onEdgeMouseMove:p,onEdgeMouseLeave:m,onEdgeClick:E,edgeUpdaterRadius:v,onEdgeDoubleClick:x,onEdgeUpdateStart:_,onEdgeUpdateEnd:w,children:S})=>{const{edgesFocusable:N,edgesUpdatable:O,elementsSelectable:D,width:T,height:A,connectionMode:L,nodeInternals:F,onError:K}=Me(iR,gt),Q=JN(t,F,r);return T?te.createElement(te.Fragment,null,Q.map(({level:X,edges:ee,isMaxLevel:ne})=>te.createElement("svg",{key:X,style:{zIndex:X},width:T,height:A,className:"react-flow__edges react-flow__container"},ne&&te.createElement(sR,{defaultColor:e,rfId:s}),te.createElement("g",null,ee.map(W=>{const[I,V,j]=pm(F.get(W.source)),[B,U,$]=pm(F.get(W.target));if(!j||!$)return null;let z=W.type||"default";i[z]||(K?.("011",Vn.error011(z)),z="default");const k=i[z]||i.default,Y=L===ar.Strict?U.target:(U.target??[]).concat(U.source??[]),re=fm(V.source,W.sourceHandle),oe=fm(Y,W.targetHandle),le=re?.position||xe.Bottom,de=oe?.position||xe.Top,he=!!(W.focusable||N&&typeof W.focusable>"u"),ue=typeof c<"u"&&(W.updatable||O&&typeof W.updatable>"u");if(!re||!oe)return K?.("008",Vn.error008(re,W)),null;const{sourceX:me,sourceY:Re,targetX:Pe,targetY:Je}=XN(I,re,le,B,oe,de);return te.createElement(k,{key:W.id,id:W.id,className:St([W.className,a]),type:z,data:W.data,selected:!!W.selected,animated:!!W.animated,hidden:!!W.hidden,label:W.label,labelStyle:W.labelStyle,labelShowBg:W.labelShowBg,labelBgStyle:W.labelBgStyle,labelBgPadding:W.labelBgPadding,labelBgBorderRadius:W.labelBgBorderRadius,style:W.style,source:W.source,target:W.target,sourceHandleId:W.sourceHandle,targetHandleId:W.targetHandle,markerEnd:W.markerEnd,markerStart:W.markerStart,sourceX:me,sourceY:Re,targetX:Pe,targetY:Je,sourcePosition:le,targetPosition:de,elementsSelectable:D,onEdgeUpdate:c,onContextMenu:u,onMouseEnter:f,onMouseMove:p,onMouseLeave:m,onClick:E,edgeUpdaterRadius:v,onEdgeDoubleClick:x,onEdgeUpdateStart:_,onEdgeUpdateEnd:w,rfId:s,ariaLabel:W.ariaLabel,isFocusable:he,isUpdatable:ue,pathOptions:"pathOptions"in W?W.pathOptions:void 0,interactionWidth:W.interactionWidth})})))),S):null};gm.displayName="EdgeRenderer";var lR=b.memo(gm);const aR=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function cR({children:e}){const t=Me(aR);return te.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function uR(e){const t=lu(),r=b.useRef(!1);b.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const dR={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},Em=({nodeId:e,handleType:t,style:r,type:s=cr.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:m}=Me(b.useCallback(L=>({fromNode:L.nodeInternals.get(e),handleId:L.connectionHandleId,toX:(L.connectionPosition.x-L.transform[0])/L.transform[2],toY:(L.connectionPosition.y-L.transform[1])/L.transform[2],connectionMode:L.connectionMode}),[e]),gt),E=c?.[nt]?.handleBounds;let v=E?.[t];if(m===ar.Loose&&(v=v||E?.[t==="source"?"target":"source"]),!c||!v)return null;const x=u?v.find(L=>L.id===u):v[0],_=x?x.x+x.width/2:(c.width??0)/2,w=x?x.y+x.height/2:c.height??0,S=(c.positionAbsolute?.x??0)+_,N=(c.positionAbsolute?.y??0)+w,O=x?.position,D=O?dR[O]:null;if(!O||!D)return null;if(i)return te.createElement(i,{connectionLineType:s,connectionLineStyle:r,fromNode:c,fromHandle:x,fromX:S,fromY:N,toX:f,toY:p,fromPosition:O,toPosition:D,connectionStatus:a});let T="";const A={sourceX:S,sourceY:N,sourcePosition:O,targetX:f,targetY:p,targetPosition:D};return s===cr.Bezier?[T]=_h(A):s===cr.Step?[T]=Us({...A,borderRadius:0}):s===cr.SmoothStep?[T]=Us(A):s===cr.SimpleBezier?[T]=yh(A):T=`M${S},${N} ${f},${p}`,te.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};Em.displayName="ConnectionLine";const fR=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function pR({containerStyle:e,style:t,type:r,component:s}){const{nodeId:i,handleType:a,nodesConnectable:c,width:u,height:f,connectionStatus:p}=Me(fR,gt);return!(i&&a&&u&&c)?null:te.createElement("svg",{style:e,width:u,height:f,className:"react-flow__edges react-flow__connectionline react-flow__container"},te.createElement("g",{className:St(["react-flow__connection",p])},te.createElement(Em,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:s,connectionStatus:p})))}function ym(e,t){return b.useRef(null),tt(),b.useMemo(()=>t(e),[e])}const vm=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:s,onMoveEnd:i,onInit:a,onNodeClick:c,onEdgeClick:u,onNodeDoubleClick:f,onEdgeDoubleClick:p,onNodeMouseEnter:m,onNodeMouseMove:E,onNodeMouseLeave:v,onNodeContextMenu:x,onSelectionContextMenu:_,onSelectionStart:w,onSelectionEnd:S,connectionLineType:N,connectionLineStyle:O,connectionLineComponent:D,connectionLineContainerStyle:T,selectionKeyCode:A,selectionOnDrag:L,selectionMode:F,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:X,deleteKeyCode:ee,onlyRenderVisibleElements:ne,elementsSelectable:W,selectNodesOnDrag:I,defaultViewport:V,translateExtent:j,minZoom:B,maxZoom:U,preventScrolling:$,defaultMarkerColor:z,zoomOnScroll:k,zoomOnPinch:Y,panOnScroll:re,panOnScrollSpeed:oe,panOnScrollMode:le,zoomOnDoubleClick:de,panOnDrag:he,onPaneClick:ue,onPaneMouseEnter:me,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneScroll:Je,onPaneContextMenu:wt,onEdgeUpdate:Be,onEdgeContextMenu:Ue,onEdgeMouseEnter:ft,onEdgeMouseMove:pt,onEdgeMouseLeave:we,edgeUpdaterRadius:un,onEdgeUpdateStart:Ht,onEdgeUpdateEnd:Qt,noDragClassName:Cn,noWheelClassName:An,noPanClassName:dn,elevateEdgesOnSelect:zn,disableKeyboardA11y:fn,nodeOrigin:pn,nodeExtent:In,rfId:Wn})=>{const Ke=ym(e,$N),it=ym(t,KN);return uR(a),te.createElement(jN,{onPaneClick:ue,onPaneMouseEnter:me,onPaneMouseMove:Re,onPaneMouseLeave:Pe,onPaneContextMenu:wt,onPaneScroll:Je,deleteKeyCode:ee,selectionKeyCode:A,selectionOnDrag:L,selectionMode:F,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:X,elementsSelectable:W,onMove:r,onMoveStart:s,onMoveEnd:i,zoomOnScroll:k,zoomOnPinch:Y,zoomOnDoubleClick:de,panOnScroll:re,panOnScrollSpeed:oe,panOnScrollMode:le,panOnDrag:he,defaultViewport:V,translateExtent:j,minZoom:B,maxZoom:U,onSelectionContextMenu:_,preventScrolling:$,noDragClassName:Cn,noWheelClassName:An,noPanClassName:dn,disableKeyboardA11y:fn},te.createElement(cR,null,te.createElement(lR,{edgeTypes:it,onEdgeClick:u,onEdgeDoubleClick:p,onEdgeUpdate:Be,onlyRenderVisibleElements:ne,onEdgeContextMenu:Ue,onEdgeMouseEnter:ft,onEdgeMouseMove:pt,onEdgeMouseLeave:we,onEdgeUpdateStart:Ht,onEdgeUpdateEnd:Qt,edgeUpdaterRadius:un,defaultMarkerColor:z,noPanClassName:dn,elevateEdgesOnSelect:!!zn,disableKeyboardA11y:fn,rfId:Wn},te.createElement(pR,{style:O,type:N,component:D,containerStyle:T})),te.createElement("div",{className:"react-flow__edgelabel-renderer"}),te.createElement(zN,{nodeTypes:Ke,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:m,onNodeMouseMove:E,onNodeMouseLeave:v,onNodeContextMenu:x,selectNodesOnDrag:I,onlyRenderVisibleElements:ne,noPanClassName:dn,noDragClassName:Cn,disableKeyboardA11y:fn,nodeOrigin:pn,nodeExtent:In,rfId:Wn})))};vm.displayName="GraphView";var hR=b.memo(vm);const pu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],dr={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:pu,nodeExtent:pu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ar.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Bw,isValidConnection:void 0},mR=()=>nx((e,t)=>({...dr,setNodes:r=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:iu(r,s,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:s={}}=t();e({edges:r.map(i=>({...s,...i}))})},setDefaultNodesAndEdges:(r,s)=>{const i=typeof r<"u",a=typeof s<"u",c=i?iu(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:c,edges:a?s:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:s,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:c,fitViewOnInitOptions:u,domNode:f,nodeOrigin:p}=t(),m=f?.querySelector(".react-flow__viewport");if(!m)return;const E=window.getComputedStyle(m),{m22:v}=new window.DOMMatrixReadOnly(E.transform),x=r.reduce((w,S)=>{const N=i.get(S.id);if(N){const O=zc(S.nodeElement);!!(O.width&&O.height&&(N.width!==O.width||N.height!==O.height||S.forceUpdate))&&(i.set(N.id,{...N,[nt]:{...N[nt],handleBounds:{source:om(".source",S.nodeElement,v,p),target:om(".target",S.nodeElement,v,p)}},...O}),w.push({id:N.id,type:"dimensions",dimensions:O}))}return w},[]);Yh(i,p);const _=c||a&&!c&&Kh(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),x?.length>0&&s?.(x)},updateNodePositions:(r,s=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),c=r.map(u=>{const f={id:u.id,type:"position",dragging:i};return s&&(f.positionAbsolute=u.positionAbsolute,f.position=u.position),f});a(c)},triggerNodeChanges:r=>{const{onNodesChange:s,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:c,getNodes:u,elevateNodesOnSelect:f}=t();if(r?.length){if(a){const p=Jh(r,u()),m=iu(p,i,c,f);e({nodeInternals:m})}s?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let c,u=null;s?c=r.map(f=>ur(f,!0)):(c=Io(a(),r),u=Io(i,[])),gl({changedNodes:c,changedEdges:u,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:s,edges:i,getNodes:a}=t();let c,u=null;s?c=r.map(f=>ur(f,!0)):(c=Io(i,r),u=Io(a(),[])),gl({changedNodes:u,changedEdges:c,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:s}={})=>{const{edges:i,getNodes:a}=t(),c=r||a(),u=s||i,f=c.map(m=>(m.selected=!1,ur(m.id,!1))),p=u.map(m=>ur(m.id,!1));gl({changedNodes:f,changedEdges:p,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:s,maxZoom:i}=t();s?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:s,minZoom:i}=t();s?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:s}=t(),a=s().filter(u=>u.selected).map(u=>ur(u.id,!1)),c=r.filter(u=>u.selected).map(u=>ur(u.id,!1));gl({changedNodes:a,changedEdges:c,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=Wc(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(s)})},panBy:r=>{const{transform:s,width:i,height:a,d3Zoom:c,d3Selection:u,translateExtent:f}=t();if(!c||!u||!r.x&&!r.y)return!1;const p=ir.translate(s[0]+r.x,s[1]+r.y).scale(s[2]),m=[[0,0],[i,a]],E=c?.constrain()(p,m,f);return c.transform(u,E),s[0]!==E.x||s[1]!==E.y||s[2]!==E.k},cancelConnection:()=>e({connectionNodeId:dr.connectionNodeId,connectionHandleId:dr.connectionHandleId,connectionHandleType:dr.connectionHandleType,connectionStatus:dr.connectionStatus,connectionStartHandle:dr.connectionStartHandle,connectionEndHandle:dr.connectionEndHandle}),reset:()=>e({...dr})}),Object.is),hu=({children:e})=>{const t=b.useRef(null);return t.current||(t.current=mR()),te.createElement(Mw,{value:t.current},e)};hu.displayName="ReactFlowProvider";const xm=({children:e})=>b.useContext(ul)?te.createElement(te.Fragment,null,e):te.createElement(hu,null,e);xm.displayName="ReactFlowWrapper";const gR={input:Uh,default:ou,output:jh,group:su},ER={default:hl,straight:qc,step:Qc,smoothstep:fl,simplebezier:Xc},yR=[0,0],vR=[15,15],xR={x:0,y:0,zoom:1},SR={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Sm=b.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:s,className:i,nodeTypes:a=gR,edgeTypes:c=ER,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:m,onMoveStart:E,onMoveEnd:v,onConnect:x,onConnectStart:_,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,onNodeMouseEnter:O,onNodeMouseMove:D,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:L,onNodeDragStart:F,onNodeDrag:K,onNodeDragStop:Q,onNodesDelete:X,onEdgesDelete:ee,onSelectionChange:ne,onSelectionDragStart:W,onSelectionDrag:I,onSelectionDragStop:V,onSelectionContextMenu:j,onSelectionStart:B,onSelectionEnd:U,connectionMode:$=ar.Strict,connectionLineType:z=cr.Bezier,connectionLineStyle:k,connectionLineComponent:Y,connectionLineContainerStyle:re,deleteKeyCode:oe="Backspace",selectionKeyCode:le="Shift",selectionOnDrag:de=!1,selectionMode:he=Ms.Full,panActivationKeyCode:ue="Space",multiSelectionKeyCode:me=dl()?"Meta":"Control",zoomActivationKeyCode:Re=dl()?"Meta":"Control",snapToGrid:Pe=!1,snapGrid:Je=vR,onlyRenderVisibleElements:wt=!1,selectNodesOnDrag:Be=!0,nodesDraggable:Ue,nodesConnectable:ft,nodesFocusable:pt,nodeOrigin:we=yR,edgesFocusable:un,edgesUpdatable:Ht,elementsSelectable:Qt,defaultViewport:Cn=xR,minZoom:An=.5,maxZoom:dn=2,translateExtent:zn=pu,preventScrolling:fn=!0,nodeExtent:pn,defaultMarkerColor:In="#b1b1b7",zoomOnScroll:Wn=!0,zoomOnPinch:Ke=!0,panOnScroll:it=!1,panOnScrollSpeed:Gn=.5,panOnScrollMode:bn=$r.Free,zoomOnDoubleClick:Yn=!0,panOnDrag:qt=!0,onPaneClick:hn,onPaneMouseEnter:Qr,onPaneMouseMove:qr,onPaneMouseLeave:Kn,onPaneScroll:Zr,onPaneContextMenu:Xn,children:Lt,onEdgeUpdate:zl,onEdgeContextMenu:Wl,onEdgeDoubleClick:Gl,onEdgeMouseEnter:Yl,onEdgeMouseMove:Kl,onEdgeMouseLeave:ri,onEdgeUpdateStart:Xl,onEdgeUpdateEnd:Jr,edgeUpdaterRadius:oi=10,onNodesChange:eo,onEdgesChange:sd,noDragClassName:to="nodrag",noWheelClassName:Ko="nowheel",noPanClassName:no="nopan",fitView:si=!1,fitViewOptions:id,connectOnClick:ld=!0,attributionPosition:ad,proOptions:Qn,defaultEdgeOptions:Ql,elevateNodesOnSelect:ql=!0,elevateEdgesOnSelect:cd=!1,disableKeyboardA11y:ii=!1,autoPanOnConnect:Zl=!0,autoPanOnNodeDrag:Jl=!0,connectionRadius:ea=20,isValidConnection:ud,onError:dd,style:We,id:ta,nodeDragThreshold:li,...na},Xo)=>{const ai=ta||"1";return te.createElement("div",{...na,style:{...We,...SR},ref:Xo,className:St(["react-flow",i]),"data-testid":"rf__wrapper",id:ta},te.createElement(xm,null,te.createElement(hR,{onInit:p,onMove:m,onMoveStart:E,onMoveEnd:v,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:O,onNodeMouseMove:D,onNodeMouseLeave:T,onNodeContextMenu:A,onNodeDoubleClick:L,nodeTypes:a,edgeTypes:c,connectionLineType:z,connectionLineStyle:k,connectionLineComponent:Y,connectionLineContainerStyle:re,selectionKeyCode:le,selectionOnDrag:de,selectionMode:he,deleteKeyCode:oe,multiSelectionKeyCode:me,panActivationKeyCode:ue,zoomActivationKeyCode:Re,onlyRenderVisibleElements:wt,selectNodesOnDrag:Be,defaultViewport:Cn,translateExtent:zn,minZoom:An,maxZoom:dn,preventScrolling:fn,zoomOnScroll:Wn,zoomOnPinch:Ke,zoomOnDoubleClick:Yn,panOnScroll:it,panOnScrollSpeed:Gn,panOnScrollMode:bn,panOnDrag:qt,onPaneClick:hn,onPaneMouseEnter:Qr,onPaneMouseMove:qr,onPaneMouseLeave:Kn,onPaneScroll:Zr,onPaneContextMenu:Xn,onSelectionContextMenu:j,onSelectionStart:B,onSelectionEnd:U,onEdgeUpdate:zl,onEdgeContextMenu:Wl,onEdgeDoubleClick:Gl,onEdgeMouseEnter:Yl,onEdgeMouseMove:Kl,onEdgeMouseLeave:ri,onEdgeUpdateStart:Xl,onEdgeUpdateEnd:Jr,edgeUpdaterRadius:oi,defaultMarkerColor:In,noDragClassName:to,noWheelClassName:Ko,noPanClassName:no,elevateEdgesOnSelect:cd,rfId:ai,disableKeyboardA11y:ii,nodeOrigin:we,nodeExtent:pn}),te.createElement(dN,{nodes:e,edges:t,defaultNodes:r,defaultEdges:s,onConnect:x,onConnectStart:_,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:N,nodesDraggable:Ue,nodesConnectable:ft,nodesFocusable:pt,edgesFocusable:un,edgesUpdatable:Ht,elementsSelectable:Qt,elevateNodesOnSelect:ql,minZoom:An,maxZoom:dn,nodeExtent:pn,onNodesChange:eo,onEdgesChange:sd,snapToGrid:Pe,snapGrid:Je,connectionMode:$,translateExtent:zn,connectOnClick:ld,defaultEdgeOptions:Ql,fitView:si,fitViewOptions:id,onNodesDelete:X,onEdgesDelete:ee,onNodeDragStart:F,onNodeDrag:K,onNodeDragStop:Q,onSelectionDrag:I,onSelectionDragStart:W,onSelectionDragStop:V,noPanClassName:no,nodeOrigin:we,rfId:ai,autoPanOnConnect:Zl,autoPanOnNodeDrag:Jl,onError:dd,connectionRadius:ea,isValidConnection:ud,nodeDragThreshold:li}),te.createElement(cN,{onSelectionChange:ne}),Lt,te.createElement(Uw,{proOptions:Qn,position:ad}),te.createElement(gN,{rfId:ai,disableKeyboardA11y:ii})))});Sm.displayName="ReactFlow";const _R=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function wR({children:e}){const t=Me(_R);return t?Bc.createPortal(e,t):null}function NR(){const e=tt();return b.useCallback(t=>{const{domNode:r,updateNodeDimensions:s}=e.getState(),a=(Array.isArray(t)?t:[t]).reduce((c,u)=>{const f=r?.querySelector(`.react-flow__node[data-id="${u}"]`);return f&&c.push({id:u,nodeElement:f,forceUpdate:!0}),c},[]);requestAnimationFrame(()=>s(a))},[])}function RR({onStart:e,onChange:t,onEnd:r}){const s=tt();b.useEffect(()=>{s.setState({onViewportChangeStart:e})},[e]),b.useEffect(()=>{s.setState({onViewportChange:t})},[t]),b.useEffect(()=>{s.setState({onViewportChangeEnd:r})},[r])}const TR=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(r=>e.includeHiddenNodes?!0:!r.hidden).every(r=>r[nt]?.handleBounds!==void 0),OR={includeHiddenNodes:!1};function CR(e=OR){return Me(TR(e))}function AR(){return te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},te.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function IR(){return te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},te.createElement("path",{d:"M0 0h32v4.2H0z"}))}function bR(){return te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},te.createElement("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 LR(){return te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},te.createElement("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 DR(){return te.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},te.createElement("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"}))}const Vs=({children:e,className:t,...r})=>te.createElement("button",{type:"button",className:St(["react-flow__controls-button",t]),...r},e);Vs.displayName="ControlButton";const kR=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),_m=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:s=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:c,onFitView:u,onInteractiveChange:f,className:p,children:m,position:E="bottom-left"})=>{const v=tt(),[x,_]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:N}=Me(kR,gt),{zoomIn:O,zoomOut:D,fitView:T}=lu();if(b.useEffect(()=>{_(!0)},[]),!x)return null;const A=()=>{O(),a?.()},L=()=>{D(),c?.()},F=()=>{T(i),u?.()},K=()=>{v.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),f?.(!w)};return te.createElement(Ds,{className:St(["react-flow__controls",p]),position:E,style:e,"data-testid":"rf__controls"},t&&te.createElement(te.Fragment,null,te.createElement(Vs,{onClick:A,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:N},te.createElement(AR,null)),te.createElement(Vs,{onClick:L,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},te.createElement(IR,null))),r&&te.createElement(Vs,{className:"react-flow__controls-fitview",onClick:F,title:"fit view","aria-label":"fit view"},te.createElement(bR,null)),s&&te.createElement(Vs,{className:"react-flow__controls-interactive",onClick:K,title:"toggle interactivity","aria-label":"toggle interactivity"},w?te.createElement(DR,null):te.createElement(LR,null)),m)};_m.displayName="Controls";var MR=b.memo(_m),Kt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Kt||(Kt={}));function PR({color:e,dimensions:t,lineWidth:r}){return te.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function UR({color:e,radius:t}){return te.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const FR={[Kt.Dots]:"#91919a",[Kt.Lines]:"#eee",[Kt.Cross]:"#e2e2e2"},jR={[Kt.Dots]:1,[Kt.Lines]:1,[Kt.Cross]:6},VR=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function wm({id:e,variant:t=Kt.Dots,gap:r=20,size:s,lineWidth:i=1,offset:a=2,color:c,style:u,className:f}){const p=b.useRef(null),{transform:m,patternId:E}=Me(VR,gt),v=c||FR[t],x=s||jR[t],_=t===Kt.Dots,w=t===Kt.Cross,S=Array.isArray(r)?r:[r,r],N=[S[0]*m[2]||1,S[1]*m[2]||1],O=x*m[2],D=w?[O,O]:N,T=_?[O/a,O/a]:[D[0]/a,D[1]/a];return te.createElement("svg",{className:St(["react-flow__background",f]),style:{...u,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background"},te.createElement("pattern",{id:E+e,x:m[0]%N[0],y:m[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},_?te.createElement(UR,{color:v,radius:O/a}):te.createElement(PR,{dimensions:D,color:v,lineWidth:i})),te.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E+e})`}))}wm.displayName="Background";var $R=b.memo(wm);const Nm={},{useDebugValue:HR}=te,{useSyncExternalStoreWithSelector:BR}=fp;let Rm=!1;function zR(e,t=e.getState,r){(Nm?"production":void 0)!=="production"&&r&&!Rm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),Rm=!0);const s=BR(e.subscribe,e.getState,e.getServerState||e.getState,t,r);return HR(s),s}const Tm=e=>{(Nm?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?hp(e):e,r=(s,i)=>zR(t,s,i);return Object.assign(r,t),r},Do=e=>e?Tm(e):Tm,WR=!1,GR="prod",YR="0.0.13",$s="0.0.10",Om=230,KR=640,Cm=20,ko={markerEnd:{height:20,type:Ps.ArrowClosed,width:20},style:{stroke:"inherit",strokeWidth:1.5},type:"floating"},XR="422",QR="404",Am="document-sync",mu=1e3,qR=1e3,ZR=300,JR=5e3,Im=300,e1="Shift+Backspace",t1="Meta",n1="Shift",yl=25,gu={duration:mu,includeHiddenNodes:!1,padding:.3},Eu=()=>{const e={},t=document.querySelector('meta[name="csrf-token"]');return t&&(e["X-CSRF-Token"]=t?.content),e},r1=(e,t)=>{const r=new Blob([JSON.stringify({edges:t,nodes:e},null,2)],{type:"application/json"}),s=window.URL.createObjectURL(r),i=window.open();i?.location?.href&&(i.location.href=s)},bm=e=>({...e,...ko}),Lm=e=>e.type==="handleCall"?{...e,deletable:!1}:e,Dm=e=>e==="success"?"positive":"negative",o1=e=>e.toLowerCase().replace(/ /g,"-"),jt=e=>typeof e=="string"?e.trim():e,km=(e,t,r)=>e.sort((s,i)=>{const a=s[r],c=i[r];if(typeof a=="string"&&typeof c=="string")return a.toLowerCase().localeCompare(c.toLowerCase());if(typeof a=="number"&&typeof c=="number")return a-c;throw new Error(`sort fn can only sort strings & numbers, but got ${typeof a} and ${typeof c}`)}),s1=e=>{try{return new URL(e).pathname.split("/").at(-1)}catch{return""}};function Mm(e,t){const r=[{divisor:1,threshold:60,unit:"second"},{divisor:60,threshold:3600,unit:"minute"},{divisor:3600,threshold:86400,unit:"hour"},{divisor:86400,threshold:86400,unit:"day"}],s=new Intl.RelativeTimeFormat(e,{numeric:"always",...t});return function(a,c={}){const{excludeUnits:u={}}=c,f=new Date().getTime(),p=new Date(a).getTime(),m=Math.floor((f-p)/1e3),E=r.filter(({unit:w})=>!u[w]),{divisor:v,unit:x}=E.find(({threshold:w})=>Math.abs(m)<w)??E[E.length-1],_=Math.floor(m/v);return s.format(-_,x)}}function Pm(e){return new Promise(t=>setTimeout(t,e))}const i1=(e,t,r)=>{const s=e==="ArrowDown";if(!t)return s?r[0]:r[r.length-1];const i=r.findIndex(u=>u.id===t),a=s?i+1:i-1;if(a<0||a>=r.length)return;const c=r[a];if(!c)throw new Error(`Could not find option at index ${a}`);return c},Um=(e,t,r)=>{const s=e.find(i=>{if(t in i)return i[t]===r});if(!s)throw new Error(`Could not find option with id ${t}`);return s},l1=e=>Object.keys(e),yu=()=>({callOrder:"single",callStateEvents:"",callStateUrl:"",connections:[{connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:Le()}],defaultFrom:"",defaultTimeout:"",destinationType:"phone",options:[{id:Le(),result:"success"},{id:Le(),result:"noAnswer"},{id:Le(),result:"busy"},{id:Le(),result:"decline"},{id:Le(),result:"error"}]}),Fm={aiAgent:()=>({agent:""}),answer:()=>({valid:!0}),cond:()=>({fallback:Le(),options:[{id:Le(),value:""}]}),condRequest:()=>({body:"",error:Le(),fallback:Le(),headers:"",method:"POST",options:[{id:Le(),value:""}],url:""}),executeSWML:()=>({dest:"",fallback:Le(),meta:"",options:[{id:Le(),value:""}],params:""}),forwardAddress:()=>({...yu(),destinationType:"address"}),forwardPhone:()=>({...yu(),destinationType:"phone"}),forwardResource:()=>({...yu(),destinationType:"resource"}),handleCall:()=>({valid:!0}),hangup:()=>({valid:!0}),play:()=>({selected:"",text:"",url:""}),promptPlay:()=>({digitTimeout:"",initialTimeout:"",options:[{command:"",digit:"",id:Le()}],results:[{id:Le(),result:"no_match"},{id:Le(),result:"no_input"}],selected:"",text:"",url:""}),record:()=>({beep:!1,endSilenceTimeout:"",format:"wav",initialTimeout:"",maxLength:"",stereo:!1,terminators:"",valid:!0}),recordCallStart:()=>({beep:!1,controlId:Le(),format:"wav",label:"",stereo:!1,terminators:""}),recordCallStop:()=>({controlId:""}),request:()=>({body:"",headers:"",method:"POST",options:[{id:Le(),result:"success"},{id:Le(),result:"failed"}],url:""}),sendSms:()=>({body:"",fromNumber:"",media:[],region:"",tags:[],toNumber:""}),set:()=>({variables:[{duplicate:!1,id:Le(),key:"",value:""}]}),unset:()=>({variables:[]})},a1={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class vl{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,r)}init(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||a1,this.options=r,this.debug=r.debug}log(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return this.forward(r,"log","",!0)}warn(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return this.forward(r,"warn","",!0)}error(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return this.forward(r,"error","")}deprecate(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return this.forward(r,"warn","WARNING DEPRECATED: ",!0)}forward(t,r,s,i){return i&&!this.debug?null:(typeof t[0]=="string"&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new vl(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new vl(this.logger,t)}}var Rn=new vl;class xl{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(s=>{this.observers[s]=this.observers[s]||[],this.observers[s].push(r)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(s=>s!==r)}}emit(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];this.observers[t]&&[].concat(this.observers[t]).forEach(c=>{c(...s)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(c=>{c.apply(c,[t,...s])})}}function Hs(){let e,t;const r=new Promise((s,i)=>{e=s,t=i});return r.resolve=e,r.reject=t,r}function jm(e){return e==null?"":""+e}function c1(e,t,r){e.forEach(s=>{t[s]&&(r[s]=t[s])})}function vu(e,t,r){function s(c){return c&&c.indexOf("###")>-1?c.replace(/###/g,"."):c}function i(){return!e||typeof e=="string"}const a=typeof t!="string"?[].concat(t):t.split(".");for(;a.length>1;){if(i())return{};const c=s(a.shift());!e[c]&&r&&(e[c]=new r),Object.prototype.hasOwnProperty.call(e,c)?e=e[c]:e={}}return i()?{}:{obj:e,k:s(a.shift())}}function Vm(e,t,r){const{obj:s,k:i}=vu(e,t,Object);s[i]=r}function u1(e,t,r,s){const{obj:i,k:a}=vu(e,t,Object);i[a]=i[a]||[],i[a].push(r)}function Sl(e,t){const{obj:r,k:s}=vu(e,t);if(r)return r[s]}function d1(e,t,r){const s=Sl(e,r);return s!==void 0?s:Sl(t,r)}function $m(e,t,r){for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?typeof e[s]=="string"||e[s]instanceof String||typeof t[s]=="string"||t[s]instanceof String?r&&(e[s]=t[s]):$m(e[s],t[s],r):e[s]=t[s]);return e}function Mo(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var f1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};function p1(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>f1[t]):e}const h1=[" ",",","?","!",";"];function m1(e,t,r){t=t||"",r=r||"";const s=h1.filter(c=>t.indexOf(c)<0&&r.indexOf(c)<0);if(s.length===0)return!0;const i=new RegExp(`(${s.map(c=>c==="?"?"\\?":c).join("|")})`);let a=!i.test(e);if(!a){const c=e.indexOf(r);c>0&&!i.test(e.substring(0,c))&&(a=!0)}return a}function _l(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const s=t.split(r);let i=e;for(let a=0;a<s.length;++a){if(!i||typeof i[s[a]]=="string"&&a+1<s.length)return;if(i[s[a]]===void 0){let c=2,u=s.slice(a,a+c).join(r),f=i[u];for(;f===void 0&&s.length>a+c;)c++,u=s.slice(a,a+c).join(r),f=i[u];if(f===void 0)return;if(f===null)return null;if(t.endsWith(u)){if(typeof f=="string")return f;if(u&&typeof f[u]=="string")return f[u]}const p=s.slice(a+c).join(r);return p?_l(f,p,r):void 0}i=i[s[a]]}return i}function wl(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Hm extends xl{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const r=this.options.ns.indexOf(t);r>-1&&this.options.ns.splice(r,1)}getResource(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,c=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let u=[t,r];s&&typeof s!="string"&&(u=u.concat(s)),s&&typeof s=="string"&&(u=u.concat(a?s.split(a):s)),t.indexOf(".")>-1&&(u=t.split("."));const f=Sl(this.data,u);return f||!c||typeof s!="string"?f:_l(this.data&&this.data[t]&&this.data[t][r],s,a)}addResource(t,r,s,i){let a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const c=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator;let u=[t,r];s&&(u=u.concat(c?s.split(c):s)),t.indexOf(".")>-1&&(u=t.split("."),i=r,r=u[1]),this.addNamespaces(r),Vm(this.data,u,i),a.silent||this.emit("added",t,r,s,i)}addResources(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const a in s)(typeof s[a]=="string"||Object.prototype.toString.apply(s[a])==="[object Array]")&&this.addResource(t,r,a,s[a],{silent:!0});i.silent||this.emit("added",t,r,s)}addResourceBundle(t,r,s,i,a){let c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},u=[t,r];t.indexOf(".")>-1&&(u=t.split("."),i=s,s=r,r=u[1]),this.addNamespaces(r);let f=Sl(this.data,u)||{};i?$m(f,s,a):f={...f,...s},Vm(this.data,u,f),c.silent||this.emit("added",t,r,s)}removeResourceBundle(t,r){this.hasResourceBundle(t,r)&&delete this.data[t][r],this.removeNamespaces(r),this.emit("removed",t,r)}hasResourceBundle(t,r){return this.getResource(t,r)!==void 0}getResourceBundle(t,r){return r||(r=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,r)}:this.getResource(t,r)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const r=this.getDataByLanguage(t);return!!(r&&Object.keys(r)||[]).find(i=>r[i]&&Object.keys(r[i]).length>0)}toJSON(){return this.data}}var Bm={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,r,s,i){return e.forEach(a=>{this.processors[a]&&(t=this.processors[a].process(t,r,s,i))}),t}};const zm={};class Nl extends xl{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),c1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Rn.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const s=this.resolve(t,r);return s&&s.res!==void 0}extractFromKey(t,r){let s=r.nsSeparator!==void 0?r.nsSeparator:this.options.nsSeparator;s===void 0&&(s=":");const i=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator;let a=r.ns||this.options.defaultNS||[];const c=s&&t.indexOf(s)>-1,u=!this.options.userDefinedKeySeparator&&!r.keySeparator&&!this.options.userDefinedNsSeparator&&!r.nsSeparator&&!m1(t,s,i);if(c&&!u){const f=t.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:t,namespaces:a};const p=t.split(s);(s!==i||s===i&&this.options.ns.indexOf(p[0])>-1)&&(a=p.shift()),t=p.join(i)}return typeof a=="string"&&(a=[a]),{key:t,namespaces:a}}translate(t,r,s){if(typeof r!="object"&&this.options.overloadTranslationOptionHandler&&(r=this.options.overloadTranslationOptionHandler(arguments)),typeof r=="object"&&(r={...r}),r||(r={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=r.returnDetails!==void 0?r.returnDetails:this.options.returnDetails,a=r.keySeparator!==void 0?r.keySeparator:this.options.keySeparator,{key:c,namespaces:u}=this.extractFromKey(t[t.length-1],r),f=u[u.length-1],p=r.lng||this.language,m=r.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(m){const T=r.nsSeparator||this.options.nsSeparator;return i?{res:`${f}${T}${c}`,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:f,usedParams:this.getUsedParamsDetails(r)}:`${f}${T}${c}`}return i?{res:c,usedKey:c,exactUsedKey:c,usedLng:p,usedNS:f,usedParams:this.getUsedParamsDetails(r)}:c}const E=this.resolve(t,r);let v=E&&E.res;const x=E&&E.usedKey||c,_=E&&E.exactUsedKey||c,w=Object.prototype.toString.apply(v),S=["[object Number]","[object Function]","[object RegExp]"],N=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,O=!this.i18nFormat||this.i18nFormat.handleAsObject;if(O&&v&&(typeof v!="string"&&typeof v!="boolean"&&typeof v!="number")&&S.indexOf(w)<0&&!(typeof N=="string"&&w==="[object Array]")){if(!r.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const T=this.options.returnedObjectHandler?this.options.returnedObjectHandler(x,v,{...r,ns:u}):`key '${c} (${this.language})' returned an object instead of string.`;return i?(E.res=T,E.usedParams=this.getUsedParamsDetails(r),E):T}if(a){const T=w==="[object Array]",A=T?[]:{},L=T?_:x;for(const F in v)if(Object.prototype.hasOwnProperty.call(v,F)){const K=`${L}${a}${F}`;A[F]=this.translate(K,{...r,joinArrays:!1,ns:u}),A[F]===K&&(A[F]=v[F])}v=A}}else if(O&&typeof N=="string"&&w==="[object Array]")v=v.join(N),v&&(v=this.extendTranslation(v,t,r,s));else{let T=!1,A=!1;const L=r.count!==void 0&&typeof r.count!="string",F=Nl.hasDefaultValue(r),K=L?this.pluralResolver.getSuffix(p,r.count,r):"",Q=r.ordinal&&L?this.pluralResolver.getSuffix(p,r.count,{ordinal:!1}):"",X=r[`defaultValue${K}`]||r[`defaultValue${Q}`]||r.defaultValue;!this.isValidLookup(v)&&F&&(T=!0,v=X),this.isValidLookup(v)||(A=!0,v=c);const ne=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&A?void 0:v,W=F&&X!==v&&this.options.updateMissing;if(A||T||W){if(this.logger.log(W?"updateKey":"missingKey",p,f,c,W?X:v),a){const B=this.resolve(c,{...r,keySeparator:!1});B&&B.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 I=[];const V=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&V&&V[0])for(let B=0;B<V.length;B++)I.push(V[B]);else this.options.saveMissingTo==="all"?I=this.languageUtils.toResolveHierarchy(r.lng||this.language):I.push(r.lng||this.language);const j=(B,U,$)=>{const z=F&&$!==v?$:ne;this.options.missingKeyHandler?this.options.missingKeyHandler(B,f,U,z,W,r):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(B,f,U,z,W,r),this.emit("missingKey",B,f,U,v)};this.options.saveMissing&&(this.options.saveMissingPlurals&&L?I.forEach(B=>{this.pluralResolver.getSuffixes(B,r).forEach(U=>{j([B],c+U,r[`defaultValue${U}`]||X)})}):j(I,c,X))}v=this.extendTranslation(v,t,r,E,s),A&&v===c&&this.options.appendNamespaceToMissingKey&&(v=`${f}:${c}`),(A||T)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?v=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}:${c}`:c,T?v:void 0):v=this.options.parseMissingKeyHandler(v))}return i?(E.res=v,E.usedParams=this.getUsedParamsDetails(r),E):v}extendTranslation(t,r,s,i,a){var c=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...s},s.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!s.skipInterpolation){s.interpolation&&this.interpolator.init({...s,interpolation:{...this.options.interpolation,...s.interpolation}});const p=typeof t=="string"&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(p){const v=t.match(this.interpolator.nestingRegexp);m=v&&v.length}let E=s.replace&&typeof s.replace!="string"?s.replace:s;if(this.options.interpolation.defaultVariables&&(E={...this.options.interpolation.defaultVariables,...E}),t=this.interpolator.interpolate(t,E,s.lng||this.language,s),p){const v=t.match(this.interpolator.nestingRegexp),x=v&&v.length;m<x&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(s.lng=i.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var v=arguments.length,x=new Array(v),_=0;_<v;_++)x[_]=arguments[_];return a&&a[0]===x[0]&&!s.context?(c.logger.warn(`It seems you are nesting recursively key: ${x[0]} in key: ${r[0]}`),null):c.translate(...x,r)},s)),s.interpolation&&this.interpolator.reset()}const u=s.postProcess||this.options.postProcess,f=typeof u=="string"?[u]:u;return t!=null&&f&&f.length&&s.applyPostProcessor!==!1&&(t=Bm.handle(f,t,r,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(s)},...s}:s,this)),t}resolve(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s,i,a,c,u;return typeof t=="string"&&(t=[t]),t.forEach(f=>{if(this.isValidLookup(s))return;const p=this.extractFromKey(f,r),m=p.key;i=m;let E=p.namespaces;this.options.fallbackNS&&(E=E.concat(this.options.fallbackNS));const v=r.count!==void 0&&typeof r.count!="string",x=v&&!r.ordinal&&r.count===0&&this.pluralResolver.shouldUseIntlApi(),_=r.context!==void 0&&(typeof r.context=="string"||typeof r.context=="number")&&r.context!=="",w=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);E.forEach(S=>{this.isValidLookup(s)||(u=S,!zm[`${w[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(u)&&(zm[`${w[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${w.join(", ")}" won't get resolved as namespace "${u}" 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!!!")),w.forEach(N=>{if(this.isValidLookup(s))return;c=N;const O=[m];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(O,m,N,S,r);else{let T;v&&(T=this.pluralResolver.getSuffix(N,r.count,r));const A=`${this.options.pluralSeparator}zero`,L=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(v&&(O.push(m+T),r.ordinal&&T.indexOf(L)===0&&O.push(m+T.replace(L,this.options.pluralSeparator)),x&&O.push(m+A)),_){const F=`${m}${this.options.contextSeparator}${r.context}`;O.push(F),v&&(O.push(F+T),r.ordinal&&T.indexOf(L)===0&&O.push(F+T.replace(L,this.options.pluralSeparator)),x&&O.push(F+A))}}let D;for(;D=O.pop();)this.isValidLookup(s)||(a=D,s=this.getResource(N,S,D,r))}))})}),{res:s,usedKey:i,exactUsedKey:a,usedLng:c,usedNS:u}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,r,s,i):this.resourceStore.getResource(t,r,s,i)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],s=t.replace&&typeof t.replace!="string";let i=s?t.replace:t;if(s&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!s){i={...i};for(const a of r)delete i[a]}return i}static hasDefaultValue(t){const r="defaultValue";for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&r===s.substring(0,r.length)&&t[s]!==void 0)return!0;return!1}}function xu(e){return e.charAt(0).toUpperCase()+e.slice(1)}class Wm{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Rn.create("languageUtils")}getScriptPartFromCode(t){if(t=wl(t),!t||t.indexOf("-")<0)return null;const r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}getLanguagePartFromCode(t){if(t=wl(t),!t||t.indexOf("-")<0)return t;const r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const r=["hans","hant","latn","cyrl","cans","mong","arab"];let s=t.split("-");return this.options.lowerCaseLng?s=s.map(i=>i.toLowerCase()):s.length===2?(s[0]=s[0].toLowerCase(),s[1]=s[1].toUpperCase(),r.indexOf(s[1].toLowerCase())>-1&&(s[1]=xu(s[1].toLowerCase()))):s.length===3&&(s[0]=s[0].toLowerCase(),s[1].length===2&&(s[1]=s[1].toUpperCase()),s[0]!=="sgn"&&s[2].length===2&&(s[2]=s[2].toUpperCase()),r.indexOf(s[1].toLowerCase())>-1&&(s[1]=xu(s[1].toLowerCase())),r.indexOf(s[2].toLowerCase())>-1&&(s[2]=xu(s[2].toLowerCase()))),s.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let r;return t.forEach(s=>{if(r)return;const i=this.formatLanguageCode(s);(!this.options.supportedLngs||this.isSupportedCode(i))&&(r=i)}),!r&&this.options.supportedLngs&&t.forEach(s=>{if(r)return;const i=this.getLanguagePartFromCode(s);if(this.isSupportedCode(i))return r=i;r=this.options.supportedLngs.find(a=>{if(a===i)return a;if(!(a.indexOf("-")<0&&i.indexOf("-")<0)&&a.indexOf(i)===0)return a})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];let s=t[r];return s||(s=t[this.getScriptPartFromCode(r)]),s||(s=t[this.formatLanguageCode(r)]),s||(s=t[this.getLanguagePartFromCode(r)]),s||(s=t.default),s||[]}toResolveHierarchy(t,r){const s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),i=[],a=c=>{c&&(this.isSupportedCode(c)?i.push(c):this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(c=>{i.indexOf(c)<0&&a(this.formatLanguageCode(c))}),i}}let g1=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],E1={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const y1=["v1","v2","v3"],v1=["v4"],Gm={zero:0,one:1,two:2,few:3,many:4,other:5};function x1(){const e={};return g1.forEach(t=>{t.lngs.forEach(r=>{e[r]={numbers:t.nr,plurals:E1[t.fc]}})}),e}class S1{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=r,this.logger=Rn.create("pluralResolver"),(!this.options.compatibilityJSON||v1.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=x1()}addRule(t,r){this.rules[t]=r}getRule(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(wl(t),{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(t,r);return this.shouldUseIntlApi()?s&&s.resolvedOptions().pluralCategories.length>1:s&&s.numbers.length>1}getPluralFormsOfKey(t,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,s).map(i=>`${r}${i}`)}getSuffixes(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort((i,a)=>Gm[i]-Gm[a]).map(i=>`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i}`):s.numbers.map(i=>this.getSuffix(t,i,r)):[]}getSuffix(t,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,s);return i?this.shouldUseIntlApi()?`${this.options.prepend}${s.ordinal?`ordinal${this.options.prepend}`:""}${i.select(r)}`:this.getSuffixRetroCompatible(i,r):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,r){const s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r));let i=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const a=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}shouldUseIntlApi(){return!y1.includes(this.options.compatibilityJSON)}}function Ym(e,t,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=d1(e,t,r);return!a&&i&&typeof r=="string"&&(a=_l(e,r,s),a===void 0&&(a=_l(t,r,s))),a}class _1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Rn.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(r=>r),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const r=t.interpolation;this.escape=r.escape!==void 0?r.escape:p1,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Mo(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Mo(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?Mo(r.nestingPrefix):r.nestingPrefixEscaped||Mo("$t("),this.nestingSuffix=r.nestingSuffix?Mo(r.nestingSuffix):r.nestingSuffixEscaped||Mo(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const r=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(r,"g");const s=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(s,"g")}interpolate(t,r,s,i){let a,c,u;const f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function p(_){return _.replace(/\$/g,"$$$$")}const m=_=>{if(_.indexOf(this.formatSeparator)<0){const O=Ym(r,f,_,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(O,void 0,s,{...i,...r,interpolationkey:_}):O}const w=_.split(this.formatSeparator),S=w.shift().trim(),N=w.join(this.formatSeparator).trim();return this.format(Ym(r,f,S,this.options.keySeparator,this.options.ignoreJSONStructure),N,s,{...i,...r,interpolationkey:S})};this.resetRegExp();const E=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,v=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:_=>p(_)},{regex:this.regexp,safeValue:_=>this.escapeValue?p(this.escape(_)):p(_)}].forEach(_=>{for(u=0;a=_.regex.exec(t);){const w=a[1].trim();if(c=m(w),c===void 0)if(typeof E=="function"){const N=E(t,a,i);c=typeof N=="string"?N:""}else if(i&&Object.prototype.hasOwnProperty.call(i,w))c="";else if(v){c=a[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),c="";else typeof c!="string"&&!this.useRawValueToEscape&&(c=jm(c));const S=_.safeValue(c);if(t=t.replace(a[0],S),v?(_.regex.lastIndex+=c.length,_.regex.lastIndex-=a[0].length):_.regex.lastIndex=0,u++,u>=this.maxReplaces)break}}),t}nest(t,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,a,c;function u(f,p){const m=this.nestingOptionsSeparator;if(f.indexOf(m)<0)return f;const E=f.split(new RegExp(`${m}[ ]*{`));let v=`{${E[1]}`;f=E[0],v=this.interpolate(v,c);const x=v.match(/'/g),_=v.match(/"/g);(x&&x.length%2===0&&!_||_.length%2!==0)&&(v=v.replace(/'/g,'"'));try{c=JSON.parse(v),p&&(c={...p,...c})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${f}`,w),`${f}${m}${v}`}return delete c.defaultValue,f}for(;i=this.nestingRegexp.exec(t);){let f=[];c={...s},c=c.replace&&typeof c.replace!="string"?c.replace:c,c.applyPostProcessor=!1,delete c.defaultValue;let p=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const m=i[1].split(this.formatSeparator).map(E=>E.trim());i[1]=m.shift(),f=m,p=!0}if(a=r(u.call(this,i[1].trim(),c),c),a&&i[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=jm(a)),a||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),a=""),p&&(a=f.reduce((m,E)=>this.format(m,E,s.lng,{...s,interpolationkey:i[1].trim()}),a.trim())),t=t.replace(i[0],a),this.regexp.lastIndex=0}return t}}function w1(e){let t=e.toLowerCase().trim();const r={};if(e.indexOf("(")>-1){const s=e.split("(");t=s[0].toLowerCase().trim();const i=s[1].substring(0,s[1].length-1);t==="currency"&&i.indexOf(":")<0?r.currency||(r.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?r.range||(r.range=i.trim()):i.split(";").forEach(c=>{if(!c)return;const[u,...f]=c.split(":"),p=f.join(":").trim().replace(/^'+|'+$/g,"");r[u.trim()]||(r[u.trim()]=p),p==="false"&&(r[u.trim()]=!1),p==="true"&&(r[u.trim()]=!0),isNaN(p)||(r[u.trim()]=parseInt(p,10))})}return{formatName:t,formatOptions:r}}function Po(e){const t={};return function(s,i,a){const c=i+JSON.stringify(a);let u=t[c];return u||(u=e(wl(i),a),t[c]=u),u(s)}}class N1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Rn.create("formatter"),this.options=t,this.formats={number:Po((r,s)=>{const i=new Intl.NumberFormat(r,{...s});return a=>i.format(a)}),currency:Po((r,s)=>{const i=new Intl.NumberFormat(r,{...s,style:"currency"});return a=>i.format(a)}),datetime:Po((r,s)=>{const i=new Intl.DateTimeFormat(r,{...s});return a=>i.format(a)}),relativetime:Po((r,s)=>{const i=new Intl.RelativeTimeFormat(r,{...s});return a=>i.format(a,s.range||"day")}),list:Po((r,s)=>{const i=new Intl.ListFormat(r,{...s});return a=>i.format(a)})},this.init(t)}init(t){const s=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=s.formatSeparator?s.formatSeparator:s.formatSeparator||","}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=Po(r)}format(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return r.split(this.formatSeparator).reduce((u,f)=>{const{formatName:p,formatOptions:m}=w1(f);if(this.formats[p]){let E=u;try{const v=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},x=v.locale||v.lng||i.locale||i.lng||s;E=this.formats[p](u,x,{...m,...i,...v})}catch(v){this.logger.warn(v)}return E}else this.logger.warn(`there was no format function for ${p}`);return u},t)}}function R1(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class T1 extends xl{constructor(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=r,this.services=s,this.languageUtils=s.languageUtils,this.options=i,this.logger=Rn.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(s,i.backend,i)}queueLoad(t,r,s,i){const a={},c={},u={},f={};return t.forEach(p=>{let m=!0;r.forEach(E=>{const v=`${p}|${E}`;!s.reload&&this.store.hasResourceBundle(p,E)?this.state[v]=2:this.state[v]<0||(this.state[v]===1?c[v]===void 0&&(c[v]=!0):(this.state[v]=1,m=!1,c[v]===void 0&&(c[v]=!0),a[v]===void 0&&(a[v]=!0),f[E]===void 0&&(f[E]=!0)))}),m||(u[p]=!0)}),(Object.keys(a).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(a),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}loaded(t,r,s){const i=t.split("|"),a=i[0],c=i[1];r&&this.emit("failedLoading",a,c,r),s&&this.store.addResourceBundle(a,c,s),this.state[t]=r?-1:2;const u={};this.queue.forEach(f=>{u1(f.loaded,[a],c),R1(f,t),r&&f.errors.push(r),f.pendingCount===0&&!f.done&&(Object.keys(f.loaded).forEach(p=>{u[p]||(u[p]={});const m=f.loaded[p];m.length&&m.forEach(E=>{u[p][E]===void 0&&(u[p][E]=!0)})}),f.done=!0,f.errors.length?f.callback(f.errors):f.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(f=>!f.done)}read(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!t.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:r,fcName:s,tried:i,wait:a,callback:c});return}this.readingCalls++;const u=(p,m)=>{if(this.readingCalls--,this.waitingReads.length>0){const E=this.waitingReads.shift();this.read(E.lng,E.ns,E.fcName,E.tried,E.wait,E.callback)}if(p&&m&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,r,s,i+1,a*2,c)},a);return}c(p,m)},f=this.backend[s].bind(this.backend);if(f.length===2){try{const p=f(t,r);p&&typeof p.then=="function"?p.then(m=>u(null,m)).catch(u):u(null,p)}catch(p){u(p)}return}return f(t,r,u)}prepareLoading(t,r){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof r=="string"&&(r=[r]);const a=this.queueLoad(t,r,s,i);if(!a.toLoad.length)return a.pending.length||i(),null;a.toLoad.forEach(c=>{this.loadOne(c)})}load(t,r,s){this.prepareLoading(t,r,{},s)}reload(t,r,s){this.prepareLoading(t,r,{reload:!0},s)}loadOne(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const s=t.split("|"),i=s[0],a=s[1];this.read(i,a,"read",void 0,void 0,(c,u)=>{c&&this.logger.warn(`${r}loading namespace ${a} for language ${i} failed`,c),!c&&u&&this.logger.log(`${r}loaded namespace ${a} for language ${i}`,u),this.loaded(t,c,u)})}saveMissing(t,r,s,i,a){let c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},u=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(r)){this.logger.warn(`did not save key "${s}" as the namespace "${r}" 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(!(s==null||s==="")){if(this.backend&&this.backend.create){const f={...c,isUpdate:a},p=this.backend.create.bind(this.backend);if(p.length<6)try{let m;p.length===5?m=p(t,r,s,i,f):m=p(t,r,s,i),m&&typeof m.then=="function"?m.then(E=>u(null,E)).catch(u):u(null,m)}catch(m){u(m)}else p(t,r,s,i,u,f)}!t||!t[0]||this.store.addResource(t[0],r,s,i)}}}function Km(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",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:function(t){let r={};if(typeof t[1]=="object"&&(r=t[1]),typeof t[1]=="string"&&(r.defaultValue=t[1]),typeof t[2]=="string"&&(r.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const s=t[3]||t[2];Object.keys(s).forEach(i=>{r[i]=s[i]})}return r},interpolation:{escapeValue:!0,format:(e,t,r,s)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function Xm(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function Rl(){}function O1(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})}class Bs extends xl{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Xm(t),this.services={},this.logger=Rn,this.modules={external:[]},O1(this),r&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,r),this;setTimeout(()=>{this.init(t,r)},0)}}init(){var t=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;typeof r=="function"&&(s=r,r={}),!r.defaultNS&&r.defaultNS!==!1&&r.ns&&(typeof r.ns=="string"?r.defaultNS=r.ns:r.ns.indexOf("translation")<0&&(r.defaultNS=r.ns[0]));const i=Km();this.options={...i,...this.options,...Xm(r)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),r.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=r.keySeparator),r.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=r.nsSeparator);function a(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?Rn.init(a(this.modules.logger),this.options):Rn.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:typeof Intl<"u"&&(m=N1);const E=new Wm(this.options);this.store=new Hm(this.options.resources,this.options);const v=this.services;v.logger=Rn,v.resourceStore=this.store,v.languageUtils=E,v.pluralResolver=new S1(E,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),m&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(v.formatter=a(m),v.formatter.init(v,this.options),this.options.interpolation.format=v.formatter.format.bind(v.formatter)),v.interpolator=new _1(this.options),v.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},v.backendConnector=new T1(a(this.modules.backend),v.resourceStore,v,this.options),v.backendConnector.on("*",function(x){for(var _=arguments.length,w=new Array(_>1?_-1:0),S=1;S<_;S++)w[S-1]=arguments[S];t.emit(x,...w)}),this.modules.languageDetector&&(v.languageDetector=a(this.modules.languageDetector),v.languageDetector.init&&v.languageDetector.init(v,this.options.detection,this.options)),this.modules.i18nFormat&&(v.i18nFormat=a(this.modules.i18nFormat),v.i18nFormat.init&&v.i18nFormat.init(this)),this.translator=new Nl(this.services,this.options),this.translator.on("*",function(x){for(var _=arguments.length,w=new Array(_>1?_-1:0),S=1;S<_;S++)w[S-1]=arguments[S];t.emit(x,...w)}),this.modules.external.forEach(x=>{x.init&&x.init(this)})}if(this.format=this.options.interpolation.format,s||(s=Rl),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const m=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);m.length>0&&m[0]!=="dev"&&(this.options.lng=m[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(m=>{this[m]=function(){return t.store[m](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(m=>{this[m]=function(){return t.store[m](...arguments),t}});const f=Hs(),p=()=>{const m=(E,v)=>{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),f.resolve(v),s(E,v)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return m(null,this.t.bind(this));this.changeLanguage(this.options.lng,m)};return this.options.resources||!this.options.initImmediate?p():setTimeout(p,0),f}loadResources(t){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rl;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(s=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return s();const a=[],c=u=>{if(!u||u==="cimode")return;this.services.languageUtils.toResolveHierarchy(u).forEach(p=>{p!=="cimode"&&a.indexOf(p)<0&&a.push(p)})};i?c(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(f=>c(f)),this.options.preload&&this.options.preload.forEach(u=>c(u)),this.services.backendConnector.load(a,this.options.ns,u=>{!u&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),s(u)})}else s(null)}reloadResources(t,r,s){const i=Hs();return t||(t=this.languages),r||(r=this.options.ns),s||(s=Rl),this.services.backendConnector.reload(t,r,a=>{i.resolve(),s(a)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&Bm.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let r=0;r<this.languages.length;r++){const s=this.languages[r];if(!(["cimode","dev"].indexOf(s)>-1)&&this.store.hasLanguageSomeTranslations(s)){this.resolvedLanguage=s;break}}}changeLanguage(t,r){var s=this;this.isLanguageChangingTo=t;const i=Hs();this.emit("languageChanging",t);const a=f=>{this.language=f,this.languages=this.services.languageUtils.toResolveHierarchy(f),this.resolvedLanguage=void 0,this.setResolvedLanguage(f)},c=(f,p)=>{p?(a(p),this.translator.changeLanguage(p),this.isLanguageChangingTo=void 0,this.emit("languageChanged",p),this.logger.log("languageChanged",p)):this.isLanguageChangingTo=void 0,i.resolve(function(){return s.t(...arguments)}),r&&r(f,function(){return s.t(...arguments)})},u=f=>{!t&&!f&&this.services.languageDetector&&(f=[]);const p=typeof f=="string"?f:this.services.languageUtils.getBestMatchFromCodes(f);p&&(this.language||a(p),this.translator.language||this.translator.changeLanguage(p),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(p)),this.loadResources(p,m=>{c(m,p)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?u(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(u):this.services.languageDetector.detect(u):u(t),i}getFixedT(t,r,s){var i=this;const a=function(c,u){let f;if(typeof u!="object"){for(var p=arguments.length,m=new Array(p>2?p-2:0),E=2;E<p;E++)m[E-2]=arguments[E];f=i.options.overloadTranslationOptionHandler([c,u].concat(m))}else f={...u};f.lng=f.lng||a.lng,f.lngs=f.lngs||a.lngs,f.ns=f.ns||a.ns,f.keyPrefix=f.keyPrefix||s||a.keyPrefix;const v=i.options.keySeparator||".";let x;return f.keyPrefix&&Array.isArray(c)?x=c.map(_=>`${f.keyPrefix}${v}${_}`):x=f.keyPrefix?`${f.keyPrefix}${v}${c}`:c,i.t(x,f)};return typeof t=="string"?a.lng=t:a.lngs=t,a.ns=r,a.keyPrefix=s,a}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};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;const s=r.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,a=this.languages[this.languages.length-1];if(s.toLowerCase()==="cimode")return!0;const c=(u,f)=>{const p=this.services.backendConnector.state[`${u}|${f}`];return p===-1||p===2};if(r.precheck){const u=r.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(s,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(s,t)&&(!i||c(a,t)))}loadNamespaces(t,r){const s=Hs();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{s.resolve(),r&&r(i)}),s):(r&&r(),Promise.resolve())}loadLanguages(t,r){const s=Hs();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],a=t.filter(c=>i.indexOf(c)<0);return a.length?(this.options.preload=i.concat(a),this.loadResources(c=>{s.resolve(),r&&r(c)}),s):(r&&r(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const r=["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"],s=this.services&&this.services.languageUtils||new Wm(Km());return r.indexOf(s.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return new Bs(t,r)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Rl;const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},a=new Bs(i);return(t.debug!==void 0||t.prefix!==void 0)&&(a.logger=a.logger.clone(t)),["store","services","language"].forEach(u=>{a[u]=this[u]}),a.services={...this.services},a.services.utils={hasLoadedNamespace:a.hasLoadedNamespace.bind(a)},s&&(a.store=new Hm(this.store.data,i),a.services.resourceStore=a.store),a.translator=new Nl(a.services,i),a.translator.on("*",function(u){for(var f=arguments.length,p=new Array(f>1?f-1:0),m=1;m<f;m++)p[m-1]=arguments[m];a.emit(u,...p)}),a.init(i,r),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}}}const ut=Bs.createInstance();ut.createInstance=Bs.createInstance,ut.createInstance,ut.dir,ut.init,ut.loadResources,ut.reloadResources,ut.use,ut.changeLanguage,ut.getFixedT;const M=ut.t;ut.exists,ut.setDefaultNamespace,ut.hasLoadedNamespace,ut.loadNamespaces,ut.loadLanguages;function C1(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zs(e){"@babel/helpers - typeof";return zs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zs(e)}function A1(e,t){if(zs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(zs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function I1(e){var t=A1(e,"string");return zs(t)=="symbol"?t:t+""}function b1(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,I1(s.key),s)}}function L1(e,t,r){return t&&b1(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var Qm=[],D1=Qm.forEach,k1=Qm.slice;function M1(e){return D1.call(k1.call(arguments,1),function(t){if(t)for(var r in t)e[r]===void 0&&(e[r]=t[r])}),e}var qm=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,P1=function(t,r,s){var i=s||{};i.path=i.path||"/";var a=encodeURIComponent(r),c="".concat(t,"=").concat(a);if(i.maxAge>0){var u=i.maxAge-0;if(Number.isNaN(u))throw new Error("maxAge should be a Number");c+="; Max-Age=".concat(Math.floor(u))}if(i.domain){if(!qm.test(i.domain))throw new TypeError("option domain is invalid");c+="; Domain=".concat(i.domain)}if(i.path){if(!qm.test(i.path))throw new TypeError("option path is invalid");c+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");c+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(c+="; HttpOnly"),i.secure&&(c+="; Secure"),i.sameSite){var f=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(f){case!0:c+="; SameSite=Strict";break;case"lax":c+="; SameSite=Lax";break;case"strict":c+="; SameSite=Strict";break;case"none":c+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return c},Zm={create:function(t,r,s,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};s&&(a.expires=new Date,a.expires.setTime(a.expires.getTime()+s*60*1e3)),i&&(a.domain=i),document.cookie=P1(t,encodeURIComponent(r),a)},read:function(t){for(var r="".concat(t,"="),s=document.cookie.split(";"),i=0;i<s.length;i++){for(var a=s[i];a.charAt(0)===" ";)a=a.substring(1,a.length);if(a.indexOf(r)===0)return a.substring(r.length,a.length)}return null},remove:function(t){this.create(t,"",-1)}},U1={name:"cookie",lookup:function(t){var r;if(t.lookupCookie&&typeof document<"u"){var s=Zm.read(t.lookupCookie);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupCookie&&typeof document<"u"&&Zm.create(r.lookupCookie,t,r.cookieMinutes,r.cookieDomain,r.cookieOptions)}},F1={name:"querystring",lookup:function(t){var r;if(typeof window<"u"){var s=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=s.substring(1),a=i.split("&"),c=0;c<a.length;c++){var u=a[c].indexOf("=");if(u>0){var f=a[c].substring(0,u);f===t.lookupQuerystring&&(r=a[c].substring(u+1))}}}return r}},Ws=null,Jm=function(){if(Ws!==null)return Ws;try{Ws=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Ws=!1}return Ws},j1={name:"localStorage",lookup:function(t){var r;if(t.lookupLocalStorage&&Jm()){var s=window.localStorage.getItem(t.lookupLocalStorage);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupLocalStorage&&Jm()&&window.localStorage.setItem(r.lookupLocalStorage,t)}},Gs=null,eg=function(){if(Gs!==null)return Gs;try{Gs=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Gs=!1}return Gs},V1={name:"sessionStorage",lookup:function(t){var r;if(t.lookupSessionStorage&&eg()){var s=window.sessionStorage.getItem(t.lookupSessionStorage);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupSessionStorage&&eg()&&window.sessionStorage.setItem(r.lookupSessionStorage,t)}},$1={name:"navigator",lookup:function(t){var r=[];if(typeof navigator<"u"){if(navigator.languages)for(var s=0;s<navigator.languages.length;s++)r.push(navigator.languages[s]);navigator.userLanguage&&r.push(navigator.userLanguage),navigator.language&&r.push(navigator.language)}return r.length>0?r:void 0}},H1={name:"htmlTag",lookup:function(t){var r,s=t.htmlTag||(typeof document<"u"?document.documentElement:null);return s&&typeof s.getAttribute=="function"&&(r=s.getAttribute("lang")),r}},B1={name:"path",lookup:function(t){var r;if(typeof window<"u"){var s=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(s instanceof Array)if(typeof t.lookupFromPathIndex=="number"){if(typeof s[t.lookupFromPathIndex]!="string")return;r=s[t.lookupFromPathIndex].replace("/","")}else r=s[0].replace("/","")}return r}},z1={name:"subdomain",lookup:function(t){var r=typeof t.lookupFromSubdomainIndex=="number"?t.lookupFromSubdomainIndex+1:1,s=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(s)return s[r]}};function W1(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var tg=function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};C1(this,e),this.type="languageDetector",this.detectors={},this.init(t,r)}return L1(e,[{key:"init",value:function(r){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=r||{languageUtils:{}},this.options=M1(s,this.options||{},W1()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(a){return a.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(U1),this.addDetector(F1),this.addDetector(j1),this.addDetector(V1),this.addDetector($1),this.addDetector(H1),this.addDetector(B1),this.addDetector(z1)}},{key:"addDetector",value:function(r){this.detectors[r.name]=r}},{key:"detect",value:function(r){var s=this;r||(r=this.options.order);var i=[];return r.forEach(function(a){if(s.detectors[a]){var c=s.detectors[a].lookup(s.options);c&&typeof c=="string"&&(c=[c]),c&&(i=i.concat(c))}}),i=i.map(function(a){return s.options.convertDetectedLanguage(a)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(r,s){var i=this;s||(s=this.options.caches),s&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(r)>-1||s.forEach(function(a){i.detectors[a]&&i.detectors[a].cacheUserLanguage(r,i.options)}))}}]),e}();tg.type="languageDetector";function Su(){return Su=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Su.apply(null,arguments)}var _u,ng;function G1(){return ng||(ng=1,_u={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}),_u}var Y1=G1();const K1=Hi(Y1);var X1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function rg(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=e.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(t.name=r[1],(K1[r[1]]||e.charAt(e.length-2)==="/")&&(t.voidElement=!0),t.name.startsWith("!--"))){var s=e.indexOf("-->");return{type:"comment",comment:s!==-1?e.slice(4,s):""}}for(var i=new RegExp(X1),a=null;(a=i.exec(e))!==null;)if(a[0].trim())if(a[1]){var c=a[1].trim(),u=[c,""];c.indexOf("=")>-1&&(u=c.split("=")),t.attrs[u[0]]=u[1],i.lastIndex--}else a[2]&&(t.attrs[a[2]]=a[3].trim().substring(1,a[3].length-1));return t}var Q1=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,q1=/^\s*$/,Z1=Object.create(null);function og(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(r){var s=[];for(var i in r)s.push(i+'="'+r[i]+'"');return s.length?" "+s.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(og,"")+"</"+t.name+">";case"comment":return e+"<!--"+t.comment+"-->"}}var J1={parse:function(e,t){t||(t={}),t.components||(t.components=Z1);var r,s=[],i=[],a=-1,c=!1;if(e.indexOf("<")!==0){var u=e.indexOf("<");s.push({type:"text",content:u===-1?e:e.substring(0,u)})}return e.replace(Q1,function(f,p){if(c){if(f!=="</"+r.name+">")return;c=!1}var m,E=f.charAt(1)!=="/",v=f.startsWith("<!--"),x=p+f.length,_=e.charAt(x);if(v){var w=rg(f);return a<0?(s.push(w),s):((m=i[a]).children.push(w),s)}if(E&&(a++,(r=rg(f)).type==="tag"&&t.components[r.name]&&(r.type="component",c=!0),r.voidElement||c||!_||_==="<"||r.children.push({type:"text",content:e.slice(x,e.indexOf("<",x))}),a===0&&s.push(r),(m=i[a-1])&&m.children.push(r),i[a]=r),(!E||r.voidElement)&&(a>-1&&(r.voidElement||r.name===f.slice(2,-1))&&(a--,r=a===-1?s:i[a]),!c&&_!=="<"&&_)){m=a===-1?s:i[a].children;var S=e.indexOf("<",x),N=e.slice(x,S===-1?void 0:S);q1.test(N)&&(N=" "),(S>-1&&a+m.length>=0||N!==" ")&&m.push({type:"text",content:N})}}),s},stringify:function(e){return e.reduce(function(t,r){return t+og("",r)},"")}};function Tl(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];typeof t[0]=="string"&&(t[0]=`react-i18next:: ${t[0]}`),console.warn(...t)}}const sg={};function eT(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];typeof t[0]=="string"&&sg[t[0]]||(typeof t[0]=="string"&&(sg[t[0]]=new Date),Tl(...t))}const tT=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,nT={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},rT=e=>nT[e];let wu={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(tT,rT)};function oT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};wu={...wu,...e}}function sT(){return wu}let ig;function iT(e){ig=e}function lg(){return ig}function Nu(e,t){if(!e)return!1;const r=e.props?e.props.children:e.children;return t?r.length>0:!!r}function Ru(e){if(!e)return[];const t=e.props?e.props.children:e.children;return e.props&&e.props.i18nIsDynamicList?Uo(t):t}function lT(e){return Object.prototype.toString.call(e)!=="[object Array]"?!1:e.every(t=>b.isValidElement(t))}function Uo(e){return Array.isArray(e)?e:[e]}function aT(e,t){const r={...t};return r.props=Object.assign(e.props,t.props),r}function ag(e,t){if(!e)return"";let r="";const s=Uo(e),i=t.transSupportBasicHtmlNodes&&t.transKeepBasicHtmlNodesFor?t.transKeepBasicHtmlNodesFor:[];return s.forEach((a,c)=>{if(typeof a=="string")r+=`${a}`;else if(b.isValidElement(a)){const u=Object.keys(a.props).length,f=i.indexOf(a.type)>-1,p=a.props.children;if(!p&&f&&u===0)r+=`<${a.type}/>`;else if(!p&&(!f||u!==0))r+=`<${c}></${c}>`;else if(a.props.i18nIsDynamicList)r+=`<${c}></${c}>`;else if(f&&u===1&&typeof p=="string")r+=`<${a.type}>${p}</${a.type}>`;else{const m=ag(p,t);r+=`<${c}>${m}</${c}>`}}else if(a===null)Tl("Trans: the passed in value is invalid - seems you passed in a null child.");else if(typeof a=="object"){const{format:u,...f}=a,p=Object.keys(f);if(p.length===1){const m=u?`${p[0]}, ${u}`:p[0];r+=`{{${m}}}`}else Tl("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Tl("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.",a)}),r}function cT(e,t,r,s,i,a){if(t==="")return[];const c=s.transKeepBasicHtmlNodesFor||[],u=t&&new RegExp(c.map(S=>`<${S}`).join("|")).test(t);if(!e&&!u&&!a)return[t];const f={};function p(S){Uo(S).forEach(O=>{typeof O!="string"&&(Nu(O)?p(Ru(O)):typeof O=="object"&&!b.isValidElement(O)&&Object.assign(f,O))})}p(e);const m=J1.parse(`<0>${t}</0>`),E={...f,...i};function v(S,N,O){const D=Ru(S),T=_(D,N.children,O);return lT(D)&&T.length===0||S.props&&S.props.i18nIsDynamicList?D:T}function x(S,N,O,D,T){S.dummy?(S.children=N,O.push(b.cloneElement(S,{key:D},T?void 0:N))):O.push(...b.Children.map([S],A=>{const L={...A.props};return delete L.i18nIsDynamicList,te.createElement(A.type,Su({},L,{key:D,ref:A.ref},T?{}:{children:N}))}))}function _(S,N,O){const D=Uo(S);return Uo(N).reduce((A,L,F)=>{const K=L.children&&L.children[0]&&L.children[0].content&&r.services.interpolator.interpolate(L.children[0].content,E,r.language);if(L.type==="tag"){let Q=D[parseInt(L.name,10)];O.length===1&&!Q&&(Q=O[0][L.name]),Q||(Q={});const X=Object.keys(L.attrs).length!==0?aT({props:L.attrs},Q):Q,ee=b.isValidElement(X),ne=ee&&Nu(L,!0)&&!L.voidElement,W=u&&typeof X=="object"&&X.dummy&&!ee,I=typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,L.name);if(typeof X=="string"){const V=r.services.interpolator.interpolate(X,E,r.language);A.push(V)}else if(Nu(X)||ne){const V=v(X,L,O);x(X,V,A,F)}else if(W){const V=_(D,L.children,O);x(X,V,A,F)}else if(Number.isNaN(parseFloat(L.name)))if(I){const V=v(X,L,O);x(X,V,A,F,L.voidElement)}else if(s.transSupportBasicHtmlNodes&&c.indexOf(L.name)>-1)if(L.voidElement)A.push(b.createElement(L.name,{key:`${L.name}-${F}`}));else{const V=_(D,L.children,O);A.push(b.createElement(L.name,{key:`${L.name}-${F}`},V))}else if(L.voidElement)A.push(`<${L.name} />`);else{const V=_(D,L.children,O);A.push(`<${L.name}>${V}</${L.name}>`)}else if(typeof X=="object"&&!ee){const V=L.children[0]?K:null;V&&A.push(V)}else x(X,K,A,F,L.children.length!==1||!K)}else if(L.type==="text"){const Q=s.transWrapTextNodes,X=a?s.unescape(r.services.interpolator.interpolate(L.content,E,r.language)):r.services.interpolator.interpolate(L.content,E,r.language);Q?A.push(b.createElement(Q,{key:`${L.name}-${F}`},X)):A.push(X)}return A},[])}const w=_([{dummy:!0,children:e||[]}],m,Uo(e||[]));return Ru(w[0])}function uT(e){let{children:t,count:r,parent:s,i18nKey:i,context:a,tOptions:c={},values:u,defaults:f,components:p,ns:m,i18n:E,t:v,shouldUnescape:x,..._}=e;const w=E||lg();if(!w)return eT("You will need to pass in an i18next instance by using i18nextReactModule"),t;const S=v||w.t.bind(w)||(ne=>ne);a&&(c.context=a);const N={...sT(),...w.options&&w.options.react};let O=m||S.ns||w.options&&w.options.defaultNS;O=typeof O=="string"?[O]:O||["translation"];const D=ag(t,N),T=f||D||N.transEmptyNodeValue||i,{hashTransKey:A}=N,L=i||(A?A(D||T):D||T);w.options&&w.options.interpolation&&w.options.interpolation.defaultVariables&&(u=u&&Object.keys(u).length>0?{...u,...w.options.interpolation.defaultVariables}:{...w.options.interpolation.defaultVariables});const F=u?c.interpolation:{interpolation:{...c.interpolation,prefix:"#$?",suffix:"?$#"}},K={...c,count:r,...u,...F,defaultValue:T,ns:O},Q=L?S(L,K):T;p&&Object.keys(p).forEach(ne=>{const W=p[ne];if(typeof W.type=="function"||!W.props||!W.props.children||Q.indexOf(`${ne}/>`)<0&&Q.indexOf(`${ne} />`)<0)return;function I(){return te.createElement(te.Fragment,null,W)}p[ne]=te.createElement(I,null)});const X=cT(p||t,Q,w,N,K,x),ee=s!==void 0?s:N.defaultTransParent;return ee?b.createElement(ee,_,X):X}const dT={type:"3rdParty",init(e){oT(e.options.react),iT(e)}},fT=b.createContext();function pT(e){let{children:t,count:r,parent:s,i18nKey:i,context:a,tOptions:c={},values:u,defaults:f,components:p,ns:m,i18n:E,t:v,shouldUnescape:x,..._}=e;const{i18n:w,defaultNS:S}=b.useContext(fT)||{},N=E||w||lg(),O=v||N&&N.t.bind(N);return uT({children:t,count:r,parent:s,i18nKey:i,context:a,tOptions:c,values:u,defaults:f,components:p,ns:m||O&&O.ns||S||N&&N.options&&N.options.defaultNS,i18n:N,t:v,shouldUnescape:x,..._})}var hT={prefix:"fas",iconName:"trash-can",icon:[448,512,[61460,"trash-alt"],"f2ed","M135.2 17.7C140.6 6.8 151.7 0 163.8 0H284.2c12.1 0 23.2 6.8 28.6 17.7L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64S14.3 32 32 32h96l7.2-14.3zM32 128H416V448c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64V128zm96 64c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16zm96 0c-8.8 0-16 7.2-16 16V432c0 8.8 7.2 16 16 16s16-7.2 16-16V208c0-8.8-7.2-16-16-16z"]},mT={prefix:"fas",iconName:"bars",icon:[448,512,["navicon"],"f0c9","M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"]},gT={prefix:"fas",iconName:"circle-exclamation",icon:[512,512,["exclamation-circle"],"f06a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},ET={prefix:"fas",iconName:"circle-dot",icon:[512,512,[128280,"dot-circle"],"f192","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-352a96 96 0 1 1 0 192 96 96 0 1 1 0-192z"]},yT=ET,vT={prefix:"fas",iconName:"circle-check",icon:[512,512,[61533,"check-circle"],"f058","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM369 209L241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"]},xT={prefix:"fas",iconName:"arrows-rotate",icon:[512,512,[128472,"refresh","sync"],"f021","M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160H352c-17.7 0-32 14.3-32 32s14.3 32 32 32H463.5c0 0 0 0 0 0h.4c17.7 0 32-14.3 32-32V80c0-17.7-14.3-32-32-32s-32 14.3-32 32v35.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5zM39 289.3c-5 1.5-9.8 4.2-13.7 8.2c-4 4-6.7 8.8-8.1 14c-.3 1.2-.6 2.5-.8 3.8c-.3 1.7-.4 3.4-.4 5.1V432c0 17.7 14.3 32 32 32s32-14.3 32-32V396.9l17.6 17.5 0 0c87.5 87.4 229.3 87.4 316.7 0c24.4-24.4 42.1-53.1 52.9-83.7c5.9-16.7-2.9-34.9-19.5-40.8s-34.9 2.9-40.8 19.5c-7.7 21.8-20.2 42.3-37.8 59.8c-62.5 62.5-163.8 62.5-226.3 0l-.1-.1L125.6 352H160c17.7 0 32-14.3 32-32s-14.3-32-32-32H48.4c-1.6 0-3.2 .1-4.8 .3s-3.1 .5-4.6 1z"]},ST={prefix:"fas",iconName:"arrow-turn-down-right",icon:[512,512,[],"e3d6","M64 64c0-17.7-14.3-32-32-32S0 46.3 0 64V224c0 53 43 96 96 96H402.7l-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256H96c-17.7 0-32-14.3-32-32V64z"]},_T={prefix:"fas",iconName:"arrow-right",icon:[448,512,[8594],"f061","M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z"]},wT={prefix:"fas",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]},NT={prefix:"fas",iconName:"arrow-left",icon:[448,512,[8592],"f060","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.2 288 416 288c17.7 0 32-14.3 32-32s-14.3-32-32-32l-306.7 0L214.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"]},RT={prefix:"fas",iconName:"circle-small",icon:[320,512,[],"e122","M0 256a160 160 0 1 1 320 0A160 160 0 1 1 0 256z"]},TT={prefix:"fas",iconName:"circle-info",icon:[512,512,["info-circle"],"f05a","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"]},OT={prefix:"fas",iconName:"bolt",icon:[448,512,[9889,"zap"],"f0e7","M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288H175.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5L349.4 44.6z"]},CT={prefix:"fas",iconName:"xmark",icon:[384,512,[128473,10005,10006,10060,215,"close","multiply","remove","times"],"f00d","M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]},AT={prefix:"fas",iconName:"clock-rotate-left",icon:[512,512,["history"],"f1da","M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"]},IT={prefix:"fas",iconName:"triangle-exclamation",icon:[512,512,[9888,"exclamation-triangle","warning"],"f071","M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z"]},bT={prefix:"fas",iconName:"circle-xmark",icon:[512,512,[61532,"times-circle","xmark-circle"],"f057","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]};const LT={"arrow-left":NT,"arrow-right":_T,"arrow-turn-down-right":ST,"arrows-rotate":xT,bars:mT,bolt:OT,"circle-check":vT,"circle-exclamation":gT,"circle-info":TT,"circle-question":wT,"circle-small":RT,"circle-xmark":bT,"clock-rotate-left":AT,"dot-circle":yT,"trash-can":hT,"triangle-exclamation":IT,xmark:CT},Ce=b.forwardRef(function({className:t="",size:r="",tag:s},i){const a=LT[s];return a?h.jsx("svg",{"aria-hidden":"true","data-prefix":a.prefix,"data-icon":s,className:`svg-inline--fa fa-${s} ${r?`fa-${r}`:""} ${t}`,focusable:"false",ref:i,role:"img",viewBox:`0 0 ${a.icon[0]} ${a.icon[1]}`,xmlns:"http://www.w3.org/2000/svg",children:h.jsx("path",{d:a.icon[4],fill:"currentColor"})}):(Qe().debug(`Unknown icon: ${s}`),null)}),Fo=({className:e="",confirm:t=!0,handleDelete:r,label:s,scale:i=1,show:a=!0,showLabel:c=!1,size:u})=>{const[f,p]=b.useState(!1),[m,E]=b.useState(i);i!==m&&(p(!1),E(i));const v=_=>{_.preventDefault(),p(w=>!w)},x=_=>{_.preventDefault(),r(_)};return h.jsx(gr,{enable:t,open:f,onOpenChange:p,placement:"top",scale:i,trigger:h.jsxs("button",{className:`${a?"visible opacity-100":"invisible opacity-0"} text-xs text-foreground/20 hover:text-negative group-hover/node-wrapper:visible group-hover/node-wrapper:animate-delay-opacity ${e}`,onClick:_=>v(_),type:"button",children:[h.jsx(Ce,{tag:"trash-can",size:u})," ",h.jsx("span",{className:`${c?"whitespace-nowrap text-foreground/40 underline hover:text-negative":"sr-only"}`,children:s})]}),children:h.jsxs("div",{className:"text-xs font-semibold",children:[h.jsx("p",{className:"w-full pb-2 text-center",children:M(C.ARE_YOU_SURE)}),h.jsxs("div",{className:"align-center flex justify-between gap-2",children:[h.jsx("button",{className:"rounded bg-secondary py-1 px-2",onClick:_=>v(_),children:M(C.CANCEL)}),h.jsx("button",{className:"rounded bg-negative py-1 px-2",onClick:_=>x(_),children:M(C.DELETE)})]})]})})},DT=e=>{const t=ye(r=>r.viewport.zoom);return h.jsx(Fo,{scale:t,...e})},kT=Qe(),MT=100,PT=100,cg=({children:e,className:t="",onClickListItem:r})=>{const s=ye(p=>p.nodes),i=ye(p=>p.reactFlowInstance),a=ye(p=>p.validationWarnings),{setSelectedNodes:c}=Ze();if(a.size===0)return null;const u=Array.from(a.values());u.sort((p,m)=>M(p.nodeTitle).toLowerCase().localeCompare(M(m.nodeTitle).toLowerCase()));const f=p=>{const m=s.find(x=>x.id===p);if(!m){kT.error(`Node with id ${p} not found`);return}const E=i?.getNode(p)?.height??PT,v=i?.getNode(p)?.width??Om;i?.fitBounds({height:E+MT,width:v,x:m.position.x,y:m.position.y},{duration:mu}),setTimeout(()=>c([m.id]),mu),r?.()};return h.jsxs("div",{className:`hidden max-h-60 flex-col sm:flex ${t}`,children:[e,h.jsxs("p",{className:"mb-2 text-xs",children:[M(C.NUMBER_OF_VALIDATION_WARNINGS,{count:u.length}),":"]}),h.jsx("div",{className:"flex-auto overflow-y-auto",children:h.jsx("ol",{className:"list-inside",children:u.map(p=>h.jsxs("li",{className:"mb-2 text-xs",children:[h.jsx("button",{className:"text-warning underline",onClick:()=>f(p.nodeId),children:M(p.nodeTitle)}),h.jsxs("ol",{className:"my-1 ml-4 flex list-inside flex-col gap-y-1",children:[!p.connected&&h.jsx("li",{children:M(C.NOT_CONNECTED_TO_FLOW)}),!p.valid&&h.jsx("li",{children:M(C.INVALID_SETTINGS)})]})]},p.id))})})]})},Ys=e=>{const{className:t="",direction:r="from",valid:s=!0,...i}=e,a=r==="from";return h.jsxs("div",{className:`relative ${t} ${s?"":"invalid"}`,children:[h.jsx("input",{className:`w-full !pl-5 ${s?"":"invalid"}`,placeholder:M(a?C.FROM:C.TO),...i}),h.jsx(Ce,{className:"absolute left-[.25rem] top-[.5rem] text-foreground/40",tag:a?"arrow-left":"arrow-right"})]})},UT=({children:e})=>h.jsx("span",{className:"whitespace-wrap inline-block",children:h.jsx("code",{className:"mr-[0.5ch] whitespace-pre-wrap rounded-md bg-background p-0 px-[0.5ch] text-sm leading-4 tracking-tighter text-foreground",children:e})}),Xt=({children:e})=>h.jsxs("section",{className:"flex gap-2 overflow-hidden px-4 pb-3 text-xs leading-5",children:[h.jsx("div",{className:"shrink-0 pl-1 text-secondary",children:h.jsx(Ce,{size:"lg",tag:"arrow-turn-down-right"})}),h.jsx("div",{className:"w-full overflow-hidden",children:e})]}),FT=({connected:e=!1,deletable:t=!0,isRoot:r=!1,nodeId:s,nodeTitle:i,selected:a=!1})=>{const{removeNode:c}=Ze(),u=ye(p=>p.isEdgeConnecting),f=(p=>p?"bg-positive/10 text-positive":e?"bg-focus/30 text-primary":"bg-foreground/10 text-foreground/50")(r);return h.jsxs("div",{className:"flex w-full items-center justify-start gap-x-2 p-4",children:[h.jsx("div",{className:`${f} flex h-5 w-5 shrink-0 items-center justify-center rounded-full`,children:h.jsx(Ce,{tag:"circle-small"})}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h2",{className:"text-xs font-semibold",children:i}),!e&&h.jsxs("div",{className:"flex items-center justify-start text-tiny font-semibold leading-[14px] text-secondary",children:[h.jsx(Ce,{className:"px-1 text-warning",size:"lg",tag:"bolt"}),M(C.NOT_CONNECTED_TO_FLOW)]})]}),t&&!u&&h.jsx(DT,{handleDelete:()=>c(s),label:M(C.REMOVE_NODE,{title:i}),show:a})]})},jT=({valid:e})=>e?null:h.jsx("div",{className:"m-4 mt-0 inline-block",children:h.jsxs("div",{className:"flex items-start justify-start gap-2 rounded bg-negative/10 px-2 py-1 text-xs text-negative",children:[h.jsx(gr,{placement:"bottom",trigger:h.jsx("div",{role:"tooltip",tabIndex:0,children:h.jsx(Ce,{size:"lg",tag:"triangle-exclamation"})}),children:M(C.INFO_INVALID_SETTINGS)}),M(C.INVALID_SETTINGS)]})}),VT=({nodeId:e,valid:t})=>{const{deleteValidationWarning:r,getTargetEdges:s,partialUpdateValidationWarning:i}=Ze(),[a,c]=b.useState(!1);return b.useEffect(()=>{let u;const f=()=>{r(e),typeof u=="function"&&u()},p=()=>{const m=ye.getState().nodes.find(E=>E.id===e);if(!m)f();else{const E=s(e).length>0;c(E),i(e,{connected:E,nodeId:e,nodeType:m.type,valid:t})}};return p(),u=ye.subscribe((m,E)=>{const v=m.nodes.length!==E.nodes.length,x=m.edges.length!==E.edges.length,_=m.isEdgeUpdateSuccessful!==E.isEdgeUpdateSuccessful;(x||v||_)&&p()}),()=>{f()}},[r,s,e,i,t]),{isConnectedToFlow:a}},$T=({id:e,isConnectable:t})=>{if(!e)throw new Error("TargetHandle: id is required");return h.jsx("div",{className:"absolute left-0 top-5 h-3 w-3 -translate-x-1/2",children:h.jsx(Ro,{className:"-left-[2px] h-full w-full border-2 border-foreground/40 bg-background transition-colors hover:border-foreground/80",id:`target-${e}`,isConnectable:t,position:xe.Left,type:"target"})})},dt=({children:e,id:t,isConnectable:r=!0,isRoot:s=!1,nodeTitle:i,selected:a,deletable:c=!0,showValidation:u=!0,target:f=!0,valid:p=!0})=>{const{isConnectedToFlow:m}=VT({nodeId:t,valid:p});return h.jsx("section",{className:`${a?"!border-focus":""} group/node-wrapper rounded-xl border-2 border-background shadow-[0_4px_12px_0_rgba(0,0,0,0.08)] transition-[visibility]`,children:h.jsxs("div",{className:"group/node-wrapper relative rounded-xl bg-background",style:{width:Om},children:[f&&t&&h.jsx($T,{id:t,isConnectable:r}),h.jsx(FT,{connected:!f||m,deletable:c,isRoot:s,nodeId:t,nodeTitle:i,selected:a}),u&&h.jsx(jT,{valid:p}),e]})})},HT=({children:e,handleClick:t,...r})=>{const s=i=>{(i.key==="Backspace"||i.key==="Delete")&&(i.stopPropagation(),t?.())};return h.jsx("li",{"aria-selected":"true",tabIndex:0,role:"option",children:h.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/20 p-1 pl-2 text-xs font-medium text-foreground",children:[e,h.jsxs("button",{className:"px-1",onClick:t,onKeyDown:s,type:"button",...r,children:[h.jsx("span",{className:"sr-only",children:"Remove"}),h.jsx(Ce,{tag:"xmark",size:"xs"})]})]})})},ug=({data:e})=>{let t=e.selected&&e[e.selected].trim();return t&&e.selected==="url"&&(t=s1(t)||M(C.PLAY_AUDIO)),t?h.jsx(Xt,{children:h.jsx("div",{className:"max-w-max",children:e.selected==="url"?h.jsx("a",{className:"break-words text-primary underline line-clamp-2",href:e.url,target:"_blank",rel:"noopener noreferrer",children:t}):h.jsx("p",{className:"break-words line-clamp-2",children:t})})}):null},dg=e=>{const{children:t,className:r="",disabled:s=!1,...i}=e;return h.jsxs("div",{className:`chevron-down relative mb-2 after:rotate-0 after:transition-transform focus-within:after:rotate-180
61
+ ${s?"after:border-t-foreground/40":"after:border-t-foreground"}`,children:[h.jsx("select",{className:`pr-8 ${r}`,disabled:s,...i,children:t}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_SELECTION_REQUIRED)})]})},Tn=e=>{const{label:t="",id:r="",...s}=e,i=b.useId(),a=r||i;return h.jsxs(h.Fragment,{children:[t&&h.jsx("label",{className:"block pb-1 font-medium",htmlFor:a,children:t}),h.jsx(dg,{id:a,...s})]})},BT=({label:e,vars:t={}})=>h.jsx(pT,{components:{a:h.jsx("a",{className:"underline hover:text-background/80",href:t.linkTo||"#",target:"_blank",rel:"noopener noreferrer"}),code:h.jsx(UT,{}),p:h.jsx("p",{className:"mb-2"})},i18nKey:e}),zT={disabled:"border-disabled cursor-not-allowed",negative:"border-negative hover:bg-negative",positive:"border-positive hover:bg-positive"},an=({color:e="positive",enabled:t=!0,id:r,isConnectable:s})=>{if(!r)throw new Error("SourceHandle: id is required");const i=t?e:"disabled",a=ye(m=>m.updatingSourceHandleId),f=!ye(m=>m.edges.some(E=>E.sourceHandle===r))||a===r,p=f&&s&&t;return h.jsx("div",{className:`absolute right-0 top-1/2 h-3 w-3 -translate-y-1/2 translate-x-1/2 ${p?"":"nodrag cursor-not-allowed"}`,children:h.jsx(Ro,{className:`-right-[2px] h-full w-full border-2 bg-background transition-colors ${zT[i]??""}`,id:r,isConnectable:f&&s&&t,position:xe.Right,type:"source"})})},jo=({children:e})=>h.jsx("div",{className:"flex w-full flex-col items-start text-xs",children:e}),cn=({color:e="positive",enabled:t=!0,id:r,isConnectable:s,optionSubtitle:i="",optionTitle:a})=>h.jsxs("div",{className:"relative w-full min-w-[104px] whitespace-nowrap border-t border-foreground/10 py-3",children:[h.jsx("div",{className:"flex flex-col items-start justify-center px-4",children:h.jsxs("div",{className:`${t?"":"text-disabled"} min-h-[1rem] w-full overflow-hidden`,children:[a,i?h.jsx("span",{className:"block text-xxs text-secondary",children:i}):null]})}),h.jsx(an,{color:e,enabled:t,id:r,isConnectable:s})]}),WT=({checked:e=!1,name:t,onClick:r,...s})=>h.jsxs("button",{"aria-checked":e?"true":"false",className:`${e?"bg-primary":"bg-secondary"} relative inline-flex h-4 w-6 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out`,name:t,onClick:r,role:"switch",type:"button",...s,children:[h.jsx("span",{className:"sr-only",children:M(e?C.ON:C.OFF)}),h.jsx("span",{className:`pointer-events-none inline-block h-3 w-3 ${e?"translate-x-2":"translate-x-0"} transform rounded-full bg-white shadow transition duration-200 ease-in-out`})]}),Ol=({checked:e,clickHandler:t,name:r,subtitle:s,title:i,...a})=>h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsxs("div",{className:"flex flex-grow flex-col",children:[h.jsx("span",{className:"text-xs font-medium",children:i}),s&&h.jsx("span",{className:"text-xxs text-foreground/50",children:s})]}),h.jsx(WT,{checked:e,name:r,onClick:t,...a})]}),$n=({errorText:e,label:t,name:r,onChange:s,required:i,valid:a,value:c,...u})=>h.jsxs(h.Fragment,{children:[t?.trim()?h.jsx("div",{className:"pb-1",children:t}):null,h.jsx("textarea",{"aria-invalid":a?void 0:"true",className:`peer min-h-[77px] w-full resize-y ${a?"":"invalid"}`,inputMode:"text",minLength:1,name:r,onChange:s,required:i,value:c,...u}),h.jsx("p",{className:"requirements",role:"alert",children:e})]});function fr(e){return fg(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Hn(e){var t;return(t=(fg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fg(e){return e instanceof Node||e instanceof Ct(e).Node}function $e(e){return e instanceof Element||e instanceof Ct(e).Element}function Vt(e){return e instanceof HTMLElement||e instanceof Ct(e).HTMLElement}function Tu(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}function Ks(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=$t(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&!["inline","contents"].includes(i)}function GT(e){return["table","td","th"].includes(fr(e))}function Ou(e){const t=Cu(),r=$t(e);return r.transform!=="none"||r.perspective!=="none"||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||["transform","perspective","filter"].some(s=>(r.willChange||"").includes(s))||["paint","layout","strict","content"].some(s=>(r.contain||"").includes(s))}function YT(e){let t=Br(e);for(;Vt(t)&&!Vo(t);){if(Ou(t))return t;t=Br(t)}return null}function Cu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Vo(e){return["html","body","#document"].includes(fr(e))}function $t(e){return Ct(e).getComputedStyle(e)}function Cl(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Br(e){if(fr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Tu(e)&&e.host||Hn(e);return Tu(t)?t.host:t}function pg(e){const t=Br(e);return Vo(t)?e.ownerDocument?e.ownerDocument.body:e.body:Vt(t)&&Ks(t)?t:pg(t)}function pr(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=pg(e),a=i===((s=e.ownerDocument)==null?void 0:s.body),c=Ct(i);return a?t.concat(c,c.visualViewport||[],Ks(i)?i:[],c.frameElement&&r?pr(c.frameElement):[]):t.concat(i,pr(i,[],r))}function hg(e){let t=e.activeElement;for(;((r=t)==null||(r=r.shadowRoot)==null?void 0:r.activeElement)!=null;){var r;t=t.shadowRoot.activeElement}return t}function hr(e,t){if(!e||!t)return!1;const r=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(r&&Tu(r)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function mg(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function KT(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:r,version:s}=t;return r+"/"+s}).join(" "):navigator.userAgent}function XT(e){return!qT()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0}function QT(){return/apple/i.test(navigator.vendor)}function qT(){const e=/android/i;return e.test(mg())||e.test(KT())}function ZT(){return mg().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function gg(e,t){const r=["mouse","pen"];return r.push("",void 0),r.includes(e)}function JT(e){return"nativeEvent"in e}function eO(e){return e.matches("html,body")}function zr(e){return e?.ownerDocument||document}function Au(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}function Wr(e){return"composedPath"in e?e.composedPath()[0]:e.target}const tO="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function nO(e){return Vt(e)&&e.matches(tO)}const $o=Math.min,Gr=Math.max,Al=Math.round,Il=Math.floor,mr=e=>({x:e,y:e}),rO={left:"right",right:"left",bottom:"top",top:"bottom"},oO={start:"end",end:"start"};function Iu(e,t,r){return Gr(e,$o(t,r))}function Xs(e,t){return typeof e=="function"?e(t):e}function Yr(e){return e.split("-")[0]}function Qs(e){return e.split("-")[1]}function Eg(e){return e==="x"?"y":"x"}function bu(e){return e==="y"?"height":"width"}function bl(e){return["top","bottom"].includes(Yr(e))?"y":"x"}function Lu(e){return Eg(bl(e))}function sO(e,t,r){r===void 0&&(r=!1);const s=Qs(e),i=Lu(e),a=bu(i);let c=i==="x"?s===(r?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(c=Ll(c)),[c,Ll(c)]}function iO(e){const t=Ll(e);return[Du(e),t,Du(t)]}function Du(e){return e.replace(/start|end/g,t=>oO[t])}function lO(e,t,r){const s=["left","right"],i=["right","left"],a=["top","bottom"],c=["bottom","top"];switch(e){case"top":case"bottom":return r?t?i:s:t?s:i;case"left":case"right":return t?a:c;default:return[]}}function aO(e,t,r,s){const i=Qs(e);let a=lO(Yr(e),r==="start",s);return i&&(a=a.map(c=>c+"-"+i),t&&(a=a.concat(a.map(Du)))),a}function Ll(e){return e.replace(/left|right|bottom|top/g,t=>rO[t])}function cO(e){return{top:0,right:0,bottom:0,left:0,...e}}function yg(e){return typeof e!="number"?cO(e):{top:e,right:e,bottom:e,left:e}}function Dl(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function vg(e,t,r){let{reference:s,floating:i}=e;const a=bl(t),c=Lu(t),u=bu(c),f=Yr(t),p=a==="y",m=s.x+s.width/2-i.width/2,E=s.y+s.height/2-i.height/2,v=s[u]/2-i[u]/2;let x;switch(f){case"top":x={x:m,y:s.y-i.height};break;case"bottom":x={x:m,y:s.y+s.height};break;case"right":x={x:s.x+s.width,y:E};break;case"left":x={x:s.x-i.width,y:E};break;default:x={x:s.x,y:s.y}}switch(Qs(t)){case"start":x[c]-=v*(r&&p?-1:1);break;case"end":x[c]+=v*(r&&p?-1:1);break}return x}const uO=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:a=[],platform:c}=r,u=a.filter(Boolean),f=await(c.isRTL==null?void 0:c.isRTL(t));let p=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:m,y:E}=vg(p,s,f),v=s,x={},_=0;for(let w=0;w<u.length;w++){const{name:S,fn:N}=u[w],{x:O,y:D,data:T,reset:A}=await N({x:m,y:E,initialPlacement:s,placement:v,strategy:i,middlewareData:x,rects:p,platform:c,elements:{reference:e,floating:t}});if(m=O??m,E=D??E,x={...x,[S]:{...x[S],...T}},A&&_<=50){_++,typeof A=="object"&&(A.placement&&(v=A.placement),A.rects&&(p=A.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:m,y:E}=vg(p,v,f)),w=-1;continue}}return{x:m,y:E,placement:v,strategy:i,middlewareData:x}};async function xg(e,t){var r;t===void 0&&(t={});const{x:s,y:i,platform:a,rects:c,elements:u,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:m="viewport",elementContext:E="floating",altBoundary:v=!1,padding:x=0}=Xs(t,e),_=yg(x),S=u[v?E==="floating"?"reference":"floating":E],N=Dl(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(S)))==null||r?S:S.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:p,rootBoundary:m,strategy:f})),O=E==="floating"?{...c.floating,x:s,y:i}:c.reference,D=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),T=await(a.isElement==null?void 0:a.isElement(D))?await(a.getScale==null?void 0:a.getScale(D))||{x:1,y:1}:{x:1,y:1},A=Dl(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({rect:O,offsetParent:D,strategy:f}):O);return{top:(N.top-A.top+_.top)/T.y,bottom:(A.bottom-N.bottom+_.bottom)/T.y,left:(N.left-A.left+_.left)/T.x,right:(A.right-N.right+_.right)/T.x}}const Sg=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:s,placement:i,rects:a,platform:c,elements:u,middlewareData:f}=t,{element:p,padding:m=0}=Xs(e,t)||{};if(p==null)return{};const E=yg(m),v={x:r,y:s},x=Lu(i),_=bu(x),w=await c.getDimensions(p),S=x==="y",N=S?"top":"left",O=S?"bottom":"right",D=S?"clientHeight":"clientWidth",T=a.reference[_]+a.reference[x]-v[x]-a.floating[_],A=v[x]-a.reference[x],L=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p));let F=L?L[D]:0;(!F||!await(c.isElement==null?void 0:c.isElement(L)))&&(F=u.floating[D]||a.floating[_]);const K=T/2-A/2,Q=F/2-w[_]/2-1,X=$o(E[N],Q),ee=$o(E[O],Q),ne=X,W=F-w[_]-ee,I=F/2-w[_]/2+K,V=Iu(ne,I,W),j=!f.arrow&&Qs(i)!=null&&I!=V&&a.reference[_]/2-(I<ne?X:ee)-w[_]/2<0,B=j?I<ne?I-ne:I-W:0;return{[x]:v[x]+B,data:{[x]:V,centerOffset:I-V-B,...j&&{alignmentOffset:B}},reset:j}}}),dO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,s;const{placement:i,middlewareData:a,rects:c,initialPlacement:u,platform:f,elements:p}=t,{mainAxis:m=!0,crossAxis:E=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:_="none",flipAlignment:w=!0,...S}=Xs(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const N=Yr(i),O=Yr(u)===u,D=await(f.isRTL==null?void 0:f.isRTL(p.floating)),T=v||(O||!w?[Ll(u)]:iO(u));!v&&_!=="none"&&T.push(...aO(u,w,_,D));const A=[u,...T],L=await xg(t,S),F=[];let K=((s=a.flip)==null?void 0:s.overflows)||[];if(m&&F.push(L[N]),E){const ne=sO(i,c,D);F.push(L[ne[0]],L[ne[1]])}if(K=[...K,{placement:i,overflows:F}],!F.every(ne=>ne<=0)){var Q,X;const ne=(((Q=a.flip)==null?void 0:Q.index)||0)+1,W=A[ne];if(W)return{data:{index:ne,overflows:K},reset:{placement:W}};let I=(X=K.filter(V=>V.overflows[0]<=0).sort((V,j)=>V.overflows[1]-j.overflows[1])[0])==null?void 0:X.placement;if(!I)switch(x){case"bestFit":{var ee;const V=(ee=K.map(j=>[j.placement,j.overflows.filter(B=>B>0).reduce((B,U)=>B+U,0)]).sort((j,B)=>j[1]-B[1])[0])==null?void 0:ee[0];V&&(I=V);break}case"initialPlacement":I=u;break}if(i!==I)return{reset:{placement:I}}}return{}}}};async function fO(e,t){const{placement:r,platform:s,elements:i}=e,a=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=Yr(r),u=Qs(r),f=bl(r)==="y",p=["left","top"].includes(c)?-1:1,m=a&&f?-1:1,E=Xs(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:_}=typeof E=="number"?{mainAxis:E,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...E};return u&&typeof _=="number"&&(x=u==="end"?_*-1:_),f?{x:x*m,y:v*p}:{x:v*p,y:x*m}}const pO=function(e){return{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:a,placement:c,middlewareData:u}=t,f=await fO(t,e);return c===((r=u.offset)==null?void 0:r.placement)&&(s=u.arrow)!=null&&s.alignmentOffset?{}:{x:i+f.x,y:a+f.y,data:{...f,placement:c}}}}},hO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i}=t,{mainAxis:a=!0,crossAxis:c=!1,limiter:u={fn:S=>{let{x:N,y:O}=S;return{x:N,y:O}}},...f}=Xs(e,t),p={x:r,y:s},m=await xg(t,f),E=bl(Yr(i)),v=Eg(E);let x=p[v],_=p[E];if(a){const S=v==="y"?"top":"left",N=v==="y"?"bottom":"right",O=x+m[S],D=x-m[N];x=Iu(O,x,D)}if(c){const S=E==="y"?"top":"left",N=E==="y"?"bottom":"right",O=_+m[S],D=_-m[N];_=Iu(O,_,D)}const w=u.fn({...t,[v]:x,[E]:_});return{...w,data:{x:w.x-r,y:w.y-s}}}}};function _g(e){const t=$t(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Vt(e),a=i?e.offsetWidth:r,c=i?e.offsetHeight:s,u=Al(r)!==a||Al(s)!==c;return u&&(r=a,s=c),{width:r,height:s,$:u}}function ku(e){return $e(e)?e:e.contextElement}function Ho(e){const t=ku(e);if(!Vt(t))return mr(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:a}=_g(t);let c=(a?Al(r.width):r.width)/s,u=(a?Al(r.height):r.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const mO=mr(0);function wg(e){const t=Ct(e);return!Cu()||!t.visualViewport?mO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gO(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ct(e)?!1:t}function Kr(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),a=ku(e);let c=mr(1);t&&(s?$e(s)&&(c=Ho(s)):c=Ho(e));const u=gO(a,r,s)?wg(a):mr(0);let f=(i.left+u.x)/c.x,p=(i.top+u.y)/c.y,m=i.width/c.x,E=i.height/c.y;if(a){const v=Ct(a),x=s&&$e(s)?Ct(s):s;let _=v.frameElement;for(;_&&s&&x!==v;){const w=Ho(_),S=_.getBoundingClientRect(),N=$t(_),O=S.left+(_.clientLeft+parseFloat(N.paddingLeft))*w.x,D=S.top+(_.clientTop+parseFloat(N.paddingTop))*w.y;f*=w.x,p*=w.y,m*=w.x,E*=w.y,f+=O,p+=D,_=Ct(_).frameElement}}return Dl({width:m,height:E,x:f,y:p})}function EO(e){let{rect:t,offsetParent:r,strategy:s}=e;const i=Vt(r),a=Hn(r);if(r===a)return t;let c={scrollLeft:0,scrollTop:0},u=mr(1);const f=mr(0);if((i||!i&&s!=="fixed")&&((fr(r)!=="body"||Ks(a))&&(c=Cl(r)),Vt(r))){const p=Kr(r);u=Ho(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+f.x,y:t.y*u.y-c.scrollTop*u.y+f.y}}function yO(e){return Array.from(e.getClientRects())}function Ng(e){return Kr(Hn(e)).left+Cl(e).scrollLeft}function vO(e){const t=Hn(e),r=Cl(e),s=e.ownerDocument.body,i=Gr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=Gr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-r.scrollLeft+Ng(e);const u=-r.scrollTop;return $t(s).direction==="rtl"&&(c+=Gr(t.clientWidth,s.clientWidth)-i),{width:i,height:a,x:c,y:u}}function xO(e,t){const r=Ct(e),s=Hn(e),i=r.visualViewport;let a=s.clientWidth,c=s.clientHeight,u=0,f=0;if(i){a=i.width,c=i.height;const p=Cu();(!p||p&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}return{width:a,height:c,x:u,y:f}}function SO(e,t){const r=Kr(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,a=Vt(e)?Ho(e):mr(1),c=e.clientWidth*a.x,u=e.clientHeight*a.y,f=i*a.x,p=s*a.y;return{width:c,height:u,x:f,y:p}}function Rg(e,t,r){let s;if(t==="viewport")s=xO(e,r);else if(t==="document")s=vO(Hn(e));else if($e(t))s=SO(t,r);else{const i=wg(e);s={...t,x:t.x-i.x,y:t.y-i.y}}return Dl(s)}function Tg(e,t){const r=Br(e);return r===t||!$e(r)||Vo(r)?!1:$t(r).position==="fixed"||Tg(r,t)}function _O(e,t){const r=t.get(e);if(r)return r;let s=pr(e,[],!1).filter(u=>$e(u)&&fr(u)!=="body"),i=null;const a=$t(e).position==="fixed";let c=a?Br(e):e;for(;$e(c)&&!Vo(c);){const u=$t(c),f=Ou(c);!f&&u.position==="fixed"&&(i=null),(a?!f&&!i:!f&&u.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Ks(c)&&!f&&Tg(e,c))?s=s.filter(m=>m!==c):i=u,c=Br(c)}return t.set(e,s),s}function wO(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const c=[...r==="clippingAncestors"?_O(t,this._c):[].concat(r),s],u=c[0],f=c.reduce((p,m)=>{const E=Rg(t,m,i);return p.top=Gr(E.top,p.top),p.right=$o(E.right,p.right),p.bottom=$o(E.bottom,p.bottom),p.left=Gr(E.left,p.left),p},Rg(t,u,i));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function NO(e){return _g(e)}function RO(e,t,r){const s=Vt(t),i=Hn(t),a=r==="fixed",c=Kr(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const f=mr(0);if(s||!s&&!a)if((fr(t)!=="body"||Ks(i))&&(u=Cl(t)),s){const p=Kr(t,!0,a,t);f.x=p.x+t.clientLeft,f.y=p.y+t.clientTop}else i&&(f.x=Ng(i));return{x:c.left+u.scrollLeft-f.x,y:c.top+u.scrollTop-f.y,width:c.width,height:c.height}}function Og(e,t){return!Vt(e)||$t(e).position==="fixed"?null:t?t(e):e.offsetParent}function Cg(e,t){const r=Ct(e);if(!Vt(e))return r;let s=Og(e,t);for(;s&&GT(s)&&$t(s).position==="static";)s=Og(s,t);return s&&(fr(s)==="html"||fr(s)==="body"&&$t(s).position==="static"&&!Ou(s))?r:s||YT(e)||r}const TO=async function(e){let{reference:t,floating:r,strategy:s}=e;const i=this.getOffsetParent||Cg,a=this.getDimensions;return{reference:RO(t,await i(r),s),floating:{x:0,y:0,...await a(r)}}};function OO(e){return $t(e).direction==="rtl"}const CO={convertOffsetParentRelativeRectToViewportRelativeRect:EO,getDocumentElement:Hn,getClippingRect:wO,getOffsetParent:Cg,getElementRects:TO,getClientRects:yO,getDimensions:NO,getScale:Ho,isElement:$e,isRTL:OO};function AO(e,t){let r=null,s;const i=Hn(e);function a(){clearTimeout(s),r&&r.disconnect(),r=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),a();const{left:p,top:m,width:E,height:v}=e.getBoundingClientRect();if(u||t(),!E||!v)return;const x=Il(m),_=Il(i.clientWidth-(p+E)),w=Il(i.clientHeight-(m+v)),S=Il(p),O={rootMargin:-x+"px "+-_+"px "+-w+"px "+-S+"px",threshold:Gr(0,$o(1,f))||1};let D=!0;function T(A){const L=A[0].intersectionRatio;if(L!==f){if(!D)return c();L?c(!1,L):s=setTimeout(()=>{c(!1,1e-7)},100)}D=!1}try{r=new IntersectionObserver(T,{...O,root:i.ownerDocument})}catch{r=new IntersectionObserver(T,O)}r.observe(e)}return c(!0),a}function IO(e,t,r,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=s,p=ku(e),m=i||a?[...p?pr(p):[],...pr(t)]:[];m.forEach(N=>{i&&N.addEventListener("scroll",r,{passive:!0}),a&&N.addEventListener("resize",r)});const E=p&&u?AO(p,r):null;let v=-1,x=null;c&&(x=new ResizeObserver(N=>{let[O]=N;O&&O.target===p&&x&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{x&&x.observe(t)})),r()}),p&&!f&&x.observe(p),x.observe(t));let _,w=f?Kr(e):null;f&&S();function S(){const N=Kr(e);w&&(N.x!==w.x||N.y!==w.y||N.width!==w.width||N.height!==w.height)&&r(),w=N,_=requestAnimationFrame(S)}return r(),()=>{m.forEach(N=>{i&&N.removeEventListener("scroll",r),a&&N.removeEventListener("resize",r)}),E&&E(),x&&x.disconnect(),x=null,f&&cancelAnimationFrame(_)}}const bO=(e,t,r)=>{const s=new Map,i={platform:CO,...r},a={...i.platform,_c:s};return uO(e,t,{...i,platform:a})},LO=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:s,padding:i}=typeof e=="function"?e(r):e;return s&&t(s)?s.current!=null?Sg({element:s.current,padding:i}).fn(r):{}:s?Sg({element:s,padding:i}).fn(r):{}}}};var kl=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Ml(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,s,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(s=r;s--!==0;)if(!Ml(e[s],t[s]))return!1;return!0}if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(s=r;s--!==0;)if(!{}.hasOwnProperty.call(t,i[s]))return!1;for(s=r;s--!==0;){const a=i[s];if(!(a==="_owner"&&e.$$typeof)&&!Ml(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Ag(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ig(e,t){const r=Ag(e);return Math.round(t*r)/r}function bg(e){const t=b.useRef(e);return kl(()=>{t.current=e}),t}function DO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:s=[],platform:i,elements:{reference:a,floating:c}={},transform:u=!0,whileElementsMounted:f,open:p}=e,[m,E]=b.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=b.useState(s);Ml(v,s)||x(s);const[_,w]=b.useState(null),[S,N]=b.useState(null),O=b.useCallback(j=>{j!=L.current&&(L.current=j,w(j))},[w]),D=b.useCallback(j=>{j!==F.current&&(F.current=j,N(j))},[N]),T=a||_,A=c||S,L=b.useRef(null),F=b.useRef(null),K=b.useRef(m),Q=bg(f),X=bg(i),ee=b.useCallback(()=>{if(!L.current||!F.current)return;const j={placement:t,strategy:r,middleware:v};X.current&&(j.platform=X.current),bO(L.current,F.current,j).then(B=>{const U={...B,isPositioned:!0};ne.current&&!Ml(K.current,U)&&(K.current=U,Bc.flushSync(()=>{E(U)}))})},[v,t,r,X]);kl(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,E(j=>({...j,isPositioned:!1})))},[p]);const ne=b.useRef(!1);kl(()=>(ne.current=!0,()=>{ne.current=!1}),[]),kl(()=>{if(T&&(L.current=T),A&&(F.current=A),T&&A){if(Q.current)return Q.current(T,A,ee);ee()}},[T,A,ee,Q]);const W=b.useMemo(()=>({reference:L,floating:F,setReference:O,setFloating:D}),[O,D]),I=b.useMemo(()=>({reference:T,floating:A}),[T,A]),V=b.useMemo(()=>{const j={position:r,left:0,top:0};if(!I.floating)return j;const B=Ig(I.floating,m.x),U=Ig(I.floating,m.y);return u?{...j,transform:"translate("+B+"px, "+U+"px)",...Ag(I.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:B,top:U}},[r,u,I.floating,m.x,m.y]);return b.useMemo(()=>({...m,update:ee,refs:W,elements:I,floatingStyles:V}),[m,ee,W,I,V])}function Lg(e){return b.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})},e)}const kO=tp.useInsertionEffect||(e=>e());function Bo(e){const t=b.useRef(()=>{});return kO(()=>{t.current=e}),b.useCallback(function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return t.current==null?void 0:t.current(...s)},[])}var qs=typeof document<"u"?b.useLayoutEffect:b.useEffect;let Mu=!1,MO=0;const Dg=()=>"floating-ui-"+MO++;function PO(){const[e,t]=b.useState(()=>Mu?Dg():void 0);return qs(()=>{e==null&&t(Dg())},[]),b.useEffect(()=>{Mu||(Mu=!0)},[]),e}const kg=tp.useId||PO;function UO(){const e=new Map;return{emit(t,r){var s;(s=e.get(t))==null||s.forEach(i=>i(r))},on(t,r){e.set(t,[...e.get(t)||[],r])},off(t,r){var s;e.set(t,((s=e.get(t))==null?void 0:s.filter(i=>i!==r))||[])}}}const FO=b.createContext(null),jO=b.createContext(null),Pu=()=>{var e;return((e=b.useContext(FO))==null?void 0:e.id)||null},Uu=()=>b.useContext(jO);function Fu(e){return"data-floating-ui-"+e}function Mg(e){const t=b.useRef(e);return qs(()=>{t.current=e}),t}const Pg=Fu("safe-polygon");function ju(e,t,r){return r&&!gg(r)?0:typeof e=="number"?e:e?.[t]}function VO(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,dataRef:i,events:a,elements:{domReference:c,floating:u},refs:f}=e,{enabled:p=!0,delay:m=0,handleClose:E=null,mouseOnly:v=!1,restMs:x=0,move:_=!0}=t,w=Uu(),S=Pu(),N=Mg(E),O=Mg(m),D=b.useRef(),T=b.useRef(),A=b.useRef(),L=b.useRef(),F=b.useRef(!0),K=b.useRef(!1),Q=b.useRef(()=>{}),X=b.useCallback(()=>{var I;const V=(I=i.current.openEvent)==null?void 0:I.type;return V?.includes("mouse")&&V!=="mousedown"},[i]);b.useEffect(()=>{if(!p)return;function I(V){let{open:j}=V;j||(clearTimeout(T.current),clearTimeout(L.current),F.current=!0)}return a.on("openchange",I),()=>{a.off("openchange",I)}},[p,a]),b.useEffect(()=>{if(!p||!N.current||!r)return;function I(j){X()&&s(!1,j,"hover")}const V=zr(u).documentElement;return V.addEventListener("mouseleave",I),()=>{V.removeEventListener("mouseleave",I)}},[u,r,s,p,N,i,X]);const ee=b.useCallback(function(I,V,j){V===void 0&&(V=!0),j===void 0&&(j="hover");const B=ju(O.current,"close",D.current);B&&!A.current?(clearTimeout(T.current),T.current=setTimeout(()=>s(!1,I,j),B)):V&&(clearTimeout(T.current),s(!1,I,j))},[O,s]),ne=b.useCallback(()=>{Q.current(),A.current=void 0},[]),W=b.useCallback(()=>{if(K.current){const I=zr(f.floating.current).body;I.style.pointerEvents="",I.removeAttribute(Pg),K.current=!1}},[f]);return b.useEffect(()=>{if(!p)return;function I(){return i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1}function V(U){if(clearTimeout(T.current),F.current=!1,v&&!gg(D.current)||x>0&&ju(O.current,"open")===0)return;const $=ju(O.current,"open",D.current);$?T.current=setTimeout(()=>{s(!0,U,"hover")},$):s(!0,U,"hover")}function j(U){if(I())return;Q.current();const $=zr(u);if(clearTimeout(L.current),N.current){r||clearTimeout(T.current),A.current=N.current({...e,tree:w,x:U.clientX,y:U.clientY,onClose(){W(),ne(),ee(U,!0,"safe-polygon")}});const k=A.current;$.addEventListener("mousemove",k),Q.current=()=>{$.removeEventListener("mousemove",k)};return}(D.current==="touch"?!hr(u,U.relatedTarget):!0)&&ee(U)}function B(U){I()||N.current==null||N.current({...e,tree:w,x:U.clientX,y:U.clientY,onClose(){W(),ne(),ee(U)}})(U)}if($e(c)){const U=c;return r&&U.addEventListener("mouseleave",B),u?.addEventListener("mouseleave",B),_&&U.addEventListener("mousemove",V,{once:!0}),U.addEventListener("mouseenter",V),U.addEventListener("mouseleave",j),()=>{r&&U.removeEventListener("mouseleave",B),u?.removeEventListener("mouseleave",B),_&&U.removeEventListener("mousemove",V),U.removeEventListener("mouseenter",V),U.removeEventListener("mouseleave",j)}}},[c,u,p,e,v,x,_,ee,ne,W,s,r,w,O,N,i]),qs(()=>{var I;if(p&&r&&(I=N.current)!=null&&I.__options.blockPointerEvents&&X()){const j=zr(u).body;if(j.setAttribute(Pg,""),j.style.pointerEvents="none",K.current=!0,$e(c)&&u){var V;const B=c,U=w==null||(V=w.nodesRef.current.find($=>$.id===S))==null||(V=V.context)==null?void 0:V.elements.floating;return U&&(U.style.pointerEvents=""),B.style.pointerEvents="auto",u.style.pointerEvents="auto",()=>{B.style.pointerEvents="",u.style.pointerEvents=""}}}},[p,r,S,u,c,w,N,i,X]),qs(()=>{r||(D.current=void 0,ne(),W())},[r,ne,W]),b.useEffect(()=>()=>{ne(),clearTimeout(T.current),clearTimeout(L.current),W()},[p,c,ne,W]),b.useMemo(()=>{if(!p)return{};function I(V){D.current=V.pointerType}return{reference:{onPointerDown:I,onPointerEnter:I,onMouseMove(V){r||x===0||(clearTimeout(L.current),L.current=setTimeout(()=>{F.current||s(!0,V.nativeEvent,"hover")},x))}},floating:{onMouseEnter(){clearTimeout(T.current)},onMouseLeave(V){ee(V.nativeEvent,!1)}}}},[p,x,r,s,ee])}function Pl(e,t){let r=e.filter(i=>{var a;return i.parentId===t&&((a=i.context)==null?void 0:a.open)}),s=r;for(;s.length;)s=e.filter(i=>{var a;return(a=s)==null?void 0:a.some(c=>{var u;return i.parentId===c.id&&((u=i.context)==null?void 0:u.open)})}),r=r.concat(s);return r}const $O={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},HO={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Ug=e=>{var t,r;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(r=e?.outsidePress)!=null?r:!0}};function BO(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,nodeId:i,elements:{reference:a,domReference:c,floating:u},dataRef:f}=e,{enabled:p=!0,escapeKey:m=!0,outsidePress:E=!0,outsidePressEvent:v="pointerdown",referencePress:x=!1,referencePressEvent:_="pointerdown",ancestorScroll:w=!1,bubbles:S,capture:N}=t,O=Uu(),D=Bo(typeof E=="function"?E:()=>!1),T=typeof E=="function"?D:E,A=b.useRef(!1),L=b.useRef(!1),{escapeKey:F,outsidePress:K}=Ug(S),{escapeKey:Q,outsidePress:X}=Ug(N),ee=Bo(V=>{if(!r||!p||!m||V.key!=="Escape")return;const j=O?Pl(O.nodesRef.current,i):[];if(!F&&(V.stopPropagation(),j.length>0)){let B=!0;if(j.forEach(U=>{var $;if(($=U.context)!=null&&$.open&&!U.context.dataRef.current.__escapeKeyBubbles){B=!1;return}}),!B)return}s(!1,JT(V)?V.nativeEvent:V,"escape-key")}),ne=Bo(V=>{var j;const B=()=>{var U;ee(V),(U=Wr(V))==null||U.removeEventListener("keydown",B)};(j=Wr(V))==null||j.addEventListener("keydown",B)}),W=Bo(V=>{const j=A.current;A.current=!1;const B=L.current;if(L.current=!1,v==="click"&&B||j||typeof T=="function"&&!T(V))return;const U=Wr(V),$="["+Fu("inert")+"]",z=zr(u).querySelectorAll($);let k=$e(U)?U:null;for(;k&&!Vo(k);){const oe=Br(k);if(Vo(oe)||!$e(oe))break;k=oe}if(z.length&&$e(U)&&!eO(U)&&!hr(U,u)&&Array.from(z).every(oe=>!hr(k,oe)))return;if(Vt(U)&&u){const oe=U.clientWidth>0&&U.scrollWidth>U.clientWidth,le=U.clientHeight>0&&U.scrollHeight>U.clientHeight;let de=le&&V.offsetX>U.clientWidth;if(le&&$t(U).direction==="rtl"&&(de=V.offsetX<=U.offsetWidth-U.clientWidth),de||oe&&V.offsetY>U.clientHeight)return}const Y=O&&Pl(O.nodesRef.current,i).some(oe=>{var le;return Au(V,(le=oe.context)==null?void 0:le.elements.floating)});if(Au(V,u)||Au(V,c)||Y)return;const re=O?Pl(O.nodesRef.current,i):[];if(re.length>0){let oe=!0;if(re.forEach(le=>{var de;if((de=le.context)!=null&&de.open&&!le.context.dataRef.current.__outsidePressBubbles){oe=!1;return}}),!oe)return}s(!1,V,"outside-press")}),I=Bo(V=>{var j;const B=()=>{var U;W(V),(U=Wr(V))==null||U.removeEventListener(v,B)};(j=Wr(V))==null||j.addEventListener(v,B)});return b.useEffect(()=>{if(!r||!p)return;f.current.__escapeKeyBubbles=F,f.current.__outsidePressBubbles=K;function V(U){s(!1,U,"ancestor-scroll")}const j=zr(u);m&&j.addEventListener("keydown",Q?ne:ee,Q),T&&j.addEventListener(v,X?I:W,X);let B=[];return w&&($e(c)&&(B=pr(c)),$e(u)&&(B=B.concat(pr(u))),!$e(a)&&a&&a.contextElement&&(B=B.concat(pr(a.contextElement)))),B=B.filter(U=>{var $;return U!==(($=j.defaultView)==null?void 0:$.visualViewport)}),B.forEach(U=>{U.addEventListener("scroll",V,{passive:!0})}),()=>{m&&j.removeEventListener("keydown",Q?ne:ee,Q),T&&j.removeEventListener(v,X?I:W,X),B.forEach(U=>{U.removeEventListener("scroll",V)})}},[f,u,c,a,m,T,v,r,s,w,p,F,K,ee,Q,ne,W,X,I]),b.useEffect(()=>{A.current=!1},[T,v]),b.useMemo(()=>p?{reference:{onKeyDown:ee,[$O[_]]:V=>{x&&s(!1,V.nativeEvent,"reference-press")}},floating:{onKeyDown:ee,onMouseDown(){L.current=!0},onMouseUp(){L.current=!0},[HO[v]]:()=>{A.current=!0}}}:{},[p,x,v,_,s,ee])}function zO(e){var t;e===void 0&&(e={});const{open:r=!1,onOpenChange:s,nodeId:i}=e,[a,c]=b.useState(null),u=((t=e.elements)==null?void 0:t.reference)||a,f=DO(e),p=Uu(),m=Pu()!=null,E=Bo((A,L,F)=>{A&&(x.current.openEvent=L),_.emit("openchange",{open:A,event:L,reason:F,nested:m}),s?.(A,L,F)}),v=b.useRef(null),x=b.useRef({}),_=b.useState(()=>UO())[0],w=kg(),S=b.useCallback(A=>{const L=$e(A)?{getBoundingClientRect:()=>A.getBoundingClientRect(),contextElement:A}:A;f.refs.setReference(L)},[f.refs]),N=b.useCallback(A=>{($e(A)||A===null)&&(v.current=A,c(A)),($e(f.refs.reference.current)||f.refs.reference.current===null||A!==null&&!$e(A))&&f.refs.setReference(A)},[f.refs]),O=b.useMemo(()=>({...f.refs,setReference:N,setPositionReference:S,domReference:v}),[f.refs,N,S]),D=b.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),T=b.useMemo(()=>({...f,refs:O,elements:D,dataRef:x,nodeId:i,floatingId:w,events:_,open:r,onOpenChange:E}),[f,i,w,_,r,E,O,D]);return qs(()=>{const A=p?.nodesRef.current.find(L=>L.id===i);A&&(A.context=T)}),b.useMemo(()=>({...f,context:T,refs:O,elements:D}),[f,O,D,T])}function WO(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,events:i,refs:a,elements:{floating:c,domReference:u}}=e,{enabled:f=!0,visibleOnly:p=!0}=t,m=b.useRef(!1),E=b.useRef(),v=b.useRef(!0);return b.useEffect(()=>{if(!f)return;const x=Ct(u);function _(){!r&&Vt(u)&&u===hg(zr(u))&&(m.current=!0)}function w(){v.current=!0}return x.addEventListener("blur",_),x.addEventListener("keydown",w,!0),()=>{x.removeEventListener("blur",_),x.removeEventListener("keydown",w,!0)}},[c,u,r,f]),b.useEffect(()=>{if(!f)return;function x(_){let{reason:w}=_;(w==="reference-press"||w==="escape-key")&&(m.current=!0)}return i.on("openchange",x),()=>{i.off("openchange",x)}},[i,f]),b.useEffect(()=>()=>{clearTimeout(E.current)},[]),b.useMemo(()=>f?{reference:{onPointerDown(x){XT(x.nativeEvent)||(v.current=!1)},onMouseLeave(){m.current=!1},onFocus(x){if(m.current)return;const _=Wr(x.nativeEvent);if(p&&$e(_))try{if(QT()&&ZT())throw Error();if(!_.matches(":focus-visible"))return}catch{if(!v.current&&!nO(_))return}s(!0,x.nativeEvent,"focus")},onBlur(x){m.current=!1;const _=x.relatedTarget,w=$e(_)&&_.hasAttribute(Fu("focus-guard"))&&_.getAttribute("data-type")==="outside";E.current=window.setTimeout(()=>{const S=hg(u?u.ownerDocument:document);!_&&S===u||hr(a.floating.current,_)||hr(u,_)||w||s(!1,x.nativeEvent,"focus")})}}}:{},[f,p,u,a,s])}const Fg="active",jg="selected";function Vu(e,t,r){const s=new Map,i=r==="item";let a=e;if(i&&e){const{[Fg]:c,[jg]:u,...f}=e;a=f}return{...r==="floating"&&{tabIndex:-1},...a,...t.map(c=>{const u=c?c[r]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(f=>{let[p,m]=f;if(!(i&&[Fg,jg].includes(p)))if(p.indexOf("on")===0){if(s.has(p)||s.set(p,[]),typeof m=="function"){var E;(E=s.get(p))==null||E.push(m),c[p]=function(){for(var v,x=arguments.length,_=new Array(x),w=0;w<x;w++)_[w]=arguments[w];return(v=s.get(p))==null?void 0:v.map(S=>S(..._)).find(S=>S!==void 0)}}}else c[p]=m}),c),{})}}function GO(e){e===void 0&&(e=[]);const t=e,r=b.useCallback(a=>Vu(a,e,"reference"),t),s=b.useCallback(a=>Vu(a,e,"floating"),t),i=b.useCallback(a=>Vu(a,e,"item"),e.map(a=>a?.item));return b.useMemo(()=>({getReferenceProps:r,getFloatingProps:s,getItemProps:i}),[r,s,i])}const YO=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function KO(e,t){var r;t===void 0&&(t={});const{open:s,floatingId:i}=e,{enabled:a=!0,role:c="dialog"}=t,u=(r=YO.get(c))!=null?r:c,f=kg(),m=Pu()!=null;return b.useMemo(()=>{if(!a)return{};const E={id:i,...u&&{role:u}};return u==="tooltip"||c==="label"?{reference:{["aria-"+(c==="label"?"labelledby":"describedby")]:s?i:void 0},floating:E}:{reference:{"aria-expanded":s?"true":"false","aria-haspopup":u==="alertdialog"?"dialog":u,"aria-controls":s?i:void 0,...u==="listbox"&&{role:"combobox"},...u==="menu"&&{id:f},...u==="menu"&&m&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},floating:{...E,...u==="menu"&&{"aria-labelledby":f}},item(v){let{active:x,selected:_}=v;const w={role:"option",...x&&{id:i+"-option"}};switch(c){case"select":return{...w,"aria-selected":x&&_};case"combobox":return{...w,...x&&{"aria-selected":!0}}}return{}}}},[a,c,u,s,i,f,m])}function Vg(e,t){const[r,s]=e;let i=!1;const a=t.length;for(let c=0,u=a-1;c<a;u=c++){const[f,p]=t[c]||[0,0],[m,E]=t[u]||[0,0];p>=s!=E>=s&&r<=(m-f)*(s-p)/(E-p)+f&&(i=!i)}return i}function XO(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function QO(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:r=!1,requireIntent:s=!0}=e;let i,a=!1,c=null,u=null,f=performance.now();function p(E,v){const x=performance.now(),_=x-f;if(c===null||u===null||_===0)return c=E,u=v,f=x,null;const w=E-c,S=v-u,O=Math.sqrt(w*w+S*S)/_;return c=E,u=v,f=x,O}const m=E=>{let{x:v,y:x,placement:_,elements:w,onClose:S,nodeId:N,tree:O}=E;return function(T){function A(){clearTimeout(i),S()}if(clearTimeout(i),!w.domReference||!w.floating||_==null||v==null||x==null)return;const{clientX:L,clientY:F}=T,K=[L,F],Q=Wr(T),X=T.type==="mouseleave",ee=hr(w.floating,Q),ne=hr(w.domReference,Q),W=w.domReference.getBoundingClientRect(),I=w.floating.getBoundingClientRect(),V=_.split("-")[0],j=v>I.right-I.width/2,B=x>I.bottom-I.height/2,U=XO(K,W),$=I.width>W.width,z=I.height>W.height,k=($?W:I).left,Y=($?W:I).right,re=(z?W:I).top,oe=(z?W:I).bottom;if(ee&&(a=!0,!X))return;if(ne&&(a=!1),ne&&!X){a=!0;return}if(X&&$e(T.relatedTarget)&&hr(w.floating,T.relatedTarget)||O&&Pl(O.nodesRef.current,N).some(he=>{let{context:ue}=he;return ue?.open}))return;if(V==="top"&&x>=W.bottom-1||V==="bottom"&&x<=W.top+1||V==="left"&&v>=W.right-1||V==="right"&&v<=W.left+1)return A();let le=[];switch(V){case"top":le=[[k,W.top+1],[k,I.bottom-1],[Y,I.bottom-1],[Y,W.top+1]];break;case"bottom":le=[[k,I.top+1],[k,W.bottom-1],[Y,W.bottom-1],[Y,I.top+1]];break;case"left":le=[[I.right-1,oe],[I.right-1,re],[W.left+1,re],[W.left+1,oe]];break;case"right":le=[[W.right-1,oe],[W.right-1,re],[I.left+1,re],[I.left+1,oe]];break}function de(he){let[ue,me]=he;switch(V){case"top":{const Re=[$?ue+t/2:j?ue+t*4:ue-t*4,me+t+1],Pe=[$?ue-t/2:j?ue+t*4:ue-t*4,me+t+1],Je=[[I.left,j||$?I.bottom-t:I.top],[I.right,j?$?I.bottom-t:I.top:I.bottom-t]];return[Re,Pe,...Je]}case"bottom":{const Re=[$?ue+t/2:j?ue+t*4:ue-t*4,me-t],Pe=[$?ue-t/2:j?ue+t*4:ue-t*4,me-t],Je=[[I.left,j||$?I.top+t:I.bottom],[I.right,j?$?I.top+t:I.bottom:I.top+t]];return[Re,Pe,...Je]}case"left":{const Re=[ue+t+1,z?me+t/2:B?me+t*4:me-t*4],Pe=[ue+t+1,z?me-t/2:B?me+t*4:me-t*4];return[...[[B||z?I.right-t:I.left,I.top],[B?z?I.right-t:I.left:I.right-t,I.bottom]],Re,Pe]}case"right":{const Re=[ue-t,z?me+t/2:B?me+t*4:me-t*4],Pe=[ue-t,z?me-t/2:B?me+t*4:me-t*4],Je=[[B||z?I.left+t:I.right,I.top],[B?z?I.left+t:I.right:I.left+t,I.bottom]];return[Re,Pe,...Je]}}}if(!Vg([L,F],le)){if(a&&!U)return A();if(!X&&s){const he=p(T.clientX,T.clientY);if(he!==null&&he<.1)return A()}Vg([L,F],de([v,x]))?!a&&s&&(i=window.setTimeout(A,40)):A()}}};return m.__options={blockPointerEvents:r},m}function qO({arrowPadding:e,escapeKey:t=!0,initialOpen:r=!1,keepOpenOverContent:s=!1,onOpenChange:i,open:a,outsidePress:c=!0,placement:u,role:f="tooltip"}){const p=ye(L=>L.rootElementId),m=b.useRef(null),[E,v]=b.useState(r),x=a??E,_=i??v,w=zO({middleware:[pO(8),dO({boundary:document.querySelector(`#${p}`)||void 0}),hO({padding:4}),LO({element:m,padding:e??{bottom:0,left:8,right:8,top:8}})],onOpenChange:_,open:x,placement:u,strategy:"fixed",whileElementsMounted:IO}),S=w.context,N=VO(S,{enabled:a==null,handleClose:s?QO():null,move:!1}),O=WO(S,{enabled:a==null}),D=BO(S,{escapeKey:t,outsidePress:c}),T=KO(S,{role:f}),A=GO([N,O,D,T]);return b.useMemo(()=>({arrowRef:m,open:x,setOpen:_,...A,...w}),[x,_,A,w])}const $g=te.createContext(null),$u=()=>{const e=te.useContext($g);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},ZO=({children:e,...t})=>{const r=qO(t);return h.jsx($g.Provider,{value:r,children:e})},JO={bottom:"-top-1 before:border-b-0 before:border-r-0",left:"-right-1 before:border-r-0 before:border-t-0",right:"-left-1 before:border-l-0 before:border-b-0",top:"-bottom-1 before:border-t-0 before:border-l-0"},eC=()=>{const e=$u(),[t,r]=b.useState(e.middlewareData.arrow);b.useEffect(()=>{e.middlewareData.arrow&&r(e.middlewareData.arrow)},[e.middlewareData.arrow]);const s={left:t?.x!=null?`${t?.x}px`:"",top:t?.y!=null?`${t?.y}px`:""},i=e.placement?.split("-")?.[0]||"top",a=`${JO[i]}`;return h.jsx("div",{ref:e.arrowRef,style:s,className:`tooltip-arrow absolute h-2 w-2 rotate-45 bg-inherit
62
62
  before:absolute before:h-2 before:w-2 before:border before:border-foreground/30 before:content-['']
63
- ${l}`})},tC=ne.forwardRef(function(t,n){const{children:s,style:i,...l}=t,c=$u(),u=Lg([c.refs.setFloating,n]);return c.open?h.jsxs("div",{className:"relative max-w-md rounded-md bg-foreground p-2 text-sm text-background shadow-sm",ref:u,style:{left:c.x??0,position:c.strategy,top:c.y??0,visibility:c.x==null?"hidden":"visible",zIndex:10,...i},...c.getFloatingProps(l),children:[h.jsx("div",{className:"overflow-hidden",children:s}),h.jsx(eC,{})]}):null}),nC=b.forwardRef(function({children:t,asChild:n=!1,...s},i){const l=$u(),c=Lg([l.refs.setReference,i,t==null?void 0:t.ref]);return n&&b.isValidElement(t)?b.cloneElement(t,l.getReferenceProps({ref:c,...s,...t.props,"data-state":l.open?"open":"closed"})):h.jsx("button",{ref:c,"data-state":l.open?"open":"closed",...l.getReferenceProps(s),children:t})}),Hg={bottom:"top",left:"right",right:"left",top:"bottom"},yr=({asChild:e=!0,children:t,enable:n=!0,placement:s="right",scale:i=1,trigger:l=h.jsx(Ce,{tag:"circle-info"}),...c})=>{let u=s.split("-")[0];return u=Object.keys(Hg).includes(u)?u:"right",n?h.jsxs(JO,{...c,placement:s,children:[h.jsx(nC,{asChild:e,children:l}),h.jsx(tC,{style:i!==1?{transform:`scale(${i})`,transformOrigin:Hg[u]}:void 0,children:t})]}):h.jsx(h.Fragment,{children:l})},rC={ABOUT:"About",ACTION:"Action",ADD_ADDRESS:"Add address",ADD_AI_AGENT:"Add AI agent",ADD_CONDITION:"Add condition",ADD_OPTION:"Add option",ADD_PHONE_NUMBER:"Add phone number",ADD_RESOURCE:"Add resource",ADD_SWML_SCRIPTS:"Add SWML Scripts",ADD_VARIABLE:"Add variable",ADDRESS_NUMBER:"Address {{index}}",AI_AGENT:"AI Agent",AI_AGENT_NAME:"AI Agent Name",ANSWER_CALL:"Answer Call",ARE_YOU_SURE:"Are you sure?",AUDIO_FILE:"Audio File",BEEP:"Beep",BEEP_SUBTITLE:"Play a beep before recording",BUSY:"Busy",CALL_ADDRESSES:"Call Addresses",CALL_NUMBERS:"Call Numbers",CALL_RESOURCES:"Call Resources",CALL_STATE_EVENTS:"Call State Events",CALL_STATE_URL:"Call State URL",CALLER_PRESSES:"Caller presses",CALLER_SAYS:"Caller says",CANCEL:"Cancel",CAUTION:"Caution",CHOOSE_OPTION_TTS_AUDIO:"Choose how to play the message",CLOSE:"Close",CONDITION_NUMBER:"Condition {{index}}",CONDITIONS:"Conditions",DECISION:"Decision",DECLINE:"Decline",DEFAULT_FROM:"Default From",DEFAULT_TIMEOUT:"Default Timeout",DELETE:"Delete",DELETE_NODE:"Delete node",DEPLOY:"Deploy",DEPLOY_WARNING:"Caution - Confirm Deploy",DEPRECATED:"Deprecated",DOCUMENT_OUT_OF_SYNC:"Document Out of Sync",EDIT_SELECTED_AI_AGENT:"Edit Selected AI Agent",ELSE:"Else",END_SILENCE_TIMEOUT:"End Silence Timeout",ENABLE_WHISPER:"Enable Whisper",ENTER_URL:"Enter URL",ERROR:"Error",ERROR_ADD_AI_AGENT_FIRST:"Please add an AI Agent first.",ERROR_ADD_RECORDING_FIRST:"Please add a Start Call Recording node first.",ERROR_DUPLICATE_COMMAND:"This command is already used. Please use a unique phrase.",ERROR_DUPLICATE_RECORDING_LABEL:"This entry already exists. Please use a unique label.",ERROR_DUPLICATE_TELEPHONE_KEY:"This key is already used. Please use a unique key.",ERROR_DUPLICATE_VARIABLE_KEY:"This variable already exists. Please use a unique key.",ERROR_FETCHING_AI_AGENTS:"Error fetching AI Agents.",ERROR_FETCHING_DEPLOYED_VERSIONS:"Error fetching deployed versions.",ERROR_FETCHING_SWML_SCRIPTS:"Error fetching SWML Scripts.",ERROR_INVALID_JSON:"Invalid JSON",ERROR_NUMBER_IS_REQUIRED:"A number is required.",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"A number between {{min}} and {{max}} is required.",ERROR_RECORDING_LABEL_REQUIRED:"A value is required. Maximum 20 characters.",ERROR_SELECTION_REQUIRED:"A selection is required.",ERROR_TELEPHONE_KEY_REQUIRED:"A value of 0-9, *, or # is required.",ERROR_TERMINATORS:"This value should contain only 0-9, *, or #.",ERROR_TEXT_IS_REQUIRED:"A text value is required.",ERROR_URL_IS_REQUIRED:"A valid URL is required.",ERROR_VALUE_IS_REQUIRED:"A value is required.",ERROR_VARIABLE_KEY_REQUIRED:"Valid characters are lowercase letters, digits, or underscore. Maximum 20 characters.",EXTERNAL_OPTION_LABEL:"Enter the URL of the external resource.",EXTERNAL_OR_INTERNAL_RESOURCE:"External or Internal Resource",EXTERNAL_URL:"External URL",EXECUTE_SWML:"Execute SWML",FAILED:"Failed",FAILURE:"Failure",FLOW_DATA_VERSION:"Flow Data Version",FORMAT:"Format",FORWARD:"Forward",FORWARD_TO_ADDRESS:"Forward to Address",FORWARD_TO_PHONE:"Forward to Phone",FORWARD_TO_RESOURCE:"Forward to Resource",FROM:"From",FROM_PHONE_NUMBER:"From Phone Number",GATHER_INPUT:"Gather Input",GENDER:"Gender",GO_BACK:"Go Back",HANDLE_VIA:"Handle Via",HANDLE_CALL:"Handle Call",HANG_UP:"Hang Up",HANG_UP_CALL:"Hang Up Call",HELP:"Help",HIDDEN:"Hidden",IGNORE:"Ignore",INFO_DEPLOY:"Deploy the latest changes for the current call flow.",INFO_INVALID_SETTINGS:"Please check the settings and ensure that all required fields are filled in correctly.",INFO_NODE_AI_AGENT:"<p>Used to connect to a conversational AI Agent for processing.</p><p>Choose the appropriate AI Agent or create a new one: <a>AI Agents</a></p>",INFO_NODE_COND:`<p>A condition works like a JavaScript <code>if</code> statement.</p><p>A condition field can reference variables that have been set in the flow with <code>%{Key}</code>, Request node responses accessed with <code>%{request_response['object_field']}</code>, or call parameters such as <code>%{call.from}</code>.</p><p>Add additional conditions to create <code>else if</code> conditions.</p><p>The "Cond #" path will be executed for a truthy condition. The "Else" path will be executed for a falsy condition.</p>`,INFO_NODE_CONDREQUEST:"<p>Send a GET, POST, PUT, or DELETE request to any webhook.</p><p>This can be used to submit variables and information about an inbound call to an external server, or you can retrieve information from external servers and use them as variables throughout the call flow. You can also build conditions directly into this module.</p><p>Response variables can be accessed with <code>%{request_response['object_field']}</code>.</p><p>Headers should be input in JSON format. Valid header values are <code>Accept</code>, <code>Authorization</code>, <code>Content-Type</code>, <code>Range</code>, and <code>custom X- headers</code>.</p>",INFO_NODE_EXECUTE_SWML:"Execute a remote SWML document and return to the current document. Use <code>%{return_value.['object_field']}</code> to reference the return values from the external SWML.",INFO_NODE_FORWARD_TO_ADDRESS:"Forwards the current call to the specified Address as defined within your SignalWire space.",INFO_NODE_FORWARD_TO_PHONE:"Forwards the current call to the specified phone number (must be E.164 format).",INFO_NODE_FORWARD_TO_RESOURCE:"Forwards the current call to the specified Resource as defined within your SignalWire space.",INFO_NODE_GATHER_INPUT:"Plays an audio file or Text to Speech phrase and waits for a keypress or spoken input from the caller, allowing them to proceed through the call flow based on their input.",INFO_NODE_HANG_UP:"Ends the call with the ability to provide a reason (hangup, busy, or decline).",INFO_NODE_PLAY:"Plays an audio file or Text to Speech phrase. A valid URL must be provided for the audio file to be played. Text to Speech will read aloud the provided text using the voice option that is selected.",INFO_NODE_RECORD:"Triggers foreground recording of both sides of the call and waits for the recording to end. Options can be set to enable stereo audio, play a notification beep before recording, set a digit to stop recording (terminator), and specify the recording name and format (WAV or MP3).",INFO_NODE_RECORD_CALL_START:"Triggers background recording of both sides of the call. Options can be set to enable stereo audio, play a notification beep before recording, set a digit to stop recording (terminator), and specify the recording name and format (WAV or MP3).",INFO_NODE_RECORD_CALL_STOP:"Triggers a background call recording to stop at a specific point in the call flow, if it has not already been terminated.",INFO_NODE_REQUEST:"<p>Send a GET, POST, PUT, or DELETE request to any webhook.</p><p>This can be used to submit variables and information about an inbound call to an external server, or you can retrieve information from external servers and use them as variables throughout the call flow. You can also build conditions directly into this module.</p><p>Response variables can be accessed with <code>%{request_response['object_field']}</code>.</p><p>Headers should be input in JSON format. Valid header values are <code>Accept</code>, <code>Authorization</code>, <code>Content-Type</code>, <code>Range</code>, and <code>custom X- headers</code>.</p>",INFO_NODE_SEND_SMS:"Sends an SMS message to the specified phone number. The 'From' phone number must be enabled for messaging (a 10DLC number assigned to an active TCR campaign or a verified toll free number).",INFO_NODE_SET_VARIABLES:`<p>Set variables that can be accessed from other node blocks in the call flow.</p><p>The value can be a static value <code>("value")</code>, a variable from another node such as a request response <code>%{request_response.['object_field']}</code>, or a call parameter <code>%{call.from}</code>.</p><p>Access these variables in other blocks with <code>%{Key}</code> and unset variables with the Unset Variables block.</p>`,INFO_NODE_UNSET_VARIABLES:"Unsets script variables.",INFO_STATUS_ERROR:"An error occurred while loading or saving the flow.",INFO_STATUS_ERROR_OUT_OF_SYNC:"This document is locked because another user has made updates to the Call Flow. Refresh the page to discard your changes and unlock the flow with the latest updates.",INITIAL_TIMEOUT:"Initial Timeout",INPUT:"Input",INVALID_SETTINGS:"Invalid settings",JSON_OBJECT:"JSON object to serialize",KEY:"Key",KEYPAD_VALUE:"Keypad value",LANGUAGE:"Language",MAXIMUM_RECORDING_LENGTH:"Maximum Recording Length",META:"Meta",METHOD:"Method",MORE_INFO_DEPLOY:"Deploying a Call Flow makes it live.",MORE_INFO_DEPLOY_ERROR:"There was an error deploying the Call Flow. Please try again. {{message}}",MORE_INFO_STATUS_ERROR:"More info on Flow document error",MORE_INFO_TESTING_YOUR_FLOW:"Info on testing your call flow",MORE_WITH_COUNT:"{{count}} more",NAVIGATE_BACK:"Navigate Back",NO_ANSWER:"No Answer",NO_DEPLOYED_VERSIONS:"<p>No deployed versions found.</p> <p>Deploy a flow to view the history.</p>",NO_INPUT:"No Input",NO_RESULTS:"No results",NO_SCRIPTS_FOUND:"No scripts found.",NO_VARIABLES_SET:"Please set variables first",NOT_CONNECTED_TO_FLOW:"Not connected to flow",NUMBER_OF_VALIDATION_WARNINGS_one:"There is {{count}} validation warning in your flow",NUMBER_OF_VALIDATION_WARNINGS_other:"There are {{count}} validation warnings in your flow",NUMBER_OF_VARIABLES_SELECTED_one:"{{count}} variable selected",NUMBER_OF_VARIABLES_SELECTED_other:"{{count}} variables selected",OFF:"Off",ON:"On",OPTION_NUMBER:"Option {{index}}",OPTIONAL:"optional",OR_CALLER_SAYS:"or says",OR_SAYS:"Or says",PARAMS:"Params",PHONE_NUMBER:"Phone Number",PHONE_NUMBER_NUMBER:"Phone Number {{index}}",PKG_VERSION:"Package Version",PLAY_AUDIO:"Play Audio",PLAY_AUDIO_FILE:"Play Audio File",PLAY_AUDIO_TTS:"Play Audio or TTS",PREVIEW_DEPLOYED_VERSION:"You are previewing this version.",REASON:"Reason",RECORD:"Record",RECORD_CALL_START:"Start Call Recording",RECORD_CALL_STOP:"Stop Call Recording",RECORDING:"Recording",RECORDING_NAME:"Recording Name",RECORDING_NAME_DEFAULT:"Recording {{index}}",REMOVE_ADDRESS:"Remove Address {{index}}",REMOVE_CONDITION:"Remove Condition {{index}}",REMOVE_EDGE:"Remove Edge",REMOVE_NODE:"Remove Node {{title}}",REMOVE_OPTION:"Remove Option {{index}}",REMOVE_PHONE_NUMBER:"Remove Phone Number {{index}}",REMOVE_RESOURCE:"Remove Resource {{index}}",REMOVE_VARIABLE:"Remove Variable {{index}}",REQUEST:"Request",REQUEST_BODY:"Body",REQUEST_HEADERS:"Headers (JSON)",RESOURCE_NUMBER:"Resource {{index}}",RESTORE:"Restore",RESTORE_THIS_VERSION:"Restore this version",RESYNC:"Resync",RESYNC_AI_AGENTS:"Resync AI Agents",SAVED:"Saved",SAVE_VARIABLES:"Save Variables",SAVE_VARIABLES_SUBTITLE:"Store the response as variables",SCRIPT_NOT_FOUND:"Selected script not found. A selection is required.",SEARCH_FOR_INTERNAL_SCRIPT:"Search for internal script",SECONDS:"Seconds",SELECT:"Select",SELECT_VARIABLES:"Select Variables",SELECT_VARIABLES_TO_UNSET:"Select Variables to Unset",SEND_SMS:"Send SMS",SEPARATE_WITH_COMMAS:"Separate with commas",SEQUENTIALLY:"Sequentially",SET_VARIABLES:"Set Variables",SIMULTANEOUSLY:"Simultaneously",SMS_TEXT:"SMS Text",SPOKEN_PROMPT:"Spoken prompt",STATUS_DEPLOY:"Deploy",STATUS_DEPLOY_ERROR:"Deploy Error",STATUS_DEPLOYED:"Deployed",STATUS_DEPLOYING:"Deploying...",STATUS_ERROR:"Error",STATUS_LOADING:"Loading...",STATUS_LOCKED:"Locked",STATUS_SAVED:"Saved",STATUS_SAVING:"Saving...",STEREO:"Stereo",STEREO_SUBTITLE:"Enable stereo audio",STRING_OR_JSON:"String or JSON to serialize",SUCCESS:"Success",SWML_TO_EXECUTE:"SWML to execute on answer",TERMINATORS:"Terminators",TEXT:"Text",TEXT_TO_SPEECH:"Text to Speech",TIMEOUT:"Timeout",TO:"To",TO_PHONE_NUMBER:"To Phone Number",TOAST_DEPLOY_WARNING:'<p>There are inconsistencies in your Call Flow which may cause unexpected behavior. Please review the Call Flow before deploying.</p><p>Choose "Deploy" to deploy the Call Flow or "Cancel" to return to editing.</p>',TOAST_DOCUMENT_OUT_OF_SYNC:'<p>Updates have been made to this Call Flow by another user and your recent changes have not been saved.</p><p>Choose "Ignore" to view your changes in a locked state or "Resync" to abandon your changes and adopt the latest updates.</p>',TOGGLE_CLOSE:"Toggle close",TOGGLE_OPEN:"Toggle open",UNKNOWN:"Unknown",UNSET_VARIABLES:"Unset Variables",URL:"URL",VALUE:"Value",VARIABLE_KEY:"Variable {{key}}",VARIABLE_NUMBER:"Variable {{index}}",VERSION_HISTORY:"Version History",VERSION_LIST_ITEM:"Version {{number}}",VERSION_RESTORED:"Version restored",VOICE:"Voice",VOICEMAIL_RECORDING:"Voicemail Recording",WAIT_FOR_DIGIT:"Wait for Digit",WAIT_FOR_INPUT:"Wait for Input",WARNING:"Warning",WRITE_SOMETHING:"Write something"},O={ABOUT:"ABOUT",ACTION:"ACTION",ADDRESS_NUMBER:"ADDRESS_NUMBER",ADD_ADDRESS:"ADD_ADDRESS",ADD_AI_AGENT:"ADD_AI_AGENT",ADD_CONDITION:"ADD_CONDITION",ADD_OPTION:"ADD_OPTION",ADD_PHONE_NUMBER:"ADD_PHONE_NUMBER",ADD_RESOURCE:"ADD_RESOURCE",ADD_SWML_SCRIPTS:"ADD_SWML_SCRIPTS",ADD_VARIABLE:"ADD_VARIABLE",AI_AGENT:"AI_AGENT",AI_AGENT_NAME:"AI_AGENT_NAME",ANSWER_CALL:"ANSWER_CALL",ARE_YOU_SURE:"ARE_YOU_SURE",AUDIO_FILE:"AUDIO_FILE",BEEP:"BEEP",BEEP_SUBTITLE:"BEEP_SUBTITLE",BUSY:"BUSY",CALLER_PRESSES:"CALLER_PRESSES",CALLER_SAYS:"CALLER_SAYS",CALL_ADDRESSES:"CALL_ADDRESSES",CALL_NUMBERS:"CALL_NUMBERS",CALL_RESOURCES:"CALL_RESOURCES",CALL_STATE_EVENTS:"CALL_STATE_EVENTS",CALL_STATE_URL:"CALL_STATE_URL",CANCEL:"CANCEL",CAUTION:"CAUTION",CHOOSE_OPTION_TTS_AUDIO:"CHOOSE_OPTION_TTS_AUDIO",CLOSE:"CLOSE",CONDITIONS:"CONDITIONS",CONDITION_NUMBER:"CONDITION_NUMBER",DECISION:"DECISION",DECLINE:"DECLINE",DEFAULT_FROM:"DEFAULT_FROM",DEFAULT_TIMEOUT:"DEFAULT_TIMEOUT",DELETE:"DELETE",DELETE_NODE:"DELETE_NODE",DEPLOY:"DEPLOY",DEPLOY_WARNING:"DEPLOY_WARNING",DEPRECATED:"DEPRECATED",DOCUMENT_OUT_OF_SYNC:"DOCUMENT_OUT_OF_SYNC",EDIT_SELECTED_AI_AGENT:"EDIT_SELECTED_AI_AGENT",ELSE:"ELSE",ENABLE_WHISPER:"ENABLE_WHISPER",END_SILENCE_TIMEOUT:"END_SILENCE_TIMEOUT",ENTER_URL:"ENTER_URL",ERROR:"ERROR",ERROR_ADD_AI_AGENT_FIRST:"ERROR_ADD_AI_AGENT_FIRST",ERROR_ADD_RECORDING_FIRST:"ERROR_ADD_RECORDING_FIRST",ERROR_DUPLICATE_COMMAND:"ERROR_DUPLICATE_COMMAND",ERROR_DUPLICATE_RECORDING_LABEL:"ERROR_DUPLICATE_RECORDING_LABEL",ERROR_DUPLICATE_TELEPHONE_KEY:"ERROR_DUPLICATE_TELEPHONE_KEY",ERROR_DUPLICATE_VARIABLE_KEY:"ERROR_DUPLICATE_VARIABLE_KEY",ERROR_FETCHING_AI_AGENTS:"ERROR_FETCHING_AI_AGENTS",ERROR_FETCHING_DEPLOYED_VERSIONS:"ERROR_FETCHING_DEPLOYED_VERSIONS",ERROR_FETCHING_SWML_SCRIPTS:"ERROR_FETCHING_SWML_SCRIPTS",ERROR_INVALID_JSON:"ERROR_INVALID_JSON",ERROR_NUMBER_IS_REQUIRED:"ERROR_NUMBER_IS_REQUIRED",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"ERROR_NUMBER_MIN_MAX_IS_REQUIRED",ERROR_RECORDING_LABEL_REQUIRED:"ERROR_RECORDING_LABEL_REQUIRED",ERROR_SELECTION_REQUIRED:"ERROR_SELECTION_REQUIRED",ERROR_TELEPHONE_KEY_REQUIRED:"ERROR_TELEPHONE_KEY_REQUIRED",ERROR_TERMINATORS:"ERROR_TERMINATORS",ERROR_TEXT_IS_REQUIRED:"ERROR_TEXT_IS_REQUIRED",ERROR_URL_IS_REQUIRED:"ERROR_URL_IS_REQUIRED",ERROR_VALUE_IS_REQUIRED:"ERROR_VALUE_IS_REQUIRED",ERROR_VARIABLE_KEY_REQUIRED:"ERROR_VARIABLE_KEY_REQUIRED",EXECUTE_SWML:"EXECUTE_SWML",EXTERNAL_OPTION_LABEL:"EXTERNAL_OPTION_LABEL",EXTERNAL_OR_INTERNAL_RESOURCE:"EXTERNAL_OR_INTERNAL_RESOURCE",EXTERNAL_URL:"EXTERNAL_URL",FAILED:"FAILED",FAILURE:"FAILURE",FLOW_DATA_VERSION:"FLOW_DATA_VERSION",FORMAT:"FORMAT",FORWARD:"FORWARD",FORWARD_TO_ADDRESS:"FORWARD_TO_ADDRESS",FORWARD_TO_PHONE:"FORWARD_TO_PHONE",FORWARD_TO_RESOURCE:"FORWARD_TO_RESOURCE",FROM:"FROM",FROM_PHONE_NUMBER:"FROM_PHONE_NUMBER",GATHER_INPUT:"GATHER_INPUT",GENDER:"GENDER",GO_BACK:"GO_BACK",HANDLE_CALL:"HANDLE_CALL",HANDLE_VIA:"HANDLE_VIA",HANG_UP:"HANG_UP",HANG_UP_CALL:"HANG_UP_CALL",HELP:"HELP",HIDDEN:"HIDDEN",IGNORE:"IGNORE",INFO_INVALID_SETTINGS:"INFO_INVALID_SETTINGS",INFO_NODE_AI_AGENT:"INFO_NODE_AI_AGENT",INFO_NODE_COND:"INFO_NODE_COND",INFO_NODE_CONDREQUEST:"INFO_NODE_CONDREQUEST",INFO_NODE_EXECUTE_SWML:"INFO_NODE_EXECUTE_SWML",INFO_NODE_FORWARD_TO_ADDRESS:"INFO_NODE_FORWARD_TO_ADDRESS",INFO_NODE_FORWARD_TO_PHONE:"INFO_NODE_FORWARD_TO_PHONE",INFO_NODE_FORWARD_TO_RESOURCE:"INFO_NODE_FORWARD_TO_RESOURCE",INFO_NODE_GATHER_INPUT:"INFO_NODE_GATHER_INPUT",INFO_NODE_HANG_UP:"INFO_NODE_HANG_UP",INFO_NODE_PLAY:"INFO_NODE_PLAY",INFO_NODE_RECORD:"INFO_NODE_RECORD",INFO_NODE_RECORD_CALL_START:"INFO_NODE_RECORD_CALL_START",INFO_NODE_RECORD_CALL_STOP:"INFO_NODE_RECORD_CALL_STOP",INFO_NODE_REQUEST:"INFO_NODE_REQUEST",INFO_NODE_SEND_SMS:"INFO_NODE_SEND_SMS",INFO_NODE_SET_VARIABLES:"INFO_NODE_SET_VARIABLES",INFO_NODE_UNSET_VARIABLES:"INFO_NODE_UNSET_VARIABLES",INFO_STATUS_ERROR:"INFO_STATUS_ERROR",INFO_STATUS_ERROR_OUT_OF_SYNC:"INFO_STATUS_ERROR_OUT_OF_SYNC",INITIAL_TIMEOUT:"INITIAL_TIMEOUT",INPUT:"INPUT",INVALID_SETTINGS:"INVALID_SETTINGS",JSON_OBJECT:"JSON_OBJECT",KEY:"KEY",KEYPAD_VALUE:"KEYPAD_VALUE",LANGUAGE:"LANGUAGE",MAXIMUM_RECORDING_LENGTH:"MAXIMUM_RECORDING_LENGTH",META:"META",METHOD:"METHOD",MORE_INFO_DEPLOY:"MORE_INFO_DEPLOY",MORE_INFO_DEPLOY_ERROR:"MORE_INFO_DEPLOY_ERROR",MORE_INFO_STATUS_ERROR:"MORE_INFO_STATUS_ERROR",MORE_INFO_TESTING_YOUR_FLOW:"MORE_INFO_TESTING_YOUR_FLOW",MORE_WITH_COUNT:"MORE_WITH_COUNT",NAVIGATE_BACK:"NAVIGATE_BACK",NOT_CONNECTED_TO_FLOW:"NOT_CONNECTED_TO_FLOW",NO_ANSWER:"NO_ANSWER",NO_DEPLOYED_VERSIONS:"NO_DEPLOYED_VERSIONS",NO_INPUT:"NO_INPUT",NO_RESULTS:"NO_RESULTS",NO_SCRIPTS_FOUND:"NO_SCRIPTS_FOUND",NO_VARIABLES_SET:"NO_VARIABLES_SET",NUMBER_OF_VALIDATION_WARNINGS:"NUMBER_OF_VALIDATION_WARNINGS",NUMBER_OF_VARIABLES_SELECTED:"NUMBER_OF_VARIABLES_SELECTED",OFF:"OFF",ON:"ON",OPTIONAL:"OPTIONAL",OPTION_NUMBER:"OPTION_NUMBER",OR_CALLER_SAYS:"OR_CALLER_SAYS",OR_SAYS:"OR_SAYS",PARAMS:"PARAMS",PHONE_NUMBER_NUMBER:"PHONE_NUMBER_NUMBER",PKG_VERSION:"PKG_VERSION",PLAY_AUDIO:"PLAY_AUDIO",PLAY_AUDIO_FILE:"PLAY_AUDIO_FILE",PLAY_AUDIO_TTS:"PLAY_AUDIO_TTS",PREVIEW_DEPLOYED_VERSION:"PREVIEW_DEPLOYED_VERSION",REASON:"REASON",RECORD:"RECORD",RECORDING_NAME:"RECORDING_NAME",RECORDING_NAME_DEFAULT:"RECORDING_NAME_DEFAULT",RECORD_CALL_START:"RECORD_CALL_START",RECORD_CALL_STOP:"RECORD_CALL_STOP",REMOVE_ADDRESS:"REMOVE_ADDRESS",REMOVE_CONDITION:"REMOVE_CONDITION",REMOVE_EDGE:"REMOVE_EDGE",REMOVE_NODE:"REMOVE_NODE",REMOVE_OPTION:"REMOVE_OPTION",REMOVE_PHONE_NUMBER:"REMOVE_PHONE_NUMBER",REMOVE_RESOURCE:"REMOVE_RESOURCE",REMOVE_VARIABLE:"REMOVE_VARIABLE",REQUEST:"REQUEST",REQUEST_BODY:"REQUEST_BODY",REQUEST_HEADERS:"REQUEST_HEADERS",RESOURCE_NUMBER:"RESOURCE_NUMBER",RESTORE:"RESTORE",RESTORE_THIS_VERSION:"RESTORE_THIS_VERSION",RESYNC:"RESYNC",RESYNC_AI_AGENTS:"RESYNC_AI_AGENTS",SAVED:"SAVED",SAVE_VARIABLES:"SAVE_VARIABLES",SAVE_VARIABLES_SUBTITLE:"SAVE_VARIABLES_SUBTITLE",SCRIPT_NOT_FOUND:"SCRIPT_NOT_FOUND",SEARCH_FOR_INTERNAL_SCRIPT:"SEARCH_FOR_INTERNAL_SCRIPT",SECONDS:"SECONDS",SELECT:"SELECT",SELECT_VARIABLES:"SELECT_VARIABLES",SELECT_VARIABLES_TO_UNSET:"SELECT_VARIABLES_TO_UNSET",SEND_SMS:"SEND_SMS",SEPARATE_WITH_COMMAS:"SEPARATE_WITH_COMMAS",SEQUENTIALLY:"SEQUENTIALLY",SET_VARIABLES:"SET_VARIABLES",SIMULTANEOUSLY:"SIMULTANEOUSLY",SMS_TEXT:"SMS_TEXT",SPOKEN_PROMPT:"SPOKEN_PROMPT",STATUS_DEPLOY:"STATUS_DEPLOY",STATUS_DEPLOYED:"STATUS_DEPLOYED",STATUS_DEPLOYING:"STATUS_DEPLOYING",STATUS_DEPLOY_ERROR:"STATUS_DEPLOY_ERROR",STATUS_ERROR:"STATUS_ERROR",STATUS_LOADING:"STATUS_LOADING",STATUS_LOCKED:"STATUS_LOCKED",STATUS_SAVED:"STATUS_SAVED",STATUS_SAVING:"STATUS_SAVING",STEREO:"STEREO",STEREO_SUBTITLE:"STEREO_SUBTITLE",STRING_OR_JSON:"STRING_OR_JSON",SUCCESS:"SUCCESS",SWML_TO_EXECUTE:"SWML_TO_EXECUTE",TERMINATORS:"TERMINATORS",TEXT:"TEXT",TEXT_TO_SPEECH:"TEXT_TO_SPEECH",TIMEOUT:"TIMEOUT",TO:"TO",TOAST_DEPLOY_WARNING:"TOAST_DEPLOY_WARNING",TOAST_DOCUMENT_OUT_OF_SYNC:"TOAST_DOCUMENT_OUT_OF_SYNC",TOGGLE_CLOSE:"TOGGLE_CLOSE",TOGGLE_OPEN:"TOGGLE_OPEN",TO_PHONE_NUMBER:"TO_PHONE_NUMBER",UNKNOWN:"UNKNOWN",UNSET_VARIABLES:"UNSET_VARIABLES",URL:"URL",VALUE:"VALUE",VARIABLE_NUMBER:"VARIABLE_NUMBER",VERSION_HISTORY:"VERSION_HISTORY",VERSION_LIST_ITEM:"VERSION_LIST_ITEM",VERSION_RESTORED:"VERSION_RESTORED",VOICE:"VOICE",VOICEMAIL_RECORDING:"VOICEMAIL_RECORDING",WAIT_FOR_DIGIT:"WAIT_FOR_DIGIT",WAIT_FOR_INPUT:"WAIT_FOR_INPUT",WARNING:"WARNING",WRITE_SOMETHING:"WRITE_SOMETHING"},oC={order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag","path","subdomain"],lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupQuerystring:"lng",lookupSessionStorage:"i18nextLng",caches:["localStorage","cookie"],excludeCacheFor:["cimode"]},sC={"en-US":{translation:rC}},iC=async()=>{await ut.use(tg).use(dT).init({debug:WR,detection:oC,fallbackLng:"en-US",interpolation:{escapeValue:!1},keySeparator:!1,resources:sC})};function Ul(e,t){return h.jsx(BT,{label:e,vars:t})}const Bg=()=>ut.resolvedLanguage,lC={entries:[],nextLabelIndex:0},zo=Do((e,t)=>({...lC,actions:{getEntries(){return t().entries},getEntryValue(n){var s;return(s=t().entries.find(i=>i.controlId===n))==null?void 0:s.label},getGeneratedLabel(){let n="",s=t().nextLabelIndex;do s++,n=k(O.RECORDING_NAME_DEFAULT,{index:s});while(this.isValueDuplicate(n));return e({nextLabelIndex:s}),n},isKeyDuplicate(n){return t().entries.some(s=>s.controlId===n)},isValueDuplicate(n,s){const i=n.trim();return!!t().entries.reduce((c,u)=>{const{label:f,controlId:p}=u;return f!==""&&f===i&&(!s||p!==s)?[...c,u]:c},[]).length},removeEntry(n){e(s=>({entries:s.entries.filter(i=>i.controlId!==n)}))},upsertEntry:n=>{const{actions:s}=t(),{isKeyDuplicate:i}=s;e(l=>{let c=[...l.entries];const u=n.label.trim(),f=!!u;return(i(n.controlId)||!f)&&(c=c.filter(p=>p.controlId!==n.controlId)),f&&c.push({...n,label:u}),{entries:c}})}}})),Hu=()=>zo.getState().actions,zg=e=>{const t=[];e.forEach(n=>{n.type==="recordCallStart"&&n.data.controlId&&n.data.label&&t.push({controlId:n.data.controlId,label:n.data.label})}),zo.setState({entries:t,nextLabelIndex:t.length})},aC=(e,t)=>{const n=[];return t.forEach(s=>{s.type==="recordCallStart"&&s.data.controlId&&(n.push(s.data.controlId),zo.getState().actions.removeEntry(s.data.controlId))}),n.length?e.reduce((s,i)=>i.type==="recordCallStop"&&n.includes(i.data.controlId)?[...s,{...i,data:{...i.data,controlId:""}}]:s,[]):[]},Wg={recordCallStart:e=>{const t=zo.getState().actions.getGeneratedLabel();return zo.getState().actions.upsertEntry({controlId:e.data.controlId,label:t}),{...e,data:{...e.data,label:t}}}},cC=e=>typeof e=="object"&&e!==null&&Object.keys(e).length>0,uC=e=>Wg[e.type]!==void 0,Gg=(e,t={})=>{const{deletable:n=!0,position:s={x:300,y:250},selected:i=!0}=t,l=()=>({data:{initial:!0,valid:!1},deletable:n,id:Le(),position:s,selected:i,type:e}),c=(p,m)=>({...p,data:{...p.data,...m}});let u=l();const f=Um[e]();return cC(f)&&(u=c(u,f)),uC(u)&&(u=Wg[u.type](u)),u},Fl={action:{label:O.ACTION,nodes:{answer:{active:!0,label:O.ANSWER_CALL},hangup:{active:!0,infoLabel:O.INFO_NODE_HANG_UP,label:O.HANG_UP_CALL},play:{active:!0,infoLabel:O.INFO_NODE_PLAY,label:O.PLAY_AUDIO_TTS},sendSms:{active:!0,infoLabel:O.INFO_NODE_SEND_SMS,label:O.SEND_SMS}}},decision:{label:O.DECISION,nodes:{cond:{active:!0,infoLabel:O.INFO_NODE_COND,label:O.CONDITIONS},executeSWML:{active:!0,infoLabel:O.INFO_NODE_EXECUTE_SWML,label:O.EXECUTE_SWML},set:{active:!0,infoLabel:O.INFO_NODE_SET_VARIABLES,label:O.SET_VARIABLES},unset:{active:!0,infoLabel:O.INFO_NODE_UNSET_VARIABLES,label:O.UNSET_VARIABLES}}},forwardTo:{label:O.FORWARD,nodes:{forwardAddress:{active:!1,infoLabel:O.INFO_NODE_FORWARD_TO_ADDRESS,label:O.FORWARD_TO_ADDRESS},forwardPhone:{active:!0,infoLabel:O.INFO_NODE_FORWARD_TO_PHONE,label:O.FORWARD_TO_PHONE},forwardResource:{active:!1,infoLabel:O.INFO_NODE_FORWARD_TO_RESOURCE,label:O.FORWARD_TO_RESOURCE}}},hidden:{label:O.HIDDEN,nodes:{handleCall:{active:!0,label:O.HANDLE_CALL}}},input:{label:O.INPUT,nodes:{aiAgent:{active:!0,infoLabel:O.INFO_NODE_AI_AGENT,label:O.AI_AGENT},condRequest:{active:!0,infoLabel:O.INFO_NODE_CONDREQUEST,label:O.REQUEST},promptPlay:{active:!0,infoLabel:O.INFO_NODE_GATHER_INPUT,label:O.GATHER_INPUT},request:{active:!1,deprecated:!0,infoLabel:O.INFO_NODE_REQUEST,label:O.REQUEST}}},recording:{label:O.RECORD,nodes:{record:{active:!0,infoLabel:O.INFO_NODE_RECORD,label:O.VOICEMAIL_RECORDING},recordCallStart:{active:!0,infoLabel:O.INFO_NODE_RECORD_CALL_START,label:O.RECORD_CALL_START},recordCallStop:{active:!0,infoLabel:O.INFO_NODE_RECORD_CALL_STOP,label:O.RECORD_CALL_STOP}}}},dC=Object.entries(Fl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([n,{label:s}])=>{e.set(n,s)}),e),new Map),fC=Object.entries(Fl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([n,{infoLabel:s}])=>{e.set(n,s)}),e),new Map),Vl=Qe(),pC={aiAgentMap:new Map,error:"",status:"initial"},hC=(e,t)=>({...pC,actions:{fetchAiAgents:async()=>{try{const{actions:n}=t(),{getAiAgents:s}=n;if(!s){Vl.error("getAiAgents is not defined");return}e({status:"loading"});const i=await s(),l=km(i.data,"asc","display_name"),c=new Map(l.map(u=>[u.id,u]));e({aiAgentMap:c,error:"",status:"loaded"})}catch(n){let s="Unknown error";Vl.error("Error fetching aiAgents ",n),n instanceof Error&&(s=n.message),e({aiAgentMap:new Map,error:s,status:"error"})}},init:({getAiAgentsURL:n})=>{if(!n){Vl.error("getAiAgentsURL is not defined");return}const s=gc({getAiAgentsURL:n,headers:yu()}),i=async()=>await s.getAiAgents();e(l=>({...l,actions:{...l.actions,getAiAgents:i}}))}}}),Yg=(e,t)=>{if(e.find(s=>s.type==="aiAgent")){const{fetchAiAgents:s}=On.getState().actions;s().then(()=>{const{aiAgentMap:i,status:l}=On.getState();l==="loaded"&&e.forEach(c=>{if(c.data&&"agent"in c.data){const u=i.has(c.data.agent);u||t(c.id,{agent:u?c.data.agent:"",valid:u})}})}).catch(i=>Vl.error("Error rehydrating AiAgentStore",i))}},On=Do()(hC),mC=()=>On.getState().actions;window.__useAiAgentStore=On;const gC=e=>!!(e&&e>=KR),yC=e=>(t,n,s)=>(s.setState=(i,l,...c)=>{const{edges:u,detachedMode:f,httpError:p,initializing:m,isCanvasInteractive:y,isInteractiveControlOn:E,nodes:x,rootAppWidth:_,viewportChanging:w}=n(),S=typeof i=="function"?i(n()):i,N=["detachedMode","httpError","initializing","isInteractiveControlOn","rootAppWidth","viewportChanging"],R="initializing"in S?S.initializing:m;if(N.some(P=>P in S)){const P=gC("rootAppWidth"in S?S.rootAppWidth:_),C="isInteractiveControlOn"in S?S.isInteractiveControlOn:E,I="detachedMode"in S?S.detachedMode:f,L=("httpError"in S?S.httpError:p)===Am,U="viewportChanging"in S?S.viewportChanging:w;if(S.isCanvasInteractive=!!(P&&C&&!I&&!R&&!L&&!U),S.showInteractiveControl=P&&!L&&!I,y&&!S.isCanvasInteractive){const G="nodes"in S?S.nodes:x;S.nodes=G.map(H=>({...H,selected:!1}));const X="edges"in S?S.edges:u;S.edges=X.map(H=>({...H,selected:!1})),S.selectedNode=void 0}}t(S,l,...c)},e(s.setState,n,s)),Kg=1e3,Zs=Qe(),EC=e=>(t,n,s)=>{let i,l;const c=async()=>{const{httpService:u,nodes:f,edges:p,documentVersion:m}=n();t({dataHandlingStatus:"saving",saveFlowStatus:"saving"}),clearTimeout(l);try{if(!u)throw new Error("Missing httpService");const y=await u.putFlow({documentVersion:m,edges:p,flowDataVersion:Hs,nodes:f}),E={documentLastUpdated:y.updated_at,documentVersion:y.document_version},x=n().dataHandlingStatus;switch(x){case"saving":t({...E,dataHandlingStatus:"queueing",deployFlowStatus:"deploy",saveFlowStatus:"saved"});break;case"holding":t({...E,saveFlowStatus:"awaiting-save"}),Zs.debug("Setting up a new save for held changes"),l=setTimeout(()=>{c().catch(_=>{Zs.error("Error Save Flow",_)})},Kg);break;default:Zs.debug("Invalid dataHandlingStatus",x)}}catch(y){Zs.error("Put Flow",y),y instanceof Error&&y.message.includes(XR)?t({dataHandlingStatus:"holding",httpError:"document-sync",saveFlowStatus:"error"}):t({dataHandlingStatus:"queueing",saveFlowStatus:"error"})}};return s.setState=(u,f,...p)=>{const{dataHandlingStatus:m,detachedMode:y,initializing:E,saveFlowStatus:x}=n(),_=typeof u=="function"?u(n()):u,w="initializing"in _?_.initializing:E,S="detachedMode"in _?_.detachedMode:y;!w&&!S&&(_.nodes||_.edges)?m==="queueing"?(_.saveFlowStatus="awaiting-save",t(_,f,...p),clearTimeout(i),i=setTimeout(()=>{c().catch(R=>{Zs.error("Error Save Flow",R)})},Kg)):(_.dataHandlingStatus="holding",t(_,f,...p)):"initializing"in _&&!_.initializing?(_.dataHandlingStatus="queueing",x!=="error"&&(_.saveFlowStatus="saved"),t(_,f,...p)):t(_,f,...p)},e(s.setState,n,s)},$l=Qe(),vC={cachedResults:new Map,error:"",results:[],status:"initial",swmlScriptMap:new Map},xC={ids:"ids",name:"name"},SC=(e,t)=>({...vC,actions:{buildParamsFromQuery:n=>{const{searchParams:s}=new URL(n,window.location.href);return l1(xC).reduce((l,c)=>{const u=s.get(c);return u&&(c==="ids"?l[c]=u.split(","):l[c]=u),l},{})},buildQueryFromParams:n=>{const s=hc(window.location.origin,{...n}),{search:i}=new URL(s);return`/${i}`},fetchSwmlScript:async n=>{try{const{actions:s}=t(),{getSwmlScripts:i,updateMapAndCache:l}=s;if(!i){$l.error("getSwmlScripts is not defined");return}e({status:"loading"});const c=await i(n),u=km(c.data,"asc","display_name"),f=new Map(u.map(p=>[p.id,{displayName:p.display_name,id:p.id,requestUrl:p.request_url}]));l(f,n),e({error:"",results:Array.from(f.values()),status:"loaded"})}catch(s){let i="Unknown error";$l.error("Error fetching swmlScripts ",s),s instanceof Error&&(i=s.message),e({error:i,status:"error"})}},getCachedResults:n=>{const{cachedResults:s,swmlScriptMap:i}=t(),l=s.get(n);if(l)return l.reduce((c,u)=>{const f=i.get(u);return f&&c.push(f),c},[])},init:({getSwmlScriptsURL:n})=>{if(!n){$l.error("getSwmlScriptsURL is not defined");return}const s=gc({getSwmlScriptsURL:n,headers:yu()}),i=async l=>await s.getSwmlScripts(l);e(l=>({...l,actions:{...l.actions,getSwmlScripts:i}}))},setResults:n=>{e({results:n})},updateConnection:(n,s)=>{if(n.connectConfirmId!=="external"){const i=s.get(n.connectConfirmId),l={...n};if(i&&i.displayName!==n.connectConfirmDisplayName)return l.connectConfirmDisplayName=i.displayName,l;if(!i)return l.connectConfirmId="",l.connectConfirmUrl="",l}},updateMapAndCache:(n,s)=>{const{actions:i,cachedResults:l,swmlScriptMap:c}=t(),{buildQueryFromParams:u}=i,f=s==null?void 0:s.ids,p=u(s),m=l.get(p),y=(m==null?void 0:m.filter(w=>n.has(w)))??[],E=(f==null?void 0:f.filter(w=>!n.has(w)))??[],x=[...new Set([...E,...y])];x.length>0&&(Array.from(l.entries()).forEach(([S,N])=>{if(S===s){const R=N.filter(P=>!x.includes(P));l.set(S,R)}}),x.forEach(S=>{c.delete(S)})),n.forEach((w,S)=>{c.set(S,w)});const _=Array.from(n.keys());l.set(p,_),e({cachedResults:new Map(l),swmlScriptMap:new Map(c)})},validateCache:(()=>{let n;return()=>{n&&clearTimeout(n),n=setTimeout(async()=>{const{actions:i,swmlScriptMap:l}=t(),{fetchSwmlScript:c}=i,u=Array.from(l.keys());u.length>0&&c&&await c({ids:u})},Im)}})(),validateScriptsFromNodes:(n,s)=>{const{actions:i}=t(),{fetchSwmlScript:l}=i,c=new Set,u=n.filter(p=>Xg(p)&&"connections"in p.data&&p.data.connections.some(m=>m.connectConfirmEnabled));if(u.length===0)return;const f=(p,m)=>u.forEach(y=>{const E=y.data.connections.map(x=>p(x)??x);typeof m=="function"&&m(E,y)});f(p=>{p.connectConfirmId!==""&&p.connectConfirmId!=="external"&&p.connectConfirmEnabled&&c.add(p.connectConfirmId)}),c.size!==0&&l({ids:Array.from(c.values())}).then(()=>{const{actions:p,swmlScriptMap:m,status:y}=zn.getState(),{updateConnection:E}=p;y==="loaded"&&f(x=>{const _=E(x,m);return _||x},(x,_)=>{s(_.id,{connections:x})})}).catch(p=>$l.error("Error rehydrating SwmlScriptStore",p))}}}),Xg=e=>e.type==="forwardAddress"||e.type==="forwardPhone"||e.type==="forwardResource",_C=(e,t)=>{if(e.some(Xg)){const{validateScriptsFromNodes:s}=zn.getState().actions;s(e,t)}},zn=Do()(SC),Qg=()=>zn.getState().actions;window.__useSwmlScriptStore=zn;const qg=500,wC=100,qe=Qe(),NC=Gg("handleCall",{deletable:!1,position:{x:300,y:100}}),Bu={backButtonHref:void 0,colorMode:"light",dataHandlingStatus:"queueing",deployFlowStatus:"deploy",deployFlowURL:"",deployedVersionsList:[],detachedMode:!1,documentLastUpdated:void 0,documentVersion:0,dragNodeType:void 0,edges:[],flowId:"",flowTitle:"",flowWrapperElement:void 0,getFlowURL:"",httpError:void 0,httpService:void 0,initializing:!0,isCanvasInteractive:!1,isDraggingNode:!1,isEdgeConnecting:!1,isEdgeUpdateSuccessful:!1,isInteractiveControlOn:!0,nodes:[],reactFlowInstance:void 0,rootAppHeight:void 0,rootAppWidth:void 0,rootElement:void 0,rootElementId:"",saveFlowStatus:"initial",selectedNode:void 0,showDeployWarning:!1,showDeployedHistory:!1,showDeployedHistoryToast:!1,showInteractiveControl:!0,showValidationWarnings:!1,toastsMap:new Map,updateFlowURL:"",updatingSourceHandleId:void 0,validationWarnings:new Map,viewport:{x:0,y:0,zoom:1},viewportChanging:!1,workingFlowCopy:void 0},RC=(e,t)=>({...Bu,actions:{addNode:({nodeType:n,x:s=150,y:i=150})=>{qe.debug("Add Node",n);const{nodes:l,reactFlowInstance:c}=t();if(!c)throw new Error("ReactFlowInstance not found");const u=Gg(n,{position:c.project({x:s,y:i})}),f=l.map(p=>({...p,selected:!1}));f.push(u),e({nodes:f,selectedNode:u})},addToast:n=>{const{toastsMap:s}=t(),i=Le();s.set(i,{...n,id:i}),e({toastsMap:new Map(s)})},cancelDetachedMode:async()=>{const{actions:n,workingFlowCopy:s}=t(),{cleanUpDetachedMode:i}=n;if(s){const{edges:l,nodes:c,saveFlowStatus:u}=s;e({edges:[],initializing:!0,nodes:[]}),await Mm(qg),e({edges:l,nodes:c,saveFlowStatus:u})}else qe.error("There was no working flow to restore");i()},cleanUpDetachedMode:()=>{e({detachedMode:!1,showDeployedHistory:!1,showDeployedHistoryToast:!1,workingFlowCopy:void 0})},deleteToast:n=>{const{toastsMap:s}=t();s.delete(n)&&e({toastsMap:new Map(s)})},deleteValidationWarning:n=>{const{validationWarnings:s}=t();s.delete(n)&&e({validationWarnings:new Map(s)})},deployFlow:async()=>{qe.info("Deploying..."),e({deployFlowStatus:"deploying"});try{const{httpService:n,documentVersion:s}=t();if(!n)throw new Error("Missing httpService");const i=await n.deployFlow({documentVersion:s});qe.info("Deploy response",i),e({deployFlowStatus:"deployed"})}catch(n){throw qe.info("Deploy error",n),e({deployFlowStatus:"error"}),n}},exportStoreData:()=>{const{nodes:n,edges:s}=t();r1(n,s)},getDeployedVersionsList:async n=>{try{const{httpService:s}=t();if(!s)throw new Error("Missing httpService");const i=await s.getFlowVersions(n),l=Pm(Bg());return e({deployedVersionsList:i.map((c,u)=>({id:c.id,relativeTimeSince:l(c.created_at),version:(i.length-u).toFixed(1)}))}),i}catch(s){throw qe.error("Could not get deployed versions",s),e({deployedVersionsList:[]}),s}},getNodeType:n=>{const s=t().nodes.find(i=>i.id===n);return s==null?void 0:s.type},getRootElement:()=>{const{rootElement:n,rootElementId:s}=t();if(!n)throw new Error(`Root element not found for ID ${s}`);return n.shadowRoot?n.shadowRoot.getRootNode():n},getTargetEdges:n=>t().edges.filter(s=>{const i=s.target===n,l=s.source!==s.target;return i&&l}),getValidationWarnings:()=>t().validationWarnings,migrateAndLoadDeployedFlow:async n=>{const{actions:s,workingFlowCopy:i}=t(),{partialUpdateNodeData:l,saveWorkingFlowCopy:c}=s,f=new ep({dbRecord:n}).migrateTo(Hs),{flow_data:p}=f;if(!p)qe.error("Cannot load flow: missing flowData",p);else{i||c();const m=p.nodes.map(Lm),y=p.edges.map(bm);e({detachedMode:!0,edges:[],initializing:!0,nodes:[]}),await Mm(qg),e({edges:y,nodes:m,showDeployedHistoryToast:!0}),zg(m),Yg(m,l)}},onConnect:n=>{qe.debug("onConnect"),e({edges:Nh(n,t().edges)})},onConnectEnd:()=>{qe.debug("onConnectEnd"),e({isEdgeConnecting:!1})},onConnectStart:()=>{qe.debug("onConnectStart"),e({isEdgeConnecting:!0})},onEdgeUpdate:(n,s)=>{qe.debug("onEdgeUpdate"),e({edges:Zw(n,s,t().edges),isEdgeUpdateSuccessful:!0})},onEdgeUpdateEnd:(n,s)=>{var i;qe.debug("onEdgeUpdateEnd"),t().isEdgeUpdateSuccessful?e({isEdgeUpdateSuccessful:!0}):(i=t().reactFlowInstance)==null||i.deleteElements({edges:[{id:s.id}]}),e({updatingSourceHandleId:void 0})},onEdgeUpdateStart:(n,s)=>{qe.debug("onEdgeUpdateStart"),e({isEdgeUpdateSuccessful:!1,updatingSourceHandleId:s.sourceHandle??void 0})},onEdgesChange:n=>{e({edges:IN(n,t().edges)})},onEdgesDelete:n=>{qe.debug("onEdgesDelete [noop]",n)},onInit:async n=>{const{actions:s,deployFlowURL:i,getFlowURL:l,updateFlowURL:c}=t(),{partialUpdateNodeData:u}=s;qe.log("onInit",{getFlowURL:l,updateFlowURL:c});try{const f=gc({deployFlowURL:i,getFlowURL:l,headers:yu(),updateFlowURL:c}),[p,m]=await Promise.all([f.getFlow(),f.getFlowVersions({pageSize:1})]),E=new ep({dbRecord:p}).migrateTo(Hs),{document_version:x,flow_data:_,id:w,title:S,updated_at:N}=E;if(m.length&&m[0]){const{document_version:P}=m[0];P===x&&e({deployFlowStatus:"deployed"})}let R=_;R||(R={edges:Bu.edges,flowDataVersion:Hs,nodes:Bu.nodes.concat([NC])}),e({documentLastUpdated:N,documentVersion:x,edges:R.edges.map(bm),flowId:w,flowTitle:S,httpService:f,nodes:R.nodes.map(Lm),reactFlowInstance:n}),zg(R.nodes),Yg(R.nodes,u),_C(R.nodes,u)}catch(f){qe.error("Could not load flow. URL:",l);let p="unknown";f instanceof Error&&f.message.includes(QR)&&(p="not-found"),e({httpError:p})}},onNodeDragStart:()=>{e({isDraggingNode:!0})},onNodeDragStop:()=>{e({isDraggingNode:!1})},onNodesChange:n=>{const s=n.filter(i=>i.type!=="dimensions");s.length>0&&e({nodes:Zh(s,t().nodes)})},onNodesDelete:n=>{qe.debug("onNodesDelete");const{actions:s}=t(),{partialUpdateNodeData:i}=s;aC(t().nodes,n).forEach(c=>{i(c.id,c.data)})},onSelectionChange:({nodes:n})=>{e({selectedNode:n.find(s=>s.selected)})},onViewportChange:(()=>{let n;function s(i){n&&clearTimeout(n),n=setTimeout(()=>{e({viewportChanging:!1})},wC),e({viewport:{...i},viewportChanging:!0})}return s})(),onViewportChangeEnd:()=>{},onViewportChangeStart:()=>{},partialUpdateNodeData:(n,s)=>{var c;qe.debug("partialUpdateNodeData",n,s);const i=[],l=t().nodes.map(u=>{if(u.id===n){if("options"in s&&"options"in u.data){const f=u.data.options.map(m=>m.id),p=s.options.map(m=>m.id);i.push(...f.filter(m=>!p.includes(m)))}return{...u,data:{...u.data,...s}}}return u});if(i.length){const u=t().edges.filter(f=>f.sourceHandle&&i.includes(f.sourceHandle));qe.debug("Remove orphaned edges",{edgesToDelete:u,sourceHandleDeleted:i}),(c=t().reactFlowInstance)==null||c.deleteElements({edges:u})}e({nodes:l})},partialUpdateValidationWarning:(n,s)=>{const{validationWarnings:i}=t(),l=u=>u.connected===!1||u.valid===!1,c=i.get(n);if(s.nodeType!=="handleCall"&&!c&&l(s)){const u=dC.get(s.nodeType),f={connected:s.connected,id:Le(),nodeId:s.nodeId,nodeTitle:u,nodeType:s.nodeType,valid:s.valid};i.set(n,f)}else if(c){const u={...c,...s};l(u)?i.set(n,u):i.delete(n)}e({validationWarnings:new Map(i)})},removeEdge:n=>{qe.debug("removeEdge",n);const s=t().reactFlowInstance;s&&s.deleteElements({edges:[{id:n}]})},removeNode:n=>{qe.debug("removeNode",n);const s=t().reactFlowInstance;s&&s.deleteElements({nodes:[{id:n}]})},restoreDeployedFlow:()=>{const{actions:n,edges:s,nodes:i}=t(),{cleanUpDetachedMode:l}=n;e({detachedMode:!1,edges:s,nodes:i}),l()},saveWorkingFlowCopy:()=>{const{edges:n,nodes:s,saveFlowStatus:i}=t();e({workingFlowCopy:{edges:n,nodes:s,saveFlowStatus:i}})},setColorMode:n=>{e({colorMode:n})},setDragNodeType:n=>{e({dragNodeType:n})},setFlowWrapperElement:n=>{e({flowWrapperElement:n||void 0})},setInitializing:n=>{e({initializing:n})},setSelectedNodes:n=>{const{nodes:s}=t(),i=s.map(l=>({...l,selected:n.includes(l.id)}));e({nodes:i})},setShowDeployWarning:n=>{e({showDeployWarning:n})},setShowDeployedHistory:n=>{e({showDeployedHistory:n})},setShowValidationWarnings:n=>{e({showValidationWarnings:n})},setViewportChanging:n=>{e({viewportChanging:n})}}}),Ee=Do()(yC(EC(RC))),Je=()=>Ee.getState().actions;window.__useRFStore=Ee;const TC={"not-found":{message:"Please ensure that the Call Flow exists and the URL is correct.",status:"404",title:"Call Flow not found"},unknown:{message:"An unknown error occurred. Please try again or go back.",status:"",title:"Unknown error"}},OC=({errorType:e})=>{const t=Ee(l=>l.backButtonHref),{title:n,message:s,status:i}=TC[e];return h.jsx("section",{className:"flex min-h-full w-full items-center justify-center bg-background px-6",children:h.jsxs("div",{className:"text-center",children:[i&&h.jsx("p",{className:"text-2xl font-semibold text-foreground/50",children:i}),h.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground",children:n}),h.jsx("p",{className:"mt-6 leading-7 text-foreground",children:s}),t&&h.jsx("div",{className:"mt-8 flex items-center justify-center gap-x-6",children:h.jsx("a",{href:t,className:"rounded-md bg-foreground px-3.5 py-2.5 text-sm font-semibold text-background shadow-sm transition-colors hover:bg-foreground/80 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground",children:k(O.GO_BACK)})})]})})},Jg=({height:e,strokeWidth:t,toX:n,toY:s,width:i})=>h.jsx("svg",{x:n-i*t/2,y:s-e*t/2,height:e*t,width:i*t,viewBox:`-${i/2} -${e/2} ${i} ${e}`,children:h.jsx("g",{children:h.jsx("polyline",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,points:"-5,-4 0,0 -5,4 -5,-4"})})}),CC=({fromHandle:e,fromNode:t,fromPosition:n,fromX:s,fromY:i,toPosition:l,toX:c,toY:u})=>{if(!t)return null;const[f]=Us({borderRadius:Cm,sourcePosition:n,sourceX:s,sourceY:i,targetPosition:l,targetX:c,targetY:u}),{height:p,strokeWidth:m,width:y}={...ko.markerEnd,...ko.style},E=(e==null?void 0:e.position)===xe.Left,x=E?s:c,_=E?i:u;return h.jsxs("g",{className:"cfb-connection-line",children:[h.jsx("path",{fill:"none",strokeWidth:m,className:"animated",d:f}),h.jsx(Jg,{height:p,strokeWidth:m,toX:x,toY:_,width:y}),E&&h.jsx("circle",{cx:c-2,cy:u,fill:"none",r:4,strokeWidth:m})]})};function AC({isCircular:e=!1,targetNode:t,targetX:n,targetY:s}){const{width:i,height:l,position:c}=t,u=i??0,f=l??0,p=u/2;return e?{tx:c.x+p,ty:c.y+f}:{tx:n,ty:s}}const IC=e=>{const t={...e,interactionWidth:40},{id:n,source:s,target:i,sourcePosition:l,sourceX:c,sourceY:u,targetX:f,targetY:p}=t,{removeEdge:m}=Je(),y=b.useRef(null),E=Pe(b.useCallback(H=>H.nodeInternals.get(s),[s])),x=Pe(b.useCallback(H=>H.nodeInternals.get(i),[i]));if(!E||!x)return null;const _=s===i,{tx:w,ty:S}=AC({isCircular:_,targetNode:x,targetX:f,targetY:p}),[N,R,P]=Us({borderRadius:Cm,sourcePosition:l,sourceX:c,sourceY:u,targetPosition:_?xe.Bottom:xe.Left,targetX:w,targetY:S}),C=(H,q)=>{H.stopPropagation(),m(q)},I=H=>{var q,ee,z;(q=H.currentTarget)==null||q.classList.add("highlight"),(ee=y.current)==null||ee.classList.add("animate-delay-opacity","flex"),(z=y.current)==null||z.classList.remove("hidden")},L=H=>{var q,ee,z;(q=H.currentTarget)==null||q.classList.remove("highlight"),(ee=y.current)==null||ee.classList.remove("animate-delay-opacity","flex"),(z=y.current)==null||z.classList.add("hidden")},{height:U,strokeWidth:G,width:X}={...ko.markerEnd,...ko.style};return h.jsxs("g",{onMouseEnter:I,onMouseLeave:L,children:[h.jsx(wo,{path:N,...t}),h.jsx(Jg,{height:U,strokeWidth:G,toX:w,toY:S,width:X}),h.jsx(wR,{children:h.jsxs("button",{className:"nodrag nopan pointer-events-auto absolute hidden h-[18px] w-[26px] cursor-pointer items-center justify-center rounded-full bg-foreground/90 opacity-0 hover:h-[22px] hover:w-[30px] hover:border-2 hover:border-focus",onClick:H=>C(H,n),ref:y,style:{transform:`translate(-50%, -50%) translate(${R}px,${P}px)`},children:[h.jsx(Ce,{tag:"trash-can",className:"py-0.5 px-1.5 text-background"}),h.jsx("span",{className:"sr-only",children:k(O.REMOVE_EDGE)})]})})]})},bC=/^[\w\d -']+$/,LC=/^\d+$/,DC=/^\d|\*|#$/,kC=/^[\d*#$]{0,12}$/,PC=/^.{1,20}$/,Wo={MAX:3600,MIN:0},MC=/^[a-z0-9_]{1,20}$/,He={MAX:99,MIN:1},Go=e=>t=>!!e.exec(t),zu=e=>{if(!Vt(e))return!0;try{return!!new URL(e)}catch{return!1}},At=e=>Vt(e)?Go(LC)(e):!0,jC=e=>Vt(e)?Go(DC)(e):!0,UC=e=>Vt(e)?Go(bC)(e):!0,FC=e=>Vt(e)?Go(MC)(e):!0,Zg=e=>Vt(e)?Go(kC)(e):!0,VC=e=>Vt(e)?Go(PC)(e):!0,Hl=e=>{if(!Vt(e))return!0;try{return JSON.parse(e),!0}catch{return!1}},De=e=>!!Vt(e),ei=(e,t)=>{if(typeof e=="string"&&!Vt(e))return!0;const n=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(n)&&n>=t},ti=(e,t)=>{if(typeof e=="string"&&!Vt(e))return!0;const n=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(n)&&n<=t},Er=(e,t)=>{const n=new Set,s=e.reduce((i,l)=>{const c=l[t];if(typeof c=="string"){const u=c.trim();u&&(n.has(u)&&i.add(u),n.add(u))}return i},new Set);return i=>s.has(i.trim())},Yo={aiAgent:{fieldValidators:{agent:[De]},validate:e=>Ko({nodeData:e,nodeType:"aiAgent"}),validateField:(e,t)=>Ie({name:e,nodeType:"aiAgent",value:t})},cond:{fieldValidators:{value:[De]},validate:e=>Gu("cond",e),validateField:(e,t)=>Ie({name:e,nodeType:"cond",value:t})},condRequest:{fieldValidators:{body:[],headers:[Hl],method:[De],saveVariables:[],url:[De],value:[De]},validate:e=>{const t=e,n=[];return["body","headers","method","saveVariables","url"].forEach(i=>{Ie({name:i,nodeType:"condRequest",value:t[i]})||n.push(i)}),[...n,...Gu("condRequest",e)]},validateField:(e,t)=>Ie({name:e,nodeType:"condRequest",value:t})},executeSWML:{fieldValidators:{dest:[De],meta:[Hl],params:[Hl]},validate:e=>{const t=e,n=[];return["dest","params","meta"].forEach(i=>{Ie({name:i,nodeType:"executeSWML",value:t[i]})||n.push(i)}),[...n,...Gu("executeSWML",e)]},validateField:(e,t)=>Ie({name:e,nodeType:"executeSWML",value:t})},forwardAddress:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardAddress",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardAddress",value:t})},forwardPhone:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardPhone",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardPhone",value:t})},forwardResource:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardResource",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardResource",value:t})},hangup:{fieldValidators:{reason:[]},validate:e=>Ku("hangup",e),validateField:(e,t)=>Ie({name:e,nodeType:"hangup",value:t})},play:{fieldValidators:{selected:[De],text:[De],url:[De]},validate:e=>Ku("play",e),validateField:(e,t)=>Ie({name:e,nodeType:"play",value:t})},promptPlay:{fieldValidators:{command:[UC],digit:[jC],digitTimeout:[At,{test:ei,testValue:He.MIN},{test:ti,testValue:He.MAX}],initialTimeout:[At,{test:ei,testValue:He.MIN},{test:ti,testValue:He.MAX}],selected:[De],text:[De],url:[De]},validate:e=>{const t="promptPlay",n=e,s=Er(n.options,"command"),i=Er(n.options,"digit"),l=Ku("promptPlay",n),c=pc(n.initialTimeout);c!=null&&c.trim()&&!Ie({name:"initialTimeout",nodeType:t,value:c})&&l.push("initialTimeout");const u=pc(n.digitTimeout);return u!=null&&u.trim()&&!Ie({name:"digitTimeout",nodeType:t,value:u})&&l.push("digitTimeout"),n.options.forEach(f=>{const p=Ie({name:"command",nodeType:t,value:f.command})&&!s(f.command),m=Ie({name:"digit",nodeType:t,value:f.digit})&&!i(f.digit);p&&m&&(f.command||f.digit)||l.push(`option_${f.id}`)}),l},validateField:(e,t)=>Ie({name:e,nodeType:"promptPlay",value:t})},record:{fieldValidators:{beep:[],endSilenceTimeout:[At,{test:ei,testValue:He.MIN},{test:ti,testValue:He.MAX}],format:[De],initialTimeout:[At,{test:ei,testValue:He.MIN},{test:ti,testValue:He.MAX}],maxLength:[At,{test:ei,testValue:Wo.MIN},{test:ti,testValue:Wo.MAX}],stereo:[],terminators:[Zg]},validate:e=>Ko({nodeData:e,nodeType:"record"}),validateField:(e,t)=>Ie({name:e,nodeType:"record",value:t})},recordCallStart:{fieldValidators:{beep:[],controlId:[],format:[De],label:[De,VC],stereo:[],terminators:[Zg]},validate:e=>Ko({nodeData:e,nodeType:"recordCallStart"}),validateField:(e,t)=>Ie({name:e,nodeType:"recordCallStart",value:t})},recordCallStop:{fieldValidators:{controlId:[De]},validate:e=>Ko({nodeData:e,nodeType:"recordCallStop"}),validateField:(e,t)=>Ie({name:e,nodeType:"recordCallStop",value:t})},request:{fieldValidators:{body:[],headers:[Hl],method:[De],saveVariables:[],url:[De]},validate:e=>Ko({nodeData:e,nodeType:"request"}),validateField:(e,t)=>Ie({name:e,nodeType:"request",value:t})},sendSms:{fieldValidators:{body:[De],fromNumber:[De],toNumber:[De]},validate:e=>Ko({nodeData:e,nodeType:"sendSms"}),validateField:(e,t)=>Ie({name:e,nodeType:"sendSms",value:t})},set:{fieldValidators:{key:[De,FC],value:[]},validate:e=>{const t=e,n="set",s=[],i=Er(t.variables,"key");return t.variables.forEach(l=>{const c=Ie({name:"key",nodeType:n,value:l.key})&&!i(l.key),u=Ie({name:"value",nodeType:n,value:l.value});c&&u||s.push(`variable_${l.id}`)}),s},validateField:(e,t)=>Ie({name:e,nodeType:"set",value:t})},unset:{fieldValidators:{},validate:e=>e.variables.length>0?[]:["variables"],validateField:(e,t)=>Ie({name:e,nodeType:"unset",value:t})}},It=e=>{const t=Yo==null?void 0:Yo[e];return{validate:t==null?void 0:t.validate,validateField:t==null?void 0:t.validateField}},ey=(e,t)=>{var s;const n=(s=Yo[e])==null?void 0:s.validate;return n===void 0?[]:n(t)},Wu=(e,t)=>{var n;return!e||!t?!1:((n=ey(e,t))==null?void 0:n.length)===0},$C=e=>{var t;return(t=Yo[e])==null?void 0:t.fieldValidators},Ie=({name:e,nodeType:t,value:n})=>{var l;let s=!0;const i=(l=$C(t))==null?void 0:l[e];return i==null||i.forEach(c=>{typeof c=="function"?s=s&&c(n):s=s&&c.test(n,c.testValue)}),s},Ko=({nodeData:e,nodeType:t})=>{var i;const n=((i=Yo[t])==null?void 0:i.fieldValidators)??{},s=[];return Object.keys(n).forEach(l=>{const c=l;Ie({name:l,nodeType:t,value:(e==null?void 0:e[c])??""})||s.push(l)}),s},Gu=(e,t)=>{const n=t,s=[];return n.options.forEach(i=>{Ie({name:"value",nodeType:e,value:i.value})||s.push(`condition_${i.id}`)}),s},Yu=(e,t)=>{var l;const n=[];["callOrder","callStateEvents","callStateUrl","defaultFrom","defaultTimeout"].forEach(c=>{Ie({name:c,nodeType:e,value:t[c]})||n.push(c)});const i=["connectFrom","connectTo","connectTimeout","connectConfirmUrl","connectConfirmId"];return(l=t.connections)==null||l.forEach(c=>{i.forEach(u=>{!c.connectConfirmEnabled&&(u==="connectConfirmUrl"||u==="connectConfirmId")||Ie({name:u,nodeType:e,value:c[u]})||n.push(`${u}_${c.id}`)})}),n},Ku=(e,t)=>{const n=[];return Ie({name:"selected",nodeType:e,value:t==null?void 0:t.selected})||n.push("selected"),t.selected==="url"?Ie({name:"url",nodeType:e,value:t.url})||n.push("url"):t.selected==="text"&&(Ie({name:"text",nodeType:e,value:t.text})||n.push("text")),n},bt=({data:e,id:t})=>{const n=Ee(u=>u.isCanvasInteractive),{getNodeType:s,partialUpdateNodeData:i}=Je(),{isValueDuplicate:l}=Hu(),c=s(t);return b.useEffect(()=>{if(c&&n){let u=Wu(c,e);c==="recordCallStart"&&"label"in e&&(u=u&&!l(e.label,e.controlId)),u!==e.valid&&i(t,{valid:u})}},[e,t,n,l,i,c]),b.useEffect(()=>{if(c==="aiAgent"&&n){const u=On.subscribe(f=>{if(f.status==="loaded"&&"agent"in e){const p=f.aiAgentMap.has(e.agent),m=p&&Wu(c,e);m!==e.valid&&i(t,{agent:p?e.agent:"",valid:m})}});return()=>{u()}}},[e,t,n,i,c]),b.useEffect(()=>{if((f=>(c==="forwardAddress"||c==="forwardPhone"||c==="forwardResource")&&"connections"in f)(e)&&n){const f=zn.subscribe(p=>{if(p.status==="loaded"){let m=!0;const y=e.connections.map(x=>{const _=p.actions.updateConnection(x,p.swmlScriptMap);return _?(m=!1,_):x}),E=m&&Wu(c,e);E!==e.valid&&i(t,{connections:y,valid:E})}});return()=>{f()}}},[e,t,n,i,c]),{getInvalidFields:()=>!c||e.valid?[]:ey(c,e),valid:()=>e.valid}},HC=({data:e,id:t,isConnectable:n,selected:s})=>{bt({data:e,id:t});const i=On(c=>c.aiAgentMap.get(e.agent)),l=i==null?void 0:i.display_name;return h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.AI_AGENT),selected:s,valid:e.valid,children:[l&&h.jsx(Qt,{children:h.jsx("p",{className:"truncate text-xs",children:l})}),h.jsx(an,{id:t,color:"positive",isConnectable:n})]})},BC=({data:e,id:t,isConnectable:n,selected:s})=>h.jsx(dt,{id:t,isConnectable:n,nodeTitle:k(O.ANSWER_CALL),selected:s,valid:e.valid,children:h.jsx(an,{id:t,isConnectable:n,color:"positive"})}),zC=({id:e,data:t,isConnectable:n,selected:s})=>(bt({data:t,id:e}),h.jsx(dt,{id:e,isConnectable:n,nodeTitle:k(O.CONDITIONS),selected:s,valid:t.valid,children:h.jsxs(Fo,{children:[t.options.map((i,l)=>{const c=i.value.trim();return h.jsx(cn,{color:"positive",enabled:!!c,id:i.id,isConnectable:n,optionTitle:c?h.jsx("div",{className:"truncate",children:c}):k(O.CONDITION_NUMBER,{index:l+1})},i.id)}),h.jsx(cn,{color:"negative",id:t.fallback,isConnectable:n,optionTitle:k(O.ELSE)})]})})),WC=({data:e,id:t,isConnectable:n,selected:s})=>{var l;bt({data:e,id:t});const i=e.url.trim();return h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.REQUEST),selected:s,valid:e.valid,children:[i&&h.jsx(Qt,{children:h.jsx("div",{className:"break-all line-clamp-3",children:i})}),h.jsxs(Fo,{children:[(l=e==null?void 0:e.options)==null?void 0:l.map((c,u)=>{const f=c.value.trim();return h.jsx(cn,{color:"positive",enabled:!!f,id:c.id,isConnectable:n,optionTitle:f?h.jsx("div",{className:"truncate",children:f}):k(O.CONDITION_NUMBER,{index:u+1})},c.id)}),h.jsx(cn,{color:"negative",id:e.fallback,isConnectable:n,optionTitle:k(O.ELSE)}),h.jsx(cn,{color:"negative",id:e.error,isConnectable:n,optionTitle:k(O.FAILURE)})]})]})},GC=({data:e,id:t,isConnectable:n,selected:s})=>{var l;bt({data:e,id:t});const i=e.dest.trim();return h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.EXECUTE_SWML),selected:s,valid:e.valid,children:[i&&h.jsx(Qt,{children:h.jsx("div",{className:"break-all line-clamp-3",children:i})}),h.jsxs(Fo,{children:[(l=e==null?void 0:e.options)==null?void 0:l.map((c,u)=>{const f=c.value.trim();return h.jsx(cn,{color:"positive",enabled:!!f,id:c.id,isConnectable:n,optionTitle:f?h.jsx("div",{className:"truncate",children:f}):k(O.CONDITION_NUMBER,{index:u+1})},c.id)}),h.jsx(cn,{color:"negative",id:e.fallback,isConnectable:n,optionTitle:k(O.ELSE)})]})]})},Xu=3,YC={busy:O.BUSY,decline:O.DECLINE,error:O.ERROR,noAnswer:O.NO_ANSWER,success:O.SUCCESS},KC={address:O.FORWARD_TO_ADDRESS,phone:O.FORWARD_TO_PHONE,resource:O.FORWARD_TO_RESOURCE},Qu=({id:e,data:t,isConnectable:n,selected:s})=>{bt({data:t,id:e});const i=t.connections.filter(c=>c.connectTo),l=i.slice(0,Xu);return h.jsxs(dt,{id:e,isConnectable:n,nodeTitle:k(KC[t.destinationType]),selected:s,valid:t.valid,children:[i.length?h.jsxs(Qt,{children:[h.jsx("ul",{children:l.map(c=>h.jsx("li",{className:"pb-2",children:h.jsx("div",{className:"max-w-max truncate rounded bg-secondary/20 px-1 ",children:c.connectTo})},`node-${c.id}`))}),i.length>Xu&&h.jsx("div",{children:`+ ${k(O.MORE_WITH_COUNT,{count:i.length-Xu})}`})]}):null,h.jsx(Fo,{children:t.options.map(c=>h.jsx(cn,{color:Dm(c.result),id:c.id,isConnectable:n,optionTitle:k(YC[c.result])},c.id))})]})},XC=({id:e,data:t,isConnectable:n,selected:s})=>{bt({data:t,id:e});const i=Er(t.options,"command"),l=Er(t.options,"digit");return h.jsxs(dt,{id:e,isConnectable:n,nodeTitle:k(O.GATHER_INPUT),selected:s,valid:t.valid,children:[h.jsx(ug,{data:t}),h.jsxs(Fo,{children:[t.options.map((c,u)=>{const f=c.command.trim(),p=c.digit.trim(),m=!!(f||p)&&!i(c.command)&&!l(c.digit),y=h.jsxs("div",{className:"flex gap-1",children:[k(O.CALLER_PRESSES)," ",h.jsx("span",{className:"truncate rounded bg-secondary/20 px-1",children:p})]}),E=w=>h.jsxs("div",{className:"flex",children:[k(w?O.CALLER_SAYS:O.OR_CALLER_SAYS)," '",h.jsx("span",{className:"truncate",children:f}),"'"]});let x=k(O.OPTION_NUMBER,{index:u+1}),_="";switch(!0){case!!(f&&!p):x=E(!0);break;case!!(!f&&p):x=y;break;case!!(f&&p):x=y,_=E(!1);break}return h.jsx(cn,{color:"positive",enabled:m,id:c.id,isConnectable:n,optionTitle:x,optionSubtitle:_},c.id)}),t.results.map(c=>h.jsx(cn,{color:"negative",id:c.id,isConnectable:n,optionTitle:c.result==="no_input"?k(O.NO_INPUT):k(O.UNKNOWN)},c.id))]})]})},QC=({id:e,isConnectable:t,selected:n})=>h.jsx(dt,{id:e,isConnectable:t,isRoot:!0,nodeTitle:k(O.HANDLE_CALL),selected:n,deletable:!1,showValidation:!1,target:!1,children:h.jsx(an,{id:e,color:"positive",isConnectable:t})}),qu={busy:O.BUSY,decline:O.DECLINE,hangup:O.HANG_UP},qC=({data:e,id:t,isConnectable:n,selected:s})=>h.jsx(dt,{id:t,isConnectable:n,nodeTitle:k(O.HANG_UP_CALL),selected:s,valid:e.valid,children:e.reason&&h.jsx(Qt,{children:h.jsx("p",{children:k(qu[e.reason])})})}),JC=({data:e,id:t,isConnectable:n,selected:s})=>(bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.PLAY_AUDIO_TTS),selected:s,valid:e.valid,children:[h.jsx(ug,{data:e}),h.jsx(an,{id:t,isConnectable:n})]})),ZC=({data:e,id:t,isConnectable:n,selected:s})=>{const{label:i,valid:l}=e;return bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.RECORD_CALL_START),selected:s,valid:l,children:[i&&l&&h.jsx(Qt,{children:h.jsx("p",{className:"truncate text-xs leading-5",children:i})}),h.jsx(an,{id:t,isConnectable:n,color:"positive"})]})},eA=({data:e,id:t,isConnectable:n,selected:s})=>{var c;bt({data:e,id:t});const i=(c=zo(u=>u.entries))==null?void 0:c.find(u=>u.controlId===e.controlId),l=i==null?void 0:i.label;return h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.RECORD_CALL_STOP),selected:s,valid:e.valid,children:[l&&h.jsx(Qt,{children:h.jsx("p",{className:"truncate text-xs leading-5",children:l})}),h.jsx(an,{id:t,color:"positive",isConnectable:n})]})},tA=({data:e,id:t,isConnectable:n,selected:s})=>{bt({data:e,id:t});const i=new Set(e.terminators);return h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.VOICEMAIL_RECORDING),selected:s,valid:e.valid,children:[e.terminators?h.jsxs(Qt,{children:[k(O.TERMINATORS),":"," ",h.jsx("ul",{className:"inline-flex flex-wrap justify-start gap-1",children:[...i].sort().map((l,c)=>h.jsx("li",{className:"rounded bg-secondary/20 px-1",children:l},`${c}-${l}`))})]}):null,h.jsx(an,{id:t,isConnectable:n,color:"positive"})]})},nA={failed:O.FAILED,success:O.SUCCESS},ty={aiAgent:HC,answer:BC,cond:zC,condRequest:WC,executeSWML:GC,forwardAddress:Qu,forwardPhone:Qu,forwardResource:Qu,handleCall:QC,hangup:qC,play:JC,promptPlay:XC,record:tA,recordCallStart:ZC,recordCallStop:eA,request:({data:e,id:t,isConnectable:n,selected:s})=>{var i;return bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.REQUEST),selected:s,valid:e.valid,children:[h.jsx("p",{className:"p-4 pt-0 text-xs text-negative",children:k(O.DEPRECATED)}),h.jsx(Fo,{children:(i=e==null?void 0:e.options)==null?void 0:i.map(l=>h.jsx(cn,{color:Dm(l.result),id:l.id,isConnectable:n,optionTitle:k(nA[l.result])},l.id))})]})},sendSms:({data:e,id:t,isConnectable:n,selected:s})=>(bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:n,nodeTitle:k(O.SEND_SMS),selected:s,valid:e.valid,children:[e.body&&h.jsx(Qt,{children:h.jsx("p",{className:"break-words line-clamp-3",children:e.body})}),h.jsx(an,{id:t,isConnectable:n})]})),set:({id:e,data:t,isConnectable:n,selected:s})=>{const{getInvalidFields:i}=bt({data:t,id:e}),l=i().reduce((u,f)=>(f.startsWith("variable_")&&u.push(f.replace("variable_","")),u),[]),c=t.variables.filter(u=>!!u.key);return h.jsxs(dt,{id:e,isConnectable:n,nodeTitle:k(O.SET_VARIABLES),selected:s,valid:t.valid,children:[c.length>0&&h.jsx(Qt,{children:h.jsx("ul",{className:"flex flex-col",children:c.map(u=>h.jsxs("li",{className:"flex w-full gap-1 pb-2",children:[h.jsx("div",{className:`max-w-[50%] shrink-0 truncate rounded px-1 ${l.includes(u.id)?"bg-negative/10 text-negative":"bg-secondary/20"}`,children:u.key}),"=",u.value&&h.jsx("div",{className:"truncate",children:u.value})]},u.id))})}),h.jsx(an,{id:e,isConnectable:n,color:"positive"})]})},unset:({id:e,data:t,isConnectable:n,selected:s})=>{bt({data:t,id:e});const i=t.variables.filter(l=>!!l.key);return h.jsxs(dt,{id:e,isConnectable:n,nodeTitle:k(O.UNSET_VARIABLES),selected:s,valid:t.valid,children:[i.length>0&&h.jsx(Qt,{children:h.jsx("ul",{children:i.map(l=>h.jsx("li",{className:"pb-2",children:h.jsx("div",{className:"max-w-max truncate rounded bg-secondary/20 px-1",children:l.key})},l.id))})}),h.jsx(an,{id:e,isConnectable:n,color:"positive"})]})}},rA={floating:IC},oA=({children:e})=>{const t=Ee(P=>P.nodes),n=Ee(P=>P.edges),s=Ee(P=>P.isCanvasInteractive),{onConnect:i,onConnectEnd:l,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:p,onEdgeUpdateEnd:m,onEdgeUpdateStart:y,onInit:E,onNodeDragStart:x,onNodeDragStop:_,onNodesChange:w,onNodesDelete:S,onSelectionChange:N,setFlowWrapperElement:R}=Je();return h.jsx("div",{className:"bg-sw-white !h-auto w-full",ref:P=>R(P),children:h.jsxs(Sm,{attributionPosition:"bottom-left",connectionLineComponent:CC,connectionMode:cr.Strict,deleteKeyCode:s?e1:null,defaultEdgeOptions:ko,edges:n,edgeTypes:rA,elementsSelectable:s,fitViewOptions:gu,multiSelectionKeyCode:s?t1:null,nodes:t,nodesConnectable:s,nodesDraggable:s,nodeTypes:ty,onConnect:i,onConnectEnd:l,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:s?p:void 0,onEdgeUpdateEnd:m,onEdgeUpdateStart:y,onInit:E,onNodeDragStart:x,onNodeDragStop:_,onNodesChange:w,onNodesDelete:S,onSelectionChange:N,selectionKeyCode:s?n1:null,snapGrid:[vl,vl],snapToGrid:!0,children:[h.jsx($R,{className:"bg-background-alt text-grid",color:"currentColor",gap:[vl,vl],variant:Xt.Dots}),e]})})},sA=()=>{const e=Ee(u=>u.initializing),t=Ee(u=>u.reactFlowInstance),{setInitializing:n,setViewportChanging:s}=Je(),i=b.useRef(!1),l=CR({includeHiddenNodes:!0}),c=b.useMemo(()=>()=>{t==null||t.fitView(gu)},[t]);b.useEffect(()=>{let u;e?!i.current&&!l?i.current=!0:i.current&&l&&(clearTimeout(u),s(!0),c(),u=setTimeout(()=>{s(!1)},gu.duration),n(!1),i.current=!1):i.current=!1},[e,c,l,n,s])},iA=()=>{const{onViewportChange:e,onViewportChangeEnd:t,onViewportChangeStart:n}=Je();return sA(),RR({onChange:e,onEnd:t,onStart:n}),null},lA=()=>{const e=Ee(n=>n.selectedNode),t=e?fC.get(e.type):void 0;return t?h.jsx(ks,{className:"z-40 max-w-[40%] rounded-md bg-background",position:"bottom-center",children:h.jsxs("div",{className:"justify-left flex items-center gap-2 rounded-md bg-primary/10 p-3 py-4","data-testid":"cfb__info",children:[h.jsx(Ce,{className:"shrink-0 text-primary",tag:"circle-info",size:"xl"}),h.jsx("div",{className:"text-xs font-medium",children:Ul(t)})]})}):null},aA=e=>{var l;const t=b.useRef(),n=NR(),s=e&&"options"in e.data?(l=e.data.options)==null?void 0:l.length:0;return t.current=s,{updateDynamicHandles:c=>{"options"in c&&c.options.length!==t.current&&(e&&n(e.id),t.current=c.options.length)}}},cA="/hello/.test('%{foo}')",uA=()=>({id:Le(),value:""}),Ju=({nodeData:e,handleOnUpdate:t,placeholder:n=cA})=>{const{validateField:s}=It("cond"),[i,l]=b.useState({options:e.options.map(y=>({id:!0,initial:e.initial,value:s("value",y.value)}))}),c=y=>{y.preventDefault(),l({...i,options:[...i.options,{initial:!0,value:!0}]}),t({options:[...e.options,uA()]})},u=y=>E=>{E.preventDefault();const x=[...i.options];x.splice(y,1),l({...i,options:x});const _=[...e.options];_.splice(y,1),t({options:_})},f=(y,E)=>{const x=[...e.options];if(!x[y])throw new Error(`Option not found at index ${y}`);const{name:_,value:w}=E,S=[...i.options];S[y]={...S[y],initial:!1,[_]:s(_,w)},l({...i,options:S}),x[y]={...x[y],[_]:w},t({options:x})},p=(y,E)=>{const x=y.target,{name:_,value:w}=x;switch(t({initial:!1}),_){case"value":E!==void 0&&f(E,{name:_,value:w});break;default:Qe().error(`Unhandled input name: ${_}`)}},m=({index:y,name:E})=>{const x=i.options[y];return(x==null?void 0:x[E])||(x==null?void 0:x.initial)};return h.jsxs(h.Fragment,{children:[h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.options.map((y,E,x)=>h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[x.length>1&&h.jsx(Uo,{className:"absolute right-0 top-0",handleDelete:u(E),label:k(O.REMOVE_CONDITION,{index:E+1}),size:"sm",show:!0}),h.jsxs("label",{className:"mb-2 block",children:[k(O.CONDITION_NUMBER,{index:E+1}),h.jsx("input",{className:`w-full ${m({index:E,name:"value"})?"":"invalid"}`,name:"value",onChange:_=>p(_,E),placeholder:n,type:"text",value:y.value}),h.jsx("p",{className:"requirements",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]})]})]},y.id))}),h.jsx("div",{className:"p-3 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:c,type:"button",children:k(O.ADD_CONDITION)})})]})},dA=Qe(),ni=(e,t)=>[e,t].filter(Boolean).join("-").toLowerCase(),fA={idsByKey:{},languageById:{},voiceById:{}},pA=(e,t)=>({...fA,actions:{getGenderByKeys:({languageId:n})=>{const{idsByKey:s}=t(),i=(n==null?void 0:n.split(",").map(c=>ni(c)))??[];if(!i.length)return["female","male"];const l=new Set;return i.forEach(c=>{var u;return(u=s[c])==null?void 0:u.forEach(f=>{f.gender&&l.add(f.gender)})}),Array.from(l).sort((c,u)=>c.toLowerCase().localeCompare(u.toLowerCase()))},getLanguages:()=>Object.values(t().languageById).sort((n,s)=>n.name.toLowerCase().localeCompare(s.name.toLowerCase())),getVoicesByKeys:({languageId:n,gender:s})=>{const{voiceById:i,idsByKey:l}=t(),c=(n==null?void 0:n.split(",").map(f=>ni(f,s)))??[];let u=[];return!c.length||c[0]===""?u=Object.values(i):c.forEach(f=>{u=u.concat(l[f]??[])}),u.sort((f,p)=>{const m=/^\w{2,3}-\w{2,}-.+/;return f.name.match(m)&&!p.name.match(m)?1:!f.name.match(m)&&p.name.match(m)?-1:f.name.toLowerCase().localeCompare(p.name.toLowerCase())})},init:async({voicesURL:n="/cfb/voices.json"})=>{try{dA.debug("Load voicesURL",n);const i=await(await fetch(n)).json(),l={},c={},u={};i.forEach(f=>{var S,N,R;const p=!!f.premium,m=f.signalwire_id,y=f.gender.toLowerCase(),E={gender:y,id:m,key:`${f.language_code}-${y}-${f.signalwire_id}`,name:`${f.friendly_name.trim()} ${p?"(premium)":""}`,premium:p};l[m]=E,c[f.language_code]={id:f.language_code,name:f.language};const x=ni(f.language_code);x in u||(u[x]=[]),(S=u[x])==null||S.push(E);const _=ni(y);_ in u||(u[_]=[]),(N=u[_])==null||N.push(E);const w=ni(f.language_code,y);w in u||(u[w]=[]),(R=u[w])==null||R.push(E)}),e({idsByKey:u,languageById:c,voiceById:l})}catch(s){console.error("Error",s)}}}}),Zu=Do()(pA),hA=()=>Zu.getState().actions;window.__useVoiceStore=Zu;const ny=e=>h.jsx("option",{value:e.id,children:e.name},e.key??e.id),mA=({onChange:e,languageId:t,gender:n,voiceId:s})=>{const{getLanguages:i,getVoicesByKeys:l,getGenderByKeys:c}=hA();return h.jsxs(h.Fragment,{children:[h.jsxs(Tn,{className:"w-full",label:k(O.LANGUAGE),name:"language",onChange:e,value:t??"",children:[h.jsx("option",{value:"",children:k(O.SELECT)}),i().map(ny)]}),h.jsxs(Tn,{className:"w-full capitalize",label:k(O.GENDER),name:"gender",onChange:e,value:n??"",children:[h.jsx("option",{value:"",children:k(O.SELECT)}),c({languageId:t}).map(u=>h.jsx("option",{value:u,children:u},u))]}),h.jsxs(Tn,{className:"w-full",label:k(O.VOICE),name:"voice",onChange:e,value:s??"",children:[h.jsx("option",{value:"",children:k(O.SELECT)}),l({gender:n,languageId:t}).map(ny)]})]})},ry={text:O.TEXT_TO_SPEECH,url:O.PLAY_AUDIO_FILE},oy=({handleOnUpdate:e,label:t,nodeData:n,showDefaultOption:s})=>{const{validateField:i}=It("play"),[l,c]=b.useState({gender:!0,language:!0,selected:n.initial||i("selected",n.selected),text:n.initial||i("text",n.text),url:n.initial||i("url",n.url),voice:!0}),u=n.selected;b.useEffect(()=>{!u&&!s&&e({selected:"url"})},[e,u,s]);const f=m=>{const y=m.target,{name:E,value:x}=y;switch(E){case"selected":case"text":case"url":c({...l,[E]:i(E,x)}),e({initial:!1,[E]:x});break;default:throw new Error(`Unhandled input name: ${E}`)}},p=m=>{const y=m.target,{name:E,value:x}=y;switch(E){case"language":e({gender:void 0,language:x,voice:void 0});break;case"gender":e({gender:x,voice:void 0});break;default:e({[E]:x})}};return h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"mb-2",children:[h.jsx("span",{className:"sr-only",children:t}),h.jsxs(dg,{className:`w-full ${l.selected?"":"invalid"}`,name:"selected",onChange:f,value:u,children:[s&&h.jsx("option",{value:"",children:k(O.SELECT)}),Object.keys(ry).map(m=>h.jsx("option",{value:m,children:k(ry[m])},m))]})]}),u&&h.jsx(gA,{nodeData:n,onChange:f,voiceSettingsChangeHandler:p,selected:u,valid:l[u]})]})},gA=({nodeData:e,onChange:t,voiceSettingsChangeHandler:n,selected:s,valid:i})=>{const l=e[s],u={text:h.jsxs(h.Fragment,{children:[h.jsx(mA,{onChange:n,languageId:e.language,gender:e.gender,voiceId:e.voice}),h.jsx(Hn,{errorText:k(O.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:k(O.TEXT),name:s,onChange:t,placeholder:k(O.WRITE_SOMETHING),valid:i,value:l})]}),url:h.jsx(Hn,{errorText:k(O.ERROR_URL_IS_REQUIRED),inputMode:"url",label:k(O.AUDIO_FILE),name:s,onChange:t,placeholder:k(O.ENTER_URL),valid:i,value:l})}[s];return h.jsx(h.Fragment,{children:u})},yA=[{field:"stereo",subtitle:O.STEREO_SUBTITLE,title:O.STEREO},{field:"beep",subtitle:O.BEEP_SUBTITLE,title:O.BEEP}],sy=({handleOnUpdate:e,nodeData:t,type:n})=>{const{validateField:s}=It("record"),[i,l]=b.useState({beep:!0,endSilenceTimeout:t.initial||s("endSilenceTimeout",t.endSilenceTimeout),format:!0,initialTimeout:t.initial||s("initialTimeout",t.initialTimeout),maxLength:t.initial||s("maxLength",t.maxLength),stereo:!0,terminators:t.initial||s("terminators",t.terminators)});t.format||e({format:"mp3"});const c=f=>{const p=f.target.name;e({[p]:!t[p]})},u=f=>{const p=f.target,{name:m,value:y}=p;switch(m){case"endSilenceTimeout":case"format":case"initialTimeout":case"maxLength":case"terminators":l({...i,[m]:s(m,y)}),e({initial:!1,[m]:y});break;default:throw new Error(`Unhandled input name: ${m}`)}};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-2",children:yA.map(f=>{const p=t[f.field];return h.jsx("div",{children:h.jsx(Cl,{checked:p,clickHandler:c,name:f.field,subtitle:k(f.subtitle),title:k(f.title)})},f.field)})}),h.jsxs("label",{className:"mb-2 block",children:[k(O.TERMINATORS),h.jsx("span",{className:"block text-xxs text-foreground/50",children:k(O.SEPARATE_WITH_COMMAS)}),h.jsx("input",{className:`w-full ${i.terminators?"":"invalid"}`,name:"terminators",onChange:u,placeholder:"#*0",type:"text",value:t.terminators}),h.jsx("p",{className:"requirements",role:"alert",children:k(O.ERROR_TERMINATORS)})]}),n==="voicemail"&&h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:k(O.MAXIMUM_RECORDING_LENGTH)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.maxLength?"":"invalid"}`,inputMode:"numeric",min:Wo.MIN,max:Wo.MAX,name:"maxLength",onChange:u,placeholder:k(O.SECONDS),type:"number",value:t.maxLength}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Wo.MAX,min:Wo.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:k(O.INITIAL_TIMEOUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.initialTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"initialTimeout",onChange:u,placeholder:k(O.SECONDS),type:"number",value:t.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:k(O.END_SILENCE_TIMEOUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.endSilenceTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"endSilenceTimeout",onChange:u,placeholder:k(O.SECONDS),type:"number",value:t.endSilenceTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]})]}),h.jsxs(Tn,{className:"w-full",label:k(O.FORMAT),name:"format",onChange:u,value:t.format,children:[h.jsx("option",{value:"mp3",children:"MP3"}),h.jsx("option",{value:"wav",children:"WAV"})]})]})},_t=({children:e,formRef:t,handleOnChange:n=()=>null,title:s})=>h.jsxs("div",{className:"flex flex-col overflow-hidden","data-testid":"cfb__settings",children:[h.jsxs("div",{className:"flex w-full items-center justify-start gap-x-2 px-4 pb-3",children:[h.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-focus/30 text-primary",children:h.jsx(Ce,{tag:"circle-small"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-xs font-semibold",children:s})})]}),h.jsx("form",{className:"flex h-full flex-col overflow-hidden text-xs",noValidate:!0,onChange:n,ref:t,children:h.jsx("div",{className:"flex-1 overflow-y-auto pt-1 pb-4",children:e})})]}),EA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("aiAgent"),[s,i]=b.useState({agent:e.initial||n("agent",e.agent)}),l=On(w=>w.aiAgentMap.values()),c=On(w=>w.error),u=On(w=>w.status),{fetchAiAgents:f}=mC();b.useEffect(()=>{f()},[f]);const p=Array.from(l),m=u==="loading",y=!!c||u==="error",E=y||u==="initial",x=w=>{const S=w.target,{name:N,value:R}=S;i({...s,[N]:n(N,R)}),t({initial:!1,[N]:R})},_=b.useId();return h.jsx(_t,{title:k(O.AI_AGENT),children:h.jsx("div",{className:"mx-3",children:!y&&p.length?h.jsxs("div",{className:"relative",children:[h.jsxs(Tn,{id:_,className:`${s.agent?"":"invalid"}`,disabled:E,label:k(O.AI_AGENT_NAME),name:"agent",onChange:x,value:e.agent,children:[h.jsx("option",{value:"",children:k(O.SELECT)}),p.map(w=>h.jsx("option",{value:w.id,children:w.display_name},w.id))]}),h.jsx(iy,{className:"absolute top-0 right-0 mx-1",handleClickResync:f,isLoading:m}),e.agent&&h.jsx("p",{children:h.jsx(ly,{agent:e.agent,mode:"edit",className:"mb-2",children:k(O.EDIT_SELECTED_AI_AGENT)})})]}):h.jsxs("div",{className:"flex items-end justify-between",children:[h.jsx("p",{role:"alert",className:"text-negative",children:y?h.jsx(h.Fragment,{children:k(O.ERROR_FETCHING_AI_AGENTS)}):h.jsxs(h.Fragment,{children:[k(O.ERROR_ADD_AI_AGENT_FIRST),h.jsx(ly,{mode:"add",className:"mt-2 block",children:k(O.ADD_AI_AGENT)})]})}),h.jsx(iy,{className:"mx-1",handleClickResync:f,isLoading:m})]})})})},iy=({className:e="",isLoading:t,handleClickResync:n})=>h.jsx(yr,{placement:"bottom-end",trigger:h.jsxs("button",{className:`overflow-hidden ${t?"text-disabled":""} ${e}`,disabled:t,onClick:n,type:"button",children:[h.jsx(Ce,{className:`${t?"animate-spin":""}`,tag:"arrows-rotate"}),h.jsx("span",{className:"sr-only",children:k(O.RESYNC_AI_AGENTS)})]}),children:h.jsx("p",{className:"text-sm",children:k(O.RESYNC_AI_AGENTS)})}),ly=({agent:e="",children:t,className:n="",mode:s})=>{const i={add:"",edit:`${e}/edit`};return h.jsx("a",{className:`w-fit text-foreground underline hover:text-foreground/80 ${n}`,href:`/ai_agents/${i[s]}`,target:"_blank",rel:"noopener noreferrer",children:t})},vA=["GET","POST","PUT","DELETE"],xA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("condRequest"),[s,i]=b.useState({body:e.initial||n("body",e.body),headers:e.initial||n("headers",e.headers),method:e.initial||n("method",e.method),saveVariables:e.initial||n("saveVariables",e.saveVariables),url:e.initial||n("url",e.url)}),l=f=>{const p=f.target,{name:m,value:y}=p;switch(t({initial:!1}),m){case"url":case"method":i({...s,[m]:n(m,y)}),t({[m]:y});break;case"headers":i({...s,[m]:n(m,y)}),t({[m]:y});break;case"body":i({...s,[m]:n(m,y)}),t({[m]:y});break;default:throw new Error(`Unhandled input name: ${m}`)}},c=f=>{const{name:p,value:m}=f.target;t({[p]:m})},u=f=>{const{name:p}=f.target,m=!e[p];t({[p]:m})};return h.jsxs(_t,{title:k(O.REQUEST),children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[k(O.URL),h.jsx("input",{className:`w-full ${s.url?"":"invalid"}`,name:"url",onChange:l,placeholder:"https://u:p@example.com/api/status",type:"text",value:e.url}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(Tn,{className:"w-full",label:k(O.METHOD),name:"method",onChange:c,value:e.method,children:vA.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Cl,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:k(O.SAVE_VARIABLES_SUBTITLE),title:k(O.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.REQUEST_HEADERS),name:"headers",onChange:l,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.headers,value:e.headers})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.REQUEST_BODY),name:"body",onChange:l,placeholder:k(O.STRING_OR_JSON),valid:s.body,value:e.body??""})})]}),h.jsx(Ju,{nodeData:e,handleOnUpdate:t})]})},SA=({nodeData:e,handleOnUpdate:t})=>{const n=b.useRef();return h.jsx(_t,{formRef:n,title:k(O.CONDITIONS),children:h.jsx("div",{children:h.jsx(Ju,{nodeData:e,handleOnUpdate:t})})})},_A=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("executeSWML"),[s,i]=b.useState({dest:e.initial||n("dest",e.dest),meta:e.initial||n("meta",e.meta),params:e.initial||n("params",e.params)}),l=c=>{const u=c.target,{name:f,value:p}=u;switch(t({initial:!1}),f){case"dest":case"params":case"meta":i({...s,[f]:n(f,p)}),t({[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsxs(_t,{title:k(O.EXECUTE_SWML),children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[k(O.URL),h.jsx("input",{className:`w-full ${s.dest?"":"invalid"}`,name:"dest",onChange:l,placeholder:"https://u:p@test.com/go.swml",type:"text",value:e.dest}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.PARAMS),name:"params",onChange:l,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.params,value:e.params??""})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.META),name:"meta",onChange:l,placeholder:k(O.JSON_OBJECT),valid:s.meta,value:e.meta??""})})]}),h.jsx(Ju,{nodeData:e,handleOnUpdate:t,placeholder:"return_value === '1'"})]})},ay=(e,t)=>{b.useEffect(()=>{var i;const n=(i=e.current)==null?void 0:i.getRootNode(),s=l=>{var u;const c=l.target;c instanceof Node&&!((u=e.current)!=null&&u.contains(c))&&t(l)};return n&&n.addEventListener("pointerdown",s),()=>{n&&n.removeEventListener("pointerdown",s)}},[e,t])},ed=e=>{const[t,n]=b.useReducer((s,i)=>({...s,...i}),e);return[t,n]},wA=Qe(),NA=({enable:e,searchParams:t})=>{const n=zn(y=>y.results),s=zn(y=>y.status),i=zn(y=>y.error),{buildParamsFromQuery:l,buildQueryFromParams:c,getCachedResults:u,fetchSwmlScript:f,setResults:p}=Qg(),m=c(t);return b.useEffect(()=>{if(!e)return;const y=u(m);y&&p(y);const E=l(m),x=setTimeout(()=>{f(E).catch(_=>{wA.error("Error fetching swml scripts",_)})},Im);return()=>clearTimeout(x)},[l,c,e,f,u,m,p]),[n,s,i]},td=e=>e==="external",RA={externalValue:"",focusedId:"",focusedName:"",open:!1,query:""},TA=({confirmId:e,confirmName:t,confirmUrl:n,onChange:s,valid:i})=>{var Q;const l={displayName:k(O.EXTERNAL_URL),id:"external"},c=b.useRef(null),u=b.useRef(null),f=b.useRef(null),p=b.useRef({}),m=b.useId(),y=b.useId(),E=b.useId(),[x,_]=ed({...RA,externalValue:td(e)?n:"",query:t??""}),w=td(e),S=x.query===""||x.query.toLocaleLowerCase()===t.toLocaleLowerCase(),[N,R]=NA({enable:x.open&&!x.focusedName,searchParams:{name:S?"":x.query}}),P=[{displayName:k(O.EXTERNAL_URL),id:l.id},...N],C=S?P:N,I=()=>_({focusedId:"",focusedName:""}),L=oe=>{_({open:!0,query:oe.target.value}),I()},U=oe=>{_({externalValue:oe.target.value}),s({connectConfirmDisplayName:l.displayName,connectConfirmId:l.id,connectConfirmUrl:oe.target.value})},G=()=>{_({focusedId:e,open:!0}),q()},X=()=>{_({open:!1}),I()},H=()=>x.open?X():G(),q=()=>{var oe;(oe=u.current)==null||oe.focus()},ee=oe=>{const re=jm(P,"id",oe);_({query:re.displayName});const le=ue=>"requestUrl"in ue?ue.requestUrl:x.externalValue;s({connectConfirmDisplayName:re.displayName,connectConfirmId:re.id,connectConfirmUrl:le(re)}),X()},z=oe=>{q(),ee(oe)},A=oe=>{const re=x.focusedId||e||"",le=i1(oe,re,C),ue=le&&p.current[le==null?void 0:le.id];if(ue){ue==null||ue.focus({preventScroll:!0}),ue==null||ue.scrollIntoView({block:"nearest"});const fe=jm(P,"id",ue.id);_({focusedId:fe.id,focusedName:fe.displayName}),u.current&&(u.current.value=fe.displayName)}else q();x.open||G()},F=()=>{p.current[x.focusedId]&&ee(x.focusedId)},$=()=>{x.query!==t&&_({query:t}),X()},Y=oe=>{const{key:re}=oe;switch(re){case"ArrowDown":case"ArrowUp":oe.preventDefault(),A(re),q();break;case"Enter":oe.preventDefault(),F();break;case"Escape":oe.preventDefault(),$();break}};b.useEffect(()=>{w&&f.current&&f.current.focus()},[w]),ay(c,X);const M=x.open&&!C.length,V=R==="loading"&&M,B=R==="error",D=t&&e===""&&n==="";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`relative mb-2 block ${B?"after:border-t-foreground/40":"after:border-t-foreground"}`,ref:c,children:[h.jsx("label",{className:"block pb-1 font-medium",id:y,htmlFor:m,children:k(O.HANDLE_VIA)}),h.jsxs("div",{className:"relative pb-1",children:[h.jsx("input",{"aria-activedescendant":x.open?x.focusedId:void 0,"aria-invalid":M,"aria-autocomplete":"list","aria-controls":x.open?m:void 0,"aria-expanded":x.open,"aria-labelledby":y,autoComplete:"off",className:`${B||D?"invalid":""} rounded-md border border-foreground !p-2 !pr-8`,disabled:B,onChange:L,onClick:G,onKeyDown:Y,placeholder:x.open?k(O.SEARCH_FOR_INTERNAL_SCRIPT):k(O.EXTERNAL_OR_INTERNAL_RESOURCE),ref:u,role:"combobox",type:"text",value:x.focusedName||x.query}),h.jsxs("button",{"aria-controls":x.open?m:void 0,"aria-expanded":x.open,"aria-haspopup":"listbox","aria-labelledby":`${y} ${E}`,className:`${x.open?"after:rotate-180":"after:rotate-0"} chevron-down absolute inset-y-0 right-0 px-4 after:transition-transform focus-within:!ring-0 focus-within:!ring-offset-0`,disabled:B,id:E,onClick:H,tabIndex:-1,type:"button",children:[V&&h.jsx(Ce,{className:"absolute top-3 right-7 animate-spin",tag:"arrows-rotate",size:"xs"}),h.jsx("span",{className:"sr-only",children:k(x.open?O.TOGGLE_CLOSE:O.TOGGLE_OPEN)})]}),h.jsxs("p",{className:"requirements w-full",role:"alert",children:[D&&k(O.SCRIPT_NOT_FOUND),B&&k(O.ERROR_FETCHING_SWML_SCRIPTS)]})]}),!B&&x.open&&h.jsx("ul",{className:"max-h-60 w-full overflow-auto rounded shadow-[0px_2px_6px_2px_rgba(0,0,0,0.15),_0px_1px_2px_0px_rgba(0,0,0,0.30)]","aria-labelledby":y,id:m,role:"listbox",onKeyDown:Y,children:C.length?h.jsxs(h.Fragment,{children:[C.length===1&&td((Q=C==null?void 0:C[0])==null?void 0:Q.id)&&(R==="loaded"||R==="loading")&&h.jsx(nd,{displayName:k(R==="loading"?O.STATUS_LOADING:O.NO_SCRIPTS_FOUND)}),C.map(({displayName:oe,id:re},le)=>{const ue=e===re,fe=x.focusedId?x.focusedId===re:le===0;return h.jsx(nd,{active:ue,focus:fe,displayName:oe,handleOnClick:()=>z(re),id:re,ref:de=>p.current[re]=de},re)})]}):h.jsx(nd,{displayName:k(V?O.STATUS_LOADING:O.NO_RESULTS)})})]}),w&&h.jsxs("label",{className:"mb-2 block",children:[h.jsx("span",{className:"sr-only",children:k(O.EXTERNAL_OPTION_LABEL)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i?"":"invalid"}`,inputMode:"url",name:"connectConfirmUrl",onChange:U,placeholder:k(O.ENTER_URL),ref:f,type:"url",value:x.externalValue}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_URL_IS_REQUIRED)})]})]}),!N.length&&!w&&h.jsx("div",{className:"mb-2",children:h.jsx("p",{children:h.jsx(OA,{children:k(O.ADD_SWML_SCRIPTS)})})})]})},nd=b.forwardRef(function({active:t,displayName:n,focus:s,handleOnClick:i,id:l},c){const u=!!i,f=u?`cursor-pointer transition-colors hover:bg-primary/5 focus:bg-primary/5 aria-selected:bg-primary/20 ${s?"bg-primary/5":""}`:"";return h.jsx("li",{"aria-selected":t,className:`relative select-none bg-background py-1 px-3 text-xs leading-6 ${f}`,id:l,onClick:i,ref:c,role:u?"option":"presentation",tabIndex:-1,children:n})}),OA=({children:e,className:t=""})=>h.jsx("a",{className:`w-fit text-foreground underline hover:text-foreground/80 ${t}`,href:"/relay-bins",target:"_blank",rel:"noopener noreferrer",children:e}),CA=({confirmId:e,confirmName:t,confirmUrl:n,enabled:s,handleOnChange:i,onCheck:l,valid:c})=>{const u=b.useId(),{validateCache:f}=Qg();return b.useEffect(()=>{s&&f()},[s,f]),h.jsxs(h.Fragment,{children:[h.jsx(Cl,{"aria-controls":u,"aria-expanded":s,checked:s,clickHandler:l,name:"connectConfirmEnabled",subtitle:k(O.SWML_TO_EXECUTE),title:k(O.ENABLE_WHISPER)}),s&&h.jsx("div",{id:u,children:h.jsx(TA,{onChange:i,confirmId:e,confirmName:t,confirmUrl:n,valid:c})})]})},AA={forwardAddress:{add:O.ADD_ADDRESS,call:O.CALL_ADDRESSES,optionNumber:O.ADDRESS_NUMBER,remove:O.REMOVE_ADDRESS,title:O.FORWARD_TO_ADDRESS},forwardPhone:{add:O.ADD_PHONE_NUMBER,call:O.CALL_NUMBERS,optionNumber:O.PHONE_NUMBER_NUMBER,remove:O.REMOVE_PHONE_NUMBER,title:O.FORWARD_TO_PHONE},forwardResource:{add:O.ADD_RESOURCE,call:O.CALL_RESOURCES,optionNumber:O.RESOURCE_NUMBER,remove:O.REMOVE_RESOURCE,title:O.FORWARD_TO_RESOURCE}},cy={parallel:O.SIMULTANEOUSLY,serial:O.SEQUENTIALLY},IA=()=>({connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:Le()}),rd=({nodeType:e,nodeData:t,handleOnUpdate:n})=>{var P,C,I;const{validateField:s}=It(e),i=b.useRef(),[l,c]=b.useState(["serial","parallel"].includes(t.callOrder)?t.callOrder:"serial"),u=AA[e],[f,p]=b.useState({callOrder:t.initial||s("callOrder",l),callStateEvents:t.initial||s("callStateEvents",l),callStateUrl:t.initial||s("callStateUrl",l),connections:(P=t.connections)==null?void 0:P.map(L=>({connectConfirmId:s("connectConfirmId",L.connectConfirmId),connectConfirmUrl:s("connectConfirmUrl",L.connectConfirmUrl),connectFrom:s("connectFrom",L.connectFrom),connectTimeout:s("connectTimeout",L.connectTimeout),connectTo:s("connectTo",L.connectTo),initial:t.initial})),defaultFrom:t.initial||s("defaultFrom",t.defaultFrom),defaultTimeout:t.initial||s("defaultTimeout",t.defaultTimeout)}),m=L=>{L.preventDefault(),p({...f,connections:[...f.connections,{connectConfirmId:!0,connectConfirmUrl:!0,connectFrom:!0,connectTimeout:!0,connectTo:!0,initial:!0}]}),n({callOrder:l,connections:[...t.connections,IA()]})},y=L=>U=>{U.preventDefault();const G=[...f.connections];G.splice(L,1),p({...f,connections:G});const X=[...t.connections];X.splice(L,1),n({callOrder:X.length===1?"single":l,connections:X})},E=(L,U,G)=>{const X=[...t.connections],H=X[L];if(!H)throw new Error(`Option not found at index ${L}`);const q=U==null?void 0:U.name,ee=U==null?void 0:U.value,A={...q?{[q]:ee}:{},...G,id:H.id},F=[...f.connections],$=Object.keys(A).reduce((V,B)=>{const D=A[B],Q=B;return V[Q]=s(B,D),V},{initial:!1}),Y=F.map((V,B)=>B===L?{...V,...$}:V);p({...f,connections:Y});const M=X.map(V=>V.id===A.id?{...V,...A}:V);n({connections:M,initial:!1})},x=L=>{const U=L.currentTarget.value;c(U),n({callOrder:U})},_=(L,U)=>{E(L,void 0,U)},w=(L,U)=>{_(L,{connectConfirmEnabled:U})},S=L=>U=>_(L,{...U}),N=(L,U)=>{const G=L.target,{name:X,value:H}=G;switch(X){case"callStateEvents":case"callStateUrl":case"defaultTimeout":case"defaultFrom":p({...f,[X]:s(X,H)}),n({initial:!1,[X]:H});break;case"connectFrom":case"connectTimeout":case"connectTo":if(U===void 0)throw new Error(`Option index not provided: ${X}`);E(U,{name:X,value:H});break;default:throw new Error(`Unhandled input name: ${X}`)}},R=({index:L,name:U})=>{const G=f.connections[L];return!!(G!=null&&G[U]||G!=null&&G.initial)};return h.jsxs(_t,{title:k(u.title),formRef:i,children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3 pb-3",children:[h.jsxs("label",{className:"mb-2 block",children:[k(O.DEFAULT_FROM),h.jsx(Ks,{className:"w-full",direction:"from",name:"defaultFrom",onChange:N,placeholder:k(O.FROM),type:"tel",value:t.defaultFrom,valid:f.defaultFrom}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.DEFAULT_TIMEOUT),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${f.defaultTimeout?"":"invalid"}`,inputMode:"numeric",min:0,name:"defaultTimeout",onChange:N,placeholder:k(O.SECONDS),type:"number",value:t.defaultTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.CALL_STATE_URL),h.jsx("input",{className:`w-full ${f.callStateUrl?"":"invalid"}`,name:"callStateUrl",onChange:N,placeholder:"https://example.com/api",type:"url",value:t.callStateUrl}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.CALL_STATE_EVENTS),h.jsx("input",{className:`w-full ${f.callStateEvents?"":"invalid"}`,name:"callStateEvents",onChange:N,placeholder:"Created, ringing, answered, ended",type:"text",value:t.callStateEvents}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]})]}),h.jsx("ul",{className:"border-foreground-10 divide-y-4 divide-foreground/10 border-b-4 pt-2",children:(C=t.connections)==null?void 0:C.map((L,U,G)=>h.jsx("li",{className:"flex flex-col gap-y-2 px-4",children:h.jsxs("fieldset",{children:[h.jsxs("div",{className:"item-center flex justify-between py-4",children:[h.jsxs("legend",{children:[h.jsx(Ce,{className:"pr-2 text-foreground/60",size:"xs",tag:"bars"}),h.jsx("span",{className:"text-xs font-semibold",children:k(u.optionNumber,{index:U+1})})]}),G.length>1&&h.jsx(Uo,{handleDelete:y(U),label:k(u.remove,{index:U+1}),size:"sm",show:!0})]}),h.jsxs("label",{className:"mb-1 block pl-2",children:[h.jsx("div",{className:"sr-only",children:k(O.TO)}),h.jsx(Ks,{className:"w-full",direction:"to",name:"connectTo",onChange:X=>N(X,U),type:e==="forwardPhone"?"tel":"text",valid:R({index:U,name:"connectTo"}),value:L.connectTo}),h.jsx("p",{className:"requirements",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[h.jsx("div",{className:"sr-only",children:k(O.FROM)}),h.jsx(Ks,{className:"w-full",direction:"from",name:"connectFrom",onChange:X=>N(X,U),placeholder:k(O.FROM),type:"text",valid:R({index:U,name:"connectFrom"}),value:L.connectFrom}),h.jsx("p",{className:"requirements",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[k(O.TIMEOUT),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`${R({index:U,name:"connectTimeout"})?"":"invalid"}`,inputMode:"numeric",min:0,name:"connectTimeout",onChange:X=>N(X,U),placeholder:k(O.SECONDS),type:"number",value:L.connectTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsx("div",{className:"mb-2 block pl-2",children:h.jsx(CA,{confirmId:L.connectConfirmId,confirmName:L.connectConfirmDisplayName,confirmUrl:L.connectConfirmUrl,enabled:L.connectConfirmEnabled,handleOnChange:S(U),onCheck:()=>w(U,!L.connectConfirmEnabled),valid:R({index:U,name:"connectConfirmUrl"})&&R({index:U,name:"connectConfirmId"})})})]})},L.id))}),h.jsx("div",{className:"p-3 pb-6 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:m,type:"button",children:k(u.add)})}),((I=t.connections)==null?void 0:I.length)>1&&h.jsx("div",{className:"mb-4 px-3",children:h.jsx(Tn,{className:"w-full",label:k(u.call),name:"callOrder",onChange:x,value:l,children:Object.keys(cy).map(L=>h.jsx("option",{value:L,children:k(cy[L])},L))})})]})},bA=()=>({command:"",digit:"",id:Le()}),LA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("promptPlay"),s=b.useRef(),[i,l]=b.useState({digitTimeout:e.initial||n("digitTimeout",e.digitTimeout),initialTimeout:e.initial||n("initialTimeout",e.initialTimeout),options:e.options.map(x=>({command:n("command",x.command),digit:n("digit",x.digit),initial:e.initial}))}),c=Er(e.options,"command"),u=Er(e.options,"digit"),f=x=>{x.preventDefault(),l({...i,options:[...i.options,{command:!0,digit:!0,initial:!0}]}),t({options:[...e.options,bA()]})},p=x=>_=>{_.preventDefault();const w=[...i.options];w.splice(x,1),l({...i,options:w});const S=[...e.options];S.splice(x,1),t({options:S})},m=(x,_)=>{const w=[...e.options];if(!w[x])throw new Error(`Option not found at index ${x}`);const{name:S,value:N}=_,R=[...i.options];R[x]={...R[x],initial:!1,[S]:n(S,N)},l({...i,options:R}),w[x]={...w[x],[S]:N},t({options:w})},y=(x,_)=>{const w=x.target,{name:S,value:N}=w;switch(t({initial:!1}),S){case"digit":case"command":_!==void 0&&m(_,{name:S,value:N});break;case"digitTimeout":case"initialTimeout":{l({...i,[S]:n(S,N)}),t({[S]:N});break}default:throw new Error(`Unhandled input field name: ${S}`)}},E=({index:x,name:_})=>{var N;const w=i.options[x];if(w!=null&&w.initial)return!0;if(!(w!=null&&w[_]))return!1;const S=(N=e.options)==null?void 0:N[x];return Vt(S==null?void 0:S.digit)||Vt(S==null?void 0:S.command)};return h.jsxs(_t,{formRef:s,title:k(O.GATHER_INPUT),children:[h.jsx("div",{className:"border-b-4 border-foreground/10 px-3 pb-3",children:h.jsx(oy,{handleOnUpdate:t,label:k(O.CHOOSE_OPTION_TTS_AUDIO),nodeData:e})}),h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.options.map((x,_,w)=>{const S=c(x.command),N=u(x.digit);return h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[w.length>1&&h.jsx(Uo,{className:"absolute right-0 top-0",handleDelete:p(_),label:k(O.REMOVE_OPTION,{index:_+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:k(O.OPTION_NUMBER,{index:_+1})}),h.jsxs("label",{className:"mb-2 block",children:[k(O.CALLER_PRESSES),h.jsx("input",{className:`${E({index:_,name:"digit"})&&!N?"":"invalid"}`,name:"digit",onChange:R=>y(R,_),placeholder:k(O.KEYPAD_VALUE),type:"text",value:x.digit}),h.jsx("p",{className:"requirements",role:"alert",children:k(N?O.ERROR_DUPLICATE_TELEPHONE_KEY:O.ERROR_TELEPHONE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.OR_SAYS),h.jsx("input",{className:`w-full ${E({index:_,name:"command"})&&!S?"":"invalid"}`,name:"command",onChange:R=>y(R,_),placeholder:k(O.SPOKEN_PROMPT),type:"text",value:x.command}),h.jsx("p",{className:"requirements",role:"alert",children:k(S?O.ERROR_DUPLICATE_COMMAND:O.ERROR_TEXT_IS_REQUIRED)})]})]})]})]},x.id)})}),h.jsx("div",{className:"p-3 pb-6 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:f,type:"button",children:k(O.ADD_OPTION)})}),h.jsxs("div",{className:"px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:k(O.WAIT_FOR_INPUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.initialTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"initialTimeout",onChange:y,placeholder:k(O.SECONDS),type:"number",value:e.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]}),h.jsxs("label",{children:[h.jsx("div",{className:"w-full",children:k(O.WAIT_FOR_DIGIT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.digitTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"digitTimeout",onChange:y,placeholder:k(O.SECONDS),type:"number",value:e.digitTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]})]})]})},DA=({handleOnUpdate:e,nodeData:t})=>{const{validateField:n}=It("play"),[s,i]=b.useState({reason:t.initial||n("reason",t.reason)}),l=c=>{const u=c.target,{name:f,value:p}=u;switch(f){case"reason":i({...s,[f]:n(f,p)}),e({initial:!1,[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsx(_t,{title:k(O.HANG_UP_CALL),children:h.jsx("div",{className:"mx-3",children:h.jsxs(Tn,{className:"w-full",label:`${k(O.REASON)} (${k(O.OPTIONAL)})`,name:"reason",onChange:l,value:t.reason,children:[h.jsx("option",{value:"",children:k(O.SELECT)}),Object.keys(qu).map(c=>h.jsx("option",{value:c,children:k(qu[c])},c))]})})})},kA=({nodeData:e,handleOnUpdate:t})=>{const n=b.useRef();return h.jsx(_t,{formRef:n,title:k(O.PLAY_AUDIO_TTS),children:h.jsx("div",{className:"mx-3",children:h.jsx(oy,{handleOnUpdate:t,label:k(O.CHOOSE_OPTION_TTS_AUDIO),nodeData:e,showDefaultOption:!0})})})},PA=({nodeData:e,handleOnUpdate:t})=>{const n=b.useRef(),{validateField:s}=It("recordCallStart"),[i,l]=b.useState({label:e.initial||s("label",e.label)}),[c,u]=b.useState(!1),{upsertEntry:f,isValueDuplicate:p}=Hu();b.useEffect(()=>{u(p(e.label,e.controlId))},[p,e.controlId,e.label]);const m=y=>{const E=y.target,{name:x,value:_}=E;l({...i,[x]:s(x,_)}),t({initial:!1,[x]:_}),f({controlId:e.controlId,label:_})};return h.jsxs(_t,{title:k(O.RECORD_CALL_START),formRef:n,children:[h.jsx("div",{className:"px-3 pb-3",children:h.jsxs("label",{children:[k(O.RECORDING_NAME),h.jsx("input",{className:`w-full ${i.label&&!c?"":"invalid"}`,name:"label",onChange:m,type:"text",value:e.label}),h.jsx("p",{className:"requirements",role:"alert",children:k(c?O.ERROR_DUPLICATE_RECORDING_LABEL:O.ERROR_RECORDING_LABEL_REQUIRED)})]})}),h.jsx("div",{className:"px-3",children:h.jsx(sy,{handleOnUpdate:t,nodeData:e,type:"call"})})]})},MA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("recordCallStop"),[s,i]=b.useState({controlId:e.initial||n("controlId",e.controlId)}),{getEntries:l}=Hu(),c=l().sort((f,p)=>f.label.toLowerCase().localeCompare(p.label.toLowerCase())),u=f=>{const p=f.target,{name:m,value:y}=p;i({...s,[m]:n(m,y)}),t({initial:!1,[m]:y})};return h.jsx(_t,{title:k(O.RECORD_CALL_STOP),children:h.jsx("div",{className:"px-3",children:c.length?h.jsxs(Tn,{className:`w-full ${s.controlId?"":"invalid"}`,label:k(O.RECORDING_NAME),name:"controlId",value:e.controlId,onChange:u,children:[h.jsx("option",{value:"",children:k(O.SELECT)}),c.map(f=>h.jsx("option",{value:f.controlId,children:f.label},f.controlId))]}):h.jsx("p",{role:"alert",className:"text-negative",children:k(O.ERROR_ADD_RECORDING_FIRST)})})})},jA=({nodeData:e,handleOnUpdate:t})=>h.jsx(_t,{title:k(O.VOICEMAIL_RECORDING),children:h.jsx("div",{className:"mx-3",children:h.jsx(sy,{handleOnUpdate:t,nodeData:e,type:"voicemail"})})}),UA=["GET","POST","PUT","DELETE"],FA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("request"),[s,i]=b.useState({body:e.initial||n("body",e.body),headers:e.initial||n("headers",e.headers),method:e.initial||n("method",e.method),saveVariables:e.initial||n("saveVariables",e.saveVariables),url:e.initial||n("url",e.url)}),l=f=>{const p=f.target,{name:m,value:y}=p;switch(t({initial:!1}),m){case"url":case"method":i({...s,[m]:n(m,y)}),t({[m]:y});break;case"headers":i({...s,[m]:n(m,y)}),t({[m]:y});break;case"body":i({...s,[m]:n(m,y)}),t({[m]:y});break;default:throw new Error(`Unhandled input name: ${m}`)}},c=f=>{const{name:p,value:m}=f.target;t({[p]:m})},u=f=>{const{name:p}=f.target,m=!e[p];t({[p]:m})};return h.jsx(_t,{title:k(O.REQUEST),children:h.jsxs("div",{className:"px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[k(O.URL),h.jsx("input",{className:`w-full ${s.url?"":"invalid"}`,name:"url",onChange:l,placeholder:"https://u:p@example.com/api/status",type:"text",value:e.url}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(Tn,{className:"w-full",label:k(O.METHOD),name:"method",onChange:c,value:e.method,children:UA.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Cl,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:k(O.SAVE_VARIABLES_SUBTITLE),title:k(O.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.REQUEST_HEADERS),name:"headers",onChange:l,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.headers,value:e.headers})}),h.jsx("label",{children:h.jsx(Hn,{errorText:k(O.ERROR_INVALID_JSON),inputMode:"text",label:k(O.REQUEST_BODY),name:"body",onChange:l,placeholder:k(O.STRING_OR_JSON),valid:s.body,value:e.body??""})})]})})},VA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:n}=It("sendSms"),[s,i]=b.useState({body:e.initial||n("body",e.body),fromNumber:e.initial||n("fromNumber",e.fromNumber),toNumber:e.initial||n("toNumber",e.toNumber)}),l=c=>{const u=c.target,{name:f,value:p}=u;switch(f){case"body":case"fromNumber":case"toNumber":i({...s,[f]:n(f,p)}),t({initial:!1,[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsx(_t,{title:k(O.SEND_SMS),children:h.jsxs("div",{className:"mx-3",children:[h.jsxs("label",{className:"mb-2 block",children:[k(O.TO_PHONE_NUMBER),h.jsx(Ks,{className:"w-full",direction:"to",name:"toNumber",onChange:l,placeholder:"+12405550000",type:"tel",valid:s.toNumber,value:e.toNumber}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.FROM_PHONE_NUMBER),h.jsx(Ks,{className:"w-full",direction:"from",name:"fromNumber",onChange:l,placeholder:"+12405550000",type:"tel",valid:s.fromNumber,value:e.fromNumber}),h.jsx("p",{className:"requirements w-full",role:"alert",children:k(O.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{children:h.jsx(Hn,{errorText:k(O.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:k(O.SMS_TEXT),name:"body",onChange:l,placeholder:k(O.WRITE_SOMETHING),valid:s.body,value:e.body})})]})})},$A=()=>({id:Le(),key:"",value:""}),HA=({nodeData:e,handleOnUpdate:t})=>{var y;const{validateField:n}=It("set"),[s,i]=b.useState({variables:e.variables.map(E=>({key:e.initial||n("key",E.key),value:e.initial||n("value",E.value)}))}),l=Er(e.variables,"key"),c=E=>{E==null||E.preventDefault(),i({...s,variables:[...s.variables,{key:!0,value:!0}]}),t({variables:[...e.variables,$A()]})},u=(E,x)=>{const _=[...e.variables];let w=_[E];if(!w)throw new Error(`Variable not found at index ${E}`);const{name:S,value:N}=x,R=[...s.variables];R[E]={...R[E],[S]:n(S,N)},i({...s,variables:R}),w={..._[E],[S]:N},_[E]=w,t({initial:!1,variables:_})},f=E=>x=>{x.preventDefault();const _=[...s.variables];_.splice(E,1),i({...s,variables:_});const w=[...e.variables];w.splice(E,1),t({variables:w})},p=(E,x)=>{const _=E.target,{name:w,value:S}=_;switch(w){case"key":case"value":x!==void 0&&u(x,{name:w,value:S});break;default:throw new Error(`Unhandled input name: ${w}`)}},m=({index:E,name:x})=>{const _=s.variables[E];return _==null?void 0:_[x]};return h.jsxs(_t,{title:k(O.SET_VARIABLES),children:[h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:(y=e.variables)==null?void 0:y.map((E,x,_)=>{const w=l(E.key);return h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[_.length>1&&h.jsx(Uo,{className:"absolute right-0 top-0",handleDelete:f(x),label:k(O.REMOVE_VARIABLE,{index:x+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:k(O.VARIABLE_NUMBER,{index:x+1})}),h.jsxs("label",{className:"mb-2 block",children:[k(O.KEY),h.jsx("input",{className:`w-full ${m({index:x,name:"key"})&&!w?"":"invalid"}`,name:"key",onChange:S=>p(S,x),type:"text",value:E.key}),h.jsx("p",{className:"requirements",role:"alert",children:k(w?O.ERROR_DUPLICATE_VARIABLE_KEY:O.ERROR_VARIABLE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[k(O.VALUE),h.jsx("input",{className:`w-full ${m({index:x,name:"value"})?"":"invalid"}`,name:"value",onChange:S=>p(S,x),type:"text",value:E.value}),h.jsx("p",{className:"requirements",role:"alert",children:k(O.ERROR_TEXT_IS_REQUIRED)})]})]})]})]},E.id)})}),h.jsx("div",{className:"p-3 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:c,type:"button",children:k(O.ADD_VARIABLE)})})]})},BA=e=>({id:Le(),key:e}),zA=({nodeData:e,handleOnUpdate:t})=>{const l={currentFocus:void 0,listOpen:!1,setVariablesList:Ee(S=>S.nodes).reduce((S,N)=>{if(N.type==="set"){const R=N.data.variables.map(P=>({id:P.id,key:P.key}));return[...S,...R]}else if(N.type==="unset")return[...S,...N.data.variables];return S},[]).reduce((S,N)=>(S.find(R=>R.key===N.key)||S.push(N),S),[]).map(S=>({...S,selected:!!e.variables.find(N=>N.key===S.key)})).sort((S,N)=>S.key.toLowerCase().localeCompare(N.key.toLowerCase()))},[c,u]=ed(l),f=S=>c.setVariablesList.map(N=>N.id===S?{...N,selected:!N.selected}:N),p=S=>{const N=c.setVariablesList.find(R=>R.id===S);if(!N)throw new Error("Variable not found");if(N.selected)m(N.id);else{const R=[...e.variables,BA(N.key)];u({setVariablesList:f(N.id)}),t({variables:R})}},m=S=>{const N=c.setVariablesList.filter(R=>R.selected&&R.id!==S);u({setVariablesList:f(S)}),t({variables:N})},y=b.useRef(null);ay(y,()=>u({listOpen:!1}));const E=S=>{(S.key==="Escape"||S.key==="Esc")&&u({listOpen:!1})},x=(S,N)=>{S.preventDefault(),(S.key===" "||S.code==="Space"||S.key==="Enter")&&p(N),E(S)},_=()=>{u({listOpen:!c.listOpen})},w=e.variables.length;return h.jsx(_t,{title:k(O.UNSET_VARIABLES),children:h.jsxs("div",{className:"px-3",children:[h.jsxs("div",{className:"mb-2 flex flex-col",children:[h.jsx("label",{id:"listbox-label",className:"sr-only",children:k(O.SELECT_VARIABLES_TO_UNSET)}),h.jsxs("div",{className:"relative",ref:y,children:[h.jsx("button",{"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"listbox-label",className:`relative w-full cursor-pointer rounded-md border border-foreground/10 bg-transparent py-1.5 px-3 text-left
64
- after:absolute after:top-[.725rem] after:right-3 after:h-0 after:w-0 after:border-[5px] after:border-t-[6px] after:border-b-0 after:border-r-transparent after:border-l-transparent after:border-t-foreground after:content-['']`,onClick:_,onKeyDown:E,type:"button",children:w>0?k(O.NUMBER_OF_VARIABLES_SELECTED,{count:w}):k(O.SELECT_VARIABLES)}),c.listOpen&&h.jsxs("ul",{"aria-activedescendant":c.currentFocus,"aria-labelledby":"listbox-label","aria-multiselectable":"true",className:"mt-1 max-h-60 w-full overflow-auto rounded-lg border border-foreground/10 bg-backgroundAlt py-1 shadow-xl",role:"listbox",children:[!c.setVariablesList.length&&h.jsx("li",{"aria-disabled":"true",className:"relative",role:"option",children:h.jsx("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:k(O.NO_VARIABLES_SET)})}),c.setVariablesList.map(S=>{if(S.key)return h.jsx("li",{"aria-selected":S.selected,className:"relative",id:S.id,role:"option",children:h.jsxs("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:[h.jsx("input",{checked:S.selected,className:"mr-2 h-4 w-4 rounded accent-primary",onChange:()=>p(S.id),onKeyDown:N=>x(N,S.id),type:"checkbox"}),S.key]})},S.id)})]})]})]}),w>0&&h.jsxs("section",{className:"pt-3",children:[h.jsx("h3",{className:"mb-2 text-xs font-medium text-foreground",children:k(O.UNSET_VARIABLES)}),h.jsx("ul",{className:"flex flex-wrap gap-2",children:c.setVariablesList.map(S=>S.selected&&h.jsx(HT,{handleClick:()=>m(S.id),children:S.key},S.id))})]})]})})},uy={aiAgent:({data:e,formUpdate:t})=>h.jsx(EA,{handleOnUpdate:t,nodeData:e}),cond:({data:e,formUpdate:t})=>h.jsx(SA,{handleOnUpdate:t,nodeData:e}),condRequest:({data:e,formUpdate:t})=>h.jsx(xA,{handleOnUpdate:t,nodeData:e}),executeSWML:({data:e,formUpdate:t})=>h.jsx(_A,{handleOnUpdate:t,nodeData:e}),forwardAddress:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardAddress"}),forwardPhone:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardPhone"}),forwardResource:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardResource"}),hangup:({data:e,formUpdate:t})=>h.jsx(DA,{handleOnUpdate:t,nodeData:e}),play:({data:e,formUpdate:t})=>h.jsx(kA,{handleOnUpdate:t,nodeData:e}),promptPlay:({data:e,formUpdate:t})=>h.jsx(LA,{handleOnUpdate:t,nodeData:e}),record:({data:e,formUpdate:t})=>h.jsx(jA,{handleOnUpdate:t,nodeData:e}),recordCallStart:({data:e,formUpdate:t})=>h.jsx(PA,{handleOnUpdate:t,nodeData:e}),recordCallStop:({data:e,formUpdate:t})=>h.jsx(MA,{handleOnUpdate:t,nodeData:e}),request:({data:e,formUpdate:t})=>h.jsx(FA,{handleOnUpdate:t,nodeData:e}),sendSms:({data:e,formUpdate:t})=>h.jsx(VA,{handleOnUpdate:t,nodeData:e}),set:({data:e,formUpdate:t})=>h.jsx(HA,{handleOnUpdate:t,nodeData:e}),unset:({data:e,formUpdate:t})=>h.jsx(zA,{handleOnUpdate:t,nodeData:e})},WA=(e,t)=>{if("options"in t)switch(e.type){case"promptPlay":case"cond":case"condRequest":return!0}return!1},GA=e=>{if(e in uy)return uy[e]},YA=()=>{var p;const{partialUpdateNodeData:e,removeNode:t}=Je(),n=Ee(m=>m.selectedNode),s=n==null?void 0:n.id,l=(p=Ee(m=>m.nodes).find(m=>m.id===s))==null?void 0:p.data,{updateDynamicHandles:c}=aA(n);if(!(n&&l&&s))return null;const u=m=>{WA(n,m)&&c(m),e(s,m)},f=GA(n.type);return f?h.jsxs(ks,{className:"nokey m-0 flex h-full w-[260px] flex-col overflow-hidden rounded-none border border-foreground/10 bg-background pt-4",position:"top-right",children:[h.jsx(f,{data:l,formUpdate:u},s),n.deletable!==!1&&h.jsx("div",{className:"border-t border-foreground/10 p-3",children:h.jsx(Uo,{handleDelete:()=>t(s),label:k(O.DELETE_NODE),show:!0,showLabel:!0})})]}):null},dy=b.forwardRef(function({animate:t=!0,children:n,className:s="",iconTag:i="circle-info",message:l,role:c="alertdialog",status:u},f){const m=u?{error:"bg-negative text-background",success:"bg-positive text-background"}[u]:"";return h.jsxs("div",{className:`flex items-center justify-between rounded-lg bg-foreground p-2
63
+ ${a}`})},tC=te.forwardRef(function(t,r){const{children:s,style:i,...a}=t,c=$u(),u=Lg([c.refs.setFloating,r]);return c.open?h.jsxs("div",{className:"relative max-w-md rounded-md bg-foreground p-2 text-sm text-background shadow-sm",ref:u,style:{left:c.x??0,position:c.strategy,top:c.y??0,visibility:c.x==null?"hidden":"visible",zIndex:10,...i},...c.getFloatingProps(a),children:[h.jsx("div",{className:"overflow-hidden",children:s}),h.jsx(eC,{})]}):null}),nC=b.forwardRef(function({children:t,asChild:r=!1,...s},i){const a=$u(),c=Lg([a.refs.setReference,i,t?.ref]);return r&&b.isValidElement(t)?b.cloneElement(t,a.getReferenceProps({ref:c,...s,...t.props,"data-state":a.open?"open":"closed"})):h.jsx("button",{ref:c,"data-state":a.open?"open":"closed",...a.getReferenceProps(s),children:t})}),Hg={bottom:"top",left:"right",right:"left",top:"bottom"},gr=({asChild:e=!0,children:t,enable:r=!0,placement:s="right",scale:i=1,trigger:a=h.jsx(Ce,{tag:"circle-info"}),...c})=>{let u=s.split("-")[0];return u=Object.keys(Hg).includes(u)?u:"right",r?h.jsxs(ZO,{...c,placement:s,children:[h.jsx(nC,{asChild:e,children:a}),h.jsx(tC,{style:i!==1?{transform:`scale(${i})`,transformOrigin:Hg[u]}:void 0,children:t})]}):h.jsx(h.Fragment,{children:a})},rC={ABOUT:"About",ACTION:"Action",ADD_ADDRESS:"Add address",ADD_AI_AGENT:"Add AI agent",ADD_CONDITION:"Add condition",ADD_OPTION:"Add option",ADD_PHONE_NUMBER:"Add phone number",ADD_RESOURCE:"Add resource",ADD_SWML_SCRIPTS:"Add SWML Scripts",ADD_VARIABLE:"Add variable",ADDRESS_NUMBER:"Address {{index}}",AI_AGENT:"AI Agent",AI_AGENT_NAME:"AI Agent Name",ANSWER_CALL:"Answer Call",ARE_YOU_SURE:"Are you sure?",AUDIO_FILE:"Audio File",BEEP:"Beep",BEEP_SUBTITLE:"Play a beep before recording",BUSY:"Busy",CALL_ADDRESSES:"Call Addresses",CALL_NUMBERS:"Call Numbers",CALL_RESOURCES:"Call Resources",CALL_STATE_EVENTS:"Call State Events",CALL_STATE_URL:"Call State URL",CALLER_PRESSES:"Caller presses",CALLER_SAYS:"Caller says",CANCEL:"Cancel",CAUTION:"Caution",CHOOSE_OPTION_TTS_AUDIO:"Choose how to play the message",CLOSE:"Close",CONDITION_NUMBER:"Condition {{index}}",CONDITIONS:"Conditions",DECISION:"Decision",DECLINE:"Decline",DEFAULT_FROM:"Default From",DEFAULT_TIMEOUT:"Default Timeout",DELETE:"Delete",DELETE_NODE:"Delete node",DEPLOY:"Deploy",DEPLOY_WARNING:"Caution - Confirm Deploy",DEPRECATED:"Deprecated",DOCUMENT_OUT_OF_SYNC:"Document Out of Sync",EDIT_SELECTED_AI_AGENT:"Edit Selected AI Agent",ELSE:"Else",END_SILENCE_TIMEOUT:"End Silence Timeout",ENABLE_WHISPER:"Enable Whisper",ENTER_URL:"Enter URL",ERROR:"Error",ERROR_ADD_AI_AGENT_FIRST:"Please add an AI Agent first.",ERROR_ADD_RECORDING_FIRST:"Please add a Start Call Recording node first.",ERROR_DUPLICATE_COMMAND:"This command is already used. Please use a unique phrase.",ERROR_DUPLICATE_RECORDING_LABEL:"This entry already exists. Please use a unique label.",ERROR_DUPLICATE_TELEPHONE_KEY:"This key is already used. Please use a unique key.",ERROR_DUPLICATE_VARIABLE_KEY:"This variable already exists. Please use a unique key.",ERROR_FETCHING_AI_AGENTS:"Error fetching AI Agents.",ERROR_FETCHING_DEPLOYED_VERSIONS:"Error fetching deployed versions.",ERROR_FETCHING_SWML_SCRIPTS:"Error fetching SWML Scripts.",ERROR_INVALID_JSON:"Invalid JSON",ERROR_NUMBER_IS_REQUIRED:"A number is required.",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"A number between {{min}} and {{max}} is required.",ERROR_RECORDING_LABEL_REQUIRED:"A value is required. Maximum 20 characters.",ERROR_SELECTION_REQUIRED:"A selection is required.",ERROR_TELEPHONE_KEY_REQUIRED:"A value of 0-9, *, or # is required.",ERROR_TERMINATORS:"This value should contain only 0-9, *, or #.",ERROR_TEXT_IS_REQUIRED:"A text value is required.",ERROR_URL_IS_REQUIRED:"A valid URL is required.",ERROR_VALUE_IS_REQUIRED:"A value is required.",ERROR_VARIABLE_KEY_REQUIRED:"Valid characters are lowercase letters, digits, or underscore. Maximum 20 characters.",EXTERNAL_OPTION_LABEL:"Enter the URL of the external resource.",EXTERNAL_OR_INTERNAL_RESOURCE:"External or Internal Resource",EXTERNAL_URL:"External URL",EXECUTE_SWML:"Execute SWML",FAILED:"Failed",FAILURE:"Failure",FLOW_DATA_VERSION:"Flow Data Version",FORMAT:"Format",FORWARD:"Forward",FORWARD_TO_ADDRESS:"Forward to Address",FORWARD_TO_PHONE:"Forward to Phone",FORWARD_TO_RESOURCE:"Forward to Resource",FROM:"From",FROM_PHONE_NUMBER:"From Phone Number",GATHER_INPUT:"Gather Input",GENDER:"Gender",GO_BACK:"Go Back",HANDLE_VIA:"Handle Via",HANDLE_CALL:"Handle Call",HANG_UP:"Hang Up",HANG_UP_CALL:"Hang Up Call",HELP:"Help",HIDDEN:"Hidden",IGNORE:"Ignore",INFO_DEPLOY:"Deploy the latest changes for the current call flow.",INFO_INVALID_SETTINGS:"Please check the settings and ensure that all required fields are filled in correctly.",INFO_NODE_AI_AGENT:"<p>Used to connect to a conversational AI Agent for processing.</p><p>Choose the appropriate AI Agent or create a new one: <a>AI Agents</a></p>",INFO_NODE_COND:`<p>A condition works like a JavaScript <code>if</code> statement.</p><p>A condition field can reference variables that have been set in the flow with <code>%{Key}</code>, Request node responses accessed with <code>%{request_response['object_field']}</code>, or call parameters such as <code>%{call.from}</code>.</p><p>Add additional conditions to create <code>else if</code> conditions.</p><p>The "Cond #" path will be executed for a truthy condition. The "Else" path will be executed for a falsy condition.</p>`,INFO_NODE_CONDREQUEST:"<p>Send a GET, POST, PUT, or DELETE request to any webhook.</p><p>This can be used to submit variables and information about an inbound call to an external server, or you can retrieve information from external servers and use them as variables throughout the call flow. You can also build conditions directly into this module.</p><p>Response variables can be accessed with <code>%{request_response['object_field']}</code>.</p><p>Headers should be input in JSON format. Valid header values are <code>Accept</code>, <code>Authorization</code>, <code>Content-Type</code>, <code>Range</code>, and <code>custom X- headers</code>.</p>",INFO_NODE_EXECUTE_SWML:"Execute a remote SWML document and return to the current document. Use <code>%{return_value.['object_field']}</code> to reference the return values from the external SWML.",INFO_NODE_FORWARD_TO_ADDRESS:"Forwards the current call to the specified Address as defined within your SignalWire space.",INFO_NODE_FORWARD_TO_PHONE:"Forwards the current call to the specified phone number (must be E.164 format).",INFO_NODE_FORWARD_TO_RESOURCE:"Forwards the current call to the specified Resource as defined within your SignalWire space.",INFO_NODE_GATHER_INPUT:"Plays an audio file or Text to Speech phrase and waits for a keypress or spoken input from the caller, allowing them to proceed through the call flow based on their input.",INFO_NODE_HANG_UP:"Ends the call with the ability to provide a reason (hangup, busy, or decline).",INFO_NODE_PLAY:"Plays an audio file or Text to Speech phrase. A valid URL must be provided for the audio file to be played. Text to Speech will read aloud the provided text using the voice option that is selected.",INFO_NODE_RECORD:"Triggers foreground recording of both sides of the call and waits for the recording to end. Options can be set to enable stereo audio, play a notification beep before recording, set a digit to stop recording (terminator), and specify the recording name and format (WAV or MP3).",INFO_NODE_RECORD_CALL_START:"Triggers background recording of both sides of the call. Options can be set to enable stereo audio, play a notification beep before recording, set a digit to stop recording (terminator), and specify the recording name and format (WAV or MP3).",INFO_NODE_RECORD_CALL_STOP:"Triggers a background call recording to stop at a specific point in the call flow, if it has not already been terminated.",INFO_NODE_REQUEST:"<p>Send a GET, POST, PUT, or DELETE request to any webhook.</p><p>This can be used to submit variables and information about an inbound call to an external server, or you can retrieve information from external servers and use them as variables throughout the call flow. You can also build conditions directly into this module.</p><p>Response variables can be accessed with <code>%{request_response['object_field']}</code>.</p><p>Headers should be input in JSON format. Valid header values are <code>Accept</code>, <code>Authorization</code>, <code>Content-Type</code>, <code>Range</code>, and <code>custom X- headers</code>.</p>",INFO_NODE_SEND_SMS:"Sends an SMS message to the specified phone number. The 'From' phone number must be enabled for messaging (a 10DLC number assigned to an active TCR campaign or a verified toll free number).",INFO_NODE_SET_VARIABLES:`<p>Set variables that can be accessed from other node blocks in the call flow.</p><p>The value can be a static value <code>("value")</code>, a variable from another node such as a request response <code>%{request_response.['object_field']}</code>, or a call parameter <code>%{call.from}</code>.</p><p>Access these variables in other blocks with <code>%{Key}</code> and unset variables with the Unset Variables block.</p>`,INFO_NODE_UNSET_VARIABLES:"Unsets script variables.",INFO_STATUS_ERROR:"An error occurred while loading or saving the flow.",INFO_STATUS_ERROR_OUT_OF_SYNC:"This document is locked because another user has made updates to the Call Flow. Refresh the page to discard your changes and unlock the flow with the latest updates.",INITIAL_TIMEOUT:"Initial Timeout",INPUT:"Input",INVALID_SETTINGS:"Invalid settings",JSON_OBJECT:"JSON object to serialize",KEY:"Key",KEYPAD_VALUE:"Keypad value",LANGUAGE:"Language",MAXIMUM_RECORDING_LENGTH:"Maximum Recording Length",META:"Meta",METHOD:"Method",MORE_INFO_DEPLOY:"Deploying a Call Flow makes it live.",MORE_INFO_DEPLOY_ERROR:"There was an error deploying the Call Flow. Please try again. {{message}}",MORE_INFO_STATUS_ERROR:"More info on Flow document error",MORE_INFO_TESTING_YOUR_FLOW:"Info on testing your call flow",MORE_WITH_COUNT:"{{count}} more",NAVIGATE_BACK:"Navigate Back",NO_ANSWER:"No Answer",NO_DEPLOYED_VERSIONS:"<p>No deployed versions found.</p> <p>Deploy a flow to view the history.</p>",NO_INPUT:"No Input",NO_RESULTS:"No results",NO_SCRIPTS_FOUND:"No scripts found.",NO_VARIABLES_SET:"Please set variables first",NOT_CONNECTED_TO_FLOW:"Not connected to flow",NUMBER_OF_VALIDATION_WARNINGS_one:"There is {{count}} validation warning in your flow",NUMBER_OF_VALIDATION_WARNINGS_other:"There are {{count}} validation warnings in your flow",NUMBER_OF_VARIABLES_SELECTED_one:"{{count}} variable selected",NUMBER_OF_VARIABLES_SELECTED_other:"{{count}} variables selected",OFF:"Off",ON:"On",OPTION_NUMBER:"Option {{index}}",OPTIONAL:"optional",OR_CALLER_SAYS:"or says",OR_SAYS:"Or says",PARAMS:"Params",PHONE_NUMBER:"Phone Number",PHONE_NUMBER_NUMBER:"Phone Number {{index}}",PKG_VERSION:"Package Version",PLAY_AUDIO:"Play Audio",PLAY_AUDIO_FILE:"Play Audio File",PLAY_AUDIO_TTS:"Play Audio or TTS",PREVIEW_DEPLOYED_VERSION:"You are previewing this version.",REASON:"Reason",RECORD:"Record",RECORD_CALL_START:"Start Call Recording",RECORD_CALL_STOP:"Stop Call Recording",RECORDING:"Recording",RECORDING_NAME:"Recording Name",RECORDING_NAME_DEFAULT:"Recording {{index}}",REMOVE_ADDRESS:"Remove Address {{index}}",REMOVE_CONDITION:"Remove Condition {{index}}",REMOVE_EDGE:"Remove Edge",REMOVE_NODE:"Remove Node {{title}}",REMOVE_OPTION:"Remove Option {{index}}",REMOVE_PHONE_NUMBER:"Remove Phone Number {{index}}",REMOVE_RESOURCE:"Remove Resource {{index}}",REMOVE_VARIABLE:"Remove Variable {{index}}",REQUEST:"Request",REQUEST_BODY:"Body",REQUEST_HEADERS:"Headers (JSON)",RESOURCE_NUMBER:"Resource {{index}}",RESTORE:"Restore",RESTORE_THIS_VERSION:"Restore this version",RESYNC:"Resync",RESYNC_AI_AGENTS:"Resync AI Agents",SAVED:"Saved",SAVE_VARIABLES:"Save Variables",SAVE_VARIABLES_SUBTITLE:"Store the response as variables",SCRIPT_NOT_FOUND:"Selected script not found. A selection is required.",SEARCH_FOR_INTERNAL_SCRIPT:"Search for internal script",SECONDS:"Seconds",SELECT:"Select",SELECT_VARIABLES:"Select Variables",SELECT_VARIABLES_TO_UNSET:"Select Variables to Unset",SEND_SMS:"Send SMS",SEPARATE_WITH_COMMAS:"Separate with commas",SEQUENTIALLY:"Sequentially",SET_VARIABLES:"Set Variables",SIMULTANEOUSLY:"Simultaneously",SMS_TEXT:"SMS Text",SPOKEN_PROMPT:"Spoken prompt",STATUS_DEPLOY:"Deploy",STATUS_DEPLOY_ERROR:"Deploy Error",STATUS_DEPLOYED:"Deployed",STATUS_DEPLOYING:"Deploying...",STATUS_ERROR:"Error",STATUS_LOADING:"Loading...",STATUS_LOCKED:"Locked",STATUS_SAVED:"Saved",STATUS_SAVING:"Saving...",STEREO:"Stereo",STEREO_SUBTITLE:"Enable stereo audio",STRING_OR_JSON:"String or JSON to serialize",SUCCESS:"Success",SWML_TO_EXECUTE:"SWML to execute on answer",TERMINATORS:"Terminators",TEXT:"Text",TEXT_TO_SPEECH:"Text to Speech",TIMEOUT:"Timeout",TO:"To",TO_PHONE_NUMBER:"To Phone Number",TOAST_DEPLOY_WARNING:'<p>There are inconsistencies in your Call Flow which may cause unexpected behavior. Please review the Call Flow before deploying.</p><p>Choose "Deploy" to deploy the Call Flow or "Cancel" to return to editing.</p>',TOAST_DOCUMENT_OUT_OF_SYNC:'<p>Updates have been made to this Call Flow by another user and your recent changes have not been saved.</p><p>Choose "Ignore" to view your changes in a locked state or "Resync" to abandon your changes and adopt the latest updates.</p>',TOGGLE_CLOSE:"Toggle close",TOGGLE_OPEN:"Toggle open",UNKNOWN:"Unknown",UNSET_VARIABLES:"Unset Variables",URL:"URL",VALUE:"Value",VARIABLE_KEY:"Variable {{key}}",VARIABLE_NUMBER:"Variable {{index}}",VERSION_HISTORY:"Version History",VERSION_LIST_ITEM:"Version {{number}}",VERSION_RESTORED:"Version restored",VOICE:"Voice",VOICEMAIL_RECORDING:"Voicemail Recording",WAIT_FOR_DIGIT:"Wait for Digit",WAIT_FOR_INPUT:"Wait for Input",WARNING:"Warning",WRITE_SOMETHING:"Write something"},C={ABOUT:"ABOUT",ACTION:"ACTION",ADDRESS_NUMBER:"ADDRESS_NUMBER",ADD_ADDRESS:"ADD_ADDRESS",ADD_AI_AGENT:"ADD_AI_AGENT",ADD_CONDITION:"ADD_CONDITION",ADD_OPTION:"ADD_OPTION",ADD_PHONE_NUMBER:"ADD_PHONE_NUMBER",ADD_RESOURCE:"ADD_RESOURCE",ADD_SWML_SCRIPTS:"ADD_SWML_SCRIPTS",ADD_VARIABLE:"ADD_VARIABLE",AI_AGENT:"AI_AGENT",AI_AGENT_NAME:"AI_AGENT_NAME",ANSWER_CALL:"ANSWER_CALL",ARE_YOU_SURE:"ARE_YOU_SURE",AUDIO_FILE:"AUDIO_FILE",BEEP:"BEEP",BEEP_SUBTITLE:"BEEP_SUBTITLE",BUSY:"BUSY",CALLER_PRESSES:"CALLER_PRESSES",CALLER_SAYS:"CALLER_SAYS",CALL_ADDRESSES:"CALL_ADDRESSES",CALL_NUMBERS:"CALL_NUMBERS",CALL_RESOURCES:"CALL_RESOURCES",CALL_STATE_EVENTS:"CALL_STATE_EVENTS",CALL_STATE_URL:"CALL_STATE_URL",CANCEL:"CANCEL",CAUTION:"CAUTION",CHOOSE_OPTION_TTS_AUDIO:"CHOOSE_OPTION_TTS_AUDIO",CLOSE:"CLOSE",CONDITIONS:"CONDITIONS",CONDITION_NUMBER:"CONDITION_NUMBER",DECISION:"DECISION",DECLINE:"DECLINE",DEFAULT_FROM:"DEFAULT_FROM",DEFAULT_TIMEOUT:"DEFAULT_TIMEOUT",DELETE:"DELETE",DELETE_NODE:"DELETE_NODE",DEPLOY:"DEPLOY",DEPLOY_WARNING:"DEPLOY_WARNING",DEPRECATED:"DEPRECATED",DOCUMENT_OUT_OF_SYNC:"DOCUMENT_OUT_OF_SYNC",EDIT_SELECTED_AI_AGENT:"EDIT_SELECTED_AI_AGENT",ELSE:"ELSE",ENABLE_WHISPER:"ENABLE_WHISPER",END_SILENCE_TIMEOUT:"END_SILENCE_TIMEOUT",ENTER_URL:"ENTER_URL",ERROR:"ERROR",ERROR_ADD_AI_AGENT_FIRST:"ERROR_ADD_AI_AGENT_FIRST",ERROR_ADD_RECORDING_FIRST:"ERROR_ADD_RECORDING_FIRST",ERROR_DUPLICATE_COMMAND:"ERROR_DUPLICATE_COMMAND",ERROR_DUPLICATE_RECORDING_LABEL:"ERROR_DUPLICATE_RECORDING_LABEL",ERROR_DUPLICATE_TELEPHONE_KEY:"ERROR_DUPLICATE_TELEPHONE_KEY",ERROR_DUPLICATE_VARIABLE_KEY:"ERROR_DUPLICATE_VARIABLE_KEY",ERROR_FETCHING_AI_AGENTS:"ERROR_FETCHING_AI_AGENTS",ERROR_FETCHING_DEPLOYED_VERSIONS:"ERROR_FETCHING_DEPLOYED_VERSIONS",ERROR_FETCHING_SWML_SCRIPTS:"ERROR_FETCHING_SWML_SCRIPTS",ERROR_INVALID_JSON:"ERROR_INVALID_JSON",ERROR_NUMBER_IS_REQUIRED:"ERROR_NUMBER_IS_REQUIRED",ERROR_NUMBER_MIN_MAX_IS_REQUIRED:"ERROR_NUMBER_MIN_MAX_IS_REQUIRED",ERROR_RECORDING_LABEL_REQUIRED:"ERROR_RECORDING_LABEL_REQUIRED",ERROR_SELECTION_REQUIRED:"ERROR_SELECTION_REQUIRED",ERROR_TELEPHONE_KEY_REQUIRED:"ERROR_TELEPHONE_KEY_REQUIRED",ERROR_TERMINATORS:"ERROR_TERMINATORS",ERROR_TEXT_IS_REQUIRED:"ERROR_TEXT_IS_REQUIRED",ERROR_URL_IS_REQUIRED:"ERROR_URL_IS_REQUIRED",ERROR_VALUE_IS_REQUIRED:"ERROR_VALUE_IS_REQUIRED",ERROR_VARIABLE_KEY_REQUIRED:"ERROR_VARIABLE_KEY_REQUIRED",EXECUTE_SWML:"EXECUTE_SWML",EXTERNAL_OPTION_LABEL:"EXTERNAL_OPTION_LABEL",EXTERNAL_OR_INTERNAL_RESOURCE:"EXTERNAL_OR_INTERNAL_RESOURCE",EXTERNAL_URL:"EXTERNAL_URL",FAILED:"FAILED",FAILURE:"FAILURE",FLOW_DATA_VERSION:"FLOW_DATA_VERSION",FORMAT:"FORMAT",FORWARD:"FORWARD",FORWARD_TO_ADDRESS:"FORWARD_TO_ADDRESS",FORWARD_TO_PHONE:"FORWARD_TO_PHONE",FORWARD_TO_RESOURCE:"FORWARD_TO_RESOURCE",FROM:"FROM",FROM_PHONE_NUMBER:"FROM_PHONE_NUMBER",GATHER_INPUT:"GATHER_INPUT",GENDER:"GENDER",GO_BACK:"GO_BACK",HANDLE_CALL:"HANDLE_CALL",HANDLE_VIA:"HANDLE_VIA",HANG_UP:"HANG_UP",HANG_UP_CALL:"HANG_UP_CALL",HELP:"HELP",HIDDEN:"HIDDEN",IGNORE:"IGNORE",INFO_INVALID_SETTINGS:"INFO_INVALID_SETTINGS",INFO_NODE_AI_AGENT:"INFO_NODE_AI_AGENT",INFO_NODE_COND:"INFO_NODE_COND",INFO_NODE_CONDREQUEST:"INFO_NODE_CONDREQUEST",INFO_NODE_EXECUTE_SWML:"INFO_NODE_EXECUTE_SWML",INFO_NODE_FORWARD_TO_ADDRESS:"INFO_NODE_FORWARD_TO_ADDRESS",INFO_NODE_FORWARD_TO_PHONE:"INFO_NODE_FORWARD_TO_PHONE",INFO_NODE_FORWARD_TO_RESOURCE:"INFO_NODE_FORWARD_TO_RESOURCE",INFO_NODE_GATHER_INPUT:"INFO_NODE_GATHER_INPUT",INFO_NODE_HANG_UP:"INFO_NODE_HANG_UP",INFO_NODE_PLAY:"INFO_NODE_PLAY",INFO_NODE_RECORD:"INFO_NODE_RECORD",INFO_NODE_RECORD_CALL_START:"INFO_NODE_RECORD_CALL_START",INFO_NODE_RECORD_CALL_STOP:"INFO_NODE_RECORD_CALL_STOP",INFO_NODE_REQUEST:"INFO_NODE_REQUEST",INFO_NODE_SEND_SMS:"INFO_NODE_SEND_SMS",INFO_NODE_SET_VARIABLES:"INFO_NODE_SET_VARIABLES",INFO_NODE_UNSET_VARIABLES:"INFO_NODE_UNSET_VARIABLES",INFO_STATUS_ERROR:"INFO_STATUS_ERROR",INFO_STATUS_ERROR_OUT_OF_SYNC:"INFO_STATUS_ERROR_OUT_OF_SYNC",INITIAL_TIMEOUT:"INITIAL_TIMEOUT",INPUT:"INPUT",INVALID_SETTINGS:"INVALID_SETTINGS",JSON_OBJECT:"JSON_OBJECT",KEY:"KEY",KEYPAD_VALUE:"KEYPAD_VALUE",LANGUAGE:"LANGUAGE",MAXIMUM_RECORDING_LENGTH:"MAXIMUM_RECORDING_LENGTH",META:"META",METHOD:"METHOD",MORE_INFO_DEPLOY:"MORE_INFO_DEPLOY",MORE_INFO_DEPLOY_ERROR:"MORE_INFO_DEPLOY_ERROR",MORE_INFO_STATUS_ERROR:"MORE_INFO_STATUS_ERROR",MORE_INFO_TESTING_YOUR_FLOW:"MORE_INFO_TESTING_YOUR_FLOW",MORE_WITH_COUNT:"MORE_WITH_COUNT",NAVIGATE_BACK:"NAVIGATE_BACK",NOT_CONNECTED_TO_FLOW:"NOT_CONNECTED_TO_FLOW",NO_ANSWER:"NO_ANSWER",NO_DEPLOYED_VERSIONS:"NO_DEPLOYED_VERSIONS",NO_INPUT:"NO_INPUT",NO_RESULTS:"NO_RESULTS",NO_SCRIPTS_FOUND:"NO_SCRIPTS_FOUND",NO_VARIABLES_SET:"NO_VARIABLES_SET",NUMBER_OF_VALIDATION_WARNINGS:"NUMBER_OF_VALIDATION_WARNINGS",NUMBER_OF_VARIABLES_SELECTED:"NUMBER_OF_VARIABLES_SELECTED",OFF:"OFF",ON:"ON",OPTIONAL:"OPTIONAL",OPTION_NUMBER:"OPTION_NUMBER",OR_CALLER_SAYS:"OR_CALLER_SAYS",OR_SAYS:"OR_SAYS",PARAMS:"PARAMS",PHONE_NUMBER_NUMBER:"PHONE_NUMBER_NUMBER",PKG_VERSION:"PKG_VERSION",PLAY_AUDIO:"PLAY_AUDIO",PLAY_AUDIO_FILE:"PLAY_AUDIO_FILE",PLAY_AUDIO_TTS:"PLAY_AUDIO_TTS",PREVIEW_DEPLOYED_VERSION:"PREVIEW_DEPLOYED_VERSION",REASON:"REASON",RECORD:"RECORD",RECORDING_NAME:"RECORDING_NAME",RECORDING_NAME_DEFAULT:"RECORDING_NAME_DEFAULT",RECORD_CALL_START:"RECORD_CALL_START",RECORD_CALL_STOP:"RECORD_CALL_STOP",REMOVE_ADDRESS:"REMOVE_ADDRESS",REMOVE_CONDITION:"REMOVE_CONDITION",REMOVE_EDGE:"REMOVE_EDGE",REMOVE_NODE:"REMOVE_NODE",REMOVE_OPTION:"REMOVE_OPTION",REMOVE_PHONE_NUMBER:"REMOVE_PHONE_NUMBER",REMOVE_RESOURCE:"REMOVE_RESOURCE",REMOVE_VARIABLE:"REMOVE_VARIABLE",REQUEST:"REQUEST",REQUEST_BODY:"REQUEST_BODY",REQUEST_HEADERS:"REQUEST_HEADERS",RESOURCE_NUMBER:"RESOURCE_NUMBER",RESTORE:"RESTORE",RESTORE_THIS_VERSION:"RESTORE_THIS_VERSION",RESYNC:"RESYNC",RESYNC_AI_AGENTS:"RESYNC_AI_AGENTS",SAVED:"SAVED",SAVE_VARIABLES:"SAVE_VARIABLES",SAVE_VARIABLES_SUBTITLE:"SAVE_VARIABLES_SUBTITLE",SCRIPT_NOT_FOUND:"SCRIPT_NOT_FOUND",SEARCH_FOR_INTERNAL_SCRIPT:"SEARCH_FOR_INTERNAL_SCRIPT",SECONDS:"SECONDS",SELECT:"SELECT",SELECT_VARIABLES:"SELECT_VARIABLES",SELECT_VARIABLES_TO_UNSET:"SELECT_VARIABLES_TO_UNSET",SEND_SMS:"SEND_SMS",SEPARATE_WITH_COMMAS:"SEPARATE_WITH_COMMAS",SEQUENTIALLY:"SEQUENTIALLY",SET_VARIABLES:"SET_VARIABLES",SIMULTANEOUSLY:"SIMULTANEOUSLY",SMS_TEXT:"SMS_TEXT",SPOKEN_PROMPT:"SPOKEN_PROMPT",STATUS_DEPLOY:"STATUS_DEPLOY",STATUS_DEPLOYED:"STATUS_DEPLOYED",STATUS_DEPLOYING:"STATUS_DEPLOYING",STATUS_DEPLOY_ERROR:"STATUS_DEPLOY_ERROR",STATUS_ERROR:"STATUS_ERROR",STATUS_LOADING:"STATUS_LOADING",STATUS_LOCKED:"STATUS_LOCKED",STATUS_SAVED:"STATUS_SAVED",STATUS_SAVING:"STATUS_SAVING",STEREO:"STEREO",STEREO_SUBTITLE:"STEREO_SUBTITLE",STRING_OR_JSON:"STRING_OR_JSON",SUCCESS:"SUCCESS",SWML_TO_EXECUTE:"SWML_TO_EXECUTE",TERMINATORS:"TERMINATORS",TEXT:"TEXT",TEXT_TO_SPEECH:"TEXT_TO_SPEECH",TIMEOUT:"TIMEOUT",TO:"TO",TOAST_DEPLOY_WARNING:"TOAST_DEPLOY_WARNING",TOAST_DOCUMENT_OUT_OF_SYNC:"TOAST_DOCUMENT_OUT_OF_SYNC",TOGGLE_CLOSE:"TOGGLE_CLOSE",TOGGLE_OPEN:"TOGGLE_OPEN",TO_PHONE_NUMBER:"TO_PHONE_NUMBER",UNKNOWN:"UNKNOWN",UNSET_VARIABLES:"UNSET_VARIABLES",URL:"URL",VALUE:"VALUE",VARIABLE_NUMBER:"VARIABLE_NUMBER",VERSION_HISTORY:"VERSION_HISTORY",VERSION_LIST_ITEM:"VERSION_LIST_ITEM",VERSION_RESTORED:"VERSION_RESTORED",VOICE:"VOICE",VOICEMAIL_RECORDING:"VOICEMAIL_RECORDING",WAIT_FOR_DIGIT:"WAIT_FOR_DIGIT",WAIT_FOR_INPUT:"WAIT_FOR_INPUT",WARNING:"WARNING",WRITE_SOMETHING:"WRITE_SOMETHING"},oC={order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag","path","subdomain"],lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupQuerystring:"lng",lookupSessionStorage:"i18nextLng",caches:["localStorage","cookie"],excludeCacheFor:["cimode"]},sC={"en-US":{translation:rC}},iC=async()=>{await ut.use(tg).use(dT).init({debug:WR,detection:oC,fallbackLng:"en-US",interpolation:{escapeValue:!1},keySeparator:!1,resources:sC})};function Ul(e,t){return h.jsx(BT,{label:e,vars:t})}const Bg=()=>ut.resolvedLanguage,lC={entries:[],nextLabelIndex:0},zo=Do((e,t)=>({...lC,actions:{getEntries(){return t().entries},getEntryValue(r){return t().entries.find(s=>s.controlId===r)?.label},getGeneratedLabel(){let r="",s=t().nextLabelIndex;do s++,r=M(C.RECORDING_NAME_DEFAULT,{index:s});while(this.isValueDuplicate(r));return e({nextLabelIndex:s}),r},isKeyDuplicate(r){return t().entries.some(s=>s.controlId===r)},isValueDuplicate(r,s){const i=r.trim();return!!t().entries.reduce((c,u)=>{const{label:f,controlId:p}=u;return f!==""&&f===i&&(!s||p!==s)?[...c,u]:c},[]).length},removeEntry(r){e(s=>({entries:s.entries.filter(i=>i.controlId!==r)}))},upsertEntry:r=>{const{actions:s}=t(),{isKeyDuplicate:i}=s;e(a=>{let c=[...a.entries];const u=r.label.trim(),f=!!u;return(i(r.controlId)||!f)&&(c=c.filter(p=>p.controlId!==r.controlId)),f&&c.push({...r,label:u}),{entries:c}})}}})),Hu=()=>zo.getState().actions,zg=e=>{const t=[];e.forEach(r=>{r.type==="recordCallStart"&&r.data.controlId&&r.data.label&&t.push({controlId:r.data.controlId,label:r.data.label})}),zo.setState({entries:t,nextLabelIndex:t.length})},aC=(e,t)=>{const r=[];return t.forEach(s=>{s.type==="recordCallStart"&&s.data.controlId&&(r.push(s.data.controlId),zo.getState().actions.removeEntry(s.data.controlId))}),r.length?e.reduce((s,i)=>i.type==="recordCallStop"&&r.includes(i.data.controlId)?[...s,{...i,data:{...i.data,controlId:""}}]:s,[]):[]},Wg={recordCallStart:e=>{const t=zo.getState().actions.getGeneratedLabel();return zo.getState().actions.upsertEntry({controlId:e.data.controlId,label:t}),{...e,data:{...e.data,label:t}}}},cC=e=>typeof e=="object"&&e!==null&&Object.keys(e).length>0,uC=e=>Wg[e.type]!==void 0,Gg=(e,t={})=>{const{deletable:r=!0,position:s={x:300,y:250},selected:i=!0}=t,a=()=>({data:{initial:!0,valid:!1},deletable:r,id:Le(),position:s,selected:i,type:e}),c=(p,m)=>({...p,data:{...p.data,...m}});let u=a();const f=Fm[e]();return cC(f)&&(u=c(u,f)),uC(u)&&(u=Wg[u.type](u)),u},Fl={action:{label:C.ACTION,nodes:{answer:{active:!0,label:C.ANSWER_CALL},hangup:{active:!0,infoLabel:C.INFO_NODE_HANG_UP,label:C.HANG_UP_CALL},play:{active:!0,infoLabel:C.INFO_NODE_PLAY,label:C.PLAY_AUDIO_TTS},sendSms:{active:!0,infoLabel:C.INFO_NODE_SEND_SMS,label:C.SEND_SMS}}},decision:{label:C.DECISION,nodes:{cond:{active:!0,infoLabel:C.INFO_NODE_COND,label:C.CONDITIONS},executeSWML:{active:!0,infoLabel:C.INFO_NODE_EXECUTE_SWML,label:C.EXECUTE_SWML},set:{active:!0,infoLabel:C.INFO_NODE_SET_VARIABLES,label:C.SET_VARIABLES},unset:{active:!0,infoLabel:C.INFO_NODE_UNSET_VARIABLES,label:C.UNSET_VARIABLES}}},forwardTo:{label:C.FORWARD,nodes:{forwardAddress:{active:!1,infoLabel:C.INFO_NODE_FORWARD_TO_ADDRESS,label:C.FORWARD_TO_ADDRESS},forwardPhone:{active:!0,infoLabel:C.INFO_NODE_FORWARD_TO_PHONE,label:C.FORWARD_TO_PHONE},forwardResource:{active:!1,infoLabel:C.INFO_NODE_FORWARD_TO_RESOURCE,label:C.FORWARD_TO_RESOURCE}}},hidden:{label:C.HIDDEN,nodes:{handleCall:{active:!0,label:C.HANDLE_CALL}}},input:{label:C.INPUT,nodes:{aiAgent:{active:!0,infoLabel:C.INFO_NODE_AI_AGENT,label:C.AI_AGENT},condRequest:{active:!0,infoLabel:C.INFO_NODE_CONDREQUEST,label:C.REQUEST},promptPlay:{active:!0,infoLabel:C.INFO_NODE_GATHER_INPUT,label:C.GATHER_INPUT},request:{active:!1,deprecated:!0,infoLabel:C.INFO_NODE_REQUEST,label:C.REQUEST}}},recording:{label:C.RECORD,nodes:{record:{active:!0,infoLabel:C.INFO_NODE_RECORD,label:C.VOICEMAIL_RECORDING},recordCallStart:{active:!0,infoLabel:C.INFO_NODE_RECORD_CALL_START,label:C.RECORD_CALL_START},recordCallStop:{active:!0,infoLabel:C.INFO_NODE_RECORD_CALL_STOP,label:C.RECORD_CALL_STOP}}}},dC=Object.entries(Fl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([r,{label:s}])=>{e.set(r,s)}),e),new Map),fC=Object.entries(Fl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([r,{infoLabel:s}])=>{e.set(r,s)}),e),new Map),jl=Qe(),pC={aiAgentMap:new Map,error:"",status:"initial"},hC=(e,t)=>({...pC,actions:{fetchAiAgents:async()=>{try{const{actions:r}=t(),{getAiAgents:s}=r;if(!s){jl.error("getAiAgents is not defined");return}e({status:"loading"});const i=await s(),a=km(i.data,"asc","display_name"),c=new Map(a.map(u=>[u.id,u]));e({aiAgentMap:c,error:"",status:"loaded"})}catch(r){let s="Unknown error";jl.error("Error fetching aiAgents ",r),r instanceof Error&&(s=r.message),e({aiAgentMap:new Map,error:s,status:"error"})}},init:({getAiAgentsURL:r})=>{if(!r){jl.error("getAiAgentsURL is not defined");return}const s=gc({getAiAgentsURL:r,headers:Eu()}),i=async()=>await s.getAiAgents();e(a=>({...a,actions:{...a.actions,getAiAgents:i}}))}}}),Yg=(e,t)=>{if(e.find(s=>s.type==="aiAgent")){const{fetchAiAgents:s}=On.getState().actions;s().then(()=>{const{aiAgentMap:i,status:a}=On.getState();a==="loaded"&&e.forEach(c=>{if(c.data&&"agent"in c.data){const u=i.has(c.data.agent);u||t(c.id,{agent:u?c.data.agent:"",valid:u})}})}).catch(i=>jl.error("Error rehydrating AiAgentStore",i))}},On=Do()(hC),mC=()=>On.getState().actions;window.__useAiAgentStore=On;const gC=e=>!!(e&&e>=KR),EC=e=>(t,r,s)=>(s.setState=(i,a,...c)=>{const{edges:u,detachedMode:f,httpError:p,initializing:m,isCanvasInteractive:E,isInteractiveControlOn:v,nodes:x,rootAppWidth:_,viewportChanging:w}=r(),S=typeof i=="function"?i(r()):i,N=["detachedMode","httpError","initializing","isInteractiveControlOn","rootAppWidth","viewportChanging"],O="initializing"in S?S.initializing:m;if(N.some(D=>D in S)){const D=gC("rootAppWidth"in S?S.rootAppWidth:_),T="isInteractiveControlOn"in S?S.isInteractiveControlOn:v,A="detachedMode"in S?S.detachedMode:f,L=("httpError"in S?S.httpError:p)===Am,F="viewportChanging"in S?S.viewportChanging:w;if(S.isCanvasInteractive=!!(D&&T&&!A&&!O&&!L&&!F),S.showInteractiveControl=D&&!L&&!A,E&&!S.isCanvasInteractive){const K="nodes"in S?S.nodes:x;S.nodes=K.map(X=>({...X,selected:!1}));const Q="edges"in S?S.edges:u;S.edges=Q.map(X=>({...X,selected:!1})),S.selectedNode=void 0}}t(S,a,...c)},e(s.setState,r,s)),Kg=1e3,Zs=Qe(),yC=e=>(t,r,s)=>{let i,a;const c=async()=>{const{httpService:u,nodes:f,edges:p,documentVersion:m}=r();t({dataHandlingStatus:"saving",saveFlowStatus:"saving"}),clearTimeout(a);try{if(!u)throw new Error("Missing httpService");const E=await u.putFlow({documentVersion:m,edges:p,flowDataVersion:$s,nodes:f}),v={documentLastUpdated:E.updated_at,documentVersion:E.document_version},x=r().dataHandlingStatus;switch(x){case"saving":t({...v,dataHandlingStatus:"queueing",deployFlowStatus:"deploy",saveFlowStatus:"saved"});break;case"holding":t({...v,saveFlowStatus:"awaiting-save"}),Zs.debug("Setting up a new save for held changes"),a=setTimeout(()=>{c().catch(_=>{Zs.error("Error Save Flow",_)})},Kg);break;default:Zs.debug("Invalid dataHandlingStatus",x)}}catch(E){Zs.error("Put Flow",E),E instanceof Error&&E.message.includes(XR)?t({dataHandlingStatus:"holding",httpError:"document-sync",saveFlowStatus:"error"}):t({dataHandlingStatus:"queueing",saveFlowStatus:"error"})}};return s.setState=(u,f,...p)=>{const{dataHandlingStatus:m,detachedMode:E,initializing:v,saveFlowStatus:x}=r(),_=typeof u=="function"?u(r()):u,w="initializing"in _?_.initializing:v,S="detachedMode"in _?_.detachedMode:E;!w&&!S&&(_.nodes||_.edges)?m==="queueing"?(_.saveFlowStatus="awaiting-save",t(_,f,...p),clearTimeout(i),i=setTimeout(()=>{c().catch(O=>{Zs.error("Error Save Flow",O)})},Kg)):(_.dataHandlingStatus="holding",t(_,f,...p)):"initializing"in _&&!_.initializing?(_.dataHandlingStatus="queueing",x!=="error"&&(_.saveFlowStatus="saved"),t(_,f,...p)):t(_,f,...p)},e(s.setState,r,s)},Vl=Qe(),vC={cachedResults:new Map,error:"",results:[],status:"initial",swmlScriptMap:new Map},xC={ids:"ids",name:"name"},SC=(e,t)=>({...vC,actions:{buildParamsFromQuery:r=>{const{searchParams:s}=new URL(r,window.location.href);return l1(xC).reduce((a,c)=>{const u=s.get(c);return u&&(c==="ids"?a[c]=u.split(","):a[c]=u),a},{})},buildQueryFromParams:r=>{const s=hc(window.location.origin,{...r}),{search:i}=new URL(s);return`/${i}`},fetchSwmlScript:async r=>{try{const{actions:s}=t(),{getSwmlScripts:i,updateMapAndCache:a}=s;if(!i){Vl.error("getSwmlScripts is not defined");return}e({status:"loading"});const c=await i(r),u=km(c.data,"asc","display_name"),f=new Map(u.map(p=>[p.id,{displayName:p.display_name,id:p.id,requestUrl:p.request_url}]));a(f,r),e({error:"",results:Array.from(f.values()),status:"loaded"})}catch(s){let i="Unknown error";Vl.error("Error fetching swmlScripts ",s),s instanceof Error&&(i=s.message),e({error:i,status:"error"})}},getCachedResults:r=>{const{cachedResults:s,swmlScriptMap:i}=t(),a=s.get(r);if(a)return a.reduce((c,u)=>{const f=i.get(u);return f&&c.push(f),c},[])},init:({getSwmlScriptsURL:r})=>{if(!r){Vl.error("getSwmlScriptsURL is not defined");return}const s=gc({getSwmlScriptsURL:r,headers:Eu()}),i=async a=>await s.getSwmlScripts(a);e(a=>({...a,actions:{...a.actions,getSwmlScripts:i}}))},setResults:r=>{e({results:r})},updateConnection:(r,s)=>{if(r.connectConfirmId!=="external"){const i=s.get(r.connectConfirmId),a={...r};if(i&&i.displayName!==r.connectConfirmDisplayName)return a.connectConfirmDisplayName=i.displayName,a;if(!i)return a.connectConfirmId="",a.connectConfirmUrl="",a}},updateMapAndCache:(r,s)=>{const{actions:i,cachedResults:a,swmlScriptMap:c}=t(),{buildQueryFromParams:u}=i,f=s?.ids,p=u(s),E=a.get(p)?.filter(w=>r.has(w))??[],v=f?.filter(w=>!r.has(w))??[],x=[...new Set([...v,...E])];x.length>0&&(Array.from(a.entries()).forEach(([S,N])=>{if(S===s){const O=N.filter(D=>!x.includes(D));a.set(S,O)}}),x.forEach(S=>{c.delete(S)})),r.forEach((w,S)=>{c.set(S,w)});const _=Array.from(r.keys());a.set(p,_),e({cachedResults:new Map(a),swmlScriptMap:new Map(c)})},validateCache:(()=>{let r;return()=>{r&&clearTimeout(r),r=setTimeout(async()=>{const{actions:i,swmlScriptMap:a}=t(),{fetchSwmlScript:c}=i,u=Array.from(a.keys());u.length>0&&c&&await c({ids:u})},Im)}})(),validateScriptsFromNodes:(r,s)=>{const{actions:i}=t(),{fetchSwmlScript:a}=i,c=new Set,u=r.filter(p=>Xg(p)&&"connections"in p.data&&p.data.connections.some(m=>m.connectConfirmEnabled));if(u.length===0)return;const f=(p,m)=>u.forEach(E=>{const v=E.data.connections.map(x=>p(x)??x);typeof m=="function"&&m(v,E)});f(p=>{p.connectConfirmId!==""&&p.connectConfirmId!=="external"&&p.connectConfirmEnabled&&c.add(p.connectConfirmId)}),c.size!==0&&a({ids:Array.from(c.values())}).then(()=>{const{actions:p,swmlScriptMap:m,status:E}=Bn.getState(),{updateConnection:v}=p;E==="loaded"&&f(x=>{const _=v(x,m);return _||x},(x,_)=>{s(_.id,{connections:x})})}).catch(p=>Vl.error("Error rehydrating SwmlScriptStore",p))}}}),Xg=e=>e.type==="forwardAddress"||e.type==="forwardPhone"||e.type==="forwardResource",_C=(e,t)=>{if(e.some(Xg)){const{validateScriptsFromNodes:s}=Bn.getState().actions;s(e,t)}},Bn=Do()(SC),Qg=()=>Bn.getState().actions;window.__useSwmlScriptStore=Bn;const qg=500,wC=100,qe=Qe(),NC=Gg("handleCall",{deletable:!1,position:{x:300,y:100}}),Bu={backButtonHref:void 0,colorMode:"light",dataHandlingStatus:"queueing",deployFlowStatus:"deploy",deployFlowURL:"",deployedVersionsList:[],detachedMode:!1,documentLastUpdated:void 0,documentVersion:0,dragNodeType:void 0,edges:[],flowId:"",flowTitle:"",flowWrapperElement:void 0,getFlowURL:"",httpError:void 0,httpService:void 0,initializing:!0,isCanvasInteractive:!1,isDraggingNode:!1,isEdgeConnecting:!1,isEdgeUpdateSuccessful:!1,isInteractiveControlOn:!0,nodes:[],reactFlowInstance:void 0,rootAppHeight:void 0,rootAppWidth:void 0,rootElement:void 0,rootElementId:"",saveFlowStatus:"initial",selectedNode:void 0,showDeployWarning:!1,showDeployedHistory:!1,showDeployedHistoryToast:!1,showInteractiveControl:!0,showValidationWarnings:!1,toastsMap:new Map,updateFlowURL:"",updatingSourceHandleId:void 0,validationWarnings:new Map,viewport:{x:0,y:0,zoom:1},viewportChanging:!1,workingFlowCopy:void 0},RC=(e,t)=>({...Bu,actions:{addNode:({nodeType:r,x:s=150,y:i=150})=>{qe.debug("Add Node",r);const{nodes:a,reactFlowInstance:c}=t();if(!c)throw new Error("ReactFlowInstance not found");const u=Gg(r,{position:c.project({x:s,y:i})}),f=a.map(p=>({...p,selected:!1}));f.push(u),e({nodes:f,selectedNode:u})},addToast:r=>{const{toastsMap:s}=t(),i=Le();s.set(i,{...r,id:i}),e({toastsMap:new Map(s)})},cancelDetachedMode:async()=>{const{actions:r,workingFlowCopy:s}=t(),{cleanUpDetachedMode:i}=r;if(s){const{edges:a,nodes:c,saveFlowStatus:u}=s;e({edges:[],initializing:!0,nodes:[]}),await Pm(qg),e({edges:a,nodes:c,saveFlowStatus:u})}else qe.error("There was no working flow to restore");i()},cleanUpDetachedMode:()=>{e({detachedMode:!1,showDeployedHistory:!1,showDeployedHistoryToast:!1,workingFlowCopy:void 0})},deleteToast:r=>{const{toastsMap:s}=t();s.delete(r)&&e({toastsMap:new Map(s)})},deleteValidationWarning:r=>{const{validationWarnings:s}=t();s.delete(r)&&e({validationWarnings:new Map(s)})},deployFlow:async()=>{qe.info("Deploying..."),e({deployFlowStatus:"deploying"});try{const{httpService:r,documentVersion:s}=t();if(!r)throw new Error("Missing httpService");const i=await r.deployFlow({documentVersion:s});qe.info("Deploy response",i),e({deployFlowStatus:"deployed"})}catch(r){throw qe.info("Deploy error",r),e({deployFlowStatus:"error"}),r}},exportStoreData:()=>{const{nodes:r,edges:s}=t();r1(r,s)},getDeployedVersionsList:async r=>{try{const{httpService:s}=t();if(!s)throw new Error("Missing httpService");const i=await s.getFlowVersions(r),a=Mm(Bg());return e({deployedVersionsList:i.map((c,u)=>({id:c.id,relativeTimeSince:a(c.created_at),version:(i.length-u).toFixed(1)}))}),i}catch(s){throw qe.error("Could not get deployed versions",s),e({deployedVersionsList:[]}),s}},getNodeType:r=>t().nodes.find(i=>i.id===r)?.type,getRootElement:()=>{const{rootElement:r,rootElementId:s}=t();if(!r)throw new Error(`Root element not found for ID ${s}`);return r.shadowRoot?r.shadowRoot.getRootNode():r},getTargetEdges:r=>t().edges.filter(s=>{const i=s.target===r,a=s.source!==s.target;return i&&a}),getValidationWarnings:()=>t().validationWarnings,migrateAndLoadDeployedFlow:async r=>{const{actions:s,workingFlowCopy:i}=t(),{partialUpdateNodeData:a,saveWorkingFlowCopy:c}=s,f=new ep({dbRecord:r}).migrateTo($s),{flow_data:p}=f;if(!p)qe.error("Cannot load flow: missing flowData",p);else{i||c();const m=p.nodes.map(Lm),E=p.edges.map(bm);e({detachedMode:!0,edges:[],initializing:!0,nodes:[]}),await Pm(qg),e({edges:E,nodes:m,showDeployedHistoryToast:!0}),zg(m),Yg(m,a)}},onConnect:r=>{qe.debug("onConnect"),e({edges:Nh(r,t().edges)})},onConnectEnd:()=>{qe.debug("onConnectEnd"),e({isEdgeConnecting:!1})},onConnectStart:()=>{qe.debug("onConnectStart"),e({isEdgeConnecting:!0})},onEdgeUpdate:(r,s)=>{qe.debug("onEdgeUpdate"),e({edges:Jw(r,s,t().edges),isEdgeUpdateSuccessful:!0})},onEdgeUpdateEnd:(r,s)=>{qe.debug("onEdgeUpdateEnd"),t().isEdgeUpdateSuccessful?e({isEdgeUpdateSuccessful:!0}):t().reactFlowInstance?.deleteElements({edges:[{id:s.id}]}),e({updatingSourceHandleId:void 0})},onEdgeUpdateStart:(r,s)=>{qe.debug("onEdgeUpdateStart"),e({isEdgeUpdateSuccessful:!1,updatingSourceHandleId:s.sourceHandle??void 0})},onEdgesChange:r=>{e({edges:IN(r,t().edges)})},onEdgesDelete:r=>{qe.debug("onEdgesDelete [noop]",r)},onInit:async r=>{const{actions:s,deployFlowURL:i,getFlowURL:a,updateFlowURL:c}=t(),{partialUpdateNodeData:u}=s;qe.log("onInit",{getFlowURL:a,updateFlowURL:c});try{const f=gc({deployFlowURL:i,getFlowURL:a,headers:Eu(),updateFlowURL:c}),[p,m]=await Promise.all([f.getFlow(),f.getFlowVersions({pageSize:1})]),v=new ep({dbRecord:p}).migrateTo($s),{document_version:x,flow_data:_,id:w,title:S,updated_at:N}=v;if(m.length&&m[0]){const{document_version:D}=m[0];D===x&&e({deployFlowStatus:"deployed"})}let O=_;O||(O={edges:Bu.edges,flowDataVersion:$s,nodes:Bu.nodes.concat([NC])}),e({documentLastUpdated:N,documentVersion:x,edges:O.edges.map(bm),flowId:w,flowTitle:S,httpService:f,nodes:O.nodes.map(Lm),reactFlowInstance:r}),zg(O.nodes),Yg(O.nodes,u),_C(O.nodes,u)}catch(f){qe.error("Could not load flow. URL:",a);let p="unknown";f instanceof Error&&f.message.includes(QR)&&(p="not-found"),e({httpError:p})}},onNodeDragStart:()=>{e({isDraggingNode:!0})},onNodeDragStop:()=>{e({isDraggingNode:!1})},onNodesChange:r=>{const s=r.filter(i=>i.type!=="dimensions");s.length>0&&e({nodes:Jh(s,t().nodes)})},onNodesDelete:r=>{qe.debug("onNodesDelete");const{actions:s}=t(),{partialUpdateNodeData:i}=s;aC(t().nodes,r).forEach(c=>{i(c.id,c.data)})},onSelectionChange:({nodes:r})=>{e({selectedNode:r.find(s=>s.selected)})},onViewportChange:(()=>{let r;function s(i){r&&clearTimeout(r),r=setTimeout(()=>{e({viewportChanging:!1})},wC),e({viewport:{...i},viewportChanging:!0})}return s})(),onViewportChangeEnd:()=>{},onViewportChangeStart:()=>{},partialUpdateNodeData:(r,s)=>{qe.debug("partialUpdateNodeData",r,s);const i=[],a=t().nodes.map(c=>{if(c.id===r){if("options"in s&&"options"in c.data){const u=c.data.options.map(p=>p.id),f=s.options.map(p=>p.id);i.push(...u.filter(p=>!f.includes(p)))}return{...c,data:{...c.data,...s}}}return c});if(i.length){const c=t().edges.filter(u=>u.sourceHandle&&i.includes(u.sourceHandle));qe.debug("Remove orphaned edges",{edgesToDelete:c,sourceHandleDeleted:i}),t().reactFlowInstance?.deleteElements({edges:c})}e({nodes:a})},partialUpdateValidationWarning:(r,s)=>{const{validationWarnings:i}=t(),a=u=>u.connected===!1||u.valid===!1,c=i.get(r);if(s.nodeType!=="handleCall"&&!c&&a(s)){const u=dC.get(s.nodeType),f={connected:s.connected,id:Le(),nodeId:s.nodeId,nodeTitle:u,nodeType:s.nodeType,valid:s.valid};i.set(r,f)}else if(c){const u={...c,...s};a(u)?i.set(r,u):i.delete(r)}e({validationWarnings:new Map(i)})},removeEdge:r=>{qe.debug("removeEdge",r);const s=t().reactFlowInstance;s&&s.deleteElements({edges:[{id:r}]})},removeNode:r=>{qe.debug("removeNode",r);const s=t().reactFlowInstance;s&&s.deleteElements({nodes:[{id:r}]})},restoreDeployedFlow:()=>{const{actions:r,edges:s,nodes:i}=t(),{cleanUpDetachedMode:a}=r;e({detachedMode:!1,edges:s,nodes:i}),a()},saveWorkingFlowCopy:()=>{const{edges:r,nodes:s,saveFlowStatus:i}=t();e({workingFlowCopy:{edges:r,nodes:s,saveFlowStatus:i}})},setColorMode:r=>{e({colorMode:r})},setDragNodeType:r=>{e({dragNodeType:r})},setFlowWrapperElement:r=>{e({flowWrapperElement:r||void 0})},setInitializing:r=>{e({initializing:r})},setSelectedNodes:r=>{const{nodes:s}=t(),i=s.map(a=>({...a,selected:r.includes(a.id)}));e({nodes:i})},setShowDeployWarning:r=>{e({showDeployWarning:r})},setShowDeployedHistory:r=>{e({showDeployedHistory:r})},setShowValidationWarnings:r=>{e({showValidationWarnings:r})},setViewportChanging:r=>{e({viewportChanging:r})}}}),ye=Do()(EC(yC(RC))),Ze=()=>ye.getState().actions;window.__useRFStore=ye;const TC={"not-found":{message:"Please ensure that the Call Flow exists and the URL is correct.",status:"404",title:"Call Flow not found"},unknown:{message:"An unknown error occurred. Please try again or go back.",status:"",title:"Unknown error"}},OC=({errorType:e})=>{const t=ye(a=>a.backButtonHref),{title:r,message:s,status:i}=TC[e];return h.jsx("section",{className:"flex min-h-full w-full items-center justify-center bg-background px-6",children:h.jsxs("div",{className:"text-center",children:[i&&h.jsx("p",{className:"text-2xl font-semibold text-foreground/50",children:i}),h.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground",children:r}),h.jsx("p",{className:"mt-6 leading-7 text-foreground",children:s}),t&&h.jsx("div",{className:"mt-8 flex items-center justify-center gap-x-6",children:h.jsx("a",{href:t,className:"rounded-md bg-foreground px-3.5 py-2.5 text-sm font-semibold text-background shadow-sm transition-colors hover:bg-foreground/80 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-foreground",children:M(C.GO_BACK)})})]})})},Zg=({height:e,strokeWidth:t,toX:r,toY:s,width:i})=>h.jsx("svg",{x:r-i*t/2,y:s-e*t/2,height:e*t,width:i*t,viewBox:`-${i/2} -${e/2} ${i} ${e}`,children:h.jsx("g",{children:h.jsx("polyline",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,points:"-5,-4 0,0 -5,4 -5,-4"})})}),CC=({fromHandle:e,fromNode:t,fromPosition:r,fromX:s,fromY:i,toPosition:a,toX:c,toY:u})=>{if(!t)return null;const[f]=Us({borderRadius:Cm,sourcePosition:r,sourceX:s,sourceY:i,targetPosition:a,targetX:c,targetY:u}),{height:p,strokeWidth:m,width:E}={...ko.markerEnd,...ko.style},v=e?.position===xe.Left,x=v?s:c,_=v?i:u;return h.jsxs("g",{className:"cfb-connection-line",children:[h.jsx("path",{fill:"none",strokeWidth:m,className:"animated",d:f}),h.jsx(Zg,{height:p,strokeWidth:m,toX:x,toY:_,width:E}),v&&h.jsx("circle",{cx:c-2,cy:u,fill:"none",r:4,strokeWidth:m})]})};function AC({isCircular:e=!1,targetNode:t,targetX:r,targetY:s}){const{width:i,height:a,position:c}=t,u=i??0,f=a??0,p=u/2;return e?{tx:c.x+p,ty:c.y+f}:{tx:r,ty:s}}const IC=e=>{const t={...e,interactionWidth:40},{id:r,source:s,target:i,sourcePosition:a,sourceX:c,sourceY:u,targetX:f,targetY:p}=t,{removeEdge:m}=Ze(),E=b.useRef(null),v=Me(b.useCallback(X=>X.nodeInternals.get(s),[s])),x=Me(b.useCallback(X=>X.nodeInternals.get(i),[i]));if(!v||!x)return null;const _=s===i,{tx:w,ty:S}=AC({isCircular:_,targetNode:x,targetX:f,targetY:p}),[N,O,D]=Us({borderRadius:Cm,sourcePosition:a,sourceX:c,sourceY:u,targetPosition:_?xe.Bottom:xe.Left,targetX:w,targetY:S}),T=(X,ee)=>{X.stopPropagation(),m(ee)},A=X=>{X.currentTarget?.classList.add("highlight"),E.current?.classList.add("animate-delay-opacity","flex"),E.current?.classList.remove("hidden")},L=X=>{X.currentTarget?.classList.remove("highlight"),E.current?.classList.remove("animate-delay-opacity","flex"),E.current?.classList.add("hidden")},{height:F,strokeWidth:K,width:Q}={...ko.markerEnd,...ko.style};return h.jsxs("g",{onMouseEnter:A,onMouseLeave:L,children:[h.jsx(wo,{path:N,...t}),h.jsx(Zg,{height:F,strokeWidth:K,toX:w,toY:S,width:Q}),h.jsx(wR,{children:h.jsxs("button",{className:"nodrag nopan pointer-events-auto absolute hidden h-[18px] w-[26px] cursor-pointer items-center justify-center rounded-full bg-foreground/90 opacity-0 hover:h-[22px] hover:w-[30px] hover:border-2 hover:border-focus",onClick:X=>T(X,r),ref:E,style:{transform:`translate(-50%, -50%) translate(${O}px,${D}px)`},children:[h.jsx(Ce,{tag:"trash-can",className:"py-0.5 px-1.5 text-background"}),h.jsx("span",{className:"sr-only",children:M(C.REMOVE_EDGE)})]})})]})},bC=/^[\w\d -']+$/,LC=/^\d+$/,DC=/^\d|\*|#$/,kC=/^[\d*#$]{0,12}$/,MC=/^.{1,20}$/,Wo={MAX:3600,MIN:0},PC=/^[a-z0-9_]{1,20}$/,He={MAX:99,MIN:1},Go=e=>t=>!!e.exec(t),zu=e=>{if(!jt(e))return!0;try{return!!new URL(e)}catch{return!1}},At=e=>jt(e)?Go(LC)(e):!0,UC=e=>jt(e)?Go(DC)(e):!0,FC=e=>jt(e)?Go(bC)(e):!0,jC=e=>jt(e)?Go(PC)(e):!0,Jg=e=>jt(e)?Go(kC)(e):!0,VC=e=>jt(e)?Go(MC)(e):!0,$l=e=>{if(!jt(e))return!0;try{return JSON.parse(e),!0}catch{return!1}},De=e=>!!jt(e),Js=(e,t)=>{if(typeof e=="string"&&!jt(e))return!0;const r=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(r)&&r>=t},ei=(e,t)=>{if(typeof e=="string"&&!jt(e))return!0;const r=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(r)&&r<=t},Er=(e,t)=>{const r=new Set,s=e.reduce((i,a)=>{const c=a[t];if(typeof c=="string"){const u=c.trim();u&&(r.has(u)&&i.add(u),r.add(u))}return i},new Set);return i=>s.has(i.trim())},Hl={aiAgent:{fieldValidators:{agent:[De]},validate:e=>Yo({nodeData:e,nodeType:"aiAgent"}),validateField:(e,t)=>Ie({name:e,nodeType:"aiAgent",value:t})},cond:{fieldValidators:{value:[De]},validate:e=>Gu("cond",e),validateField:(e,t)=>Ie({name:e,nodeType:"cond",value:t})},condRequest:{fieldValidators:{body:[],headers:[$l],method:[De],saveVariables:[],url:[De],value:[De]},validate:e=>{const t=e,r=[];return["body","headers","method","saveVariables","url"].forEach(i=>{Ie({name:i,nodeType:"condRequest",value:t[i]})||r.push(i)}),[...r,...Gu("condRequest",e)]},validateField:(e,t)=>Ie({name:e,nodeType:"condRequest",value:t})},executeSWML:{fieldValidators:{dest:[De],meta:[$l],params:[$l]},validate:e=>{const t=e,r=[];return["dest","params","meta"].forEach(i=>{Ie({name:i,nodeType:"executeSWML",value:t[i]})||r.push(i)}),[...r,...Gu("executeSWML",e)]},validateField:(e,t)=>Ie({name:e,nodeType:"executeSWML",value:t})},forwardAddress:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardAddress",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardAddress",value:t})},forwardPhone:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardPhone",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardPhone",value:t})},forwardResource:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[De],connectConfirmUrl:[De,zu],connectFrom:[],connectTimeout:[At],connectTo:[De],defaultFrom:[],defaultTimeout:[At],sessionTimeout:[At]},validate:e=>Yu("forwardResource",e),validateField:(e,t)=>Ie({name:e,nodeType:"forwardResource",value:t})},hangup:{fieldValidators:{reason:[]},validate:e=>Ku("hangup",e),validateField:(e,t)=>Ie({name:e,nodeType:"hangup",value:t})},play:{fieldValidators:{selected:[De],text:[De],url:[De]},validate:e=>Ku("play",e),validateField:(e,t)=>Ie({name:e,nodeType:"play",value:t})},promptPlay:{fieldValidators:{command:[FC],digit:[UC],digitTimeout:[At,{test:Js,testValue:He.MIN},{test:ei,testValue:He.MAX}],initialTimeout:[At,{test:Js,testValue:He.MIN},{test:ei,testValue:He.MAX}],selected:[De],text:[De],url:[De]},validate:e=>{const t="promptPlay",r=e,s=Er(r.options,"command"),i=Er(r.options,"digit"),a=Ku("promptPlay",r),c=pc(r.initialTimeout);c?.trim()&&!Ie({name:"initialTimeout",nodeType:t,value:c})&&a.push("initialTimeout");const u=pc(r.digitTimeout);return u?.trim()&&!Ie({name:"digitTimeout",nodeType:t,value:u})&&a.push("digitTimeout"),r.options.forEach(f=>{const p=Ie({name:"command",nodeType:t,value:f.command})&&!s(f.command),m=Ie({name:"digit",nodeType:t,value:f.digit})&&!i(f.digit);p&&m&&(f.command||f.digit)||a.push(`option_${f.id}`)}),a},validateField:(e,t)=>Ie({name:e,nodeType:"promptPlay",value:t})},record:{fieldValidators:{beep:[],endSilenceTimeout:[At,{test:Js,testValue:He.MIN},{test:ei,testValue:He.MAX}],format:[De],initialTimeout:[At,{test:Js,testValue:He.MIN},{test:ei,testValue:He.MAX}],maxLength:[At,{test:Js,testValue:Wo.MIN},{test:ei,testValue:Wo.MAX}],stereo:[],terminators:[Jg]},validate:e=>Yo({nodeData:e,nodeType:"record"}),validateField:(e,t)=>Ie({name:e,nodeType:"record",value:t})},recordCallStart:{fieldValidators:{beep:[],controlId:[],format:[De],label:[De,VC],stereo:[],terminators:[Jg]},validate:e=>Yo({nodeData:e,nodeType:"recordCallStart"}),validateField:(e,t)=>Ie({name:e,nodeType:"recordCallStart",value:t})},recordCallStop:{fieldValidators:{controlId:[De]},validate:e=>Yo({nodeData:e,nodeType:"recordCallStop"}),validateField:(e,t)=>Ie({name:e,nodeType:"recordCallStop",value:t})},request:{fieldValidators:{body:[],headers:[$l],method:[De],saveVariables:[],url:[De]},validate:e=>Yo({nodeData:e,nodeType:"request"}),validateField:(e,t)=>Ie({name:e,nodeType:"request",value:t})},sendSms:{fieldValidators:{body:[De],fromNumber:[De],toNumber:[De]},validate:e=>Yo({nodeData:e,nodeType:"sendSms"}),validateField:(e,t)=>Ie({name:e,nodeType:"sendSms",value:t})},set:{fieldValidators:{key:[De,jC],value:[]},validate:e=>{const t=e,r="set",s=[],i=Er(t.variables,"key");return t.variables.forEach(a=>{const c=Ie({name:"key",nodeType:r,value:a.key})&&!i(a.key),u=Ie({name:"value",nodeType:r,value:a.value});c&&u||s.push(`variable_${a.id}`)}),s},validateField:(e,t)=>Ie({name:e,nodeType:"set",value:t})},unset:{fieldValidators:{},validate:e=>e.variables.length>0?[]:["variables"],validateField:(e,t)=>Ie({name:e,nodeType:"unset",value:t})}},It=e=>{const t=Hl?.[e];return{validate:t?.validate,validateField:t?.validateField}},eE=(e,t)=>{const r=Hl[e]?.validate;return r===void 0?[]:r(t)},Wu=(e,t)=>!e||!t?!1:eE(e,t)?.length===0,$C=e=>Hl[e]?.fieldValidators,Ie=({name:e,nodeType:t,value:r})=>{let s=!0;return $C(t)?.[e]?.forEach(a=>{typeof a=="function"?s=s&&a(r):s=s&&a.test(r,a.testValue)}),s},Yo=({nodeData:e,nodeType:t})=>{const r=Hl[t]?.fieldValidators??{},s=[];return Object.keys(r).forEach(i=>{Ie({name:i,nodeType:t,value:e?.[i]??""})||s.push(i)}),s},Gu=(e,t)=>{const r=t,s=[];return r.options.forEach(i=>{Ie({name:"value",nodeType:e,value:i.value})||s.push(`condition_${i.id}`)}),s},Yu=(e,t)=>{const r=[];["callOrder","callStateEvents","callStateUrl","defaultFrom","defaultTimeout"].forEach(a=>{Ie({name:a,nodeType:e,value:t[a]})||r.push(a)});const i=["connectFrom","connectTo","connectTimeout","connectConfirmUrl","connectConfirmId"];return t.connections?.forEach(a=>{i.forEach(c=>{!a.connectConfirmEnabled&&(c==="connectConfirmUrl"||c==="connectConfirmId")||Ie({name:c,nodeType:e,value:a[c]})||r.push(`${c}_${a.id}`)})}),r},Ku=(e,t)=>{const r=[];return Ie({name:"selected",nodeType:e,value:t?.selected})||r.push("selected"),t.selected==="url"?Ie({name:"url",nodeType:e,value:t.url})||r.push("url"):t.selected==="text"&&(Ie({name:"text",nodeType:e,value:t.text})||r.push("text")),r},bt=({data:e,id:t})=>{const r=ye(u=>u.isCanvasInteractive),{getNodeType:s,partialUpdateNodeData:i}=Ze(),{isValueDuplicate:a}=Hu(),c=s(t);return b.useEffect(()=>{if(c&&r){let u=Wu(c,e);c==="recordCallStart"&&"label"in e&&(u=u&&!a(e.label,e.controlId)),u!==e.valid&&i(t,{valid:u})}},[e,t,r,a,i,c]),b.useEffect(()=>{if(c==="aiAgent"&&r){const u=On.subscribe(f=>{if(f.status==="loaded"&&"agent"in e){const p=f.aiAgentMap.has(e.agent),m=p&&Wu(c,e);m!==e.valid&&i(t,{agent:p?e.agent:"",valid:m})}});return()=>{u()}}},[e,t,r,i,c]),b.useEffect(()=>{if((f=>(c==="forwardAddress"||c==="forwardPhone"||c==="forwardResource")&&"connections"in f)(e)&&r){const f=Bn.subscribe(p=>{if(p.status==="loaded"){let m=!0;const E=e.connections.map(x=>{const _=p.actions.updateConnection(x,p.swmlScriptMap);return _?(m=!1,_):x}),v=m&&Wu(c,e);v!==e.valid&&i(t,{connections:E,valid:v})}});return()=>{f()}}},[e,t,r,i,c]),{getInvalidFields:()=>!c||e.valid?[]:eE(c,e),valid:()=>e.valid}},HC=({data:e,id:t,isConnectable:r,selected:s})=>{bt({data:e,id:t});const a=On(c=>c.aiAgentMap.get(e.agent))?.display_name;return h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.AI_AGENT),selected:s,valid:e.valid,children:[a&&h.jsx(Xt,{children:h.jsx("p",{className:"truncate text-xs",children:a})}),h.jsx(an,{id:t,color:"positive",isConnectable:r})]})},BC=({data:e,id:t,isConnectable:r,selected:s})=>h.jsx(dt,{id:t,isConnectable:r,nodeTitle:M(C.ANSWER_CALL),selected:s,valid:e.valid,children:h.jsx(an,{id:t,isConnectable:r,color:"positive"})}),zC=({id:e,data:t,isConnectable:r,selected:s})=>(bt({data:t,id:e}),h.jsx(dt,{id:e,isConnectable:r,nodeTitle:M(C.CONDITIONS),selected:s,valid:t.valid,children:h.jsxs(jo,{children:[t.options.map((i,a)=>{const c=i.value.trim();return h.jsx(cn,{color:"positive",enabled:!!c,id:i.id,isConnectable:r,optionTitle:c?h.jsx("div",{className:"truncate",children:c}):M(C.CONDITION_NUMBER,{index:a+1})},i.id)}),h.jsx(cn,{color:"negative",id:t.fallback,isConnectable:r,optionTitle:M(C.ELSE)})]})})),WC=({data:e,id:t,isConnectable:r,selected:s})=>{bt({data:e,id:t});const i=e.url.trim();return h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.REQUEST),selected:s,valid:e.valid,children:[i&&h.jsx(Xt,{children:h.jsx("div",{className:"break-all line-clamp-3",children:i})}),h.jsxs(jo,{children:[e?.options?.map((a,c)=>{const u=a.value.trim();return h.jsx(cn,{color:"positive",enabled:!!u,id:a.id,isConnectable:r,optionTitle:u?h.jsx("div",{className:"truncate",children:u}):M(C.CONDITION_NUMBER,{index:c+1})},a.id)}),h.jsx(cn,{color:"negative",id:e.fallback,isConnectable:r,optionTitle:M(C.ELSE)}),h.jsx(cn,{color:"negative",id:e.error,isConnectable:r,optionTitle:M(C.FAILURE)})]})]})},GC=({data:e,id:t,isConnectable:r,selected:s})=>{bt({data:e,id:t});const i=e.dest.trim();return h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.EXECUTE_SWML),selected:s,valid:e.valid,children:[i&&h.jsx(Xt,{children:h.jsx("div",{className:"break-all line-clamp-3",children:i})}),h.jsxs(jo,{children:[e?.options?.map((a,c)=>{const u=a.value.trim();return h.jsx(cn,{color:"positive",enabled:!!u,id:a.id,isConnectable:r,optionTitle:u?h.jsx("div",{className:"truncate",children:u}):M(C.CONDITION_NUMBER,{index:c+1})},a.id)}),h.jsx(cn,{color:"negative",id:e.fallback,isConnectable:r,optionTitle:M(C.ELSE)})]})]})},Xu=3,YC={busy:C.BUSY,decline:C.DECLINE,error:C.ERROR,noAnswer:C.NO_ANSWER,success:C.SUCCESS},KC={address:C.FORWARD_TO_ADDRESS,phone:C.FORWARD_TO_PHONE,resource:C.FORWARD_TO_RESOURCE},Qu=({id:e,data:t,isConnectable:r,selected:s})=>{bt({data:t,id:e});const i=t.connections.filter(c=>c.connectTo),a=i.slice(0,Xu);return h.jsxs(dt,{id:e,isConnectable:r,nodeTitle:M(KC[t.destinationType]),selected:s,valid:t.valid,children:[i.length?h.jsxs(Xt,{children:[h.jsx("ul",{children:a.map(c=>h.jsx("li",{className:"pb-2",children:h.jsx("div",{className:"max-w-max truncate rounded bg-secondary/20 px-1 ",children:c.connectTo})},`node-${c.id}`))}),i.length>Xu&&h.jsx("div",{children:`+ ${M(C.MORE_WITH_COUNT,{count:i.length-Xu})}`})]}):null,h.jsx(jo,{children:t.options.map(c=>h.jsx(cn,{color:Dm(c.result),id:c.id,isConnectable:r,optionTitle:M(YC[c.result])},c.id))})]})},XC=({id:e,data:t,isConnectable:r,selected:s})=>{bt({data:t,id:e});const i=Er(t.options,"command"),a=Er(t.options,"digit");return h.jsxs(dt,{id:e,isConnectable:r,nodeTitle:M(C.GATHER_INPUT),selected:s,valid:t.valid,children:[h.jsx(ug,{data:t}),h.jsxs(jo,{children:[t.options.map((c,u)=>{const f=c.command.trim(),p=c.digit.trim(),m=!!(f||p)&&!i(c.command)&&!a(c.digit),E=h.jsxs("div",{className:"flex gap-1",children:[M(C.CALLER_PRESSES)," ",h.jsx("span",{className:"truncate rounded bg-secondary/20 px-1",children:p})]}),v=w=>h.jsxs("div",{className:"flex",children:[M(w?C.CALLER_SAYS:C.OR_CALLER_SAYS)," '",h.jsx("span",{className:"truncate",children:f}),"'"]});let x=M(C.OPTION_NUMBER,{index:u+1}),_="";switch(!0){case!!(f&&!p):x=v(!0);break;case!!(!f&&p):x=E;break;case!!(f&&p):x=E,_=v(!1);break}return h.jsx(cn,{color:"positive",enabled:m,id:c.id,isConnectable:r,optionTitle:x,optionSubtitle:_},c.id)}),t.results.map(c=>h.jsx(cn,{color:"negative",id:c.id,isConnectable:r,optionTitle:c.result==="no_input"?M(C.NO_INPUT):M(C.UNKNOWN)},c.id))]})]})},QC=({id:e,isConnectable:t,selected:r})=>h.jsx(dt,{id:e,isConnectable:t,isRoot:!0,nodeTitle:M(C.HANDLE_CALL),selected:r,deletable:!1,showValidation:!1,target:!1,children:h.jsx(an,{id:e,color:"positive",isConnectable:t})}),qu={busy:C.BUSY,decline:C.DECLINE,hangup:C.HANG_UP},qC=({data:e,id:t,isConnectable:r,selected:s})=>h.jsx(dt,{id:t,isConnectable:r,nodeTitle:M(C.HANG_UP_CALL),selected:s,valid:e.valid,children:e.reason&&h.jsx(Xt,{children:h.jsx("p",{children:M(qu[e.reason])})})}),ZC=({data:e,id:t,isConnectable:r,selected:s})=>(bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.PLAY_AUDIO_TTS),selected:s,valid:e.valid,children:[h.jsx(ug,{data:e}),h.jsx(an,{id:t,isConnectable:r})]})),JC=({data:e,id:t,isConnectable:r,selected:s})=>{const{label:i,valid:a}=e;return bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.RECORD_CALL_START),selected:s,valid:a,children:[i&&a&&h.jsx(Xt,{children:h.jsx("p",{className:"truncate text-xs leading-5",children:i})}),h.jsx(an,{id:t,isConnectable:r,color:"positive"})]})},eA=({data:e,id:t,isConnectable:r,selected:s})=>{bt({data:e,id:t});const a=zo(c=>c.entries)?.find(c=>c.controlId===e.controlId)?.label;return h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.RECORD_CALL_STOP),selected:s,valid:e.valid,children:[a&&h.jsx(Xt,{children:h.jsx("p",{className:"truncate text-xs leading-5",children:a})}),h.jsx(an,{id:t,color:"positive",isConnectable:r})]})},tA=({data:e,id:t,isConnectable:r,selected:s})=>{bt({data:e,id:t});const i=new Set(e.terminators);return h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.VOICEMAIL_RECORDING),selected:s,valid:e.valid,children:[e.terminators?h.jsxs(Xt,{children:[M(C.TERMINATORS),":"," ",h.jsx("ul",{className:"inline-flex flex-wrap justify-start gap-1",children:[...i].sort().map((a,c)=>h.jsx("li",{className:"rounded bg-secondary/20 px-1",children:a},`${c}-${a}`))})]}):null,h.jsx(an,{id:t,isConnectable:r,color:"positive"})]})},nA={failed:C.FAILED,success:C.SUCCESS},tE={aiAgent:HC,answer:BC,cond:zC,condRequest:WC,executeSWML:GC,forwardAddress:Qu,forwardPhone:Qu,forwardResource:Qu,handleCall:QC,hangup:qC,play:ZC,promptPlay:XC,record:tA,recordCallStart:JC,recordCallStop:eA,request:({data:e,id:t,isConnectable:r,selected:s})=>(bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.REQUEST),selected:s,valid:e.valid,children:[h.jsx("p",{className:"p-4 pt-0 text-xs text-negative",children:M(C.DEPRECATED)}),h.jsx(jo,{children:e?.options?.map(i=>h.jsx(cn,{color:Dm(i.result),id:i.id,isConnectable:r,optionTitle:M(nA[i.result])},i.id))})]})),sendSms:({data:e,id:t,isConnectable:r,selected:s})=>(bt({data:e,id:t}),h.jsxs(dt,{id:t,isConnectable:r,nodeTitle:M(C.SEND_SMS),selected:s,valid:e.valid,children:[e.body&&h.jsx(Xt,{children:h.jsx("p",{className:"break-words line-clamp-3",children:e.body})}),h.jsx(an,{id:t,isConnectable:r})]})),set:({id:e,data:t,isConnectable:r,selected:s})=>{const{getInvalidFields:i}=bt({data:t,id:e}),a=i().reduce((u,f)=>(f.startsWith("variable_")&&u.push(f.replace("variable_","")),u),[]),c=t.variables.filter(u=>!!u.key);return h.jsxs(dt,{id:e,isConnectable:r,nodeTitle:M(C.SET_VARIABLES),selected:s,valid:t.valid,children:[c.length>0&&h.jsx(Xt,{children:h.jsx("ul",{className:"flex flex-col",children:c.map(u=>h.jsxs("li",{className:"flex w-full gap-1 pb-2",children:[h.jsx("div",{className:`max-w-[50%] shrink-0 truncate rounded px-1 ${a.includes(u.id)?"bg-negative/10 text-negative":"bg-secondary/20"}`,children:u.key}),"=",u.value&&h.jsx("div",{className:"truncate",children:u.value})]},u.id))})}),h.jsx(an,{id:e,isConnectable:r,color:"positive"})]})},unset:({id:e,data:t,isConnectable:r,selected:s})=>{bt({data:t,id:e});const i=t.variables.filter(a=>!!a.key);return h.jsxs(dt,{id:e,isConnectable:r,nodeTitle:M(C.UNSET_VARIABLES),selected:s,valid:t.valid,children:[i.length>0&&h.jsx(Xt,{children:h.jsx("ul",{children:i.map(a=>h.jsx("li",{className:"pb-2",children:h.jsx("div",{className:"max-w-max truncate rounded bg-secondary/20 px-1",children:a.key})},a.id))})}),h.jsx(an,{id:e,isConnectable:r,color:"positive"})]})}},rA={floating:IC},oA=({children:e})=>{const t=ye(D=>D.nodes),r=ye(D=>D.edges),s=ye(D=>D.isCanvasInteractive),{onConnect:i,onConnectEnd:a,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:p,onEdgeUpdateEnd:m,onEdgeUpdateStart:E,onInit:v,onNodeDragStart:x,onNodeDragStop:_,onNodesChange:w,onNodesDelete:S,onSelectionChange:N,setFlowWrapperElement:O}=Ze();return h.jsx("div",{className:"bg-sw-white !h-auto w-full",ref:D=>O(D),children:h.jsxs(Sm,{attributionPosition:"bottom-left",connectionLineComponent:CC,connectionMode:ar.Strict,deleteKeyCode:s?e1:null,defaultEdgeOptions:ko,edges:r,edgeTypes:rA,elementsSelectable:s,fitViewOptions:gu,multiSelectionKeyCode:s?t1:null,nodes:t,nodesConnectable:s,nodesDraggable:s,nodeTypes:tE,onConnect:i,onConnectEnd:a,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:s?p:void 0,onEdgeUpdateEnd:m,onEdgeUpdateStart:E,onInit:v,onNodeDragStart:x,onNodeDragStop:_,onNodesChange:w,onNodesDelete:S,onSelectionChange:N,selectionKeyCode:s?n1:null,snapGrid:[yl,yl],snapToGrid:!0,children:[h.jsx($R,{className:"bg-background-alt text-grid",color:"currentColor",gap:[yl,yl],variant:Kt.Dots}),e]})})},sA=()=>{const e=ye(u=>u.initializing),t=ye(u=>u.reactFlowInstance),{setInitializing:r,setViewportChanging:s}=Ze(),i=b.useRef(!1),a=CR({includeHiddenNodes:!0}),c=b.useMemo(()=>()=>{t?.fitView(gu)},[t]);b.useEffect(()=>{let u;e?!i.current&&!a?i.current=!0:i.current&&a&&(clearTimeout(u),s(!0),c(),u=setTimeout(()=>{s(!1)},gu.duration),r(!1),i.current=!1):i.current=!1},[e,c,a,r,s])},iA=()=>{const{onViewportChange:e,onViewportChangeEnd:t,onViewportChangeStart:r}=Ze();return sA(),RR({onChange:e,onEnd:t,onStart:r}),null},lA=()=>{const e=ye(r=>r.selectedNode),t=e?fC.get(e.type):void 0;return t?h.jsx(Ds,{className:"z-40 max-w-[40%] rounded-md bg-background",position:"bottom-center",children:h.jsxs("div",{className:"justify-left flex items-center gap-2 rounded-md bg-primary/10 p-3 py-4","data-testid":"cfb__info",children:[h.jsx(Ce,{className:"shrink-0 text-primary",tag:"circle-info",size:"xl"}),h.jsx("div",{className:"text-xs font-medium",children:Ul(t)})]})}):null},aA=e=>{const t=b.useRef(),r=NR(),s=e&&"options"in e.data?e.data.options?.length:0;return t.current=s,{updateDynamicHandles:a=>{"options"in a&&a.options.length!==t.current&&(e&&r(e.id),t.current=a.options.length)}}},cA="/hello/.test('%{foo}')",uA=()=>({id:Le(),value:""}),Zu=({nodeData:e,handleOnUpdate:t,placeholder:r=cA})=>{const{validateField:s}=It("cond"),[i,a]=b.useState({options:e.options.map(E=>({id:!0,initial:e.initial,value:s("value",E.value)}))}),c=E=>{E.preventDefault(),a({...i,options:[...i.options,{initial:!0,value:!0}]}),t({options:[...e.options,uA()]})},u=E=>v=>{v.preventDefault();const x=[...i.options];x.splice(E,1),a({...i,options:x});const _=[...e.options];_.splice(E,1),t({options:_})},f=(E,v)=>{const x=[...e.options];if(!x[E])throw new Error(`Option not found at index ${E}`);const{name:_,value:w}=v,S=[...i.options];S[E]={...S[E],initial:!1,[_]:s(_,w)},a({...i,options:S}),x[E]={...x[E],[_]:w},t({options:x})},p=(E,v)=>{const x=E.target,{name:_,value:w}=x;switch(t({initial:!1}),_){case"value":v!==void 0&&f(v,{name:_,value:w});break;default:Qe().error(`Unhandled input name: ${_}`)}},m=({index:E,name:v})=>{const x=i.options[E];return x?.[v]||x?.initial};return h.jsxs(h.Fragment,{children:[h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.options.map((E,v,x)=>h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[x.length>1&&h.jsx(Fo,{className:"absolute right-0 top-0",handleDelete:u(v),label:M(C.REMOVE_CONDITION,{index:v+1}),size:"sm",show:!0}),h.jsxs("label",{className:"mb-2 block",children:[M(C.CONDITION_NUMBER,{index:v+1}),h.jsx("input",{className:`w-full ${m({index:v,name:"value"})?"":"invalid"}`,name:"value",onChange:_=>p(_,v),placeholder:r,type:"text",value:E.value}),h.jsx("p",{className:"requirements",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]})]})]},E.id))}),h.jsx("div",{className:"p-3 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:c,type:"button",children:M(C.ADD_CONDITION)})})]})},dA=Qe(),ti=(e,t)=>[e,t].filter(Boolean).join("-").toLowerCase(),fA={idsByKey:{},languageById:{},voiceById:{}},pA=(e,t)=>({...fA,actions:{getGenderByKeys:({languageId:r})=>{const{idsByKey:s}=t(),i=r?.split(",").map(c=>ti(c))??[];if(!i.length)return["female","male"];const a=new Set;return i.forEach(c=>s[c]?.forEach(u=>{u.gender&&a.add(u.gender)})),Array.from(a).sort((c,u)=>c.toLowerCase().localeCompare(u.toLowerCase()))},getLanguages:()=>Object.values(t().languageById).sort((r,s)=>r.name.toLowerCase().localeCompare(s.name.toLowerCase())),getVoicesByKeys:({languageId:r,gender:s})=>{const{voiceById:i,idsByKey:a}=t(),c=r?.split(",").map(f=>ti(f,s))??[];let u=[];return!c.length||c[0]===""?u=Object.values(i):c.forEach(f=>{u=u.concat(a[f]??[])}),u.sort((f,p)=>{const m=/^\w{2,3}-\w{2,}-.+/;return f.name.match(m)&&!p.name.match(m)?1:!f.name.match(m)&&p.name.match(m)?-1:f.name.toLowerCase().localeCompare(p.name.toLowerCase())})},init:async({voicesURL:r="/cfb/voices.json"})=>{try{dA.debug("Load voicesURL",r);const i=await(await fetch(r)).json(),a={},c={},u={};i.forEach(f=>{const p=!!f.premium,m=f.signalwire_id,E=f.gender.toLowerCase(),v={gender:E,id:m,key:`${f.language_code}-${E}-${f.signalwire_id}`,name:`${f.friendly_name.trim()} ${p?"(premium)":""}`,premium:p};a[m]=v,c[f.language_code]={id:f.language_code,name:f.language};const x=ti(f.language_code);x in u||(u[x]=[]),u[x]?.push(v);const _=ti(E);_ in u||(u[_]=[]),u[_]?.push(v);const w=ti(f.language_code,E);w in u||(u[w]=[]),u[w]?.push(v)}),e({idsByKey:u,languageById:c,voiceById:a})}catch(s){console.error("Error",s)}}}}),Ju=Do()(pA),hA=()=>Ju.getState().actions;window.__useVoiceStore=Ju;const nE=e=>h.jsx("option",{value:e.id,children:e.name},e.key??e.id),mA=({onChange:e,languageId:t,gender:r,voiceId:s})=>{const{getLanguages:i,getVoicesByKeys:a,getGenderByKeys:c}=hA();return h.jsxs(h.Fragment,{children:[h.jsxs(Tn,{className:"w-full",label:M(C.LANGUAGE),name:"language",onChange:e,value:t??"",children:[h.jsx("option",{value:"",children:M(C.SELECT)}),i().map(nE)]}),h.jsxs(Tn,{className:"w-full capitalize",label:M(C.GENDER),name:"gender",onChange:e,value:r??"",children:[h.jsx("option",{value:"",children:M(C.SELECT)}),c({languageId:t}).map(u=>h.jsx("option",{value:u,children:u},u))]}),h.jsxs(Tn,{className:"w-full",label:M(C.VOICE),name:"voice",onChange:e,value:s??"",children:[h.jsx("option",{value:"",children:M(C.SELECT)}),a({gender:r,languageId:t}).map(nE)]})]})},rE={text:C.TEXT_TO_SPEECH,url:C.PLAY_AUDIO_FILE},oE=({handleOnUpdate:e,label:t,nodeData:r,showDefaultOption:s})=>{const{validateField:i}=It("play"),[a,c]=b.useState({gender:!0,language:!0,selected:r.initial||i("selected",r.selected),text:r.initial||i("text",r.text),url:r.initial||i("url",r.url),voice:!0}),u=r.selected;b.useEffect(()=>{!u&&!s&&e({selected:"url"})},[e,u,s]);const f=m=>{const E=m.target,{name:v,value:x}=E;switch(v){case"selected":case"text":case"url":c({...a,[v]:i(v,x)}),e({initial:!1,[v]:x});break;default:throw new Error(`Unhandled input name: ${v}`)}},p=m=>{const E=m.target,{name:v,value:x}=E;switch(v){case"language":e({gender:void 0,language:x,voice:void 0});break;case"gender":e({gender:x,voice:void 0});break;default:e({[v]:x})}};return h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"mb-2",children:[h.jsx("span",{className:"sr-only",children:t}),h.jsxs(dg,{className:`w-full ${a.selected?"":"invalid"}`,name:"selected",onChange:f,value:u,children:[s&&h.jsx("option",{value:"",children:M(C.SELECT)}),Object.keys(rE).map(m=>h.jsx("option",{value:m,children:M(rE[m])},m))]})]}),u&&h.jsx(gA,{nodeData:r,onChange:f,voiceSettingsChangeHandler:p,selected:u,valid:a[u]})]})},gA=({nodeData:e,onChange:t,voiceSettingsChangeHandler:r,selected:s,valid:i})=>{const a=e[s],u={text:h.jsxs(h.Fragment,{children:[h.jsx(mA,{onChange:r,languageId:e.language,gender:e.gender,voiceId:e.voice}),h.jsx($n,{errorText:M(C.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(C.TEXT),name:s,onChange:t,placeholder:M(C.WRITE_SOMETHING),valid:i,value:a})]}),url:h.jsx($n,{errorText:M(C.ERROR_URL_IS_REQUIRED),inputMode:"url",label:M(C.AUDIO_FILE),name:s,onChange:t,placeholder:M(C.ENTER_URL),valid:i,value:a})}[s];return h.jsx(h.Fragment,{children:u})},EA=[{field:"stereo",subtitle:C.STEREO_SUBTITLE,title:C.STEREO},{field:"beep",subtitle:C.BEEP_SUBTITLE,title:C.BEEP}],sE=({handleOnUpdate:e,nodeData:t,type:r})=>{const{validateField:s}=It("record"),[i,a]=b.useState({beep:!0,endSilenceTimeout:t.initial||s("endSilenceTimeout",t.endSilenceTimeout),format:!0,initialTimeout:t.initial||s("initialTimeout",t.initialTimeout),maxLength:t.initial||s("maxLength",t.maxLength),stereo:!0,terminators:t.initial||s("terminators",t.terminators)});t.format||e({format:"mp3"});const c=f=>{const p=f.target.name;e({[p]:!t[p]})},u=f=>{const p=f.target,{name:m,value:E}=p;switch(m){case"endSilenceTimeout":case"format":case"initialTimeout":case"maxLength":case"terminators":a({...i,[m]:s(m,E)}),e({initial:!1,[m]:E});break;default:throw new Error(`Unhandled input name: ${m}`)}};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-2",children:EA.map(f=>{const p=t[f.field];return h.jsx("div",{children:h.jsx(Ol,{checked:p,clickHandler:c,name:f.field,subtitle:M(f.subtitle),title:M(f.title)})},f.field)})}),h.jsxs("label",{className:"mb-2 block",children:[M(C.TERMINATORS),h.jsx("span",{className:"block text-xxs text-foreground/50",children:M(C.SEPARATE_WITH_COMMAS)}),h.jsx("input",{className:`w-full ${i.terminators?"":"invalid"}`,name:"terminators",onChange:u,placeholder:"#*0",type:"text",value:t.terminators}),h.jsx("p",{className:"requirements",role:"alert",children:M(C.ERROR_TERMINATORS)})]}),r==="voicemail"&&h.jsxs(h.Fragment,{children:[h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(C.MAXIMUM_RECORDING_LENGTH)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.maxLength?"":"invalid"}`,inputMode:"numeric",min:Wo.MIN,max:Wo.MAX,name:"maxLength",onChange:u,placeholder:M(C.SECONDS),type:"number",value:t.maxLength}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Wo.MAX,min:Wo.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(C.INITIAL_TIMEOUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.initialTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"initialTimeout",onChange:u,placeholder:M(C.SECONDS),type:"number",value:t.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(C.END_SILENCE_TIMEOUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.endSilenceTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"endSilenceTimeout",onChange:u,placeholder:M(C.SECONDS),type:"number",value:t.endSilenceTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]})]}),h.jsxs(Tn,{className:"w-full",label:M(C.FORMAT),name:"format",onChange:u,value:t.format,children:[h.jsx("option",{value:"mp3",children:"MP3"}),h.jsx("option",{value:"wav",children:"WAV"})]})]})},_t=({children:e,formRef:t,handleOnChange:r=()=>null,title:s})=>h.jsxs("div",{className:"flex flex-col overflow-hidden","data-testid":"cfb__settings",children:[h.jsxs("div",{className:"flex w-full items-center justify-start gap-x-2 px-4 pb-3",children:[h.jsx("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-focus/30 text-primary",children:h.jsx(Ce,{tag:"circle-small"})}),h.jsx("div",{className:"flex-1",children:h.jsx("h2",{className:"text-xs font-semibold",children:s})})]}),h.jsx("form",{className:"flex h-full flex-col overflow-hidden text-xs",noValidate:!0,onChange:r,ref:t,children:h.jsx("div",{className:"flex-1 overflow-y-auto pt-1 pb-4",children:e})})]}),yA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("aiAgent"),[s,i]=b.useState({agent:e.initial||r("agent",e.agent)}),a=On(w=>w.aiAgentMap.values()),c=On(w=>w.error),u=On(w=>w.status),{fetchAiAgents:f}=mC();b.useEffect(()=>{f()},[f]);const p=Array.from(a),m=u==="loading",E=!!c||u==="error",v=E||u==="initial",x=w=>{const S=w.target,{name:N,value:O}=S;i({...s,[N]:r(N,O)}),t({initial:!1,[N]:O})},_=b.useId();return h.jsx(_t,{title:M(C.AI_AGENT),children:h.jsx("div",{className:"mx-3",children:!E&&p.length?h.jsxs("div",{className:"relative",children:[h.jsxs(Tn,{id:_,className:`${s.agent?"":"invalid"}`,disabled:v,label:M(C.AI_AGENT_NAME),name:"agent",onChange:x,value:e.agent,children:[h.jsx("option",{value:"",children:M(C.SELECT)}),p.map(w=>h.jsx("option",{value:w.id,children:w.display_name},w.id))]}),h.jsx(iE,{className:"absolute top-0 right-0 mx-1",handleClickResync:f,isLoading:m}),e.agent&&h.jsx("p",{children:h.jsx(lE,{agent:e.agent,mode:"edit",className:"mb-2",children:M(C.EDIT_SELECTED_AI_AGENT)})})]}):h.jsxs("div",{className:"flex items-end justify-between",children:[h.jsx("p",{role:"alert",className:"text-negative",children:E?h.jsx(h.Fragment,{children:M(C.ERROR_FETCHING_AI_AGENTS)}):h.jsxs(h.Fragment,{children:[M(C.ERROR_ADD_AI_AGENT_FIRST),h.jsx(lE,{mode:"add",className:"mt-2 block",children:M(C.ADD_AI_AGENT)})]})}),h.jsx(iE,{className:"mx-1",handleClickResync:f,isLoading:m})]})})})},iE=({className:e="",isLoading:t,handleClickResync:r})=>h.jsx(gr,{placement:"bottom-end",trigger:h.jsxs("button",{className:`overflow-hidden ${t?"text-disabled":""} ${e}`,disabled:t,onClick:r,type:"button",children:[h.jsx(Ce,{className:`${t?"animate-spin":""}`,tag:"arrows-rotate"}),h.jsx("span",{className:"sr-only",children:M(C.RESYNC_AI_AGENTS)})]}),children:h.jsx("p",{className:"text-sm",children:M(C.RESYNC_AI_AGENTS)})}),lE=({agent:e="",children:t,className:r="",mode:s})=>{const i={add:"",edit:`${e}/edit`};return h.jsx("a",{className:`w-fit text-foreground underline hover:text-foreground/80 ${r}`,href:`/ai_agents/${i[s]}`,target:"_blank",rel:"noopener noreferrer",children:t})},vA=["GET","POST","PUT","DELETE"],xA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("condRequest"),[s,i]=b.useState({body:e.initial||r("body",e.body),headers:e.initial||r("headers",e.headers),method:e.initial||r("method",e.method),saveVariables:e.initial||r("saveVariables",e.saveVariables),url:e.initial||r("url",e.url)}),a=f=>{const p=f.target,{name:m,value:E}=p;switch(t({initial:!1}),m){case"url":case"method":i({...s,[m]:r(m,E)}),t({[m]:E});break;case"headers":i({...s,[m]:r(m,E)}),t({[m]:E});break;case"body":i({...s,[m]:r(m,E)}),t({[m]:E});break;default:throw new Error(`Unhandled input name: ${m}`)}},c=f=>{const{name:p,value:m}=f.target;t({[p]:m})},u=f=>{const{name:p}=f.target,m=!e[p];t({[p]:m})};return h.jsxs(_t,{title:M(C.REQUEST),children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(C.URL),h.jsx("input",{className:`w-full ${s.url?"":"invalid"}`,name:"url",onChange:a,placeholder:"https://u:p@example.com/api/status",type:"text",value:e.url}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(Tn,{className:"w-full",label:M(C.METHOD),name:"method",onChange:c,value:e.method,children:vA.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Ol,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:M(C.SAVE_VARIABLES_SUBTITLE),title:M(C.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.REQUEST_HEADERS),name:"headers",onChange:a,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.headers,value:e.headers})}),h.jsx("label",{className:"mb-2 block",children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.REQUEST_BODY),name:"body",onChange:a,placeholder:M(C.STRING_OR_JSON),valid:s.body,value:e.body??""})})]}),h.jsx(Zu,{nodeData:e,handleOnUpdate:t})]})},SA=({nodeData:e,handleOnUpdate:t})=>{const r=b.useRef();return h.jsx(_t,{formRef:r,title:M(C.CONDITIONS),children:h.jsx("div",{children:h.jsx(Zu,{nodeData:e,handleOnUpdate:t})})})},_A=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("executeSWML"),[s,i]=b.useState({dest:e.initial||r("dest",e.dest),meta:e.initial||r("meta",e.meta),params:e.initial||r("params",e.params)}),a=c=>{const u=c.target,{name:f,value:p}=u;switch(t({initial:!1}),f){case"dest":case"params":case"meta":i({...s,[f]:r(f,p)}),t({[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsxs(_t,{title:M(C.EXECUTE_SWML),children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(C.URL),h.jsx("input",{className:`w-full ${s.dest?"":"invalid"}`,name:"dest",onChange:a,placeholder:"https://u:p@test.com/go.swml",type:"text",value:e.dest}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{className:"mb-2 block",children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.PARAMS),name:"params",onChange:a,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.params,value:e.params??""})}),h.jsx("label",{className:"mb-2 block",children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.META),name:"meta",onChange:a,placeholder:M(C.JSON_OBJECT),valid:s.meta,value:e.meta??""})})]}),h.jsx(Zu,{nodeData:e,handleOnUpdate:t,placeholder:"return_value === '1'"})]})},aE=(e,t)=>{b.useEffect(()=>{const r=e.current?.getRootNode(),s=i=>{const a=i.target;a instanceof Node&&!e.current?.contains(a)&&t(i)};return r&&r.addEventListener("pointerdown",s),()=>{r&&r.removeEventListener("pointerdown",s)}},[e,t])},ed=e=>{const[t,r]=b.useReducer((s,i)=>({...s,...i}),e);return[t,r]},wA=Qe(),NA=({enable:e,searchParams:t})=>{const r=Bn(E=>E.results),s=Bn(E=>E.status),i=Bn(E=>E.error),{buildParamsFromQuery:a,buildQueryFromParams:c,getCachedResults:u,fetchSwmlScript:f,setResults:p}=Qg(),m=c(t);return b.useEffect(()=>{if(!e)return;const E=u(m);E&&p(E);const v=a(m),x=setTimeout(()=>{f(v).catch(_=>{wA.error("Error fetching swml scripts",_)})},Im);return()=>clearTimeout(x)},[a,c,e,f,u,m,p]),[r,s,i]},td=e=>e==="external",RA={externalValue:"",focusedId:"",focusedName:"",open:!1,query:""},TA=({confirmId:e,confirmName:t,confirmUrl:r,onChange:s,valid:i})=>{const a={displayName:M(C.EXTERNAL_URL),id:"external"},c=b.useRef(null),u=b.useRef(null),f=b.useRef(null),p=b.useRef({}),m=b.useId(),E=b.useId(),v=b.useId(),[x,_]=ed({...RA,externalValue:td(e)?r:"",query:t??""}),w=td(e),S=x.query===""||x.query.toLocaleLowerCase()===t.toLocaleLowerCase(),[N,O]=NA({enable:x.open&&!x.focusedName,searchParams:{name:S?"":x.query}}),D=[{displayName:M(C.EXTERNAL_URL),id:a.id},...N],T=S?D:N,A=()=>_({focusedId:"",focusedName:""}),L=Y=>{_({open:!0,query:Y.target.value}),A()},F=Y=>{_({externalValue:Y.target.value}),s({connectConfirmDisplayName:a.displayName,connectConfirmId:a.id,connectConfirmUrl:Y.target.value})},K=()=>{_({focusedId:e,open:!0}),ee()},Q=()=>{_({open:!1}),A()},X=()=>x.open?Q():K(),ee=()=>{u.current?.focus()},ne=Y=>{const re=Um(D,"id",Y);_({query:re.displayName});const oe=le=>"requestUrl"in le?le.requestUrl:x.externalValue;s({connectConfirmDisplayName:re.displayName,connectConfirmId:re.id,connectConfirmUrl:oe(re)}),Q()},W=Y=>{ee(),ne(Y)},I=Y=>{const re=x.focusedId||e||"",oe=i1(Y,re,T),le=oe&&p.current[oe?.id];if(le){le?.focus({preventScroll:!0}),le?.scrollIntoView({block:"nearest"});const de=Um(D,"id",le.id);_({focusedId:de.id,focusedName:de.displayName}),u.current&&(u.current.value=de.displayName)}else ee();x.open||K()},V=()=>{p.current[x.focusedId]&&ne(x.focusedId)},j=()=>{x.query!==t&&_({query:t}),Q()},B=Y=>{const{key:re}=Y;switch(re){case"ArrowDown":case"ArrowUp":Y.preventDefault(),I(re),ee();break;case"Enter":Y.preventDefault(),V();break;case"Escape":Y.preventDefault(),j();break}};b.useEffect(()=>{w&&f.current&&f.current.focus()},[w]),aE(c,Q);const U=x.open&&!T.length,$=O==="loading"&&U,z=O==="error",k=t&&e===""&&r==="";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`relative mb-2 block ${z?"after:border-t-foreground/40":"after:border-t-foreground"}`,ref:c,children:[h.jsx("label",{className:"block pb-1 font-medium",id:E,htmlFor:m,children:M(C.HANDLE_VIA)}),h.jsxs("div",{className:"relative pb-1",children:[h.jsx("input",{"aria-activedescendant":x.open?x.focusedId:void 0,"aria-invalid":U,"aria-autocomplete":"list","aria-controls":x.open?m:void 0,"aria-expanded":x.open,"aria-labelledby":E,autoComplete:"off",className:`${z||k?"invalid":""} rounded-md border border-foreground !p-2 !pr-8`,disabled:z,onChange:L,onClick:K,onKeyDown:B,placeholder:x.open?M(C.SEARCH_FOR_INTERNAL_SCRIPT):M(C.EXTERNAL_OR_INTERNAL_RESOURCE),ref:u,role:"combobox",type:"text",value:x.focusedName||x.query}),h.jsxs("button",{"aria-controls":x.open?m:void 0,"aria-expanded":x.open,"aria-haspopup":"listbox","aria-labelledby":`${E} ${v}`,className:`${x.open?"after:rotate-180":"after:rotate-0"} chevron-down absolute inset-y-0 right-0 px-4 after:transition-transform focus-within:!ring-0 focus-within:!ring-offset-0`,disabled:z,id:v,onClick:X,tabIndex:-1,type:"button",children:[$&&h.jsx(Ce,{className:"absolute top-3 right-7 animate-spin",tag:"arrows-rotate",size:"xs"}),h.jsx("span",{className:"sr-only",children:M(x.open?C.TOGGLE_CLOSE:C.TOGGLE_OPEN)})]}),h.jsxs("p",{className:"requirements w-full",role:"alert",children:[k&&M(C.SCRIPT_NOT_FOUND),z&&M(C.ERROR_FETCHING_SWML_SCRIPTS)]})]}),!z&&x.open&&h.jsx("ul",{className:"max-h-60 w-full overflow-auto rounded shadow-[0px_2px_6px_2px_rgba(0,0,0,0.15),_0px_1px_2px_0px_rgba(0,0,0,0.30)]","aria-labelledby":E,id:m,role:"listbox",onKeyDown:B,children:T.length?h.jsxs(h.Fragment,{children:[T.length===1&&td(T?.[0]?.id)&&(O==="loaded"||O==="loading")&&h.jsx(nd,{displayName:M(O==="loading"?C.STATUS_LOADING:C.NO_SCRIPTS_FOUND)}),T.map(({displayName:Y,id:re},oe)=>{const le=e===re,de=x.focusedId?x.focusedId===re:oe===0;return h.jsx(nd,{active:le,focus:de,displayName:Y,handleOnClick:()=>W(re),id:re,ref:he=>p.current[re]=he},re)})]}):h.jsx(nd,{displayName:M($?C.STATUS_LOADING:C.NO_RESULTS)})})]}),w&&h.jsxs("label",{className:"mb-2 block",children:[h.jsx("span",{className:"sr-only",children:M(C.EXTERNAL_OPTION_LABEL)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i?"":"invalid"}`,inputMode:"url",name:"connectConfirmUrl",onChange:F,placeholder:M(C.ENTER_URL),ref:f,type:"url",value:x.externalValue}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_URL_IS_REQUIRED)})]})]}),!N.length&&!w&&h.jsx("div",{className:"mb-2",children:h.jsx("p",{children:h.jsx(OA,{children:M(C.ADD_SWML_SCRIPTS)})})})]})},nd=b.forwardRef(function({active:t,displayName:r,focus:s,handleOnClick:i,id:a},c){const u=!!i,f=u?`cursor-pointer transition-colors hover:bg-primary/5 focus:bg-primary/5 aria-selected:bg-primary/20 ${s?"bg-primary/5":""}`:"";return h.jsx("li",{"aria-selected":t,className:`relative select-none bg-background py-1 px-3 text-xs leading-6 ${f}`,id:a,onClick:i,ref:c,role:u?"option":"presentation",tabIndex:-1,children:r})}),OA=({children:e,className:t=""})=>h.jsx("a",{className:`w-fit text-foreground underline hover:text-foreground/80 ${t}`,href:"/relay-bins",target:"_blank",rel:"noopener noreferrer",children:e}),CA=({confirmId:e,confirmName:t,confirmUrl:r,enabled:s,handleOnChange:i,onCheck:a,valid:c})=>{const u=b.useId(),{validateCache:f}=Qg();return b.useEffect(()=>{s&&f()},[s,f]),h.jsxs(h.Fragment,{children:[h.jsx(Ol,{"aria-controls":u,"aria-expanded":s,checked:s,clickHandler:a,name:"connectConfirmEnabled",subtitle:M(C.SWML_TO_EXECUTE),title:M(C.ENABLE_WHISPER)}),s&&h.jsx("div",{id:u,children:h.jsx(TA,{onChange:i,confirmId:e,confirmName:t,confirmUrl:r,valid:c})})]})},AA={forwardAddress:{add:C.ADD_ADDRESS,call:C.CALL_ADDRESSES,optionNumber:C.ADDRESS_NUMBER,remove:C.REMOVE_ADDRESS,title:C.FORWARD_TO_ADDRESS},forwardPhone:{add:C.ADD_PHONE_NUMBER,call:C.CALL_NUMBERS,optionNumber:C.PHONE_NUMBER_NUMBER,remove:C.REMOVE_PHONE_NUMBER,title:C.FORWARD_TO_PHONE},forwardResource:{add:C.ADD_RESOURCE,call:C.CALL_RESOURCES,optionNumber:C.RESOURCE_NUMBER,remove:C.REMOVE_RESOURCE,title:C.FORWARD_TO_RESOURCE}},cE={parallel:C.SIMULTANEOUSLY,serial:C.SEQUENTIALLY},IA=()=>({connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:Le()}),rd=({nodeType:e,nodeData:t,handleOnUpdate:r})=>{const{validateField:s}=It(e),i=b.useRef(),[a,c]=b.useState(["serial","parallel"].includes(t.callOrder)?t.callOrder:"serial"),u=AA[e],[f,p]=b.useState({callOrder:t.initial||s("callOrder",a),callStateEvents:t.initial||s("callStateEvents",a),callStateUrl:t.initial||s("callStateUrl",a),connections:t.connections?.map(D=>({connectConfirmId:s("connectConfirmId",D.connectConfirmId),connectConfirmUrl:s("connectConfirmUrl",D.connectConfirmUrl),connectFrom:s("connectFrom",D.connectFrom),connectTimeout:s("connectTimeout",D.connectTimeout),connectTo:s("connectTo",D.connectTo),initial:t.initial})),defaultFrom:t.initial||s("defaultFrom",t.defaultFrom),defaultTimeout:t.initial||s("defaultTimeout",t.defaultTimeout)}),m=D=>{D.preventDefault(),p({...f,connections:[...f.connections,{connectConfirmId:!0,connectConfirmUrl:!0,connectFrom:!0,connectTimeout:!0,connectTo:!0,initial:!0}]}),r({callOrder:a,connections:[...t.connections,IA()]})},E=D=>T=>{T.preventDefault();const A=[...f.connections];A.splice(D,1),p({...f,connections:A});const L=[...t.connections];L.splice(D,1),r({callOrder:L.length===1?"single":a,connections:L})},v=(D,T,A)=>{const L=[...t.connections],F=L[D];if(!F)throw new Error(`Option not found at index ${D}`);const K=T?.name,Q=T?.value,ee={...K?{[K]:Q}:{},...A,id:F.id},ne=[...f.connections],W=Object.keys(ee).reduce((j,B)=>{const U=ee[B],$=B;return j[$]=s(B,U),j},{initial:!1}),I=ne.map((j,B)=>B===D?{...j,...W}:j);p({...f,connections:I});const V=L.map(j=>j.id===ee.id?{...j,...ee}:j);r({connections:V,initial:!1})},x=D=>{const T=D.currentTarget.value;c(T),r({callOrder:T})},_=(D,T)=>{v(D,void 0,T)},w=(D,T)=>{_(D,{connectConfirmEnabled:T})},S=D=>T=>_(D,{...T}),N=(D,T)=>{const A=D.target,{name:L,value:F}=A;switch(L){case"callStateEvents":case"callStateUrl":case"defaultTimeout":case"defaultFrom":p({...f,[L]:s(L,F)}),r({initial:!1,[L]:F});break;case"connectFrom":case"connectTimeout":case"connectTo":if(T===void 0)throw new Error(`Option index not provided: ${L}`);v(T,{name:L,value:F});break;default:throw new Error(`Unhandled input name: ${L}`)}},O=({index:D,name:T})=>{const A=f.connections[D];return!!(A?.[T]||A?.initial)};return h.jsxs(_t,{title:M(u.title),formRef:i,children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3 pb-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(C.DEFAULT_FROM),h.jsx(Ys,{className:"w-full",direction:"from",name:"defaultFrom",onChange:N,placeholder:M(C.FROM),type:"tel",value:t.defaultFrom,valid:f.defaultFrom}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.DEFAULT_TIMEOUT),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${f.defaultTimeout?"":"invalid"}`,inputMode:"numeric",min:0,name:"defaultTimeout",onChange:N,placeholder:M(C.SECONDS),type:"number",value:t.defaultTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.CALL_STATE_URL),h.jsx("input",{className:`w-full ${f.callStateUrl?"":"invalid"}`,name:"callStateUrl",onChange:N,placeholder:"https://example.com/api",type:"url",value:t.callStateUrl}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.CALL_STATE_EVENTS),h.jsx("input",{className:`w-full ${f.callStateEvents?"":"invalid"}`,name:"callStateEvents",onChange:N,placeholder:"Created, ringing, answered, ended",type:"text",value:t.callStateEvents}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]})]}),h.jsx("ul",{className:"border-foreground-10 divide-y-4 divide-foreground/10 border-b-4 pt-2",children:t.connections?.map((D,T,A)=>h.jsx("li",{className:"flex flex-col gap-y-2 px-4",children:h.jsxs("fieldset",{children:[h.jsxs("div",{className:"item-center flex justify-between py-4",children:[h.jsxs("legend",{children:[h.jsx(Ce,{className:"pr-2 text-foreground/60",size:"xs",tag:"bars"}),h.jsx("span",{className:"text-xs font-semibold",children:M(u.optionNumber,{index:T+1})})]}),A.length>1&&h.jsx(Fo,{handleDelete:E(T),label:M(u.remove,{index:T+1}),size:"sm",show:!0})]}),h.jsxs("label",{className:"mb-1 block pl-2",children:[h.jsx("div",{className:"sr-only",children:M(C.TO)}),h.jsx(Ys,{className:"w-full",direction:"to",name:"connectTo",onChange:L=>N(L,T),type:e==="forwardPhone"?"tel":"text",valid:O({index:T,name:"connectTo"}),value:D.connectTo}),h.jsx("p",{className:"requirements",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[h.jsx("div",{className:"sr-only",children:M(C.FROM)}),h.jsx(Ys,{className:"w-full",direction:"from",name:"connectFrom",onChange:L=>N(L,T),placeholder:M(C.FROM),type:"text",valid:O({index:T,name:"connectFrom"}),value:D.connectFrom}),h.jsx("p",{className:"requirements",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[M(C.TIMEOUT),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`${O({index:T,name:"connectTimeout"})?"":"invalid"}`,inputMode:"numeric",min:0,name:"connectTimeout",onChange:L=>N(L,T),placeholder:M(C.SECONDS),type:"number",value:D.connectTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsx("div",{className:"mb-2 block pl-2",children:h.jsx(CA,{confirmId:D.connectConfirmId,confirmName:D.connectConfirmDisplayName,confirmUrl:D.connectConfirmUrl,enabled:D.connectConfirmEnabled,handleOnChange:S(T),onCheck:()=>w(T,!D.connectConfirmEnabled),valid:O({index:T,name:"connectConfirmUrl"})&&O({index:T,name:"connectConfirmId"})})})]})},D.id))}),h.jsx("div",{className:"p-3 pb-6 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:m,type:"button",children:M(u.add)})}),t.connections?.length>1&&h.jsx("div",{className:"mb-4 px-3",children:h.jsx(Tn,{className:"w-full",label:M(u.call),name:"callOrder",onChange:x,value:a,children:Object.keys(cE).map(D=>h.jsx("option",{value:D,children:M(cE[D])},D))})})]})},bA=()=>({command:"",digit:"",id:Le()}),LA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("promptPlay"),s=b.useRef(),[i,a]=b.useState({digitTimeout:e.initial||r("digitTimeout",e.digitTimeout),initialTimeout:e.initial||r("initialTimeout",e.initialTimeout),options:e.options.map(x=>({command:r("command",x.command),digit:r("digit",x.digit),initial:e.initial}))}),c=Er(e.options,"command"),u=Er(e.options,"digit"),f=x=>{x.preventDefault(),a({...i,options:[...i.options,{command:!0,digit:!0,initial:!0}]}),t({options:[...e.options,bA()]})},p=x=>_=>{_.preventDefault();const w=[...i.options];w.splice(x,1),a({...i,options:w});const S=[...e.options];S.splice(x,1),t({options:S})},m=(x,_)=>{const w=[...e.options];if(!w[x])throw new Error(`Option not found at index ${x}`);const{name:S,value:N}=_,O=[...i.options];O[x]={...O[x],initial:!1,[S]:r(S,N)},a({...i,options:O}),w[x]={...w[x],[S]:N},t({options:w})},E=(x,_)=>{const w=x.target,{name:S,value:N}=w;switch(t({initial:!1}),S){case"digit":case"command":_!==void 0&&m(_,{name:S,value:N});break;case"digitTimeout":case"initialTimeout":{a({...i,[S]:r(S,N)}),t({[S]:N});break}default:throw new Error(`Unhandled input field name: ${S}`)}},v=({index:x,name:_})=>{const w=i.options[x];if(w?.initial)return!0;if(!w?.[_])return!1;const S=e.options?.[x];return jt(S?.digit)||jt(S?.command)};return h.jsxs(_t,{formRef:s,title:M(C.GATHER_INPUT),children:[h.jsx("div",{className:"border-b-4 border-foreground/10 px-3 pb-3",children:h.jsx(oE,{handleOnUpdate:t,label:M(C.CHOOSE_OPTION_TTS_AUDIO),nodeData:e})}),h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.options.map((x,_,w)=>{const S=c(x.command),N=u(x.digit);return h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[w.length>1&&h.jsx(Fo,{className:"absolute right-0 top-0",handleDelete:p(_),label:M(C.REMOVE_OPTION,{index:_+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:M(C.OPTION_NUMBER,{index:_+1})}),h.jsxs("label",{className:"mb-2 block",children:[M(C.CALLER_PRESSES),h.jsx("input",{className:`${v({index:_,name:"digit"})&&!N?"":"invalid"}`,name:"digit",onChange:O=>E(O,_),placeholder:M(C.KEYPAD_VALUE),type:"text",value:x.digit}),h.jsx("p",{className:"requirements",role:"alert",children:M(N?C.ERROR_DUPLICATE_TELEPHONE_KEY:C.ERROR_TELEPHONE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.OR_SAYS),h.jsx("input",{className:`w-full ${v({index:_,name:"command"})&&!S?"":"invalid"}`,name:"command",onChange:O=>E(O,_),placeholder:M(C.SPOKEN_PROMPT),type:"text",value:x.command}),h.jsx("p",{className:"requirements",role:"alert",children:M(S?C.ERROR_DUPLICATE_COMMAND:C.ERROR_TEXT_IS_REQUIRED)})]})]})]})]},x.id)})}),h.jsx("div",{className:"p-3 pb-6 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:f,type:"button",children:M(C.ADD_OPTION)})}),h.jsxs("div",{className:"px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(C.WAIT_FOR_INPUT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.initialTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"initialTimeout",onChange:E,placeholder:M(C.SECONDS),type:"number",value:e.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]}),h.jsxs("label",{children:[h.jsx("div",{className:"w-full",children:M(C.WAIT_FOR_DIGIT)}),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`w-14 ${i.digitTimeout?"":"invalid"}`,inputMode:"numeric",min:He.MIN,max:He.MAX,name:"digitTimeout",onChange:E,placeholder:M(C.SECONDS),type:"number",value:e.digitTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:He.MAX,min:He.MIN})})]})]})]})]})},DA=({handleOnUpdate:e,nodeData:t})=>{const{validateField:r}=It("play"),[s,i]=b.useState({reason:t.initial||r("reason",t.reason)}),a=c=>{const u=c.target,{name:f,value:p}=u;switch(f){case"reason":i({...s,[f]:r(f,p)}),e({initial:!1,[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsx(_t,{title:M(C.HANG_UP_CALL),children:h.jsx("div",{className:"mx-3",children:h.jsxs(Tn,{className:"w-full",label:`${M(C.REASON)} (${M(C.OPTIONAL)})`,name:"reason",onChange:a,value:t.reason,children:[h.jsx("option",{value:"",children:M(C.SELECT)}),Object.keys(qu).map(c=>h.jsx("option",{value:c,children:M(qu[c])},c))]})})})},kA=({nodeData:e,handleOnUpdate:t})=>{const r=b.useRef();return h.jsx(_t,{formRef:r,title:M(C.PLAY_AUDIO_TTS),children:h.jsx("div",{className:"mx-3",children:h.jsx(oE,{handleOnUpdate:t,label:M(C.CHOOSE_OPTION_TTS_AUDIO),nodeData:e,showDefaultOption:!0})})})},MA=({nodeData:e,handleOnUpdate:t})=>{const r=b.useRef(),{validateField:s}=It("recordCallStart"),[i,a]=b.useState({label:e.initial||s("label",e.label)}),[c,u]=b.useState(!1),{upsertEntry:f,isValueDuplicate:p}=Hu();b.useEffect(()=>{u(p(e.label,e.controlId))},[p,e.controlId,e.label]);const m=E=>{const v=E.target,{name:x,value:_}=v;a({...i,[x]:s(x,_)}),t({initial:!1,[x]:_}),f({controlId:e.controlId,label:_})};return h.jsxs(_t,{title:M(C.RECORD_CALL_START),formRef:r,children:[h.jsx("div",{className:"px-3 pb-3",children:h.jsxs("label",{children:[M(C.RECORDING_NAME),h.jsx("input",{className:`w-full ${i.label&&!c?"":"invalid"}`,name:"label",onChange:m,type:"text",value:e.label}),h.jsx("p",{className:"requirements",role:"alert",children:M(c?C.ERROR_DUPLICATE_RECORDING_LABEL:C.ERROR_RECORDING_LABEL_REQUIRED)})]})}),h.jsx("div",{className:"px-3",children:h.jsx(sE,{handleOnUpdate:t,nodeData:e,type:"call"})})]})},PA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("recordCallStop"),[s,i]=b.useState({controlId:e.initial||r("controlId",e.controlId)}),{getEntries:a}=Hu(),c=a().sort((f,p)=>f.label.toLowerCase().localeCompare(p.label.toLowerCase())),u=f=>{const p=f.target,{name:m,value:E}=p;i({...s,[m]:r(m,E)}),t({initial:!1,[m]:E})};return h.jsx(_t,{title:M(C.RECORD_CALL_STOP),children:h.jsx("div",{className:"px-3",children:c.length?h.jsxs(Tn,{className:`w-full ${s.controlId?"":"invalid"}`,label:M(C.RECORDING_NAME),name:"controlId",value:e.controlId,onChange:u,children:[h.jsx("option",{value:"",children:M(C.SELECT)}),c.map(f=>h.jsx("option",{value:f.controlId,children:f.label},f.controlId))]}):h.jsx("p",{role:"alert",className:"text-negative",children:M(C.ERROR_ADD_RECORDING_FIRST)})})})},UA=({nodeData:e,handleOnUpdate:t})=>h.jsx(_t,{title:M(C.VOICEMAIL_RECORDING),children:h.jsx("div",{className:"mx-3",children:h.jsx(sE,{handleOnUpdate:t,nodeData:e,type:"voicemail"})})}),FA=["GET","POST","PUT","DELETE"],jA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("request"),[s,i]=b.useState({body:e.initial||r("body",e.body),headers:e.initial||r("headers",e.headers),method:e.initial||r("method",e.method),saveVariables:e.initial||r("saveVariables",e.saveVariables),url:e.initial||r("url",e.url)}),a=f=>{const p=f.target,{name:m,value:E}=p;switch(t({initial:!1}),m){case"url":case"method":i({...s,[m]:r(m,E)}),t({[m]:E});break;case"headers":i({...s,[m]:r(m,E)}),t({[m]:E});break;case"body":i({...s,[m]:r(m,E)}),t({[m]:E});break;default:throw new Error(`Unhandled input name: ${m}`)}},c=f=>{const{name:p,value:m}=f.target;t({[p]:m})},u=f=>{const{name:p}=f.target,m=!e[p];t({[p]:m})};return h.jsx(_t,{title:M(C.REQUEST),children:h.jsxs("div",{className:"px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(C.URL),h.jsx("input",{className:`w-full ${s.url?"":"invalid"}`,name:"url",onChange:a,placeholder:"https://u:p@example.com/api/status",type:"text",value:e.url}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(Tn,{className:"w-full",label:M(C.METHOD),name:"method",onChange:c,value:e.method,children:FA.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Ol,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:M(C.SAVE_VARIABLES_SUBTITLE),title:M(C.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.REQUEST_HEADERS),name:"headers",onChange:a,placeholder:'{"Content-Type": "application/json", "X-Custom-Header": "foo"}',valid:s.headers,value:e.headers})}),h.jsx("label",{children:h.jsx($n,{errorText:M(C.ERROR_INVALID_JSON),inputMode:"text",label:M(C.REQUEST_BODY),name:"body",onChange:a,placeholder:M(C.STRING_OR_JSON),valid:s.body,value:e.body??""})})]})})},VA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("sendSms"),[s,i]=b.useState({body:e.initial||r("body",e.body),fromNumber:e.initial||r("fromNumber",e.fromNumber),toNumber:e.initial||r("toNumber",e.toNumber)}),a=c=>{const u=c.target,{name:f,value:p}=u;switch(f){case"body":case"fromNumber":case"toNumber":i({...s,[f]:r(f,p)}),t({initial:!1,[f]:p});break;default:throw new Error(`Unhandled input name: ${f}`)}};return h.jsx(_t,{title:M(C.SEND_SMS),children:h.jsxs("div",{className:"mx-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(C.TO_PHONE_NUMBER),h.jsx(Ys,{className:"w-full",direction:"to",name:"toNumber",onChange:a,placeholder:"+12405550000",type:"tel",valid:s.toNumber,value:e.toNumber}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.FROM_PHONE_NUMBER),h.jsx(Ys,{className:"w-full",direction:"from",name:"fromNumber",onChange:a,placeholder:"+12405550000",type:"tel",valid:s.fromNumber,value:e.fromNumber}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(C.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{children:h.jsx($n,{errorText:M(C.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(C.SMS_TEXT),name:"body",onChange:a,placeholder:M(C.WRITE_SOMETHING),valid:s.body,value:e.body})})]})})},$A=()=>({id:Le(),key:"",value:""}),HA=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=It("set"),[s,i]=b.useState({variables:e.variables.map(E=>({key:e.initial||r("key",E.key),value:e.initial||r("value",E.value)}))}),a=Er(e.variables,"key"),c=E=>{E?.preventDefault(),i({...s,variables:[...s.variables,{key:!0,value:!0}]}),t({variables:[...e.variables,$A()]})},u=(E,v)=>{const x=[...e.variables];let _=x[E];if(!_)throw new Error(`Variable not found at index ${E}`);const{name:w,value:S}=v,N=[...s.variables];N[E]={...N[E],[w]:r(w,S)},i({...s,variables:N}),_={...x[E],[w]:S},x[E]=_,t({initial:!1,variables:x})},f=E=>v=>{v.preventDefault();const x=[...s.variables];x.splice(E,1),i({...s,variables:x});const _=[...e.variables];_.splice(E,1),t({variables:_})},p=(E,v)=>{const x=E.target,{name:_,value:w}=x;switch(_){case"key":case"value":v!==void 0&&u(v,{name:_,value:w});break;default:throw new Error(`Unhandled input name: ${_}`)}},m=({index:E,name:v})=>s.variables[E]?.[v];return h.jsxs(_t,{title:M(C.SET_VARIABLES),children:[h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.variables?.map((E,v,x)=>{const _=a(E.key);return h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ce,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[x.length>1&&h.jsx(Fo,{className:"absolute right-0 top-0",handleDelete:f(v),label:M(C.REMOVE_VARIABLE,{index:v+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:M(C.VARIABLE_NUMBER,{index:v+1})}),h.jsxs("label",{className:"mb-2 block",children:[M(C.KEY),h.jsx("input",{className:`w-full ${m({index:v,name:"key"})&&!_?"":"invalid"}`,name:"key",onChange:w=>p(w,v),type:"text",value:E.key}),h.jsx("p",{className:"requirements",role:"alert",children:M(_?C.ERROR_DUPLICATE_VARIABLE_KEY:C.ERROR_VARIABLE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(C.VALUE),h.jsx("input",{className:`w-full ${m({index:v,name:"value"})?"":"invalid"}`,name:"value",onChange:w=>p(w,v),type:"text",value:E.value}),h.jsx("p",{className:"requirements",role:"alert",children:M(C.ERROR_TEXT_IS_REQUIRED)})]})]})]})]},E.id)})}),h.jsx("div",{className:"p-3 text-right",children:h.jsx("button",{className:"rounded bg-foreground/10 py-1 px-2 font-medium",onClick:c,type:"button",children:M(C.ADD_VARIABLE)})})]})},BA=e=>({id:Le(),key:e}),zA=({nodeData:e,handleOnUpdate:t})=>{const a={currentFocus:void 0,listOpen:!1,setVariablesList:ye(S=>S.nodes).reduce((S,N)=>{if(N.type==="set"){const O=N.data.variables.map(D=>({id:D.id,key:D.key}));return[...S,...O]}else if(N.type==="unset")return[...S,...N.data.variables];return S},[]).reduce((S,N)=>(S.find(O=>O.key===N.key)||S.push(N),S),[]).map(S=>({...S,selected:!!e.variables.find(N=>N.key===S.key)})).sort((S,N)=>S.key.toLowerCase().localeCompare(N.key.toLowerCase()))},[c,u]=ed(a),f=S=>c.setVariablesList.map(N=>N.id===S?{...N,selected:!N.selected}:N),p=S=>{const N=c.setVariablesList.find(O=>O.id===S);if(!N)throw new Error("Variable not found");if(N.selected)m(N.id);else{const O=[...e.variables,BA(N.key)];u({setVariablesList:f(N.id)}),t({variables:O})}},m=S=>{const N=c.setVariablesList.filter(O=>O.selected&&O.id!==S);u({setVariablesList:f(S)}),t({variables:N})},E=b.useRef(null);aE(E,()=>u({listOpen:!1}));const v=S=>{(S.key==="Escape"||S.key==="Esc")&&u({listOpen:!1})},x=(S,N)=>{S.preventDefault(),(S.key===" "||S.code==="Space"||S.key==="Enter")&&p(N),v(S)},_=()=>{u({listOpen:!c.listOpen})},w=e.variables.length;return h.jsx(_t,{title:M(C.UNSET_VARIABLES),children:h.jsxs("div",{className:"px-3",children:[h.jsxs("div",{className:"mb-2 flex flex-col",children:[h.jsx("label",{id:"listbox-label",className:"sr-only",children:M(C.SELECT_VARIABLES_TO_UNSET)}),h.jsxs("div",{className:"relative",ref:E,children:[h.jsx("button",{"aria-expanded":"true","aria-haspopup":"listbox","aria-labelledby":"listbox-label",className:`relative w-full cursor-pointer rounded-md border border-foreground/10 bg-transparent py-1.5 px-3 text-left
64
+ after:absolute after:top-[.725rem] after:right-3 after:h-0 after:w-0 after:border-[5px] after:border-t-[6px] after:border-b-0 after:border-r-transparent after:border-l-transparent after:border-t-foreground after:content-['']`,onClick:_,onKeyDown:v,type:"button",children:w>0?M(C.NUMBER_OF_VARIABLES_SELECTED,{count:w}):M(C.SELECT_VARIABLES)}),c.listOpen&&h.jsxs("ul",{"aria-activedescendant":c.currentFocus,"aria-labelledby":"listbox-label","aria-multiselectable":"true",className:"mt-1 max-h-60 w-full overflow-auto rounded-lg border border-foreground/10 bg-backgroundAlt py-1 shadow-xl",role:"listbox",children:[!c.setVariablesList.length&&h.jsx("li",{"aria-disabled":"true",className:"relative",role:"option",children:h.jsx("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:M(C.NO_VARIABLES_SET)})}),c.setVariablesList.map(S=>{if(S.key)return h.jsx("li",{"aria-selected":S.selected,className:"relative",id:S.id,role:"option",children:h.jsxs("label",{className:"flex select-none items-center py-2 pl-3 pr-9",children:[h.jsx("input",{checked:S.selected,className:"mr-2 h-4 w-4 rounded accent-primary",onChange:()=>p(S.id),onKeyDown:N=>x(N,S.id),type:"checkbox"}),S.key]})},S.id)})]})]})]}),w>0&&h.jsxs("section",{className:"pt-3",children:[h.jsx("h3",{className:"mb-2 text-xs font-medium text-foreground",children:M(C.UNSET_VARIABLES)}),h.jsx("ul",{className:"flex flex-wrap gap-2",children:c.setVariablesList.map(S=>S.selected&&h.jsx(HT,{handleClick:()=>m(S.id),children:S.key},S.id))})]})]})})},uE={aiAgent:({data:e,formUpdate:t})=>h.jsx(yA,{handleOnUpdate:t,nodeData:e}),cond:({data:e,formUpdate:t})=>h.jsx(SA,{handleOnUpdate:t,nodeData:e}),condRequest:({data:e,formUpdate:t})=>h.jsx(xA,{handleOnUpdate:t,nodeData:e}),executeSWML:({data:e,formUpdate:t})=>h.jsx(_A,{handleOnUpdate:t,nodeData:e}),forwardAddress:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardAddress"}),forwardPhone:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardPhone"}),forwardResource:({data:e,formUpdate:t})=>h.jsx(rd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardResource"}),hangup:({data:e,formUpdate:t})=>h.jsx(DA,{handleOnUpdate:t,nodeData:e}),play:({data:e,formUpdate:t})=>h.jsx(kA,{handleOnUpdate:t,nodeData:e}),promptPlay:({data:e,formUpdate:t})=>h.jsx(LA,{handleOnUpdate:t,nodeData:e}),record:({data:e,formUpdate:t})=>h.jsx(UA,{handleOnUpdate:t,nodeData:e}),recordCallStart:({data:e,formUpdate:t})=>h.jsx(MA,{handleOnUpdate:t,nodeData:e}),recordCallStop:({data:e,formUpdate:t})=>h.jsx(PA,{handleOnUpdate:t,nodeData:e}),request:({data:e,formUpdate:t})=>h.jsx(jA,{handleOnUpdate:t,nodeData:e}),sendSms:({data:e,formUpdate:t})=>h.jsx(VA,{handleOnUpdate:t,nodeData:e}),set:({data:e,formUpdate:t})=>h.jsx(HA,{handleOnUpdate:t,nodeData:e}),unset:({data:e,formUpdate:t})=>h.jsx(zA,{handleOnUpdate:t,nodeData:e})},WA=(e,t)=>{if("options"in t)switch(e.type){case"promptPlay":case"cond":case"condRequest":return!0}return!1},GA=e=>{if(e in uE)return uE[e]},YA=()=>{const{partialUpdateNodeData:e,removeNode:t}=Ze(),r=ye(p=>p.selectedNode),s=r?.id,a=ye(p=>p.nodes).find(p=>p.id===s)?.data,{updateDynamicHandles:c}=aA(r);if(!(r&&a&&s))return null;const u=p=>{WA(r,p)&&c(p),e(s,p)},f=GA(r.type);return f?h.jsxs(Ds,{className:"nokey m-0 flex h-full w-[260px] flex-col overflow-hidden rounded-none border border-foreground/10 bg-background pt-4",position:"top-right",children:[h.jsx(f,{data:a,formUpdate:u},s),r.deletable!==!1&&h.jsx("div",{className:"border-t border-foreground/10 p-3",children:h.jsx(Fo,{handleDelete:()=>t(s),label:M(C.DELETE_NODE),show:!0,showLabel:!0})})]}):null},dE=b.forwardRef(function({animate:t=!0,children:r,className:s="",iconTag:i="circle-info",message:a,role:c="alertdialog",status:u},f){const m=u?{error:"bg-negative text-background",success:"bg-positive text-background"}[u]:"";return h.jsxs("div",{className:`flex items-center justify-between rounded-lg bg-foreground p-2
65
65
  text-background shadow-lg transition-[box-shadow] hover:shadow-none
66
- ${m} ${t?"animate-from-bottom":""} ${s}`,ref:f,role:c,children:[h.jsxs("div",{className:"flex items-center justify-center gap-x-2",children:[h.jsx(Ce,{className:"flex-shrink-0 self-start",tag:i}),h.jsx("p",{className:"text-xs font-semibold",children:l})]}),n]})}),KA=()=>{const{addToast:e,restoreDeployedFlow:t,cancelDetachedMode:n}=Je();if(!Ee(c=>c.showDeployedHistoryToast))return null;const i=()=>{t(),e({message:k(O.VERSION_RESTORED),status:"success"})},l=()=>{n()};return h.jsx(dy,{animate:!1,className:"gap-x-14",message:k(O.PREVIEW_DEPLOYED_VERSION),role:"dialog",children:h.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[h.jsx("button",{className:"rounded bg-primary px-1.5 py-0.5 text-xs font-medium text-background transition-colors hover:bg-primary/90",onClick:i,children:k(O.RESTORE_THIS_VERSION)}),h.jsx("button",{className:"rounded bg-secondary/50 px-1.5 py-0.5 text-xs font-medium text-background transition-colors hover:bg-secondary/40",onClick:l,children:k(O.CANCEL)})]})})},fy=({onKeyPress:e})=>{const t=Oo(["Escape","Esc"]);return b.useEffect(()=>{t&&typeof e=="function"&&e()},[t,e]),{isPressed:t}},XA={offset:[0,.5,1],opacity:[1,0,0],pointerEvents:["none","none","auto"],transform:["scale(1.1) translateY(0%)","scale(0.5) translateY(-100%)"]},QA={duration:JR*2,easing:"ease-in-out",fill:"forwards"},qA=({durationMs:e,id:t,permanent:n})=>{const s=e??ZR,[i,l]=b.useState(null),{deleteToast:c}=Je(),u=b.useCallback(()=>{let f;const p=()=>c(t);return i instanceof HTMLElement?(f=i.animate(XA,QA),f.addEventListener("finish",p,{once:!0})):p(),()=>f==null?void 0:f.removeEventListener("finish",p)},[t,c,i]);return fy({onKeyPress:u}),b.useEffect(()=>{if(n)return;let f,p;const m=()=>{clearTimeout(f)},y=()=>{m(),f=setTimeout(()=>{p=u()},s)};return y(),i instanceof HTMLElement&&(i.addEventListener("mouseenter",m),i.addEventListener("mouseleave",y)),()=>{m(),i instanceof HTMLElement&&(i.removeEventListener("mouseenter",m),i.removeEventListener("mouseleave",y),p==null||p())}},[u,s,n,i]),{deleteToastCallback:u,setToastRef:l,toastRef:i}},py=({durationMs:e,id:t,message:n,permanent:s,status:i})=>{const{deleteToastCallback:l,setToastRef:c}=qA({durationMs:e,id:t,permanent:s});return h.jsx(dy,{className:"w-full max-w-sm",iconTag:i==="success"?"circle-check":"circle-exclamation",message:n,ref:c,status:i,children:h.jsxs("button",{className:"flex-shrink-0 self-start opacity-40 transition-opacity hover:opacity-70",onClick:l,children:[h.jsx(Ce,{tag:"circle-xmark",size:"xl"}),h.jsx("span",{className:"sr-only",children:k(O.CLOSE)})]})})},JA={error:py,success:py},ZA=()=>{const e=Ee(n=>n.toastsMap);if(e.size===0)return null;const t=Array.from(e.values());return h.jsx("div",{className:"flex w-full flex-col items-center gap-y-1",children:t.map(n=>{const s=JA[n.status];return h.jsx(s,{durationMs:n.durationMs,id:n.id,message:n.message,permanent:n.permanent,status:n.status},n.id)})})},e2=({asRole:e="alert",open:t=!1,type:n="overlay"})=>{const[s,i]=ne.useState(t);b.useEffect(()=>{i(t)},[t]);const l=b.useCallback(()=>i(!1),[]),c=b.useCallback(()=>i(!0),[]);return{asRole:e,closeContainer:l,isOpen:s,openContainer:c,type:n}},hy=b.createContext(null),od=()=>{const e=b.useContext(hy);if(e==null)throw new Error("Toast components must be wrapped in <ToastContainer />");return e},t2=({children:e,...t})=>{const n=e2(t);return h.jsx(hy.Provider,{value:n,children:e})},my=({iconAs:e,title:t,children:n})=>{const{asRole:s}=od();return h.jsxs("div",{className:"max-w-xl rounded-lg bg-foreground p-4 text-background shadow-2xl transition-[transform,box-shadow] duration-500 will-change-transform hover:shadow-none",role:s,children:[h.jsxs("h2",{className:"text-lg font-semibold leading-6 tracking-wide",children:[h.jsx("span",{className:"mr-2",children:h.jsx(Ce,{tag:e??"circle-exclamation"})}),t]}),h.jsx("div",{className:"mt-2 text-sm leading-5",children:n})]})},n2=({children:e})=>{const{closeContainer:t,isOpen:n,type:s}=od(),{getRootElement:i}=Je(),l=i(),c=b.useRef(null);return b.useEffect(()=>{if(!c.current)return;let u,f;const p=m=>{var y,E;if(m.key==="Escape"&&t(),m.key==="Tab"){const x=(E=(y=document.activeElement)==null?void 0:y.shadowRoot)==null?void 0:E.activeElement;m.shiftKey?x===u&&(f==null||f.focus(),m.preventDefault()):x===f&&(u==null||u.focus(),m.preventDefault())}};if(s==="overlay"){const m=c.current.querySelectorAll("button");u=m[0],f=m[m.length-1],f==null||f.focus(),document.addEventListener("keydown",p)}return()=>{document.removeEventListener("keydown",p)}},[t,s]),n?Bc.createPortal(h.jsx("section",{className:`flex justify-center ${s==="overlay"?"fixed top-0 z-50 h-full w-full items-start px-6 py-36 backdrop-blur-sm backdrop-grayscale":"absolute top-10 left-1/2 z-10 -translate-x-1/2 translate-y-1/2 items-center"}`,ref:s==="overlay"?c:void 0,children:e}),l):null},gy=({asRole:e,open:t,children:n,type:s})=>h.jsx(t2,{asRole:e,open:t,type:s,children:h.jsx(n2,{children:n})}),r2=()=>{const t=Ee(n=>n.httpError)===Am;return t?h.jsx(gy,{asRole:"dialog",open:t,type:"overlay",children:h.jsx(my,{title:k(O.DOCUMENT_OUT_OF_SYNC),children:h.jsx(o2,{})})}):null},o2=()=>{const{closeContainer:e}=od(),t=()=>{window.location.reload()};return h.jsxs(h.Fragment,{children:[Ul(O.TOAST_DOCUMENT_OUT_OF_SYNC),h.jsxs("div",{className:"mt-11 flex items-center justify-center gap-x-6",children:[h.jsx("button",{className:"rounded-md border border-background bg-foreground px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:e,children:k(O.IGNORE)}),h.jsx("button",{className:"rounded-md border border-background bg-positive/70 px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:t,children:k(O.RESYNC)})]})]})},s2=Qe(),i2=()=>{const e=Ee(t=>t.showDeployWarning);return h.jsx(gy,{asRole:"dialog",open:e,type:"overlay",children:h.jsx(my,{title:k(O.DEPLOY_WARNING),children:h.jsx(l2,{})})})},l2=()=>{const{deployFlow:e,setShowDeployWarning:t,setShowValidationWarnings:n}=Je(),s=()=>{t(!1),n(!0)},i=()=>{t(!1)},l=()=>{e().catch(c=>{s2.error(c)}),i()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-4",children:Ul(O.TOAST_DEPLOY_WARNING)}),h.jsx(cg,{onClickListItem:s}),h.jsxs("div",{className:"mt-11 flex items-center justify-center gap-x-6",children:[h.jsx("button",{className:"rounded-md border border-background bg-foreground px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:i,children:k(O.CANCEL)}),h.jsx("button",{className:"rounded-md border border-background bg-positive/70 px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:l,children:k(O.DEPLOY)})]})]})},a2="react-flow__controls-button",c2="min-w-[3.625rem] cursor-auto select-auto text-center hover:bg-background active:bg-background",u2="hidden sm:flex",d2=b.forwardRef(function({asTag:t="div",children:n,className:s="",hiddenSmallScreen:i=!1,...l},c){const u=t,p=`${a2} ${u==="button"?"":c2} ${i?u2:""} ${s}`;return h.jsx(u,{className:p,ref:c,...l,children:n})}),f2=()=>{const e=Ee(c=>c.showValidationWarnings),t=Ee(c=>c.validationWarnings),n=Ee(c=>c.detachedMode),{setShowValidationWarnings:s}=Je(),i=()=>s(!e),l=()=>{e&&s(!1)};return!t.size||n?(l(),null):h.jsx(yr,{onOpenChange:s,open:e,outsidePress:!1,placement:"bottom-start",role:"dialog",trigger:h.jsxs(d2,{className:"text-xs",asTag:"button",onClick:i,hiddenSmallScreen:!0,children:[k(O.WARNING),h.jsxs("div",{className:"flex items-center justify-center pl-1",children:[h.jsx("span",{className:"sr-only",children:k(O.MORE_INFO_STATUS_ERROR)}),h.jsx(Ce,{className:"text-warning",tag:"circle-exclamation"})]})]}),children:h.jsx(cg,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("h2",{className:"text-xs font-semibold",children:[h.jsx(Ce,{className:"mr-1",tag:"circle-exclamation"}),k(O.CAUTION)]}),h.jsxs("button",{className:"my-0.5 rounded-md py-0.5 px-1.5",onClick:l,children:[h.jsx("span",{className:"sr-only",children:k(O.CLOSE)}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]})})})},p2=()=>{const e=Ee(s=>s.isDraggingNode),t=Ee(s=>s.showInteractiveControl),n=s=>{Ee.setState({isInteractiveControlOn:s})};return h.jsx(PR,{className:`mt-2.5 rounded-[0.25rem] ${e?"group/control-buttons":""}`,position:"top-left",onInteractiveChange:n,showInteractive:t,children:h.jsx(f2,{})})},h2=".react-flow__panel",m2=16,yy={cursor:"no-drop",transform:"translate(0px, 0px) scale(1)",visibility:"hidden",zIndex:"5"},Ey=e=>{const t=e.getBoundingClientRect();return{isCursorIntersecting:({clientX:n,clientY:s})=>t.top<=s&&t.bottom>=s&&t.left<=n&&t.right>=n}},g2=e=>{const t=e.querySelectorAll(h2);return Array.from(t).map(n=>Ey(n).isCursorIntersecting)},y2=e=>({resetDragNodeStyles:()=>{Object.entries(yy).forEach(([t,n])=>{e.style[t]=n})},updateDragNodeStyles:({isOverDropTarget:t,scale:n,xPos:s,yPos:i})=>{e.style.visibility="visible",e.style.cursor=t?"grabbing":"no-drop",e.style.transform=`translate(${s}px, ${i}px) scale(${n})`}}),E2=({handleMouseMove:e,handleMouseUp:t,root:n})=>(n.addEventListener("mousemove",e),n.addEventListener("mouseup",t),{removeListeners:()=>{n.removeEventListener("mousemove",e),n.removeEventListener("mouseup",t)}}),v2=()=>{const e=b.useRef(null),t=Ee(E=>E.dragNodeType),n=Ee(E=>E.flowWrapperElement),s=Ee(E=>E.viewport.zoom),{addNode:i,getRootElement:l,setDragNodeType:c}=Je(),u=l();if(b.useEffect(()=>{if(e.current&&t&&n&&u){let E=!1;const x=m2*s,_=e.current,w=Ey(n).isCursorIntersecting,S=g2(n),{resetDragNodeStyles:N,updateDragNodeStyles:R}=y2(_),{removeListeners:P}=E2({handleMouseMove:C=>{const{clientX:I,clientY:L}=C,U=I-x,G=L-x;E=w({clientX:I,clientY:L})&&!S.some(X=>X({clientX:I,clientY:L})),R({isOverDropTarget:E,scale:E?s:1,xPos:U,yPos:G})},handleMouseUp:C=>{if(E){const I=n.getBoundingClientRect();i({nodeType:t,x:C.clientX-I.left-x,y:C.clientY-I.top-x})}c(void 0)},root:u});return()=>{P(),N()}}},[i,t,n,u,c,s]),!t)return null;const f=ty[t],p=Um[t](),m=Le(),y={...p,initial:!1,valid:!0};return h.jsx("section",{className:"react-flow__node fixed left-0 top-0",ref:e,style:yy,children:h.jsx(f,{data:y,dragging:!0,id:m,isConnectable:!0,selected:!0,type:t,xPos:0,yPos:0,zIndex:0})})},x2={};function vy(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var l;const c=f=>f===null?null:JSON.parse(f,void 0),u=(l=n.getItem(i))!=null?l:null;return u instanceof Promise?u.then(c):c(u)},setItem:(i,l)=>n.setItem(i,JSON.stringify(l,void 0)),removeItem:i=>n.removeItem(i)}}const ri=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return ri(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return ri(s)(n)}}}},S2=(e,t)=>(n,s,i)=>{let l={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,N)=>({...N,...S}),...t},c=!1;const u=new Set,f=new Set;let p;try{p=l.getStorage()}catch{}if(!p)return e((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),n(...S)},s,i);const m=ri(l.serialize),y=()=>{const S=l.partialize({...s()});let N;const R=m({state:S,version:l.version}).then(P=>p.setItem(l.name,P)).catch(P=>{N=P});if(N)throw N;return R},E=i.setState;i.setState=(S,N)=>{E(S,N),y()};const x=e((...S)=>{n(...S),y()},s,i);let _;const w=()=>{var S;if(!p)return;c=!1,u.forEach(R=>R(s()));const N=((S=l.onRehydrateStorage)==null?void 0:S.call(l,s()))||void 0;return ri(p.getItem.bind(p))(l.name).then(R=>{if(R)return l.deserialize(R)}).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==l.version){if(l.migrate)return l.migrate(R.state,R.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return R.state}).then(R=>{var P;return _=l.merge(R,(P=s())!=null?P:x),n(_,!0),y()}).then(()=>{N==null||N(_,void 0),c=!0,f.forEach(R=>R(_))}).catch(R=>{N==null||N(void 0,R)})};return i.persist={setOptions:S=>{l={...l,...S},S.getStorage&&(p=S.getStorage())},clearStorage:()=>{p==null||p.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>w(),hasHydrated:()=>c,onHydrate:S=>(u.add(S),()=>{u.delete(S)}),onFinishHydration:S=>(f.add(S),()=>{f.delete(S)})},w(),_||x},_2=(e,t)=>(n,s,i)=>{let l={storage:vy(()=>localStorage),partialize:w=>w,version:0,merge:(w,S)=>({...S,...w}),...t},c=!1;const u=new Set,f=new Set;let p=l.storage;if(!p)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${l.name}', the given storage is currently unavailable.`),n(...w)},s,i);const m=()=>{const w=l.partialize({...s()});return p.setItem(l.name,{state:w,version:l.version})},y=i.setState;i.setState=(w,S)=>{y(w,S),m()};const E=e((...w)=>{n(...w),m()},s,i);let x;const _=()=>{var w,S;if(!p)return;c=!1,u.forEach(R=>{var P;return R((P=s())!=null?P:E)});const N=((S=l.onRehydrateStorage)==null?void 0:S.call(l,(w=s())!=null?w:E))||void 0;return ri(p.getItem.bind(p))(l.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==l.version){if(l.migrate)return l.migrate(R.state,R.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return R.state}).then(R=>{var P;return x=l.merge(R,(P=s())!=null?P:E),n(x,!0),m()}).then(()=>{N==null||N(x,void 0),x=s(),c=!0,f.forEach(R=>R(x))}).catch(R=>{N==null||N(void 0,R)})};return i.persist={setOptions:w=>{l={...l,...w},w.storage&&(p=w.storage)},clearStorage:()=>{p==null||p.removeItem(l.name)},getOptions:()=>l,rehydrate:()=>_(),hasHydrated:()=>c,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(f.add(w),()=>{f.delete(w)})},l.skipHydration||_(),x||E},w2=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((x2?"staging":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),S2(e,t)):_2(e,t),xy=window,Sy={showAllNodes:!1,showDevOptions:!1},Qr=Do()(w2((e,t)=>({...Sy,actions:{getFlagNames:()=>{const n=t();return Object.keys(n).filter(s=>s!=="actions")},toggleFlag:n=>e(s=>({...s,[n]:!s[n]}))}}),{name:"flags",partialize:e=>Object.fromEntries(Object.entries(e).filter(([t])=>t!=="actions")),storage:vy(()=>localStorage),version:0})),_y=()=>Qr.getState().actions;Qr.subscribe(e=>{console.log("feature flags changed",e)});const N2=e=>{const t=(s,i)=>{Qr.setState(l=>({...l,[s]:i}))},n=s=>{const i=Qr.getState(),l={...s};return Object.entries(i).forEach(([c,u])=>{c in l&&typeof u=="boolean"&&(l[c]=u)}),l};if(xy){const s=new Proxy(n(e),{get:(i,l)=>Reflect.get(i,l),set:(i,l,c)=>{if(typeof c=="boolean"&&l in i)t(l,c);else throw new Error("unknown flag");return Reflect.set(i,l,c)}});xy.swFlags=s}},R2=()=>N2(Sy),Bl={currentColor:{negative:"fill-current",primary:"fill-current"},light:{negative:"fill-negative",primary:"fill-primary"}},T2={"2xl":"w-[2em] h-[2em]","2xs":"w-[0.75em] h-[0.75em]",lg:"w-[1.25em] h-[1.25em]",md:"w-[1em] h-[1em]",sm:"w-[0.875em] h-[0.875em]",xl:"w-[1.5em] h-[1.5em]",xs:"w-[0.75em] h-[0.75em]"},O2=b.forwardRef(function({className:t="",size:n="md",type:s="light"},i){const l=T2[n];return h.jsxs("svg",{"aria-hidden":"true",className:`${l} ${t}`,focusable:"false",fill:"none",ref:i,role:"img",viewBox:"0 0 64 73",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M63.9998 46.5209C63.9998 48.596 63.4369 49.9545 62.3171 51.0736C55.6065 57.7826 48.8931 64.4815 42.177 71.1703C39.841 73.495 36.4374 73.6097 34.1234 71.4843C31.6868 69.2442 31.5903 65.569 33.9726 63.1356C36.9983 60.0482 40.0681 57.003 43.132 53.9537C46.8137 50.2907 50.5034 46.6369 54.2012 42.9926C55.9925 41.2315 58.3929 40.7666 60.5902 41.7669C62.7876 42.7672 63.9315 44.5686 63.9998 46.5209Z",className:Bl[s].primary}),h.jsx("path",{d:"M0.000812669 25.3858C0.0329789 24.3372 0.589857 23.0088 1.68351 21.9159C8.37007 15.2378 15.058 8.56035 21.7472 1.88357C23.1384 0.492799 24.7789 -0.219695 26.739 0.0600696C29.061 0.402228 30.6834 1.69438 31.4393 3.92847C32.1952 6.16256 31.6725 8.18129 30.032 9.85183C26.8355 13.1003 23.5988 16.3166 20.3822 19.5329C16.868 23.0309 13.3444 26.5196 9.81152 29.9989C8.01423 31.762 5.61985 32.1947 3.41647 31.2307C1.27339 30.2988 -0.0373848 28.2438 0.000812669 25.3858Z",className:Bl[s].primary}),h.jsx("path",{d:"M4.59424 32.9836C5.35618 32.9494 5.98342 32.9675 6.60463 32.8849C8.18055 32.688 9.64041 31.953 10.738 30.8038C12.0206 29.4936 13.3093 28.1873 14.6241 26.8489C14.8714 27.0683 15.0262 27.191 15.1609 27.3279C20.1078 32.2791 25.054 37.2324 29.9995 42.1876C31.6219 43.8179 32.1909 45.7843 31.5395 47.9983C30.9123 50.1257 29.4507 51.4883 27.2835 51.9774C25.4078 52.398 23.6186 52.0398 22.2435 50.6751C16.3671 44.8484 10.551 38.9673 4.59424 32.9836Z",className:Bl[s].negative}),h.jsx("path",{d:"M59.4545 40.0944C56.4389 39.7865 54.2878 40.9519 52.4744 42.9585C51.4933 44.0454 50.4178 45.0477 49.3583 46.1164C49.1372 45.9152 48.9824 45.7964 48.8436 45.6555C43.8914 40.7003 38.9418 35.7464 33.9949 30.7938C32.3745 29.1635 31.8076 27.1931 32.4751 24.9791C33.1164 22.8537 34.5799 21.4951 36.7532 21.0181C38.6751 20.5955 40.4623 21.0181 41.8676 22.4109C47.6307 28.1229 53.3677 33.8571 59.0785 39.6134C59.163 39.6899 59.2273 39.7966 59.4545 40.0944Z",className:Bl[s].negative})]})}),C2={[O.FLOW_DATA_VERSION]:Hs,[O.PKG_VERSION]:YR},A2=()=>{const e=()=>{var s;((s=n.current)==null?void 0:s.open)===!1&&n.current.showModal()},t=()=>{var s;(s=n.current)!=null&&s.open&&n.current.close()},n=ne.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsxs("button",{className:"group flex items-center justify-center gap-x-2 text-foreground/50 transition-colors hover:text-foreground/70",onClick:e,children:[h.jsx(O2,{className:"text-foreground/40 transition-colors group-hover:text-foreground/50",size:"xl",type:"currentColor"}),h.jsx("span",{className:"text-xs font-semibold",children:k(O.ABOUT)})]}),h.jsx("dialog",{ref:n,className:"aspect-[5/4] w-72 max-w-xs overflow-hidden rounded-lg border border-foreground/10 bg-background text-foreground shadow-xl backdrop:backdrop-blur-sm backdrop:backdrop-brightness-95",children:h.jsxs("div",{className:"h-full px-2 pb-10",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-2xl leading-10",children:k(O.ABOUT)}),h.jsxs("button",{className:"my-0.5 -mr-1.5 rounded-md py-0.5 px-1.5 ",onClick:t,children:[h.jsx("span",{className:"sr-only",children:k(O.CLOSE)}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]}),h.jsxs("div",{className:"h-full overflow-y-auto",children:[h.jsx("ul",{className:"mt-1 flex flex-col items-center justify-center text-sm",children:Object.entries(C2).map(([s,i])=>h.jsx("li",{className:"text-foreground/70",children:h.jsxs("p",{children:[k(s),": ",i]})},s))}),h.jsx("div",{className:"mt-6 flex items-center justify-center ",children:h.jsx("button",{className:"rounded-md border border-foreground/10 bg-positive px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:t,children:k(O.CLOSE)})})]})]})})]})},I2={deploy:O.STATUS_DEPLOY,deployed:O.STATUS_DEPLOYED,deploying:O.STATUS_DEPLOYING,error:O.STATUS_DEPLOY_ERROR},wy={deploy:"text-background border-hidden hover:bg-primary/90",deployed:"bg-background text-positive border-positive/20",deploying:"bg-background text-foreground/50 border-foreground/10",error:"bg-negative text-background border-hidden"},b2=()=>{const e=Ee(R=>R.deployFlowStatus),t=Ee(R=>R.deployFlowURL),n=Ee(R=>R.detachedMode),s=Ee(R=>R.documentVersion),i=Ee(R=>R.httpError),l=Ee(R=>R.saveFlowStatus),{deployFlow:c,getValidationWarnings:u,setShowDeployWarning:f}=Je(),p={error:void 0,prevDocVersion:s},[m,y]=ed(p),E=I2[e],x=async()=>{if(u().size>0)f(!0);else try{y({error:void 0}),await c()}catch(R){R instanceof Error?y({error:R.message}):y({error:"Failed to deploy!"})}};b.useEffect(()=>{l==="saved"&&s!==m.prevDocVersion&&y({prevDocVersion:s})},[m.prevDocVersion,s,l,y]);const _=l!=="saved"||e==="deployed"||e==="deploying",w=i==="document-sync"?wy.deploying:wy[e];let S="";e==="deploy"&&(S=l==="saved"?"bg-primary":"bg-focus");const N=`${S} ${w}`;return!t||n?null:h.jsxs("button",{"data-testid":"cfb__deploy-button",className:`flex items-center justify-center rounded border px-1.5 py-0.5
67
- text-xs font-medium transition-colors ${N}`,disabled:_,onClick:x,children:[k(E),h.jsx(yr,{placement:"right",trigger:h.jsx("span",{className:"flex items-center justify-center pl-1",role:"tooltip",tabIndex:0,children:e==="error"?h.jsx(Ce,{tag:"circle-exclamation"}):h.jsx(h.Fragment,{})}),children:e==="error"?k(O.MORE_INFO_DEPLOY_ERROR,{message:m.error}):k(O.MORE_INFO_DEPLOY)})]})},L2=()=>{const e=Ee(t=>t.backButtonHref);return e?h.jsxs("a",{href:e,children:[h.jsx("span",{className:"sr-only",children:k(O.NAVIGATE_BACK)}),h.jsx(Ce,{tag:"arrow-left",className:"text-negative",size:"lg"})]}):null},D2=()=>{const e=Ee(c=>c.showDeployedHistory),t=Ee(c=>c.httpError==="document-sync"),{cancelDetachedMode:n,setShowDeployedHistory:s}=Je(),i=()=>{e?n():s(!0)},l=e?"text-background bg-foreground":"text-foreground bg-foreground/10";return h.jsx(yr,{placement:"top",trigger:h.jsxs("button",{className:`flex items-center justify-center rounded border border-transparent p-1 transition-colors ${l}`,disabled:t,onClick:i,type:"button",children:[h.jsx("span",{className:"sr-only",children:k(O.VERSION_HISTORY)}),h.jsx(Ce,{tag:"clock-rotate-left",size:"xs"})]}),children:k(O.VERSION_HISTORY)})},k2=({isDisabled:e,isSelected:t,itemIndex:n,onClick:s,onSelected:i,relativeTimeSince:l,version:c})=>{var y,E;const u=b.useRef(null),f=x=>{i(x)},p=()=>{t||(f(n),s(n))},m=x=>{x.preventDefault();const{key:_}=x;(_==="Enter"||_===" ")&&s(n),_==="ArrowUp"&&f(n-1),_==="ArrowDown"&&f(n+1)};return t&&((y=u.current)==null||y.focus({preventScroll:!0}),(E=u.current)==null||E.scrollIntoView({block:"nearest"})),h.jsx("li",{className:`border-l-2 transition-colors ${t?"border-l-primary/50 bg-primary/10":"border-l-transparent bg-background hover:bg-primary/5"}`,children:h.jsxs("button",{"aria-selected":t?"true":"false",className:`flex w-full items-start gap-x-2 p-2 pr-4 ${e?"text-disabled":""}`,disabled:e,onClick:p,onKeyDown:m,type:"button",tabIndex:t?0:-1,ref:u,children:[h.jsx(Ce,{className:`p-1 ${t?"text-primary":"text-foreground/30"}`,tag:"dot-circle"}),h.jsxs("div",{className:"flex flex-col items-start justify-center",children:[h.jsx("h3",{className:"text-xs font-medium",children:k(O.VERSION_LIST_ITEM,{number:c})}),h.jsx("p",{className:"text-xxs",children:h.jsx("time",{children:l})})]})]})})},P2=200,Ny=Qe(),M2=()=>{const e=Ee(N=>N.deployedVersionsList),t=Ee(N=>N.saveFlowStatus),n=Ee(N=>N.showDeployedHistory),{cancelDetachedMode:s,getDeployedVersionsList:i,migrateAndLoadDeployedFlow:l}=Je();fy({onKeyPress:n?s:void 0});const c=b.useRef(),[u,f]=b.useState("loading"),[p,m]=b.useState(null);p!==null&&!n&&m(null);const y=b.useCallback(N=>{N>=0&&N<=e.length-1?m(N):m(null)},[e.length]),E=b.useCallback(N=>{var P;const R=(P=c.current)==null?void 0:P[N];R?(Ny.info("load version",R.id),l(R)):Ny.error("version not found")},[l]),x=b.useCallback(()=>{f("loading"),i({pageSize:P2}).then(N=>{f("loaded"),c.current=N}).catch(()=>{f("error"),c.current=void 0})},[i]);b.useLayoutEffect(()=>{n&&x()},[x,n]);const _=u==="error",w=e.length>0,S=t==="saved";return n?h.jsxs("div",{"data-testid":"cfb__deployed-versions-sidebar",className:"flex h-full flex-col py-3",children:[h.jsxs("section",{className:"flex items-center justify-between self-stretch px-4 pb-1",children:[h.jsxs("h2",{className:"flex items-center gap-1 text-tiny font-bold uppercase leading-none tracking-wide",children:[h.jsx(Ce,{className:"text-xs text-foreground/50",tag:"clock-rotate-left"}),k(O.VERSION_HISTORY)]}),h.jsxs("button",{className:"flex items-center justify-center px-0.5",onClick:s,type:"button",children:[h.jsx("span",{className:"sr-only",children:k(O.CLOSE)}),h.jsx(Ce,{tag:"xmark"})]})]}),h.jsxs("div",{className:`${w?"overflow-y-auto":"h-full"}`,children:[u!=="loaded"?h.jsxs("div",{className:`flex flex-col justify-center gap-y-4 p-4 text-sm leading-none tracking-wide text-foreground/50 ${w?"":"h-full"}`,children:[h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[_?h.jsx(Ce,{className:"text-negative",tag:"circle-exclamation"}):h.jsx(Ce,{className:"animate-spin",tag:"arrows-rotate"}),h.jsx("p",{"aria-live":_?"assertive":"polite",className:`${_?"text-negative":"font-bold uppercase text-foreground/50"}`,role:_?"alert":"status",children:k(_?O.ERROR_FETCHING_DEPLOYED_VERSIONS:O.STATUS_LOADING)})]}),_?h.jsx("div",{className:"flex w-full items-center justify-center",children:h.jsx("button",{className:"rounded border border-primary/50 bg-primary/10 px-3 py-1.5 text-sm font-bold leading-tight tracking-wider text-primary",onClick:x,type:"button",children:k(O.RESYNC)})}):null]}):null,!w&&u==="loaded"?h.jsx("div",{className:`flex h-full flex-col justify-center gap-y-4 p-4 text-sm leading-none tracking-wide text-foreground/50
68
- `,children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[h.jsx(Ce,{tag:"circle-exclamation"}),Ul(O.NO_DEPLOYED_VERSIONS)]})}):null,w?h.jsx("ol",{children:e.map((N,R)=>h.jsx(k2,{itemIndex:R,isDisabled:!S,isSelected:R===p,onClick:E,onSelected:y,relativeTimeSince:N.relativeTimeSince,version:N.version},N.id))}):null]})]}):null},j2=()=>{const{getFlagNames:e}=_y();return h.jsxs("div",{className:"rounded-sm border border-gray-200 p-2",children:[h.jsx("h3",{className:"w-full",children:"Feature Flags"}),h.jsx("div",{className:"flex flex-col gap-y-2 py-2",children:e().map(t=>h.jsx(U2,{flagName:t},t))})]})},U2=({flagName:e})=>{const{toggleFlag:t}=_y(),s=Qr(i=>i[e])?"translate-x-5 bg-positive":"translate-x-0 bg-negative";return h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:"checkbox",className:"sr-only",onChange:()=>t(e)}),h.jsx("div",{className:"h-5 w-10 rounded-full bg-secondary/20",children:h.jsx("div",{className:`absolute left-1 top-1 h-3 w-3 rounded-full transition ${s}`})})]}),h.jsx("p",{className:"ml-3 text-sm font-medium",children:e})]})},F2=()=>{const[e,t]=b.useState(!1),n=()=>{t(s=>!s)};return h.jsx(yr,{open:e,onOpenChange:t,placement:"bottom",role:"dialog",trigger:h.jsxs("button",{className:"group flex items-center justify-center gap-x-2 text-foreground/50 transition-colors hover:text-foreground/70",onClick:n,children:[h.jsx(Ce,{className:"text-foreground/40 transition-colors group-hover:text-foreground/50",size:"xl",tag:"circle-question"}),h.jsxs("span",{className:"text-xs font-semibold",children:[k(O.HELP),h.jsx("span",{className:"sr-only",children:k(O.MORE_INFO_TESTING_YOUR_FLOW)})]})]}),children:h.jsxs("section",{className:"p-2",children:[h.jsx("h2",{className:"mb-4 text-2xl font-semibold",children:"Testing Your Call Flow"}),h.jsxs("div",{className:"text-sm",children:[h.jsx("p",{children:"To test the current working version (draft) of your Call Flow, follow these steps:"}),h.jsxs("ol",{className:"my-4 list-inside list-decimal",children:[h.jsxs("li",{className:"mb-2 list-item",children:["Go to the settings tab of the purchased phone number you want to use for testing:  ",h.jsx("a",{className:"underline hover:text-background/80",href:"/phone_numbers",target:"_blank",rel:"noopener noreferrer",children:"Purchased Phone Numbers"})]}),h.jsxs("li",{className:"mb-2",children:["Choose the appropriate Call Flow for handling your calls:  ",h.jsx("a",{className:"underline hover:text-background/80",href:"/call_flows",target:"_blank",rel:"noopener noreferrer",children:"Call Flows"})]}),h.jsx("li",{className:"mb-2",children:"Select the working version (draft) of the chosen Call Flow."}),h.jsx("li",{children:"When you make a call to the number, it should now execute the working version of your Call Flow upon answering."})]}),h.jsx("p",{className:"mt-4 mb-2",children:"In an upcoming update, you will be able to test your selected Call Flow directly from the Call Flow Builder, eliminating the need to manually associate the Call Flow with your number."})]})]})})},V2=(e,t)=>({label:k(Fl[e].label),nodes:Object.entries(Fl[e].nodes).reduce((n,[s,i])=>(((typeof i.active=="boolean"?i.active:i.active[GR])||t)&&n.push({deprecated:!!i.deprecated,title:k(i.label),type:s}),n),[]).sort((n,s)=>n.title.localeCompare(s.title))}),Ry=Qe(),$2=["action","forwardTo","recording","input","decision"],H2=()=>{const e=Qr(c=>c.showAllNodes),t=Ee(c=>c.isCanvasInteractive),{addNode:n,setDragNodeType:s}=Je(),i=b.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?n({nodeType:u}):Ry.error("No nodeType found on click event")},[n]),l=b.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?s(u):Ry.error("No nodeType found on drag event")},[s]);return h.jsx("ul",{className:"py-3 px-2",id:"sidebar-node-list",children:$2.map(c=>h.jsx("li",{children:h.jsx(B2,{enableNodeButtons:t,group:c,handleOnClick:i,handleDragStart:l,showAllNodes:e})},c))})},B2=({enableNodeButtons:e=!0,group:t,handleOnClick:n,handleDragStart:s,showAllNodes:i})=>{const l=V2(t,i),c=`ngm-heading-${o1(l.label)}`;return h.jsxs(h.Fragment,{children:[h.jsx("h2",{className:"px-2 pb-1 text-tiny font-bold uppercase tracking-wide text-foreground/50",id:c,children:l.label}),h.jsx("ul",{"aria-labelledby":c,className:"flex flex-1 flex-col gap-y-1 pb-2",children:l.nodes.map(u=>h.jsx("li",{children:h.jsxs("button",{className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-transparent bg-primary/5 p-2 transition-colors
69
- hover:border-primary hover:bg-primary/20 enabled:hover:shadow-md`,"data-node-type":u.type,disabled:!e,draggable:e,onClick:e?n:void 0,onDragStart:e?s:void 0,children:[h.jsx(Ce,{tag:"circle-small",className:"text-primary"}),h.jsxs("span",{className:"text-left text-xs font-medium line-clamp-2",children:[u.title,u.deprecated&&h.jsxs("span",{className:"text-foreground/70",children:[" ",k(O.DEPRECATED)]})]})]})},u.type))})]})},z2=()=>{const{addToast:e,restoreDeployedFlow:t}=Je(),n=Ee(i=>i.workingFlowCopy),s=()=>{t(),e({message:k(O.VERSION_RESTORED),status:"success"})};return n?h.jsx("button",{className:`flex items-center justify-center rounded border bg-primary px-1.5 py-0.5 text-xs font-medium
70
- text-background transition-colors hover:bg-primary/90`,onClick:s,children:k(O.RESTORE)}):null},W2={"awaiting-save":O.STATUS_SAVING,"document-sync":O.STATUS_LOCKED,error:O.STATUS_ERROR,initial:O.STATUS_LOADING,saved:O.STATUS_SAVED,saving:O.STATUS_SAVING},Ty=e=>(e.preventDefault(),e.returnValue=""),Oy=(e,t)=>e==="document-sync"?e:t,G2=()=>{const e=Ee(E=>E.detachedMode),t=Ee(E=>E.saveFlowStatus),n=Ee(E=>E.httpError),[s,i]=b.useState(!0),[l,c]=b.useState(Oy(n,t)),u=W2[l],f=t==="error"||n,p=Oy(n,t),m=b.useRef(!1);b.useEffect(()=>{p==="initial"&&!m.current?(m.current=!0,c(p),i(!1),setTimeout(()=>{i(!0)},qR)):p!=="initial"&&s&&(m.current=!1,c(p))},[s,p]),b.useEffect(()=>{if(!(t==="saved"||n))return addEventListener("beforeunload",Ty,{capture:!0}),()=>{removeEventListener("beforeunload",Ty,{capture:!0})}},[n,t]);let y="";switch(!0){case f:y="px-1.5 py-0.5 bg-negative/20 text-negative";break;case l==="saved":y="text-foreground/50";break;default:y="px-1.5 py-0.5 bg-foreground/30 text-background"}return e?null:h.jsx("div",{"aria-live":f?"assertive":"polite","data-testid":"cfb__status",className:"flex",role:f?"alert":"status",children:h.jsxs("div",{className:`flex gap-x-1 rounded text-xxs ${y}`,children:[h.jsx("p",{children:u==="STATUS_SAVED"?h.jsx(Y2,{}):k(u)}),f&&h.jsx(yr,{placement:"bottom",trigger:h.jsxs("div",{role:"tooltip",tabIndex:0,children:[h.jsx("span",{className:"sr-only",children:k(O.MORE_INFO_STATUS_ERROR)}),h.jsx(Ce,{tag:"circle-exclamation"})]}),children:k(n==="document-sync"?O.INFO_STATUS_ERROR_OUT_OF_SYNC:O.INFO_STATUS_ERROR)})]})})},Y2=()=>{const e=Ee(l=>l.documentLastUpdated),t=b.useCallback((l,...c)=>Pm(Bg(),{numeric:"always",style:"narrow"})(l,{excludeUnits:{second:!0},...c}),[]),n=e?t(e):void 0,[s,i]=b.useState(n);return b.useEffect(()=>{if(!e)return;const l=setInterval(()=>{i(t(e))},1e3);return()=>clearInterval(l)},[e,t]),h.jsxs(h.Fragment,{children:[k(O.SAVED)," ",h.jsx("time",{children:s})]})},K2=()=>{const e=Qr(c=>c.showDevOptions),{exportStoreData:t}=Je(),n=Ee(c=>c.flowTitle),s=Ee(c=>c.showDeployedHistory),i=b.useRef(null),l=c=>{c.preventDefault(),i.current&&i.current.showModal()};return h.jsxs(h.Fragment,{children:[h.jsxs("section",{className:"hidden h-full w-1/6 min-w-[160px] shrink-0 flex-col bg-background text-foreground sm:flex",children:[h.jsxs("nav",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[h.jsx(L2,{}),e&&h.jsx("button",{className:"rounded bg-positive p-1 px-2 text-xs text-background",onClick:l,children:"Dev Options"})]}),h.jsx("section",{className:"px-2 py-2",children:h.jsxs("div",{className:"divide-y divide-foreground/10 rounded-lg border border-foreground/10",children:[h.jsx("h1",{className:"block w-full shrink-0 p-2 text-sm font-semibold leading-tight line-clamp-2",children:n||h.jsx(h.Fragment,{children:" "})}),h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-1 gap-y-2 p-2",children:[h.jsx("div",{className:"flex-1",children:h.jsx(G2,{})}),h.jsxs("menu",{className:"flex items-center justify-center gap-x-1",children:[s?h.jsx(z2,{}):h.jsx(b2,{}),h.jsx(D2,{})]})]})]})}),h.jsxs("section",{className:"h-full overflow-y-auto",children:[s?null:h.jsx(H2,{}),h.jsx(M2,{})]}),h.jsx("section",{className:"flex flex-col items-start justify-center gap-y-5 px-2 pt-3 pb-4",children:h.jsxs("div",{className:"flex flex-col items-start justify-center gap-y-3 px-2",children:[h.jsx(A2,{}),h.jsx(F2,{})]})})]}),e&&h.jsx("dialog",{className:"z-50 my-10 rounded-lg border border-foreground/10 bg-background text-foreground",ref:i,children:h.jsx("form",{children:h.jsxs("fieldset",{children:[h.jsxs("legend",{className:"flex w-full justify-between pb-2",children:[h.jsx("h1",{className:"text-2xl leading-10",children:"Dev Options"}),h.jsxs("button",{className:"p-1 pt-0 font-semibold",formMethod:"dialog",children:[h.jsx("span",{className:"sr-only",children:"Close"}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]}),h.jsxs("div",{className:"mb-1 rounded-sm border border-gray-200 p-2",children:[h.jsx("h3",{className:"w-full",children:"Flow Data"}),h.jsx("div",{className:"flex flex-row gap-x-2 py-2",children:h.jsx("div",{className:"flex items-center",children:h.jsx("button",{type:"button",className:"rounded border bg-background px-2 py-1 text-sm hover:scale-105 hover:bg-background/80 active:scale-95",onClick:t,children:"View JSON File"})})})]}),h.jsx(j2,{})]})})})]})},X2=()=>{const e=b.useRef(null),[t,n]=b.useState(),[s,i]=b.useState(null);return b.useLayoutEffect(()=>(e.current=new ResizeObserver(([l])=>n(l)),s&&e.current.observe(s),()=>{var l;return(l=e.current)==null?void 0:l.disconnect()}),[s]),{observerEntry:t,setTarget:i}},Q2=({rootAppHeight:e,rootAppWidth:t})=>{Ee.setState({rootAppHeight:e,rootAppWidth:t})},q2=()=>{const{observerEntry:e,setTarget:t}=X2();return b.useEffect(()=>{e&&(Qe().log("resized",{rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}),Q2({rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}))},[e]),{rootTarget:t}};function J2(){Qe().debug("Hello World!");const{rootTarget:e}=q2(),t=Ee(i=>i.colorMode)??"",n=Ee(i=>i.httpError),s=n!==void 0&&n!=="document-sync";return h.jsx(h.Fragment,{children:h.jsx("div",{className:`${t} flex h-full w-full bg-backgroundAlt text-foreground`,ref:e,children:s?h.jsx(OC,{errorType:n}):h.jsxs(h.Fragment,{children:[h.jsx(K2,{}),h.jsx(r2,{}),h.jsx(i2,{}),h.jsxs(hu,{children:[h.jsx(iA,{}),h.jsxs(oA,{children:[h.jsxs(ks,{className:"z-50 m-0 mx-auto mt-2.5 flex w-full min-w-[320px] max-w-lg flex-col items-center gap-y-2 px-4",position:"top-center",children:[h.jsx(KA,{}),h.jsx(ZA,{})]}),h.jsx(v2,{}),h.jsx(p2,{}),h.jsx(YA,{}),h.jsx(lA,{})]})]})]})})})}const Z2='@font-face{font-family:SWInter;font-style:normal;font-weight:400;font-display:swap;src:url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff2) format("woff2"),url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff) format("woff")}@font-face{font-family:SWInter;font-style:normal;font-weight:500;font-display:swap;src:url(//cdn.signalwire.com/fonts/inter/Inter-Medium.woff2) format("woff2"),url(//cdn.signalwire.com/fonts/inter/Inter-Medium.woff) format("woff")}',Cy=Qe(),eI=e=>{if(!e||!e.getFlowURL||!e.updateFlowURL)throw new TypeError("Invalid or missing required params")};function tI(e){eI(e);const{backButtonHref:t,deployFlowURL:n,getAiAgentsURL:s=`${window.location.origin}${mv}`,getFlowURL:i,getSwmlScriptsURL:l=`${window.location.origin}${gv}`,rootElementId:c="sw-cfb-root",styleHref:u="https://cdn.swire.io/npm/@signalwire/cfb@dev/dist/style.css",updateFlowURL:f,voicesURL:p="https://cdn.signalwire.com/npm/@signalwire/cfb@dev/dist/voices.json"}=e;Zu.getState().actions.init({voicesURL:p}).catch(E=>{Cy.error("Error initializing voices",E)});const m=document.getElementById(c);if(Ee.setState({backButtonHref:t,deployFlowURL:n,getFlowURL:i,rootElement:m,rootElementId:c,updateFlowURL:f}),s&&On.getState().actions.init({getAiAgentsURL:s}),l&&zn.getState().actions.init({getSwmlScriptsURL:l}),iC().catch(E=>{Cy.error("Error initializing i18n",E)}),R2(),!m)throw new Error(`Id: '${c}' not found in the DOM`);m.attachShadow({mode:"open"}),m.shadowRoot&&Yv.createRoot(m.shadowRoot).render(h.jsxs(b.StrictMode,{children:[h.jsx("link",{type:"text/css",rel:"stylesheet",href:u}),h.jsx(J2,{})]}));const y=document.createElement("style");document.head.appendChild(y),y.appendChild(document.createTextNode(Z2))}go.main=tI,Object.defineProperty(go,Symbol.toStringTag,{value:"Module"})});
66
+ ${m} ${t?"animate-from-bottom":""} ${s}`,ref:f,role:c,children:[h.jsxs("div",{className:"flex items-center justify-center gap-x-2",children:[h.jsx(Ce,{className:"flex-shrink-0 self-start",tag:i}),h.jsx("p",{className:"text-xs font-semibold",children:a})]}),r]})}),KA=()=>{const{addToast:e,restoreDeployedFlow:t,cancelDetachedMode:r}=Ze();if(!ye(c=>c.showDeployedHistoryToast))return null;const i=()=>{t(),e({message:M(C.VERSION_RESTORED),status:"success"})},a=()=>{r()};return h.jsx(dE,{animate:!1,className:"gap-x-14",message:M(C.PREVIEW_DEPLOYED_VERSION),role:"dialog",children:h.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[h.jsx("button",{className:"rounded bg-primary px-1.5 py-0.5 text-xs font-medium text-background transition-colors hover:bg-primary/90",onClick:i,children:M(C.RESTORE_THIS_VERSION)}),h.jsx("button",{className:"rounded bg-secondary/50 px-1.5 py-0.5 text-xs font-medium text-background transition-colors hover:bg-secondary/40",onClick:a,children:M(C.CANCEL)})]})})},fE=({onKeyPress:e})=>{const t=Oo(["Escape","Esc"]);return b.useEffect(()=>{t&&typeof e=="function"&&e()},[t,e]),{isPressed:t}},XA={offset:[0,.5,1],opacity:[1,0,0],pointerEvents:["none","none","auto"],transform:["scale(1.1) translateY(0%)","scale(0.5) translateY(-100%)"]},QA={duration:ZR*2,easing:"ease-in-out",fill:"forwards"},qA=({durationMs:e,id:t,permanent:r})=>{const s=e??JR,[i,a]=b.useState(null),{deleteToast:c}=Ze(),u=b.useCallback(()=>{let f;const p=()=>c(t);return i instanceof HTMLElement?(f=i.animate(XA,QA),f.addEventListener("finish",p,{once:!0})):p(),()=>f?.removeEventListener("finish",p)},[t,c,i]);return fE({onKeyPress:u}),b.useEffect(()=>{if(r)return;let f,p;const m=()=>{clearTimeout(f)},E=()=>{m(),f=setTimeout(()=>{p=u()},s)};return E(),i instanceof HTMLElement&&(i.addEventListener("mouseenter",m),i.addEventListener("mouseleave",E)),()=>{m(),i instanceof HTMLElement&&(i.removeEventListener("mouseenter",m),i.removeEventListener("mouseleave",E),p?.())}},[u,s,r,i]),{deleteToastCallback:u,setToastRef:a,toastRef:i}},pE=({durationMs:e,id:t,message:r,permanent:s,status:i})=>{const{deleteToastCallback:a,setToastRef:c}=qA({durationMs:e,id:t,permanent:s});return h.jsx(dE,{className:"w-full max-w-sm",iconTag:i==="success"?"circle-check":"circle-exclamation",message:r,ref:c,status:i,children:h.jsxs("button",{className:"flex-shrink-0 self-start opacity-40 transition-opacity hover:opacity-70",onClick:a,children:[h.jsx(Ce,{tag:"circle-xmark",size:"xl"}),h.jsx("span",{className:"sr-only",children:M(C.CLOSE)})]})})},ZA={error:pE,success:pE},JA=()=>{const e=ye(r=>r.toastsMap);if(e.size===0)return null;const t=Array.from(e.values());return h.jsx("div",{className:"flex w-full flex-col items-center gap-y-1",children:t.map(r=>{const s=ZA[r.status];return h.jsx(s,{durationMs:r.durationMs,id:r.id,message:r.message,permanent:r.permanent,status:r.status},r.id)})})},eI=({asRole:e="alert",open:t=!1,type:r="overlay"})=>{const[s,i]=te.useState(t);b.useEffect(()=>{i(t)},[t]);const a=b.useCallback(()=>i(!1),[]),c=b.useCallback(()=>i(!0),[]);return{asRole:e,closeContainer:a,isOpen:s,openContainer:c,type:r}},hE=b.createContext(null),od=()=>{const e=b.useContext(hE);if(e==null)throw new Error("Toast components must be wrapped in <ToastContainer />");return e},tI=({children:e,...t})=>{const r=eI(t);return h.jsx(hE.Provider,{value:r,children:e})},mE=({iconAs:e,title:t,children:r})=>{const{asRole:s}=od();return h.jsxs("div",{className:"max-w-xl rounded-lg bg-foreground p-4 text-background shadow-2xl transition-[transform,box-shadow] duration-500 will-change-transform hover:shadow-none",role:s,children:[h.jsxs("h2",{className:"text-lg font-semibold leading-6 tracking-wide",children:[h.jsx("span",{className:"mr-2",children:h.jsx(Ce,{tag:e??"circle-exclamation"})}),t]}),h.jsx("div",{className:"mt-2 text-sm leading-5",children:r})]})},nI=({children:e})=>{const{closeContainer:t,isOpen:r,type:s}=od(),{getRootElement:i}=Ze(),a=i(),c=b.useRef(null);return b.useEffect(()=>{if(!c.current)return;let u,f;const p=m=>{if(m.key==="Escape"&&t(),m.key==="Tab"){const E=document.activeElement?.shadowRoot?.activeElement;m.shiftKey?E===u&&(f?.focus(),m.preventDefault()):E===f&&(u?.focus(),m.preventDefault())}};if(s==="overlay"){const m=c.current.querySelectorAll("button");u=m[0],f=m[m.length-1],f?.focus(),document.addEventListener("keydown",p)}return()=>{document.removeEventListener("keydown",p)}},[t,s]),r?Bc.createPortal(h.jsx("section",{className:`flex justify-center ${s==="overlay"?"fixed top-0 z-50 h-full w-full items-start px-6 py-36 backdrop-blur-sm backdrop-grayscale":"absolute top-10 left-1/2 z-10 -translate-x-1/2 translate-y-1/2 items-center"}`,ref:s==="overlay"?c:void 0,children:e}),a):null},gE=({asRole:e,open:t,children:r,type:s})=>h.jsx(tI,{asRole:e,open:t,type:s,children:h.jsx(nI,{children:r})}),rI=()=>{const t=ye(r=>r.httpError)===Am;return t?h.jsx(gE,{asRole:"dialog",open:t,type:"overlay",children:h.jsx(mE,{title:M(C.DOCUMENT_OUT_OF_SYNC),children:h.jsx(oI,{})})}):null},oI=()=>{const{closeContainer:e}=od(),t=()=>{window.location.reload()};return h.jsxs(h.Fragment,{children:[Ul(C.TOAST_DOCUMENT_OUT_OF_SYNC),h.jsxs("div",{className:"mt-11 flex items-center justify-center gap-x-6",children:[h.jsx("button",{className:"rounded-md border border-background bg-foreground px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:e,children:M(C.IGNORE)}),h.jsx("button",{className:"rounded-md border border-background bg-positive/70 px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:t,children:M(C.RESYNC)})]})]})},sI=Qe(),iI=()=>{const e=ye(t=>t.showDeployWarning);return h.jsx(gE,{asRole:"dialog",open:e,type:"overlay",children:h.jsx(mE,{title:M(C.DEPLOY_WARNING),children:h.jsx(lI,{})})})},lI=()=>{const{deployFlow:e,setShowDeployWarning:t,setShowValidationWarnings:r}=Ze(),s=()=>{t(!1),r(!0)},i=()=>{t(!1)},a=()=>{e().catch(c=>{sI.error(c)}),i()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-4",children:Ul(C.TOAST_DEPLOY_WARNING)}),h.jsx(cg,{onClickListItem:s}),h.jsxs("div",{className:"mt-11 flex items-center justify-center gap-x-6",children:[h.jsx("button",{className:"rounded-md border border-background bg-foreground px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:i,children:M(C.CANCEL)}),h.jsx("button",{className:"rounded-md border border-background bg-positive/70 px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:a,children:M(C.DEPLOY)})]})]})},aI="react-flow__controls-button",cI="min-w-[3.625rem] cursor-auto select-auto text-center hover:bg-background active:bg-background",uI="hidden sm:flex",dI=b.forwardRef(function({asTag:t="div",children:r,className:s="",hiddenSmallScreen:i=!1,...a},c){const u=t,p=`${aI} ${u==="button"?"":cI} ${i?uI:""} ${s}`;return h.jsx(u,{className:p,ref:c,...a,children:r})}),fI=()=>{const e=ye(c=>c.showValidationWarnings),t=ye(c=>c.validationWarnings),r=ye(c=>c.detachedMode),{setShowValidationWarnings:s}=Ze(),i=()=>s(!e),a=()=>{e&&s(!1)};return!t.size||r?(a(),null):h.jsx(gr,{onOpenChange:s,open:e,outsidePress:!1,placement:"bottom-start",role:"dialog",trigger:h.jsxs(dI,{className:"text-xs",asTag:"button",onClick:i,hiddenSmallScreen:!0,children:[M(C.WARNING),h.jsxs("div",{className:"flex items-center justify-center pl-1",children:[h.jsx("span",{className:"sr-only",children:M(C.MORE_INFO_STATUS_ERROR)}),h.jsx(Ce,{className:"text-warning",tag:"circle-exclamation"})]})]}),children:h.jsx(cg,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("h2",{className:"text-xs font-semibold",children:[h.jsx(Ce,{className:"mr-1",tag:"circle-exclamation"}),M(C.CAUTION)]}),h.jsxs("button",{className:"my-0.5 rounded-md py-0.5 px-1.5",onClick:a,children:[h.jsx("span",{className:"sr-only",children:M(C.CLOSE)}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]})})})},pI=()=>{const e=ye(s=>s.isDraggingNode),t=ye(s=>s.showInteractiveControl),r=s=>{ye.setState({isInteractiveControlOn:s})};return h.jsx(MR,{className:`mt-2.5 rounded-[0.25rem] ${e?"group/control-buttons":""}`,position:"top-left",onInteractiveChange:r,showInteractive:t,children:h.jsx(fI,{})})},hI=".react-flow__panel",mI=16,EE={cursor:"no-drop",transform:"translate(0px, 0px) scale(1)",visibility:"hidden",zIndex:"5"},yE=e=>{const t=e.getBoundingClientRect();return{isCursorIntersecting:({clientX:r,clientY:s})=>t.top<=s&&t.bottom>=s&&t.left<=r&&t.right>=r}},gI=e=>{const t=e.querySelectorAll(hI);return Array.from(t).map(r=>yE(r).isCursorIntersecting)},EI=e=>({resetDragNodeStyles:()=>{Object.entries(EE).forEach(([t,r])=>{e.style[t]=r})},updateDragNodeStyles:({isOverDropTarget:t,scale:r,xPos:s,yPos:i})=>{e.style.visibility="visible",e.style.cursor=t?"grabbing":"no-drop",e.style.transform=`translate(${s}px, ${i}px) scale(${r})`}}),yI=({handleMouseMove:e,handleMouseUp:t,root:r})=>(r.addEventListener("mousemove",e),r.addEventListener("mouseup",t),{removeListeners:()=>{r.removeEventListener("mousemove",e),r.removeEventListener("mouseup",t)}}),vI=()=>{const e=b.useRef(null),t=ye(v=>v.dragNodeType),r=ye(v=>v.flowWrapperElement),s=ye(v=>v.viewport.zoom),{addNode:i,getRootElement:a,setDragNodeType:c}=Ze(),u=a();if(b.useEffect(()=>{if(e.current&&t&&r&&u){let v=!1;const x=mI*s,_=e.current,w=yE(r).isCursorIntersecting,S=gI(r),{resetDragNodeStyles:N,updateDragNodeStyles:O}=EI(_),{removeListeners:D}=yI({handleMouseMove:T=>{const{clientX:A,clientY:L}=T,F=A-x,K=L-x;v=w({clientX:A,clientY:L})&&!S.some(Q=>Q({clientX:A,clientY:L})),O({isOverDropTarget:v,scale:v?s:1,xPos:F,yPos:K})},handleMouseUp:T=>{if(v){const A=r.getBoundingClientRect();i({nodeType:t,x:T.clientX-A.left-x,y:T.clientY-A.top-x})}c(void 0)},root:u});return()=>{D(),N()}}},[i,t,r,u,c,s]),!t)return null;const f=tE[t],p=Fm[t](),m=Le(),E={...p,initial:!1,valid:!0};return h.jsx("section",{className:"react-flow__node fixed left-0 top-0",ref:e,style:EE,children:h.jsx(f,{data:E,dragging:!0,id:m,isConnectable:!0,selected:!0,type:t,xPos:0,yPos:0,zIndex:0})})},xI={};function vE(e,t){let r;try{r=e()}catch{return}return{getItem:i=>{var a;const c=f=>f===null?null:JSON.parse(f,void 0),u=(a=r.getItem(i))!=null?a:null;return u instanceof Promise?u.then(c):c(u)},setItem:(i,a)=>r.setItem(i,JSON.stringify(a,void 0)),removeItem:i=>r.removeItem(i)}}const ni=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(s){return ni(s)(r)},catch(s){return this}}}catch(r){return{then(s){return this},catch(s){return ni(s)(r)}}}},SI=(e,t)=>(r,s,i)=>{let a={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,N)=>({...N,...S}),...t},c=!1;const u=new Set,f=new Set;let p;try{p=a.getStorage()}catch{}if(!p)return e((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...S)},s,i);const m=ni(a.serialize),E=()=>{const S=a.partialize({...s()});let N;const O=m({state:S,version:a.version}).then(D=>p.setItem(a.name,D)).catch(D=>{N=D});if(N)throw N;return O},v=i.setState;i.setState=(S,N)=>{v(S,N),E()};const x=e((...S)=>{r(...S),E()},s,i);let _;const w=()=>{var S;if(!p)return;c=!1,u.forEach(O=>O(s()));const N=((S=a.onRehydrateStorage)==null?void 0:S.call(a,s()))||void 0;return ni(p.getItem.bind(p))(a.name).then(O=>{if(O)return a.deserialize(O)}).then(O=>{if(O)if(typeof O.version=="number"&&O.version!==a.version){if(a.migrate)return a.migrate(O.state,O.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return O.state}).then(O=>{var D;return _=a.merge(O,(D=s())!=null?D:x),r(_,!0),E()}).then(()=>{N?.(_,void 0),c=!0,f.forEach(O=>O(_))}).catch(O=>{N?.(void 0,O)})};return i.persist={setOptions:S=>{a={...a,...S},S.getStorage&&(p=S.getStorage())},clearStorage:()=>{p?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>w(),hasHydrated:()=>c,onHydrate:S=>(u.add(S),()=>{u.delete(S)}),onFinishHydration:S=>(f.add(S),()=>{f.delete(S)})},w(),_||x},_I=(e,t)=>(r,s,i)=>{let a={storage:vE(()=>localStorage),partialize:w=>w,version:0,merge:(w,S)=>({...S,...w}),...t},c=!1;const u=new Set,f=new Set;let p=a.storage;if(!p)return e((...w)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(...w)},s,i);const m=()=>{const w=a.partialize({...s()});return p.setItem(a.name,{state:w,version:a.version})},E=i.setState;i.setState=(w,S)=>{E(w,S),m()};const v=e((...w)=>{r(...w),m()},s,i);let x;const _=()=>{var w,S;if(!p)return;c=!1,u.forEach(O=>{var D;return O((D=s())!=null?D:v)});const N=((S=a.onRehydrateStorage)==null?void 0:S.call(a,(w=s())!=null?w:v))||void 0;return ni(p.getItem.bind(p))(a.name).then(O=>{if(O)if(typeof O.version=="number"&&O.version!==a.version){if(a.migrate)return a.migrate(O.state,O.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return O.state}).then(O=>{var D;return x=a.merge(O,(D=s())!=null?D:v),r(x,!0),m()}).then(()=>{N?.(x,void 0),x=s(),c=!0,f.forEach(O=>O(x))}).catch(O=>{N?.(void 0,O)})};return i.persist={setOptions:w=>{a={...a,...w},w.storage&&(p=w.storage)},clearStorage:()=>{p?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>c,onHydrate:w=>(u.add(w),()=>{u.delete(w)}),onFinishHydration:w=>(f.add(w),()=>{f.delete(w)})},a.skipHydration||_(),x||v},wI=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((xI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),SI(e,t)):_I(e,t),xE=window,SE={showAllNodes:!1,showDevOptions:!1},Xr=Do()(wI((e,t)=>({...SE,actions:{getFlagNames:()=>{const r=t();return Object.keys(r).filter(s=>s!=="actions")},toggleFlag:r=>e(s=>({...s,[r]:!s[r]}))}}),{name:"flags",partialize:e=>Object.fromEntries(Object.entries(e).filter(([t])=>t!=="actions")),storage:vE(()=>localStorage),version:0})),_E=()=>Xr.getState().actions;Xr.subscribe(e=>{console.log("feature flags changed",e)});const NI=e=>{const t=(s,i)=>{Xr.setState(a=>({...a,[s]:i}))},r=s=>{const i=Xr.getState(),a={...s};return Object.entries(i).forEach(([c,u])=>{c in a&&typeof u=="boolean"&&(a[c]=u)}),a};if(xE){const s=new Proxy(r(e),{get:(i,a)=>Reflect.get(i,a),set:(i,a,c)=>{if(typeof c=="boolean"&&a in i)t(a,c);else throw new Error("unknown flag");return Reflect.set(i,a,c)}});xE.swFlags=s}},RI=()=>NI(SE),Bl={currentColor:{negative:"fill-current",primary:"fill-current"},light:{negative:"fill-negative",primary:"fill-primary"}},TI={"2xl":"w-[2em] h-[2em]","2xs":"w-[0.75em] h-[0.75em]",lg:"w-[1.25em] h-[1.25em]",md:"w-[1em] h-[1em]",sm:"w-[0.875em] h-[0.875em]",xl:"w-[1.5em] h-[1.5em]",xs:"w-[0.75em] h-[0.75em]"},OI=b.forwardRef(function({className:t="",size:r="md",type:s="light"},i){const a=TI[r];return h.jsxs("svg",{"aria-hidden":"true",className:`${a} ${t}`,focusable:"false",fill:"none",ref:i,role:"img",viewBox:"0 0 64 73",xmlns:"http://www.w3.org/2000/svg",children:[h.jsx("path",{d:"M63.9998 46.5209C63.9998 48.596 63.4369 49.9545 62.3171 51.0736C55.6065 57.7826 48.8931 64.4815 42.177 71.1703C39.841 73.495 36.4374 73.6097 34.1234 71.4843C31.6868 69.2442 31.5903 65.569 33.9726 63.1356C36.9983 60.0482 40.0681 57.003 43.132 53.9537C46.8137 50.2907 50.5034 46.6369 54.2012 42.9926C55.9925 41.2315 58.3929 40.7666 60.5902 41.7669C62.7876 42.7672 63.9315 44.5686 63.9998 46.5209Z",className:Bl[s].primary}),h.jsx("path",{d:"M0.000812669 25.3858C0.0329789 24.3372 0.589857 23.0088 1.68351 21.9159C8.37007 15.2378 15.058 8.56035 21.7472 1.88357C23.1384 0.492799 24.7789 -0.219695 26.739 0.0600696C29.061 0.402228 30.6834 1.69438 31.4393 3.92847C32.1952 6.16256 31.6725 8.18129 30.032 9.85183C26.8355 13.1003 23.5988 16.3166 20.3822 19.5329C16.868 23.0309 13.3444 26.5196 9.81152 29.9989C8.01423 31.762 5.61985 32.1947 3.41647 31.2307C1.27339 30.2988 -0.0373848 28.2438 0.000812669 25.3858Z",className:Bl[s].primary}),h.jsx("path",{d:"M4.59424 32.9836C5.35618 32.9494 5.98342 32.9675 6.60463 32.8849C8.18055 32.688 9.64041 31.953 10.738 30.8038C12.0206 29.4936 13.3093 28.1873 14.6241 26.8489C14.8714 27.0683 15.0262 27.191 15.1609 27.3279C20.1078 32.2791 25.054 37.2324 29.9995 42.1876C31.6219 43.8179 32.1909 45.7843 31.5395 47.9983C30.9123 50.1257 29.4507 51.4883 27.2835 51.9774C25.4078 52.398 23.6186 52.0398 22.2435 50.6751C16.3671 44.8484 10.551 38.9673 4.59424 32.9836Z",className:Bl[s].negative}),h.jsx("path",{d:"M59.4545 40.0944C56.4389 39.7865 54.2878 40.9519 52.4744 42.9585C51.4933 44.0454 50.4178 45.0477 49.3583 46.1164C49.1372 45.9152 48.9824 45.7964 48.8436 45.6555C43.8914 40.7003 38.9418 35.7464 33.9949 30.7938C32.3745 29.1635 31.8076 27.1931 32.4751 24.9791C33.1164 22.8537 34.5799 21.4951 36.7532 21.0181C38.6751 20.5955 40.4623 21.0181 41.8676 22.4109C47.6307 28.1229 53.3677 33.8571 59.0785 39.6134C59.163 39.6899 59.2273 39.7966 59.4545 40.0944Z",className:Bl[s].negative})]})}),CI={[C.FLOW_DATA_VERSION]:$s,[C.PKG_VERSION]:YR},AI=()=>{const e=()=>{r.current?.open===!1&&r.current.showModal()},t=()=>{r.current?.open&&r.current.close()},r=te.useRef(null);return h.jsxs(h.Fragment,{children:[h.jsxs("button",{className:"group flex items-center justify-center gap-x-2 text-foreground/50 transition-colors hover:text-foreground/70",onClick:e,children:[h.jsx(OI,{className:"text-foreground/40 transition-colors group-hover:text-foreground/50",size:"xl",type:"currentColor"}),h.jsx("span",{className:"text-xs font-semibold",children:M(C.ABOUT)})]}),h.jsx("dialog",{ref:r,className:"aspect-[5/4] w-72 max-w-xs overflow-hidden rounded-lg border border-foreground/10 bg-background text-foreground shadow-xl backdrop:backdrop-blur-sm backdrop:backdrop-brightness-95",children:h.jsxs("div",{className:"h-full px-2 pb-10",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h2",{className:"text-2xl leading-10",children:M(C.ABOUT)}),h.jsxs("button",{className:"my-0.5 -mr-1.5 rounded-md py-0.5 px-1.5 ",onClick:t,children:[h.jsx("span",{className:"sr-only",children:M(C.CLOSE)}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]}),h.jsxs("div",{className:"h-full overflow-y-auto",children:[h.jsx("ul",{className:"mt-1 flex flex-col items-center justify-center text-sm",children:Object.entries(CI).map(([s,i])=>h.jsx("li",{className:"text-foreground/70",children:h.jsxs("p",{children:[M(s),": ",i]})},s))}),h.jsx("div",{className:"mt-6 flex items-center justify-center ",children:h.jsx("button",{className:"rounded-md border border-foreground/10 bg-positive px-3.5 py-2.5 font-bold tracking-widest text-background",onClick:t,children:M(C.CLOSE)})})]})]})})]})},II={deploy:C.STATUS_DEPLOY,deployed:C.STATUS_DEPLOYED,deploying:C.STATUS_DEPLOYING,error:C.STATUS_DEPLOY_ERROR},wE={deploy:"text-background border-hidden hover:bg-primary/90",deployed:"bg-background text-positive border-positive/20",deploying:"bg-background text-foreground/50 border-foreground/10",error:"bg-negative text-background border-hidden"},bI=()=>{const e=ye(O=>O.deployFlowStatus),t=ye(O=>O.deployFlowURL),r=ye(O=>O.detachedMode),s=ye(O=>O.documentVersion),i=ye(O=>O.httpError),a=ye(O=>O.saveFlowStatus),{deployFlow:c,getValidationWarnings:u,setShowDeployWarning:f}=Ze(),p={error:void 0,prevDocVersion:s},[m,E]=ed(p),v=II[e],x=async()=>{if(u().size>0)f(!0);else try{E({error:void 0}),await c()}catch(O){O instanceof Error?E({error:O.message}):E({error:"Failed to deploy!"})}};b.useEffect(()=>{a==="saved"&&s!==m.prevDocVersion&&E({prevDocVersion:s})},[m.prevDocVersion,s,a,E]);const _=a!=="saved"||e==="deployed"||e==="deploying",w=i==="document-sync"?wE.deploying:wE[e];let S="";e==="deploy"&&(S=a==="saved"?"bg-primary":"bg-focus");const N=`${S} ${w}`;return!t||r?null:h.jsxs("button",{"data-testid":"cfb__deploy-button",className:`flex items-center justify-center rounded border px-1.5 py-0.5
67
+ text-xs font-medium transition-colors ${N}`,disabled:_,onClick:x,children:[M(v),h.jsx(gr,{placement:"right",trigger:h.jsx("span",{className:"flex items-center justify-center pl-1",role:"tooltip",tabIndex:0,children:e==="error"?h.jsx(Ce,{tag:"circle-exclamation"}):h.jsx(h.Fragment,{})}),children:e==="error"?M(C.MORE_INFO_DEPLOY_ERROR,{message:m.error}):M(C.MORE_INFO_DEPLOY)})]})},LI=()=>{const e=ye(t=>t.backButtonHref);return e?h.jsxs("a",{href:e,children:[h.jsx("span",{className:"sr-only",children:M(C.NAVIGATE_BACK)}),h.jsx(Ce,{tag:"arrow-left",className:"text-negative",size:"lg"})]}):null},DI=()=>{const e=ye(c=>c.showDeployedHistory),t=ye(c=>c.httpError==="document-sync"),{cancelDetachedMode:r,setShowDeployedHistory:s}=Ze(),i=()=>{e?r():s(!0)},a=e?"text-background bg-foreground":"text-foreground bg-foreground/10";return h.jsx(gr,{placement:"top",trigger:h.jsxs("button",{className:`flex items-center justify-center rounded border border-transparent p-1 transition-colors ${a}`,disabled:t,onClick:i,type:"button",children:[h.jsx("span",{className:"sr-only",children:M(C.VERSION_HISTORY)}),h.jsx(Ce,{tag:"clock-rotate-left",size:"xs"})]}),children:M(C.VERSION_HISTORY)})},kI=({isDisabled:e,isSelected:t,itemIndex:r,onClick:s,onSelected:i,relativeTimeSince:a,version:c})=>{const u=b.useRef(null),f=E=>{i(E)},p=()=>{t||(f(r),s(r))},m=E=>{E.preventDefault();const{key:v}=E;(v==="Enter"||v===" ")&&s(r),v==="ArrowUp"&&f(r-1),v==="ArrowDown"&&f(r+1)};return t&&(u.current?.focus({preventScroll:!0}),u.current?.scrollIntoView({block:"nearest"})),h.jsx("li",{className:`border-l-2 transition-colors ${t?"border-l-primary/50 bg-primary/10":"border-l-transparent bg-background hover:bg-primary/5"}`,children:h.jsxs("button",{"aria-selected":t?"true":"false",className:`flex w-full items-start gap-x-2 p-2 pr-4 ${e?"text-disabled":""}`,disabled:e,onClick:p,onKeyDown:m,type:"button",tabIndex:t?0:-1,ref:u,children:[h.jsx(Ce,{className:`p-1 ${t?"text-primary":"text-foreground/30"}`,tag:"dot-circle"}),h.jsxs("div",{className:"flex flex-col items-start justify-center",children:[h.jsx("h3",{className:"text-xs font-medium",children:M(C.VERSION_LIST_ITEM,{number:c})}),h.jsx("p",{className:"text-xxs",children:h.jsx("time",{children:a})})]})]})})},MI=200,NE=Qe(),PI=()=>{const e=ye(N=>N.deployedVersionsList),t=ye(N=>N.saveFlowStatus),r=ye(N=>N.showDeployedHistory),{cancelDetachedMode:s,getDeployedVersionsList:i,migrateAndLoadDeployedFlow:a}=Ze();fE({onKeyPress:r?s:void 0});const c=b.useRef(),[u,f]=b.useState("loading"),[p,m]=b.useState(null);p!==null&&!r&&m(null);const E=b.useCallback(N=>{N>=0&&N<=e.length-1?m(N):m(null)},[e.length]),v=b.useCallback(N=>{const O=c.current?.[N];O?(NE.info("load version",O.id),a(O)):NE.error("version not found")},[a]),x=b.useCallback(()=>{f("loading"),i({pageSize:MI}).then(N=>{f("loaded"),c.current=N}).catch(()=>{f("error"),c.current=void 0})},[i]);b.useLayoutEffect(()=>{r&&x()},[x,r]);const _=u==="error",w=e.length>0,S=t==="saved";return r?h.jsxs("div",{"data-testid":"cfb__deployed-versions-sidebar",className:"flex h-full flex-col py-3",children:[h.jsxs("section",{className:"flex items-center justify-between self-stretch px-4 pb-1",children:[h.jsxs("h2",{className:"flex items-center gap-1 text-tiny font-bold uppercase leading-none tracking-wide",children:[h.jsx(Ce,{className:"text-xs text-foreground/50",tag:"clock-rotate-left"}),M(C.VERSION_HISTORY)]}),h.jsxs("button",{className:"flex items-center justify-center px-0.5",onClick:s,type:"button",children:[h.jsx("span",{className:"sr-only",children:M(C.CLOSE)}),h.jsx(Ce,{tag:"xmark"})]})]}),h.jsxs("div",{className:`${w?"overflow-y-auto":"h-full"}`,children:[u!=="loaded"?h.jsxs("div",{className:`flex flex-col justify-center gap-y-4 p-4 text-sm leading-none tracking-wide text-foreground/50 ${w?"":"h-full"}`,children:[h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[_?h.jsx(Ce,{className:"text-negative",tag:"circle-exclamation"}):h.jsx(Ce,{className:"animate-spin",tag:"arrows-rotate"}),h.jsx("p",{"aria-live":_?"assertive":"polite",className:`${_?"text-negative":"font-bold uppercase text-foreground/50"}`,role:_?"alert":"status",children:M(_?C.ERROR_FETCHING_DEPLOYED_VERSIONS:C.STATUS_LOADING)})]}),_?h.jsx("div",{className:"flex w-full items-center justify-center",children:h.jsx("button",{className:"rounded border border-primary/50 bg-primary/10 px-3 py-1.5 text-sm font-bold leading-tight tracking-wider text-primary",onClick:x,type:"button",children:M(C.RESYNC)})}):null]}):null,!w&&u==="loaded"?h.jsx("div",{className:`flex h-full flex-col justify-center gap-y-4 p-4 text-sm leading-none tracking-wide text-foreground/50
68
+ `,children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[h.jsx(Ce,{tag:"circle-exclamation"}),Ul(C.NO_DEPLOYED_VERSIONS)]})}):null,w?h.jsx("ol",{children:e.map((N,O)=>h.jsx(kI,{itemIndex:O,isDisabled:!S,isSelected:O===p,onClick:v,onSelected:E,relativeTimeSince:N.relativeTimeSince,version:N.version},N.id))}):null]})]}):null},UI=()=>{const{getFlagNames:e}=_E();return h.jsxs("div",{className:"rounded-sm border border-gray-200 p-2",children:[h.jsx("h3",{className:"w-full",children:"Feature Flags"}),h.jsx("div",{className:"flex flex-col gap-y-2 py-2",children:e().map(t=>h.jsx(FI,{flagName:t},t))})]})},FI=({flagName:e})=>{const{toggleFlag:t}=_E(),s=Xr(i=>i[e])?"translate-x-5 bg-positive":"translate-x-0 bg-negative";return h.jsxs("label",{className:"flex cursor-pointer items-center",children:[h.jsxs("div",{className:"relative",children:[h.jsx("input",{type:"checkbox",className:"sr-only",onChange:()=>t(e)}),h.jsx("div",{className:"h-5 w-10 rounded-full bg-secondary/20",children:h.jsx("div",{className:`absolute left-1 top-1 h-3 w-3 rounded-full transition ${s}`})})]}),h.jsx("p",{className:"ml-3 text-sm font-medium",children:e})]})},jI=()=>{const[e,t]=b.useState(!1),r=()=>{t(s=>!s)};return h.jsx(gr,{open:e,onOpenChange:t,placement:"bottom",role:"dialog",trigger:h.jsxs("button",{className:"group flex items-center justify-center gap-x-2 text-foreground/50 transition-colors hover:text-foreground/70",onClick:r,children:[h.jsx(Ce,{className:"text-foreground/40 transition-colors group-hover:text-foreground/50",size:"xl",tag:"circle-question"}),h.jsxs("span",{className:"text-xs font-semibold",children:[M(C.HELP),h.jsx("span",{className:"sr-only",children:M(C.MORE_INFO_TESTING_YOUR_FLOW)})]})]}),children:h.jsxs("section",{className:"p-2",children:[h.jsx("h2",{className:"mb-4 text-2xl font-semibold",children:"Testing Your Call Flow"}),h.jsxs("div",{className:"text-sm",children:[h.jsx("p",{children:"To test the current working version (draft) of your Call Flow, follow these steps:"}),h.jsxs("ol",{className:"my-4 list-inside list-decimal",children:[h.jsxs("li",{className:"mb-2 list-item",children:["Go to the settings tab of the purchased phone number you want to use for testing:  ",h.jsx("a",{className:"underline hover:text-background/80",href:"/phone_numbers",target:"_blank",rel:"noopener noreferrer",children:"Purchased Phone Numbers"})]}),h.jsxs("li",{className:"mb-2",children:["Choose the appropriate Call Flow for handling your calls:  ",h.jsx("a",{className:"underline hover:text-background/80",href:"/call_flows",target:"_blank",rel:"noopener noreferrer",children:"Call Flows"})]}),h.jsx("li",{className:"mb-2",children:"Select the working version (draft) of the chosen Call Flow."}),h.jsx("li",{children:"When you make a call to the number, it should now execute the working version of your Call Flow upon answering."})]}),h.jsx("p",{className:"mt-4 mb-2",children:"In an upcoming update, you will be able to test your selected Call Flow directly from the Call Flow Builder, eliminating the need to manually associate the Call Flow with your number."})]})]})})},VI=(e,t)=>({label:M(Fl[e].label),nodes:Object.entries(Fl[e].nodes).reduce((r,[s,i])=>(((typeof i.active=="boolean"?i.active:i.active[GR])||t)&&r.push({deprecated:!!i.deprecated,title:M(i.label),type:s}),r),[]).sort((r,s)=>r.title.localeCompare(s.title))}),RE=Qe(),$I=["action","forwardTo","recording","input","decision"],HI=()=>{const e=Xr(c=>c.showAllNodes),t=ye(c=>c.isCanvasInteractive),{addNode:r,setDragNodeType:s}=Ze(),i=b.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?r({nodeType:u}):RE.error("No nodeType found on click event")},[r]),a=b.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?s(u):RE.error("No nodeType found on drag event")},[s]);return h.jsx("ul",{className:"py-3 px-2",id:"sidebar-node-list",children:$I.map(c=>h.jsx("li",{children:h.jsx(BI,{enableNodeButtons:t,group:c,handleOnClick:i,handleDragStart:a,showAllNodes:e})},c))})},BI=({enableNodeButtons:e=!0,group:t,handleOnClick:r,handleDragStart:s,showAllNodes:i})=>{const a=VI(t,i),c=`ngm-heading-${o1(a.label)}`;return h.jsxs(h.Fragment,{children:[h.jsx("h2",{className:"px-2 pb-1 text-tiny font-bold uppercase tracking-wide text-foreground/50",id:c,children:a.label}),h.jsx("ul",{"aria-labelledby":c,className:"flex flex-1 flex-col gap-y-1 pb-2",children:a.nodes.map(u=>h.jsx("li",{children:h.jsxs("button",{className:`flex w-full items-start gap-2 rounded-lg border border-dashed border-transparent bg-primary/5 p-2 transition-colors
69
+ hover:border-primary hover:bg-primary/20 enabled:hover:shadow-md`,"data-node-type":u.type,disabled:!e,draggable:e,onClick:e?r:void 0,onDragStart:e?s:void 0,children:[h.jsx(Ce,{tag:"circle-small",className:"text-primary"}),h.jsxs("span",{className:"text-left text-xs font-medium line-clamp-2",children:[u.title,u.deprecated&&h.jsxs("span",{className:"text-foreground/70",children:[" ",M(C.DEPRECATED)]})]})]})},u.type))})]})},zI=()=>{const{addToast:e,restoreDeployedFlow:t}=Ze(),r=ye(i=>i.workingFlowCopy),s=()=>{t(),e({message:M(C.VERSION_RESTORED),status:"success"})};return r?h.jsx("button",{className:`flex items-center justify-center rounded border bg-primary px-1.5 py-0.5 text-xs font-medium
70
+ text-background transition-colors hover:bg-primary/90`,onClick:s,children:M(C.RESTORE)}):null},WI={"awaiting-save":C.STATUS_SAVING,"document-sync":C.STATUS_LOCKED,error:C.STATUS_ERROR,initial:C.STATUS_LOADING,saved:C.STATUS_SAVED,saving:C.STATUS_SAVING},TE=e=>(e.preventDefault(),e.returnValue=""),OE=(e,t)=>e==="document-sync"?e:t,GI=()=>{const e=ye(v=>v.detachedMode),t=ye(v=>v.saveFlowStatus),r=ye(v=>v.httpError),[s,i]=b.useState(!0),[a,c]=b.useState(OE(r,t)),u=WI[a],f=t==="error"||r,p=OE(r,t),m=b.useRef(!1);b.useEffect(()=>{p==="initial"&&!m.current?(m.current=!0,c(p),i(!1),setTimeout(()=>{i(!0)},qR)):p!=="initial"&&s&&(m.current=!1,c(p))},[s,p]),b.useEffect(()=>{if(!(t==="saved"||r))return addEventListener("beforeunload",TE,{capture:!0}),()=>{removeEventListener("beforeunload",TE,{capture:!0})}},[r,t]);let E="";switch(!0){case f:E="px-1.5 py-0.5 bg-negative/20 text-negative";break;case a==="saved":E="text-foreground/50";break;default:E="px-1.5 py-0.5 bg-foreground/30 text-background"}return e?null:h.jsx("div",{"aria-live":f?"assertive":"polite","data-testid":"cfb__status",className:"flex",role:f?"alert":"status",children:h.jsxs("div",{className:`flex gap-x-1 rounded text-xxs ${E}`,children:[h.jsx("p",{children:u==="STATUS_SAVED"?h.jsx(YI,{}):M(u)}),f&&h.jsx(gr,{placement:"bottom",trigger:h.jsxs("div",{role:"tooltip",tabIndex:0,children:[h.jsx("span",{className:"sr-only",children:M(C.MORE_INFO_STATUS_ERROR)}),h.jsx(Ce,{tag:"circle-exclamation"})]}),children:M(r==="document-sync"?C.INFO_STATUS_ERROR_OUT_OF_SYNC:C.INFO_STATUS_ERROR)})]})})},YI=()=>{const e=ye(a=>a.documentLastUpdated),t=b.useCallback((a,...c)=>Mm(Bg(),{numeric:"always",style:"narrow"})(a,{excludeUnits:{second:!0},...c}),[]),r=e?t(e):void 0,[s,i]=b.useState(r);return b.useEffect(()=>{if(!e)return;const a=setInterval(()=>{i(t(e))},1e3);return()=>clearInterval(a)},[e,t]),h.jsxs(h.Fragment,{children:[M(C.SAVED)," ",h.jsx("time",{children:s})]})},KI=()=>{const e=Xr(c=>c.showDevOptions),{exportStoreData:t}=Ze(),r=ye(c=>c.flowTitle),s=ye(c=>c.showDeployedHistory),i=b.useRef(null),a=c=>{c.preventDefault(),i.current&&i.current.showModal()};return h.jsxs(h.Fragment,{children:[h.jsxs("section",{className:"hidden h-full w-1/6 min-w-[160px] shrink-0 flex-col bg-background text-foreground sm:flex",children:[h.jsxs("nav",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[h.jsx(LI,{}),e&&h.jsx("button",{className:"rounded bg-positive p-1 px-2 text-xs text-background",onClick:a,children:"Dev Options"})]}),h.jsx("section",{className:"px-2 py-2",children:h.jsxs("div",{className:"divide-y divide-foreground/10 rounded-lg border border-foreground/10",children:[h.jsx("h1",{className:"block w-full shrink-0 p-2 text-sm font-semibold leading-tight line-clamp-2",children:r||h.jsx(h.Fragment,{children:" "})}),h.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-1 gap-y-2 p-2",children:[h.jsx("div",{className:"flex-1",children:h.jsx(GI,{})}),h.jsxs("menu",{className:"flex items-center justify-center gap-x-1",children:[s?h.jsx(zI,{}):h.jsx(bI,{}),h.jsx(DI,{})]})]})]})}),h.jsxs("section",{className:"h-full overflow-y-auto",children:[s?null:h.jsx(HI,{}),h.jsx(PI,{})]}),h.jsx("section",{className:"flex flex-col items-start justify-center gap-y-5 px-2 pt-3 pb-4",children:h.jsxs("div",{className:"flex flex-col items-start justify-center gap-y-3 px-2",children:[h.jsx(AI,{}),h.jsx(jI,{})]})})]}),e&&h.jsx("dialog",{className:"z-50 my-10 rounded-lg border border-foreground/10 bg-background text-foreground",ref:i,children:h.jsx("form",{children:h.jsxs("fieldset",{children:[h.jsxs("legend",{className:"flex w-full justify-between pb-2",children:[h.jsx("h1",{className:"text-2xl leading-10",children:"Dev Options"}),h.jsxs("button",{className:"p-1 pt-0 font-semibold",formMethod:"dialog",children:[h.jsx("span",{className:"sr-only",children:"Close"}),h.jsx(Ce,{tag:"xmark",size:"lg"})]})]}),h.jsxs("div",{className:"mb-1 rounded-sm border border-gray-200 p-2",children:[h.jsx("h3",{className:"w-full",children:"Flow Data"}),h.jsx("div",{className:"flex flex-row gap-x-2 py-2",children:h.jsx("div",{className:"flex items-center",children:h.jsx("button",{type:"button",className:"rounded border bg-background px-2 py-1 text-sm hover:scale-105 hover:bg-background/80 active:scale-95",onClick:t,children:"View JSON File"})})})]}),h.jsx(UI,{})]})})})]})},XI=()=>{const e=b.useRef(null),[t,r]=b.useState(),[s,i]=b.useState(null);return b.useLayoutEffect(()=>(e.current=new ResizeObserver(([a])=>r(a)),s&&e.current.observe(s),()=>e.current?.disconnect()),[s]),{observerEntry:t,setTarget:i}},QI=({rootAppHeight:e,rootAppWidth:t})=>{ye.setState({rootAppHeight:e,rootAppWidth:t})},qI=()=>{const{observerEntry:e,setTarget:t}=XI();return b.useEffect(()=>{e&&(Qe().log("resized",{rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}),QI({rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}))},[e]),{rootTarget:t}};function ZI(){Qe().debug("Hello World!");const{rootTarget:e}=qI(),t=ye(i=>i.colorMode)??"",r=ye(i=>i.httpError),s=r!==void 0&&r!=="document-sync";return h.jsx(h.Fragment,{children:h.jsx("div",{className:`${t} flex h-full w-full bg-backgroundAlt text-foreground`,ref:e,children:s?h.jsx(OC,{errorType:r}):h.jsxs(h.Fragment,{children:[h.jsx(KI,{}),h.jsx(rI,{}),h.jsx(iI,{}),h.jsxs(hu,{children:[h.jsx(iA,{}),h.jsxs(oA,{children:[h.jsxs(Ds,{className:"z-50 m-0 mx-auto mt-2.5 flex w-full min-w-[320px] max-w-lg flex-col items-center gap-y-2 px-4",position:"top-center",children:[h.jsx(KA,{}),h.jsx(JA,{})]}),h.jsx(vI,{}),h.jsx(pI,{}),h.jsx(YA,{}),h.jsx(lA,{})]})]})]})})})}const JI='@font-face{font-family:SWInter;font-style:normal;font-weight:400;font-display:swap;src:url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff2) format("woff2"),url(//cdn.signalwire.com/fonts/inter/Inter-Regular.woff) format("woff")}@font-face{font-family:SWInter;font-style:normal;font-weight:500;font-display:swap;src:url(//cdn.signalwire.com/fonts/inter/Inter-Medium.woff2) format("woff2"),url(//cdn.signalwire.com/fonts/inter/Inter-Medium.woff) format("woff")}',CE=Qe(),e2=e=>{if(!e||!e.getFlowURL||!e.updateFlowURL)throw new TypeError("Invalid or missing required params")};function t2(e){e2(e);const{backButtonHref:t,deployFlowURL:r,getAiAgentsURL:s=`${window.location.origin}${mv}`,getFlowURL:i,getSwmlScriptsURL:a=`${window.location.origin}${gv}`,rootElementId:c="sw-cfb-root",styleHref:u="https://cdn.signalwire.com/npm/@signalwire/cfb@latest/dist/style.css",updateFlowURL:f,voicesURL:p="https://cdn.signalwire.com/npm/@signalwire/cfb@latest/dist/voices.json"}=e;Ju.getState().actions.init({voicesURL:p}).catch(v=>{CE.error("Error initializing voices",v)});const m=document.getElementById(c);if(ye.setState({backButtonHref:t,deployFlowURL:r,getFlowURL:i,rootElement:m,rootElementId:c,updateFlowURL:f}),s&&On.getState().actions.init({getAiAgentsURL:s}),a&&Bn.getState().actions.init({getSwmlScriptsURL:a}),iC().catch(v=>{CE.error("Error initializing i18n",v)}),RI(),!m)throw new Error(`Id: '${c}' not found in the DOM`);m.attachShadow({mode:"open"}),m.shadowRoot&&Yv.createRoot(m.shadowRoot).render(h.jsxs(b.StrictMode,{children:[h.jsx("link",{type:"text/css",rel:"stylesheet",href:u}),h.jsx(ZI,{})]}));const E=document.createElement("style");document.head.appendChild(E),E.appendChild(document.createTextNode(JI))}go.main=t2,Object.defineProperty(go,Symbol.toStringTag,{value:"Module"})});