@signalwire/cfb 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,70 +1,22 @@
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.14 [14ac6c2] (https://signalwire.com)
1
+ (function(vo,Rs){typeof exports=="object"&&typeof module<"u"?Rs(exports):typeof define=="function"&&define.amd?define(["exports"],Rs):(vo=typeof globalThis<"u"?globalThis:vo||self,Rs(vo.CFB={}))})(this,(function(vo){"use strict";/**
2
+ * Visual Builder v0.0.15 [49d79b0] (https://signalwire.com)
3
3
  * Copyright 2018-2026 SignalWire.
4
4
  */
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
- * @license React
7
- * react.production.min.js
8
- *
9
- * Copyright (c) Facebook, Inc. and its affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
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"),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
- * @license React
15
- * react-jsx-runtime.production.min.js
16
- *
17
- * Copyright (c) Facebook, Inc. and its affiliates.
18
- *
19
- * This source code is licensed under the MIT license found in the
20
- * LICENSE file in the root directory of this source tree.
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
- * @license React
23
- * scheduler.production.min.js
24
- *
25
- * Copyright (c) Facebook, Inc. and its affiliates.
26
- *
27
- * This source code is licensed under the MIT license found in the
28
- * LICENSE file in the root directory of this source tree.
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
- * @license React
31
- * react-dom.production.min.js
32
- *
33
- * Copyright (c) Facebook, Inc. and its affiliates.
34
- *
35
- * This source code is licensed under the MIT license found in the
36
- * LICENSE file in the root directory of this source tree.
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
- * @license React
46
- * use-sync-external-store-shim.production.min.js
47
- *
48
- * Copyright (c) Facebook, Inc. and its affiliates.
49
- *
50
- * This source code is licensed under the MIT license found in the
51
- * LICENSE file in the root directory of this source tree.
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
- * @license React
54
- * use-sync-external-store-shim/with-selector.production.min.js
55
- *
56
- * Copyright (c) Facebook, Inc. and its affiliates.
57
- *
58
- * This source code is licensed under the MIT license found in the
59
- * LICENSE file in the root directory of this source tree.
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.14",$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
5
+ function Rs(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 Ki(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xc={exports:{}},Ns={},Sc={exports:{}},Te={};var cp;function Rv(){if(cp)return Te;cp=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 y(k){return k===null||typeof k!="object"?null:(k=E&&k[E]||k["@@iterator"],typeof k=="function"?k:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,_={};function S(k,j,ee){this.props=k,this.context=j,this.refs=_,this.updater=ee||v}S.prototype.isReactComponent={},S.prototype.setState=function(k,j){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,j,"setState")},S.prototype.forceUpdate=function(k){this.updater.enqueueForceUpdate(this,k,"forceUpdate")};function R(){}R.prototype=S.prototype;function N(k,j,ee){this.props=k,this.context=j,this.refs=_,this.updater=ee||v}var b=N.prototype=new R;b.constructor=N,w(b,S.prototype),b.isPureReactComponent=!0;var T=Array.isArray,L=Object.prototype.hasOwnProperty,D={current:null},V={key:!0,ref:!0,__self:!0,__source:!0};function K(k,j,ee){var oe,se={},ue=null,pe=null;if(j!=null)for(oe in j.ref!==void 0&&(pe=j.ref),j.key!==void 0&&(ue=""+j.key),j)L.call(j,oe)&&!V.hasOwnProperty(oe)&&(se[oe]=j[oe]);var de=arguments.length-2;if(de===1)se.children=ee;else if(1<de){for(var he=Array(de),Re=0;Re<de;Re++)he[Re]=arguments[Re+2];se.children=he}if(k&&k.defaultProps)for(oe in de=k.defaultProps,de)se[oe]===void 0&&(se[oe]=de[oe]);return{$$typeof:e,type:k,key:ue,ref:pe,props:se,_owner:D.current}}function X(k,j){return{$$typeof:e,type:k.type,key:j,ref:k.ref,props:k.props,_owner:k._owner}}function G(k){return typeof k=="object"&&k!==null&&k.$$typeof===e}function te(k){var j={"=":"=0",":":"=2"};return"$"+k.replace(/[=:]/g,function(ee){return j[ee]})}var re=/\/+/g;function J(k,j){return typeof k=="object"&&k!==null&&k.key!=null?te(""+k.key):j.toString(36)}function C(k,j,ee,oe,se){var ue=typeof k;(ue==="undefined"||ue==="boolean")&&(k=null);var pe=!1;if(k===null)pe=!0;else switch(ue){case"string":case"number":pe=!0;break;case"object":switch(k.$$typeof){case e:case t:pe=!0}}if(pe)return pe=k,se=se(pe),k=oe===""?"."+J(pe,0):oe,T(se)?(ee="",k!=null&&(ee=k.replace(re,"$&/")+"/"),C(se,j,ee,"",function(Re){return Re})):se!=null&&(G(se)&&(se=X(se,ee+(!se.key||pe&&pe.key===se.key?"":(""+se.key).replace(re,"$&/")+"/")+k)),j.push(se)),1;if(pe=0,oe=oe===""?".":oe+":",T(k))for(var de=0;de<k.length;de++){ue=k[de];var he=oe+J(ue,de);pe+=C(ue,j,ee,he,se)}else if(he=y(k),typeof he=="function")for(k=he.call(k),de=0;!(ue=k.next()).done;)ue=ue.value,he=oe+J(ue,de++),pe+=C(ue,j,ee,he,se);else if(ue==="object")throw j=String(k),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(k).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.");return pe}function z(k,j,ee){if(k==null)return k;var oe=[],se=0;return C(k,oe,"","",function(ue){return j.call(ee,ue,se++)}),oe}function H(k){if(k._status===-1){var j=k._result;j=j(),j.then(function(ee){(k._status===0||k._status===-1)&&(k._status=1,k._result=ee)},function(ee){(k._status===0||k._status===-1)&&(k._status=2,k._result=ee)}),k._status===-1&&(k._status=0,k._result=j)}if(k._status===1)return k._result.default;throw k._result}var W={current:null},P={transition:null},U={ReactCurrentDispatcher:W,ReactCurrentBatchConfig:P,ReactCurrentOwner:D};function $(){throw Error("act(...) is not supported in production builds of React.")}return Te.Children={map:z,forEach:function(k,j,ee){z(k,function(){j.apply(this,arguments)},ee)},count:function(k){var j=0;return z(k,function(){j++}),j},toArray:function(k){return z(k,function(j){return j})||[]},only:function(k){if(!G(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=N,Te.StrictMode=s,Te.Suspense=f,Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,Te.act=$,Te.cloneElement=function(k,j,ee){if(k==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+k+".");var oe=w({},k.props),se=k.key,ue=k.ref,pe=k._owner;if(j!=null){if(j.ref!==void 0&&(ue=j.ref,pe=D.current),j.key!==void 0&&(se=""+j.key),k.type&&k.type.defaultProps)var de=k.type.defaultProps;for(he in j)L.call(j,he)&&!V.hasOwnProperty(he)&&(oe[he]=j[he]===void 0&&de!==void 0?de[he]:j[he])}var he=arguments.length-2;if(he===1)oe.children=ee;else if(1<he){de=Array(he);for(var Re=0;Re<he;Re++)de[Re]=arguments[Re+2];oe.children=de}return{$$typeof:e,type:k.type,key:se,ref:ue,props:oe,_owner:pe}},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 j=K.bind(null,k);return j.type=k,j},Te.createRef=function(){return{current:null}},Te.forwardRef=function(k){return{$$typeof:u,render:k}},Te.isValidElement=G,Te.lazy=function(k){return{$$typeof:m,_payload:{_status:-1,_result:k},_init:H}},Te.memo=function(k,j){return{$$typeof:p,type:k,compare:j===void 0?null:j}},Te.startTransition=function(k){var j=P.transition;P.transition={};try{k()}finally{P.transition=j}},Te.unstable_act=$,Te.useCallback=function(k,j){return W.current.useCallback(k,j)},Te.useContext=function(k){return W.current.useContext(k)},Te.useDebugValue=function(){},Te.useDeferredValue=function(k){return W.current.useDeferredValue(k)},Te.useEffect=function(k,j){return W.current.useEffect(k,j)},Te.useId=function(){return W.current.useId()},Te.useImperativeHandle=function(k,j,ee){return W.current.useImperativeHandle(k,j,ee)},Te.useInsertionEffect=function(k,j){return W.current.useInsertionEffect(k,j)},Te.useLayoutEffect=function(k,j){return W.current.useLayoutEffect(k,j)},Te.useMemo=function(k,j){return W.current.useMemo(k,j)},Te.useReducer=function(k,j,ee){return W.current.useReducer(k,j,ee)},Te.useRef=function(k){return W.current.useRef(k)},Te.useState=function(k){return W.current.useState(k)},Te.useSyncExternalStore=function(k,j,ee){return W.current.useSyncExternalStore(k,j,ee)},Te.useTransition=function(){return W.current.useTransition()},Te.version="18.3.1",Te}var up;function Os(){return up||(up=1,Sc.exports=Rv()),Sc.exports}var dp;function Nv(){if(dp)return Ns;dp=1;var e=Os(),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={},y=null,v=null;p!==void 0&&(y=""+p),f.key!==void 0&&(y=""+f.key),f.ref!==void 0&&(v=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:y,ref:v,props:E,_owner:i.current}}return Ns.Fragment=r,Ns.jsx=c,Ns.jsxs=c,Ns}var fp;function Ov(){return fp||(fp=1,xc.exports=Nv()),xc.exports}var h=Ov(),Tv=Object.create,_c=Object.defineProperty,Cv=Object.getOwnPropertyDescriptor,Av=Object.getOwnPropertyNames,Iv=Object.getPrototypeOf,bv=Object.prototype.hasOwnProperty,Lv=(e,t,r)=>t in e?_c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Dv=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kv=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Av(t))!bv.call(e,i)&&i!==r&&_c(e,i,{get:()=>t[i],enumerable:!(s=Cv(t,i))||s.enumerable});return e},Mv=(e,t,r)=>(r=e!=null?Tv(Iv(e)):{},kv(_c(r,"default",{value:e,enumerable:!0}),e)),wc=(e,t,r)=>Lv(e,typeof t!="symbol"?t+"":t,r),Pv=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,R){var N=S[R];if(typeof N.bind=="function")return N.bind(S);try{return Function.prototype.bind.call(N,S)}catch{return function(){return Function.prototype.apply.apply(N,[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,R){for(var N=0;N<a.length;N++){var b=a[N];this[b]=N<S?r:this.methodFactory(b,S,R)}this.log=this.debug}function m(S,R,N){return function(){typeof console!==s&&(p.call(this,R,N),this[S].apply(this,arguments))}}function E(S,R,N){return f(S)||m.apply(this,arguments)}function y(S,R,N){var b=this,T;R=R??"WARN";var L="loglevel";typeof S=="string"?L+=":"+S:typeof S=="symbol"&&(L=void 0);function D(G){var te=(a[G]||"silent").toUpperCase();if(!(typeof window===s||!L)){try{window.localStorage[L]=te;return}catch{}try{window.document.cookie=encodeURIComponent(L)+"="+te+";"}catch{}}}function V(){var G;if(!(typeof window===s||!L)){try{G=window.localStorage[L]}catch{}if(typeof G===s)try{var te=window.document.cookie,re=te.indexOf(encodeURIComponent(L)+"=");re!==-1&&(G=/^([^;]+)/.exec(te.slice(re))[1])}catch{}return b.levels[G]===void 0&&(G=void 0),G}}function K(){if(!(typeof window===s||!L)){try{window.localStorage.removeItem(L);return}catch{}try{window.document.cookie=encodeURIComponent(L)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}b.name=S,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=N||E,b.getLevel=function(){return T},b.setLevel=function(G,te){if(typeof G=="string"&&b.levels[G.toUpperCase()]!==void 0&&(G=b.levels[G.toUpperCase()]),typeof G=="number"&&G>=0&&G<=b.levels.SILENT){if(T=G,te!==!1&&D(G),p.call(b,G,S),typeof console===s&&G<b.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+G},b.setDefaultLevel=function(G){R=G,V()||b.setLevel(G,!1)},b.resetLevel=function(){b.setLevel(R,!1),K()},b.enableAll=function(G){b.setLevel(b.levels.TRACE,G)},b.disableAll=function(G){b.setLevel(b.levels.SILENT,G)};var X=V();X==null&&(X=R),b.setLevel(X,!1)}var v=new y,w={};v.getLogger=function(S){if(typeof S!="symbol"&&typeof S!="string"||S==="")throw new TypeError("You must supply a name when creating a logger.");var R=w[S];return R||(R=w[S]=new y(S,v.getLevel(),v.methodFactory)),R};var _=typeof window!==s?window.log:void 0;return v.noConflict=function(){return typeof window!==s&&window.log===v&&(window.log=_),v},v.getLoggers=function(){return w},v.default=v,v})}),Uv="/api/ai/ai_agents",Fv="/api/swml_scripts",jv=Mv(Pv()),Vv=()=>new Date().toISOString(),Ts=jv.default.getLogger("signalwire"),$v=Ts.methodFactory;Ts.methodFactory=(e,t,r)=>{let s=$v(e,t,r);return function(...i){i.unshift(Vv(),"-"),s(...i)}};var Hv=Ts.getLevel();Ts.setLevel(Hv);var Ge=()=>Ts,Bv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",zv=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Bv[r[e]&63];return t},Xi=Ge(),Wv=e=>typeof e=="object"&&e!==null&&"id"in e&&"type"in e&&"data"in e&&"position"in e,Gv=e=>{if(!Wv(e))throw Xi.error("nodeToDBShape: Invalid node",e),new Error;return{data:e.data,id:e.id,position:e.position,type:e.type}},Yv=e=>typeof e=="object"&&e!==null&&"id"in e&&"source"in e&&"sourceHandle"in e&&"target"in e&&"targetHandle"in e,Kv=e=>{if(!Yv(e))throw Xi.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}},pp=e=>e?.trim()?.toLowerCase(),xo=e=>e.replace(/\s/g,""),Rc=e=>{if(!(!e||typeof e=="string"&&e.trim().length===0))try{return JSON.parse(e)}catch(t){return Xi.error(t),typeof e=="string"?e.trim():e}},Nc=e=>typeof e=="string"?e.trim():typeof e=="number"&&isNaN(e)||e==null||typeof e=="object"||typeof e=="function"||typeof e=="symbol"?"":String(e),Xv=e=>e.split(",").map(t=>t.trim()).filter(Boolean),Qi=e=>{let t=Rc(e);return t&&typeof t=="object"&&Object.keys(t).length?t:void 0},De=()=>zv(),Oc=(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 Xi.error("buildUrlWithParams",r),r}},hp=e=>{let t=e===void 0?void 0:parseInt(e,10);return t===void 0||Number.isNaN(t)||t<=0?void 0:t},Tc=({callStateEvents:e,callStateUrl:t,connections:r,defaultFrom:s,defaultTimeout:i,callOrder:a})=>{let c=hp(i),u=xo(s),f=Xv(e),p=t?.trim(),m=r.map(({connectConfirmUrl:y,connectConfirmEnabled:v,connectFrom:w,connectTimeout:_,connectTo:S})=>({call_state_events:f.length>0?f:void 0,call_state_url:p||void 0,confirm:v?y:void 0,from:xo(w)||u||"%{call.from}",timeout:hp(_)??c,to:xo(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 Ge().warn(`The type '${a}' is not supported yet.`),[{connect:m[0]},E]}},Qv=/\bmale\b/i,qv=/\bfemale\b/i,Jv=e=>{if(e){if(qv.test(e))return"female";if(Qv.test(e))return"male"}},mp=(e,t)=>{if(typeof e=="object"&&!Array.isArray(e)){t.language&&(e.say_language=t.language);let r=Jv(t.gender);r&&(e.say_gender=r),t.voice&&(e.say_voice=t.voice)}return e},gp=(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},Zv={aiAgent:({data:{agent:e}})=>({ai:{agent:e}}),answer:({data:{maxDuration:e}})=>e?{answer:{max_duration:e}}:"answer",cond:()=>({cond:[]}),condRequest:({data:e})=>[{request:{body:Rc(e.body),connect_timeout:e.connectTimeout,headers:Qi(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:Qi(e.meta),params:Qi(e.params),result:[]}}),forwardAddress:({data:e})=>Tc(e),forwardPhone:({data:e})=>Tc(e),forwardResource:({data:e})=>Tc(e),handleCall:()=>"start",hangup:({data:{reason:e}})=>e?{hangup:{reason:e}}:"hangup",play:({data:e})=>{let{volume:t}=e,r=mp(gp({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=mp(gp({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=pp(f.command);p&&u.speechHints.push(p);let m=xo(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:Rc(e.body),connect_timeout:e.connectTimeout,headers:Qi(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:xo(t),to_number:xo(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)})},Br=e=>{try{return Zv[e.__type](e.node)}catch(t){throw Ge().error("Unknown Verb",e),t}},ex="1.0.0",tx=e=>{let t=Ge(),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 L=s.get(T.source),D=s.get(T.target);if(!L||!D)return t.warn("Invalid edge:",T);L.children.push(T.target),T.sourceHandle&&c.set(T.sourceHandle,D),r.has(T.target)&&a.set(T.target,[]),r.add(T.target)});let E=[...a.keys()],y=(T,L)=>{let D=c.get(L.id);if(D){let V=[];a.set(L.id,V),L.digit&&(T[L.digit]=V);let K=pp(L.command);K&&(T[K]=V);let X=f(D.node.id);if(X){let G={transfer:D.node.id};L.digit&&T[L.digit]?.push(G),K&&!T[K]?.includes(G)&&T[K]?.push(G)}R({current:D,sectionName:X?D.node.id:L.id})}return T},v=(T,L)=>{let D=c.get(L.id);if(D){let V=[];a.set(L.id,V),T[L.result]=V;let K=f(D.node.id);K&&T[L.result]?.push({transfer:D.node.id}),R({current:D,sectionName:K?D.node.id:L.id})}return T},w={else:(T,L)=>{if(L.result==="success")return T;let D=c.get(L.id);if(D){let V=[];a.set(L.id,V),T=V;let K=f(D.node.id);K&&T.push({transfer:D.node.id}),R({current:D,sectionName:K?D.node.id:L.id})}return T},then:(T,L)=>{if(L.result!=="success")return T;let D=c.get(L.id);if(D){let V=[];a.set(L.id,V),T=V;let K=f(D.node.id);K&&T.push({transfer:D.node.id}),R({current:D,sectionName:K?D.node.id:L.id})}return T}},_={fallback:T=>{let L=c.get(T),D={else:[]};if(L){let V=[];a.set(T,V),D.else=V;let K=f(L.node.id);K&&D.else.push({transfer:L.node.id}),R({current:L,sectionName:K?L.node.id:T})}return D},options:(T,L)=>{let D=c.get(L.id),V={then:[],when:L.value};if(D){let K=[];a.set(L.id,K),V.then=K;let X=f(D.node.id);X&&V.then.push({transfer:D.node.id}),T.push(V),R({current:D,sectionName:X?D.node.id:L.id})}return T}},S=T=>{let L=c.get(T),D=[];if(L){let V=[];a.set(T,V),D=V;let K=f(L.node.id);K&&D.push({transfer:L.node.id}),R({current:L,sectionName:K?L.node.id:T})}return D},R=({sectionName:T,current:L})=>{if(p(L.node.id))return;m(L.node.id);let D=a.get(T);if(!D){t.warn("Unknown section name:",T);return}switch(L.node.type){case"promptPlay":{let V=Br({__type:L.node.type,node:L.node});if(!Array.isArray(V)){t.warn("Invalid gather node",V);return}L.node.data?.results?.length&&(V[1].switch.case={...V[1].switch.case,...L.node.data.results.reduce(v,{})}),V[1].switch.default[0].switch.case=L.node.data.options.reduce(y,{}),V[1].switch.case?.no_match&&(V[1].switch.default[0].switch.default=V[1].switch.case.no_match),D.push(...V);return}case"cond":{let V=Br({__type:L.node.type,node:L.node});V.cond=L.node.data.options.reduce(_.options,[]),V.cond.push(_.fallback(L.node.data.fallback)),D.push(V);return}case"condRequest":{let V=Br({__type:L.node.type,node:L.node}),K=L.node.data.options.reduce(_.options,[]),X=_.fallback(L.node.data.fallback),G={cond:[...K,X]};V[1].switch.case.success=[G],V[1].switch.default=S(L.node.data.error),D.push(...V);return}case"executeSWML":{let V=Br({__type:L.node.type,node:L.node}),K=L.node.data.options.reduce(_.options,[]),X=_.fallback(L.node.data.fallback);V.execute.result=[...K,X],D.push(V);return}case"forwardPhone":case"forwardAddress":case"forwardResource":{let V=Br({__type:L.node.type,node:L.node});if(!Array.isArray(V)){t.warn("Invalid connect node",V);return}L.node.data.options.length&&(V[1].switch.case.connected=L.node.data.options.reduce(w.then,[]),V[1].switch.default[0].switch.case=L.node.data.options.filter(K=>K.result!=="success").reduce(v,{})),D.push(...V);return}case"request":{let V=Br({__type:L.node.type,node:L.node});if(!Array.isArray(V)){t.warn("Invalid request node",V);return}V[1].switch.case.success=L.node.data.options.reduce(w.then,[]),V[1].switch.default=L.node.data.options.reduce(w.else,[]),D.push(...V);return}default:{let V=Br({__type:L.node.type,node:L.node});L.node.type!=="handleCall"&&D.push(V),L.children.forEach(K=>{let X=s.get(K);if(!X)return t.warn("Invalid Child Node",K);let G=f(K);G&&D.push({transfer:K}),R({current:X,sectionName:G?K:T})});break}}},N=s.get(u);N&&R({current:N,sectionName:"main"});let b={};return E.forEach(T=>{let L=a.get(T);L&&(b[T]=L)}),t.debug("sections",JSON.stringify(b)),{sections:b,version:ex}},nx=class _v extends Error{constructor(t,r){super(r),this.code=t,this.message=r,wc(this,"name","AuthError"),Object.setPrototypeOf(this,_v.prototype)}},rx=class wv extends Error{constructor(t,r,s){super(r),this.code=t,this.message=r,this.response=s,wc(this,"name","HttpError"),Object.setPrototypeOf(this,wv.prototype)}},Ep=Ge();async function ox(e,t){let r=await fetch(e,t);if(!r.ok){if(r.status===401)throw new nx(r.status,"Unauthorized");let s;try{s=await r.json()}catch(a){Ep.error(a)}let i=s?.errors?JSON.stringify(s.errors):`Error Code: ${r.status}`;throw new rx(r.status,i,s)}try{r.parsedBody??(r.parsedBody=await r.json())}catch(s){Ep.error(s)}return r}var sx=({timeout:e=3e4,...t},r=ox)=>async(s,i)=>{let a={...i?.body?{"Content-Type":"application/json"}:{},...t.headers,...i?.headers},c=lx({...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(ax({searchParams:i?.searchParams,url:s}),c)).parsedBody}}finally{u&&clearTimeout(u)}},ix=e=>typeof e=="string"?e:JSON.stringify(e),lx=e=>Object.entries(e).reduce((t,[r,s])=>r==="body"?{...t,body:ix(s)}:s!=null?{...t,[r]:s}:t,{}),ax=({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()},Cc=e=>{let t=Ge(),r=sx(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=Oc(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=Oc(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(Gv),edges:s.edges.map(Kv)},relayml:tx({nodes:s.nodes,edges:s.edges})},a=await r(e.updateFlowURL,{body:i,method:"PUT"});return t.info("putFlow",a.body),a.body}}},Ac=[{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=Nc(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:De()}));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:De()});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)}],cx=e=>{let t=Ac.findIndex(r=>r.from===e);return t>=0?Ac.slice(t):Ac},yp=class{constructor({dbRecord:e}){wc(this,"dbRecord"),this.dbRecord=e}get logger(){return Ge()}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=cx(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}},I=Os();const ne=Ki(I),vp=Rs({__proto__:null,default:ne},[I]);var qi={},Ic={exports:{}},Ot={},bc={exports:{}},Lc={};var xp;function ux(){return xp||(xp=1,(function(e){function t(P,U){var $=P.length;P.push(U);e:for(;0<$;){var k=$-1>>>1,j=P[k];if(0<i(j,U))P[k]=U,P[$]=j,$=k;else break e}}function r(P){return P.length===0?null:P[0]}function s(P){if(P.length===0)return null;var U=P[0],$=P.pop();if($!==U){P[0]=$;e:for(var k=0,j=P.length,ee=j>>>1;k<ee;){var oe=2*(k+1)-1,se=P[oe],ue=oe+1,pe=P[ue];if(0>i(se,$))ue<j&&0>i(pe,se)?(P[k]=pe,P[ue]=$,k=ue):(P[k]=se,P[oe]=$,k=oe);else if(ue<j&&0>i(pe,$))P[k]=pe,P[ue]=$,k=ue;else break e}}return U}function i(P,U){var $=P.sortIndex-U.sortIndex;return $!==0?$:P.id-U.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,y=3,v=!1,w=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b(P){for(var U=r(p);U!==null;){if(U.callback===null)s(p);else if(U.startTime<=P)s(p),U.sortIndex=U.expirationTime,t(f,U);else break;U=r(p)}}function T(P){if(_=!1,b(P),!w)if(r(f)!==null)w=!0,H(L);else{var U=r(p);U!==null&&W(T,U.startTime-P)}}function L(P,U){w=!1,_&&(_=!1,R(K),K=-1),v=!0;var $=y;try{for(b(U),E=r(f);E!==null&&(!(E.expirationTime>U)||P&&!te());){var k=E.callback;if(typeof k=="function"){E.callback=null,y=E.priorityLevel;var j=k(E.expirationTime<=U);U=e.unstable_now(),typeof j=="function"?E.callback=j:E===r(f)&&s(f),b(U)}else s(f);E=r(f)}if(E!==null)var ee=!0;else{var oe=r(p);oe!==null&&W(T,oe.startTime-U),ee=!1}return ee}finally{E=null,y=$,v=!1}}var D=!1,V=null,K=-1,X=5,G=-1;function te(){return!(e.unstable_now()-G<X)}function re(){if(V!==null){var P=e.unstable_now();G=P;var U=!0;try{U=V(!0,P)}finally{U?J():(D=!1,V=null)}}else D=!1}var J;if(typeof N=="function")J=function(){N(re)};else if(typeof MessageChannel<"u"){var C=new MessageChannel,z=C.port2;C.port1.onmessage=re,J=function(){z.postMessage(null)}}else J=function(){S(re,0)};function H(P){V=P,D||(D=!0,J())}function W(P,U){K=S(function(){P(e.unstable_now())},U)}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(P){P.callback=null},e.unstable_continueExecution=function(){w||v||(w=!0,H(L))},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_getFirstCallbackNode=function(){return r(f)},e.unstable_next=function(P){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var $=y;y=U;try{return P()}finally{y=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(P,U){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var $=y;y=P;try{return U()}finally{y=$}},e.unstable_scheduleCallback=function(P,U,$){var k=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?k+$:k):$=k,P){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=$+j,P={id:m++,callback:U,priorityLevel:P,startTime:$,expirationTime:j,sortIndex:-1},$>k?(P.sortIndex=$,t(p,P),r(f)===null&&P===r(p)&&(_?(R(K),K=-1):_=!0,W(T,$-k))):(P.sortIndex=j,t(f,P),w||v||(w=!0,H(L))),P},e.unstable_shouldYield=te,e.unstable_wrapCallback=function(P){var U=y;return function(){var $=y;y=U;try{return P.apply(this,arguments)}finally{y=$}}}})(Lc)),Lc}var Sp;function dx(){return Sp||(Sp=1,bc.exports=ux()),bc.exports}var _p;function fx(){if(_p)return Ot;_p=1;var e=Os(),t=dx();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 y(n){return f.call(E,n)?!0:f.call(m,n)?!1:p.test(n)?E[n]=!0:(m[n]=!0,!1)}function v(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 w(n,o,l,d){if(o===null||typeof o>"u"||v(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 _(n,o,l,d,g,x,O){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=x,this.removeEmptyString=O}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){S[n]=new _(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 _(o,1,!1,n[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(n){S[n]=new _(n,2,!1,n.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){S[n]=new _(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 _(n,3,!1,n.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(n){S[n]=new _(n,3,!0,n,null,!1,!1)}),["capture","download"].forEach(function(n){S[n]=new _(n,4,!1,n,null,!1,!1)}),["cols","rows","size","span"].forEach(function(n){S[n]=new _(n,6,!1,n,null,!1,!1)}),["rowSpan","start"].forEach(function(n){S[n]=new _(n,5,!1,n.toLowerCase(),null,!1,!1)});var R=/[\-:]([a-z])/g;function N(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(R,N);S[o]=new _(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(R,N);S[o]=new _(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(R,N);S[o]=new _(o,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(n){S[n]=new _(n,1,!1,n.toLowerCase(),null,!1,!1)}),S.xlinkHref=new _("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(n){S[n]=new _(n,1,!1,n.toLowerCase(),null,!0,!0)});function b(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")&&(w(o,l,g,d)&&(l=null),d||g===null?y(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,L=Symbol.for("react.element"),D=Symbol.for("react.portal"),V=Symbol.for("react.fragment"),K=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),G=Symbol.for("react.provider"),te=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),C=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),P=Symbol.iterator;function U(n){return n===null||typeof n!="object"?null:(n=P&&n[P]||n["@@iterator"],typeof n=="function"?n:null)}var $=Object.assign,k;function j(n){if(k===void 0)try{throw Error()}catch(l){var o=l.stack.trim().match(/\n( *(at )?)/);k=o&&o[1]||""}return`
6
+ `+k+n}var ee=!1;function oe(n,o){if(!n||ee)return"";ee=!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(Z){var d=Z}Reflect.construct(n,[],o)}else{try{o.call()}catch(Z){d=Z}n.call(o.prototype)}else{try{throw Error()}catch(Z){d=Z}n()}}catch(Z){if(Z&&d&&typeof Z.stack=="string"){for(var g=Z.stack.split(`
7
+ `),x=d.stack.split(`
8
+ `),O=g.length-1,F=x.length-1;1<=O&&0<=F&&g[O]!==x[F];)F--;for(;1<=O&&0<=F;O--,F--)if(g[O]!==x[F]){if(O!==1||F!==1)do if(O--,F--,0>F||g[O]!==x[F]){var B=`
9
+ `+g[O].replace(" at new "," at ");return n.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",n.displayName)),B}while(1<=O&&0<=F);break}}}finally{ee=!1,Error.prepareStackTrace=l}return(n=n?n.displayName||n.name:"")?j(n):""}function se(n){switch(n.tag){case 5:return j(n.type);case 16:return j("Lazy");case 13:return j("Suspense");case 19:return j("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 ue(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 V:return"Fragment";case D:return"Portal";case X:return"Profiler";case K:return"StrictMode";case J:return"Suspense";case C:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case te:return(n.displayName||"Context")+".Consumer";case G:return(n._context.displayName||"Context")+".Provider";case re:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return o=n.displayName||null,o!==null?o:ue(n.type)||"Memo";case H:o=n._payload,n=n._init;try{return ue(n(o))}catch{}}return null}function pe(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 ue(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 de(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function he(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function Re(n){var o=he(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,x=l.set;return Object.defineProperty(n,o,{configurable:!0,get:function(){return g.call(this)},set:function(O){d=""+O,x.call(this,O)}}),Object.defineProperty(n,o,{enumerable:l.enumerable}),{getValue:function(){return d},setValue:function(O){d=""+O},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function je(n){n._valueTracker||(n._valueTracker=Re(n))}function ze(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var l=o.getValue(),d="";return n&&(d=he(n)?n.checked?"true":"false":n.value),n=d,n!==l?(o.setValue(n),!0):!1}function lt(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 at(n,o){var l=o.checked;return $({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:l??n._wrapperState.initialChecked})}function qe(n,o){var l=o.defaultValue==null?"":o.defaultValue,d=o.checked!=null?o.checked:o.defaultChecked;l=de(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 $t(n,o){o=o.checked,o!=null&&b(n,"checked",o,!1)}function Me(n,o){$t(n,o);var l=de(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")?ht(n,o.type,l):o.hasOwnProperty("defaultValue")&&ht(n,o.type,de(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(n.defaultChecked=!!o.defaultChecked)}function Se(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 ht(n,o,l){(o!=="number"||lt(n.ownerDocument)!==n)&&(l==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+l&&(n.defaultValue=""+l))}var Ht=Array.isArray;function Jt(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=""+de(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 kn(n,o){if(o.dangerouslySetInnerHTML!=null)throw Error(r(91));return $({},o,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function Jn(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:de(l)}}function Zt(n,o){var l=de(o.value),d=de(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 Mn(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 hn(n,o){return n==null||n==="http://www.w3.org/1999/xhtml"?Mn(o):n==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var mn,er=(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(mn=mn||document.createElement("div"),mn.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=mn.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;o.firstChild;)n.appendChild(o.firstChild)}});function gn(n,o){if(o){var l=n.firstChild;if(l&&l===n.lastChild&&l.nodeType===3){l.nodeValue=o;return}}n.textContent=o}var Je={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},en=["Webkit","ms","Moz","O"];Object.keys(Je).forEach(function(n){en.forEach(function(o){o=o+n.charAt(0).toUpperCase()+n.substring(1),Je[o]=Je[n]})});function Pn(n,o,l){return o==null||typeof o=="boolean"||o===""?"":l||typeof o!="number"||o===0||Je.hasOwnProperty(n)&&Je[n]?(""+o).trim():o+"px"}function Un(n,o){n=n.style;for(var l in o)if(o.hasOwnProperty(l)){var d=l.indexOf("--")===0,g=Pn(l,o[l],d);l==="float"&&(l="cssFloat"),d?n.setProperty(l,g):n[l]=g}}var wr=$({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 Dt(n,o){if(o){if(wr[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 En(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 to=null;function no(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var tr=null,Fn=null,nr=null;function jn(n){if(n=Di(n)){if(typeof tr!="function")throw Error(r(280));var o=n.stateNode;o&&(o=Ma(o),tr(n.stateNode,n.type,o))}}function ta(n){Fn?nr?nr.push(n):nr=[n]:Fn=n}function na(){if(Fn){var n=Fn,o=nr;if(nr=Fn=null,jn(n),o)for(n=0;n<o.length;n++)jn(o[n])}}function ra(n,o){return n(o)}function oa(){}var ui=!1;function sa(n,o,l){if(ui)return n(o,l);ui=!0;try{return ra(n,o,l)}finally{ui=!1,(Fn!==null||nr!==null)&&(oa(),na())}}function ro(n,o){var l=n.stateNode;if(l===null)return null;var d=Ma(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 di=!1;if(u)try{var oo={};Object.defineProperty(oo,"passive",{get:function(){di=!0}}),window.addEventListener("test",oo,oo),window.removeEventListener("test",oo,oo)}catch{di=!1}function wd(n,o,l,d,g,x,O,F,B){var Z=Array.prototype.slice.call(arguments,3);try{o.apply(l,Z)}catch(le){this.onError(le)}}var so=!1,Jo=null,Zo=!1,fi=null,Rd={onError:function(n){so=!0,Jo=n}};function Nd(n,o,l,d,g,x,O,F,B){so=!1,Jo=null,wd.apply(Rd,arguments)}function ia(n,o,l,d,g,x,O,F,B){if(Nd.apply(this,arguments),so){if(so){var Z=Jo;so=!1,Jo=null}else throw Error(r(198));Zo||(Zo=!0,fi=Z)}}function rr(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 la(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 aa(n){if(rr(n)!==n)throw Error(r(188))}function Od(n){var o=n.alternate;if(!o){if(o=rr(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 x=g.alternate;if(x===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===x.child){for(x=g.child;x;){if(x===l)return aa(g),n;if(x===d)return aa(g),o;x=x.sibling}throw Error(r(188))}if(l.return!==d.return)l=g,d=x;else{for(var O=!1,F=g.child;F;){if(F===l){O=!0,l=g,d=x;break}if(F===d){O=!0,d=g,l=x;break}F=F.sibling}if(!O){for(F=x.child;F;){if(F===l){O=!0,l=x,d=g;break}if(F===d){O=!0,d=x,l=g;break}F=F.sibling}if(!O)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 ca(n){return n=Od(n),n!==null?ua(n):null}function ua(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var o=ua(n);if(o!==null)return o;n=n.sibling}return null}var da=t.unstable_scheduleCallback,fa=t.unstable_cancelCallback,pa=t.unstable_shouldYield,Td=t.unstable_requestPaint,Ke=t.unstable_now,Cd=t.unstable_getCurrentPriorityLevel,pi=t.unstable_ImmediatePriority,ha=t.unstable_UserBlockingPriority,es=t.unstable_NormalPriority,ma=t.unstable_LowPriority,ga=t.unstable_IdlePriority,ts=null,tn=null;function hi(n){if(tn&&typeof tn.onCommitFiberRoot=="function")try{tn.onCommitFiberRoot(ts,n,void 0,(n.current.flags&128)===128)}catch{}}var yn=Math.clz32?Math.clz32:ob,nb=Math.log,rb=Math.LN2;function ob(n){return n>>>=0,n===0?32:31-(nb(n)/rb|0)|0}var Ea=64,ya=4194304;function mi(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 va(n,o){var l=n.pendingLanes;if(l===0)return 0;var d=0,g=n.suspendedLanes,x=n.pingedLanes,O=l&268435455;if(O!==0){var F=O&~g;F!==0?d=mi(F):(x&=O,x!==0&&(d=mi(x)))}else O=l&~g,O!==0?d=mi(O):x!==0&&(d=mi(x));if(d===0)return 0;if(o!==0&&o!==d&&(o&g)===0&&(g=d&-d,x=o&-o,g>=x||g===16&&(x&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-yn(o),g=1<<l,d|=n[l],o&=~g;return d}function sb(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 ib(n,o){for(var l=n.suspendedLanes,d=n.pingedLanes,g=n.expirationTimes,x=n.pendingLanes;0<x;){var O=31-yn(x),F=1<<O,B=g[O];B===-1?((F&l)===0||(F&d)!==0)&&(g[O]=sb(F,o)):B<=o&&(n.expiredLanes|=F),x&=~F}}function Ad(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function ZE(){var n=Ea;return Ea<<=1,(Ea&4194240)===0&&(Ea=64),n}function Id(n){for(var o=[],l=0;31>l;l++)o.push(n);return o}function gi(n,o,l){n.pendingLanes|=o,o!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,o=31-yn(o),n[o]=l}function lb(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-yn(l),x=1<<g;o[g]=0,d[g]=-1,n[g]=-1,l&=~x}}function bd(n,o){var l=n.entangledLanes|=o;for(n=n.entanglements;l;){var d=31-yn(l),g=1<<d;g&o|n[d]&o&&(n[d]|=o),l&=~g}}var Pe=0;function ey(n){return n&=-n,1<n?4<n?(n&268435455)!==0?16:536870912:4:1}var ty,Ld,ny,ry,oy,Dd=!1,xa=[],Rr=null,Nr=null,Or=null,Ei=new Map,yi=new Map,Tr=[],ab="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 sy(n,o){switch(n){case"focusin":case"focusout":Rr=null;break;case"dragenter":case"dragleave":Nr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":Ei.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":yi.delete(o.pointerId)}}function vi(n,o,l,d,g,x){return n===null||n.nativeEvent!==x?(n={blockedOn:o,domEventName:l,eventSystemFlags:d,nativeEvent:x,targetContainers:[g]},o!==null&&(o=Di(o),o!==null&&Ld(o)),n):(n.eventSystemFlags|=d,o=n.targetContainers,g!==null&&o.indexOf(g)===-1&&o.push(g),n)}function cb(n,o,l,d,g){switch(o){case"focusin":return Rr=vi(Rr,n,o,l,d,g),!0;case"dragenter":return Nr=vi(Nr,n,o,l,d,g),!0;case"mouseover":return Or=vi(Or,n,o,l,d,g),!0;case"pointerover":var x=g.pointerId;return Ei.set(x,vi(Ei.get(x)||null,n,o,l,d,g)),!0;case"gotpointercapture":return x=g.pointerId,yi.set(x,vi(yi.get(x)||null,n,o,l,d,g)),!0}return!1}function iy(n){var o=io(n.target);if(o!==null){var l=rr(o);if(l!==null){if(o=l.tag,o===13){if(o=la(l),o!==null){n.blockedOn=o,oy(n.priority,function(){ny(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 Sa(n){if(n.blockedOn!==null)return!1;for(var o=n.targetContainers;0<o.length;){var l=Md(n.domEventName,n.eventSystemFlags,o[0],n.nativeEvent);if(l===null){l=n.nativeEvent;var d=new l.constructor(l.type,l);to=d,l.target.dispatchEvent(d),to=null}else return o=Di(l),o!==null&&Ld(o),n.blockedOn=l,!1;o.shift()}return!0}function ly(n,o,l){Sa(n)&&l.delete(o)}function ub(){Dd=!1,Rr!==null&&Sa(Rr)&&(Rr=null),Nr!==null&&Sa(Nr)&&(Nr=null),Or!==null&&Sa(Or)&&(Or=null),Ei.forEach(ly),yi.forEach(ly)}function xi(n,o){n.blockedOn===o&&(n.blockedOn=null,Dd||(Dd=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,ub)))}function Si(n){function o(g){return xi(g,n)}if(0<xa.length){xi(xa[0],n);for(var l=1;l<xa.length;l++){var d=xa[l];d.blockedOn===n&&(d.blockedOn=null)}}for(Rr!==null&&xi(Rr,n),Nr!==null&&xi(Nr,n),Or!==null&&xi(Or,n),Ei.forEach(o),yi.forEach(o),l=0;l<Tr.length;l++)d=Tr[l],d.blockedOn===n&&(d.blockedOn=null);for(;0<Tr.length&&(l=Tr[0],l.blockedOn===null);)iy(l),l.blockedOn===null&&Tr.shift()}var ns=T.ReactCurrentBatchConfig,_a=!0;function db(n,o,l,d){var g=Pe,x=ns.transition;ns.transition=null;try{Pe=1,kd(n,o,l,d)}finally{Pe=g,ns.transition=x}}function fb(n,o,l,d){var g=Pe,x=ns.transition;ns.transition=null;try{Pe=4,kd(n,o,l,d)}finally{Pe=g,ns.transition=x}}function kd(n,o,l,d){if(_a){var g=Md(n,o,l,d);if(g===null)Jd(n,o,d,wa,l),sy(n,d);else if(cb(g,n,o,l,d))d.stopPropagation();else if(sy(n,d),o&4&&-1<ab.indexOf(n)){for(;g!==null;){var x=Di(g);if(x!==null&&ty(x),x=Md(n,o,l,d),x===null&&Jd(n,o,d,wa,l),x===g)break;g=x}g!==null&&d.stopPropagation()}else Jd(n,o,d,null,l)}}var wa=null;function Md(n,o,l,d){if(wa=null,n=no(d),n=io(n),n!==null)if(o=rr(n),o===null)n=null;else if(l=o.tag,l===13){if(n=la(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 wa=n,null}function ay(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(Cd()){case pi:return 1;case ha:return 4;case es:case ma:return 16;case ga:return 536870912;default:return 16}default:return 16}}var Cr=null,Pd=null,Ra=null;function cy(){if(Ra)return Ra;var n,o=Pd,l=o.length,d,g="value"in Cr?Cr.value:Cr.textContent,x=g.length;for(n=0;n<l&&o[n]===g[n];n++);var O=l-n;for(d=1;d<=O&&o[l-d]===g[x-d];d++);return Ra=g.slice(n,1<d?1-d:void 0)}function Na(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 Oa(){return!0}function uy(){return!1}function Bt(n){function o(l,d,g,x,O){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=x,this.target=O,this.currentTarget=null;for(var F in n)n.hasOwnProperty(F)&&(l=n[F],this[F]=l?l(x):x[F]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Oa:uy,this.isPropagationStopped=uy,this}return $(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=Oa)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Oa)},persist:function(){},isPersistent:Oa}),o}var rs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ud=Bt(rs),_i=$({},rs,{view:0,detail:0}),pb=Bt(_i),Fd,jd,wi,Ta=$({},_i,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$d,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!==wi&&(wi&&n.type==="mousemove"?(Fd=n.screenX-wi.screenX,jd=n.screenY-wi.screenY):jd=Fd=0,wi=n),Fd)},movementY:function(n){return"movementY"in n?n.movementY:jd}}),dy=Bt(Ta),hb=$({},Ta,{dataTransfer:0}),mb=Bt(hb),gb=$({},_i,{relatedTarget:0}),Vd=Bt(gb),Eb=$({},rs,{animationName:0,elapsedTime:0,pseudoElement:0}),yb=Bt(Eb),vb=$({},rs,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),xb=Bt(vb),Sb=$({},rs,{data:0}),fy=Bt(Sb),_b={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wb={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"},Rb={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nb(n){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(n):(n=Rb[n])?!!o[n]:!1}function $d(){return Nb}var Ob=$({},_i,{key:function(n){if(n.key){var o=_b[n.key]||n.key;if(o!=="Unidentified")return o}return n.type==="keypress"?(n=Na(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?wb[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$d,charCode:function(n){return n.type==="keypress"?Na(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Na(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Tb=Bt(Ob),Cb=$({},Ta,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),py=Bt(Cb),Ab=$({},_i,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$d}),Ib=Bt(Ab),bb=$({},rs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lb=Bt(bb),Db=$({},Ta,{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}),kb=Bt(Db),Mb=[9,13,27,32],Hd=u&&"CompositionEvent"in window,Ri=null;u&&"documentMode"in document&&(Ri=document.documentMode);var Pb=u&&"TextEvent"in window&&!Ri,hy=u&&(!Hd||Ri&&8<Ri&&11>=Ri),my=" ",gy=!1;function Ey(n,o){switch(n){case"keyup":return Mb.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var os=!1;function Ub(n,o){switch(n){case"compositionend":return yy(o);case"keypress":return o.which!==32?null:(gy=!0,my);case"textInput":return n=o.data,n===my&&gy?null:n;default:return null}}function Fb(n,o){if(os)return n==="compositionend"||!Hd&&Ey(n,o)?(n=cy(),Ra=Pd=Cr=null,os=!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 hy&&o.locale!=="ko"?null:o.data;default:return null}}var jb={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 vy(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o==="input"?!!jb[n.type]:o==="textarea"}function xy(n,o,l,d){ta(d),o=La(o,"onChange"),0<o.length&&(l=new Ud("onChange","change",null,l,d),n.push({event:l,listeners:o}))}var Ni=null,Oi=null;function Vb(n){Fy(n,0)}function Ca(n){var o=cs(n);if(ze(o))return n}function $b(n,o){if(n==="change")return o}var Sy=!1;if(u){var Bd;if(u){var zd="oninput"in document;if(!zd){var _y=document.createElement("div");_y.setAttribute("oninput","return;"),zd=typeof _y.oninput=="function"}Bd=zd}else Bd=!1;Sy=Bd&&(!document.documentMode||9<document.documentMode)}function wy(){Ni&&(Ni.detachEvent("onpropertychange",Ry),Oi=Ni=null)}function Ry(n){if(n.propertyName==="value"&&Ca(Oi)){var o=[];xy(o,Oi,n,no(n)),sa(Vb,o)}}function Hb(n,o,l){n==="focusin"?(wy(),Ni=o,Oi=l,Ni.attachEvent("onpropertychange",Ry)):n==="focusout"&&wy()}function Bb(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Ca(Oi)}function zb(n,o){if(n==="click")return Ca(o)}function Wb(n,o){if(n==="input"||n==="change")return Ca(o)}function Gb(n,o){return n===o&&(n!==0||1/n===1/o)||n!==n&&o!==o}var vn=typeof Object.is=="function"?Object.is:Gb;function Ti(n,o){if(vn(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)||!vn(n[g],o[g]))return!1}return!0}function Ny(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Oy(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 Ty(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?Ty(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function Cy(){for(var n=window,o=lt();o instanceof n.HTMLIFrameElement;){try{var l=typeof o.contentWindow.location.href=="string"}catch{l=!1}if(l)n=o.contentWindow;else break;o=lt(n.document)}return o}function Wd(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 Yb(n){var o=Cy(),l=n.focusedElem,d=n.selectionRange;if(o!==l&&l&&l.ownerDocument&&Ty(l.ownerDocument.documentElement,l)){if(d!==null&&Wd(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,x=Math.min(d.start,g);d=d.end===void 0?x:Math.min(d.end,g),!n.extend&&x>d&&(g=d,d=x,x=g),g=Oy(l,x);var O=Oy(l,d);g&&O&&(n.rangeCount!==1||n.anchorNode!==g.node||n.anchorOffset!==g.offset||n.focusNode!==O.node||n.focusOffset!==O.offset)&&(o=o.createRange(),o.setStart(g.node,g.offset),n.removeAllRanges(),x>d?(n.addRange(o),n.extend(O.node,O.offset)):(o.setEnd(O.node,O.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 Kb=u&&"documentMode"in document&&11>=document.documentMode,ss=null,Gd=null,Ci=null,Yd=!1;function Ay(n,o,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Yd||ss==null||ss!==lt(d)||(d=ss,"selectionStart"in d&&Wd(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}),Ci&&Ti(Ci,d)||(Ci=d,d=La(Gd,"onSelect"),0<d.length&&(o=new Ud("onSelect","select",null,o,l),n.push({event:o,listeners:d}),o.target=ss)))}function Aa(n,o){var l={};return l[n.toLowerCase()]=o.toLowerCase(),l["Webkit"+n]="webkit"+o,l["Moz"+n]="moz"+o,l}var is={animationend:Aa("Animation","AnimationEnd"),animationiteration:Aa("Animation","AnimationIteration"),animationstart:Aa("Animation","AnimationStart"),transitionend:Aa("Transition","TransitionEnd")},Kd={},Iy={};u&&(Iy=document.createElement("div").style,"AnimationEvent"in window||(delete is.animationend.animation,delete is.animationiteration.animation,delete is.animationstart.animation),"TransitionEvent"in window||delete is.transitionend.transition);function Ia(n){if(Kd[n])return Kd[n];if(!is[n])return n;var o=is[n],l;for(l in o)if(o.hasOwnProperty(l)&&l in Iy)return Kd[n]=o[l];return n}var by=Ia("animationend"),Ly=Ia("animationiteration"),Dy=Ia("animationstart"),ky=Ia("transitionend"),My=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 Ar(n,o){My.set(n,o),a(o,[n])}for(var Xd=0;Xd<Py.length;Xd++){var Qd=Py[Xd],Xb=Qd.toLowerCase(),Qb=Qd[0].toUpperCase()+Qd.slice(1);Ar(Xb,"on"+Qb)}Ar(by,"onAnimationEnd"),Ar(Ly,"onAnimationIteration"),Ar(Dy,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(ky,"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 Ai="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(" "),qb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ai));function Uy(n,o,l){var d=n.type||"unknown-event";n.currentTarget=l,ia(d,o,void 0,n),n.currentTarget=null}function Fy(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 x=void 0;if(o)for(var O=d.length-1;0<=O;O--){var F=d[O],B=F.instance,Z=F.currentTarget;if(F=F.listener,B!==x&&g.isPropagationStopped())break e;Uy(g,F,Z),x=B}else for(O=0;O<d.length;O++){if(F=d[O],B=F.instance,Z=F.currentTarget,F=F.listener,B!==x&&g.isPropagationStopped())break e;Uy(g,F,Z),x=B}}}if(Zo)throw n=fi,Zo=!1,fi=null,n}function $e(n,o){var l=o[of];l===void 0&&(l=o[of]=new Set);var d=n+"__bubble";l.has(d)||(jy(o,n,2,!1),l.add(d))}function qd(n,o,l){var d=0;o&&(d|=4),jy(l,n,d,o)}var ba="_reactListening"+Math.random().toString(36).slice(2);function Ii(n){if(!n[ba]){n[ba]=!0,s.forEach(function(l){l!=="selectionchange"&&(qb.has(l)||qd(l,!1,n),qd(l,!0,n))});var o=n.nodeType===9?n:n.ownerDocument;o===null||o[ba]||(o[ba]=!0,qd("selectionchange",!1,o))}}function jy(n,o,l,d){switch(ay(o)){case 1:var g=db;break;case 4:g=fb;break;default:g=kd}l=g.bind(null,o,l,n),g=void 0,!di||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 Jd(n,o,l,d,g){var x=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var O=d.tag;if(O===3||O===4){var F=d.stateNode.containerInfo;if(F===g||F.nodeType===8&&F.parentNode===g)break;if(O===4)for(O=d.return;O!==null;){var B=O.tag;if((B===3||B===4)&&(B=O.stateNode.containerInfo,B===g||B.nodeType===8&&B.parentNode===g))return;O=O.return}for(;F!==null;){if(O=io(F),O===null)return;if(B=O.tag,B===5||B===6){d=x=O;continue e}F=F.parentNode}}d=d.return}sa(function(){var Z=x,le=no(l),ae=[];e:{var ie=My.get(n);if(ie!==void 0){var fe=Ud,ge=n;switch(n){case"keypress":if(Na(l)===0)break e;case"keydown":case"keyup":fe=Tb;break;case"focusin":ge="focus",fe=Vd;break;case"focusout":ge="blur",fe=Vd;break;case"beforeblur":case"afterblur":fe=Vd;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=dy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=mb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=Ib;break;case by:case Ly:case Dy:fe=yb;break;case ky:fe=Lb;break;case"scroll":fe=pb;break;case"wheel":fe=kb;break;case"copy":case"cut":case"paste":fe=xb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=py}var Ee=(o&4)!==0,nt=!Ee&&n==="scroll",Q=Ee?ie!==null?ie+"Capture":null:ie;Ee=[];for(var Y=Z,q;Y!==null;){q=Y;var ce=q.stateNode;if(q.tag===5&&ce!==null&&(q=ce,Q!==null&&(ce=ro(Y,Q),ce!=null&&Ee.push(bi(Y,ce,q)))),nt)break;Y=Y.return}0<Ee.length&&(ie=new fe(ie,ge,null,l,le),ae.push({event:ie,listeners:Ee}))}}if((o&7)===0){e:{if(ie=n==="mouseover"||n==="pointerover",fe=n==="mouseout"||n==="pointerout",ie&&l!==to&&(ge=l.relatedTarget||l.fromElement)&&(io(ge)||ge[or]))break e;if((fe||ie)&&(ie=le.window===le?le:(ie=le.ownerDocument)?ie.defaultView||ie.parentWindow:window,fe?(ge=l.relatedTarget||l.toElement,fe=Z,ge=ge?io(ge):null,ge!==null&&(nt=rr(ge),ge!==nt||ge.tag!==5&&ge.tag!==6)&&(ge=null)):(fe=null,ge=Z),fe!==ge)){if(Ee=dy,ce="onMouseLeave",Q="onMouseEnter",Y="mouse",(n==="pointerout"||n==="pointerover")&&(Ee=py,ce="onPointerLeave",Q="onPointerEnter",Y="pointer"),nt=fe==null?ie:cs(fe),q=ge==null?ie:cs(ge),ie=new Ee(ce,Y+"leave",fe,l,le),ie.target=nt,ie.relatedTarget=q,ce=null,io(le)===Z&&(Ee=new Ee(Q,Y+"enter",ge,l,le),Ee.target=q,Ee.relatedTarget=nt,ce=Ee),nt=ce,fe&&ge)t:{for(Ee=fe,Q=ge,Y=0,q=Ee;q;q=ls(q))Y++;for(q=0,ce=Q;ce;ce=ls(ce))q++;for(;0<Y-q;)Ee=ls(Ee),Y--;for(;0<q-Y;)Q=ls(Q),q--;for(;Y--;){if(Ee===Q||Q!==null&&Ee===Q.alternate)break t;Ee=ls(Ee),Q=ls(Q)}Ee=null}else Ee=null;fe!==null&&Vy(ae,ie,fe,Ee,!1),ge!==null&&nt!==null&&Vy(ae,nt,ge,Ee,!0)}}e:{if(ie=Z?cs(Z):window,fe=ie.nodeName&&ie.nodeName.toLowerCase(),fe==="select"||fe==="input"&&ie.type==="file")var ve=$b;else if(vy(ie))if(Sy)ve=Wb;else{ve=Bb;var _e=Hb}else(fe=ie.nodeName)&&fe.toLowerCase()==="input"&&(ie.type==="checkbox"||ie.type==="radio")&&(ve=zb);if(ve&&(ve=ve(n,Z))){xy(ae,ve,l,le);break e}_e&&_e(n,ie,Z),n==="focusout"&&(_e=ie._wrapperState)&&_e.controlled&&ie.type==="number"&&ht(ie,"number",ie.value)}switch(_e=Z?cs(Z):window,n){case"focusin":(vy(_e)||_e.contentEditable==="true")&&(ss=_e,Gd=Z,Ci=null);break;case"focusout":Ci=Gd=ss=null;break;case"mousedown":Yd=!0;break;case"contextmenu":case"mouseup":case"dragend":Yd=!1,Ay(ae,l,le);break;case"selectionchange":if(Kb)break;case"keydown":case"keyup":Ay(ae,l,le)}var we;if(Hd)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 os?Ey(n,l)&&(Ne="onCompositionEnd"):n==="keydown"&&l.keyCode===229&&(Ne="onCompositionStart");Ne&&(hy&&l.locale!=="ko"&&(os||Ne!=="onCompositionStart"?Ne==="onCompositionEnd"&&os&&(we=cy()):(Cr=le,Pd="value"in Cr?Cr.value:Cr.textContent,os=!0)),_e=La(Z,Ne),0<_e.length&&(Ne=new fy(Ne,n,null,l,le),ae.push({event:Ne,listeners:_e}),we?Ne.data=we:(we=yy(l),we!==null&&(Ne.data=we)))),(we=Pb?Ub(n,l):Fb(n,l))&&(Z=La(Z,"onBeforeInput"),0<Z.length&&(le=new fy("onBeforeInput","beforeinput",null,l,le),ae.push({event:le,listeners:Z}),le.data=we))}Fy(ae,o)})}function bi(n,o,l){return{instance:n,listener:o,currentTarget:l}}function La(n,o){for(var l=o+"Capture",d=[];n!==null;){var g=n,x=g.stateNode;g.tag===5&&x!==null&&(g=x,x=ro(n,l),x!=null&&d.unshift(bi(n,x,g)),x=ro(n,o),x!=null&&d.push(bi(n,x,g))),n=n.return}return d}function ls(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function Vy(n,o,l,d,g){for(var x=o._reactName,O=[];l!==null&&l!==d;){var F=l,B=F.alternate,Z=F.stateNode;if(B!==null&&B===d)break;F.tag===5&&Z!==null&&(F=Z,g?(B=ro(l,x),B!=null&&O.unshift(bi(l,B,F))):g||(B=ro(l,x),B!=null&&O.push(bi(l,B,F)))),l=l.return}O.length!==0&&n.push({event:o,listeners:O})}var Jb=/\r\n?/g,Zb=/\u0000|\uFFFD/g;function $y(n){return(typeof n=="string"?n:""+n).replace(Jb,`
10
+ `).replace(Zb,"")}function Da(n,o,l){if(o=$y(o),$y(n)!==o&&l)throw Error(r(425))}function ka(){}var Zd=null,ef=null;function tf(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 nf=typeof setTimeout=="function"?setTimeout:void 0,eL=typeof clearTimeout=="function"?clearTimeout:void 0,Hy=typeof Promise=="function"?Promise:void 0,tL=typeof queueMicrotask=="function"?queueMicrotask:typeof Hy<"u"?function(n){return Hy.resolve(null).then(n).catch(nL)}:nf;function nL(n){setTimeout(function(){throw n})}function rf(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),Si(o);return}d--}else l!=="$"&&l!=="$?"&&l!=="$!"||d++;l=g}while(l);Si(o)}function Ir(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 By(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 as=Math.random().toString(36).slice(2),Vn="__reactFiber$"+as,Li="__reactProps$"+as,or="__reactContainer$"+as,of="__reactEvents$"+as,rL="__reactListeners$"+as,oL="__reactHandles$"+as;function io(n){var o=n[Vn];if(o)return o;for(var l=n.parentNode;l;){if(o=l[or]||l[Vn]){if(l=o.alternate,o.child!==null||l!==null&&l.child!==null)for(n=By(n);n!==null;){if(l=n[Vn])return l;n=By(n)}return o}n=l,l=n.parentNode}return null}function Di(n){return n=n[Vn]||n[or],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function cs(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(r(33))}function Ma(n){return n[Li]||null}var sf=[],us=-1;function br(n){return{current:n}}function He(n){0>us||(n.current=sf[us],sf[us]=null,us--)}function Ve(n,o){us++,sf[us]=n.current,n.current=o}var Lr={},yt=br(Lr),kt=br(!1),lo=Lr;function ds(n,o){var l=n.type.contextTypes;if(!l)return Lr;var d=n.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===o)return d.__reactInternalMemoizedMaskedChildContext;var g={},x;for(x in l)g[x]=o[x];return d&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=o,n.__reactInternalMemoizedMaskedChildContext=g),g}function Mt(n){return n=n.childContextTypes,n!=null}function Pa(){He(kt),He(yt)}function zy(n,o,l){if(yt.current!==Lr)throw Error(r(168));Ve(yt,o),Ve(kt,l)}function Wy(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,pe(n)||"Unknown",g));return $({},l,d)}function Ua(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Lr,lo=yt.current,Ve(yt,n),Ve(kt,kt.current),!0}function Gy(n,o,l){var d=n.stateNode;if(!d)throw Error(r(169));l?(n=Wy(n,o,lo),d.__reactInternalMemoizedMergedChildContext=n,He(kt),He(yt),Ve(yt,n)):He(kt),Ve(kt,l)}var sr=null,Fa=!1,lf=!1;function Yy(n){sr===null?sr=[n]:sr.push(n)}function sL(n){Fa=!0,Yy(n)}function Dr(){if(!lf&&sr!==null){lf=!0;var n=0,o=Pe;try{var l=sr;for(Pe=1;n<l.length;n++){var d=l[n];do d=d(!0);while(d!==null)}sr=null,Fa=!1}catch(g){throw sr!==null&&(sr=sr.slice(n+1)),da(pi,Dr),g}finally{Pe=o,lf=!1}}return null}var fs=[],ps=0,ja=null,Va=0,nn=[],rn=0,ao=null,ir=1,lr="";function co(n,o){fs[ps++]=Va,fs[ps++]=ja,ja=n,Va=o}function Ky(n,o,l){nn[rn++]=ir,nn[rn++]=lr,nn[rn++]=ao,ao=n;var d=ir;n=lr;var g=32-yn(d)-1;d&=~(1<<g),l+=1;var x=32-yn(o)+g;if(30<x){var O=g-g%5;x=(d&(1<<O)-1).toString(32),d>>=O,g-=O,ir=1<<32-yn(o)+g|l<<g|d,lr=x+n}else ir=1<<x|l<<g|d,lr=n}function af(n){n.return!==null&&(co(n,1),Ky(n,1,0))}function cf(n){for(;n===ja;)ja=fs[--ps],fs[ps]=null,Va=fs[--ps],fs[ps]=null;for(;n===ao;)ao=nn[--rn],nn[rn]=null,lr=nn[--rn],nn[rn]=null,ir=nn[--rn],nn[rn]=null}var zt=null,Wt=null,We=!1,xn=null;function Xy(n,o){var l=an(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 Qy(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=Ir(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=ao!==null?{id:ir,overflow:lr}:null,n.memoizedState={dehydrated:o,treeContext:l,retryLane:1073741824},l=an(18,null,null,0),l.stateNode=o,l.return=n,n.child=l,zt=n,Wt=null,!0):!1;default:return!1}}function uf(n){return(n.mode&1)!==0&&(n.flags&128)===0}function df(n){if(We){var o=Wt;if(o){var l=o;if(!Qy(n,o)){if(uf(n))throw Error(r(418));o=Ir(l.nextSibling);var d=zt;o&&Qy(n,o)?Xy(d,l):(n.flags=n.flags&-4097|2,We=!1,zt=n)}}else{if(uf(n))throw Error(r(418));n.flags=n.flags&-4097|2,We=!1,zt=n}}}function qy(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;zt=n}function $a(n){if(n!==zt)return!1;if(!We)return qy(n),We=!0,!1;var o;if((o=n.tag!==3)&&!(o=n.tag!==5)&&(o=n.type,o=o!=="head"&&o!=="body"&&!tf(n.type,n.memoizedProps)),o&&(o=Wt)){if(uf(n))throw Jy(),Error(r(418));for(;o;)Xy(n,o),o=Ir(o.nextSibling)}if(qy(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=Ir(n.nextSibling);break e}o--}else l!=="$"&&l!=="$!"&&l!=="$?"||o++}n=n.nextSibling}Wt=null}}else Wt=zt?Ir(n.stateNode.nextSibling):null;return!0}function Jy(){for(var n=Wt;n;)n=Ir(n.nextSibling)}function hs(){Wt=zt=null,We=!1}function ff(n){xn===null?xn=[n]:xn.push(n)}var iL=T.ReactCurrentBatchConfig;function ki(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,x=""+n;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===x?o.ref:(o=function(O){var F=g.refs;O===null?delete F[x]:F[x]=O},o._stringRef=x,o)}if(typeof n!="string")throw Error(r(284));if(!l._owner)throw Error(r(290,n))}return n}function Ha(n,o){throw n=Object.prototype.toString.call(o),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":n))}function Zy(n){var o=n._init;return o(n._payload)}function e0(n){function o(Q,Y){if(n){var q=Q.deletions;q===null?(Q.deletions=[Y],Q.flags|=16):q.push(Y)}}function l(Q,Y){if(!n)return null;for(;Y!==null;)o(Q,Y),Y=Y.sibling;return null}function d(Q,Y){for(Q=new Map;Y!==null;)Y.key!==null?Q.set(Y.key,Y):Q.set(Y.index,Y),Y=Y.sibling;return Q}function g(Q,Y){return Q=$r(Q,Y),Q.index=0,Q.sibling=null,Q}function x(Q,Y,q){return Q.index=q,n?(q=Q.alternate,q!==null?(q=q.index,q<Y?(Q.flags|=2,Y):q):(Q.flags|=2,Y)):(Q.flags|=1048576,Y)}function O(Q){return n&&Q.alternate===null&&(Q.flags|=2),Q}function F(Q,Y,q,ce){return Y===null||Y.tag!==6?(Y=rp(q,Q.mode,ce),Y.return=Q,Y):(Y=g(Y,q),Y.return=Q,Y)}function B(Q,Y,q,ce){var ve=q.type;return ve===V?le(Q,Y,q.props.children,ce,q.key):Y!==null&&(Y.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===H&&Zy(ve)===Y.type)?(ce=g(Y,q.props),ce.ref=ki(Q,Y,q),ce.return=Q,ce):(ce=fc(q.type,q.key,q.props,null,Q.mode,ce),ce.ref=ki(Q,Y,q),ce.return=Q,ce)}function Z(Q,Y,q,ce){return Y===null||Y.tag!==4||Y.stateNode.containerInfo!==q.containerInfo||Y.stateNode.implementation!==q.implementation?(Y=op(q,Q.mode,ce),Y.return=Q,Y):(Y=g(Y,q.children||[]),Y.return=Q,Y)}function le(Q,Y,q,ce,ve){return Y===null||Y.tag!==7?(Y=yo(q,Q.mode,ce,ve),Y.return=Q,Y):(Y=g(Y,q),Y.return=Q,Y)}function ae(Q,Y,q){if(typeof Y=="string"&&Y!==""||typeof Y=="number")return Y=rp(""+Y,Q.mode,q),Y.return=Q,Y;if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case L:return q=fc(Y.type,Y.key,Y.props,null,Q.mode,q),q.ref=ki(Q,null,Y),q.return=Q,q;case D:return Y=op(Y,Q.mode,q),Y.return=Q,Y;case H:var ce=Y._init;return ae(Q,ce(Y._payload),q)}if(Ht(Y)||U(Y))return Y=yo(Y,Q.mode,q,null),Y.return=Q,Y;Ha(Q,Y)}return null}function ie(Q,Y,q,ce){var ve=Y!==null?Y.key:null;if(typeof q=="string"&&q!==""||typeof q=="number")return ve!==null?null:F(Q,Y,""+q,ce);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case L:return q.key===ve?B(Q,Y,q,ce):null;case D:return q.key===ve?Z(Q,Y,q,ce):null;case H:return ve=q._init,ie(Q,Y,ve(q._payload),ce)}if(Ht(q)||U(q))return ve!==null?null:le(Q,Y,q,ce,null);Ha(Q,q)}return null}function fe(Q,Y,q,ce,ve){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return Q=Q.get(q)||null,F(Y,Q,""+ce,ve);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case L:return Q=Q.get(ce.key===null?q:ce.key)||null,B(Y,Q,ce,ve);case D:return Q=Q.get(ce.key===null?q:ce.key)||null,Z(Y,Q,ce,ve);case H:var _e=ce._init;return fe(Q,Y,q,_e(ce._payload),ve)}if(Ht(ce)||U(ce))return Q=Q.get(q)||null,le(Y,Q,ce,ve,null);Ha(Y,ce)}return null}function ge(Q,Y,q,ce){for(var ve=null,_e=null,we=Y,Ne=Y=0,dt=null;we!==null&&Ne<q.length;Ne++){we.index>Ne?(dt=we,we=null):dt=we.sibling;var Le=ie(Q,we,q[Ne],ce);if(Le===null){we===null&&(we=dt);break}n&&we&&Le.alternate===null&&o(Q,we),Y=x(Le,Y,Ne),_e===null?ve=Le:_e.sibling=Le,_e=Le,we=dt}if(Ne===q.length)return l(Q,we),We&&co(Q,Ne),ve;if(we===null){for(;Ne<q.length;Ne++)we=ae(Q,q[Ne],ce),we!==null&&(Y=x(we,Y,Ne),_e===null?ve=we:_e.sibling=we,_e=we);return We&&co(Q,Ne),ve}for(we=d(Q,we);Ne<q.length;Ne++)dt=fe(we,Q,Ne,q[Ne],ce),dt!==null&&(n&&dt.alternate!==null&&we.delete(dt.key===null?Ne:dt.key),Y=x(dt,Y,Ne),_e===null?ve=dt:_e.sibling=dt,_e=dt);return n&&we.forEach(function(Hr){return o(Q,Hr)}),We&&co(Q,Ne),ve}function Ee(Q,Y,q,ce){var ve=U(q);if(typeof ve!="function")throw Error(r(150));if(q=ve.call(q),q==null)throw Error(r(151));for(var _e=ve=null,we=Y,Ne=Y=0,dt=null,Le=q.next();we!==null&&!Le.done;Ne++,Le=q.next()){we.index>Ne?(dt=we,we=null):dt=we.sibling;var Hr=ie(Q,we,Le.value,ce);if(Hr===null){we===null&&(we=dt);break}n&&we&&Hr.alternate===null&&o(Q,we),Y=x(Hr,Y,Ne),_e===null?ve=Hr:_e.sibling=Hr,_e=Hr,we=dt}if(Le.done)return l(Q,we),We&&co(Q,Ne),ve;if(we===null){for(;!Le.done;Ne++,Le=q.next())Le=ae(Q,Le.value,ce),Le!==null&&(Y=x(Le,Y,Ne),_e===null?ve=Le:_e.sibling=Le,_e=Le);return We&&co(Q,Ne),ve}for(we=d(Q,we);!Le.done;Ne++,Le=q.next())Le=fe(we,Q,Ne,Le.value,ce),Le!==null&&(n&&Le.alternate!==null&&we.delete(Le.key===null?Ne:Le.key),Y=x(Le,Y,Ne),_e===null?ve=Le:_e.sibling=Le,_e=Le);return n&&we.forEach(function(jL){return o(Q,jL)}),We&&co(Q,Ne),ve}function nt(Q,Y,q,ce){if(typeof q=="object"&&q!==null&&q.type===V&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case L:e:{for(var ve=q.key,_e=Y;_e!==null;){if(_e.key===ve){if(ve=q.type,ve===V){if(_e.tag===7){l(Q,_e.sibling),Y=g(_e,q.props.children),Y.return=Q,Q=Y;break e}}else if(_e.elementType===ve||typeof ve=="object"&&ve!==null&&ve.$$typeof===H&&Zy(ve)===_e.type){l(Q,_e.sibling),Y=g(_e,q.props),Y.ref=ki(Q,_e,q),Y.return=Q,Q=Y;break e}l(Q,_e);break}else o(Q,_e);_e=_e.sibling}q.type===V?(Y=yo(q.props.children,Q.mode,ce,q.key),Y.return=Q,Q=Y):(ce=fc(q.type,q.key,q.props,null,Q.mode,ce),ce.ref=ki(Q,Y,q),ce.return=Q,Q=ce)}return O(Q);case D:e:{for(_e=q.key;Y!==null;){if(Y.key===_e)if(Y.tag===4&&Y.stateNode.containerInfo===q.containerInfo&&Y.stateNode.implementation===q.implementation){l(Q,Y.sibling),Y=g(Y,q.children||[]),Y.return=Q,Q=Y;break e}else{l(Q,Y);break}else o(Q,Y);Y=Y.sibling}Y=op(q,Q.mode,ce),Y.return=Q,Q=Y}return O(Q);case H:return _e=q._init,nt(Q,Y,_e(q._payload),ce)}if(Ht(q))return ge(Q,Y,q,ce);if(U(q))return Ee(Q,Y,q,ce);Ha(Q,q)}return typeof q=="string"&&q!==""||typeof q=="number"?(q=""+q,Y!==null&&Y.tag===6?(l(Q,Y.sibling),Y=g(Y,q),Y.return=Q,Q=Y):(l(Q,Y),Y=rp(q,Q.mode,ce),Y.return=Q,Q=Y),O(Q)):l(Q,Y)}return nt}var ms=e0(!0),t0=e0(!1),Ba=br(null),za=null,gs=null,pf=null;function hf(){pf=gs=za=null}function mf(n){var o=Ba.current;He(Ba),n._currentValue=o}function gf(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 Es(n,o){za=n,pf=gs=null,n=n.dependencies,n!==null&&n.firstContext!==null&&((n.lanes&o)!==0&&(Pt=!0),n.firstContext=null)}function on(n){var o=n._currentValue;if(pf!==n)if(n={context:n,memoizedValue:o,next:null},gs===null){if(za===null)throw Error(r(308));gs=n,za.dependencies={lanes:0,firstContext:n}}else gs=gs.next=n;return o}var uo=null;function Ef(n){uo===null?uo=[n]:uo.push(n)}function n0(n,o,l,d){var g=o.interleaved;return g===null?(l.next=l,Ef(o)):(l.next=g.next,g.next=l),o.interleaved=l,ar(n,d)}function ar(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 kr=!1;function yf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function r0(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 cr(n,o){return{eventTime:n,lane:o,tag:0,payload:null,callback:null,next:null}}function Mr(n,o,l){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(Ie&2)!==0){var g=d.pending;return g===null?o.next=o:(o.next=g.next,g.next=o),d.pending=o,ar(n,l)}return g=d.interleaved,g===null?(o.next=o,Ef(d)):(o.next=g.next,g.next=o),d.interleaved=o,ar(n,l)}function Wa(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,bd(n,l)}}function o0(n,o){var l=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,x=null;if(l=l.firstBaseUpdate,l!==null){do{var O={eventTime:l.eventTime,lane:l.lane,tag:l.tag,payload:l.payload,callback:l.callback,next:null};x===null?g=x=O:x=x.next=O,l=l.next}while(l!==null);x===null?g=x=o:x=x.next=o}else g=x=o;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:x,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 Ga(n,o,l,d){var g=n.updateQueue;kr=!1;var x=g.firstBaseUpdate,O=g.lastBaseUpdate,F=g.shared.pending;if(F!==null){g.shared.pending=null;var B=F,Z=B.next;B.next=null,O===null?x=Z:O.next=Z,O=B;var le=n.alternate;le!==null&&(le=le.updateQueue,F=le.lastBaseUpdate,F!==O&&(F===null?le.firstBaseUpdate=Z:F.next=Z,le.lastBaseUpdate=B))}if(x!==null){var ae=g.baseState;O=0,le=Z=B=null,F=x;do{var ie=F.lane,fe=F.eventTime;if((d&ie)===ie){le!==null&&(le=le.next={eventTime:fe,lane:0,tag:F.tag,payload:F.payload,callback:F.callback,next:null});e:{var ge=n,Ee=F;switch(ie=o,fe=l,Ee.tag){case 1:if(ge=Ee.payload,typeof ge=="function"){ae=ge.call(fe,ae,ie);break e}ae=ge;break e;case 3:ge.flags=ge.flags&-65537|128;case 0:if(ge=Ee.payload,ie=typeof ge=="function"?ge.call(fe,ae,ie):ge,ie==null)break e;ae=$({},ae,ie);break e;case 2:kr=!0}}F.callback!==null&&F.lane!==0&&(n.flags|=64,ie=g.effects,ie===null?g.effects=[F]:ie.push(F))}else fe={eventTime:fe,lane:ie,tag:F.tag,payload:F.payload,callback:F.callback,next:null},le===null?(Z=le=fe,B=ae):le=le.next=fe,O|=ie;if(F=F.next,F===null){if(F=g.shared.pending,F===null)break;ie=F,F=ie.next,ie.next=null,g.lastBaseUpdate=ie,g.shared.pending=null}}while(!0);if(le===null&&(B=ae),g.baseState=B,g.firstBaseUpdate=Z,g.lastBaseUpdate=le,o=g.shared.interleaved,o!==null){g=o;do O|=g.lane,g=g.next;while(g!==o)}else x===null&&(g.shared.lanes=0);ho|=O,n.lanes=O,n.memoizedState=ae}}function s0(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 Mi={},$n=br(Mi),Pi=br(Mi),Ui=br(Mi);function fo(n){if(n===Mi)throw Error(r(174));return n}function vf(n,o){switch(Ve(Ui,o),Ve(Pi,n),Ve($n,Mi),n=o.nodeType,n){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:hn(null,"");break;default:n=n===8?o.parentNode:o,o=n.namespaceURI||null,n=n.tagName,o=hn(o,n)}He($n),Ve($n,o)}function ys(){He($n),He(Pi),He(Ui)}function i0(n){fo(Ui.current);var o=fo($n.current),l=hn(o,n.type);o!==l&&(Ve(Pi,n),Ve($n,l))}function xf(n){Pi.current===n&&(He($n),He(Pi))}var Xe=br(0);function Ya(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 _f(){for(var n=0;n<Sf.length;n++)Sf[n]._workInProgressVersionPrimary=null;Sf.length=0}var Ka=T.ReactCurrentDispatcher,wf=T.ReactCurrentBatchConfig,po=0,Qe=null,st=null,ct=null,Xa=!1,Fi=!1,ji=0,lL=0;function vt(){throw Error(r(321))}function Rf(n,o){if(o===null)return!1;for(var l=0;l<o.length&&l<n.length;l++)if(!vn(n[l],o[l]))return!1;return!0}function Nf(n,o,l,d,g,x){if(po=x,Qe=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,Ka.current=n===null||n.memoizedState===null?dL:fL,n=l(d,g),Fi){x=0;do{if(Fi=!1,ji=0,25<=x)throw Error(r(301));x+=1,ct=st=null,o.updateQueue=null,Ka.current=pL,n=l(d,g)}while(Fi)}if(Ka.current=Ja,o=st!==null&&st.next!==null,po=0,ct=st=Qe=null,Xa=!1,o)throw Error(r(300));return n}function Of(){var n=ji!==0;return ji=0,n}function Hn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ct===null?Qe.memoizedState=ct=n:ct=ct.next=n,ct}function sn(){if(st===null){var n=Qe.alternate;n=n!==null?n.memoizedState:null}else n=st.next;var o=ct===null?Qe.memoizedState:ct.next;if(o!==null)ct=o,st=n;else{if(n===null)throw Error(r(310));st=n,n={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},ct===null?Qe.memoizedState=ct=n:ct=ct.next=n}return ct}function Vi(n,o){return typeof o=="function"?o(n):o}function Tf(n){var o=sn(),l=o.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var d=st,g=d.baseQueue,x=l.pending;if(x!==null){if(g!==null){var O=g.next;g.next=x.next,x.next=O}d.baseQueue=g=x,l.pending=null}if(g!==null){x=g.next,d=d.baseState;var F=O=null,B=null,Z=x;do{var le=Z.lane;if((po&le)===le)B!==null&&(B=B.next={lane:0,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null}),d=Z.hasEagerState?Z.eagerState:n(d,Z.action);else{var ae={lane:le,action:Z.action,hasEagerState:Z.hasEagerState,eagerState:Z.eagerState,next:null};B===null?(F=B=ae,O=d):B=B.next=ae,Qe.lanes|=le,ho|=le}Z=Z.next}while(Z!==null&&Z!==x);B===null?O=d:B.next=F,vn(d,o.memoizedState)||(Pt=!0),o.memoizedState=d,o.baseState=O,o.baseQueue=B,l.lastRenderedState=d}if(n=l.interleaved,n!==null){g=n;do x=g.lane,Qe.lanes|=x,ho|=x,g=g.next;while(g!==n)}else g===null&&(l.lanes=0);return[o.memoizedState,l.dispatch]}function Cf(n){var o=sn(),l=o.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=n;var d=l.dispatch,g=l.pending,x=o.memoizedState;if(g!==null){l.pending=null;var O=g=g.next;do x=n(x,O.action),O=O.next;while(O!==g);vn(x,o.memoizedState)||(Pt=!0),o.memoizedState=x,o.baseQueue===null&&(o.baseState=x),l.lastRenderedState=x}return[x,d]}function l0(){}function a0(n,o){var l=Qe,d=sn(),g=o(),x=!vn(d.memoizedState,g);if(x&&(d.memoizedState=g,Pt=!0),d=d.queue,Af(d0.bind(null,l,d,n),[n]),d.getSnapshot!==o||x||ct!==null&&ct.memoizedState.tag&1){if(l.flags|=2048,$i(9,u0.bind(null,l,d,g,o),void 0,null),ut===null)throw Error(r(349));(po&30)!==0||c0(l,o,g)}return g}function c0(n,o,l){n.flags|=16384,n={getSnapshot:o,value:l},o=Qe.updateQueue,o===null?(o={lastEffect:null,stores:null},Qe.updateQueue=o,o.stores=[n]):(l=o.stores,l===null?o.stores=[n]:l.push(n))}function u0(n,o,l,d){o.value=l,o.getSnapshot=d,f0(o)&&p0(n)}function d0(n,o,l){return l(function(){f0(o)&&p0(n)})}function f0(n){var o=n.getSnapshot;n=n.value;try{var l=o();return!vn(n,l)}catch{return!0}}function p0(n){var o=ar(n,1);o!==null&&Rn(o,n,1,-1)}function h0(n){var o=Hn();return typeof n=="function"&&(n=n()),o.memoizedState=o.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Vi,lastRenderedState:n},o.queue=n,n=n.dispatch=uL.bind(null,Qe,n),[o.memoizedState,n]}function $i(n,o,l,d){return n={tag:n,create:o,destroy:l,deps:d,next:null},o=Qe.updateQueue,o===null?(o={lastEffect:null,stores:null},Qe.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 m0(){return sn().memoizedState}function Qa(n,o,l,d){var g=Hn();Qe.flags|=n,g.memoizedState=$i(1|o,l,void 0,d===void 0?null:d)}function qa(n,o,l,d){var g=sn();d=d===void 0?null:d;var x=void 0;if(st!==null){var O=st.memoizedState;if(x=O.destroy,d!==null&&Rf(d,O.deps)){g.memoizedState=$i(o,l,x,d);return}}Qe.flags|=n,g.memoizedState=$i(1|o,l,x,d)}function g0(n,o){return Qa(8390656,8,n,o)}function Af(n,o){return qa(2048,8,n,o)}function E0(n,o){return qa(4,2,n,o)}function y0(n,o){return qa(4,4,n,o)}function v0(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 x0(n,o,l){return l=l!=null?l.concat([n]):null,qa(4,4,v0.bind(null,o,n),l)}function If(){}function S0(n,o){var l=sn();o=o===void 0?null:o;var d=l.memoizedState;return d!==null&&o!==null&&Rf(o,d[1])?d[0]:(l.memoizedState=[n,o],n)}function _0(n,o){var l=sn();o=o===void 0?null:o;var d=l.memoizedState;return d!==null&&o!==null&&Rf(o,d[1])?d[0]:(n=n(),l.memoizedState=[n,o],n)}function w0(n,o,l){return(po&21)===0?(n.baseState&&(n.baseState=!1,Pt=!0),n.memoizedState=l):(vn(l,o)||(l=ZE(),Qe.lanes|=l,ho|=l,n.baseState=!0),o)}function aL(n,o){var l=Pe;Pe=l!==0&&4>l?l:4,n(!0);var d=wf.transition;wf.transition={};try{n(!1),o()}finally{Pe=l,wf.transition=d}}function R0(){return sn().memoizedState}function cL(n,o,l){var d=jr(n);if(l={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null},N0(n))O0(o,l);else if(l=n0(n,o,l,d),l!==null){var g=Nt();Rn(l,n,d,g),T0(l,o,d)}}function uL(n,o,l){var d=jr(n),g={lane:d,action:l,hasEagerState:!1,eagerState:null,next:null};if(N0(n))O0(o,g);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=o.lastRenderedReducer,x!==null))try{var O=o.lastRenderedState,F=x(O,l);if(g.hasEagerState=!0,g.eagerState=F,vn(F,O)){var B=o.interleaved;B===null?(g.next=g,Ef(o)):(g.next=B.next,B.next=g),o.interleaved=g;return}}catch{}l=n0(n,o,g,d),l!==null&&(g=Nt(),Rn(l,n,d,g),T0(l,o,d))}}function N0(n){var o=n.alternate;return n===Qe||o!==null&&o===Qe}function O0(n,o){Fi=Xa=!0;var l=n.pending;l===null?o.next=o:(o.next=l.next,l.next=o),n.pending=o}function T0(n,o,l){if((l&4194240)!==0){var d=o.lanes;d&=n.pendingLanes,l|=d,o.lanes=l,bd(n,l)}}var Ja={readContext:on,useCallback:vt,useContext:vt,useEffect:vt,useImperativeHandle:vt,useInsertionEffect:vt,useLayoutEffect:vt,useMemo:vt,useReducer:vt,useRef:vt,useState:vt,useDebugValue:vt,useDeferredValue:vt,useTransition:vt,useMutableSource:vt,useSyncExternalStore:vt,useId:vt,unstable_isNewReconciler:!1},dL={readContext:on,useCallback:function(n,o){return Hn().memoizedState=[n,o===void 0?null:o],n},useContext:on,useEffect:g0,useImperativeHandle:function(n,o,l){return l=l!=null?l.concat([n]):null,Qa(4194308,4,v0.bind(null,o,n),l)},useLayoutEffect:function(n,o){return Qa(4194308,4,n,o)},useInsertionEffect:function(n,o){return Qa(4,2,n,o)},useMemo:function(n,o){var l=Hn();return o=o===void 0?null:o,n=n(),l.memoizedState=[n,o],n},useReducer:function(n,o,l){var d=Hn();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=cL.bind(null,Qe,n),[d.memoizedState,n]},useRef:function(n){var o=Hn();return n={current:n},o.memoizedState=n},useState:h0,useDebugValue:If,useDeferredValue:function(n){return Hn().memoizedState=n},useTransition:function(){var n=h0(!1),o=n[0];return n=aL.bind(null,n[1]),Hn().memoizedState=n,[o,n]},useMutableSource:function(){},useSyncExternalStore:function(n,o,l){var d=Qe,g=Hn();if(We){if(l===void 0)throw Error(r(407));l=l()}else{if(l=o(),ut===null)throw Error(r(349));(po&30)!==0||c0(d,o,l)}g.memoizedState=l;var x={value:l,getSnapshot:o};return g.queue=x,g0(d0.bind(null,d,x,n),[n]),d.flags|=2048,$i(9,u0.bind(null,d,x,l,o),void 0,null),l},useId:function(){var n=Hn(),o=ut.identifierPrefix;if(We){var l=lr,d=ir;l=(d&~(1<<32-yn(d)-1)).toString(32)+l,o=":"+o+"R"+l,l=ji++,0<l&&(o+="H"+l.toString(32)),o+=":"}else l=lL++,o=":"+o+"r"+l.toString(32)+":";return n.memoizedState=o},unstable_isNewReconciler:!1},fL={readContext:on,useCallback:S0,useContext:on,useEffect:Af,useImperativeHandle:x0,useInsertionEffect:E0,useLayoutEffect:y0,useMemo:_0,useReducer:Tf,useRef:m0,useState:function(){return Tf(Vi)},useDebugValue:If,useDeferredValue:function(n){var o=sn();return w0(o,st.memoizedState,n)},useTransition:function(){var n=Tf(Vi)[0],o=sn().memoizedState;return[n,o]},useMutableSource:l0,useSyncExternalStore:a0,useId:R0,unstable_isNewReconciler:!1},pL={readContext:on,useCallback:S0,useContext:on,useEffect:Af,useImperativeHandle:x0,useInsertionEffect:E0,useLayoutEffect:y0,useMemo:_0,useReducer:Cf,useRef:m0,useState:function(){return Cf(Vi)},useDebugValue:If,useDeferredValue:function(n){var o=sn();return st===null?o.memoizedState=n:w0(o,st.memoizedState,n)},useTransition:function(){var n=Cf(Vi)[0],o=sn().memoizedState;return[n,o]},useMutableSource:l0,useSyncExternalStore:a0,useId:R0,unstable_isNewReconciler:!1};function Sn(n,o){if(n&&n.defaultProps){o=$({},o),n=n.defaultProps;for(var l in n)o[l]===void 0&&(o[l]=n[l]);return o}return o}function bf(n,o,l,d){o=n.memoizedState,l=l(d,o),l=l==null?o:$({},o,l),n.memoizedState=l,n.lanes===0&&(n.updateQueue.baseState=l)}var Za={isMounted:function(n){return(n=n._reactInternals)?rr(n)===n:!1},enqueueSetState:function(n,o,l){n=n._reactInternals;var d=Nt(),g=jr(n),x=cr(d,g);x.payload=o,l!=null&&(x.callback=l),o=Mr(n,x,g),o!==null&&(Rn(o,n,g,d),Wa(o,n,g))},enqueueReplaceState:function(n,o,l){n=n._reactInternals;var d=Nt(),g=jr(n),x=cr(d,g);x.tag=1,x.payload=o,l!=null&&(x.callback=l),o=Mr(n,x,g),o!==null&&(Rn(o,n,g,d),Wa(o,n,g))},enqueueForceUpdate:function(n,o){n=n._reactInternals;var l=Nt(),d=jr(n),g=cr(l,d);g.tag=2,o!=null&&(g.callback=o),o=Mr(n,g,d),o!==null&&(Rn(o,n,d,l),Wa(o,n,d))}};function C0(n,o,l,d,g,x,O){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,x,O):o.prototype&&o.prototype.isPureReactComponent?!Ti(l,d)||!Ti(g,x):!0}function A0(n,o,l){var d=!1,g=Lr,x=o.contextType;return typeof x=="object"&&x!==null?x=on(x):(g=Mt(o)?lo:yt.current,d=o.contextTypes,x=(d=d!=null)?ds(n,g):Lr),o=new o(l,x),n.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Za,n.stateNode=o,o._reactInternals=n,d&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=g,n.__reactInternalMemoizedMaskedChildContext=x),o}function I0(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&&Za.enqueueReplaceState(o,o.state,null)}function Lf(n,o,l,d){var g=n.stateNode;g.props=l,g.state=n.memoizedState,g.refs={},yf(n);var x=o.contextType;typeof x=="object"&&x!==null?g.context=on(x):(x=Mt(o)?lo:yt.current,g.context=ds(n,x)),g.state=n.memoizedState,x=o.getDerivedStateFromProps,typeof x=="function"&&(bf(n,o,x,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&&Za.enqueueReplaceState(g,g.state,null),Ga(n,l,g,d),g.state=n.memoizedState),typeof g.componentDidMount=="function"&&(n.flags|=4194308)}function vs(n,o){try{var l="",d=o;do l+=se(d),d=d.return;while(d);var g=l}catch(x){g=`
11
+ Error generating stack: `+x.message+`
12
+ `+x.stack}return{value:n,source:o,stack:g,digest:null}}function Df(n,o,l){return{value:n,source:null,stack:l??null,digest:o??null}}function kf(n,o){try{console.error(o.value)}catch(l){setTimeout(function(){throw l})}}var hL=typeof WeakMap=="function"?WeakMap:Map;function b0(n,o,l){l=cr(-1,l),l.tag=3,l.payload={element:null};var d=o.value;return l.callback=function(){ic||(ic=!0,Xf=d),kf(n,o)},l}function L0(n,o,l){l=cr(-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(){kf(n,o)}}var x=n.stateNode;return x!==null&&typeof x.componentDidCatch=="function"&&(l.callback=function(){kf(n,o),typeof d!="function"&&(Ur===null?Ur=new Set([this]):Ur.add(this));var O=o.stack;this.componentDidCatch(o.value,{componentStack:O!==null?O:""})}),l}function D0(n,o,l){var d=n.pingCache;if(d===null){d=n.pingCache=new hL;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=CL.bind(null,n,o,l),o.then(n,n))}function k0(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 M0(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=cr(-1,1),o.tag=2,Mr(l,o,1))),l.lanes|=1),n):(n.flags|=65536,n.lanes=g,n)}var mL=T.ReactCurrentOwner,Pt=!1;function Rt(n,o,l,d){o.child=n===null?t0(o,null,l,d):ms(o,n.child,l,d)}function P0(n,o,l,d,g){l=l.render;var x=o.ref;return Es(o,g),d=Nf(n,o,l,d,x,g),l=Of(),n!==null&&!Pt?(o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~g,ur(n,o,g)):(We&&l&&af(o),o.flags|=1,Rt(n,o,d,g),o.child)}function U0(n,o,l,d,g){if(n===null){var x=l.type;return typeof x=="function"&&!np(x)&&x.defaultProps===void 0&&l.compare===null&&l.defaultProps===void 0?(o.tag=15,o.type=x,F0(n,o,x,d,g)):(n=fc(l.type,null,d,o,o.mode,g),n.ref=o.ref,n.return=o,o.child=n)}if(x=n.child,(n.lanes&g)===0){var O=x.memoizedProps;if(l=l.compare,l=l!==null?l:Ti,l(O,d)&&n.ref===o.ref)return ur(n,o,g)}return o.flags|=1,n=$r(x,d),n.ref=o.ref,n.return=o,o.child=n}function F0(n,o,l,d,g){if(n!==null){var x=n.memoizedProps;if(Ti(x,d)&&n.ref===o.ref)if(Pt=!1,o.pendingProps=d=x,(n.lanes&g)!==0)(n.flags&131072)!==0&&(Pt=!0);else return o.lanes=n.lanes,ur(n,o,g)}return Mf(n,o,l,d,g)}function j0(n,o,l){var d=o.pendingProps,g=d.children,x=n!==null?n.memoizedState:null;if(d.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ve(Ss,Gt),Gt|=l;else{if((l&1073741824)===0)return n=x!==null?x.baseLanes|l:l,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:n,cachePool:null,transitions:null},o.updateQueue=null,Ve(Ss,Gt),Gt|=n,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},d=x!==null?x.baseLanes:l,Ve(Ss,Gt),Gt|=d}else x!==null?(d=x.baseLanes|l,o.memoizedState=null):d=l,Ve(Ss,Gt),Gt|=d;return Rt(n,o,g,l),o.child}function V0(n,o){var l=o.ref;(n===null&&l!==null||n!==null&&n.ref!==l)&&(o.flags|=512,o.flags|=2097152)}function Mf(n,o,l,d,g){var x=Mt(l)?lo:yt.current;return x=ds(o,x),Es(o,g),l=Nf(n,o,l,d,x,g),d=Of(),n!==null&&!Pt?(o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~g,ur(n,o,g)):(We&&d&&af(o),o.flags|=1,Rt(n,o,l,g),o.child)}function $0(n,o,l,d,g){if(Mt(l)){var x=!0;Ua(o)}else x=!1;if(Es(o,g),o.stateNode===null)tc(n,o),A0(o,l,d),Lf(o,l,d,g),d=!0;else if(n===null){var O=o.stateNode,F=o.memoizedProps;O.props=F;var B=O.context,Z=l.contextType;typeof Z=="object"&&Z!==null?Z=on(Z):(Z=Mt(l)?lo:yt.current,Z=ds(o,Z));var le=l.getDerivedStateFromProps,ae=typeof le=="function"||typeof O.getSnapshotBeforeUpdate=="function";ae||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(F!==d||B!==Z)&&I0(o,O,d,Z),kr=!1;var ie=o.memoizedState;O.state=ie,Ga(o,d,O,g),B=o.memoizedState,F!==d||ie!==B||kt.current||kr?(typeof le=="function"&&(bf(o,l,le,d),B=o.memoizedState),(F=kr||C0(o,l,F,d,ie,B,Z))?(ae||typeof O.UNSAFE_componentWillMount!="function"&&typeof O.componentWillMount!="function"||(typeof O.componentWillMount=="function"&&O.componentWillMount(),typeof O.UNSAFE_componentWillMount=="function"&&O.UNSAFE_componentWillMount()),typeof O.componentDidMount=="function"&&(o.flags|=4194308)):(typeof O.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=B),O.props=d,O.state=B,O.context=Z,d=F):(typeof O.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{O=o.stateNode,r0(n,o),F=o.memoizedProps,Z=o.type===o.elementType?F:Sn(o.type,F),O.props=Z,ae=o.pendingProps,ie=O.context,B=l.contextType,typeof B=="object"&&B!==null?B=on(B):(B=Mt(l)?lo:yt.current,B=ds(o,B));var fe=l.getDerivedStateFromProps;(le=typeof fe=="function"||typeof O.getSnapshotBeforeUpdate=="function")||typeof O.UNSAFE_componentWillReceiveProps!="function"&&typeof O.componentWillReceiveProps!="function"||(F!==ae||ie!==B)&&I0(o,O,d,B),kr=!1,ie=o.memoizedState,O.state=ie,Ga(o,d,O,g);var ge=o.memoizedState;F!==ae||ie!==ge||kt.current||kr?(typeof fe=="function"&&(bf(o,l,fe,d),ge=o.memoizedState),(Z=kr||C0(o,l,Z,d,ie,ge,B)||!1)?(le||typeof O.UNSAFE_componentWillUpdate!="function"&&typeof O.componentWillUpdate!="function"||(typeof O.componentWillUpdate=="function"&&O.componentWillUpdate(d,ge,B),typeof O.UNSAFE_componentWillUpdate=="function"&&O.UNSAFE_componentWillUpdate(d,ge,B)),typeof O.componentDidUpdate=="function"&&(o.flags|=4),typeof O.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof O.componentDidUpdate!="function"||F===n.memoizedProps&&ie===n.memoizedState||(o.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||F===n.memoizedProps&&ie===n.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=ge),O.props=d,O.state=ge,O.context=B,d=Z):(typeof O.componentDidUpdate!="function"||F===n.memoizedProps&&ie===n.memoizedState||(o.flags|=4),typeof O.getSnapshotBeforeUpdate!="function"||F===n.memoizedProps&&ie===n.memoizedState||(o.flags|=1024),d=!1)}return Pf(n,o,l,d,x,g)}function Pf(n,o,l,d,g,x){V0(n,o);var O=(o.flags&128)!==0;if(!d&&!O)return g&&Gy(o,l,!1),ur(n,o,x);d=o.stateNode,mL.current=o;var F=O&&typeof l.getDerivedStateFromError!="function"?null:d.render();return o.flags|=1,n!==null&&O?(o.child=ms(o,n.child,null,x),o.child=ms(o,null,F,x)):Rt(n,o,F,x),o.memoizedState=d.state,g&&Gy(o,l,!0),o.child}function H0(n){var o=n.stateNode;o.pendingContext?zy(n,o.pendingContext,o.pendingContext!==o.context):o.context&&zy(n,o.context,!1),vf(n,o.containerInfo)}function B0(n,o,l,d,g){return hs(),ff(g),o.flags|=256,Rt(n,o,l,d),o.child}var Uf={dehydrated:null,treeContext:null,retryLane:0};function Ff(n){return{baseLanes:n,cachePool:null,transitions:null}}function z0(n,o,l){var d=o.pendingProps,g=Xe.current,x=!1,O=(o.flags&128)!==0,F;if((F=O)||(F=n!==null&&n.memoizedState===null?!1:(g&2)!==0),F?(x=!0,o.flags&=-129):(n===null||n.memoizedState!==null)&&(g|=1),Ve(Xe,g&1),n===null)return df(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):(O=d.children,n=d.fallback,x?(d=o.mode,x=o.child,O={mode:"hidden",children:O},(d&1)===0&&x!==null?(x.childLanes=0,x.pendingProps=O):x=pc(O,d,0,null),n=yo(n,d,l,null),x.return=o,n.return=o,x.sibling=n,o.child=x,o.child.memoizedState=Ff(l),o.memoizedState=Uf,n):jf(o,O));if(g=n.memoizedState,g!==null&&(F=g.dehydrated,F!==null))return gL(n,o,O,d,F,g,l);if(x){x=d.fallback,O=o.mode,g=n.child,F=g.sibling;var B={mode:"hidden",children:d.children};return(O&1)===0&&o.child!==g?(d=o.child,d.childLanes=0,d.pendingProps=B,o.deletions=null):(d=$r(g,B),d.subtreeFlags=g.subtreeFlags&14680064),F!==null?x=$r(F,x):(x=yo(x,O,l,null),x.flags|=2),x.return=o,d.return=o,d.sibling=x,o.child=d,d=x,x=o.child,O=n.child.memoizedState,O=O===null?Ff(l):{baseLanes:O.baseLanes|l,cachePool:null,transitions:O.transitions},x.memoizedState=O,x.childLanes=n.childLanes&~l,o.memoizedState=Uf,d}return x=n.child,n=x.sibling,d=$r(x,{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 jf(n,o){return o=pc({mode:"visible",children:o},n.mode,0,null),o.return=n,n.child=o}function ec(n,o,l,d){return d!==null&&ff(d),ms(o,n.child,null,l),n=jf(o,o.pendingProps.children),n.flags|=2,o.memoizedState=null,n}function gL(n,o,l,d,g,x,O){if(l)return o.flags&256?(o.flags&=-257,d=Df(Error(r(422))),ec(n,o,O,d)):o.memoizedState!==null?(o.child=n.child,o.flags|=128,null):(x=d.fallback,g=o.mode,d=pc({mode:"visible",children:d.children},g,0,null),x=yo(x,g,O,null),x.flags|=2,d.return=o,x.return=o,d.sibling=x,o.child=d,(o.mode&1)!==0&&ms(o,n.child,null,O),o.child.memoizedState=Ff(O),o.memoizedState=Uf,x);if((o.mode&1)===0)return ec(n,o,O,null);if(g.data==="$!"){if(d=g.nextSibling&&g.nextSibling.dataset,d)var F=d.dgst;return d=F,x=Error(r(419)),d=Df(x,d,void 0),ec(n,o,O,d)}if(F=(O&n.childLanes)!==0,Pt||F){if(d=ut,d!==null){switch(O&-O){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|O))!==0?0:g,g!==0&&g!==x.retryLane&&(x.retryLane=g,ar(n,g),Rn(d,n,g,-1))}return tp(),d=Df(Error(r(421))),ec(n,o,O,d)}return g.data==="$?"?(o.flags|=128,o.child=n.child,o=AL.bind(null,n),g._reactRetry=o,null):(n=x.treeContext,Wt=Ir(g.nextSibling),zt=o,We=!0,xn=null,n!==null&&(nn[rn++]=ir,nn[rn++]=lr,nn[rn++]=ao,ir=n.id,lr=n.overflow,ao=o),o=jf(o,d.children),o.flags|=4096,o)}function W0(n,o,l){n.lanes|=o;var d=n.alternate;d!==null&&(d.lanes|=o),gf(n.return,o,l)}function Vf(n,o,l,d,g){var x=n.memoizedState;x===null?n.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g}:(x.isBackwards=o,x.rendering=null,x.renderingStartTime=0,x.last=d,x.tail=l,x.tailMode=g)}function G0(n,o,l){var d=o.pendingProps,g=d.revealOrder,x=d.tail;if(Rt(n,o,d.children,l),d=Xe.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(Ve(Xe,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&&Ya(n)===null&&(g=l),l=l.sibling;l=g,l===null?(g=o.child,o.child=null):(g=l.sibling,l.sibling=null),Vf(o,!1,g,l,x);break;case"backwards":for(l=null,g=o.child,o.child=null;g!==null;){if(n=g.alternate,n!==null&&Ya(n)===null){o.child=g;break}n=g.sibling,g.sibling=l,l=g,g=n}Vf(o,!0,l,null,x);break;case"together":Vf(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function tc(n,o){(o.mode&1)===0&&n!==null&&(n.alternate=null,o.alternate=null,o.flags|=2)}function ur(n,o,l){if(n!==null&&(o.dependencies=n.dependencies),ho|=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=$r(n,n.pendingProps),o.child=l,l.return=o;n.sibling!==null;)n=n.sibling,l=l.sibling=$r(n,n.pendingProps),l.return=o;l.sibling=null}return o.child}function EL(n,o,l){switch(o.tag){case 3:H0(o),hs();break;case 5:i0(o);break;case 1:Mt(o.type)&&Ua(o);break;case 4:vf(o,o.stateNode.containerInfo);break;case 10:var d=o.type._context,g=o.memoizedProps.value;Ve(Ba,d._currentValue),d._currentValue=g;break;case 13:if(d=o.memoizedState,d!==null)return d.dehydrated!==null?(Ve(Xe,Xe.current&1),o.flags|=128,null):(l&o.child.childLanes)!==0?z0(n,o,l):(Ve(Xe,Xe.current&1),n=ur(n,o,l),n!==null?n.sibling:null);Ve(Xe,Xe.current&1);break;case 19:if(d=(l&o.childLanes)!==0,(n.flags&128)!==0){if(d)return G0(n,o,l);o.flags|=128}if(g=o.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),Ve(Xe,Xe.current),d)break;return null;case 22:case 23:return o.lanes=0,j0(n,o,l)}return ur(n,o,l)}var Y0,$f,K0,X0;Y0=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}},$f=function(){},K0=function(n,o,l,d){var g=n.memoizedProps;if(g!==d){n=o.stateNode,fo($n.current);var x=null;switch(l){case"input":g=at(n,g),d=at(n,d),x=[];break;case"select":g=$({},g,{value:void 0}),d=$({},d,{value:void 0}),x=[];break;case"textarea":g=kn(n,g),d=kn(n,d),x=[];break;default:typeof g.onClick!="function"&&typeof d.onClick=="function"&&(n.onclick=ka)}Dt(l,d);var O;l=null;for(Z in g)if(!d.hasOwnProperty(Z)&&g.hasOwnProperty(Z)&&g[Z]!=null)if(Z==="style"){var F=g[Z];for(O in F)F.hasOwnProperty(O)&&(l||(l={}),l[O]="")}else Z!=="dangerouslySetInnerHTML"&&Z!=="children"&&Z!=="suppressContentEditableWarning"&&Z!=="suppressHydrationWarning"&&Z!=="autoFocus"&&(i.hasOwnProperty(Z)?x||(x=[]):(x=x||[]).push(Z,null));for(Z in d){var B=d[Z];if(F=g?.[Z],d.hasOwnProperty(Z)&&B!==F&&(B!=null||F!=null))if(Z==="style")if(F){for(O in F)!F.hasOwnProperty(O)||B&&B.hasOwnProperty(O)||(l||(l={}),l[O]="");for(O in B)B.hasOwnProperty(O)&&F[O]!==B[O]&&(l||(l={}),l[O]=B[O])}else l||(x||(x=[]),x.push(Z,l)),l=B;else Z==="dangerouslySetInnerHTML"?(B=B?B.__html:void 0,F=F?F.__html:void 0,B!=null&&F!==B&&(x=x||[]).push(Z,B)):Z==="children"?typeof B!="string"&&typeof B!="number"||(x=x||[]).push(Z,""+B):Z!=="suppressContentEditableWarning"&&Z!=="suppressHydrationWarning"&&(i.hasOwnProperty(Z)?(B!=null&&Z==="onScroll"&&$e("scroll",n),x||F===B||(x=[])):(x=x||[]).push(Z,B))}l&&(x=x||[]).push("style",l);var Z=x;(o.updateQueue=Z)&&(o.flags|=4)}},X0=function(n,o,l,d){l!==d&&(o.flags|=4)};function Hi(n,o){if(!We)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 xt(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 yL(n,o,l){var d=o.pendingProps;switch(cf(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xt(o),null;case 1:return Mt(o.type)&&Pa(),xt(o),null;case 3:return d=o.stateNode,ys(),He(kt),He(yt),_f(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(n===null||n.child===null)&&($a(o)?o.flags|=4:n===null||n.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,xn!==null&&(Jf(xn),xn=null))),$f(n,o),xt(o),null;case 5:xf(o);var g=fo(Ui.current);if(l=o.type,n!==null&&o.stateNode!=null)K0(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 xt(o),null}if(n=fo($n.current),$a(o)){d=o.stateNode,l=o.type;var x=o.memoizedProps;switch(d[Vn]=o,d[Li]=x,n=(o.mode&1)!==0,l){case"dialog":$e("cancel",d),$e("close",d);break;case"iframe":case"object":case"embed":$e("load",d);break;case"video":case"audio":for(g=0;g<Ai.length;g++)$e(Ai[g],d);break;case"source":$e("error",d);break;case"img":case"image":case"link":$e("error",d),$e("load",d);break;case"details":$e("toggle",d);break;case"input":qe(d,x),$e("invalid",d);break;case"select":d._wrapperState={wasMultiple:!!x.multiple},$e("invalid",d);break;case"textarea":Jn(d,x),$e("invalid",d)}Dt(l,x),g=null;for(var O in x)if(x.hasOwnProperty(O)){var F=x[O];O==="children"?typeof F=="string"?d.textContent!==F&&(x.suppressHydrationWarning!==!0&&Da(d.textContent,F,n),g=["children",F]):typeof F=="number"&&d.textContent!==""+F&&(x.suppressHydrationWarning!==!0&&Da(d.textContent,F,n),g=["children",""+F]):i.hasOwnProperty(O)&&F!=null&&O==="onScroll"&&$e("scroll",d)}switch(l){case"input":je(d),Se(d,x,!0);break;case"textarea":je(d),Zn(d);break;case"select":case"option":break;default:typeof x.onClick=="function"&&(d.onclick=ka)}d=g,o.updateQueue=d,d!==null&&(o.flags|=4)}else{O=g.nodeType===9?g:g.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=Mn(l)),n==="http://www.w3.org/1999/xhtml"?l==="script"?(n=O.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof d.is=="string"?n=O.createElement(l,{is:d.is}):(n=O.createElement(l),l==="select"&&(O=n,d.multiple?O.multiple=!0:d.size&&(O.size=d.size))):n=O.createElementNS(n,l),n[Vn]=o,n[Li]=d,Y0(n,o,!1,!1),o.stateNode=n;e:{switch(O=En(l,d),l){case"dialog":$e("cancel",n),$e("close",n),g=d;break;case"iframe":case"object":case"embed":$e("load",n),g=d;break;case"video":case"audio":for(g=0;g<Ai.length;g++)$e(Ai[g],n);g=d;break;case"source":$e("error",n),g=d;break;case"img":case"image":case"link":$e("error",n),$e("load",n),g=d;break;case"details":$e("toggle",n),g=d;break;case"input":qe(n,d),g=at(n,d),$e("invalid",n);break;case"option":g=d;break;case"select":n._wrapperState={wasMultiple:!!d.multiple},g=$({},d,{value:void 0}),$e("invalid",n);break;case"textarea":Jn(n,d),g=kn(n,d),$e("invalid",n);break;default:g=d}Dt(l,g),F=g;for(x in F)if(F.hasOwnProperty(x)){var B=F[x];x==="style"?Un(n,B):x==="dangerouslySetInnerHTML"?(B=B?B.__html:void 0,B!=null&&er(n,B)):x==="children"?typeof B=="string"?(l!=="textarea"||B!=="")&&gn(n,B):typeof B=="number"&&gn(n,""+B):x!=="suppressContentEditableWarning"&&x!=="suppressHydrationWarning"&&x!=="autoFocus"&&(i.hasOwnProperty(x)?B!=null&&x==="onScroll"&&$e("scroll",n):B!=null&&b(n,x,B,O))}switch(l){case"input":je(n),Se(n,d,!1);break;case"textarea":je(n),Zn(n);break;case"option":d.value!=null&&n.setAttribute("value",""+de(d.value));break;case"select":n.multiple=!!d.multiple,x=d.value,x!=null?Jt(n,!!d.multiple,x,!1):d.defaultValue!=null&&Jt(n,!!d.multiple,d.defaultValue,!0);break;default:typeof g.onClick=="function"&&(n.onclick=ka)}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 xt(o),null;case 6:if(n&&o.stateNode!=null)X0(n,o,n.memoizedProps,d);else{if(typeof d!="string"&&o.stateNode===null)throw Error(r(166));if(l=fo(Ui.current),fo($n.current),$a(o)){if(d=o.stateNode,l=o.memoizedProps,d[Vn]=o,(x=d.nodeValue!==l)&&(n=zt,n!==null))switch(n.tag){case 3:Da(d.nodeValue,l,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Da(d.nodeValue,l,(n.mode&1)!==0)}x&&(o.flags|=4)}else d=(l.nodeType===9?l:l.ownerDocument).createTextNode(d),d[Vn]=o,o.stateNode=d}return xt(o),null;case 13:if(He(Xe),d=o.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(We&&Wt!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Jy(),hs(),o.flags|=98560,x=!1;else if(x=$a(o),d!==null&&d.dehydrated!==null){if(n===null){if(!x)throw Error(r(318));if(x=o.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Vn]=o}else hs(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;xt(o),x=!1}else xn!==null&&(Jf(xn),xn=null),x=!0;if(!x)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||(Xe.current&1)!==0?it===0&&(it=3):tp())),o.updateQueue!==null&&(o.flags|=4),xt(o),null);case 4:return ys(),$f(n,o),n===null&&Ii(o.stateNode.containerInfo),xt(o),null;case 10:return mf(o.type._context),xt(o),null;case 17:return Mt(o.type)&&Pa(),xt(o),null;case 19:if(He(Xe),x=o.memoizedState,x===null)return xt(o),null;if(d=(o.flags&128)!==0,O=x.rendering,O===null)if(d)Hi(x,!1);else{if(it!==0||n!==null&&(n.flags&128)!==0)for(n=o.child;n!==null;){if(O=Ya(n),O!==null){for(o.flags|=128,Hi(x,!1),d=O.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),o.subtreeFlags=0,d=l,l=o.child;l!==null;)x=l,n=d,x.flags&=14680066,O=x.alternate,O===null?(x.childLanes=0,x.lanes=n,x.child=null,x.subtreeFlags=0,x.memoizedProps=null,x.memoizedState=null,x.updateQueue=null,x.dependencies=null,x.stateNode=null):(x.childLanes=O.childLanes,x.lanes=O.lanes,x.child=O.child,x.subtreeFlags=0,x.deletions=null,x.memoizedProps=O.memoizedProps,x.memoizedState=O.memoizedState,x.updateQueue=O.updateQueue,x.type=O.type,n=O.dependencies,x.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),l=l.sibling;return Ve(Xe,Xe.current&1|2),o.child}n=n.sibling}x.tail!==null&&Ke()>_s&&(o.flags|=128,d=!0,Hi(x,!1),o.lanes=4194304)}else{if(!d)if(n=Ya(O),n!==null){if(o.flags|=128,d=!0,l=n.updateQueue,l!==null&&(o.updateQueue=l,o.flags|=4),Hi(x,!0),x.tail===null&&x.tailMode==="hidden"&&!O.alternate&&!We)return xt(o),null}else 2*Ke()-x.renderingStartTime>_s&&l!==1073741824&&(o.flags|=128,d=!0,Hi(x,!1),o.lanes=4194304);x.isBackwards?(O.sibling=o.child,o.child=O):(l=x.last,l!==null?l.sibling=O:o.child=O,x.last=O)}return x.tail!==null?(o=x.tail,x.rendering=o,x.tail=o.sibling,x.renderingStartTime=Ke(),o.sibling=null,l=Xe.current,Ve(Xe,d?l&1|2:l&1),o):(xt(o),null);case 22:case 23:return ep(),d=o.memoizedState!==null,n!==null&&n.memoizedState!==null!==d&&(o.flags|=8192),d&&(o.mode&1)!==0?(Gt&1073741824)!==0&&(xt(o),o.subtreeFlags&6&&(o.flags|=8192)):xt(o),null;case 24:return null;case 25:return null}throw Error(r(156,o.tag))}function vL(n,o){switch(cf(o),o.tag){case 1:return Mt(o.type)&&Pa(),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return ys(),He(kt),He(yt),_f(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 5:return xf(o),null;case 13:if(He(Xe),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(r(340));hs()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return He(Xe),null;case 4:return ys(),null;case 10:return mf(o.type._context),null;case 22:case 23:return ep(),null;case 24:return null;default:return null}}var nc=!1,St=!1,xL=typeof WeakSet=="function"?WeakSet:Set,me=null;function xs(n,o){var l=n.ref;if(l!==null)if(typeof l=="function")try{l(null)}catch(d){Ze(n,o,d)}else l.current=null}function Hf(n,o,l){try{l()}catch(d){Ze(n,o,d)}}var Q0=!1;function SL(n,o){if(Zd=_a,n=Cy(),Wd(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,x=d.focusNode;d=d.focusOffset;try{l.nodeType,x.nodeType}catch{l=null;break e}var O=0,F=-1,B=-1,Z=0,le=0,ae=n,ie=null;t:for(;;){for(var fe;ae!==l||g!==0&&ae.nodeType!==3||(F=O+g),ae!==x||d!==0&&ae.nodeType!==3||(B=O+d),ae.nodeType===3&&(O+=ae.nodeValue.length),(fe=ae.firstChild)!==null;)ie=ae,ae=fe;for(;;){if(ae===n)break t;if(ie===l&&++Z===g&&(F=O),ie===x&&++le===d&&(B=O),(fe=ae.nextSibling)!==null)break;ae=ie,ie=ae.parentNode}ae=fe}l=F===-1||B===-1?null:{start:F,end:B}}else l=null}l=l||{start:0,end:0}}else l=null;for(ef={focusedElem:n,selectionRange:l},_a=!1,me=o;me!==null;)if(o=me,n=o.child,(o.subtreeFlags&1028)!==0&&n!==null)n.return=o,me=n;else for(;me!==null;){o=me;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,nt=ge.memoizedState,Q=o.stateNode,Y=Q.getSnapshotBeforeUpdate(o.elementType===o.type?Ee:Sn(o.type,Ee),nt);Q.__reactInternalSnapshotBeforeUpdate=Y}break;case 3:var q=o.stateNode.containerInfo;q.nodeType===1?q.textContent="":q.nodeType===9&&q.documentElement&&q.removeChild(q.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ce){Ze(o,o.return,ce)}if(n=o.sibling,n!==null){n.return=o.return,me=n;break}me=o.return}return ge=Q0,Q0=!1,ge}function Bi(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 x=g.destroy;g.destroy=void 0,x!==void 0&&Hf(o,l,x)}g=g.next}while(g!==d)}}function rc(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 Bf(n){var o=n.ref;if(o!==null){var l=n.stateNode;n.tag,n=l,typeof o=="function"?o(n):o.current=n}}function q0(n){var o=n.alternate;o!==null&&(n.alternate=null,q0(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&(delete o[Vn],delete o[Li],delete o[of],delete o[rL],delete o[oL])),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 J0(n){return n.tag===5||n.tag===3||n.tag===4}function Z0(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||J0(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 zf(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=ka));else if(d!==4&&(n=n.child,n!==null))for(zf(n,o,l),n=n.sibling;n!==null;)zf(n,o,l),n=n.sibling}function Wf(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(Wf(n,o,l),n=n.sibling;n!==null;)Wf(n,o,l),n=n.sibling}var mt=null,_n=!1;function Pr(n,o,l){for(l=l.child;l!==null;)ev(n,o,l),l=l.sibling}function ev(n,o,l){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(ts,l)}catch{}switch(l.tag){case 5:St||xs(l,o);case 6:var d=mt,g=_n;mt=null,Pr(n,o,l),mt=d,_n=g,mt!==null&&(_n?(n=mt,l=l.stateNode,n.nodeType===8?n.parentNode.removeChild(l):n.removeChild(l)):mt.removeChild(l.stateNode));break;case 18:mt!==null&&(_n?(n=mt,l=l.stateNode,n.nodeType===8?rf(n.parentNode,l):n.nodeType===1&&rf(n,l),Si(n)):rf(mt,l.stateNode));break;case 4:d=mt,g=_n,mt=l.stateNode.containerInfo,_n=!0,Pr(n,o,l),mt=d,_n=g;break;case 0:case 11:case 14:case 15:if(!St&&(d=l.updateQueue,d!==null&&(d=d.lastEffect,d!==null))){g=d=d.next;do{var x=g,O=x.destroy;x=x.tag,O!==void 0&&((x&2)!==0||(x&4)!==0)&&Hf(l,o,O),g=g.next}while(g!==d)}Pr(n,o,l);break;case 1:if(!St&&(xs(l,o),d=l.stateNode,typeof d.componentWillUnmount=="function"))try{d.props=l.memoizedProps,d.state=l.memoizedState,d.componentWillUnmount()}catch(F){Ze(l,o,F)}Pr(n,o,l);break;case 21:Pr(n,o,l);break;case 22:l.mode&1?(St=(d=St)||l.memoizedState!==null,Pr(n,o,l),St=d):Pr(n,o,l);break;default:Pr(n,o,l)}}function tv(n){var o=n.updateQueue;if(o!==null){n.updateQueue=null;var l=n.stateNode;l===null&&(l=n.stateNode=new xL),o.forEach(function(d){var g=IL.bind(null,n,d);l.has(d)||(l.add(d),d.then(g,g))})}}function wn(n,o){var l=o.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d];try{var x=n,O=o,F=O;e:for(;F!==null;){switch(F.tag){case 5:mt=F.stateNode,_n=!1;break e;case 3:mt=F.stateNode.containerInfo,_n=!0;break e;case 4:mt=F.stateNode.containerInfo,_n=!0;break e}F=F.return}if(mt===null)throw Error(r(160));ev(x,O,g),mt=null,_n=!1;var B=g.alternate;B!==null&&(B.return=null),g.return=null}catch(Z){Ze(g,o,Z)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)nv(o,n),o=o.sibling}function nv(n,o){var l=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(wn(o,n),Bn(n),d&4){try{Bi(3,n,n.return),rc(3,n)}catch(Ee){Ze(n,n.return,Ee)}try{Bi(5,n,n.return)}catch(Ee){Ze(n,n.return,Ee)}}break;case 1:wn(o,n),Bn(n),d&512&&l!==null&&xs(l,l.return);break;case 5:if(wn(o,n),Bn(n),d&512&&l!==null&&xs(l,l.return),n.flags&32){var g=n.stateNode;try{gn(g,"")}catch(Ee){Ze(n,n.return,Ee)}}if(d&4&&(g=n.stateNode,g!=null)){var x=n.memoizedProps,O=l!==null?l.memoizedProps:x,F=n.type,B=n.updateQueue;if(n.updateQueue=null,B!==null)try{F==="input"&&x.type==="radio"&&x.name!=null&&$t(g,x),En(F,O);var Z=En(F,x);for(O=0;O<B.length;O+=2){var le=B[O],ae=B[O+1];le==="style"?Un(g,ae):le==="dangerouslySetInnerHTML"?er(g,ae):le==="children"?gn(g,ae):b(g,le,ae,Z)}switch(F){case"input":Me(g,x);break;case"textarea":Zt(g,x);break;case"select":var ie=g._wrapperState.wasMultiple;g._wrapperState.wasMultiple=!!x.multiple;var fe=x.value;fe!=null?Jt(g,!!x.multiple,fe,!1):ie!==!!x.multiple&&(x.defaultValue!=null?Jt(g,!!x.multiple,x.defaultValue,!0):Jt(g,!!x.multiple,x.multiple?[]:"",!1))}g[Li]=x}catch(Ee){Ze(n,n.return,Ee)}}break;case 6:if(wn(o,n),Bn(n),d&4){if(n.stateNode===null)throw Error(r(162));g=n.stateNode,x=n.memoizedProps;try{g.nodeValue=x}catch(Ee){Ze(n,n.return,Ee)}}break;case 3:if(wn(o,n),Bn(n),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Si(o.containerInfo)}catch(Ee){Ze(n,n.return,Ee)}break;case 4:wn(o,n),Bn(n);break;case 13:wn(o,n),Bn(n),g=n.child,g.flags&8192&&(x=g.memoizedState!==null,g.stateNode.isHidden=x,!x||g.alternate!==null&&g.alternate.memoizedState!==null||(Kf=Ke())),d&4&&tv(n);break;case 22:if(le=l!==null&&l.memoizedState!==null,n.mode&1?(St=(Z=St)||le,wn(o,n),St=Z):wn(o,n),Bn(n),d&8192){if(Z=n.memoizedState!==null,(n.stateNode.isHidden=Z)&&!le&&(n.mode&1)!==0)for(me=n,le=n.child;le!==null;){for(ae=me=le;me!==null;){switch(ie=me,fe=ie.child,ie.tag){case 0:case 11:case 14:case 15:Bi(4,ie,ie.return);break;case 1:xs(ie,ie.return);var ge=ie.stateNode;if(typeof ge.componentWillUnmount=="function"){d=ie,l=ie.return;try{o=d,ge.props=o.memoizedProps,ge.state=o.memoizedState,ge.componentWillUnmount()}catch(Ee){Ze(d,l,Ee)}}break;case 5:xs(ie,ie.return);break;case 22:if(ie.memoizedState!==null){sv(ae);continue}}fe!==null?(fe.return=ie,me=fe):sv(ae)}le=le.sibling}e:for(le=null,ae=n;;){if(ae.tag===5){if(le===null){le=ae;try{g=ae.stateNode,Z?(x=g.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none"):(F=ae.stateNode,B=ae.memoizedProps.style,O=B!=null&&B.hasOwnProperty("display")?B.display:null,F.style.display=Pn("display",O))}catch(Ee){Ze(n,n.return,Ee)}}}else if(ae.tag===6){if(le===null)try{ae.stateNode.nodeValue=Z?"":ae.memoizedProps}catch(Ee){Ze(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;le===ae&&(le=null),ae=ae.return}le===ae&&(le=null),ae.sibling.return=ae.return,ae=ae.sibling}}break;case 19:wn(o,n),Bn(n),d&4&&tv(n);break;case 21:break;default:wn(o,n),Bn(n)}}function Bn(n){var o=n.flags;if(o&2){try{e:{for(var l=n.return;l!==null;){if(J0(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&&(gn(g,""),d.flags&=-33);var x=Z0(n);Wf(n,x,g);break;case 3:case 4:var O=d.stateNode.containerInfo,F=Z0(n);zf(n,F,O);break;default:throw Error(r(161))}}catch(B){Ze(n,n.return,B)}n.flags&=-3}o&4096&&(n.flags&=-4097)}function _L(n,o,l){me=n,rv(n)}function rv(n,o,l){for(var d=(n.mode&1)!==0;me!==null;){var g=me,x=g.child;if(g.tag===22&&d){var O=g.memoizedState!==null||nc;if(!O){var F=g.alternate,B=F!==null&&F.memoizedState!==null||St;F=nc;var Z=St;if(nc=O,(St=B)&&!Z)for(me=g;me!==null;)O=me,B=O.child,O.tag===22&&O.memoizedState!==null?iv(g):B!==null?(B.return=O,me=B):iv(g);for(;x!==null;)me=x,rv(x),x=x.sibling;me=g,nc=F,St=Z}ov(n)}else(g.subtreeFlags&8772)!==0&&x!==null?(x.return=g,me=x):ov(n)}}function ov(n){for(;me!==null;){var o=me;if((o.flags&8772)!==0){var l=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:St||rc(5,o);break;case 1:var d=o.stateNode;if(o.flags&4&&!St)if(l===null)d.componentDidMount();else{var g=o.elementType===o.type?l.memoizedProps:Sn(o.type,l.memoizedProps);d.componentDidUpdate(g,l.memoizedState,d.__reactInternalSnapshotBeforeUpdate)}var x=o.updateQueue;x!==null&&s0(o,x,d);break;case 3:var O=o.updateQueue;if(O!==null){if(l=null,o.child!==null)switch(o.child.tag){case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}s0(o,O,l)}break;case 5:var F=o.stateNode;if(l===null&&o.flags&4){l=F;var B=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":B.autoFocus&&l.focus();break;case"img":B.src&&(l.src=B.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var Z=o.alternate;if(Z!==null){var le=Z.memoizedState;if(le!==null){var ae=le.dehydrated;ae!==null&&Si(ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}St||o.flags&512&&Bf(o)}catch(ie){Ze(o,o.return,ie)}}if(o===n){me=null;break}if(l=o.sibling,l!==null){l.return=o.return,me=l;break}me=o.return}}function sv(n){for(;me!==null;){var o=me;if(o===n){me=null;break}var l=o.sibling;if(l!==null){l.return=o.return,me=l;break}me=o.return}}function iv(n){for(;me!==null;){var o=me;try{switch(o.tag){case 0:case 11:case 15:var l=o.return;try{rc(4,o)}catch(B){Ze(o,l,B)}break;case 1:var d=o.stateNode;if(typeof d.componentDidMount=="function"){var g=o.return;try{d.componentDidMount()}catch(B){Ze(o,g,B)}}var x=o.return;try{Bf(o)}catch(B){Ze(o,x,B)}break;case 5:var O=o.return;try{Bf(o)}catch(B){Ze(o,O,B)}}}catch(B){Ze(o,o.return,B)}if(o===n){me=null;break}var F=o.sibling;if(F!==null){F.return=o.return,me=F;break}me=o.return}}var wL=Math.ceil,oc=T.ReactCurrentDispatcher,Gf=T.ReactCurrentOwner,ln=T.ReactCurrentBatchConfig,Ie=0,ut=null,ot=null,gt=0,Gt=0,Ss=br(0),it=0,zi=null,ho=0,sc=0,Yf=0,Wi=null,Ut=null,Kf=0,_s=1/0,dr=null,ic=!1,Xf=null,Ur=null,lc=!1,Fr=null,ac=0,Gi=0,Qf=null,cc=-1,uc=0;function Nt(){return(Ie&6)!==0?Ke():cc!==-1?cc:cc=Ke()}function jr(n){return(n.mode&1)===0?1:(Ie&2)!==0&&gt!==0?gt&-gt:iL.transition!==null?(uc===0&&(uc=ZE()),uc):(n=Pe,n!==0||(n=window.event,n=n===void 0?16:ay(n.type)),n)}function Rn(n,o,l,d){if(50<Gi)throw Gi=0,Qf=null,Error(r(185));gi(n,l,d),((Ie&2)===0||n!==ut)&&(n===ut&&((Ie&2)===0&&(sc|=l),it===4&&Vr(n,gt)),Ft(n,d),l===1&&Ie===0&&(o.mode&1)===0&&(_s=Ke()+500,Fa&&Dr()))}function Ft(n,o){var l=n.callbackNode;ib(n,o);var d=va(n,n===ut?gt:0);if(d===0)l!==null&&fa(l),n.callbackNode=null,n.callbackPriority=0;else if(o=d&-d,n.callbackPriority!==o){if(l!=null&&fa(l),o===1)n.tag===0?sL(av.bind(null,n)):Yy(av.bind(null,n)),tL(function(){(Ie&6)===0&&Dr()}),l=null;else{switch(ey(d)){case 1:l=pi;break;case 4:l=ha;break;case 16:l=es;break;case 536870912:l=ga;break;default:l=es}l=gv(l,lv.bind(null,n))}n.callbackPriority=o,n.callbackNode=l}}function lv(n,o){if(cc=-1,uc=0,(Ie&6)!==0)throw Error(r(327));var l=n.callbackNode;if(ws()&&n.callbackNode!==l)return null;var d=va(n,n===ut?gt:0);if(d===0)return null;if((d&30)!==0||(d&n.expiredLanes)!==0||o)o=dc(n,d);else{o=d;var g=Ie;Ie|=2;var x=uv();(ut!==n||gt!==o)&&(dr=null,_s=Ke()+500,go(n,o));do try{OL();break}catch(F){cv(n,F)}while(!0);hf(),oc.current=x,Ie=g,ot!==null?o=0:(ut=null,gt=0,o=it)}if(o!==0){if(o===2&&(g=Ad(n),g!==0&&(d=g,o=qf(n,g))),o===1)throw l=zi,go(n,0),Vr(n,d),Ft(n,Ke()),l;if(o===6)Vr(n,d);else{if(g=n.current.alternate,(d&30)===0&&!RL(g)&&(o=dc(n,d),o===2&&(x=Ad(n),x!==0&&(d=x,o=qf(n,x))),o===1))throw l=zi,go(n,0),Vr(n,d),Ft(n,Ke()),l;switch(n.finishedWork=g,n.finishedLanes=d,o){case 0:case 1:throw Error(r(345));case 2:Eo(n,Ut,dr);break;case 3:if(Vr(n,d),(d&130023424)===d&&(o=Kf+500-Ke(),10<o)){if(va(n,0)!==0)break;if(g=n.suspendedLanes,(g&d)!==d){Nt(),n.pingedLanes|=n.suspendedLanes&g;break}n.timeoutHandle=nf(Eo.bind(null,n,Ut,dr),o);break}Eo(n,Ut,dr);break;case 4:if(Vr(n,d),(d&4194240)===d)break;for(o=n.eventTimes,g=-1;0<d;){var O=31-yn(d);x=1<<O,O=o[O],O>g&&(g=O),d&=~x}if(d=g,d=Ke()-d,d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3e3>d?3e3:4320>d?4320:1960*wL(d/1960))-d,10<d){n.timeoutHandle=nf(Eo.bind(null,n,Ut,dr),d);break}Eo(n,Ut,dr);break;case 5:Eo(n,Ut,dr);break;default:throw Error(r(329))}}}return Ft(n,Ke()),n.callbackNode===l?lv.bind(null,n):null}function qf(n,o){var l=Wi;return n.current.memoizedState.isDehydrated&&(go(n,o).flags|=256),n=dc(n,o),n!==2&&(o=Ut,Ut=l,o!==null&&Jf(o)),n}function Jf(n){Ut===null?Ut=n:Ut.push.apply(Ut,n)}function RL(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],x=g.getSnapshot;g=g.value;try{if(!vn(x(),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 Vr(n,o){for(o&=~Yf,o&=~sc,n.suspendedLanes|=o,n.pingedLanes&=~o,n=n.expirationTimes;0<o;){var l=31-yn(o),d=1<<l;n[l]=-1,o&=~d}}function av(n){if((Ie&6)!==0)throw Error(r(327));ws();var o=va(n,0);if((o&1)===0)return Ft(n,Ke()),null;var l=dc(n,o);if(n.tag!==0&&l===2){var d=Ad(n);d!==0&&(o=d,l=qf(n,d))}if(l===1)throw l=zi,go(n,0),Vr(n,o),Ft(n,Ke()),l;if(l===6)throw Error(r(345));return n.finishedWork=n.current.alternate,n.finishedLanes=o,Eo(n,Ut,dr),Ft(n,Ke()),null}function Zf(n,o){var l=Ie;Ie|=1;try{return n(o)}finally{Ie=l,Ie===0&&(_s=Ke()+500,Fa&&Dr())}}function mo(n){Fr!==null&&Fr.tag===0&&(Ie&6)===0&&ws();var o=Ie;Ie|=1;var l=ln.transition,d=Pe;try{if(ln.transition=null,Pe=1,n)return n()}finally{Pe=d,ln.transition=l,Ie=o,(Ie&6)===0&&Dr()}}function ep(){Gt=Ss.current,He(Ss)}function go(n,o){n.finishedWork=null,n.finishedLanes=0;var l=n.timeoutHandle;if(l!==-1&&(n.timeoutHandle=-1,eL(l)),ot!==null)for(l=ot.return;l!==null;){var d=l;switch(cf(d),d.tag){case 1:d=d.type.childContextTypes,d!=null&&Pa();break;case 3:ys(),He(kt),He(yt),_f();break;case 5:xf(d);break;case 4:ys();break;case 13:He(Xe);break;case 19:He(Xe);break;case 10:mf(d.type._context);break;case 22:case 23:ep()}l=l.return}if(ut=n,ot=n=$r(n.current,null),gt=Gt=o,it=0,zi=null,Yf=sc=ho=0,Ut=Wi=null,uo!==null){for(o=0;o<uo.length;o++)if(l=uo[o],d=l.interleaved,d!==null){l.interleaved=null;var g=d.next,x=l.pending;if(x!==null){var O=x.next;x.next=g,d.next=O}l.pending=d}uo=null}return n}function cv(n,o){do{var l=ot;try{if(hf(),Ka.current=Ja,Xa){for(var d=Qe.memoizedState;d!==null;){var g=d.queue;g!==null&&(g.pending=null),d=d.next}Xa=!1}if(po=0,ct=st=Qe=null,Fi=!1,ji=0,Gf.current=null,l===null||l.return===null){it=1,zi=o,ot=null;break}e:{var x=n,O=l.return,F=l,B=o;if(o=gt,F.flags|=32768,B!==null&&typeof B=="object"&&typeof B.then=="function"){var Z=B,le=F,ae=le.tag;if((le.mode&1)===0&&(ae===0||ae===11||ae===15)){var ie=le.alternate;ie?(le.updateQueue=ie.updateQueue,le.memoizedState=ie.memoizedState,le.lanes=ie.lanes):(le.updateQueue=null,le.memoizedState=null)}var fe=k0(O);if(fe!==null){fe.flags&=-257,M0(fe,O,F,x,o),fe.mode&1&&D0(x,Z,o),o=fe,B=Z;var ge=o.updateQueue;if(ge===null){var Ee=new Set;Ee.add(B),o.updateQueue=Ee}else ge.add(B);break e}else{if((o&1)===0){D0(x,Z,o),tp();break e}B=Error(r(426))}}else if(We&&F.mode&1){var nt=k0(O);if(nt!==null){(nt.flags&65536)===0&&(nt.flags|=256),M0(nt,O,F,x,o),ff(vs(B,F));break e}}x=B=vs(B,F),it!==4&&(it=2),Wi===null?Wi=[x]:Wi.push(x),x=O;do{switch(x.tag){case 3:x.flags|=65536,o&=-o,x.lanes|=o;var Q=b0(x,B,o);o0(x,Q);break e;case 1:F=B;var Y=x.type,q=x.stateNode;if((x.flags&128)===0&&(typeof Y.getDerivedStateFromError=="function"||q!==null&&typeof q.componentDidCatch=="function"&&(Ur===null||!Ur.has(q)))){x.flags|=65536,o&=-o,x.lanes|=o;var ce=L0(x,F,o);o0(x,ce);break e}}x=x.return}while(x!==null)}fv(l)}catch(ve){o=ve,ot===l&&l!==null&&(ot=l=l.return);continue}break}while(!0)}function uv(){var n=oc.current;return oc.current=Ja,n===null?Ja:n}function tp(){(it===0||it===3||it===2)&&(it=4),ut===null||(ho&268435455)===0&&(sc&268435455)===0||Vr(ut,gt)}function dc(n,o){var l=Ie;Ie|=2;var d=uv();(ut!==n||gt!==o)&&(dr=null,go(n,o));do try{NL();break}catch(g){cv(n,g)}while(!0);if(hf(),Ie=l,oc.current=d,ot!==null)throw Error(r(261));return ut=null,gt=0,it}function NL(){for(;ot!==null;)dv(ot)}function OL(){for(;ot!==null&&!pa();)dv(ot)}function dv(n){var o=mv(n.alternate,n,Gt);n.memoizedProps=n.pendingProps,o===null?fv(n):ot=o,Gf.current=null}function fv(n){var o=n;do{var l=o.alternate;if(n=o.return,(o.flags&32768)===0){if(l=yL(l,o,Gt),l!==null){ot=l;return}}else{if(l=vL(l,o),l!==null){l.flags&=32767,ot=l;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{it=6,ot=null;return}}if(o=o.sibling,o!==null){ot=o;return}ot=o=n}while(o!==null);it===0&&(it=5)}function Eo(n,o,l){var d=Pe,g=ln.transition;try{ln.transition=null,Pe=1,TL(n,o,l,d)}finally{ln.transition=g,Pe=d}return null}function TL(n,o,l,d){do ws();while(Fr!==null);if((Ie&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 x=l.lanes|l.childLanes;if(lb(n,x),n===ut&&(ot=ut=null,gt=0),(l.subtreeFlags&2064)===0&&(l.flags&2064)===0||lc||(lc=!0,gv(es,function(){return ws(),null})),x=(l.flags&15990)!==0,(l.subtreeFlags&15990)!==0||x){x=ln.transition,ln.transition=null;var O=Pe;Pe=1;var F=Ie;Ie|=4,Gf.current=null,SL(n,l),nv(l,n),Yb(ef),_a=!!Zd,ef=Zd=null,n.current=l,_L(l),Td(),Ie=F,Pe=O,ln.transition=x}else n.current=l;if(lc&&(lc=!1,Fr=n,ac=g),x=n.pendingLanes,x===0&&(Ur=null),hi(l.stateNode),Ft(n,Ke()),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(ic)throw ic=!1,n=Xf,Xf=null,n;return(ac&1)!==0&&n.tag!==0&&ws(),x=n.pendingLanes,(x&1)!==0?n===Qf?Gi++:(Gi=0,Qf=n):Gi=0,Dr(),null}function ws(){if(Fr!==null){var n=ey(ac),o=ln.transition,l=Pe;try{if(ln.transition=null,Pe=16>n?16:n,Fr===null)var d=!1;else{if(n=Fr,Fr=null,ac=0,(Ie&6)!==0)throw Error(r(331));var g=Ie;for(Ie|=4,me=n.current;me!==null;){var x=me,O=x.child;if((me.flags&16)!==0){var F=x.deletions;if(F!==null){for(var B=0;B<F.length;B++){var Z=F[B];for(me=Z;me!==null;){var le=me;switch(le.tag){case 0:case 11:case 15:Bi(8,le,x)}var ae=le.child;if(ae!==null)ae.return=le,me=ae;else for(;me!==null;){le=me;var ie=le.sibling,fe=le.return;if(q0(le),le===Z){me=null;break}if(ie!==null){ie.return=fe,me=ie;break}me=fe}}}var ge=x.alternate;if(ge!==null){var Ee=ge.child;if(Ee!==null){ge.child=null;do{var nt=Ee.sibling;Ee.sibling=null,Ee=nt}while(Ee!==null)}}me=x}}if((x.subtreeFlags&2064)!==0&&O!==null)O.return=x,me=O;else e:for(;me!==null;){if(x=me,(x.flags&2048)!==0)switch(x.tag){case 0:case 11:case 15:Bi(9,x,x.return)}var Q=x.sibling;if(Q!==null){Q.return=x.return,me=Q;break e}me=x.return}}var Y=n.current;for(me=Y;me!==null;){O=me;var q=O.child;if((O.subtreeFlags&2064)!==0&&q!==null)q.return=O,me=q;else e:for(O=Y;me!==null;){if(F=me,(F.flags&2048)!==0)try{switch(F.tag){case 0:case 11:case 15:rc(9,F)}}catch(ve){Ze(F,F.return,ve)}if(F===O){me=null;break e}var ce=F.sibling;if(ce!==null){ce.return=F.return,me=ce;break e}me=F.return}}if(Ie=g,Dr(),tn&&typeof tn.onPostCommitFiberRoot=="function")try{tn.onPostCommitFiberRoot(ts,n)}catch{}d=!0}return d}finally{Pe=l,ln.transition=o}}return!1}function pv(n,o,l){o=vs(l,o),o=b0(n,o,1),n=Mr(n,o,1),o=Nt(),n!==null&&(gi(n,1,o),Ft(n,o))}function Ze(n,o,l){if(n.tag===3)pv(n,n,l);else for(;o!==null;){if(o.tag===3){pv(o,n,l);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Ur===null||!Ur.has(d))){n=vs(l,n),n=L0(o,n,1),o=Mr(o,n,1),n=Nt(),o!==null&&(gi(o,1,n),Ft(o,n));break}}o=o.return}}function CL(n,o,l){var d=n.pingCache;d!==null&&d.delete(o),o=Nt(),n.pingedLanes|=n.suspendedLanes&l,ut===n&&(gt&l)===l&&(it===4||it===3&&(gt&130023424)===gt&&500>Ke()-Kf?go(n,0):Yf|=l),Ft(n,o)}function hv(n,o){o===0&&((n.mode&1)===0?o=1:(o=ya,ya<<=1,(ya&130023424)===0&&(ya=4194304)));var l=Nt();n=ar(n,o),n!==null&&(gi(n,o,l),Ft(n,l))}function AL(n){var o=n.memoizedState,l=0;o!==null&&(l=o.retryLane),hv(n,l)}function IL(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),hv(n,l)}var mv;mv=function(n,o,l){if(n!==null)if(n.memoizedProps!==o.pendingProps||kt.current)Pt=!0;else{if((n.lanes&l)===0&&(o.flags&128)===0)return Pt=!1,EL(n,o,l);Pt=(n.flags&131072)!==0}else Pt=!1,We&&(o.flags&1048576)!==0&&Ky(o,Va,o.index);switch(o.lanes=0,o.tag){case 2:var d=o.type;tc(n,o),n=o.pendingProps;var g=ds(o,yt.current);Es(o,l),g=Nf(null,o,d,n,g,l);var x=Of();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,Mt(d)?(x=!0,Ua(o)):x=!1,o.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,yf(o),g.updater=Za,o.stateNode=g,g._reactInternals=o,Lf(o,d,n,l),o=Pf(null,o,d,!0,x,l)):(o.tag=0,We&&x&&af(o),Rt(null,o,g,l),o=o.child),o;case 16:d=o.elementType;e:{switch(tc(n,o),n=o.pendingProps,g=d._init,d=g(d._payload),o.type=d,g=o.tag=LL(d),n=Sn(d,n),g){case 0:o=Mf(null,o,d,n,l);break e;case 1:o=$0(null,o,d,n,l);break e;case 11:o=P0(null,o,d,n,l);break e;case 14:o=U0(null,o,d,Sn(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:Sn(d,g),Mf(n,o,d,g,l);case 1:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Sn(d,g),$0(n,o,d,g,l);case 3:e:{if(H0(o),n===null)throw Error(r(387));d=o.pendingProps,x=o.memoizedState,g=x.element,r0(n,o),Ga(o,d,null,l);var O=o.memoizedState;if(d=O.element,x.isDehydrated)if(x={element:d,isDehydrated:!1,cache:O.cache,pendingSuspenseBoundaries:O.pendingSuspenseBoundaries,transitions:O.transitions},o.updateQueue.baseState=x,o.memoizedState=x,o.flags&256){g=vs(Error(r(423)),o),o=B0(n,o,d,l,g);break e}else if(d!==g){g=vs(Error(r(424)),o),o=B0(n,o,d,l,g);break e}else for(Wt=Ir(o.stateNode.containerInfo.firstChild),zt=o,We=!0,xn=null,l=t0(o,null,d,l),o.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(hs(),d===g){o=ur(n,o,l);break e}Rt(n,o,d,l)}o=o.child}return o;case 5:return i0(o),n===null&&df(o),d=o.type,g=o.pendingProps,x=n!==null?n.memoizedProps:null,O=g.children,tf(d,g)?O=null:x!==null&&tf(d,x)&&(o.flags|=32),V0(n,o),Rt(n,o,O,l),o.child;case 6:return n===null&&df(o),null;case 13:return z0(n,o,l);case 4:return vf(o,o.stateNode.containerInfo),d=o.pendingProps,n===null?o.child=ms(o,null,d,l):Rt(n,o,d,l),o.child;case 11:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Sn(d,g),P0(n,o,d,g,l);case 7:return Rt(n,o,o.pendingProps,l),o.child;case 8:return Rt(n,o,o.pendingProps.children,l),o.child;case 12:return Rt(n,o,o.pendingProps.children,l),o.child;case 10:e:{if(d=o.type._context,g=o.pendingProps,x=o.memoizedProps,O=g.value,Ve(Ba,d._currentValue),d._currentValue=O,x!==null)if(vn(x.value,O)){if(x.children===g.children&&!kt.current){o=ur(n,o,l);break e}}else for(x=o.child,x!==null&&(x.return=o);x!==null;){var F=x.dependencies;if(F!==null){O=x.child;for(var B=F.firstContext;B!==null;){if(B.context===d){if(x.tag===1){B=cr(-1,l&-l),B.tag=2;var Z=x.updateQueue;if(Z!==null){Z=Z.shared;var le=Z.pending;le===null?B.next=B:(B.next=le.next,le.next=B),Z.pending=B}}x.lanes|=l,B=x.alternate,B!==null&&(B.lanes|=l),gf(x.return,l,o),F.lanes|=l;break}B=B.next}}else if(x.tag===10)O=x.type===o.type?null:x.child;else if(x.tag===18){if(O=x.return,O===null)throw Error(r(341));O.lanes|=l,F=O.alternate,F!==null&&(F.lanes|=l),gf(O,l,o),O=x.sibling}else O=x.child;if(O!==null)O.return=x;else for(O=x;O!==null;){if(O===o){O=null;break}if(x=O.sibling,x!==null){x.return=O.return,O=x;break}O=O.return}x=O}Rt(n,o,g.children,l),o=o.child}return o;case 9:return g=o.type,d=o.pendingProps.children,Es(o,l),g=on(g),d=d(g),o.flags|=1,Rt(n,o,d,l),o.child;case 14:return d=o.type,g=Sn(d,o.pendingProps),g=Sn(d.type,g),U0(n,o,d,g,l);case 15:return F0(n,o,o.type,o.pendingProps,l);case 17:return d=o.type,g=o.pendingProps,g=o.elementType===d?g:Sn(d,g),tc(n,o),o.tag=1,Mt(d)?(n=!0,Ua(o)):n=!1,Es(o,l),A0(o,d,g),Lf(o,d,g,l),Pf(null,o,d,!0,n,l);case 19:return G0(n,o,l);case 22:return j0(n,o,l)}throw Error(r(156,o.tag))};function gv(n,o){return da(n,o)}function bL(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 an(n,o,l,d){return new bL(n,o,l,d)}function np(n){return n=n.prototype,!(!n||!n.isReactComponent)}function LL(n){if(typeof n=="function")return np(n)?1:0;if(n!=null){if(n=n.$$typeof,n===re)return 11;if(n===z)return 14}return 2}function $r(n,o){var l=n.alternate;return l===null?(l=an(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 fc(n,o,l,d,g,x){var O=2;if(d=n,typeof n=="function")np(n)&&(O=1);else if(typeof n=="string")O=5;else e:switch(n){case V:return yo(l.children,g,x,o);case K:O=8,g|=8;break;case X:return n=an(12,l,o,g|2),n.elementType=X,n.lanes=x,n;case J:return n=an(13,l,o,g),n.elementType=J,n.lanes=x,n;case C:return n=an(19,l,o,g),n.elementType=C,n.lanes=x,n;case W:return pc(l,g,x,o);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case G:O=10;break e;case te:O=9;break e;case re:O=11;break e;case z:O=14;break e;case H:O=16,d=null;break e}throw Error(r(130,n==null?n:typeof n,""))}return o=an(O,l,o,g),o.elementType=n,o.type=d,o.lanes=x,o}function yo(n,o,l,d){return n=an(7,n,d,o),n.lanes=l,n}function pc(n,o,l,d){return n=an(22,n,d,o),n.elementType=W,n.lanes=l,n.stateNode={isHidden:!1},n}function rp(n,o,l){return n=an(6,n,null,o),n.lanes=l,n}function op(n,o,l){return o=an(4,n.children!==null?n.children:[],n.key,o),o.lanes=l,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}function DL(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=Id(0),this.expirationTimes=Id(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Id(0),this.identifierPrefix=d,this.onRecoverableError=g,this.mutableSourceEagerHydrationData=null}function sp(n,o,l,d,g,x,O,F,B){return n=new DL(n,o,l,F,B),o===1?(o=1,x===!0&&(o|=8)):o=0,x=an(3,null,null,o),n.current=x,x.stateNode=n,x.memoizedState={element:d,isDehydrated:l,cache:null,transitions:null,pendingSuspenseBoundaries:null},yf(x),n}function kL(n,o,l){var d=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:D,key:d==null?null:""+d,children:n,containerInfo:o,implementation:l}}function Ev(n){if(!n)return Lr;n=n._reactInternals;e:{if(rr(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(Mt(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(Mt(l))return Wy(n,l,o)}return o}function yv(n,o,l,d,g,x,O,F,B){return n=sp(l,d,!0,n,g,x,O,F,B),n.context=Ev(null),l=n.current,d=Nt(),g=jr(l),x=cr(d,g),x.callback=o??null,Mr(l,x,g),n.current.lanes=g,gi(n,g,d),Ft(n,d),n}function hc(n,o,l,d){var g=o.current,x=Nt(),O=jr(g);return l=Ev(l),o.context===null?o.context=l:o.pendingContext=l,o=cr(x,O),o.payload={element:n},d=d===void 0?null:d,d!==null&&(o.callback=d),n=Mr(g,o,O),n!==null&&(Rn(n,g,O,x),Wa(n,g,O)),O}function mc(n){return n=n.current,n.child?(n.child.tag===5,n.child.stateNode):null}function vv(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var l=n.retryLane;n.retryLane=l!==0&&l<o?l:o}}function ip(n,o){vv(n,o),(n=n.alternate)&&vv(n,o)}function ML(){return null}var xv=typeof reportError=="function"?reportError:function(n){console.error(n)};function lp(n){this._internalRoot=n}gc.prototype.render=lp.prototype.render=function(n){var o=this._internalRoot;if(o===null)throw Error(r(409));hc(n,o,null,null)},gc.prototype.unmount=lp.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var o=n.containerInfo;mo(function(){hc(null,n,null,null)}),o[or]=null}};function gc(n){this._internalRoot=n}gc.prototype.unstable_scheduleHydration=function(n){if(n){var o=ry();n={blockedOn:null,target:n,priority:o};for(var l=0;l<Tr.length&&o!==0&&o<Tr[l].priority;l++);Tr.splice(l,0,n),l===0&&iy(n)}};function ap(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function Ec(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function Sv(){}function PL(n,o,l,d,g){if(g){if(typeof d=="function"){var x=d;d=function(){var Z=mc(O);x.call(Z)}}var O=yv(o,d,n,0,null,!1,!1,"",Sv);return n._reactRootContainer=O,n[or]=O.current,Ii(n.nodeType===8?n.parentNode:n),mo(),O}for(;g=n.lastChild;)n.removeChild(g);if(typeof d=="function"){var F=d;d=function(){var Z=mc(B);F.call(Z)}}var B=sp(n,0,!1,null,null,!1,!1,"",Sv);return n._reactRootContainer=B,n[or]=B.current,Ii(n.nodeType===8?n.parentNode:n),mo(function(){hc(o,B,l,d)}),B}function yc(n,o,l,d,g){var x=l._reactRootContainer;if(x){var O=x;if(typeof g=="function"){var F=g;g=function(){var B=mc(O);F.call(B)}}hc(o,O,n,g)}else O=PL(l,o,n,g,d);return mc(O)}ty=function(n){switch(n.tag){case 3:var o=n.stateNode;if(o.current.memoizedState.isDehydrated){var l=mi(o.pendingLanes);l!==0&&(bd(o,l|1),Ft(o,Ke()),(Ie&6)===0&&(_s=Ke()+500,Dr()))}break;case 13:mo(function(){var d=ar(n,1);if(d!==null){var g=Nt();Rn(d,n,1,g)}}),ip(n,1)}},Ld=function(n){if(n.tag===13){var o=ar(n,134217728);if(o!==null){var l=Nt();Rn(o,n,134217728,l)}ip(n,134217728)}},ny=function(n){if(n.tag===13){var o=jr(n),l=ar(n,o);if(l!==null){var d=Nt();Rn(l,n,o,d)}ip(n,o)}},ry=function(){return Pe},oy=function(n,o){var l=Pe;try{return Pe=n,o()}finally{Pe=l}},tr=function(n,o,l){switch(o){case"input":if(Me(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=Ma(d);if(!g)throw Error(r(90));ze(d),Me(d,g)}}}break;case"textarea":Zt(n,l);break;case"select":o=l.value,o!=null&&Jt(n,!!l.multiple,o,!1)}},ra=Zf,oa=mo;var UL={usingClientEntryPoint:!1,Events:[Di,cs,Ma,ta,na,Zf]},Yi={findFiberByHostInstance:io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},FL={bundleType:Yi.bundleType,version:Yi.version,rendererPackageName:Yi.rendererPackageName,rendererConfig:Yi.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=ca(n),n===null?null:n.stateNode},findFiberByHostInstance:Yi.findFiberByHostInstance||ML,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var vc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vc.isDisabled&&vc.supportsFiber)try{ts=vc.inject(FL),tn=vc}catch{}}return Ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UL,Ot.createPortal=function(n,o){var l=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ap(o))throw Error(r(200));return kL(n,o,null,l)},Ot.createRoot=function(n,o){if(!ap(n))throw Error(r(299));var l=!1,d="",g=xv;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onRecoverableError!==void 0&&(g=o.onRecoverableError)),o=sp(n,1,!1,null,null,l,!1,d,g),n[or]=o.current,Ii(n.nodeType===8?n.parentNode:n),new lp(o)},Ot.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=ca(o),n=n===null?null:n.stateNode,n},Ot.flushSync=function(n){return mo(n)},Ot.hydrate=function(n,o,l){if(!Ec(o))throw Error(r(200));return yc(null,n,o,!0,l)},Ot.hydrateRoot=function(n,o,l){if(!ap(n))throw Error(r(405));var d=l!=null&&l.hydratedSources||null,g=!1,x="",O=xv;if(l!=null&&(l.unstable_strictMode===!0&&(g=!0),l.identifierPrefix!==void 0&&(x=l.identifierPrefix),l.onRecoverableError!==void 0&&(O=l.onRecoverableError)),o=yv(o,null,n,1,l??null,g,!1,x,O),n[or]=o.current,Ii(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 gc(o)},Ot.render=function(n,o,l){if(!Ec(o))throw Error(r(200));return yc(null,n,o,!1,l)},Ot.unmountComponentAtNode=function(n){if(!Ec(n))throw Error(r(40));return n._reactRootContainer?(mo(function(){yc(null,null,n,!1,function(){n._reactRootContainer=null,n[or]=null})}),!0):!1},Ot.unstable_batchedUpdates=Zf,Ot.unstable_renderSubtreeIntoContainer=function(n,o,l,d){if(!Ec(l))throw Error(r(200));if(n==null||n._reactInternals===void 0)throw Error(r(38));return yc(n,o,l,!1,d)},Ot.version="18.3.1-next-f1338f8080-20240426",Ot}var wp;function Rp(){if(wp)return Ic.exports;wp=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(),Ic.exports=fx(),Ic.exports}var Np;function px(){if(Np)return qi;Np=1;var e=Rp();return qi.createRoot=e.createRoot,qi.hydrateRoot=e.hydrateRoot,qi}var hx=px();const mx=Ki(hx);function _t(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=_t(e[r]))!==""&&(t+=(t&&" ")+s);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var Dc={exports:{}},kc={},Mc={exports:{}},Pc={};var Op;function gx(){if(Op)return Pc;Op=1;var e=Os();function t(E,y){return E===y&&(E!==0||1/E===1/y)||E!==E&&y!==y}var r=typeof Object.is=="function"?Object.is:t,s=e.useState,i=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function u(E,y){var v=y(),w=s({inst:{value:v,getSnapshot:y}}),_=w[0].inst,S=w[1];return a(function(){_.value=v,_.getSnapshot=y,f(_)&&S({inst:_})},[E,v,y]),i(function(){return f(_)&&S({inst:_}),E(function(){f(_)&&S({inst:_})})},[E]),c(v),v}function f(E){var y=E.getSnapshot;E=E.value;try{var v=y();return!r(E,v)}catch{return!0}}function p(E,y){return y()}var m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:u;return Pc.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:m,Pc}var Tp;function Ex(){return Tp||(Tp=1,Mc.exports=gx()),Mc.exports}var Cp;function yx(){if(Cp)return kc;Cp=1;var e=Os(),t=Ex();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 kc.useSyncExternalStoreWithSelector=function(p,m,E,y,v){var w=a(null);if(w.current===null){var _={hasValue:!1,value:null};w.current=_}else _=w.current;w=u(function(){function R(D){if(!N){if(N=!0,b=D,D=y(D),v!==void 0&&_.hasValue){var V=_.value;if(v(V,D))return T=V}return T=D}if(V=T,s(b,D))return V;var K=y(D);return v!==void 0&&v(V,K)?(b=D,V):(b=D,T=K)}var N=!1,b,T,L=E===void 0?null:E;return[function(){return R(m())},L===null?void 0:function(){return R(L())}]},[m,E,y,v]);var S=i(p,w[0],w[1]);return c(function(){_.hasValue=!0,_.value=S},[S]),f(S),S},kc}var Ap;function vx(){return Ap||(Ap=1,Dc.exports=yx()),Dc.exports}var xx=vx();const Ip=Ki(xx),Sx={},bp=e=>{let t;const r=new Set,s=(m,E)=>{const y=typeof m=="function"?m(t):m;if(!Object.is(y,t)){const v=t;t=E??(typeof y!="object"||y===null)?y:Object.assign({},t,y),r.forEach(w=>w(t,v))}},i=()=>t,f={setState:s,getState:i,getInitialState:()=>p,subscribe:m=>(r.add(m),()=>r.delete(m)),destroy:()=>{(Sx?"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()}},p=t=e(s,i,f);return f},Lp=e=>e?bp(e):bp,{useDebugValue:_x}=ne,{useSyncExternalStoreWithSelector:wx}=Ip,Rx=e=>e;function Dp(e,t=Rx,r){const s=wx(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return _x(s),s}const kp=(e,t)=>{const r=Lp(e),s=(i,a=t)=>Dp(r,i,a);return Object.assign(s,r),s},Nx=(e,t)=>e?kp(e,t):kp;function Et(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(const s of r)if(!Object.prototype.hasOwnProperty.call(t,s)||!Object.is(e[s],t[s]))return!1;return!0}var Ox={value:()=>{}};function Ji(){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 Zi(r)}function Zi(e){this._=e}function Tx(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}})}Zi.prototype=Ji.prototype={constructor:Zi,on:function(e,t){var r=this._,s=Tx(e+"",r),i,a=-1,c=s.length;if(arguments.length<2){for(;++a<c;)if((i=(e=s[a]).type)&&(i=Cx(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]=Mp(r[i],e.name,t);else if(t==null)for(i in r)r[i]=Mp(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 Zi(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 Cx(e,t){for(var r=0,s=e.length,i;r<s;++r)if((i=e[r]).name===t)return i.value}function Mp(e,t,r){for(var s=0,i=e.length;s<i;++s)if(e[s].name===t){e[s]=Ox,e=e.slice(0,s).concat(e.slice(s+1));break}return r!=null&&e.push({name:t,value:r}),e}var Uc="http://www.w3.org/1999/xhtml";const Pp={svg:"http://www.w3.org/2000/svg",xhtml:Uc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function el(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),Pp.hasOwnProperty(t)?{space:Pp[t],local:e}:e}function Ax(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Uc&&t.documentElement.namespaceURI===Uc?t.createElement(e):t.createElementNS(r,e)}}function Ix(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Up(e){var t=el(e);return(t.local?Ix:Ax)(t)}function bx(){}function Fc(e){return e==null?bx:function(){return this.querySelector(e)}}function Lx(e){typeof e!="function"&&(e=Fc(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 jt(s,this._parents)}function Dx(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kx(){return[]}function Fp(e){return e==null?kx:function(){return this.querySelectorAll(e)}}function Mx(e){return function(){return Dx(e.apply(this,arguments))}}function Px(e){typeof e=="function"?e=Mx(e):e=Fp(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 jt(s,i)}function jp(e){return function(){return this.matches(e)}}function Vp(e){return function(t){return t.matches(e)}}var Ux=Array.prototype.find;function Fx(e){return function(){return Ux.call(this.children,e)}}function jx(){return this.firstElementChild}function Vx(e){return this.select(e==null?jx:Fx(typeof e=="function"?e:Vp(e)))}var $x=Array.prototype.filter;function Hx(){return Array.from(this.children)}function Bx(e){return function(){return $x.call(this.children,e)}}function zx(e){return this.selectAll(e==null?Hx:Bx(typeof e=="function"?e:Vp(e)))}function Wx(e){typeof e!="function"&&(e=jp(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 jt(s,this._parents)}function $p(e){return new Array(e.length)}function Gx(){return new jt(this._enter||this._groups.map($p),this._parents)}function tl(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}tl.prototype={constructor:tl,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 Yx(e){return function(){return e}}function Kx(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 tl(e,a[c]);for(;c<f;++c)(u=t[c])&&(i[c]=u)}function Xx(e,t,r,s,i,a,c){var u,f,p=new Map,m=t.length,E=a.length,y=new Array(m),v;for(u=0;u<m;++u)(f=t[u])&&(y[u]=v=c.call(f,f.__data__,u,t)+"",p.has(v)?i[u]=f:p.set(v,f));for(u=0;u<E;++u)v=c.call(e,a[u],u,a)+"",(f=p.get(v))?(s[u]=f,f.__data__=a[u],p.delete(v)):r[u]=new tl(e,a[u]);for(u=0;u<m;++u)(f=t[u])&&p.get(y[u])===f&&(i[u]=f)}function Qx(e){return e.__data__}function qx(e,t){if(!arguments.length)return Array.from(this,Qx);var r=t?Xx:Kx,s=this._parents,i=this._groups;typeof e!="function"&&(e=Yx(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],y=E.length,v=Jx(e.call(m,m&&m.__data__,p,s)),w=v.length,_=u[p]=new Array(w),S=c[p]=new Array(w),R=f[p]=new Array(y);r(m,E,_,S,R,v,t);for(var N=0,b=0,T,L;N<w;++N)if(T=_[N]){for(N>=b&&(b=N+1);!(L=S[b])&&++b<w;);T._next=L||null}}return c=new jt(c,s),c._enter=u,c._exit=f,c}function Jx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zx(){return new jt(this._exit||this._groups.map($p),this._parents)}function eS(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 tS(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,y=u[f]=new Array(E),v,w=0;w<E;++w)(v=p[w]||m[w])&&(y[w]=v);for(;f<i;++f)u[f]=r[f];return new jt(u,this._parents)}function nS(){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 rS(e){e||(e=oS);function t(E,y){return E&&y?e(E.__data__,y.__data__):!E-!y}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 jt(i,this._parents).order()}function oS(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function sS(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function iS(){return Array.from(this)}function lS(){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 aS(){let e=0;for(const t of this)++e;return e}function cS(){return!this.node()}function uS(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 dS(e){return function(){this.removeAttribute(e)}}function fS(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pS(e,t){return function(){this.setAttribute(e,t)}}function hS(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function mS(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function gS(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 ES(e,t){var r=el(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?fS:dS:typeof t=="function"?r.local?gS:mS:r.local?hS:pS)(r,t))}function Hp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function yS(e){return function(){this.style.removeProperty(e)}}function vS(e,t,r){return function(){this.style.setProperty(e,t,r)}}function xS(e,t,r){return function(){var s=t.apply(this,arguments);s==null?this.style.removeProperty(e):this.style.setProperty(e,s,r)}}function SS(e,t,r){return arguments.length>1?this.each((t==null?yS:typeof t=="function"?xS:vS)(e,t,r??"")):So(this.node(),e)}function So(e,t){return e.style.getPropertyValue(t)||Hp(e).getComputedStyle(e,null).getPropertyValue(t)}function _S(e){return function(){delete this[e]}}function wS(e,t){return function(){this[e]=t}}function RS(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?_S:typeof t=="function"?RS:wS)(e,t)):this.node()[e]}function Bp(e){return e.trim().split(/^|\s+/)}function jc(e){return e.classList||new zp(e)}function zp(e){this._node=e,this._names=Bp(e.getAttribute("class")||"")}zp.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 Wp(e,t){for(var r=jc(e),s=-1,i=t.length;++s<i;)r.add(t[s])}function Gp(e,t){for(var r=jc(e),s=-1,i=t.length;++s<i;)r.remove(t[s])}function OS(e){return function(){Wp(this,e)}}function TS(e){return function(){Gp(this,e)}}function CS(e,t){return function(){(t.apply(this,arguments)?Wp:Gp)(this,e)}}function AS(e,t){var r=Bp(e+"");if(arguments.length<2){for(var s=jc(this.node()),i=-1,a=r.length;++i<a;)if(!s.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?CS:t?OS:TS)(r,t))}function IS(){this.textContent=""}function bS(e){return function(){this.textContent=e}}function LS(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function DS(e){return arguments.length?this.each(e==null?IS:(typeof e=="function"?LS:bS)(e)):this.node().textContent}function kS(){this.innerHTML=""}function MS(e){return function(){this.innerHTML=e}}function PS(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function US(e){return arguments.length?this.each(e==null?kS:(typeof e=="function"?PS:MS)(e)):this.node().innerHTML}function FS(){this.nextSibling&&this.parentNode.appendChild(this)}function jS(){return this.each(FS)}function VS(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $S(){return this.each(VS)}function HS(e){var t=typeof e=="function"?e:Up(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function BS(){return null}function zS(e,t){var r=typeof e=="function"?e:Up(e),s=t==null?BS:typeof t=="function"?t:Fc(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),s.apply(this,arguments)||null)})}function WS(){var e=this.parentNode;e&&e.removeChild(this)}function GS(){return this.each(WS)}function YS(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function KS(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XS(e){return this.select(e?KS:YS)}function QS(e){return arguments.length?this.property("__data__",e):this.node().__data__}function qS(e){return function(t){e.call(this,t,this.__data__)}}function JS(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 ZS(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 e_(e,t,r){return function(){var s=this.__on,i,a=qS(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 t_(e,t,r){var s=JS(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?e_:ZS,i=0;i<a;++i)this.each(u(s[i],t,r));return this}function Yp(e,t,r){var s=Hp(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 n_(e,t){return function(){return Yp(this,e,t)}}function r_(e,t){return function(){return Yp(this,e,t.apply(this,arguments))}}function o_(e,t){return this.each((typeof t=="function"?r_:n_)(e,t))}function*s_(){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 Kp=[null];function jt(e,t){this._groups=e,this._parents=t}function Cs(){return new jt([[document.documentElement]],Kp)}function i_(){return this}jt.prototype=Cs.prototype={constructor:jt,select:Lx,selectAll:Px,selectChild:Vx,selectChildren:zx,filter:Wx,data:qx,enter:Gx,exit:Zx,join:eS,merge:tS,selection:i_,order:nS,sort:rS,call:sS,nodes:iS,node:lS,size:aS,empty:cS,each:uS,attr:ES,style:SS,property:NS,classed:AS,text:DS,html:US,raise:jS,lower:$S,append:HS,insert:zS,remove:GS,clone:XS,datum:QS,on:t_,dispatch:o_,[Symbol.iterator]:s_};function cn(e){return typeof e=="string"?new jt([[document.querySelector(e)]],[document.documentElement]):new jt([[e]],Kp)}function l_(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Nn(e,t){if(e=l_(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 a_={passive:!1},As={capture:!0,passive:!1};function Vc(e){e.stopImmediatePropagation()}function _o(e){e.preventDefault(),e.stopImmediatePropagation()}function Xp(e){var t=e.document.documentElement,r=cn(e).on("dragstart.drag",_o,As);"onselectstart"in t?r.on("selectstart.drag",_o,As):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Qp(e,t){var r=e.document.documentElement,s=cn(e).on("dragstart.drag",null);t&&(s.on("click.drag",_o,As),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 nl=e=>()=>e;function $c(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}})}$c.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function c_(e){return!e.ctrlKey&&!e.button}function u_(){return this.parentNode}function d_(e,t){return t??{x:e.x,y:e.y}}function f_(){return navigator.maxTouchPoints||"ontouchstart"in this}function p_(){var e=c_,t=u_,r=d_,s=f_,i={},a=Ji("start","drag","end"),c=0,u,f,p,m,E=0;function y(T){T.on("mousedown.drag",v).filter(s).on("touchstart.drag",S).on("touchmove.drag",R,a_).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(T,L){if(!(m||!e.call(this,T,L))){var D=b(this,t.call(this,T,L),T,L,"mouse");D&&(cn(T.view).on("mousemove.drag",w,As).on("mouseup.drag",_,As),Xp(T.view),Vc(T),p=!1,u=T.clientX,f=T.clientY,D("start",T))}}function w(T){if(_o(T),!p){var L=T.clientX-u,D=T.clientY-f;p=L*L+D*D>E}i.mouse("drag",T)}function _(T){cn(T.view).on("mousemove.drag mouseup.drag",null),Qp(T.view,p),_o(T),i.mouse("end",T)}function S(T,L){if(e.call(this,T,L)){var D=T.changedTouches,V=t.call(this,T,L),K=D.length,X,G;for(X=0;X<K;++X)(G=b(this,V,T,L,D[X].identifier,D[X]))&&(Vc(T),G("start",T,D[X]))}}function R(T){var L=T.changedTouches,D=L.length,V,K;for(V=0;V<D;++V)(K=i[L[V].identifier])&&(_o(T),K("drag",T,L[V]))}function N(T){var L=T.changedTouches,D=L.length,V,K;for(m&&clearTimeout(m),m=setTimeout(function(){m=null},500),V=0;V<D;++V)(K=i[L[V].identifier])&&(Vc(T),K("end",T,L[V]))}function b(T,L,D,V,K,X){var G=a.copy(),te=Nn(X||D,L),re,J,C;if((C=r.call(T,new $c("beforestart",{sourceEvent:D,target:y,identifier:K,active:c,x:te[0],y:te[1],dx:0,dy:0,dispatch:G}),V))!=null)return re=C.x-te[0]||0,J=C.y-te[1]||0,function z(H,W,P){var U=te,$;switch(H){case"start":i[K]=z,$=c++;break;case"end":delete i[K],--c;case"drag":te=Nn(P||W,L),$=c;break}G.call(H,T,new $c(H,{sourceEvent:W,subject:C,target:y,identifier:K,active:$,x:te[0]+re,y:te[1]+J,dx:te[0]-U[0],dy:te[1]-U[1],dispatch:G}),V)}}return y.filter=function(T){return arguments.length?(e=typeof T=="function"?T:nl(!!T),y):e},y.container=function(T){return arguments.length?(t=typeof T=="function"?T:nl(T),y):t},y.subject=function(T){return arguments.length?(r=typeof T=="function"?T:nl(T),y):r},y.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:nl(!!T),y):s},y.on=function(){var T=a.on.apply(a,arguments);return T===a?y:T},y.clickDistance=function(T){return arguments.length?(E=(T=+T)*T,y):Math.sqrt(E)},y}function Hc(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function qp(e,t){var r=Object.create(e.prototype);for(var s in t)r[s]=t[s];return r}function Is(){}var bs=.7,rl=1/bs,wo="\\s*([+-]?\\d+)\\s*",Ls="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",On="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",h_=/^#([0-9a-f]{3,8})$/,m_=new RegExp(`^rgb\\(${wo},${wo},${wo}\\)$`),g_=new RegExp(`^rgb\\(${On},${On},${On}\\)$`),E_=new RegExp(`^rgba\\(${wo},${wo},${wo},${Ls}\\)$`),y_=new RegExp(`^rgba\\(${On},${On},${On},${Ls}\\)$`),v_=new RegExp(`^hsl\\(${Ls},${On},${On}\\)$`),x_=new RegExp(`^hsla\\(${Ls},${On},${On},${Ls}\\)$`),Jp={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};Hc(Is,Ds,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Zp,formatHex:Zp,formatHex8:S_,formatHsl:__,formatRgb:eh,toString:eh});function Zp(){return this.rgb().formatHex()}function S_(){return this.rgb().formatHex8()}function __(){return sh(this).formatHsl()}function eh(){return this.rgb().formatRgb()}function Ds(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=h_.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?th(t):r===3?new Tt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ol(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ol(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=m_.exec(e))?new Tt(t[1],t[2],t[3],1):(t=g_.exec(e))?new Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=E_.exec(e))?ol(t[1],t[2],t[3],t[4]):(t=y_.exec(e))?ol(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=v_.exec(e))?oh(t[1],t[2]/100,t[3]/100,1):(t=x_.exec(e))?oh(t[1],t[2]/100,t[3]/100,t[4]):Jp.hasOwnProperty(e)?th(Jp[e]):e==="transparent"?new Tt(NaN,NaN,NaN,0):null}function th(e){return new Tt(e>>16&255,e>>8&255,e&255,1)}function ol(e,t,r,s){return s<=0&&(e=t=r=NaN),new Tt(e,t,r,s)}function w_(e){return e instanceof Is||(e=Ds(e)),e?(e=e.rgb(),new Tt(e.r,e.g,e.b,e.opacity)):new Tt}function Bc(e,t,r,s){return arguments.length===1?w_(e):new Tt(e,t,r,s??1)}function Tt(e,t,r,s){this.r=+e,this.g=+t,this.b=+r,this.opacity=+s}Hc(Tt,Bc,qp(Is,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bs:Math.pow(bs,e),new Tt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Tt(zr(this.r),zr(this.g),zr(this.b),sl(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:nh,formatHex:nh,formatHex8:R_,formatRgb:rh,toString:rh}));function nh(){return`#${Wr(this.r)}${Wr(this.g)}${Wr(this.b)}`}function R_(){return`#${Wr(this.r)}${Wr(this.g)}${Wr(this.b)}${Wr((isNaN(this.opacity)?1:this.opacity)*255)}`}function rh(){const e=sl(this.opacity);return`${e===1?"rgb(":"rgba("}${zr(this.r)}, ${zr(this.g)}, ${zr(this.b)}${e===1?")":`, ${e})`}`}function sl(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function zr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wr(e){return e=zr(e),(e<16?"0":"")+e.toString(16)}function oh(e,t,r,s){return s<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new un(e,t,r,s)}function sh(e){if(e instanceof un)return new un(e.h,e.s,e.l,e.opacity);if(e instanceof Is||(e=Ds(e)),!e)return new un;if(e instanceof un)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 un(c,u,f,e.opacity)}function N_(e,t,r,s){return arguments.length===1?sh(e):new un(e,t,r,s??1)}function un(e,t,r,s){this.h=+e,this.s=+t,this.l=+r,this.opacity=+s}Hc(un,N_,qp(Is,{brighter(e){return e=e==null?rl:Math.pow(rl,e),new un(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bs:Math.pow(bs,e),new un(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 Tt(zc(e>=240?e-240:e+120,i,s),zc(e,i,s),zc(e<120?e+240:e-120,i,s),this.opacity)},clamp(){return new un(ih(this.h),il(this.s),il(this.l),sl(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=sl(this.opacity);return`${e===1?"hsl(":"hsla("}${ih(this.h)}, ${il(this.s)*100}%, ${il(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ih(e){return e=(e||0)%360,e<0?e+360:e}function il(e){return Math.max(0,Math.min(1,e||0))}function zc(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 lh=e=>()=>e;function O_(e,t){return function(r){return e+r*t}}function T_(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 C_(e){return(e=+e)==1?ah:function(t,r){return r-t?T_(t,r,e):lh(isNaN(t)?r:t)}}function ah(e,t){var r=t-e;return r?O_(e,r):lh(isNaN(e)?t:e)}const ch=(function e(t){var r=C_(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=ah(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 fr(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}var Wc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Gc=new RegExp(Wc.source,"g");function A_(e){return function(){return e}}function I_(e){return function(t){return e(t)+""}}function b_(e,t){var r=Wc.lastIndex=Gc.lastIndex=0,s,i,a,c=-1,u=[],f=[];for(e=e+"",t=t+"";(s=Wc.exec(e))&&(i=Gc.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:fr(s,i)})),r=Gc.lastIndex;return r<t.length&&(a=t.slice(r),u[c]?u[c]+=a:u[++c]=a),u.length<2?f[0]?I_(f[0].x):A_(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 uh=180/Math.PI,Yc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function dh(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)*uh,skewX:Math.atan(f)*uh,scaleX:c,scaleY:u}}var ll;function L_(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Yc:dh(t.a,t.b,t.c,t.d,t.e,t.f)}function D_(e){return e==null||(ll||(ll=document.createElementNS("http://www.w3.org/2000/svg","g")),ll.setAttribute("transform",e),!(e=ll.transform.baseVal.consolidate()))?Yc:(e=e.matrix,dh(e.a,e.b,e.c,e.d,e.e,e.f))}function fh(e,t,r,s){function i(p){return p.length?p.pop()+" ":""}function a(p,m,E,y,v,w){if(p!==E||m!==y){var _=v.push("translate(",null,t,null,r);w.push({i:_-4,x:fr(p,E)},{i:_-2,x:fr(m,y)})}else(E||y)&&v.push("translate("+E+t+y+r)}function c(p,m,E,y){p!==m?(p-m>180?m+=360:m-p>180&&(p+=360),y.push({i:E.push(i(E)+"rotate(",null,s)-2,x:fr(p,m)})):m&&E.push(i(E)+"rotate("+m+s)}function u(p,m,E,y){p!==m?y.push({i:E.push(i(E)+"skewX(",null,s)-2,x:fr(p,m)}):m&&E.push(i(E)+"skewX("+m+s)}function f(p,m,E,y,v,w){if(p!==E||m!==y){var _=v.push(i(v)+"scale(",null,",",null,")");w.push({i:_-4,x:fr(p,E)},{i:_-2,x:fr(m,y)})}else(E!==1||y!==1)&&v.push(i(v)+"scale("+E+","+y+")")}return function(p,m){var E=[],y=[];return p=e(p),m=e(m),a(p.translateX,p.translateY,m.translateX,m.translateY,E,y),c(p.rotate,m.rotate,E,y),u(p.skewX,m.skewX,E,y),f(p.scaleX,p.scaleY,m.scaleX,m.scaleY,E,y),p=m=null,function(v){for(var w=-1,_=y.length,S;++w<_;)E[(S=y[w]).i]=S.x(v);return E.join("")}}}var k_=fh(L_,"px, ","px)","deg)"),M_=fh(D_,", ",")",")"),P_=1e-12;function ph(e){return((e=Math.exp(e))+1/e)/2}function U_(e){return((e=Math.exp(e))-1/e)/2}function F_(e){return((e=Math.exp(2*e))-1)/(e+1)}const j_=(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],y=c[2],v=m-u,w=E-f,_=v*v+w*w,S,R;if(_<P_)R=Math.log(y/p)/t,S=function(V){return[u+V*v,f+V*w,p*Math.exp(t*V*R)]};else{var N=Math.sqrt(_),b=(y*y-p*p+s*_)/(2*p*r*N),T=(y*y-p*p-s*_)/(2*y*r*N),L=Math.log(Math.sqrt(b*b+1)-b),D=Math.log(Math.sqrt(T*T+1)-T);R=(D-L)/t,S=function(V){var K=V*R,X=ph(L),G=p/(r*N)*(X*F_(t*K+L)-U_(L));return[u+G*v,f+G*w,p*X/ph(t*K+L)]}}return S.duration=R*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 Ro=0,ks=0,Ms=0,hh=1e3,al,Ps,cl=0,Gr=0,ul=0,Us=typeof performance=="object"&&performance.now?performance:Date,mh=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Kc(){return Gr||(mh(V_),Gr=Us.now()+ul)}function V_(){Gr=0}function dl(){this._call=this._time=this._next=null}dl.prototype=gh.prototype={constructor:dl,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?Kc():+r)+(t==null?0:+t),!this._next&&Ps!==this&&(Ps?Ps._next=this:al=this,Ps=this),this._call=e,this._time=r,Xc()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xc())}};function gh(e,t,r){var s=new dl;return s.restart(e,t,r),s}function $_(){Kc(),++Ro;for(var e=al,t;e;)(t=Gr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ro}function Eh(){Gr=(cl=Us.now())+ul,Ro=ks=0;try{$_()}finally{Ro=0,B_(),Gr=0}}function H_(){var e=Us.now(),t=e-cl;t>hh&&(ul-=t,cl=e)}function B_(){for(var e,t=al,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:al=r);Ps=e,Xc(s)}function Xc(e){if(!Ro){ks&&(ks=clearTimeout(ks));var t=e-Gr;t>24?(e<1/0&&(ks=setTimeout(Eh,e-Us.now()-ul)),Ms&&(Ms=clearInterval(Ms))):(Ms||(cl=Us.now(),Ms=setInterval(H_,hh)),Ro=1,mh(Eh))}}function yh(e,t,r){var s=new dl;return t=t==null?0:+t,s.restart(i=>{s.stop(),e(i+t)},t,r),s}var z_=Ji("start","end","cancel","interrupt"),W_=[],vh=0,xh=1,Qc=2,fl=3,Sh=4,qc=5,pl=6;function hl(e,t,r,s,i,a){var c=e.__transition;if(!c)e.__transition={};else if(r in c)return;G_(e,r,{name:t,index:s,group:i,on:z_,tween:W_,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:vh})}function Jc(e,t){var r=dn(e,t);if(r.state>vh)throw new Error("too late; already scheduled");return r}function Tn(e,t){var r=dn(e,t);if(r.state>fl)throw new Error("too late; already running");return r}function dn(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function G_(e,t,r){var s=e.__transition,i;s[t]=r,r.timer=gh(a,0,r.time);function a(p){r.state=xh,r.timer.restart(c,r.delay,r.time),r.delay<=p&&c(p-r.delay)}function c(p){var m,E,y,v;if(r.state!==xh)return f();for(m in s)if(v=s[m],v.name===r.name){if(v.state===fl)return yh(c);v.state===Sh?(v.state=pl,v.timer.stop(),v.on.call("interrupt",e,e.__data__,v.index,v.group),delete s[m]):+m<t&&(v.state=pl,v.timer.stop(),v.on.call("cancel",e,e.__data__,v.index,v.group),delete s[m])}if(yh(function(){r.state===fl&&(r.state=Sh,r.timer.restart(u,r.delay,r.time),u(p))}),r.state=Qc,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Qc){for(r.state=fl,i=new Array(y=r.tween.length),m=0,E=-1;m<y;++m)(v=r.tween[m].value.call(e,e.__data__,r.index,r.group))&&(i[++E]=v);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=qc,1),E=-1,y=i.length;++E<y;)i[E].call(e,m);r.state===qc&&(r.on.call("end",e,e.__data__,r.index,r.group),f())}function f(){r.state=pl,r.timer.stop(),delete s[t];for(var p in s)return;delete e.__transition}}function ml(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>Qc&&s.state<qc,s.state=pl,s.timer.stop(),s.on.call(i?"interrupt":"cancel",e,e.__data__,s.index,s.group),delete r[c]}a&&delete e.__transition}}function Y_(e){return this.each(function(){ml(this,e)})}function K_(e,t){var r,s;return function(){var i=Tn(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 X_(e,t,r){var s,i;if(typeof r!="function")throw new Error;return function(){var a=Tn(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 Q_(e,t){var r=this._id;if(e+="",arguments.length<2){for(var s=dn(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?K_:X_)(r,e,t))}function Zc(e,t,r){var s=e._id;return e.each(function(){var i=Tn(this,s);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return dn(i,s).value[t]}}function _h(e,t){var r;return(typeof t=="number"?fr:t instanceof Ds?ch:(r=Ds(t))?(t=r,ch):b_)(e,t)}function q_(e){return function(){this.removeAttribute(e)}}function J_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Z_(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 ew(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 tw(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 nw(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 rw(e,t){var r=el(e),s=r==="transform"?M_:_h;return this.attrTween(e,typeof t=="function"?(r.local?nw:tw)(r,s,Zc(this,"attr."+e,t)):t==null?(r.local?J_:q_)(r):(r.local?ew:Z_)(r,s,t))}function ow(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function sw(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function iw(e,t){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&sw(e,a)),r}return i._value=t,i}function lw(e,t){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&ow(e,a)),r}return i._value=t,i}function aw(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=el(e);return this.tween(r,(s.local?iw:lw)(s,t))}function cw(e,t){return function(){Jc(this,e).delay=+t.apply(this,arguments)}}function uw(e,t){return t=+t,function(){Jc(this,e).delay=t}}function dw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cw:uw)(t,e)):dn(this.node(),t).delay}function fw(e,t){return function(){Tn(this,e).duration=+t.apply(this,arguments)}}function pw(e,t){return t=+t,function(){Tn(this,e).duration=t}}function hw(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fw:pw)(t,e)):dn(this.node(),t).duration}function mw(e,t){if(typeof t!="function")throw new Error;return function(){Tn(this,e).ease=t}}function gw(e){var t=this._id;return arguments.length?this.each(mw(t,e)):dn(this.node(),t).ease}function Ew(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Tn(this,e).ease=r}}function yw(e){if(typeof e!="function")throw new Error;return this.each(Ew(this._id,e))}function vw(e){typeof e!="function"&&(e=jp(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 zn(s,this._parents,this._name,this._id)}function xw(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),y,v=0;v<m;++v)(y=f[v]||p[v])&&(E[v]=y);for(;u<s;++u)c[u]=t[u];return new zn(c,this._parents,this._name,this._id)}function Sw(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 _w(e,t,r){var s,i,a=Sw(t)?Jc:Tn;return function(){var c=a(this,e),u=c.on;u!==s&&(i=(s=u).copy()).on(t,r),c.on=i}}function ww(e,t){var r=this._id;return arguments.length<2?dn(this.node(),r).on.on(e):this.each(_w(r,e,t))}function Rw(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",Rw(this._id))}function Ow(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Fc(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,y=0;y<f;++y)(m=u[y])&&(E=e.call(m,m.__data__,y,u))&&("__data__"in m&&(E.__data__=m.__data__),p[y]=E,hl(p[y],t,r,y,p,dn(m,r)));return new zn(a,this._parents,t,r)}function Tw(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Fp(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 y=e.call(m,m.__data__,E,f),v,w=dn(m,r),_=0,S=y.length;_<S;++_)(v=y[_])&&hl(v,t,r,_,y,w);a.push(y),c.push(m)}return new zn(a,c,t,r)}var Cw=Cs.prototype.constructor;function Aw(){return new Cw(this._groups,this._parents)}function Iw(e,t){var r,s,i;return function(){var a=So(this,e),c=(this.style.removeProperty(e),So(this,e));return a===c?null:a===r&&c===s?i:i=t(r=a,s=c)}}function wh(e){return function(){this.style.removeProperty(e)}}function bw(e,t,r){var s,i=r+"",a;return function(){var c=So(this,e);return c===i?null:c===s?a:a=t(s=c,r)}}function Lw(e,t,r){var s,i,a;return function(){var c=So(this,e),u=r(this),f=u+"";return u==null&&(f=u=(this.style.removeProperty(e),So(this,e))),c===f?null:c===s&&f===i?a:(i=f,a=t(s=c,u))}}function Dw(e,t){var r,s,i,a="style."+t,c="end."+a,u;return function(){var f=Tn(this,e),p=f.on,m=f.value[a]==null?u||(u=wh(t)):void 0;(p!==r||i!==m)&&(s=(r=p).copy()).on(c,i=m),f.on=s}}function kw(e,t,r){var s=(e+="")=="transform"?k_:_h;return t==null?this.styleTween(e,Iw(e,s)).on("end.style."+e,wh(e)):typeof t=="function"?this.styleTween(e,Lw(e,s,Zc(this,"style."+e,t))).each(Dw(this._id,e)):this.styleTween(e,bw(e,s,t),r).on("end.style."+e,null)}function Mw(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)&&Mw(e,c,r)),s}return a._value=t,a}function Uw(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 Fw(e){return function(){this.textContent=e}}function jw(e){return function(){var t=e(this);this.textContent=t??""}}function Vw(e){return this.tween("text",typeof e=="function"?jw(Zc(this,"text",e)):Fw(e==null?"":e+""))}function $w(e){return function(t){this.textContent=e.call(this,t)}}function Hw(e){var t,r;function s(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&$w(i)),t}return s._value=e,s}function Bw(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,Hw(e))}function zw(){for(var e=this._name,t=this._id,r=Rh(),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=dn(f,t);hl(f,e,r,p,c,{time:m.time+m.delay+m.duration,delay:0,duration:m.duration,ease:m.ease})}return new zn(s,this._parents,e,r)}function Ww(){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=Tn(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 Gw=0;function zn(e,t,r,s){this._groups=e,this._parents=t,this._name=r,this._id=s}function Rh(){return++Gw}var Wn=Cs.prototype;zn.prototype={constructor:zn,select:Ow,selectAll:Tw,selectChild:Wn.selectChild,selectChildren:Wn.selectChildren,filter:vw,merge:xw,selection:Aw,transition:zw,call:Wn.call,nodes:Wn.nodes,node:Wn.node,size:Wn.size,empty:Wn.empty,each:Wn.each,on:ww,attr:rw,attrTween:aw,style:kw,styleTween:Uw,text:Vw,textTween:Bw,remove:Nw,tween:Q_,delay:dw,duration:hw,ease:gw,easeVarying:yw,end:Ww,[Symbol.iterator]:Wn[Symbol.iterator]};function Yw(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Kw={time:null,delay:0,duration:250,ease:Yw};function Xw(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 Qw(e){var t,r;e instanceof zn?(t=e._id,e=e._name):(t=Rh(),(r=Kw).time=Kc(),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])&&hl(f,e,t,p,c,r||Xw(f,t));return new zn(s,this._parents,e,t)}Cs.prototype.interrupt=Y_,Cs.prototype.transition=Qw;const gl=e=>()=>e;function qw(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 Gn(e,t,r){this.k=e,this.x=t,this.y=r}Gn.prototype={constructor:Gn,scale:function(e){return e===1?this:new Gn(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Gn(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 pr=new Gn(1,0,0);Gn.prototype;function eu(e){e.stopImmediatePropagation()}function Fs(e){e.preventDefault(),e.stopImmediatePropagation()}function Jw(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zw(){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 Nh(){return this.__zoom||pr}function eR(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tR(){return navigator.maxTouchPoints||"ontouchstart"in this}function nR(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 rR(){var e=Jw,t=Zw,r=nR,s=eR,i=tR,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,f=j_,p=Ji("start","zoom","end"),m,E,y,v=500,w=150,_=0,S=10;function R(C){C.property("__zoom",Nh).on("wheel.zoom",K,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",G).filter(i).on("touchstart.zoom",te).on("touchmove.zoom",re).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}R.transform=function(C,z,H,W){var P=C.selection?C.selection():C;P.property("__zoom",Nh),C!==P?L(C,z,H,W):P.interrupt().each(function(){D(this,arguments).event(W).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},R.scaleBy=function(C,z,H,W){R.scaleTo(C,function(){var P=this.__zoom.k,U=typeof z=="function"?z.apply(this,arguments):z;return P*U},H,W)},R.scaleTo=function(C,z,H,W){R.transform(C,function(){var P=t.apply(this,arguments),U=this.__zoom,$=H==null?T(P):typeof H=="function"?H.apply(this,arguments):H,k=U.invert($),j=typeof z=="function"?z.apply(this,arguments):z;return r(b(N(U,j),$,k),P,c)},H,W)},R.translateBy=function(C,z,H,W){R.transform(C,function(){return r(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof H=="function"?H.apply(this,arguments):H),t.apply(this,arguments),c)},null,W)},R.translateTo=function(C,z,H,W,P){R.transform(C,function(){var U=t.apply(this,arguments),$=this.__zoom,k=W==null?T(U):typeof W=="function"?W.apply(this,arguments):W;return r(pr.translate(k[0],k[1]).scale($.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof H=="function"?-H.apply(this,arguments):-H),U,c)},W,P)};function N(C,z){return z=Math.max(a[0],Math.min(a[1],z)),z===C.k?C:new Gn(z,C.x,C.y)}function b(C,z,H){var W=z[0]-H[0]*C.k,P=z[1]-H[1]*C.k;return W===C.x&&P===C.y?C:new Gn(C.k,W,P)}function T(C){return[(+C[0][0]+ +C[1][0])/2,(+C[0][1]+ +C[1][1])/2]}function L(C,z,H,W){C.on("start.zoom",function(){D(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(W).end()}).tween("zoom",function(){var P=this,U=arguments,$=D(P,U).event(W),k=t.apply(P,U),j=H==null?T(k):typeof H=="function"?H.apply(P,U):H,ee=Math.max(k[1][0]-k[0][0],k[1][1]-k[0][1]),oe=P.__zoom,se=typeof z=="function"?z.apply(P,U):z,ue=f(oe.invert(j).concat(ee/oe.k),se.invert(j).concat(ee/se.k));return function(pe){if(pe===1)pe=se;else{var de=ue(pe),he=ee/de[2];pe=new Gn(he,j[0]-de[0]*he,j[1]-de[1]*he)}$.zoom(null,pe)}})}function D(C,z,H){return!H&&C.__zooming||new V(C,z)}function V(C,z){this.that=C,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(C,z),this.taps=0}V.prototype={event:function(C){return C&&(this.sourceEvent=C),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(C,z){return this.mouse&&C!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&C!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&C!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(C){var z=cn(this.that).datum();p.call(C,this.that,new qw(C,{sourceEvent:this.sourceEvent,target:R,transform:this.that.__zoom,dispatch:p}),z)}};function K(C,...z){if(!e.apply(this,arguments))return;var H=D(this,z).event(C),W=this.__zoom,P=Math.max(a[0],Math.min(a[1],W.k*Math.pow(2,s.apply(this,arguments)))),U=Nn(C);if(H.wheel)(H.mouse[0][0]!==U[0]||H.mouse[0][1]!==U[1])&&(H.mouse[1]=W.invert(H.mouse[0]=U)),clearTimeout(H.wheel);else{if(W.k===P)return;H.mouse=[U,W.invert(U)],ml(this),H.start()}Fs(C),H.wheel=setTimeout($,w),H.zoom("mouse",r(b(N(W,P),H.mouse[0],H.mouse[1]),H.extent,c));function $(){H.wheel=null,H.end()}}function X(C,...z){if(y||!e.apply(this,arguments))return;var H=C.currentTarget,W=D(this,z,!0).event(C),P=cn(C.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",ee,!0),U=Nn(C,H),$=C.clientX,k=C.clientY;Xp(C.view),eu(C),W.mouse=[U,this.__zoom.invert(U)],ml(this),W.start();function j(oe){if(Fs(oe),!W.moved){var se=oe.clientX-$,ue=oe.clientY-k;W.moved=se*se+ue*ue>_}W.event(oe).zoom("mouse",r(b(W.that.__zoom,W.mouse[0]=Nn(oe,H),W.mouse[1]),W.extent,c))}function ee(oe){P.on("mousemove.zoom mouseup.zoom",null),Qp(oe.view,W.moved),Fs(oe),W.event(oe).end()}}function G(C,...z){if(e.apply(this,arguments)){var H=this.__zoom,W=Nn(C.changedTouches?C.changedTouches[0]:C,this),P=H.invert(W),U=H.k*(C.shiftKey?.5:2),$=r(b(N(H,U),W,P),t.apply(this,z),c);Fs(C),u>0?cn(this).transition().duration(u).call(L,$,W,C):cn(this).call(R.transform,$,W,C)}}function te(C,...z){if(e.apply(this,arguments)){var H=C.touches,W=H.length,P=D(this,z,C.changedTouches.length===W).event(C),U,$,k,j;for(eu(C),$=0;$<W;++$)k=H[$],j=Nn(k,this),j=[j,this.__zoom.invert(j),k.identifier],P.touch0?!P.touch1&&P.touch0[2]!==j[2]&&(P.touch1=j,P.taps=0):(P.touch0=j,U=!0,P.taps=1+!!m);m&&(m=clearTimeout(m)),U&&(P.taps<2&&(E=j[0],m=setTimeout(function(){m=null},v)),ml(this),P.start())}}function re(C,...z){if(this.__zooming){var H=D(this,z).event(C),W=C.changedTouches,P=W.length,U,$,k,j;for(Fs(C),U=0;U<P;++U)$=W[U],k=Nn($,this),H.touch0&&H.touch0[2]===$.identifier?H.touch0[0]=k:H.touch1&&H.touch1[2]===$.identifier&&(H.touch1[0]=k);if($=H.that.__zoom,H.touch1){var ee=H.touch0[0],oe=H.touch0[1],se=H.touch1[0],ue=H.touch1[1],pe=(pe=se[0]-ee[0])*pe+(pe=se[1]-ee[1])*pe,de=(de=ue[0]-oe[0])*de+(de=ue[1]-oe[1])*de;$=N($,Math.sqrt(pe/de)),k=[(ee[0]+se[0])/2,(ee[1]+se[1])/2],j=[(oe[0]+ue[0])/2,(oe[1]+ue[1])/2]}else if(H.touch0)k=H.touch0[0],j=H.touch0[1];else return;H.zoom("touch",r(b($,k,j),H.extent,c))}}function J(C,...z){if(this.__zooming){var H=D(this,z).event(C),W=C.changedTouches,P=W.length,U,$;for(eu(C),y&&clearTimeout(y),y=setTimeout(function(){y=null},v),U=0;U<P;++U)$=W[U],H.touch0&&H.touch0[2]===$.identifier?delete H.touch0:H.touch1&&H.touch1[2]===$.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&($=Nn($,this),Math.hypot(E[0]-$[0],E[1]-$[1])<S)){var k=cn(this).on("dblclick.zoom");k&&k.apply(this,arguments)}}}return R.wheelDelta=function(C){return arguments.length?(s=typeof C=="function"?C:gl(+C),R):s},R.filter=function(C){return arguments.length?(e=typeof C=="function"?C:gl(!!C),R):e},R.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:gl(!!C),R):i},R.extent=function(C){return arguments.length?(t=typeof C=="function"?C:gl([[+C[0][0],+C[0][1]],[+C[1][0],+C[1][1]]]),R):t},R.scaleExtent=function(C){return arguments.length?(a[0]=+C[0],a[1]=+C[1],R):[a[0],a[1]]},R.translateExtent=function(C){return arguments.length?(c[0][0]=+C[0][0],c[1][0]=+C[1][0],c[0][1]=+C[0][1],c[1][1]=+C[1][1],R):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},R.constrain=function(C){return arguments.length?(r=C,R):r},R.duration=function(C){return arguments.length?(u=+C,R):u},R.interpolate=function(C){return arguments.length?(f=C,R):f},R.on=function(){var C=p.on.apply(p,arguments);return C===p?R:C},R.clickDistance=function(C){return arguments.length?(_=(C=+C)*C,R):Math.sqrt(_)},R.tapDistance=function(C){return arguments.length?(S=+C,R):S},R}var tu=Rp();const El=I.createContext(null),oR=El.Provider,Yn={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.`},Oh=Yn.error001();function Ue(e,t){const r=I.useContext(El);if(r===null)throw new Error(Oh);return Dp(r,e,t)}const rt=()=>{const e=I.useContext(El);if(e===null)throw new Error(Oh);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},sR=e=>e.userSelectionActive?"none":"all";function js({position:e,children:t,className:r,style:s,...i}){const a=Ue(sR),c=`${e}`.split("-");return ne.createElement("div",{className:_t(["react-flow__panel",r,...c]),style:{...s,pointerEvents:a},...i},t)}function iR({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:ne.createElement(js,{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 lR=({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=I.useRef(null),[y,v]=I.useState({x:0,y:0,width:0,height:0}),w=_t(["react-flow__edge-textwrapper",p]);return I.useEffect(()=>{if(E.current){const _=E.current.getBBox();v({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),typeof r>"u"||!r?null:ne.createElement("g",{transform:`translate(${e-y.width/2} ${t-y.height/2})`,className:w,visibility:y.width?"visible":"hidden",...m},i&&ne.createElement("rect",{width:y.width+2*c[0],x:-c[0],y:-c[1],height:y.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),ne.createElement("text",{className:"react-flow__edge-text",y:y.height/2,dy:"0.3em",ref:E,style:s},r),f)};var aR=I.memo(lR);const nu=e=>({width:e.offsetWidth,height:e.offsetHeight}),No=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),ru=(e={x:0,y:0},t)=>({x:No(e.x,t[0][0],t[1][0]),y:No(e.y,t[0][1],t[1][1])}),Th=(e,t,r)=>e<t?No(Math.abs(e-t),1,50)/50:e>r?-No(Math.abs(e-r),1,50)/50:0,Ch=(e,t)=>{const r=Th(e.x,35,t.width-35)*20,s=Th(e.y,35,t.height-35)*20;return[r,s]},Ah=e=>e.getRootNode?.()||window?.document,cR=(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)}),ou=({x:e,y:t,width:r,height:s})=>({x:e,y:t,x2:e+r,y2:t+s}),uR=({x:e,y:t,x2:r,y2:s})=>({x:e,y:t,width:r-e,height:s-t}),Ih=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),su=(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)},dR=e=>Yt(e.width)&&Yt(e.height)&&Yt(e.x)&&Yt(e.y),Yt=e=>!isNaN(e)&&isFinite(e),Ye=Symbol.for("internals"),bh=["Enter"," ","Escape"],fR=(e,t)=>{},pR=e=>"nativeEvent"in e;function iu(e){const r=(pR(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const Lh=e=>"clientX"in e,hr=(e,t)=>{const r=Lh(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)}},yl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Oo=({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:y,interactionWidth:v=20})=>ne.createElement(ne.Fragment,null,ne.createElement("path",{id:e,style:m,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:E,markerStart:y}),v&&ne.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:v,className:"react-flow__edge-interaction"}),i&&Yt(r)&&Yt(s)?ne.createElement(aR,{x:r,y:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p}):null);Oo.displayName="BaseEdge";function Vs(e,t,r){return r===void 0?r:s=>{const i=t().edges.find(a=>a.id===e);i&&r(s,{...i})}}function Dh({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 kh({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 mr;(function(e){e.Strict="strict",e.Loose="loose"})(mr||(mr={}));var Yr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Yr||(Yr={}));var $s;(function(e){e.Partial="partial",e.Full="full"})($s||($s={}));var gr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(gr||(gr={}));var Hs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Hs||(Hs={}));var xe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(xe||(xe={}));function Mh({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 Ph({sourceX:e,sourceY:t,sourcePosition:r=xe.Bottom,targetX:s,targetY:i,targetPosition:a=xe.Top}){const[c,u]=Mh({pos:r,x1:e,y1:t,x2:s,y2:i}),[f,p]=Mh({pos:a,x1:s,y1:i,x2:e,y2:t}),[m,E,y,v]=kh({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,y,v]}const lu=I.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:y,markerEnd:v,markerStart:w,interactionWidth:_})=>{const[S,R,N]=Ph({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:s,targetPosition:a});return ne.createElement(Oo,{path:S,labelX:R,labelY:N,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:y,markerEnd:v,markerStart:w,interactionWidth:_})});lu.displayName="SimpleBezierEdge";const Uh={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},hR=({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},Fh=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function mR({source:e,sourcePosition:t=xe.Bottom,target:r,targetPosition:s=xe.Top,center:i,offset:a}){const c=Uh[t],u=Uh[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=hR({source:f,sourcePosition:t,target:p}),E=m.x!==0?"x":"y",y=m[E];let v=[],w,_;const S={x:0,y:0},R={x:0,y:0},[N,b,T,L]=Dh({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(c[E]*u[E]===-1){w=i.x??N,_=i.y??b;const V=[{x:w,y:f.y},{x:w,y:p.y}],K=[{x:f.x,y:_},{x:p.x,y:_}];c[E]===y?v=E==="x"?V:K:v=E==="x"?K:V}else{const V=[{x:f.x,y:p.y}],K=[{x:p.x,y:f.y}];if(E==="x"?v=c.x===y?K:V:v=c.y===y?V:K,t===s){const J=Math.abs(e[E]-r[E]);if(J<=a){const C=Math.min(a-1,a-J);c[E]===y?S[E]=(f[E]>e[E]?-1:1)*C:R[E]=(p[E]>r[E]?-1:1)*C}}if(t!==s){const J=E==="x"?"y":"x",C=c[E]===u[J],z=f[J]>p[J],H=f[J]<p[J];(c[E]===1&&(!C&&z||C&&H)||c[E]!==1&&(!C&&H||C&&z))&&(v=E==="x"?V:K)}const X={x:f.x+S.x,y:f.y+S.y},G={x:p.x+R.x,y:p.y+R.y},te=Math.max(Math.abs(X.x-v[0].x),Math.abs(G.x-v[0].x)),re=Math.max(Math.abs(X.y-v[0].y),Math.abs(G.y-v[0].y));te>=re?(w=(X.x+G.x)/2,_=v[0].y):(w=v[0].x,_=(X.y+G.y)/2)}return[[e,{x:f.x+S.x,y:f.y+S.y},...v,{x:p.x+R.x,y:p.y+R.y},r],w,_,T,L]}function gR(e,t,r,s){const i=Math.min(Fh(e,t)/2,Fh(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 Bs({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,y,v,w]=mR({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,R,N)=>{let b="";return N>0&&N<m.length-1?b=gR(m[N-1],R,m[N+1],c):b=`${N===0?"M":"L"}${R.x} ${R.y}`,S+=b,S},""),E,y,v,w]}const vl=I.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:y=xe.Top,markerEnd:v,markerStart:w,pathOptions:_,interactionWidth:S})=>{const[R,N,b]=Bs({sourceX:e,sourceY:t,sourcePosition:E,targetX:r,targetY:s,targetPosition:y,borderRadius:_?.borderRadius,offset:_?.offset});return ne.createElement(Oo,{path:R,labelX:N,labelY:b,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:v,markerStart:w,interactionWidth:S})});vl.displayName="SmoothStepEdge";const au=I.memo(e=>ne.createElement(vl,{...e,pathOptions:I.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));au.displayName="StepEdge";function ER({sourceX:e,sourceY:t,targetX:r,targetY:s}){const[i,a,c,u]=Dh({sourceX:e,sourceY:t,targetX:r,targetY:s});return[`M ${e},${t}L ${r},${s}`,i,a,c,u]}const cu=I.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:y,interactionWidth:v})=>{const[w,_,S]=ER({sourceX:e,sourceY:t,targetX:r,targetY:s});return ne.createElement(Oo,{path:w,labelX:_,labelY:S,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:E,markerStart:y,interactionWidth:v})});cu.displayName="StraightEdge";function xl(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function jh({pos:e,x1:t,y1:r,x2:s,y2:i,c:a}){switch(e){case xe.Left:return[t-xl(t-s,a),r];case xe.Right:return[t+xl(s-t,a),r];case xe.Top:return[t,r-xl(r-i,a)];case xe.Bottom:return[t,r+xl(i-r,a)]}}function Vh({sourceX:e,sourceY:t,sourcePosition:r=xe.Bottom,targetX:s,targetY:i,targetPosition:a=xe.Top,curvature:c=.25}){const[u,f]=jh({pos:r,x1:e,y1:t,x2:s,y2:i,c}),[p,m]=jh({pos:a,x1:s,y1:i,x2:e,y2:t,c}),[E,y,v,w]=kh({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,y,v,w]}const Sl=I.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:y,markerEnd:v,markerStart:w,pathOptions:_,interactionWidth:S})=>{const[R,N,b]=Vh({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:s,targetPosition:a,curvature:_?.curvature});return ne.createElement(Oo,{path:R,labelX:N,labelY:b,label:c,labelStyle:u,labelShowBg:f,labelBgStyle:p,labelBgPadding:m,labelBgBorderRadius:E,style:y,markerEnd:v,markerStart:w,interactionWidth:S})});Sl.displayName="BezierEdge";const uu=I.createContext(null),yR=uu.Provider;uu.Consumer;const vR=()=>I.useContext(uu),xR=e=>"id"in e&&"source"in e&&"target"in e,$h=({source:e,sourceHandle:t,target:r,targetHandle:s})=>`reactflow__edge-${e}${t||""}-${r}${s||""}`,du=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(s=>`${s}=${e[s]}`).join("&")}`,SR=(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)),Hh=(e,t)=>{if(!e.source||!e.target)return t;let r;return xR(e)?r={...e}:r={...e,id:$h(e)},SR(r,t)?t:t.concat(r)},_R=(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?$h(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return r.filter(f=>f.id!==i).concat(u)},wR=(e,t,r,s={shouldReplaceId:!0})=>(console.warn("[DEPRECATED] `updateEdge` is deprecated. Instead use `reconnectEdge` https://reactflow.dev/api-reference/utils/reconnect-edge"),_R(e,t,r,s)),fu=({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},Bh=({x:e,y:t},[r,s,i])=>({x:e*i+r,y:t*i+s}),To=(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}},pu=(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}=To(i,t).positionAbsolute;return cR(s,ou({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 uR(r)},zh=(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:y,selectable:v=!0,hidden:w=!1}=m;if(c&&!v||w)return!1;const{positionAbsolute:_}=To(m,u),S={x:_.x,y:_.y,width:E||0,height:y||0},R=su(f,S),N=typeof E>"u"||typeof y>"u"||E===null||y===null,b=a&&R>0,T=(E||0)*(y||0);(N||b||R>=T||m.dragging)&&p.push(m)}),p},Wh=(e,t)=>{const r=e.map(s=>s.id);return t.filter(s=>r.includes(s.source)||r.includes(s.target))},Gh=(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=No(f,s,i),m=e.x+e.width/2,E=e.y+e.height/2,y=t/2-m*p,v=r/2-E*p;return{x:y,y:v,zoom:p}},Kr=(e,t=0)=>e.transition().duration(t);function Yh(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 RR(e,t,r,s,i,a){const{x:c,y:u}=hr(e),p=t.elementsFromPoint(c,u).find(w=>w.classList.contains("react-flow__handle"));if(p){const w=p.getAttribute("data-nodeid");if(w){const _=hu(void 0,p),S=p.getAttribute("data-handleid"),R=a({nodeId:w,id:S,type:_});if(R){const N=i.find(b=>b.nodeId===w&&b.type===_&&b.id===S);return{handle:{id:S,type:_,nodeId:w,x:N?.x||r.x,y:N?.y||r.y},validHandleResult:R}}}}let m=[],E=1/0;if(i.forEach(w=>{const _=Math.sqrt((w.x-r.x)**2+(w.y-r.y)**2);if(_<=s){const S=a(w);_<=E&&(_<E?m=[{handle:w,validHandleResult:S}]:_===E&&m.push({handle:w,validHandleResult:S}),E=_)}}),!m.length)return{handle:null,validHandleResult:Kh()};if(m.length===1)return m[0];const y=m.some(({validHandleResult:w})=>w.isValid),v=m.some(({handle:w})=>w.type==="target");return m.find(({handle:w,validHandleResult:_})=>v?w.type==="target":y?_.isValid:!0)||m[0]}const NR={source:null,target:null,sourceHandle:null,targetHandle:null},Kh=()=>({handleDomNode:null,isValid:!1,connection:NR,endHandle:null});function Xh(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={...Kh(),handleDomNode:f};if(f){const m=hu(void 0,f),E=f.getAttribute("data-nodeid"),y=f.getAttribute("data-handleid"),v=f.classList.contains("connectable"),w=f.classList.contains("connectableend"),_={source:u?E:r,sourceHandle:u?y:s,target:u?r:E,targetHandle:u?s:y};p.connection=_,v&&w&&(t===mr.Strict?u&&m==="source"||!u&&m==="target":E!==r||y!==s)&&(p.endHandle={nodeId:E,handleId:y,type:m},p.isValid=a(_))}return p}function OR({nodes:e,nodeId:t,handleId:r,handleType:s}){return e.reduce((i,a)=>{if(a[Ye]){const{handleBounds:c}=a[Ye];let u=[],f=[];c&&(u=Yh(a,c,"source",`${t}-${r}-${s}`),f=Yh(a,c,"target",`${t}-${r}-${s}`)),i.push(...u,...f)}return i},[])}function hu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function mu(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function TR(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function Qh({event:e,handleId:t,nodeId:r,onConnect:s,isTarget:i,getState:a,setState:c,isValidConnection:u,edgeUpdaterType:f,onReconnectEnd:p}){const m=Ah(e.target),{connectionMode:E,domNode:y,autoPanOnConnect:v,connectionRadius:w,onConnectStart:_,panBy:S,getNodes:R,cancelConnection:N}=a();let b=0,T;const{x:L,y:D}=hr(e),V=m?.elementFromPoint(L,D),K=hu(f,V),X=y?.getBoundingClientRect();if(!X||!K)return;let G,te=hr(e,X),re=!1,J=null,C=!1,z=null;const H=OR({nodes:R(),nodeId:r,handleId:t,handleType:K}),W=()=>{if(!v)return;const[$,k]=Ch(te,X);S({x:$,y:k}),b=requestAnimationFrame(W)};c({connectionPosition:te,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:K,connectionStartHandle:{nodeId:r,handleId:t,type:K},connectionEndHandle:null}),_?.(e,{nodeId:r,handleId:t,handleType:K});function P($){const{transform:k}=a();te=hr($,X);const{handle:j,validHandleResult:ee}=RR($,m,fu(te,k,!1,[1,1]),w,H,oe=>Xh(oe,E,r,t,i?"target":"source",u,m));if(T=j,re||(W(),re=!0),z=ee.handleDomNode,J=ee.connection,C=ee.isValid,c({connectionPosition:T&&C?Bh({x:T.x,y:T.y},k):te,connectionStatus:TR(!!T,C),connectionEndHandle:ee.endHandle}),!T&&!C&&!z)return mu(G);J.source!==J.target&&z&&(mu(G),G=z,z.classList.add("connecting","react-flow__handle-connecting"),z.classList.toggle("valid",C),z.classList.toggle("react-flow__handle-valid",C))}function U($){(T||z)&&J&&C&&s?.(J),a().onConnectEnd?.($),f&&p?.($),mu(G),N(),cancelAnimationFrame(b),re=!1,C=!1,J=null,z=null,m.removeEventListener("mousemove",P),m.removeEventListener("mouseup",U),m.removeEventListener("touchmove",P),m.removeEventListener("touchend",U)}m.addEventListener("mousemove",P),m.addEventListener("mouseup",U),m.addEventListener("touchmove",P),m.addEventListener("touchend",U)}const qh=()=>!0,CR=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),AR=(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}},Jh=I.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,...y},v)=>{const w=c||null,_=e==="target",S=rt(),R=vR(),{connectOnClick:N,noPanClassName:b}=Ue(CR,Et),{connecting:T,clickConnecting:L}=Ue(AR(R,w,e),Et);R||S.getState().onError?.("010",Yn.error010());const D=X=>{const{defaultEdgeOptions:G,onConnect:te,hasDefaultEdges:re}=S.getState(),J={...G,...X};if(re){const{edges:C,setEdges:z}=S.getState();z(Hh(J,C))}te?.(J),u?.(J)},V=X=>{if(!R)return;const G=Lh(X);i&&(G&&X.button===0||!G)&&Qh({event:X,handleId:w,nodeId:R,onConnect:D,isTarget:_,getState:S.getState,setState:S.setState,isValidConnection:r||S.getState().isValidConnection||qh}),G?m?.(X):E?.(X)},K=X=>{const{onClickConnectStart:G,onClickConnectEnd:te,connectionClickStartHandle:re,connectionMode:J,isValidConnection:C}=S.getState();if(!R||!re&&!i)return;if(!re){G?.(X,{nodeId:R,handleId:w,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:R,type:e,handleId:w}});return}const z=Ah(X.target),H=r||C||qh,{connection:W,isValid:P}=Xh({nodeId:R,id:w,type:e},J,re.nodeId,re.handleId||null,re.type,H,z);P&&D(W),te?.(X),S.setState({connectionClickStartHandle:null})};return ne.createElement("div",{"data-handleid":w,"data-nodeid":R,"data-handlepos":t,"data-id":`${R}-${w}-${e}`,className:_t(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,p,{source:!_,target:_,connectable:s,connectablestart:i,connectableend:a,connecting:L,connectionindicator:s&&(i&&!T||a&&T)}]),onMouseDown:V,onTouchStart:V,onClick:N?K:void 0,ref:v,...y},f)});Jh.displayName="Handle";var Co=I.memo(Jh);const Zh=({data:e,isConnectable:t,targetPosition:r=xe.Top,sourcePosition:s=xe.Bottom})=>ne.createElement(ne.Fragment,null,ne.createElement(Co,{type:"target",position:r,isConnectable:t}),e?.label,ne.createElement(Co,{type:"source",position:s,isConnectable:t}));Zh.displayName="DefaultNode";var gu=I.memo(Zh);const em=({data:e,isConnectable:t,sourcePosition:r=xe.Bottom})=>ne.createElement(ne.Fragment,null,e?.label,ne.createElement(Co,{type:"source",position:r,isConnectable:t}));em.displayName="InputNode";var tm=I.memo(em);const nm=({data:e,isConnectable:t,targetPosition:r=xe.Top})=>ne.createElement(ne.Fragment,null,ne.createElement(Co,{type:"target",position:r,isConnectable:t}),e?.label);nm.displayName="OutputNode";var rm=I.memo(nm);const Eu=()=>null;Eu.displayName="GroupNode";const IR=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),_l=e=>e.id;function bR(e,t){return Et(e.selectedNodes.map(_l),t.selectedNodes.map(_l))&&Et(e.selectedEdges.map(_l),t.selectedEdges.map(_l))}const om=I.memo(({onSelectionChange:e})=>{const t=rt(),{selectedNodes:r,selectedEdges:s}=Ue(IR,bR);return I.useEffect(()=>{const i={nodes:r,edges:s};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,s,e]),null});om.displayName="SelectionListener";const LR=e=>!!e.onSelectionChange;function DR({onSelectionChange:e}){const t=Ue(LR);return e||t?ne.createElement(om,{onSelectionChange:e}):null}const kR=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 Ao(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ce(e,t,r){I.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const MR=({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:y,edgesUpdatable:v,elevateNodesOnSelect:w,minZoom:_,maxZoom:S,nodeExtent:R,onNodesChange:N,onEdgesChange:b,elementsSelectable:T,connectionMode:L,snapGrid:D,snapToGrid:V,translateExtent:K,connectOnClick:X,defaultEdgeOptions:G,fitView:te,fitViewOptions:re,onNodesDelete:J,onEdgesDelete:C,onNodeDrag:z,onNodeDragStart:H,onNodeDragStop:W,onSelectionDrag:P,onSelectionDragStart:U,onSelectionDragStop:$,noPanClassName:k,nodeOrigin:j,rfId:ee,autoPanOnConnect:oe,autoPanOnNodeDrag:se,onError:ue,connectionRadius:pe,isValidConnection:de,nodeDragThreshold:he})=>{const{setNodes:Re,setEdges:je,setDefaultNodesAndEdges:ze,setMinZoom:lt,setMaxZoom:at,setTranslateExtent:qe,setNodeExtent:$t,reset:Me}=Ue(kR,Et),Se=rt();return I.useEffect(()=>{const ht=s?.map(Ht=>({...Ht,...G}));return ze(r,ht),()=>{Me()}},[]),Ce("defaultEdgeOptions",G,Se.setState),Ce("connectionMode",L,Se.setState),Ce("onConnect",i,Se.setState),Ce("onConnectStart",a,Se.setState),Ce("onConnectEnd",c,Se.setState),Ce("onClickConnectStart",u,Se.setState),Ce("onClickConnectEnd",f,Se.setState),Ce("nodesDraggable",p,Se.setState),Ce("nodesConnectable",m,Se.setState),Ce("nodesFocusable",E,Se.setState),Ce("edgesFocusable",y,Se.setState),Ce("edgesUpdatable",v,Se.setState),Ce("elementsSelectable",T,Se.setState),Ce("elevateNodesOnSelect",w,Se.setState),Ce("snapToGrid",V,Se.setState),Ce("snapGrid",D,Se.setState),Ce("onNodesChange",N,Se.setState),Ce("onEdgesChange",b,Se.setState),Ce("connectOnClick",X,Se.setState),Ce("fitViewOnInit",te,Se.setState),Ce("fitViewOnInitOptions",re,Se.setState),Ce("onNodesDelete",J,Se.setState),Ce("onEdgesDelete",C,Se.setState),Ce("onNodeDrag",z,Se.setState),Ce("onNodeDragStart",H,Se.setState),Ce("onNodeDragStop",W,Se.setState),Ce("onSelectionDrag",P,Se.setState),Ce("onSelectionDragStart",U,Se.setState),Ce("onSelectionDragStop",$,Se.setState),Ce("noPanClassName",k,Se.setState),Ce("nodeOrigin",j,Se.setState),Ce("rfId",ee,Se.setState),Ce("autoPanOnConnect",oe,Se.setState),Ce("autoPanOnNodeDrag",se,Se.setState),Ce("onError",ue,Se.setState),Ce("connectionRadius",pe,Se.setState),Ce("isValidConnection",de,Se.setState),Ce("nodeDragThreshold",he,Se.setState),Ao(e,Re),Ao(t,je),Ao(_,lt),Ao(S,at),Ao(K,qe),Ao(R,$t),null},sm={display:"none"},PR={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},im="react-flow__node-desc",lm="react-flow__edge-desc",UR="react-flow__aria-live",FR=e=>e.ariaLiveMessage;function jR({rfId:e}){const t=Ue(FR);return ne.createElement("div",{id:`${UR}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:PR},t)}function VR({rfId:e,disableKeyboardA11y:t}){return ne.createElement(ne.Fragment,null,ne.createElement("div",{id:`${im}-${e}`,style:sm},"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:`${lm}-${e}`,style:sm},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&ne.createElement(jR,{rfId:e}))}var Io=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,s]=I.useState(!1),i=I.useRef(!1),a=I.useRef(new Set([])),[c,u]=I.useMemo(()=>{if(e!==null){const p=(Array.isArray(e)?e:[e]).filter(E=>typeof E=="string").map(E=>E.split("+")),m=p.reduce((E,y)=>E.concat(...y),[]);return[p,m]}return[[],[]]},[e]);return I.useEffect(()=>{const f=typeof document<"u"?document:null,p=t?.target||f;if(e!==null){const m=v=>{if(i.current=v.ctrlKey||v.metaKey||v.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&iu(v))return!1;const _=cm(v.code,u);a.current.add(v[_]),am(c,a.current,!1)&&(v.preventDefault(),s(!0))},E=v=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&iu(v))return!1;const _=cm(v.code,u);am(c,a.current,!0)?(s(!1),a.current.clear()):a.current.delete(v[_]),v.key==="Meta"&&a.current.clear(),i.current=!1},y=()=>{a.current.clear(),s(!1)};return p?.addEventListener("keydown",m),p?.addEventListener("keyup",E),window.addEventListener("blur",y),()=>{p?.removeEventListener("keydown",m),p?.removeEventListener("keyup",E),window.removeEventListener("blur",y)}}},[e,s]),r};function am(e,t,r){return e.filter(s=>r||s.length===t.size).some(s=>s.every(i=>t.has(i)))}function cm(e,t){return t.includes(e)?"code":"key"}function um(e,t,r,s){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),c=To(a,s);return um(a,t,{x:(r.x??0)+c.x,y:(r.y??0)+c.y,z:(a[Ye]?.z??0)>(r.z??0)?a[Ye]?.z??0:r.z??0},s)}function dm(e,t,r){e.forEach(s=>{const i=s.parentNode||s.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[s.id]){const{x:a,y:c,z:u}=um(s,e,{...s.position,z:s[Ye]?.z??0},t);s.positionAbsolute={x:a,y:c},s[Ye].z=u,r?.[s.id]&&(s[Ye].isParent=!0)}})}function yu(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={...u,positionAbsolute:{x:u.position.x,y:u.position.y}},E=u.parentNode||u.parentId;E&&(a[E]=!0);const y=p?.type&&p?.type!==u.type;Object.defineProperty(m,Ye,{enumerable:!1,value:{handleBounds:y?void 0:p?.[Ye]?.handleBounds,z:f}}),i.set(u.id,m)}),dm(i,r,a),i}function fm(e,t={}){const{getNodes:r,width:s,height:i,minZoom:a,maxZoom:c,d3Zoom:u,d3Selection:f,fitViewOnInitDone:p,fitViewOnInit:m,nodeOrigin:E}=e(),y=t.initial&&!p&&m;if(u&&f&&(y||!t.initial)){const w=r().filter(S=>{const R=t.includeHiddenNodes?S.width&&S.height:!S.hidden;return t.nodes?.length?R&&t.nodes.some(N=>N.id===S.id):R}),_=w.every(S=>S.width&&S.height);if(w.length>0&&_){const S=pu(w,E),{x:R,y:N,zoom:b}=Gh(S,s,i,t.minZoom??a,t.maxZoom??c,t.padding??.1),T=pr.translate(R,N).scale(b);return typeof t.duration=="number"&&t.duration>0?u.transform(Kr(f,t.duration),T):u.transform(f,T),!0}}return!1}function $R(e,t){return e.forEach(r=>{const s=t.get(r.id);s&&t.set(s.id,{...s,[Ye]:s[Ye],selected:r.selected})}),new Map(t)}function HR(e,t){return t.map(r=>{const s=e.find(i=>i.id===r.id);return s&&(r.selected=s.selected),r})}function wl({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:$R(e,i)}),c?.(e)),t?.length&&(p&&s({edges:HR(t,a)}),u?.(t))}const bo=()=>{},BR={zoomIn:bo,zoomOut:bo,zoomTo:bo,getZoom:()=>1,setViewport:bo,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:bo,fitBounds:bo,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},zR=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),WR=()=>{const e=rt(),{d3Zoom:t,d3Selection:r}=Ue(zR,Et);return I.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(Kr(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(Kr(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(Kr(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[c,u,f]=e.getState().transform,p=pr.translate(i.x??c,i.y??u).scale(i.zoom??f);t.transform(Kr(r,a?.duration),p)},getViewport:()=>{const[i,a,c]=e.getState().transform;return{x:i,y:a,zoom:c}},fitView:i=>fm(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,y=f/2-a*m,v=pr.translate(E,y).scale(m);t.transform(Kr(r,c?.duration),v)},fitBounds:(i,a)=>{const{width:c,height:u,minZoom:f,maxZoom:p}=e.getState(),{x:m,y:E,zoom:y}=Gh(i,c,u,f,p,a?.padding??.1),v=pr.translate(m,E).scale(y);t.transform(Kr(r,a?.duration),v)},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"),fu(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 fu(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=Bh(i,a);return{x:p.x+u,y:p.y+f}},viewportInitialized:!0}:BR,[t,r])};function vu(){const e=WR(),t=rt(),r=I.useCallback(()=>t.getState().getNodes().map(_=>({..._})),[]),s=I.useCallback(_=>t.getState().nodeInternals.get(_),[]),i=I.useCallback(()=>{const{edges:_=[]}=t.getState();return _.map(S=>({...S}))},[]),a=I.useCallback(_=>{const{edges:S=[]}=t.getState();return S.find(R=>R.id===_)},[]),c=I.useCallback(_=>{const{getNodes:S,setNodes:R,hasDefaultNodes:N,onNodesChange:b}=t.getState(),T=S(),L=typeof _=="function"?_(T):_;if(N)R(L);else if(b){const D=L.length===0?T.map(V=>({type:"remove",id:V.id})):L.map(V=>({item:V,type:"reset"}));b(D)}},[]),u=I.useCallback(_=>{const{edges:S=[],setEdges:R,hasDefaultEdges:N,onEdgesChange:b}=t.getState(),T=typeof _=="function"?_(S):_;if(N)R(T);else if(b){const L=T.length===0?S.map(D=>({type:"remove",id:D.id})):T.map(D=>({item:D,type:"reset"}));b(L)}},[]),f=I.useCallback(_=>{const S=Array.isArray(_)?_:[_],{getNodes:R,setNodes:N,hasDefaultNodes:b,onNodesChange:T}=t.getState();if(b){const D=[...R(),...S];N(D)}else if(T){const L=S.map(D=>({item:D,type:"add"}));T(L)}},[]),p=I.useCallback(_=>{const S=Array.isArray(_)?_:[_],{edges:R=[],setEdges:N,hasDefaultEdges:b,onEdgesChange:T}=t.getState();if(b)N([...R,...S]);else if(T){const L=S.map(D=>({item:D,type:"add"}));T(L)}},[]),m=I.useCallback(()=>{const{getNodes:_,edges:S=[],transform:R}=t.getState(),[N,b,T]=R;return{nodes:_().map(L=>({...L})),edges:S.map(L=>({...L})),viewport:{x:N,y:b,zoom:T}}},[]),E=I.useCallback(({nodes:_,edges:S})=>{const{nodeInternals:R,getNodes:N,edges:b,hasDefaultNodes:T,hasDefaultEdges:L,onNodesDelete:D,onEdgesDelete:V,onNodesChange:K,onEdgesChange:X}=t.getState(),G=(_||[]).map(z=>z.id),te=(S||[]).map(z=>z.id),re=N().reduce((z,H)=>{const W=H.parentNode||H.parentId,P=!G.includes(H.id)&&W&&z.find($=>$.id===W);return(typeof H.deletable!="boolean"||H.deletable)&&(G.includes(H.id)||P)&&z.push(H),z},[]),J=b.filter(z=>typeof z.deletable=="boolean"?z.deletable:!0),C=J.filter(z=>te.includes(z.id));if(re||C){const z=Wh(re,J),H=[...C,...z],W=H.reduce((P,U)=>(P.includes(U.id)||P.push(U.id),P),[]);if((L||T)&&(L&&t.setState({edges:b.filter(P=>!W.includes(P.id))}),T&&(re.forEach(P=>{R.delete(P.id)}),t.setState({nodeInternals:new Map(R)}))),W.length>0&&(V?.(H),X&&X(W.map(P=>({id:P,type:"remove"})))),re.length>0&&(D?.(re),K)){const P=re.map(U=>({id:U.id,type:"remove"}));K(P)}}},[]),y=I.useCallback(_=>{const S=dR(_),R=S?null:t.getState().nodeInternals.get(_.id);return!S&&!R?[null,null,S]:[S?_:Ih(R),R,S]},[]),v=I.useCallback((_,S=!0,R)=>{const[N,b,T]=y(_);return N?(R||t.getState().getNodes()).filter(L=>{if(!T&&(L.id===b.id||!L.positionAbsolute))return!1;const D=Ih(L),V=su(D,N);return S&&V>0||V>=N.width*N.height}):[]},[]),w=I.useCallback((_,S,R=!0)=>{const[N]=y(_);if(!N)return!1;const b=su(N,S);return R&&b>0||b>=N.width*N.height},[]);return I.useMemo(()=>({...e,getNodes:r,getNode:s,getEdges:i,getEdge:a,setNodes:c,setEdges:u,addNodes:f,addEdges:p,toObject:m,deleteElements:E,getIntersectingNodes:v,isNodeIntersecting:w}),[e,r,s,i,a,c,u,f,p,m,E,v,w])}const GR={actInsideInputWithModifier:!1};var YR=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=rt(),{deleteElements:s}=vu(),i=Io(e,GR),a=Io(t);I.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]),I.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function KR(e){const t=rt();I.useEffect(()=>{let r;const s=()=>{if(!e.current)return;const i=nu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Yn.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 xu={position:"absolute",width:"100%",height:"100%",top:0,left:0},XR=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Rl=e=>({x:e.x,y:e.y,zoom:e.k}),Lo=(e,t)=>e.target.closest(`.${t}`),pm=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),hm=e=>{const t=e.ctrlKey&&yl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},QR=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),qR=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:s,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:c=!1,panOnScrollSpeed:u=.5,panOnScrollMode:f=Yr.Free,zoomOnDoubleClick:p=!0,elementsSelectable:m,panOnDrag:E=!0,defaultViewport:y,translateExtent:v,minZoom:w,maxZoom:_,zoomActivationKeyCode:S,preventScrolling:R=!0,children:N,noWheelClassName:b,noPanClassName:T})=>{const L=I.useRef(),D=rt(),V=I.useRef(!1),K=I.useRef(!1),X=I.useRef(null),G=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:te,d3Selection:re,d3ZoomHandler:J,userSelectionActive:C}=Ue(QR,Et),z=Io(S),H=I.useRef(0),W=I.useRef(!1),P=I.useRef();return KR(X),I.useEffect(()=>{if(X.current){const U=X.current.getBoundingClientRect(),$=rR().scaleExtent([w,_]).translateExtent(v),k=cn(X.current).call($),j=pr.translate(y.x,y.y).scale(No(y.zoom,w,_)),ee=[[0,0],[U.width,U.height]],oe=$.constrain()(j,ee,v);$.transform(k,oe),$.wheelDelta(hm),D.setState({d3Zoom:$,d3Selection:k,d3ZoomHandler:k.on("wheel.zoom"),transform:[oe.x,oe.y,oe.k],domNode:X.current.closest(".react-flow")})}},[]),I.useEffect(()=>{re&&te&&(c&&!z&&!C?re.on("wheel.zoom",U=>{if(Lo(U,b))return!1;U.preventDefault(),U.stopImmediatePropagation();const $=re.property("__zoom").k||1;if(U.ctrlKey&&a){const de=Nn(U),he=hm(U),Re=$*Math.pow(2,he);te.scaleTo(re,Re,de,U);return}const k=U.deltaMode===1?20:1;let j=f===Yr.Vertical?0:U.deltaX*k,ee=f===Yr.Horizontal?0:U.deltaY*k;!yl()&&U.shiftKey&&f!==Yr.Vertical&&(j=U.deltaY*k,ee=0),te.translateBy(re,-(j/$)*u,-(ee/$)*u,{internal:!0});const oe=Rl(re.property("__zoom")),{onViewportChangeStart:se,onViewportChange:ue,onViewportChangeEnd:pe}=D.getState();clearTimeout(P.current),W.current||(W.current=!0,t?.(U,oe),se?.(oe)),W.current&&(e?.(U,oe),ue?.(oe),P.current=setTimeout(()=>{r?.(U,oe),pe?.(oe),W.current=!1},150))},{passive:!1}):typeof J<"u"&&re.on("wheel.zoom",function(U,$){if(!R&&U.type==="wheel"&&!U.ctrlKey||Lo(U,b))return null;U.preventDefault(),J.call(this,U,$)},{passive:!1}))},[C,c,f,re,te,J,z,a,R,b,t,e,r]),I.useEffect(()=>{te&&te.on("start",U=>{if(!U.sourceEvent||U.sourceEvent.internal)return null;H.current=U.sourceEvent?.button;const{onViewportChangeStart:$}=D.getState(),k=Rl(U.transform);V.current=!0,G.current=k,U.sourceEvent?.type==="mousedown"&&D.setState({paneDragging:!0}),$?.(k),t?.(U.sourceEvent,k)})},[te,t]),I.useEffect(()=>{te&&(C&&!V.current?te.on("zoom",null):C||te.on("zoom",U=>{const{onViewportChange:$}=D.getState();if(D.setState({transform:[U.transform.x,U.transform.y,U.transform.k]}),K.current=!!(s&&pm(E,H.current??0)),(e||$)&&!U.sourceEvent?.internal){const k=Rl(U.transform);$?.(k),e?.(U.sourceEvent,k)}}))},[C,te,e,E,s]),I.useEffect(()=>{te&&te.on("end",U=>{if(!U.sourceEvent||U.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=D.getState();if(V.current=!1,D.setState({paneDragging:!1}),s&&pm(E,H.current??0)&&!K.current&&s(U.sourceEvent),K.current=!1,(r||$)&&XR(G.current,U.transform)){const k=Rl(U.transform);G.current=k,clearTimeout(L.current),L.current=setTimeout(()=>{$?.(k),r?.(U.sourceEvent,k)},c?150:0)}})},[te,c,E,r,s]),I.useEffect(()=>{te&&te.filter(U=>{const $=z||i,k=a&&U.ctrlKey;if((E===!0||Array.isArray(E)&&E.includes(1))&&U.button===1&&U.type==="mousedown"&&(Lo(U,"react-flow__node")||Lo(U,"react-flow__edge")))return!0;if(!E&&!$&&!c&&!p&&!a||C||!p&&U.type==="dblclick"||Lo(U,b)&&U.type==="wheel"||Lo(U,T)&&(U.type!=="wheel"||c&&U.type==="wheel"&&!z)||!a&&U.ctrlKey&&U.type==="wheel"||!$&&!c&&!k&&U.type==="wheel"||!E&&(U.type==="mousedown"||U.type==="touchstart")||Array.isArray(E)&&!E.includes(U.button)&&U.type==="mousedown")return!1;const j=Array.isArray(E)&&E.includes(U.button)||!U.button||U.button<=1;return(!U.ctrlKey||U.type==="wheel")&&j})},[C,te,i,a,c,p,E,m,z]),ne.createElement("div",{className:"react-flow__renderer",ref:X,style:xu},N)},JR=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function ZR(){const{userSelectionActive:e,userSelectionRect:t}=Ue(JR,Et);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 mm(e,t){const r=t.parentNode||t.parentId,s=e.find(i=>i.id===r);if(s){const i=t.position.x+t.width-s.width,a=t.position.y+t.height-s.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(s.style={...s.style},s.style.width=s.style.width??s.width,s.style.height=s.style.height??s.height,i>0&&(s.style.width+=i),a>0&&(s.style.height+=a),t.position.x<0){const c=Math.abs(t.position.x);s.position.x=s.position.x-c,s.style.width+=c,t.position.x=0}if(t.position.y<0){const c=Math.abs(t.position.y);s.position.y=s.position.y-c,s.style.height+=c,t.position.y=0}s.width=s.style.width,s.height=s.style.height}}}function gm(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&&mm(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&&mm(s,c);break}case"remove":return s}return s.push(c),s},r)}function Em(e,t){return gm(e,t)}function eN(e,t){return gm(e,t)}const Er=(e,t)=>({id:e,type:"select",selected:t});function Do(e,t){return e.reduce((r,s)=>{const i=t.includes(s.id);return!s.selected&&i?(s.selected=!0,r.push(Er(s.id,!0))):s.selected&&!i&&(s.selected=!1,r.push(Er(s.id,!1))),r},[])}const Su=(e,t)=>r=>{r.target===t.current&&e?.(r)},tN=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),ym=I.memo(({isSelecting:e,selectionMode:t=$s.Full,panOnDrag:r,onSelectionStart:s,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:c,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:E})=>{const y=I.useRef(null),v=rt(),w=I.useRef(0),_=I.useRef(0),S=I.useRef(),{userSelectionActive:R,elementsSelectable:N,dragging:b}=Ue(tN,Et),T=()=>{v.setState({userSelectionActive:!1,userSelectionRect:null}),w.current=0,_.current=0},L=J=>{a?.(J),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},D=J=>{if(Array.isArray(r)&&r?.includes(2)){J.preventDefault();return}c?.(J)},V=u?J=>u(J):void 0,K=J=>{const{resetSelectedElements:C,domNode:z}=v.getState();if(S.current=z?.getBoundingClientRect(),!N||!e||J.button!==0||J.target!==y.current||!S.current)return;const{x:H,y:W}=hr(J,S.current);C(),v.setState({userSelectionRect:{width:0,height:0,startX:H,startY:W,x:H,y:W}}),s?.(J)},X=J=>{const{userSelectionRect:C,nodeInternals:z,edges:H,transform:W,onNodesChange:P,onEdgesChange:U,nodeOrigin:$,getNodes:k}=v.getState();if(!e||!S.current||!C)return;v.setState({userSelectionActive:!0,nodesSelectionActive:!1});const j=hr(J,S.current),ee=C.startX??0,oe=C.startY??0,se={...C,x:j.x<ee?j.x:ee,y:j.y<oe?j.y:oe,width:Math.abs(j.x-ee),height:Math.abs(j.y-oe)},ue=k(),pe=zh(z,se,W,t===$s.Partial,!0,$),de=Wh(pe,H).map(Re=>Re.id),he=pe.map(Re=>Re.id);if(w.current!==he.length){w.current=he.length;const Re=Do(ue,he);Re.length&&P?.(Re)}if(_.current!==de.length){_.current=de.length;const Re=Do(H,de);Re.length&&U?.(Re)}v.setState({userSelectionRect:se})},G=J=>{if(J.button!==0)return;const{userSelectionRect:C}=v.getState();!R&&C&&J.target===y.current&&L?.(J),v.setState({nodesSelectionActive:w.current>0}),T(),i?.(J)},te=J=>{R&&(v.setState({nodesSelectionActive:w.current>0}),i?.(J)),T()},re=N&&(e||R);return ne.createElement("div",{className:_t(["react-flow__pane",{dragging:b,selection:e}]),onClick:re?void 0:Su(L,y),onContextMenu:Su(D,y),onWheel:Su(V,y),onMouseEnter:re?void 0:f,onMouseDown:re?K:void 0,onMouseMove:re?X:p,onMouseUp:re?G:void 0,onMouseLeave:re?te:m,ref:y,style:xu},E,ne.createElement(ZR,null))});ym.displayName="Pane";function vm(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const s=t.get(r);return s?s.selected?!0:vm(s,t):!1}function xm(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 nN(e,t,r,s){return Array.from(e.values()).filter(i=>(i.selected||i.id===s)&&(!i.parentNode||i.parentId||!vm(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||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function rN(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Sm(e,t,r,s,i=[0,0],a){const c=rN(e,e.extent||s);let u=c;const f=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(f&&e.width&&e.height){const E=r.get(f),{x:y,y:v}=To(E,i).positionAbsolute;u=E&&Yt(y)&&Yt(v)&&Yt(E.width)&&Yt(E.height)?[[y+e.width*i[0],v+e.height*i[1]],[y+E.width-e.width+e.width*i[0],v+E.height-e.height+e.height*i[1]]]:u}else a?.("005",Yn.error005()),u=c;else if(e.extent&&f&&e.extent!=="parent"){const E=r.get(f),{x:y,y:v}=To(E,i).positionAbsolute;u=[[e.extent[0][0]+y,e.extent[0][1]+v],[e.extent[1][0]+y,e.extent[1][1]+v]]}let p={x:0,y:0};if(f){const E=r.get(f);p=To(E,i).positionAbsolute}const m=u&&u!=="parent"?ru(t,u):t;return{position:{x:m.x-p.x,y:m.y-p.y},positionAbsolute:m}}function _u({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 _m=(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,...nu(f)}})};function zs(e,t,r){return r===void 0?r:s=>{const i=t().nodeInternals.get(e);i&&r(s,{...i})}}function wu({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",Yn.error012(e));return}t.setState({nodesSelectionActive:!1}),p.selected?(r||p.selected&&c)&&(a({nodes:[p],edges:[]}),requestAnimationFrame(()=>s?.current?.blur())):i([e])}function oN(){const e=rt();return I.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 Ru(e){return(t,r,s)=>e?.(t,s)}function wm({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:s,nodeId:i,isSelectable:a,selectNodesOnDrag:c}){const u=rt(),[f,p]=I.useState(!1),m=I.useRef([]),E=I.useRef({x:null,y:null}),y=I.useRef(0),v=I.useRef(null),w=I.useRef({x:0,y:0}),_=I.useRef(null),S=I.useRef(!1),R=I.useRef(!1),N=I.useRef(!1),b=oN();return I.useEffect(()=>{if(e?.current){const T=cn(e.current),L=({x:K,y:X})=>{const{nodeInternals:G,onNodeDrag:te,onSelectionDrag:re,updateNodePositions:J,nodeExtent:C,snapGrid:z,snapToGrid:H,nodeOrigin:W,onError:P}=u.getState();E.current={x:K,y:X};let U=!1,$={x:0,y:0,x2:0,y2:0};if(m.current.length>1&&C){const j=pu(m.current,W);$=ou(j)}if(m.current=m.current.map(j=>{const ee={x:K-j.distance.x,y:X-j.distance.y};H&&(ee.x=z[0]*Math.round(ee.x/z[0]),ee.y=z[1]*Math.round(ee.y/z[1]));const oe=[[C[0][0],C[0][1]],[C[1][0],C[1][1]]];m.current.length>1&&C&&!j.extent&&(oe[0][0]=j.positionAbsolute.x-$.x+C[0][0],oe[1][0]=j.positionAbsolute.x+(j.width??0)-$.x2+C[1][0],oe[0][1]=j.positionAbsolute.y-$.y+C[0][1],oe[1][1]=j.positionAbsolute.y+(j.height??0)-$.y2+C[1][1]);const se=Sm(j,ee,G,oe,W,P);return U=U||j.position.x!==se.position.x||j.position.y!==se.position.y,j.position=se.position,j.positionAbsolute=se.positionAbsolute,j}),!U)return;J(m.current,!0,!0),p(!0);const k=i?te:Ru(re);if(k&&_.current){const[j,ee]=_u({nodeId:i,dragItems:m.current,nodeInternals:G});k(_.current,j,ee)}},D=()=>{if(!v.current)return;const[K,X]=Ch(w.current,v.current);if(K!==0||X!==0){const{transform:G,panBy:te}=u.getState();E.current.x=(E.current.x??0)-K/G[2],E.current.y=(E.current.y??0)-X/G[2],te({x:K,y:X})&&L(E.current)}y.current=requestAnimationFrame(D)},V=K=>{const{nodeInternals:X,multiSelectionActive:G,nodesDraggable:te,unselectNodesAndEdges:re,onNodeDragStart:J,onSelectionDragStart:C}=u.getState();R.current=!0;const z=i?J:Ru(C);(!c||!a)&&!G&&i&&(X.get(i)?.selected||re()),i&&a&&c&&wu({id:i,store:u,nodeRef:e});const H=b(K);if(E.current=H,m.current=nN(X,te,H,i),z&&m.current){const[W,P]=_u({nodeId:i,dragItems:m.current,nodeInternals:X});z(K.sourceEvent,W,P)}};if(t)T.on(".drag",null);else{const K=p_().on("start",X=>{const{domNode:G,nodeDragThreshold:te}=u.getState();te===0&&V(X),N.current=!1;const re=b(X);E.current=re,v.current=G?.getBoundingClientRect()||null,w.current=hr(X.sourceEvent,v.current)}).on("drag",X=>{const G=b(X),{autoPanOnNodeDrag:te,nodeDragThreshold:re}=u.getState();if(X.sourceEvent.type==="touchmove"&&X.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&R.current&&te&&(S.current=!0,D()),!R.current){const J=G.xSnapped-(E?.current?.x??0),C=G.ySnapped-(E?.current?.y??0);Math.sqrt(J*J+C*C)>re&&V(X)}(E.current.x!==G.xSnapped||E.current.y!==G.ySnapped)&&m.current&&R.current&&(_.current=X.sourceEvent,w.current=hr(X.sourceEvent,v.current),L(G))}}).on("end",X=>{if(!(!R.current||N.current)&&(p(!1),S.current=!1,R.current=!1,cancelAnimationFrame(y.current),m.current)){const{updateNodePositions:G,nodeInternals:te,onNodeDragStop:re,onSelectionDragStop:J}=u.getState(),C=i?re:Ru(J);if(G(m.current,!1,!1),C){const[z,H]=_u({nodeId:i,dragItems:m.current,nodeInternals:te});C(X.sourceEvent,z,H)}}}).filter(X=>{const G=X.target;return!X.button&&(!r||!xm(G,`.${r}`,e))&&(!s||xm(G,s,e))});return T.call(K),()=>{T.on(".drag",null)}}}},[e,t,r,s,a,u,i,c,b]),f}function Rm(){const e=rt();return I.useCallback(r=>{const{nodeInternals:s,nodeExtent:i,updateNodePositions:a,getNodes:c,snapToGrid:u,snapGrid:f,onError:p,nodesDraggable:m}=e.getState(),E=c().filter(N=>N.selected&&(N.draggable||m&&typeof N.draggable>"u")),y=u?f[0]:5,v=u?f[1]:5,w=r.isShiftPressed?4:1,_=r.x*y*w,S=r.y*v*w,R=E.map(N=>{if(N.positionAbsolute){const b={x:N.positionAbsolute.x+_,y:N.positionAbsolute.y+S};u&&(b.x=f[0]*Math.round(b.x/f[0]),b.y=f[1]*Math.round(b.y/f[1]));const{positionAbsolute:T,position:L}=Sm(N,b,s,i,void 0,p);N.position=L,N.positionAbsolute=T}return N});a(R,!0,!1)},[])}const ko={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var Ws=e=>{const t=({id:r,type:s,data:i,xPos:a,yPos:c,xPosOrigin:u,yPosOrigin:f,selected:p,onClick:m,onMouseEnter:E,onMouseMove:y,onMouseLeave:v,onContextMenu:w,onDoubleClick:_,style:S,className:R,isDraggable:N,isSelectable:b,isConnectable:T,isFocusable:L,selectNodesOnDrag:D,sourcePosition:V,targetPosition:K,hidden:X,resizeObserver:G,dragHandle:te,zIndex:re,isParent:J,noDragClassName:C,noPanClassName:z,initialized:H,disableKeyboardA11y:W,ariaLabel:P,rfId:U,hasHandleBounds:$})=>{const k=rt(),j=I.useRef(null),ee=I.useRef(null),oe=I.useRef(V),se=I.useRef(K),ue=I.useRef(s),pe=b||N||m||E||y||v,de=Rm(),he=zs(r,k.getState,E),Re=zs(r,k.getState,y),je=zs(r,k.getState,v),ze=zs(r,k.getState,w),lt=zs(r,k.getState,_),at=Me=>{const{nodeDragThreshold:Se}=k.getState();if(b&&(!D||!N||Se>0)&&wu({id:r,store:k,nodeRef:j}),m){const ht=k.getState().nodeInternals.get(r);ht&&m(Me,{...ht})}},qe=Me=>{if(!iu(Me)&&!W)if(bh.includes(Me.key)&&b){const Se=Me.key==="Escape";wu({id:r,store:k,unselect:Se,nodeRef:j})}else N&&p&&Object.prototype.hasOwnProperty.call(ko,Me.key)&&(k.setState({ariaLiveMessage:`Moved selected node ${Me.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~c}`}),de({x:ko[Me.key].x,y:ko[Me.key].y,isShiftPressed:Me.shiftKey}))};I.useEffect(()=>()=>{ee.current&&(G?.unobserve(ee.current),ee.current=null)},[]),I.useEffect(()=>{if(j.current&&!X){const Me=j.current;(!H||!$||ee.current!==Me)&&(ee.current&&G?.unobserve(ee.current),G?.observe(Me),ee.current=Me)}},[X,H,$]),I.useEffect(()=>{const Me=ue.current!==s,Se=oe.current!==V,ht=se.current!==K;j.current&&(Me||Se||ht)&&(Me&&(ue.current=s),Se&&(oe.current=V),ht&&(se.current=K),k.getState().updateNodeDimensions([{id:r,nodeElement:j.current,forceUpdate:!0}]))},[r,s,V,K]);const $t=wm({nodeRef:j,disabled:X||!N,noDragClassName:C,handleSelector:te,nodeId:r,isSelectable:b,selectNodesOnDrag:D});return X?null:ne.createElement("div",{className:_t(["react-flow__node",`react-flow__node-${s}`,{[z]:N},R,{selected:p,selectable:b,parent:J,dragging:$t}]),ref:j,style:{zIndex:re,transform:`translate(${u}px,${f}px)`,pointerEvents:pe?"all":"none",visibility:H?"visible":"hidden",...S},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:he,onMouseMove:Re,onMouseLeave:je,onContextMenu:ze,onClick:at,onDoubleClick:lt,onKeyDown:L?qe:void 0,tabIndex:L?0:void 0,role:L?"button":void 0,"aria-describedby":W?void 0:`${im}-${U}`,"aria-label":P},ne.createElement(yR,{value:r},ne.createElement(e,{id:r,data:i,type:s,xPos:a,yPos:c,selected:p,isConnectable:T,sourcePosition:V,targetPosition:K,dragging:$t,dragHandle:te,zIndex:re})))};return t.displayName="NodeWrapper",I.memo(t)};const sN=e=>{const t=e.getNodes().filter(r=>r.selected);return{...pu(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function iN({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const s=rt(),{width:i,height:a,x:c,y:u,transformString:f,userSelectionActive:p}=Ue(sN,Et),m=Rm(),E=I.useRef(null);if(I.useEffect(()=>{r||E.current?.focus({preventScroll:!0})},[r]),wm({nodeRef:E}),p||!i||!a)return null;const y=e?w=>{const _=s.getState().getNodes().filter(S=>S.selected);e(w,_)}:void 0,v=w=>{Object.prototype.hasOwnProperty.call(ko,w.key)&&m({x:ko[w.key].x,y:ko[w.key].y,isShiftPressed:w.shiftKey})};return ne.createElement("div",{className:_t(["react-flow__nodesselection","react-flow__container",t]),style:{transform:f}},ne.createElement("div",{ref:E,className:"react-flow__nodesselection-rect",onContextMenu:y,tabIndex:r?void 0:-1,onKeyDown:r?void 0:v,style:{width:i,height:a,top:u,left:c}}))}var lN=I.memo(iN);const aN=e=>e.nodesSelectionActive,Nm=({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:y,selectionMode:v,onSelectionStart:w,onSelectionEnd:_,multiSelectionKeyCode:S,panActivationKeyCode:R,zoomActivationKeyCode:N,elementsSelectable:b,zoomOnScroll:T,zoomOnPinch:L,panOnScroll:D,panOnScrollSpeed:V,panOnScrollMode:K,zoomOnDoubleClick:X,panOnDrag:G,defaultViewport:te,translateExtent:re,minZoom:J,maxZoom:C,preventScrolling:z,onSelectionContextMenu:H,noWheelClassName:W,noPanClassName:P,disableKeyboardA11y:U})=>{const $=Ue(aN),k=Io(E),j=Io(R),ee=j||G,oe=j||D,se=k||y&&ee!==!0;return YR({deleteKeyCode:u,multiSelectionKeyCode:S}),ne.createElement(qR,{onMove:f,onMoveStart:p,onMoveEnd:m,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:T,zoomOnPinch:L,panOnScroll:oe,panOnScrollSpeed:V,panOnScrollMode:K,zoomOnDoubleClick:X,panOnDrag:!k&&ee,defaultViewport:te,translateExtent:re,minZoom:J,maxZoom:C,zoomActivationKeyCode:N,preventScrolling:z,noWheelClassName:W,noPanClassName:P},ne.createElement(ym,{onSelectionStart:w,onSelectionEnd:_,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:s,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:ee,isSelecting:!!se,selectionMode:v},e,$&&ne.createElement(lN,{onSelectionContextMenu:H,noPanClassName:P,disableKeyboardA11y:U})))};Nm.displayName="FlowRenderer";var cN=I.memo(Nm);function uN(e){return Ue(I.useCallback(r=>e?zh(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function dN(e){const t={input:Ws(e.input||tm),default:Ws(e.default||gu),output:Ws(e.output||rm),group:Ws(e.group||Eu)},r={},s=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=Ws(e[a]||gu),i),r);return{...t,...s}}const fN=({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]},pN=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Om=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:s,elementsSelectable:i,updateNodeDimensions:a,onError:c}=Ue(pN,Et),u=uN(e.onlyRenderVisibleElements),f=I.useRef(),p=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const m=new ResizeObserver(E=>{const y=E.map(v=>({id:v.target.getAttribute("data-id"),nodeElement:v.target,forceUpdate:!0}));a(y)});return f.current=m,m},[]);return I.useEffect(()=>()=>{f?.current?.disconnect()},[]),ne.createElement("div",{className:"react-flow__nodes",style:xu},u.map(m=>{let E=m.type||"default";e.nodeTypes[E]||(c?.("003",Yn.error003(E)),E="default");const y=e.nodeTypes[E]||e.nodeTypes.default,v=!!(m.draggable||t&&typeof m.draggable>"u"),w=!!(m.selectable||i&&typeof m.selectable>"u"),_=!!(m.connectable||r&&typeof m.connectable>"u"),S=!!(m.focusable||s&&typeof m.focusable>"u"),R=e.nodeExtent?ru(m.positionAbsolute,e.nodeExtent):m.positionAbsolute,N=R?.x??0,b=R?.y??0,T=fN({x:N,y:b,width:m.width??0,height:m.height??0,origin:e.nodeOrigin});return ne.createElement(y,{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:N,yPos:b,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:v,isSelectable:w,isConnectable:_,isFocusable:S,resizeObserver:p,dragHandle:m.dragHandle,zIndex:m[Ye]?.z??0,isParent:!!m[Ye]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!m.width&&!!m.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:m.ariaLabel,hasHandleBounds:!!m[Ye]?.handleBounds})}))};Om.displayName="NodeRenderer";var hN=I.memo(Om);const mN=(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,Tm="react-flow__edgeupdater",Cm=({position:e,centerX:t,centerY:r,radius:s=10,onMouseDown:i,onMouseEnter:a,onMouseOut:c,type:u})=>ne.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:c,className:_t([Tm,`${Tm}-${u}`]),cx:mN(t,s,e),cy:gN(r,s,e),r:s,stroke:"transparent",fill:"transparent"}),EN=()=>!0;var Mo=e=>{const t=({id:r,className:s,type:i,data:a,onClick:c,onEdgeDoubleClick:u,selected:f,animated:p,label:m,labelStyle:E,labelShowBg:y,labelBgStyle:v,labelBgPadding:w,labelBgBorderRadius:_,style:S,source:R,target:N,sourceX:b,sourceY:T,targetX:L,targetY:D,sourcePosition:V,targetPosition:K,elementsSelectable:X,hidden:G,sourceHandleId:te,targetHandleId:re,onContextMenu:J,onMouseEnter:C,onMouseMove:z,onMouseLeave:H,reconnectRadius:W,onReconnect:P,onReconnectStart:U,onReconnectEnd:$,markerEnd:k,markerStart:j,rfId:ee,ariaLabel:oe,isFocusable:se,isReconnectable:ue,pathOptions:pe,interactionWidth:de,disableKeyboardA11y:he})=>{const Re=I.useRef(null),[je,ze]=I.useState(!1),[lt,at]=I.useState(!1),qe=rt(),$t=I.useMemo(()=>`url('#${du(j,ee)}')`,[j,ee]),Me=I.useMemo(()=>`url('#${du(k,ee)}')`,[k,ee]);if(G)return null;const Se=Je=>{const{edges:en,addSelectedEdges:Pn,unselectNodesAndEdges:Un,multiSelectionActive:wr}=qe.getState(),Dt=en.find(En=>En.id===r);Dt&&(X&&(qe.setState({nodesSelectionActive:!1}),Dt.selected&&wr?(Un({nodes:[],edges:[Dt]}),Re.current?.blur()):Pn([r])),c&&c(Je,Dt))},ht=Vs(r,qe.getState,u),Ht=Vs(r,qe.getState,J),Jt=Vs(r,qe.getState,C),kn=Vs(r,qe.getState,z),Jn=Vs(r,qe.getState,H),Zt=(Je,en)=>{if(Je.button!==0)return;const{edges:Pn,isValidConnection:Un}=qe.getState(),wr=en?N:R,Dt=(en?re:te)||null,En=en?"target":"source",to=Un||EN,no=en,tr=Pn.find(jn=>jn.id===r);at(!0),U?.(Je,tr,En);const Fn=jn=>{at(!1),$?.(jn,tr,En)};Qh({event:Je,handleId:Dt,nodeId:wr,onConnect:jn=>P?.(tr,jn),isTarget:no,getState:qe.getState,setState:qe.setState,isValidConnection:to,edgeUpdaterType:En,onReconnectEnd:Fn})},Zn=Je=>Zt(Je,!0),Mn=Je=>Zt(Je,!1),hn=()=>ze(!0),mn=()=>ze(!1),er=!X&&!c,gn=Je=>{if(!he&&bh.includes(Je.key)&&X){const{unselectNodesAndEdges:en,addSelectedEdges:Pn,edges:Un}=qe.getState();Je.key==="Escape"?(Re.current?.blur(),en({edges:[Un.find(Dt=>Dt.id===r)]})):Pn([r])}};return ne.createElement("g",{className:_t(["react-flow__edge",`react-flow__edge-${i}`,s,{selected:f,animated:p,inactive:er,updating:je}]),onClick:Se,onDoubleClick:ht,onContextMenu:Ht,onMouseEnter:Jt,onMouseMove:kn,onMouseLeave:Jn,onKeyDown:se?gn:void 0,tabIndex:se?0:void 0,role:se?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":oe===null?void 0:oe||`Edge from ${R} to ${N}`,"aria-describedby":se?`${lm}-${ee}`:void 0,ref:Re},!lt&&ne.createElement(e,{id:r,source:R,target:N,selected:f,animated:p,label:m,labelStyle:E,labelShowBg:y,labelBgStyle:v,labelBgPadding:w,labelBgBorderRadius:_,data:a,style:S,sourceX:b,sourceY:T,targetX:L,targetY:D,sourcePosition:V,targetPosition:K,sourceHandleId:te,targetHandleId:re,markerStart:$t,markerEnd:Me,pathOptions:pe,interactionWidth:de}),ue&&ne.createElement(ne.Fragment,null,(ue==="source"||ue===!0)&&ne.createElement(Cm,{position:V,centerX:b,centerY:T,radius:W,onMouseDown:Zn,onMouseEnter:hn,onMouseOut:mn,type:"source"}),(ue==="target"||ue===!0)&&ne.createElement(Cm,{position:K,centerX:L,centerY:D,radius:W,onMouseDown:Mn,onMouseEnter:hn,onMouseOut:mn,type:"target"})))};return t.displayName="EdgeWrapper",I.memo(t)};function yN(e){const t={default:Mo(e.default||Sl),straight:Mo(e.bezier||cu),step:Mo(e.step||au),smoothstep:Mo(e.step||vl),simplebezier:Mo(e.simplebezier||lu)},r={},s=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=Mo(e[a]||Sl),i),r);return{...t,...s}}function Am(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 Im(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const vN=(e,t,r,s,i,a)=>{const c=Am(r,e,t),u=Am(a,s,i);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y}};function xN({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=ou({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)),y=Math.max(0,Math.min(m.y2,p.y2)-Math.max(m.y,p.y));return Math.ceil(E*y)>0}function bm(e){const t=e?.[Ye]?.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 SN=[{level:0,isMaxLevel:!0,edges:[]}];function _N(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),y=u.selected||m?.selected||E?.selected,v=Math.max(E?.[Ye]?.z||0,m?.[Ye]?.z||0,1e3);p=(f?u.zIndex:0)+(y?v: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?SN:a}function wN(e,t,r){const s=Ue(I.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&&xN({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 _N(s,t,r)}const RN=({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"}),NN=({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"}),Lm={[Hs.Arrow]:RN,[Hs.ArrowClosed]:NN};function ON(e){const t=rt();return I.useMemo(()=>Object.prototype.hasOwnProperty.call(Lm,e)?Lm[e]:(t.getState().onError?.("009",Yn.error009(e)),null),[e])}const TN=({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=ON(t);return f?ne.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"},ne.createElement(f,{color:r,strokeWidth:c})):null},CN=({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=du(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))},Dm=({defaultColor:e,rfId:t})=>{const r=Ue(I.useCallback(CN({defaultColor:e,rfId:t}),[e,t]),(s,i)=>!(s.length!==i.length||s.some((a,c)=>a.id!==i[c].id)));return ne.createElement("defs",null,r.map(s=>ne.createElement(TN,{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})))};Dm.displayName="MarkerDefinitions";var AN=I.memo(Dm);const IN=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}),km=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:s,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:f,onEdgeMouseLeave:p,onEdgeClick:m,onEdgeDoubleClick:E,onReconnect:y,onReconnectStart:v,onReconnectEnd:w,reconnectRadius:_,children:S,disableKeyboardA11y:R})=>{const{edgesFocusable:N,edgesUpdatable:b,elementsSelectable:T,width:L,height:D,connectionMode:V,nodeInternals:K,onError:X}=Ue(IN,Et),G=wN(t,K,r);return L?ne.createElement(ne.Fragment,null,G.map(({level:te,edges:re,isMaxLevel:J})=>ne.createElement("svg",{key:te,style:{zIndex:te},width:L,height:D,className:"react-flow__edges react-flow__container"},J&&ne.createElement(AN,{defaultColor:e,rfId:s}),ne.createElement("g",null,re.map(C=>{const[z,H,W]=bm(K.get(C.source)),[P,U,$]=bm(K.get(C.target));if(!W||!$)return null;let k=C.type||"default";i[k]||(X?.("011",Yn.error011(k)),k="default");const j=i[k]||i.default,ee=V===mr.Strict?U.target:(U.target??[]).concat(U.source??[]),oe=Im(H.source,C.sourceHandle),se=Im(ee,C.targetHandle),ue=oe?.position||xe.Bottom,pe=se?.position||xe.Top,de=!!(C.focusable||N&&typeof C.focusable>"u"),he=C.reconnectable||C.updatable,Re=typeof y<"u"&&(he||b&&typeof he>"u");if(!oe||!se)return X?.("008",Yn.error008(oe,C)),null;const{sourceX:je,sourceY:ze,targetX:lt,targetY:at}=vN(z,oe,ue,P,se,pe);return ne.createElement(j,{key:C.id,id:C.id,className:_t([C.className,a]),type:k,data:C.data,selected:!!C.selected,animated:!!C.animated,hidden:!!C.hidden,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,style:C.style,source:C.source,target:C.target,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerEnd:C.markerEnd,markerStart:C.markerStart,sourceX:je,sourceY:ze,targetX:lt,targetY:at,sourcePosition:ue,targetPosition:pe,elementsSelectable:T,onContextMenu:c,onMouseEnter:u,onMouseMove:f,onMouseLeave:p,onClick:m,onEdgeDoubleClick:E,onReconnect:y,onReconnectStart:v,onReconnectEnd:w,reconnectRadius:_,rfId:s,ariaLabel:C.ariaLabel,isFocusable:de,isReconnectable:Re,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth,disableKeyboardA11y:R})})))),S):null};km.displayName="EdgeRenderer";var bN=I.memo(km);const LN=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function DN({children:e}){const t=Ue(LN);return ne.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function kN(e){const t=vu(),r=I.useRef(!1);I.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const MN={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},Mm=({nodeId:e,handleType:t,style:r,type:s=gr.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:c,handleId:u,toX:f,toY:p,connectionMode:m}=Ue(I.useCallback(D=>({fromNode:D.nodeInternals.get(e),handleId:D.connectionHandleId,toX:(D.connectionPosition.x-D.transform[0])/D.transform[2],toY:(D.connectionPosition.y-D.transform[1])/D.transform[2],connectionMode:D.connectionMode}),[e]),Et),E=c?.[Ye]?.handleBounds;let y=E?.[t];if(m===mr.Loose&&(y=y||E?.[t==="source"?"target":"source"]),!c||!y)return null;const v=u?y.find(D=>D.id===u):y[0],w=v?v.x+v.width/2:(c.width??0)/2,_=v?v.y+v.height/2:c.height??0,S=(c.positionAbsolute?.x??0)+w,R=(c.positionAbsolute?.y??0)+_,N=v?.position,b=N?MN[N]:null;if(!N||!b)return null;if(i)return ne.createElement(i,{connectionLineType:s,connectionLineStyle:r,fromNode:c,fromHandle:v,fromX:S,fromY:R,toX:f,toY:p,fromPosition:N,toPosition:b,connectionStatus:a});let T="";const L={sourceX:S,sourceY:R,sourcePosition:N,targetX:f,targetY:p,targetPosition:b};return s===gr.Bezier?[T]=Vh(L):s===gr.Step?[T]=Bs({...L,borderRadius:0}):s===gr.SmoothStep?[T]=Bs(L):s===gr.SimpleBezier?[T]=Ph(L):T=`M${S},${R} ${f},${p}`,ne.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:r})};Mm.displayName="ConnectionLine";const PN=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function UN({containerStyle:e,style:t,type:r,component:s}){const{nodeId:i,handleType:a,nodesConnectable:c,width:u,height:f,connectionStatus:p}=Ue(PN,Et);return!(i&&a&&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:_t(["react-flow__connection",p])},ne.createElement(Mm,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:s,connectionStatus:p})))}function Pm(e,t){return I.useRef(null),rt(),I.useMemo(()=>t(e),[e])}const Um=({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:y,onNodeContextMenu:v,onSelectionContextMenu:w,onSelectionStart:_,onSelectionEnd:S,connectionLineType:R,connectionLineStyle:N,connectionLineComponent:b,connectionLineContainerStyle:T,selectionKeyCode:L,selectionOnDrag:D,selectionMode:V,multiSelectionKeyCode:K,panActivationKeyCode:X,zoomActivationKeyCode:G,deleteKeyCode:te,onlyRenderVisibleElements:re,elementsSelectable:J,selectNodesOnDrag:C,defaultViewport:z,translateExtent:H,minZoom:W,maxZoom:P,preventScrolling:U,defaultMarkerColor:$,zoomOnScroll:k,zoomOnPinch:j,panOnScroll:ee,panOnScrollSpeed:oe,panOnScrollMode:se,zoomOnDoubleClick:ue,panOnDrag:pe,onPaneClick:de,onPaneMouseEnter:he,onPaneMouseMove:Re,onPaneMouseLeave:je,onPaneScroll:ze,onPaneContextMenu:lt,onEdgeContextMenu:at,onEdgeMouseEnter:qe,onEdgeMouseMove:$t,onEdgeMouseLeave:Me,onReconnect:Se,onReconnectStart:ht,onReconnectEnd:Ht,reconnectRadius:Jt,noDragClassName:kn,noWheelClassName:Jn,noPanClassName:Zt,elevateEdgesOnSelect:Zn,disableKeyboardA11y:Mn,nodeOrigin:hn,nodeExtent:mn,rfId:er})=>{const gn=Pm(e,dN),Je=Pm(t,yN);return kN(a),ne.createElement(cN,{onPaneClick:de,onPaneMouseEnter:he,onPaneMouseMove:Re,onPaneMouseLeave:je,onPaneContextMenu:lt,onPaneScroll:ze,deleteKeyCode:te,selectionKeyCode:L,selectionOnDrag:D,selectionMode:V,onSelectionStart:_,onSelectionEnd:S,multiSelectionKeyCode:K,panActivationKeyCode:X,zoomActivationKeyCode:G,elementsSelectable:J,onMove:r,onMoveStart:s,onMoveEnd:i,zoomOnScroll:k,zoomOnPinch:j,zoomOnDoubleClick:ue,panOnScroll:ee,panOnScrollSpeed:oe,panOnScrollMode:se,panOnDrag:pe,defaultViewport:z,translateExtent:H,minZoom:W,maxZoom:P,onSelectionContextMenu:w,preventScrolling:U,noDragClassName:kn,noWheelClassName:Jn,noPanClassName:Zt,disableKeyboardA11y:Mn},ne.createElement(DN,null,ne.createElement(bN,{edgeTypes:Je,onEdgeClick:u,onEdgeDoubleClick:p,onlyRenderVisibleElements:re,onEdgeContextMenu:at,onEdgeMouseEnter:qe,onEdgeMouseMove:$t,onEdgeMouseLeave:Me,onReconnect:Se,onReconnectStart:ht,onReconnectEnd:Ht,reconnectRadius:Jt,defaultMarkerColor:$,noPanClassName:Zt,elevateEdgesOnSelect:!!Zn,disableKeyboardA11y:Mn,rfId:er},ne.createElement(UN,{style:N,type:R,component:b,containerStyle:T})),ne.createElement("div",{className:"react-flow__edgelabel-renderer"}),ne.createElement(hN,{nodeTypes:gn,onNodeClick:c,onNodeDoubleClick:f,onNodeMouseEnter:m,onNodeMouseMove:E,onNodeMouseLeave:y,onNodeContextMenu:v,selectNodesOnDrag:C,onlyRenderVisibleElements:re,noPanClassName:Zt,noDragClassName:kn,disableKeyboardA11y:Mn,nodeOrigin:hn,nodeExtent:mn,rfId:er})))};Um.displayName="GraphView";var FN=I.memo(Um);const Nu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],yr={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:Nu,nodeExtent:Nu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:mr.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:fR,isValidConnection:void 0},jN=()=>Nx((e,t)=>({...yr,setNodes:r=>{const{nodeInternals:s,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:yu(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?yu(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:y}=new window.DOMMatrixReadOnly(E.transform),v=r.reduce((_,S)=>{const R=i.get(S.id);if(R?.hidden)i.set(R.id,{...R,[Ye]:{...R[Ye],handleBounds:void 0}});else if(R){const N=nu(S.nodeElement);N.width&&N.height&&(R.width!==N.width||R.height!==N.height||S.forceUpdate)&&(i.set(R.id,{...R,[Ye]:{...R[Ye],handleBounds:{source:_m(".source",S.nodeElement,y,p),target:_m(".target",S.nodeElement,y,p)}},...N}),_.push({id:R.id,type:"dimensions",dimensions:N}))}return _},[]);dm(i,p);const w=c||a&&!c&&fm(t,{initial:!0,...u});e({nodeInternals:new Map(i),fitViewOnInitDone:w}),v?.length>0&&s?.(v)},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=Em(r,u()),m=yu(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=>Er(f,!0)):(c=Do(a(),r),u=Do(i,[])),wl({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=>Er(f,!0)):(c=Do(i,r),u=Do(a(),[])),wl({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,Er(m.id,!1))),p=u.map(m=>Er(m.id,!1));wl({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=>Er(u.id,!1)),c=r.filter(u=>u.selected).map(u=>Er(u.id,!1));wl({changedNodes:a,changedEdges:c,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:s}=t();s.forEach(i=>{i.positionAbsolute=ru(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=pr.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:yr.connectionNodeId,connectionHandleId:yr.connectionHandleId,connectionHandleType:yr.connectionHandleType,connectionStatus:yr.connectionStatus,connectionStartHandle:yr.connectionStartHandle,connectionEndHandle:yr.connectionEndHandle}),reset:()=>e({...yr})}),Object.is),Ou=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=jN()),ne.createElement(oR,{value:t.current},e)};Ou.displayName="ReactFlowProvider";const Fm=({children:e})=>I.useContext(El)?ne.createElement(ne.Fragment,null,e):ne.createElement(Ou,null,e);Fm.displayName="ReactFlowWrapper";const VN={input:tm,default:gu,output:rm,group:Eu},$N={default:Sl,straight:cu,step:au,smoothstep:vl,simplebezier:lu},HN=[0,0],BN=[15,15],zN={x:0,y:0,zoom:1},WN={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},jm=I.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:s,className:i,nodeTypes:a=VN,edgeTypes:c=$N,onNodeClick:u,onEdgeClick:f,onInit:p,onMove:m,onMoveStart:E,onMoveEnd:y,onConnect:v,onConnectStart:w,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:R,onNodeMouseEnter:N,onNodeMouseMove:b,onNodeMouseLeave:T,onNodeContextMenu:L,onNodeDoubleClick:D,onNodeDragStart:V,onNodeDrag:K,onNodeDragStop:X,onNodesDelete:G,onEdgesDelete:te,onSelectionChange:re,onSelectionDragStart:J,onSelectionDrag:C,onSelectionDragStop:z,onSelectionContextMenu:H,onSelectionStart:W,onSelectionEnd:P,connectionMode:U=mr.Strict,connectionLineType:$=gr.Bezier,connectionLineStyle:k,connectionLineComponent:j,connectionLineContainerStyle:ee,deleteKeyCode:oe="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:ue=!1,selectionMode:pe=$s.Full,panActivationKeyCode:de="Space",multiSelectionKeyCode:he=yl()?"Meta":"Control",zoomActivationKeyCode:Re=yl()?"Meta":"Control",snapToGrid:je=!1,snapGrid:ze=BN,onlyRenderVisibleElements:lt=!1,selectNodesOnDrag:at=!0,nodesDraggable:qe,nodesConnectable:$t,nodesFocusable:Me,nodeOrigin:Se=HN,edgesFocusable:ht,edgesUpdatable:Ht,elementsSelectable:Jt,defaultViewport:kn=zN,minZoom:Jn=.5,maxZoom:Zt=2,translateExtent:Zn=Nu,preventScrolling:Mn=!0,nodeExtent:hn,defaultMarkerColor:mn="#b1b1b7",zoomOnScroll:er=!0,zoomOnPinch:gn=!0,panOnScroll:Je=!1,panOnScrollSpeed:en=.5,panOnScrollMode:Pn=Yr.Free,zoomOnDoubleClick:Un=!0,panOnDrag:wr=!0,onPaneClick:Dt,onPaneMouseEnter:En,onPaneMouseMove:to,onPaneMouseLeave:no,onPaneScroll:tr,onPaneContextMenu:Fn,children:nr,onEdgeContextMenu:jn,onEdgeDoubleClick:ta,onEdgeMouseEnter:na,onEdgeMouseMove:ra,onEdgeMouseLeave:oa,onEdgeUpdate:ui,onEdgeUpdateStart:sa,onEdgeUpdateEnd:ro,onReconnect:di,onReconnectStart:oo,onReconnectEnd:wd,reconnectRadius:so=10,edgeUpdaterRadius:Jo=10,onNodesChange:Zo,onEdgesChange:fi,noDragClassName:Rd="nodrag",noWheelClassName:Nd="nowheel",noPanClassName:ia="nopan",fitView:rr=!1,fitViewOptions:la,connectOnClick:aa=!0,attributionPosition:Od,proOptions:ca,defaultEdgeOptions:ua,elevateNodesOnSelect:da=!0,elevateEdgesOnSelect:fa=!1,disableKeyboardA11y:pa=!1,autoPanOnConnect:Td=!0,autoPanOnNodeDrag:Ke=!0,connectionRadius:Cd=20,isValidConnection:pi,onError:ha,style:es,id:ma,nodeDragThreshold:ga,...ts},tn)=>{const hi=ma||"1";return ne.createElement("div",{...ts,style:{...es,...WN},ref:tn,className:_t(["react-flow",i]),"data-testid":"rf__wrapper",id:ma},ne.createElement(Fm,null,ne.createElement(FN,{onInit:p,onMove:m,onMoveStart:E,onMoveEnd:y,onNodeClick:u,onEdgeClick:f,onNodeMouseEnter:N,onNodeMouseMove:b,onNodeMouseLeave:T,onNodeContextMenu:L,onNodeDoubleClick:D,nodeTypes:a,edgeTypes:c,connectionLineType:$,connectionLineStyle:k,connectionLineComponent:j,connectionLineContainerStyle:ee,selectionKeyCode:se,selectionOnDrag:ue,selectionMode:pe,deleteKeyCode:oe,multiSelectionKeyCode:he,panActivationKeyCode:de,zoomActivationKeyCode:Re,onlyRenderVisibleElements:lt,selectNodesOnDrag:at,defaultViewport:kn,translateExtent:Zn,minZoom:Jn,maxZoom:Zt,preventScrolling:Mn,zoomOnScroll:er,zoomOnPinch:gn,zoomOnDoubleClick:Un,panOnScroll:Je,panOnScrollSpeed:en,panOnScrollMode:Pn,panOnDrag:wr,onPaneClick:Dt,onPaneMouseEnter:En,onPaneMouseMove:to,onPaneMouseLeave:no,onPaneScroll:tr,onPaneContextMenu:Fn,onSelectionContextMenu:H,onSelectionStart:W,onSelectionEnd:P,onEdgeContextMenu:jn,onEdgeDoubleClick:ta,onEdgeMouseEnter:na,onEdgeMouseMove:ra,onEdgeMouseLeave:oa,onReconnect:di??ui,onReconnectStart:oo??sa,onReconnectEnd:wd??ro,reconnectRadius:so??Jo,defaultMarkerColor:mn,noDragClassName:Rd,noWheelClassName:Nd,noPanClassName:ia,elevateEdgesOnSelect:fa,rfId:hi,disableKeyboardA11y:pa,nodeOrigin:Se,nodeExtent:hn}),ne.createElement(MR,{nodes:e,edges:t,defaultNodes:r,defaultEdges:s,onConnect:v,onConnectStart:w,onConnectEnd:_,onClickConnectStart:S,onClickConnectEnd:R,nodesDraggable:qe,nodesConnectable:$t,nodesFocusable:Me,edgesFocusable:ht,edgesUpdatable:Ht,elementsSelectable:Jt,elevateNodesOnSelect:da,minZoom:Jn,maxZoom:Zt,nodeExtent:hn,onNodesChange:Zo,onEdgesChange:fi,snapToGrid:je,snapGrid:ze,connectionMode:U,translateExtent:Zn,connectOnClick:aa,defaultEdgeOptions:ua,fitView:rr,fitViewOptions:la,onNodesDelete:G,onEdgesDelete:te,onNodeDragStart:V,onNodeDrag:K,onNodeDragStop:X,onSelectionDrag:C,onSelectionDragStart:J,onSelectionDragStop:z,noPanClassName:ia,nodeOrigin:Se,rfId:hi,autoPanOnConnect:Td,autoPanOnNodeDrag:Ke,onError:ha,connectionRadius:Cd,isValidConnection:pi,nodeDragThreshold:ga}),ne.createElement(DR,{onSelectionChange:re}),nr,ne.createElement(iR,{proOptions:ca,position:Od}),ne.createElement(VR,{rfId:hi,disableKeyboardA11y:pa})))});jm.displayName="ReactFlow";const GN=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function YN({children:e}){const t=Ue(GN);return t?tu.createPortal(e,t):null}function KN(){const e=rt();return I.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 XN({onStart:e,onChange:t,onEnd:r}){const s=rt();I.useEffect(()=>{s.setState({onViewportChangeStart:e})},[e]),I.useEffect(()=>{s.setState({onViewportChange:t})},[t]),I.useEffect(()=>{s.setState({onViewportChangeEnd:r})},[r])}const QN=e=>t=>t.nodeInternals.size===0?!1:t.getNodes().filter(r=>e.includeHiddenNodes?!0:!r.hidden).every(r=>r[Ye]?.handleBounds!==void 0),qN={includeHiddenNodes:!1};function JN(e=qN){return Ue(QN(e))}function ZN(){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 e1(){return ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},ne.createElement("path",{d:"M0 0h32v4.2H0z"}))}function t1(){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 n1(){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 r1(){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 Gs=({children:e,className:t,...r})=>ne.createElement("button",{type:"button",className:_t(["react-flow__controls-button",t]),...r},e);Gs.displayName="ControlButton";const o1=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),Vm=({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 y=rt(),[v,w]=I.useState(!1),{isInteractive:_,minZoomReached:S,maxZoomReached:R}=Ue(o1,Et),{zoomIn:N,zoomOut:b,fitView:T}=vu();if(I.useEffect(()=>{w(!0)},[]),!v)return null;const L=()=>{N(),a?.()},D=()=>{b(),c?.()},V=()=>{T(i),u?.()},K=()=>{y.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),f?.(!_)};return ne.createElement(js,{className:_t(["react-flow__controls",p]),position:E,style:e,"data-testid":"rf__controls"},t&&ne.createElement(ne.Fragment,null,ne.createElement(Gs,{onClick:L,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:R},ne.createElement(ZN,null)),ne.createElement(Gs,{onClick:D,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},ne.createElement(e1,null))),r&&ne.createElement(Gs,{className:"react-flow__controls-fitview",onClick:V,title:"fit view","aria-label":"fit view"},ne.createElement(t1,null)),s&&ne.createElement(Gs,{className:"react-flow__controls-interactive",onClick:K,title:"toggle interactivity","aria-label":"toggle interactivity"},_?ne.createElement(r1,null):ne.createElement(n1,null)),m)};Vm.displayName="Controls";var s1=I.memo(Vm),Kt;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Kt||(Kt={}));function i1({color:e,dimensions:t,lineWidth:r}){return ne.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function l1({color:e,radius:t}){return ne.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const a1={[Kt.Dots]:"#91919a",[Kt.Lines]:"#eee",[Kt.Cross]:"#e2e2e2"},c1={[Kt.Dots]:1,[Kt.Lines]:1,[Kt.Cross]:6},u1=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function $m({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=I.useRef(null),{transform:m,patternId:E}=Ue(u1,Et),y=c||a1[t],v=s||c1[t],w=t===Kt.Dots,_=t===Kt.Cross,S=Array.isArray(r)?r:[r,r],R=[S[0]*m[2]||1,S[1]*m[2]||1],N=v*m[2],b=_?[N,N]:R,T=w?[N/a,N/a]:[b[0]/a,b[1]/a];return ne.createElement("svg",{className:_t(["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:E+e,x:m[0]%R[0],y:m[1]%R[1],width:R[0],height:R[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},w?ne.createElement(l1,{color:y,radius:N/a}):ne.createElement(i1,{dimensions:b,color:y,lineWidth:i})),ne.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E+e})`}))}$m.displayName="Background";var d1=I.memo($m);const Hm={},{useDebugValue:f1}=ne,{useSyncExternalStoreWithSelector:p1}=Ip;let Bm=!1;const h1=e=>e;function m1(e,t=h1,r){(Hm?"production":void 0)!=="production"&&r&&!Bm&&(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"),Bm=!0);const s=p1(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return f1(s),s}const zm=e=>{(Hm?"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"?Lp(e):e,r=(s,i)=>m1(t,s,i);return Object.assign(r,t),r},Po=e=>e?zm(e):zm,g1=!1,E1="prod",y1="0.0.15",Ys="0.0.10",Wm=230,v1=640,Gm=20,Uo={markerEnd:{height:20,type:Hs.ArrowClosed,width:20},style:{stroke:"inherit",strokeWidth:1.5},type:"floating"},x1="422",S1="404",Ym="document-sync",Tu=1e3,_1=1e3,w1=300,R1=5e3,Km=300,N1="Shift+Backspace",O1="Meta",T1="Shift",Nl=25,Cu={duration:Tu,includeHiddenNodes:!1,padding:.3},C1=Ge(),Au=()=>{const e={},t=document.querySelector('meta[name="csrf-token"]');return t&&(e["X-CSRF-Token"]=t?.content),e},A1=(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)},Xm=e=>({...e,...Uo}),Qm=e=>e.type==="handleCall"?{...e,deletable:!1}:e,qm=e=>e==="success"?"positive":"negative",I1=e=>e.toLowerCase().replace(/ /g,"-"),Vt=e=>typeof e=="string"?e.trim():e,Jm=(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}`)}),b1=e=>{try{return new URL(e).pathname.split("/").at(-1)}catch(t){return C1.error(t),""}};function Zm(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:_})=>!u[_]),{divisor:y,unit:v}=E.find(({threshold:_})=>Math.abs(m)<_)??E[E.length-1],w=Math.floor(m/y);return s.format(-w,v)}}function eg(e){return new Promise(t=>setTimeout(t,e))}const L1=(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},tg=(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},D1=e=>Object.keys(e),Iu=()=>({callOrder:"single",callStateEvents:"",callStateUrl:"",connections:[{connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:De()}],defaultFrom:"",defaultTimeout:"",destinationType:"phone",options:[{id:De(),result:"success"},{id:De(),result:"noAnswer"},{id:De(),result:"busy"},{id:De(),result:"decline"},{id:De(),result:"error"}]}),ng={aiAgent:()=>({agent:""}),answer:()=>({valid:!0}),cond:()=>({fallback:De(),options:[{id:De(),value:""}]}),condRequest:()=>({body:"",error:De(),fallback:De(),headers:"",method:"POST",options:[{id:De(),value:""}],url:""}),executeSWML:()=>({dest:"",fallback:De(),meta:"",options:[{id:De(),value:""}],params:""}),forwardAddress:()=>({...Iu(),destinationType:"address"}),forwardPhone:()=>({...Iu(),destinationType:"phone"}),forwardResource:()=>({...Iu(),destinationType:"resource"}),handleCall:()=>({valid:!0}),hangup:()=>({valid:!0}),play:()=>({selected:"",text:"",url:""}),promptPlay:()=>({digitTimeout:"",initialTimeout:"",options:[{command:"",digit:"",id:De()}],results:[{id:De(),result:"no_match"},{id:De(),result:"no_input"}],selected:"",text:"",url:""}),record:()=>({beep:!1,endSilenceTimeout:"",format:"wav",initialTimeout:"",maxLength:"",stereo:!1,terminators:"",valid:!0}),recordCallStart:()=>({beep:!1,controlId:De(),format:"wav",label:"",stereo:!1,terminators:""}),recordCallStop:()=>({controlId:""}),request:()=>({body:"",headers:"",method:"POST",options:[{id:De(),result:"success"},{id:De(),result:"failed"}],url:""}),sendSms:()=>({body:"",fromNumber:"",media:[],region:"",tags:[],toNumber:""}),set:()=>({variables:[{duplicate:!1,id:De(),key:"",value:""}]}),unset:()=>({variables:[]})},Oe=e=>typeof e=="string",Ks=()=>{let e,t;const r=new Promise((s,i)=>{e=s,t=i});return r.resolve=e,r.reject=t,r},rg=e=>e==null?"":""+e,k1=(e,t,r)=>{e.forEach(s=>{t[s]&&(r[s]=t[s])})},M1=/###/g,og=e=>e&&e.indexOf("###")>-1?e.replace(M1,"."):e,sg=e=>!e||Oe(e),Xs=(e,t,r)=>{const s=Oe(t)?t.split("."):t;let i=0;for(;i<s.length-1;){if(sg(e))return{};const a=og(s[i]);!e[a]&&r&&(e[a]=new r),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={},++i}return sg(e)?{}:{obj:e,k:og(s[i])}},ig=(e,t,r)=>{const{obj:s,k:i}=Xs(e,t,Object);if(s!==void 0||t.length===1){s[i]=r;return}let a=t[t.length-1],c=t.slice(0,t.length-1),u=Xs(e,c,Object);for(;u.obj===void 0&&c.length;)a=`${c[c.length-1]}.${a}`,c=c.slice(0,c.length-1),u=Xs(e,c,Object),u&&u.obj&&typeof u.obj[`${u.k}.${a}`]<"u"&&(u.obj=void 0);u.obj[`${u.k}.${a}`]=r},P1=(e,t,r,s)=>{const{obj:i,k:a}=Xs(e,t,Object);i[a]=i[a]||[],i[a].push(r)},Ol=(e,t)=>{const{obj:r,k:s}=Xs(e,t);if(r)return r[s]},U1=(e,t,r)=>{const s=Ol(e,r);return s!==void 0?s:Ol(t,r)},lg=(e,t,r)=>{for(const s in t)s!=="__proto__"&&s!=="constructor"&&(s in e?Oe(e[s])||e[s]instanceof String||Oe(t[s])||t[s]instanceof String?r&&(e[s]=t[s]):lg(e[s],t[s],r):e[s]=t[s]);return e},Fo=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var F1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const j1=e=>Oe(e)?e.replace(/[&<>"'\/]/g,t=>F1[t]):e;class V1{constructor(t){this.capacity=t,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(t){const r=this.regExpMap.get(t);if(r!==void 0)return r;const s=new RegExp(t);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(t,s),this.regExpQueue.push(t),s}}const $1=[" ",",","?","!",";"],H1=new V1(20),B1=(e,t,r)=>{t=t||"",r=r||"";const s=$1.filter(c=>t.indexOf(c)<0&&r.indexOf(c)<0);if(s.length===0)return!0;const i=H1.getRegExp(`(${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},bu=function(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;){if(!i||typeof i!="object")return;let c,u="";for(let f=a;f<s.length;++f)if(f!==a&&(u+=r),u+=s[f],c=i[u],c!==void 0){if(["string","number","boolean"].indexOf(typeof c)>-1&&f<s.length-1)continue;a+=f-a+1;break}i=c}return i},Tl=e=>e&&e.replace("_","-"),z1={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 Cl{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||z1,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:(Oe(t[0])&&(t[0]=`${s}${this.prefix} ${t[0]}`),this.logger[r](t))}create(t){return new Cl(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Cl(this.logger,t)}}var Cn=new Cl;class Al{constructor(){this.observers={}}on(t,r){return t.split(" ").forEach(s=>{this.observers[s]||(this.observers[s]=new Map);const i=this.observers[s].get(r)||0;this.observers[s].set(r,i+1)}),this}off(t,r){if(this.observers[t]){if(!r){delete this.observers[t];return}this.observers[t].delete(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]&&Array.from(this.observers[t].entries()).forEach(c=>{let[u,f]=c;for(let p=0;p<f;p++)u(...s)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(c=>{let[u,f]=c;for(let p=0;p<f;p++)u.apply(u,[t,...s])})}}class ag extends Al{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.indexOf(".")>-1?u=t.split("."):(u=[t,r],s&&(Array.isArray(s)?u.push(...s):Oe(s)&&a?u.push(...s.split(a)):u.push(s)));const f=Ol(this.data,u);return!f&&!r&&!s&&t.indexOf(".")>-1&&(t=u[0],r=u[1],s=u.slice(2).join(".")),f||!c||!Oe(s)?f:bu(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),ig(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)(Oe(s[a])||Array.isArray(s[a]))&&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,skipCopy:!1},u=[t,r];t.indexOf(".")>-1&&(u=t.split("."),i=s,s=r,r=u[1]),this.addNamespaces(r);let f=Ol(this.data,u)||{};c.skipCopy||(s=JSON.parse(JSON.stringify(s))),i?lg(f,s,a):f={...f,...s},ig(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 cg={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 ug={};class Il extends Al{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),k1(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=r,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=Cn.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&&!B1(t,s,i);if(c&&!u){const f=t.match(this.interpolator.nestingRegexp);if(f&&f.length>0)return{key:t,namespaces:Oe(a)?[a]: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{key:t,namespaces:Oe(a)?[a]: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 y=E&&E.res;const v=E&&E.usedKey||c,w=E&&E.exactUsedKey||c,_=Object.prototype.toString.apply(y),S=["[object Number]","[object Function]","[object RegExp]"],R=r.joinArrays!==void 0?r.joinArrays:this.options.joinArrays,N=!this.i18nFormat||this.i18nFormat.handleAsObject,b=!Oe(y)&&typeof y!="boolean"&&typeof y!="number";if(N&&y&&b&&S.indexOf(_)<0&&!(Oe(R)&&Array.isArray(y))){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(v,y,{...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=Array.isArray(y),L=T?[]:{},D=T?w:v;for(const V in y)if(Object.prototype.hasOwnProperty.call(y,V)){const K=`${D}${a}${V}`;L[V]=this.translate(K,{...r,joinArrays:!1,ns:u}),L[V]===K&&(L[V]=y[V])}y=L}}else if(N&&Oe(R)&&Array.isArray(y))y=y.join(R),y&&(y=this.extendTranslation(y,t,r,s));else{let T=!1,L=!1;const D=r.count!==void 0&&!Oe(r.count),V=Il.hasDefaultValue(r),K=D?this.pluralResolver.getSuffix(p,r.count,r):"",X=r.ordinal&&D?this.pluralResolver.getSuffix(p,r.count,{ordinal:!1}):"",G=D&&!r.ordinal&&r.count===0&&this.pluralResolver.shouldUseIntlApi(),te=G&&r[`defaultValue${this.options.pluralSeparator}zero`]||r[`defaultValue${K}`]||r[`defaultValue${X}`]||r.defaultValue;!this.isValidLookup(y)&&V&&(T=!0,y=te),this.isValidLookup(y)||(L=!0,y=c);const J=(r.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&L?void 0:y,C=V&&te!==y&&this.options.updateMissing;if(L||T||C){if(this.logger.log(C?"updateKey":"missingKey",p,f,c,C?te:y),a){const P=this.resolve(c,{...r,keySeparator:!1});P&&P.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 z=[];const H=this.languageUtils.getFallbackCodes(this.options.fallbackLng,r.lng||this.language);if(this.options.saveMissingTo==="fallback"&&H&&H[0])for(let P=0;P<H.length;P++)z.push(H[P]);else this.options.saveMissingTo==="all"?z=this.languageUtils.toResolveHierarchy(r.lng||this.language):z.push(r.lng||this.language);const W=(P,U,$)=>{const k=V&&$!==y?$:J;this.options.missingKeyHandler?this.options.missingKeyHandler(P,f,U,k,C,r):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(P,f,U,k,C,r),this.emit("missingKey",P,f,U,y)};this.options.saveMissing&&(this.options.saveMissingPlurals&&D?z.forEach(P=>{const U=this.pluralResolver.getSuffixes(P,r);G&&r[`defaultValue${this.options.pluralSeparator}zero`]&&U.indexOf(`${this.options.pluralSeparator}zero`)<0&&U.push(`${this.options.pluralSeparator}zero`),U.forEach($=>{W([P],c+$,r[`defaultValue${$}`]||te)})}):W(z,c,te))}y=this.extendTranslation(y,t,r,E,s),L&&y===c&&this.options.appendNamespaceToMissingKey&&(y=`${f}:${c}`),(L||T)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?y=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${f}:${c}`:c,T?y:void 0):y=this.options.parseMissingKeyHandler(y))}return i?(E.res=y,E.usedParams=this.getUsedParamsDetails(r),E):y}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=Oe(t)&&(s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let m;if(p){const y=t.match(this.interpolator.nestingRegexp);m=y&&y.length}let E=s.replace&&!Oe(s.replace)?s.replace:s;if(this.options.interpolation.defaultVariables&&(E={...this.options.interpolation.defaultVariables,...E}),t=this.interpolator.interpolate(t,E,s.lng||this.language||i.usedLng,s),p){const y=t.match(this.interpolator.nestingRegexp),v=y&&y.length;m<v&&(s.nest=!1)}!s.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(s.lng=this.language||i.usedLng),s.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var y=arguments.length,v=new Array(y),w=0;w<y;w++)v[w]=arguments[w];return a&&a[0]===v[0]&&!s.context?(c.logger.warn(`It seems you are nesting recursively key: ${v[0]} in key: ${r[0]}`),null):c.translate(...v,r)},s)),s.interpolation&&this.interpolator.reset()}const u=s.postProcess||this.options.postProcess,f=Oe(u)?[u]:u;return t!=null&&f&&f.length&&s.applyPostProcessor!==!1&&(t=cg.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 Oe(t)&&(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 y=r.count!==void 0&&!Oe(r.count),v=y&&!r.ordinal&&r.count===0&&this.pluralResolver.shouldUseIntlApi(),w=r.context!==void 0&&(Oe(r.context)||typeof r.context=="number")&&r.context!=="",_=r.lngs?r.lngs:this.languageUtils.toResolveHierarchy(r.lng||this.language,r.fallbackLng);E.forEach(S=>{this.isValidLookup(s)||(u=S,!ug[`${_[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(u)&&(ug[`${_[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${_.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!!!")),_.forEach(R=>{if(this.isValidLookup(s))return;c=R;const N=[m];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(N,m,R,S,r);else{let T;y&&(T=this.pluralResolver.getSuffix(R,r.count,r));const L=`${this.options.pluralSeparator}zero`,D=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(y&&(N.push(m+T),r.ordinal&&T.indexOf(D)===0&&N.push(m+T.replace(D,this.options.pluralSeparator)),v&&N.push(m+L)),w){const V=`${m}${this.options.contextSeparator}${r.context}`;N.push(V),y&&(N.push(V+T),r.ordinal&&T.indexOf(D)===0&&N.push(V+T.replace(D,this.options.pluralSeparator)),v&&N.push(V+L))}}let b;for(;b=N.pop();)this.isValidLookup(s)||(a=b,s=this.getResource(R,S,b,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&&!Oe(t.replace);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}}const Lu=e=>e.charAt(0).toUpperCase()+e.slice(1);class dg{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Cn.create("languageUtils")}getScriptPartFromCode(t){if(t=Tl(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=Tl(t),!t||t.indexOf("-")<0)return t;const r=t.split("-");return this.formatLanguageCode(r[0])}formatLanguageCode(t){if(Oe(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}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]=Lu(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]=Lu(s[1].toLowerCase())),r.indexOf(s[2].toLowerCase())>-1&&(s[2]=Lu(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("-")>0&&i.indexOf("-")<0&&a.substring(0,a.indexOf("-"))===i||a.indexOf(i)===0&&i.length>1))return a})}),r||(r=this.getFallbackCodes(this.options.fallbackLng)[0]),r}getFallbackCodes(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),Oe(t)&&(t=[t]),Array.isArray(t))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 Oe(t)&&(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))):Oe(t)&&a(this.formatLanguageCode(t)),s.forEach(c=>{i.indexOf(c)<0&&a(this.formatLanguageCode(c))}),i}}let W1=[{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}],G1={1:e=>+(e>1),2:e=>+(e!=1),3:e=>0,4:e=>e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,5:e=>e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5,6:e=>e==1?0:e>=2&&e<=4?1:2,7:e=>e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2,8:e=>e==1?0:e==2?1:e!=8&&e!=11?2:3,9:e=>+(e>=2),10:e=>e==1?0:e==2?1:e<7?2:e<11?3:4,11:e=>e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3,12:e=>+(e%10!=1||e%100==11),13:e=>+(e!==0),14:e=>e==1?0:e==2?1:e==3?2:3,15:e=>e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2,16:e=>e%10==1&&e%100!=11?0:e!==0?1:2,17:e=>e==1||e%10==1&&e%100!=11?0:1,18:e=>e==0?0:e==1?1:2,19:e=>e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3,20:e=>e==1?0:e==0||e%100>0&&e%100<20?1:2,21:e=>e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0,22:e=>e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3};const Y1=["v1","v2","v3"],K1=["v4"],fg={zero:0,one:1,two:2,few:3,many:4,other:5},X1=()=>{const e={};return W1.forEach(t=>{t.lngs.forEach(r=>{e[r]={numbers:t.nr,plurals:G1[t.fc]}})}),e};class Q1{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=r,this.logger=Cn.create("pluralResolver"),(!this.options.compatibilityJSON||K1.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(),this.pluralRulesCache={}}addRule(t,r){this.rules[t]=r}clearCache(){this.pluralRulesCache={}}getRule(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const s=Tl(t==="dev"?"en":t),i=r.ordinal?"ordinal":"cardinal",a=JSON.stringify({cleanedCode:s,type:i});if(a in this.pluralRulesCache)return this.pluralRulesCache[a];let c;try{c=new Intl.PluralRules(s,{type:i})}catch{if(!t.match(/-|_/))return;const f=this.languageUtils.getLanguagePartFromCode(t);c=this.getRule(f,r)}return this.pluralRulesCache[a]=c,c}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)=>fg[i]-fg[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)}}const pg=function(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=U1(e,t,r);return!a&&i&&Oe(r)&&(a=bu(e,r,s),a===void 0&&(a=bu(t,r,s))),a},Du=e=>e.replace(/\$/g,"$$$$");class q1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Cn.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{escape:r,escapeValue:s,useRawValueToEscape:i,prefix:a,prefixEscaped:c,suffix:u,suffixEscaped:f,formatSeparator:p,unescapeSuffix:m,unescapePrefix:E,nestingPrefix:y,nestingPrefixEscaped:v,nestingSuffix:w,nestingSuffixEscaped:_,nestingOptionsSeparator:S,maxReplaces:R,alwaysFormat:N}=t.interpolation;this.escape=r!==void 0?r:j1,this.escapeValue=s!==void 0?s:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=a?Fo(a):c||"{{",this.suffix=u?Fo(u):f||"}}",this.formatSeparator=p||",",this.unescapePrefix=m?"":E||"-",this.unescapeSuffix=this.unescapePrefix?"":m||"",this.nestingPrefix=y?Fo(y):v||Fo("$t("),this.nestingSuffix=w?Fo(w):_||Fo(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=R||1e3,this.alwaysFormat=N!==void 0?N:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(r,s)=>r&&r.source===s?(r.lastIndex=0,r):new RegExp(s,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,r,s,i){let a,c,u;const f=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},p=v=>{if(v.indexOf(this.formatSeparator)<0){const R=pg(r,f,v,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(R,void 0,s,{...i,...r,interpolationkey:v}):R}const w=v.split(this.formatSeparator),_=w.shift().trim(),S=w.join(this.formatSeparator).trim();return this.format(pg(r,f,_,this.options.keySeparator,this.options.ignoreJSONStructure),S,s,{...i,...r,interpolationkey:_})};this.resetRegExp();const m=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:v=>Du(v)},{regex:this.regexp,safeValue:v=>this.escapeValue?Du(this.escape(v)):Du(v)}].forEach(v=>{for(u=0;a=v.regex.exec(t);){const w=a[1].trim();if(c=p(w),c===void 0)if(typeof m=="function"){const S=m(t,a,i);c=Oe(S)?S:""}else if(i&&Object.prototype.hasOwnProperty.call(i,w))c="";else if(E){c=a[0];continue}else this.logger.warn(`missed to pass in variable ${w} for interpolating ${t}`),c="";else!Oe(c)&&!this.useRawValueToEscape&&(c=rg(c));const _=v.safeValue(c);if(t=t.replace(a[0],_),E?(v.regex.lastIndex+=c.length,v.regex.lastIndex-=a[0].length):v.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;const u=(f,p)=>{const m=this.nestingOptionsSeparator;if(f.indexOf(m)<0)return f;const E=f.split(new RegExp(`${m}[ ]*{`));let y=`{${E[1]}`;f=E[0],y=this.interpolate(y,c);const v=y.match(/'/g),w=y.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(y=y.replace(/'/g,'"'));try{c=JSON.parse(y),p&&(c={...p,...c})}catch(_){return this.logger.warn(`failed parsing options string in nesting for key ${f}`,_),`${f}${m}${y}`}return c.defaultValue&&c.defaultValue.indexOf(this.prefix)>-1&&delete c.defaultValue,f};for(;i=this.nestingRegexp.exec(t);){let f=[];c={...s},c=c.replace&&!Oe(c.replace)?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&&!Oe(a))return a;Oe(a)||(a=rg(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}}const J1=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){const[u,...f]=c.split(":"),p=f.join(":").trim().replace(/^'+|'+$/g,""),m=u.trim();r[m]||(r[m]=p),p==="false"&&(r[m]=!1),p==="true"&&(r[m]=!0),isNaN(p)||(r[m]=parseInt(p,10))}})}return{formatName:t,formatOptions:r}},jo=e=>{const t={};return(r,s,i)=>{let a=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(a={...a,[i.interpolationkey]:void 0});const c=s+JSON.stringify(a);let u=t[c];return u||(u=e(Tl(s),i),t[c]=u),u(r)}};class Z1{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=Cn.create("formatter"),this.options=t,this.formats={number:jo((r,s)=>{const i=new Intl.NumberFormat(r,{...s});return a=>i.format(a)}),currency:jo((r,s)=>{const i=new Intl.NumberFormat(r,{...s,style:"currency"});return a=>i.format(a)}),datetime:jo((r,s)=>{const i=new Intl.DateTimeFormat(r,{...s});return a=>i.format(a)}),relativetime:jo((r,s)=>{const i=new Intl.RelativeTimeFormat(r,{...s});return a=>i.format(a,s.range||"day")}),list:jo((r,s)=>{const i=new Intl.ListFormat(r,{...s});return a=>i.format(a)})},this.init(t)}init(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=r.interpolation.formatSeparator||","}add(t,r){this.formats[t.toLowerCase().trim()]=r}addCached(t,r){this.formats[t.toLowerCase().trim()]=jo(r)}format(t,r,s){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const a=r.split(this.formatSeparator);if(a.length>1&&a[0].indexOf("(")>1&&a[0].indexOf(")")<0&&a.find(u=>u.indexOf(")")>-1)){const u=a.findIndex(f=>f.indexOf(")")>-1);a[0]=[a[0],...a.splice(1,u)].join(this.formatSeparator)}return a.reduce((u,f)=>{const{formatName:p,formatOptions:m}=J1(f);if(this.formats[p]){let E=u;try{const y=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},v=y.locale||y.lng||i.locale||i.lng||s;E=this.formats[p](u,v,{...m,...i,...y})}catch(y){this.logger.warn(y)}return E}else this.logger.warn(`there was no format function for ${p}`);return u},t)}}const eO=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class tO extends Al{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=Cn.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 y=`${p}|${E}`;!s.reload&&this.store.hasResourceBundle(p,E)?this.state[y]=2:this.state[y]<0||(this.state[y]===1?c[y]===void 0&&(c[y]=!0):(this.state[y]=1,m=!1,c[y]===void 0&&(c[y]=!0),a[y]===void 0&&(a[y]=!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),!r&&s&&this.store.addResourceBundle(a,c,s,void 0,void 0,{skipCopy:!0}),this.state[t]=r?-1:2,r&&s&&(this.state[t]=0);const u={};this.queue.forEach(f=>{P1(f.loaded,[a],c),eO(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();Oe(t)&&(t=this.languageUtils.toResolveHierarchy(t)),Oe(r)&&(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)}}}const hg=()=>({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:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),Oe(e[1])&&(t.defaultValue=e[1]),Oe(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const r=e[3]||e[2];Object.keys(r).forEach(s=>{t[s]=r[s]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),mg=e=>(Oe(e.ns)&&(e.ns=[e.ns]),Oe(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),Oe(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),bl=()=>{},nO=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(r=>{typeof e[r]=="function"&&(e[r]=e[r].bind(e))})};class Qs extends Al{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;if(super(),this.options=mg(t),this.services={},this.logger=Cn,this.modules={external:[]},nO(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;this.isInitializing=!0,typeof r=="function"&&(s=r,r={}),!r.defaultNS&&r.defaultNS!==!1&&r.ns&&(Oe(r.ns)?r.defaultNS=r.ns:r.ns.indexOf("translation")<0&&(r.defaultNS=r.ns[0]));const i=hg();this.options={...i,...this.options,...mg(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);const a=m=>m?typeof m=="function"?new m:m:null;if(!this.options.isClone){this.modules.logger?Cn.init(a(this.modules.logger),this.options):Cn.init(null,this.options);let m;this.modules.formatter?m=this.modules.formatter:typeof Intl<"u"&&(m=Z1);const E=new dg(this.options);this.store=new ag(this.options.resources,this.options);const y=this.services;y.logger=Cn,y.resourceStore=this.store,y.languageUtils=E,y.pluralResolver=new Q1(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)&&(y.formatter=a(m),y.formatter.init(y,this.options),this.options.interpolation.format=y.formatter.format.bind(y.formatter)),y.interpolator=new q1(this.options),y.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},y.backendConnector=new tO(a(this.modules.backend),y.resourceStore,y,this.options),y.backendConnector.on("*",function(v){for(var w=arguments.length,_=new Array(w>1?w-1:0),S=1;S<w;S++)_[S-1]=arguments[S];t.emit(v,..._)}),this.modules.languageDetector&&(y.languageDetector=a(this.modules.languageDetector),y.languageDetector.init&&y.languageDetector.init(y,this.options.detection,this.options)),this.modules.i18nFormat&&(y.i18nFormat=a(this.modules.i18nFormat),y.i18nFormat.init&&y.i18nFormat.init(this)),this.translator=new Il(this.services,this.options),this.translator.on("*",function(v){for(var w=arguments.length,_=new Array(w>1?w-1:0),S=1;S<w;S++)_[S-1]=arguments[S];t.emit(v,..._)}),this.modules.external.forEach(v=>{v.init&&v.init(this)})}if(this.format=this.options.interpolation.format,s||(s=bl),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=Ks(),p=()=>{const m=(E,y)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),f.resolve(y),s(E,y)};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]:bl;const i=Oe(t)?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=Ks();return typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=void 0),t||(t=this.languages),r||(r=this.options.ns),s||(s=bl),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"&&cg.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=Ks();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=Oe(f)?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=f.keyPrefix||s||a.keyPrefix);const y=i.options.keySeparator||".";let v;return f.keyPrefix&&Array.isArray(c)?v=c.map(w=>`${f.keyPrefix}${y}${w}`):v=f.keyPrefix?`${f.keyPrefix}${y}${c}`:c,i.t(v,f)};return Oe(t)?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===0||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=Ks();return this.options.ns?(Oe(t)&&(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=Ks();Oe(t)&&(t=[t]);const i=this.options.preload||[],a=t.filter(c=>i.indexOf(c)<0&&this.services.languageUtils.isSupportedCode(c));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 dg(hg());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 Qs(t,r)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bl;const s=t.forkResourceStore;s&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},a=new Qs(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 ag(this.store.data,i),a.services.resourceStore=a.store),a.translator=new Il(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 ft=Qs.createInstance();ft.createInstance=Qs.createInstance,ft.createInstance,ft.dir,ft.init,ft.loadResources,ft.reloadResources,ft.use,ft.changeLanguage,ft.getFixedT;const M=ft.t;ft.exists,ft.setDefaultNamespace,ft.hasLoadedNamespace,ft.loadNamespaces,ft.loadLanguages;function rO(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qs(e){"@babel/helpers - typeof";return qs=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},qs(e)}function oO(e,t){if(qs(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,t);if(qs(s)!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function sO(e){var t=oO(e,"string");return qs(t)=="symbol"?t:t+""}function iO(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,sO(s.key),s)}}function lO(e,t,r){return t&&iO(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var gg=[],aO=gg.forEach,cO=gg.slice;function uO(e){return aO.call(cO.call(arguments,1),function(t){if(t)for(var r in t)e[r]===void 0&&(e[r]=t[r])}),e}var Eg=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,dO=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(!Eg.test(i.domain))throw new TypeError("option domain is invalid");c+="; Domain=".concat(i.domain)}if(i.path){if(!Eg.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},yg={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=dO(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)}},fO={name:"cookie",lookup:function(t){var r;if(t.lookupCookie&&typeof document<"u"){var s=yg.read(t.lookupCookie);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupCookie&&typeof document<"u"&&yg.create(r.lookupCookie,t,r.cookieMinutes,r.cookieDomain,r.cookieOptions)}},pO={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}},Js=null,vg=function(){if(Js!==null)return Js;try{Js=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Js=!1}return Js},hO={name:"localStorage",lookup:function(t){var r;if(t.lookupLocalStorage&&vg()){var s=window.localStorage.getItem(t.lookupLocalStorage);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupLocalStorage&&vg()&&window.localStorage.setItem(r.lookupLocalStorage,t)}},Zs=null,xg=function(){if(Zs!==null)return Zs;try{Zs=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Zs=!1}return Zs},mO={name:"sessionStorage",lookup:function(t){var r;if(t.lookupSessionStorage&&xg()){var s=window.sessionStorage.getItem(t.lookupSessionStorage);s&&(r=s)}return r},cacheUserLanguage:function(t,r){r.lookupSessionStorage&&xg()&&window.sessionStorage.setItem(r.lookupSessionStorage,t)}},gO={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}},EO={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}},yO={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}},vO={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]}},Sg=!1;try{document.cookie,Sg=!0}catch{}var _g=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];Sg||_g.splice(1,1);function xO(){return{order:_g,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var wg=(function(){function e(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};rO(this,e),this.type="languageDetector",this.detectors={},this.init(t,r)}return lO(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=uO(s,this.options||{},xO()),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(fO),this.addDetector(pO),this.addDetector(hO),this.addDetector(mO),this.addDetector(gO),this.addDetector(EO),this.addDetector(yO),this.addDetector(vO)}},{key:"addDetector",value:function(r){return this.detectors[r.name]=r,this}},{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)}))}}])})();wg.type="languageDetector";function ku(){return ku=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},ku.apply(null,arguments)}var Mu,Rg;function SO(){return Rg||(Rg=1,Mu={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}),Mu}var _O=SO();const wO=Ki(_O);var RO=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function Ng(e){var t={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},r=e.match(/<\/?([^\s]+?)[/\s>]/);if(r&&(t.name=r[1],(wO[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(RO),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 NO=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,OO=/^\s*$/,TO=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 CO={parse:function(e,t){t||(t={}),t.components||(t.components=TO);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(NO,function(f,p){if(c){if(f!=="</"+r.name+">")return;c=!1}var m,E=f.charAt(1)!=="/",y=f.startsWith("<!--"),v=p+f.length,w=e.charAt(v);if(y){var _=Ng(f);return a<0?(s.push(_),s):((m=i[a]).children.push(_),s)}if(E&&(a++,(r=Ng(f)).type==="tag"&&t.components[r.name]&&(r.type="component",c=!0),r.voidElement||c||!w||w==="<"||r.children.push({type:"text",content:e.slice(v,e.indexOf("<",v))}),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&&w!=="<"&&w)){m=a===-1?s:i[a].children;var S=e.indexOf("<",v),R=e.slice(v,S===-1?void 0:S);OO.test(R)&&(R=" "),(S>-1&&a+m.length>=0||R!==" ")&&m.push({type:"text",content:R})}}),s},stringify:function(e){return e.reduce(function(t,r){return t+Og("",r)},"")}};function Ll(){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 Tg={};function AO(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];typeof t[0]=="string"&&Tg[t[0]]||(typeof t[0]=="string"&&(Tg[t[0]]=new Date),Ll(...t))}const IO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,bO={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},LO=e=>bO[e];let Pu={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:e=>e.replace(IO,LO)};function DO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pu={...Pu,...e}}function kO(){return Pu}let Cg;function MO(e){Cg=e}function Ag(){return Cg}function Uu(e,t){if(!e)return!1;const r=e.props?e.props.children:e.children;return t?r.length>0:!!r}function Fu(e){if(!e)return[];const t=e.props?e.props.children:e.children;return e.props&&e.props.i18nIsDynamicList?Vo(t):t}function PO(e){return Object.prototype.toString.call(e)!=="[object Array]"?!1:e.every(t=>I.isValidElement(t))}function Vo(e){return Array.isArray(e)?e:[e]}function UO(e,t){const r={...t};return r.props=Object.assign(e.props,t.props),r}function Ig(e,t){if(!e)return"";let r="";const s=Vo(e),i=t.transSupportBasicHtmlNodes&&t.transKeepBasicHtmlNodesFor?t.transKeepBasicHtmlNodesFor:[];return s.forEach((a,c)=>{if(typeof a=="string")r+=`${a}`;else if(I.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=Ig(p,t);r+=`<${c}>${m}</${c}>`}}else if(a===null)Ll("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 Ll("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.",a)}else Ll("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 FO(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){Vo(S).forEach(N=>{typeof N!="string"&&(Uu(N)?p(Fu(N)):typeof N=="object"&&!I.isValidElement(N)&&Object.assign(f,N))})}p(e);const m=CO.parse(`<0>${t}</0>`),E={...f,...i};function y(S,R,N){const b=Fu(S),T=w(b,R.children,N);return PO(b)&&T.length===0||S.props&&S.props.i18nIsDynamicList?b:T}function v(S,R,N,b,T){S.dummy?(S.children=R,N.push(I.cloneElement(S,{key:b},T?void 0:R))):N.push(...I.Children.map([S],L=>{const D={...L.props};return delete D.i18nIsDynamicList,ne.createElement(L.type,ku({},D,{key:b,ref:L.ref},T?{}:{children:R}))}))}function w(S,R,N){const b=Vo(S);return Vo(R).reduce((L,D,V)=>{const K=D.children&&D.children[0]&&D.children[0].content&&r.services.interpolator.interpolate(D.children[0].content,E,r.language);if(D.type==="tag"){let X=b[parseInt(D.name,10)];N.length===1&&!X&&(X=N[0][D.name]),X||(X={});const G=Object.keys(D.attrs).length!==0?UO({props:D.attrs},X):X,te=I.isValidElement(G),re=te&&Uu(D,!0)&&!D.voidElement,J=u&&typeof G=="object"&&G.dummy&&!te,C=typeof e=="object"&&e!==null&&Object.hasOwnProperty.call(e,D.name);if(typeof G=="string"){const z=r.services.interpolator.interpolate(G,E,r.language);L.push(z)}else if(Uu(G)||re){const z=y(G,D,N);v(G,z,L,V)}else if(J){const z=w(b,D.children,N);v(G,z,L,V)}else if(Number.isNaN(parseFloat(D.name)))if(C){const z=y(G,D,N);v(G,z,L,V,D.voidElement)}else if(s.transSupportBasicHtmlNodes&&c.indexOf(D.name)>-1)if(D.voidElement)L.push(I.createElement(D.name,{key:`${D.name}-${V}`}));else{const z=w(b,D.children,N);L.push(I.createElement(D.name,{key:`${D.name}-${V}`},z))}else if(D.voidElement)L.push(`<${D.name} />`);else{const z=w(b,D.children,N);L.push(`<${D.name}>${z}</${D.name}>`)}else if(typeof G=="object"&&!te){const z=D.children[0]?K:null;z&&L.push(z)}else v(G,K,L,V,D.children.length!==1||!K)}else if(D.type==="text"){const X=s.transWrapTextNodes,G=a?s.unescape(r.services.interpolator.interpolate(D.content,E,r.language)):r.services.interpolator.interpolate(D.content,E,r.language);X?L.push(I.createElement(X,{key:`${D.name}-${V}`},G)):L.push(G)}return L},[])}const _=w([{dummy:!0,children:e||[]}],m,Vo(e||[]));return Fu(_[0])}function jO(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:y,shouldUnescape:v,...w}=e;const _=E||Ag();if(!_)return AO("You will need to pass in an i18next instance by using i18nextReactModule"),t;const S=y||_.t.bind(_)||(re=>re);a&&(c.context=a);const R={...kO(),..._.options&&_.options.react};let N=m||S.ns||_.options&&_.options.defaultNS;N=typeof N=="string"?[N]:N||["translation"];const b=Ig(t,R),T=f||b||R.transEmptyNodeValue||i,{hashTransKey:L}=R,D=i||(L?L(b||T):b||T);_.options&&_.options.interpolation&&_.options.interpolation.defaultVariables&&(u=u&&Object.keys(u).length>0?{...u,..._.options.interpolation.defaultVariables}:{..._.options.interpolation.defaultVariables});const V=u?c.interpolation:{interpolation:{...c.interpolation,prefix:"#$?",suffix:"?$#"}},K={...c,count:r,...u,...V,defaultValue:T,ns:N},X=D?S(D,K):T;p&&Object.keys(p).forEach(re=>{const J=p[re];if(typeof J.type=="function"||!J.props||!J.props.children||X.indexOf(`${re}/>`)<0&&X.indexOf(`${re} />`)<0)return;function C(){return ne.createElement(ne.Fragment,null,J)}p[re]=ne.createElement(C,null)});const G=FO(p||t,X,_,R,K,v),te=s!==void 0?s:R.defaultTransParent;return te?I.createElement(te,w,G):G}const VO={type:"3rdParty",init(e){DO(e.options.react),MO(e)}},$O=I.createContext();function HO(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:y,shouldUnescape:v,...w}=e;const{i18n:_,defaultNS:S}=I.useContext($O)||{},R=E||_||Ag(),N=y||R&&R.t.bind(R);return jO({children:t,count:r,parent:s,i18nKey:i,context:a,tOptions:c,values:u,defaults:f,components:p,ns:m||N&&N.ns||S||R&&R.options&&R.options.defaultNS,i18n:R,t:y,shouldUnescape:v,...w})}var BO={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"]},zO={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"]},WO={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"]},GO={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"]},YO=GO,KO={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"]},XO={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"]},QO={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"]},qO={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"]},JO={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"]},ZO={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"]},eT={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"]},nT={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"]},rT={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"]},oT={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"]},sT={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"]},iT={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":ZO,"arrow-right":qO,"arrow-turn-down-right":QO,"arrows-rotate":XO,bars:zO,bolt:nT,"circle-check":KO,"circle-exclamation":WO,"circle-info":tT,"circle-question":JO,"circle-small":eT,"circle-xmark":iT,"clock-rotate-left":oT,"dot-circle":YO,"trash-can":BO,"triangle-exclamation":sT,xmark:rT},Ae=I.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"})}):(Ge().debug(`Unknown icon: ${s}`),null)}),$o=({className:e="",confirm:t=!0,handleDelete:r,label:s,scale:i=1,show:a=!0,showLabel:c=!1,size:u})=>{const[f,p]=I.useState(!1),[m,E]=I.useState(i);i!==m&&(p(!1),E(i));const y=w=>{w.preventDefault(),p(_=>!_)},v=w=>{w.preventDefault(),r(w)};return h.jsx(Sr,{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:w=>y(w),type:"button",children:[h.jsx(Ae,{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(A.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:w=>y(w),children:M(A.CANCEL)}),h.jsx("button",{className:"rounded bg-negative py-1 px-2",onClick:w=>v(w),children:M(A.DELETE)})]})]})})},aT=e=>{const t=ye(r=>r.viewport.zoom);return h.jsx($o,{scale:t,...e})},cT=Ge(),uT=100,dT=100,bg=({children:e,className:t="",onClickListItem:r})=>{const s=ye(p=>p.nodes),i=ye(p=>p.reactFlowInstance),a=ye(p=>p.validationWarnings),{setSelectedNodes:c}=tt();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(v=>v.id===p);if(!m){cT.error(`Node with id ${p} not found`);return}const E=i?.getNode(p)?.height??dT,y=i?.getNode(p)?.width??Wm;i?.fitBounds({height:E+uT,width:y,x:m.position.x,y:m.position.y},{duration:Tu}),setTimeout(()=>c([m.id]),Tu),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(A.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(A.NOT_CONNECTED_TO_FLOW)}),!p.valid&&h.jsx("li",{children:M(A.INVALID_SETTINGS)})]})]},p.id))})})]})},ei=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?A.FROM:A.TO),...i}),h.jsx(Ae,{className:"absolute left-[.25rem] top-[.5rem] text-foreground/40",tag:a?"arrow-left":"arrow-right"})]})},fT=({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(Ae,{size:"lg",tag:"arrow-turn-down-right"})}),h.jsx("div",{className:"w-full overflow-hidden",children:e})]}),pT=({connected:e=!1,deletable:t=!0,isRoot:r=!1,nodeId:s,nodeTitle:i,selected:a=!1})=>{const{removeNode:c}=tt(),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(Ae,{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(Ae,{className:"px-1 text-warning",size:"lg",tag:"bolt"}),M(A.NOT_CONNECTED_TO_FLOW)]})]}),t&&!u&&h.jsx(aT,{handleDelete:()=>c(s),label:M(A.REMOVE_NODE,{title:i}),show:a})]})},hT=({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(Sr,{placement:"bottom",trigger:h.jsx("div",{role:"tooltip",tabIndex:0,children:h.jsx(Ae,{size:"lg",tag:"triangle-exclamation"})}),children:M(A.INFO_INVALID_SETTINGS)}),M(A.INVALID_SETTINGS)]})}),mT=({nodeId:e,valid:t})=>{const{deleteValidationWarning:r,getTargetEdges:s,partialUpdateValidationWarning:i}=tt(),[a,c]=I.useState(!1);return I.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 y=m.nodes.length!==E.nodes.length,v=m.edges.length!==E.edges.length,w=m.isEdgeUpdateSuccessful!==E.isEdgeUpdateSuccessful;(v||y||w)&&p()}),()=>{f()}},[r,s,e,i,t]),{isConnectedToFlow:a}},gT=({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(Co,{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"})})},pt=({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}=mT({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:Wm},children:[f&&t&&h.jsx(gT,{id:t,isConnectable:r}),h.jsx(pT,{connected:!f||m,deletable:c,isRoot:s,nodeId:t,nodeTitle:i,selected:a}),u&&h.jsx(hT,{valid:p}),e]})})},ET=({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(Ae,{tag:"xmark",size:"xs"})]})]})})},Lg=({data:e})=>{let t=e.selected&&e[e.selected].trim();return t&&e.selected==="url"&&(t=b1(t)||M(A.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
13
+ ${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(A.ERROR_SELECTION_REQUIRED)})]})},An=e=>{const{label:t="",id:r="",...s}=e,i=I.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})]})},yT=({label:e,vars:t={}})=>h.jsx(HO,{components:{a:h.jsx("a",{className:"underline hover:text-background/80",href:t.linkTo||"#",target:"_blank",rel:"noopener noreferrer"}),code:h.jsx(fT,{}),p:h.jsx("p",{className:"mb-2"})},i18nKey:e}),vT={disabled:"border-disabled cursor-not-allowed",negative:"border-negative hover:bg-negative",positive:"border-positive hover:bg-positive"},fn=({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(Co,{className:`-right-[2px] h-full w-full border-2 bg-background transition-colors ${vT[i]??""}`,id:r,isConnectable:f&&s&&t,position:xe.Right,type:"source"})})},Ho=({children:e})=>h.jsx("div",{className:"flex w-full flex-col items-start text-xs",children:e}),pn=({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(fn,{color:e,enabled:t,id:r,isConnectable:s})]}),xT=({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?A.ON:A.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`})]}),Dl=({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(xT,{checked:e,name:r,onClick:t,...a})]}),Kn=({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 kl(){return typeof window<"u"}function Bo(e){return kg(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function In(e){var t;return(t=(kg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function kg(e){return kl()?e instanceof Node||e instanceof Ct(e).Node:!1}function Fe(e){return kl()?e instanceof Element||e instanceof Ct(e).Element:!1}function Qt(e){return kl()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function Ml(e){return!kl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}function ti(e){const{overflow:t,overflowX:r,overflowY:s,display:i}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+r)&&i!=="inline"&&i!=="contents"}function ST(e){return/^(table|td|th)$/.test(Bo(e))}function Pl(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _T=/transform|translate|scale|rotate|perspective|filter/,wT=/paint|layout|strict|content/,Xr=e=>!!e&&e!=="none";let ju;function Vu(e){const t=Fe(e)?qt(e):e;return Xr(t.transform)||Xr(t.translate)||Xr(t.scale)||Xr(t.rotate)||Xr(t.perspective)||!Ul()&&(Xr(t.backdropFilter)||Xr(t.filter))||_T.test(t.willChange||"")||wT.test(t.contain||"")}function RT(e){let t=Qn(e);for(;Qt(t)&&!Xn(t);){if(Vu(t))return t;if(Pl(t))return null;t=Qn(t)}return null}function Ul(){return ju==null&&(ju=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ju}function Xn(e){return/^(html|body|#document)$/.test(Bo(e))}function qt(e){return Ct(e).getComputedStyle(e)}function Fl(e){return Fe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qn(e){if(Bo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ml(e)&&e.host||In(e);return Ml(t)?t.host:t}function Mg(e){const t=Qn(e);return Xn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&ti(t)?t:Mg(t)}function vr(e,t,r){var s;t===void 0&&(t=[]),r===void 0&&(r=!0);const i=Mg(e),a=i===((s=e.ownerDocument)==null?void 0:s.body),c=Ct(i);if(a){const u=$u(c);return t.concat(c,c.visualViewport||[],ti(i)?i:[],u&&r?vr(u):[])}else return t.concat(i,vr(i,[],r))}function $u(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const zo=Math.min,Qr=Math.max,jl=Math.round,Vl=Math.floor,bn=e=>({x:e,y:e}),NT={left:"right",right:"left",bottom:"top",top:"bottom"};function Hu(e,t,r){return Qr(e,zo(t,r))}function ni(e,t){return typeof e=="function"?e(t):e}function qr(e){return e.split("-")[0]}function ri(e){return e.split("-")[1]}function Pg(e){return e==="x"?"y":"x"}function Bu(e){return e==="y"?"height":"width"}function xr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function zu(e){return Pg(xr(e))}function OT(e,t,r){r===void 0&&(r=!1);const s=ri(e),i=zu(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=$l(c)),[c,$l(c)]}function TT(e){const t=$l(e);return[Wu(e),t,Wu(t)]}function Wu(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ug=["left","right"],Fg=["right","left"],CT=["top","bottom"],AT=["bottom","top"];function IT(e,t,r){switch(e){case"top":case"bottom":return r?t?Fg:Ug:t?Ug:Fg;case"left":case"right":return t?CT:AT;default:return[]}}function bT(e,t,r,s){const i=ri(e);let a=IT(qr(e),r==="start",s);return i&&(a=a.map(c=>c+"-"+i),t&&(a=a.concat(a.map(Wu)))),a}function $l(e){const t=qr(e);return NT[t]+e.slice(t.length)}function LT(e){return{top:0,right:0,bottom:0,left:0,...e}}function jg(e){return typeof e!="number"?LT(e):{top:e,right:e,bottom:e,left:e}}function Hl(e){const{x:t,y:r,width:s,height:i}=e;return{width:s,height:i,top:r,left:t,right:t+s,bottom:r+i,x:t,y:r}}function DT(){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 MT(){return/apple/i.test(navigator.vendor)}function PT(){return DT().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function UT(){return kT().includes("jsdom/")}const Vg="data-floating-ui-focusable",FT="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function $g(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 oi(e,t){if(!e||!t)return!1;const r=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(r&&Ml(r)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function Wo(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Gu(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 jT(e){return e.matches("html,body")}function Jr(e){return e?.ownerDocument||document}function VT(e){return Qt(e)&&e.matches(FT)}function $T(e){if(!e||UT())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function HT(e){return e?e.hasAttribute(Vg)?e:e.querySelector("["+Vg+"]")||e:null}function Bl(e,t,r){return r===void 0&&(r=!0),e.filter(i=>{var a;return i.parentId===t&&(!r||((a=i.context)==null?void 0:a.open))}).flatMap(i=>[i,...Bl(e,i.id,r)])}function BT(e){return"nativeEvent"in e}function Yu(e,t){const r=["mouse","pen"];return r.push("",void 0),r.includes(e)}var zT=typeof document<"u",WT=function(){},Go=zT?I.useLayoutEffect:WT;const GT={...vp};function zl(e){const t=I.useRef(e);return Go(()=>{t.current=e}),t}const YT=GT.useInsertionEffect||(e=>e());function Ln(e){const t=I.useRef(()=>{});return YT(()=>{t.current=e}),I.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)},[])}function Hg(e,t,r){let{reference:s,floating:i}=e;const a=xr(t),c=zu(t),u=Bu(c),f=qr(t),p=a==="y",m=s.x+s.width/2-i.width/2,E=s.y+s.height/2-i.height/2,y=s[u]/2-i[u]/2;let v;switch(f){case"top":v={x:m,y:s.y-i.height};break;case"bottom":v={x:m,y:s.y+s.height};break;case"right":v={x:s.x+s.width,y:E};break;case"left":v={x:s.x-i.width,y:E};break;default:v={x:s.x,y:s.y}}switch(ri(t)){case"start":v[c]-=y*(r&&p?-1:1);break;case"end":v[c]+=y*(r&&p?-1:1);break}return v}async function KT(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:y=!1,padding:v=0}=ni(t,e),w=jg(v),S=u[y?E==="floating"?"reference":"floating":E],R=Hl(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})),N=E==="floating"?{x:s,y:i,width:c.floating.width,height:c.floating.height}:c.reference,b=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),T=await(a.isElement==null?void 0:a.isElement(b))?await(a.getScale==null?void 0:a.getScale(b))||{x:1,y:1}:{x:1,y:1},L=Hl(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:N,offsetParent:b,strategy:f}):N);return{top:(R.top-L.top+w.top)/T.y,bottom:(L.bottom-R.bottom+w.bottom)/T.y,left:(R.left-L.left+w.left)/T.x,right:(L.right-R.right+w.right)/T.x}}const XT=50,QT=async(e,t,r)=>{const{placement:s="bottom",strategy:i="absolute",middleware:a=[],platform:c}=r,u=c.detectOverflow?c:{...c,detectOverflow:KT},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}=Hg(p,s,f),y=s,v=0;const w={};for(let _=0;_<a.length;_++){const S=a[_];if(!S)continue;const{name:R,fn:N}=S,{x:b,y:T,data:L,reset:D}=await N({x:m,y:E,initialPlacement:s,placement:y,strategy:i,middlewareData:w,rects:p,platform:u,elements:{reference:e,floating:t}});m=b??m,E=T??E,w[R]={...w[R],...L},D&&v<XT&&(v++,typeof D=="object"&&(D.placement&&(y=D.placement),D.rects&&(p=D.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):D.rects),{x:m,y:E}=Hg(p,y,f)),_=-1)}return{x:m,y:E,placement:y,strategy:i,middlewareData:w}},qT=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}=ni(e,t)||{};if(p==null)return{};const E=jg(m),y={x:r,y:s},v=zu(i),w=Bu(v),_=await c.getDimensions(p),S=v==="y",R=S?"top":"left",N=S?"bottom":"right",b=S?"clientHeight":"clientWidth",T=a.reference[w]+a.reference[v]-y[v]-a.floating[w],L=y[v]-a.reference[v],D=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p));let V=D?D[b]:0;(!V||!await(c.isElement==null?void 0:c.isElement(D)))&&(V=u.floating[b]||a.floating[w]);const K=T/2-L/2,X=V/2-_[w]/2-1,G=zo(E[R],X),te=zo(E[N],X),re=G,J=V-_[w]-te,C=V/2-_[w]/2+K,z=Hu(re,C,J),H=!f.arrow&&ri(i)!=null&&C!==z&&a.reference[w]/2-(C<re?G:te)-_[w]/2<0,W=H?C<re?C-re:C-J:0;return{[v]:y[v]+W,data:{[v]:z,centerOffset:C-z-W,...H&&{alignmentOffset:W}},reset:H}}}),JT=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:y,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:_=!0,...S}=ni(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const R=qr(i),N=xr(u),b=qr(u)===u,T=await(f.isRTL==null?void 0:f.isRTL(p.floating)),L=y||(b||!_?[$l(u)]:TT(u)),D=w!=="none";!y&&D&&L.push(...bT(u,_,w,T));const V=[u,...L],K=await f.detectOverflow(t,S),X=[];let G=((s=a.flip)==null?void 0:s.overflows)||[];if(m&&X.push(K[R]),E){const C=OT(i,c,T);X.push(K[C[0]],K[C[1]])}if(G=[...G,{placement:i,overflows:X}],!X.every(C=>C<=0)){var te,re;const C=(((te=a.flip)==null?void 0:te.index)||0)+1,z=V[C];if(z&&(!(E==="alignment"?N!==xr(z):!1)||G.every(P=>xr(P.placement)===N?P.overflows[0]>0:!0)))return{data:{index:C,overflows:G},reset:{placement:z}};let H=(re=G.filter(W=>W.overflows[0]<=0).sort((W,P)=>W.overflows[1]-P.overflows[1])[0])==null?void 0:re.placement;if(!H)switch(v){case"bestFit":{var J;const W=(J=G.filter(P=>{if(D){const U=xr(P.placement);return U===N||U==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(U=>U>0).reduce((U,$)=>U+$,0)]).sort((P,U)=>P[1]-U[1])[0])==null?void 0:J[0];W&&(H=W);break}case"initialPlacement":H=u;break}if(i!==H)return{reset:{placement:H}}}return{}}}},ZT=new Set(["left","top"]);async function eC(e,t){const{placement:r,platform:s,elements:i}=e,a=await(s.isRTL==null?void 0:s.isRTL(i.floating)),c=qr(r),u=ri(r),f=xr(r)==="y",p=ZT.has(c)?-1:1,m=a&&f?-1:1,E=ni(t,e);let{mainAxis:y,crossAxis:v,alignmentAxis:w}=typeof E=="number"?{mainAxis:E,crossAxis:0,alignmentAxis:null}:{mainAxis:E.mainAxis||0,crossAxis:E.crossAxis||0,alignmentAxis:E.alignmentAxis};return u&&typeof w=="number"&&(v=u==="end"?w*-1:w),f?{x:v*m,y:y*p}:{x:y*p,y:v*m}}const tC=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,s;const{x:i,y:a,placement:c,middlewareData:u}=t,f=await eC(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}}}}},nC=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:s,placement:i,platform:a}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:f={fn:R=>{let{x:N,y:b}=R;return{x:N,y:b}}},...p}=ni(e,t),m={x:r,y:s},E=await a.detectOverflow(t,p),y=xr(qr(i)),v=Pg(y);let w=m[v],_=m[y];if(c){const R=v==="y"?"top":"left",N=v==="y"?"bottom":"right",b=w+E[R],T=w-E[N];w=Hu(b,w,T)}if(u){const R=y==="y"?"top":"left",N=y==="y"?"bottom":"right",b=_+E[R],T=_-E[N];_=Hu(b,_,T)}const S=f.fn({...t,[v]:w,[y]:_});return{...S,data:{x:S.x-r,y:S.y-s,enabled:{[v]:c,[y]:u}}}}}};function Bg(e){const t=qt(e);let r=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const i=Qt(e),a=i?e.offsetWidth:r,c=i?e.offsetHeight:s,u=jl(r)!==a||jl(s)!==c;return u&&(r=a,s=c),{width:r,height:s,$:u}}function Ku(e){return Fe(e)?e:e.contextElement}function Yo(e){const t=Ku(e);if(!Qt(t))return bn(1);const r=t.getBoundingClientRect(),{width:s,height:i,$:a}=Bg(t);let c=(a?jl(r.width):r.width)/s,u=(a?jl(r.height):r.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const rC=bn(0);function zg(e){const t=Ct(e);return!Ul()||!t.visualViewport?rC:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oC(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ct(e)?!1:t}function Zr(e,t,r,s){t===void 0&&(t=!1),r===void 0&&(r=!1);const i=e.getBoundingClientRect(),a=Ku(e);let c=bn(1);t&&(s?Fe(s)&&(c=Yo(s)):c=Yo(e));const u=oC(a,r,s)?zg(a):bn(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 y=Ct(a),v=s&&Fe(s)?Ct(s):s;let w=y,_=$u(w);for(;_&&s&&v!==w;){const S=Yo(_),R=_.getBoundingClientRect(),N=qt(_),b=R.left+(_.clientLeft+parseFloat(N.paddingLeft))*S.x,T=R.top+(_.clientTop+parseFloat(N.paddingTop))*S.y;f*=S.x,p*=S.y,m*=S.x,E*=S.y,f+=b,p+=T,w=Ct(_),_=$u(w)}}return Hl({width:m,height:E,x:f,y:p})}function Wl(e,t){const r=Fl(e).scrollLeft;return t?t.left+r:Zr(In(e)).left+r}function Wg(e,t){const r=e.getBoundingClientRect(),s=r.left+t.scrollLeft-Wl(e,r),i=r.top+t.scrollTop;return{x:s,y:i}}function sC(e){let{elements:t,rect:r,offsetParent:s,strategy:i}=e;const a=i==="fixed",c=In(s),u=t?Pl(t.floating):!1;if(s===c||u&&a)return r;let f={scrollLeft:0,scrollTop:0},p=bn(1);const m=bn(0),E=Qt(s);if((E||!E&&!a)&&((Bo(s)!=="body"||ti(c))&&(f=Fl(s)),E)){const v=Zr(s);p=Yo(s),m.x=v.x+s.clientLeft,m.y=v.y+s.clientTop}const y=c&&!E&&!a?Wg(c,f):bn(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-f.scrollLeft*p.x+m.x+y.x,y:r.y*p.y-f.scrollTop*p.y+m.y+y.y}}function iC(e){return Array.from(e.getClientRects())}function lC(e){const t=In(e),r=Fl(e),s=e.ownerDocument.body,i=Qr(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=Qr(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let c=-r.scrollLeft+Wl(e);const u=-r.scrollTop;return qt(s).direction==="rtl"&&(c+=Qr(t.clientWidth,s.clientWidth)-i),{width:i,height:a,x:c,y:u}}const Gg=25;function aC(e,t){const r=Ct(e),s=In(e),i=r.visualViewport;let a=s.clientWidth,c=s.clientHeight,u=0,f=0;if(i){a=i.width,c=i.height;const m=Ul();(!m||m&&t==="fixed")&&(u=i.offsetLeft,f=i.offsetTop)}const p=Wl(s);if(p<=0){const m=s.ownerDocument,E=m.body,y=getComputedStyle(E),v=m.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,w=Math.abs(s.clientWidth-E.clientWidth-v);w<=Gg&&(a-=w)}else p<=Gg&&(a+=p);return{width:a,height:c,x:u,y:f}}function cC(e,t){const r=Zr(e,!0,t==="fixed"),s=r.top+e.clientTop,i=r.left+e.clientLeft,a=Qt(e)?Yo(e):bn(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 Yg(e,t,r){let s;if(t==="viewport")s=aC(e,r);else if(t==="document")s=lC(In(e));else if(Fe(t))s=cC(t,r);else{const i=zg(e);s={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Hl(s)}function Kg(e,t){const r=Qn(e);return r===t||!Fe(r)||Xn(r)?!1:qt(r).position==="fixed"||Kg(r,t)}function uC(e,t){const r=t.get(e);if(r)return r;let s=vr(e,[],!1).filter(u=>Fe(u)&&Bo(u)!=="body"),i=null;const a=qt(e).position==="fixed";let c=a?Qn(e):e;for(;Fe(c)&&!Xn(c);){const u=qt(c),f=Vu(c);!f&&u.position==="fixed"&&(i=null),(a?!f&&!i:!f&&u.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||ti(c)&&!f&&Kg(e,c))?s=s.filter(m=>m!==c):i=u,c=Qn(c)}return t.set(e,s),s}function dC(e){let{element:t,boundary:r,rootBoundary:s,strategy:i}=e;const c=[...r==="clippingAncestors"?Pl(t)?[]:uC(t,this._c):[].concat(r),s],u=Yg(t,c[0],i);let f=u.top,p=u.right,m=u.bottom,E=u.left;for(let y=1;y<c.length;y++){const v=Yg(t,c[y],i);f=Qr(v.top,f),p=zo(v.right,p),m=zo(v.bottom,m),E=Qr(v.left,E)}return{width:p-E,height:m-f,x:E,y:f}}function fC(e){const{width:t,height:r}=Bg(e);return{width:t,height:r}}function pC(e,t,r){const s=Qt(t),i=In(t),a=r==="fixed",c=Zr(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const f=bn(0);function p(){f.x=Wl(i)}if(s||!s&&!a)if((Bo(t)!=="body"||ti(i))&&(u=Fl(t)),s){const v=Zr(t,!0,a,t);f.x=v.x+t.clientLeft,f.y=v.y+t.clientTop}else i&&p();a&&!s&&i&&p();const m=i&&!s&&!a?Wg(i,u):bn(0),E=c.left+u.scrollLeft-f.x-m.x,y=c.top+u.scrollTop-f.y-m.y;return{x:E,y,width:c.width,height:c.height}}function Xu(e){return qt(e).position==="static"}function Xg(e,t){if(!Qt(e)||qt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return In(e)===r&&(r=r.ownerDocument.body),r}function Qg(e,t){const r=Ct(e);if(Pl(e))return r;if(!Qt(e)){let i=Qn(e);for(;i&&!Xn(i);){if(Fe(i)&&!Xu(i))return i;i=Qn(i)}return r}let s=Xg(e,t);for(;s&&ST(s)&&Xu(s);)s=Xg(s,t);return s&&Xn(s)&&Xu(s)&&!Vu(s)?r:s||RT(e)||r}const hC=async function(e){const t=this.getOffsetParent||Qg,r=this.getDimensions,s=await r(e.floating);return{reference:pC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function mC(e){return qt(e).direction==="rtl"}const gC={convertOffsetParentRelativeRectToViewportRelativeRect:sC,getDocumentElement:In,getClippingRect:dC,getOffsetParent:Qg,getElementRects:hC,getClientRects:iC,getDimensions:fC,getScale:Yo,isElement:Fe,isRTL:mC};function qg(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function EC(e,t){let r=null,s;const i=In(e);function a(){var u;clearTimeout(s),(u=r)==null||u.disconnect(),r=null}function c(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),a();const p=e.getBoundingClientRect(),{left:m,top:E,width:y,height:v}=p;if(u||t(),!y||!v)return;const w=Vl(E),_=Vl(i.clientWidth-(m+y)),S=Vl(i.clientHeight-(E+v)),R=Vl(m),b={rootMargin:-w+"px "+-_+"px "+-S+"px "+-R+"px",threshold:Qr(0,zo(1,f))||1};let T=!0;function L(D){const V=D[0].intersectionRatio;if(V!==f){if(!T)return c();V?c(!1,V):s=setTimeout(()=>{c(!1,1e-7)},1e3)}V===1&&!qg(p,e.getBoundingClientRect())&&c(),T=!1}try{r=new IntersectionObserver(L,{...b,root:i.ownerDocument})}catch{r=new IntersectionObserver(L,b)}r.observe(e)}return c(!0),a}function yC(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?vr(p):[],...t?vr(t):[]]:[];m.forEach(R=>{i&&R.addEventListener("scroll",r,{passive:!0}),a&&R.addEventListener("resize",r)});const E=p&&u?EC(p,r):null;let y=-1,v=null;c&&(v=new ResizeObserver(R=>{let[N]=R;N&&N.target===p&&v&&t&&(v.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var b;(b=v)==null||b.observe(t)})),r()}),p&&!f&&v.observe(p),t&&v.observe(t));let w,_=f?Zr(e):null;f&&S();function S(){const R=Zr(e);_&&!qg(_,R)&&r(),_=R,w=requestAnimationFrame(S)}return r(),()=>{var R;m.forEach(N=>{i&&N.removeEventListener("scroll",r),a&&N.removeEventListener("resize",r)}),E?.(),(R=v)==null||R.disconnect(),v=null,f&&cancelAnimationFrame(w)}}const vC=tC,xC=nC,SC=JT,Jg=qT,_C=(e,t,r)=>{const s=new Map,i={platform:gC,...r},a={...i.platform,_c:s};return QT(e,t,{...i,platform:a})};var wC=typeof document<"u",RC=function(){},Gl=wC?I.useLayoutEffect:RC;function Yl(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(!Yl(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)&&!Yl(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Zg(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eE(e,t){const r=Zg(e);return Math.round(t*r)/r}function Qu(e){const t=I.useRef(e);return Gl(()=>{t.current=e}),t}function NC(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]=I.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[y,v]=I.useState(s);Yl(y,s)||v(s);const[w,_]=I.useState(null),[S,R]=I.useState(null),N=I.useCallback(P=>{P!==D.current&&(D.current=P,_(P))},[]),b=I.useCallback(P=>{P!==V.current&&(V.current=P,R(P))},[]),T=a||w,L=c||S,D=I.useRef(null),V=I.useRef(null),K=I.useRef(m),X=f!=null,G=Qu(f),te=Qu(i),re=Qu(p),J=I.useCallback(()=>{if(!D.current||!V.current)return;const P={placement:t,strategy:r,middleware:y};te.current&&(P.platform=te.current),_C(D.current,V.current,P).then(U=>{const $={...U,isPositioned:re.current!==!1};C.current&&!Yl(K.current,$)&&(K.current=$,tu.flushSync(()=>{E($)}))})},[y,t,r,te,re]);Gl(()=>{p===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,E(P=>({...P,isPositioned:!1})))},[p]);const C=I.useRef(!1);Gl(()=>(C.current=!0,()=>{C.current=!1}),[]),Gl(()=>{if(T&&(D.current=T),L&&(V.current=L),T&&L){if(G.current)return G.current(T,L,J);J()}},[T,L,J,G,X]);const z=I.useMemo(()=>({reference:D,floating:V,setReference:N,setFloating:b}),[N,b]),H=I.useMemo(()=>({reference:T,floating:L}),[T,L]),W=I.useMemo(()=>{const P={position:r,left:0,top:0};if(!H.floating)return P;const U=eE(H.floating,m.x),$=eE(H.floating,m.y);return u?{...P,transform:"translate("+U+"px, "+$+"px)",...Zg(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:U,top:$}},[r,u,H.floating,m.x,m.y]);return I.useMemo(()=>({...m,update:J,refs:z,elements:H,floatingStyles:W}),[m,J,z,H,W])}const OC=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?Jg({element:s.current,padding:i}).fn(r):{}:s?Jg({element:s,padding:i}).fn(r):{}}}},TC=(e,t)=>{const r=vC(e);return{name:r.name,fn:r.fn,options:[e,t]}},CC=(e,t)=>{const r=xC(e);return{name:r.name,fn:r.fn,options:[e,t]}},AC=(e,t)=>{const r=SC(e);return{name:r.name,fn:r.fn,options:[e,t]}},IC=(e,t)=>{const r=OC(e);return{name:r.name,fn:r.fn,options:[e,t]}};function tE(e){const t=I.useRef(void 0),r=I.useCallback(s=>{const i=e.map(a=>{if(a!=null){if(typeof a=="function"){const c=a,u=c(s);return typeof u=="function"?u:()=>{c(null)}}return a.current=s,()=>{a.current=null}}});return()=>{i.forEach(a=>a?.())}},e);return I.useMemo(()=>e.every(s=>s==null)?null:s=>{t.current&&(t.current(),t.current=void 0),s!=null&&(t.current=r(s))},e)}const bC="data-floating-ui-focusable",nE="active",rE="selected",LC={...vp};let oE=!1,DC=0;const sE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+DC++;function kC(){const[e,t]=I.useState(()=>oE?sE():void 0);return Go(()=>{e==null&&t(sE())},[]),I.useEffect(()=>{oE=!0},[]),e}const iE=LC.useId||kC;function MC(){const e=new Map;return{emit(t,r){var s;(s=e.get(t))==null||s.forEach(i=>i(r))},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r)},off(t,r){var s;(s=e.get(t))==null||s.delete(r)}}}const PC=I.createContext(null),UC=I.createContext(null),qu=()=>{var e;return((e=I.useContext(PC))==null?void 0:e.id)||null},Ju=()=>I.useContext(UC);function Zu(e){return"data-floating-ui-"+e}function At(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const lE=Zu("safe-polygon");function ed(e,t,r){if(r&&!Yu(r))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const s=e();return typeof s=="number"?s:s?.[t]}return e?.[t]}function td(e){return typeof e=="function"?e():e}function FC(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,dataRef:i,events:a,elements:c}=e,{enabled:u=!0,delay:f=0,handleClose:p=null,mouseOnly:m=!1,restMs:E=0,move:y=!0}=t,v=Ju(),w=qu(),_=zl(p),S=zl(f),R=zl(r),N=zl(E),b=I.useRef(),T=I.useRef(-1),L=I.useRef(),D=I.useRef(-1),V=I.useRef(!0),K=I.useRef(!1),X=I.useRef(()=>{}),G=I.useRef(!1),te=Ln(()=>{var W;const P=(W=i.current.openEvent)==null?void 0:W.type;return P?.includes("mouse")&&P!=="mousedown"});I.useEffect(()=>{if(!u)return;function W(P){let{open:U}=P;U||(At(T),At(D),V.current=!0,G.current=!1)}return a.on("openchange",W),()=>{a.off("openchange",W)}},[u,a]),I.useEffect(()=>{if(!u||!_.current||!r)return;function W(U){te()&&s(!1,U,"hover")}const P=Jr(c.floating).documentElement;return P.addEventListener("mouseleave",W),()=>{P.removeEventListener("mouseleave",W)}},[c.floating,r,s,u,_,te]);const re=I.useCallback(function(W,P,U){P===void 0&&(P=!0),U===void 0&&(U="hover");const $=ed(S.current,"close",b.current);$&&!L.current?(At(T),T.current=window.setTimeout(()=>s(!1,W,U),$)):P&&(At(T),s(!1,W,U))},[S,s]),J=Ln(()=>{X.current(),L.current=void 0}),C=Ln(()=>{if(K.current){const W=Jr(c.floating).body;W.style.pointerEvents="",W.removeAttribute(lE),K.current=!1}}),z=Ln(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);I.useEffect(()=>{if(!u)return;function W(j){if(At(T),V.current=!1,m&&!Yu(b.current)||td(N.current)>0&&!ed(S.current,"open"))return;const ee=ed(S.current,"open",b.current);ee?T.current=window.setTimeout(()=>{R.current||s(!0,j,"hover")},ee):r||s(!0,j,"hover")}function P(j){if(z()){C();return}X.current();const ee=Jr(c.floating);if(At(D),G.current=!1,_.current&&i.current.floatingContext){r||At(T),L.current=_.current({...i.current.floatingContext,tree:v,x:j.clientX,y:j.clientY,onClose(){C(),J(),z()||re(j,!0,"safe-polygon")}});const se=L.current;ee.addEventListener("mousemove",se),X.current=()=>{ee.removeEventListener("mousemove",se)};return}(b.current!=="touch"||!oi(c.floating,j.relatedTarget))&&re(j)}function U(j){z()||i.current.floatingContext&&(_.current==null||_.current({...i.current.floatingContext,tree:v,x:j.clientX,y:j.clientY,onClose(){C(),J(),z()||re(j)}})(j))}function $(){At(T)}function k(j){z()||re(j,!1)}if(Fe(c.domReference)){const j=c.domReference,ee=c.floating;return r&&j.addEventListener("mouseleave",U),y&&j.addEventListener("mousemove",W,{once:!0}),j.addEventListener("mouseenter",W),j.addEventListener("mouseleave",P),ee&&(ee.addEventListener("mouseleave",U),ee.addEventListener("mouseenter",$),ee.addEventListener("mouseleave",k)),()=>{r&&j.removeEventListener("mouseleave",U),y&&j.removeEventListener("mousemove",W),j.removeEventListener("mouseenter",W),j.removeEventListener("mouseleave",P),ee&&(ee.removeEventListener("mouseleave",U),ee.removeEventListener("mouseenter",$),ee.removeEventListener("mouseleave",k))}}},[c,u,e,m,y,re,J,C,s,r,R,v,S,_,i,z,N]),Go(()=>{var W;if(u&&r&&(W=_.current)!=null&&(W=W.__options)!=null&&W.blockPointerEvents&&te()){K.current=!0;const U=c.floating;if(Fe(c.domReference)&&U){var P;const $=Jr(c.floating).body;$.setAttribute(lE,"");const k=c.domReference,j=v==null||(P=v.nodesRef.current.find(ee=>ee.id===w))==null||(P=P.context)==null?void 0:P.elements.floating;return j&&(j.style.pointerEvents=""),$.style.pointerEvents="none",k.style.pointerEvents="auto",U.style.pointerEvents="auto",()=>{$.style.pointerEvents="",k.style.pointerEvents="",U.style.pointerEvents=""}}}},[u,r,w,c,v,_,te]),Go(()=>{r||(b.current=void 0,G.current=!1,J(),C())},[r,J,C]),I.useEffect(()=>()=>{J(),At(T),At(D),C()},[u,c.domReference,J,C]);const H=I.useMemo(()=>{function W(P){b.current=P.pointerType}return{onPointerDown:W,onPointerEnter:W,onMouseMove(P){const{nativeEvent:U}=P;function $(){!V.current&&!R.current&&s(!0,U,"hover")}m&&!Yu(b.current)||r||td(N.current)===0||G.current&&P.movementX**2+P.movementY**2<2||(At(D),b.current==="touch"?$():(G.current=!0,D.current=window.setTimeout($,td(N.current))))}}},[m,s,r,R,N]);return I.useMemo(()=>u?{reference:H}:{},[u,H])}function nd(e,t){if(!e||!t)return!1;const r=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(r&&Ml(r)){let s=t;for(;s;){if(e===s)return!0;s=s.parentNode||s.host}}return!1}function jC(e){return"composedPath"in e?e.composedPath()[0]:e.target}const VC={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},$C={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},aE=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 HC(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,elements:i,dataRef:a}=e,{enabled:c=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:p="pointerdown",referencePress:m=!1,referencePressEvent:E="pointerdown",ancestorScroll:y=!1,bubbles:v,capture:w}=t,_=Ju(),S=Ln(typeof f=="function"?f:()=>!1),R=typeof f=="function"?S:f,N=I.useRef(!1),{escapeKey:b,outsidePress:T}=aE(v),{escapeKey:L,outsidePress:D}=aE(w),V=I.useRef(!1),K=Ln(C=>{var z;if(!r||!c||!u||C.key!=="Escape"||V.current)return;const H=(z=a.current.floatingContext)==null?void 0:z.nodeId,W=_?Bl(_.nodesRef.current,H):[];if(!b&&(C.stopPropagation(),W.length>0)){let P=!0;if(W.forEach(U=>{var $;if(($=U.context)!=null&&$.open&&!U.context.dataRef.current.__escapeKeyBubbles){P=!1;return}}),!P)return}s(!1,BT(C)?C.nativeEvent:C,"escape-key")}),X=Ln(C=>{var z;const H=()=>{var W;K(C),(W=Wo(C))==null||W.removeEventListener("keydown",H)};(z=Wo(C))==null||z.addEventListener("keydown",H)}),G=Ln(C=>{var z;const H=a.current.insideReactTree;a.current.insideReactTree=!1;const W=N.current;if(N.current=!1,p==="click"&&W||H||typeof R=="function"&&!R(C))return;const P=Wo(C),U="["+Zu("inert")+"]",$=Jr(i.floating).querySelectorAll(U);let k=Fe(P)?P:null;for(;k&&!Xn(k);){const se=Qn(k);if(Xn(se)||!Fe(se))break;k=se}if($.length&&Fe(P)&&!jT(P)&&!oi(P,i.floating)&&Array.from($).every(se=>!oi(k,se)))return;if(Qt(P)&&J){const se=Xn(P),ue=qt(P),pe=/auto|scroll/,de=se||pe.test(ue.overflowX),he=se||pe.test(ue.overflowY),Re=de&&P.clientWidth>0&&P.scrollWidth>P.clientWidth,je=he&&P.clientHeight>0&&P.scrollHeight>P.clientHeight,ze=ue.direction==="rtl",lt=je&&(ze?C.offsetX<=P.offsetWidth-P.clientWidth:C.offsetX>P.clientWidth),at=Re&&C.offsetY>P.clientHeight;if(lt||at)return}const j=(z=a.current.floatingContext)==null?void 0:z.nodeId,ee=_&&Bl(_.nodesRef.current,j).some(se=>{var ue;return Gu(C,(ue=se.context)==null?void 0:ue.elements.floating)});if(Gu(C,i.floating)||Gu(C,i.domReference)||ee)return;const oe=_?Bl(_.nodesRef.current,j):[];if(oe.length>0){let se=!0;if(oe.forEach(ue=>{var pe;if((pe=ue.context)!=null&&pe.open&&!ue.context.dataRef.current.__outsidePressBubbles){se=!1;return}}),!se)return}s(!1,C,"outside-press")}),te=Ln(C=>{var z;const H=()=>{var W;G(C),(W=Wo(C))==null||W.removeEventListener(p,H)};(z=Wo(C))==null||z.addEventListener(p,H)});I.useEffect(()=>{if(!r||!c)return;a.current.__escapeKeyBubbles=b,a.current.__outsidePressBubbles=T;let C=-1;function z($){s(!1,$,"ancestor-scroll")}function H(){window.clearTimeout(C),V.current=!0}function W(){C=window.setTimeout(()=>{V.current=!1},Ul()?5:0)}const P=Jr(i.floating);u&&(P.addEventListener("keydown",L?X:K,L),P.addEventListener("compositionstart",H),P.addEventListener("compositionend",W)),R&&P.addEventListener(p,D?te:G,D);let U=[];return y&&(Fe(i.domReference)&&(U=vr(i.domReference)),Fe(i.floating)&&(U=U.concat(vr(i.floating))),!Fe(i.reference)&&i.reference&&i.reference.contextElement&&(U=U.concat(vr(i.reference.contextElement)))),U=U.filter($=>{var k;return $!==((k=P.defaultView)==null?void 0:k.visualViewport)}),U.forEach($=>{$.addEventListener("scroll",z,{passive:!0})}),()=>{u&&(P.removeEventListener("keydown",L?X:K,L),P.removeEventListener("compositionstart",H),P.removeEventListener("compositionend",W)),R&&P.removeEventListener(p,D?te:G,D),U.forEach($=>{$.removeEventListener("scroll",z)}),window.clearTimeout(C)}},[a,i,u,R,p,r,s,y,c,b,T,K,L,X,G,D,te]),I.useEffect(()=>{a.current.insideReactTree=!1},[a,R,p]);const re=I.useMemo(()=>({onKeyDown:K,...m&&{[VC[E]]:C=>{s(!1,C.nativeEvent,"reference-press")},...E!=="click"&&{onClick(C){s(!1,C.nativeEvent,"reference-press")}}}}),[K,s,m,E]),J=I.useMemo(()=>{function C(z){z.button===0&&(N.current=!0)}return{onKeyDown:K,onMouseDown:C,onMouseUp:C,[$C[p]]:()=>{a.current.insideReactTree=!0}}},[K,p,a]);return I.useMemo(()=>c?{reference:re,floating:J}:{},[c,re,J])}function BC(e){const{open:t=!1,onOpenChange:r,elements:s}=e,i=iE(),a=I.useRef({}),[c]=I.useState(()=>MC()),u=qu()!=null,[f,p]=I.useState(s.reference),m=Ln((v,w,_)=>{a.current.openEvent=v?w:void 0,c.emit("openchange",{open:v,event:w,reason:_,nested:u}),r?.(v,w,_)}),E=I.useMemo(()=>({setPositionReference:p}),[]),y=I.useMemo(()=>({reference:f||s.reference||null,floating:s.floating||null,domReference:s.reference}),[f,s.reference,s.floating]);return I.useMemo(()=>({dataRef:a,open:t,onOpenChange:m,elements:y,events:c,floatingId:i,refs:E}),[t,m,y,c,i,E])}function zC(e){e===void 0&&(e={});const{nodeId:t}=e,r=BC({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||r,i=s.elements,[a,c]=I.useState(null),[u,f]=I.useState(null),m=i?.domReference||a,E=I.useRef(null),y=Ju();Go(()=>{m&&(E.current=m)},[m]);const v=NC({...e,elements:{...i,...u&&{reference:u}}}),w=I.useCallback(b=>{const T=Fe(b)?{getBoundingClientRect:()=>b.getBoundingClientRect(),getClientRects:()=>b.getClientRects(),contextElement:b}:b;f(T),v.refs.setReference(T)},[v.refs]),_=I.useCallback(b=>{(Fe(b)||b===null)&&(E.current=b,c(b)),(Fe(v.refs.reference.current)||v.refs.reference.current===null||b!==null&&!Fe(b))&&v.refs.setReference(b)},[v.refs]),S=I.useMemo(()=>({...v.refs,setReference:_,setPositionReference:w,domReference:E}),[v.refs,_,w]),R=I.useMemo(()=>({...v.elements,domReference:m}),[v.elements,m]),N=I.useMemo(()=>({...v,...s,refs:S,elements:R,nodeId:t}),[v,S,R,t,s]);return Go(()=>{s.dataRef.current.floatingContext=N;const b=y?.nodesRef.current.find(T=>T.id===t);b&&(b.context=N)}),I.useMemo(()=>({...v,context:N,refs:S,elements:R}),[v,S,R,N])}function rd(){return PT()&&MT()}function WC(e,t){t===void 0&&(t={});const{open:r,onOpenChange:s,events:i,dataRef:a,elements:c}=e,{enabled:u=!0,visibleOnly:f=!0}=t,p=I.useRef(!1),m=I.useRef(-1),E=I.useRef(!0);I.useEffect(()=>{if(!u)return;const v=Ct(c.domReference);function w(){!r&&Qt(c.domReference)&&c.domReference===$g(Jr(c.domReference))&&(p.current=!0)}function _(){E.current=!0}function S(){E.current=!1}return v.addEventListener("blur",w),rd()&&(v.addEventListener("keydown",_,!0),v.addEventListener("pointerdown",S,!0)),()=>{v.removeEventListener("blur",w),rd()&&(v.removeEventListener("keydown",_,!0),v.removeEventListener("pointerdown",S,!0))}},[c.domReference,r,u]),I.useEffect(()=>{if(!u)return;function v(w){let{reason:_}=w;(_==="reference-press"||_==="escape-key")&&(p.current=!0)}return i.on("openchange",v),()=>{i.off("openchange",v)}},[i,u]),I.useEffect(()=>()=>{At(m)},[]);const y=I.useMemo(()=>({onMouseLeave(){p.current=!1},onFocus(v){if(p.current)return;const w=Wo(v.nativeEvent);if(f&&Fe(w)){if(rd()&&!v.relatedTarget){if(!E.current&&!VT(w))return}else if(!$T(w))return}s(!0,v.nativeEvent,"focus")},onBlur(v){p.current=!1;const w=v.relatedTarget,_=v.nativeEvent,S=Fe(w)&&w.hasAttribute(Zu("focus-guard"))&&w.getAttribute("data-type")==="outside";m.current=window.setTimeout(()=>{var R;const N=$g(c.domReference?c.domReference.ownerDocument:document);!w&&N===c.domReference||oi((R=a.current.floatingContext)==null?void 0:R.refs.floating.current,N)||oi(c.domReference,N)||S||s(!1,_,"focus")})}}),[a,c.domReference,s,f]);return I.useMemo(()=>u?{reference:y}:{},[u,y])}function od(e,t,r){const s=new Map,i=r==="item";let a=e;if(i&&e){const{[nE]:c,[rE]:u,...f}=e;a=f}return{...r==="floating"&&{tabIndex:-1,[bC]:""},...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&&[nE,rE].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 y,v=arguments.length,w=new Array(v),_=0;_<v;_++)w[_]=arguments[_];return(y=s.get(p))==null?void 0:y.map(S=>S(...w)).find(S=>S!==void 0)}}}else c[p]=m}),c),{})}}function GC(e){e===void 0&&(e=[]);const t=e.map(u=>u?.reference),r=e.map(u=>u?.floating),s=e.map(u=>u?.item),i=I.useCallback(u=>od(u,e,"reference"),t),a=I.useCallback(u=>od(u,e,"floating"),r),c=I.useCallback(u=>od(u,e,"item"),s);return I.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:c}),[i,a,c])}const YC=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function KC(e,t){var r,s;t===void 0&&(t={});const{open:i,elements:a,floatingId:c}=e,{enabled:u=!0,role:f="dialog"}=t,p=iE(),m=((r=a.domReference)==null?void 0:r.id)||p,E=I.useMemo(()=>{var N;return((N=HT(a.floating))==null?void 0:N.id)||c},[a.floating,c]),y=(s=YC.get(f))!=null?s:f,w=qu()!=null,_=I.useMemo(()=>y==="tooltip"||f==="label"?{["aria-"+(f==="label"?"labelledby":"describedby")]:i?E:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":y==="alertdialog"?"dialog":y,"aria-controls":i?E:void 0,...y==="listbox"&&{role:"combobox"},...y==="menu"&&{id:m},...y==="menu"&&w&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[y,E,w,i,m,f]),S=I.useMemo(()=>{const N={id:E,...y&&{role:y}};return y==="tooltip"||f==="label"?N:{...N,...y==="menu"&&{"aria-labelledby":m}}},[y,E,m,f]),R=I.useCallback(N=>{let{active:b,selected:T}=N;const L={role:"option",...b&&{id:E+"-fui-option"}};switch(f){case"select":case"combobox":return{...L,"aria-selected":T}}return{}},[E,f]);return I.useMemo(()=>u?{reference:_,floating:S,item:R}:{},[u,_,S,R])}function cE(e,t,r){return r===void 0&&(r=!0),e.filter(i=>{var a;return i.parentId===t&&(!r||((a=i.context)==null?void 0:a.open))}).flatMap(i=>[i,...cE(e,i.id,r)])}function uE(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 XC(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function QC(e){e===void 0&&(e={});const{buffer:t=.5,blockPointerEvents:r=!1,requireIntent:s=!0}=e,i={current:-1};let a=!1,c=null,u=null,f=typeof performance<"u"?performance.now():0;function p(E,y){const v=performance.now(),w=v-f;if(c===null||u===null||w===0)return c=E,u=y,f=v,null;const _=E-c,S=y-u,N=Math.sqrt(_*_+S*S)/w;return c=E,u=y,f=v,N}const m=E=>{let{x:y,y:v,placement:w,elements:_,onClose:S,nodeId:R,tree:N}=E;return function(T){function L(){At(i),S()}if(At(i),!_.domReference||!_.floating||w==null||y==null||v==null)return;const{clientX:D,clientY:V}=T,K=[D,V],X=jC(T),G=T.type==="mouseleave",te=nd(_.floating,X),re=nd(_.domReference,X),J=_.domReference.getBoundingClientRect(),C=_.floating.getBoundingClientRect(),z=w.split("-")[0],H=y>C.right-C.width/2,W=v>C.bottom-C.height/2,P=XC(K,J),U=C.width>J.width,$=C.height>J.height,k=(U?J:C).left,j=(U?J:C).right,ee=($?J:C).top,oe=($?J:C).bottom;if(te&&(a=!0,!G))return;if(re&&(a=!1),re&&!G){a=!0;return}if(G&&Fe(T.relatedTarget)&&nd(_.floating,T.relatedTarget)||N&&cE(N.nodesRef.current,R).length)return;if(z==="top"&&v>=J.bottom-1||z==="bottom"&&v<=J.top+1||z==="left"&&y>=J.right-1||z==="right"&&y<=J.left+1)return L();let se=[];switch(z){case"top":se=[[k,J.top+1],[k,C.bottom-1],[j,C.bottom-1],[j,J.top+1]];break;case"bottom":se=[[k,C.top+1],[k,J.bottom-1],[j,J.bottom-1],[j,C.top+1]];break;case"left":se=[[C.right-1,oe],[C.right-1,ee],[J.left+1,ee],[J.left+1,oe]];break;case"right":se=[[J.right-1,oe],[J.right-1,ee],[C.left+1,ee],[C.left+1,oe]];break}function ue(pe){let[de,he]=pe;switch(z){case"top":{const Re=[U?de+t/2:H?de+t*4:de-t*4,he+t+1],je=[U?de-t/2:H?de+t*4:de-t*4,he+t+1],ze=[[C.left,H||U?C.bottom-t:C.top],[C.right,H?U?C.bottom-t:C.top:C.bottom-t]];return[Re,je,...ze]}case"bottom":{const Re=[U?de+t/2:H?de+t*4:de-t*4,he-t],je=[U?de-t/2:H?de+t*4:de-t*4,he-t],ze=[[C.left,H||U?C.top+t:C.bottom],[C.right,H?U?C.top+t:C.bottom:C.top+t]];return[Re,je,...ze]}case"left":{const Re=[de+t+1,$?he+t/2:W?he+t*4:he-t*4],je=[de+t+1,$?he-t/2:W?he+t*4:he-t*4];return[...[[W||$?C.right-t:C.left,C.top],[W?$?C.right-t:C.left:C.right-t,C.bottom]],Re,je]}case"right":{const Re=[de-t,$?he+t/2:W?he+t*4:he-t*4],je=[de-t,$?he-t/2:W?he+t*4:he-t*4],ze=[[W||$?C.left+t:C.right,C.top],[W?$?C.left+t:C.right:C.left+t,C.bottom]];return[Re,je,...ze]}}}if(!uE([D,V],se)){if(a&&!P)return L();if(!G&&s){const pe=p(T.clientX,T.clientY);if(pe!==null&&pe<.1)return L()}uE([D,V],ue([y,v]))?!a&&s&&(i.current=window.setTimeout(L,40)):L()}}};return m.__options={blockPointerEvents:r},m}function qC({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(D=>D.rootElementId),m=I.useRef(null),[E,y]=I.useState(r),v=a??E,w=i??y,_=zC({middleware:[TC(8),AC({boundary:document.querySelector(`#${p}`)||void 0}),CC({padding:4}),IC({element:m,padding:e??{bottom:0,left:8,right:8,top:8}})],onOpenChange:w,open:v,placement:u,strategy:"fixed",whileElementsMounted:yC}),S=_.context,R=FC(S,{enabled:a==null,handleClose:s?QC():null,move:!1}),N=WC(S,{enabled:a==null}),b=HC(S,{escapeKey:t,outsidePress:c}),T=KC(S,{role:f}),L=GC([R,N,b,T]);return I.useMemo(()=>({arrowRef:m,open:v,setOpen:w,...L,..._}),[v,w,L,_])}const dE=ne.createContext(null),sd=()=>{const e=ne.useContext(dE);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},JC=({children:e,...t})=>{const r=qC(t);return h.jsx(dE.Provider,{value:r,children:e})},ZC={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"},eA=()=>{const e=sd(),[t,r]=I.useState(e.middlewareData.arrow);I.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=`${ZC[i]}`;return h.jsx("div",{ref:e.arrowRef,style:s,className:`tooltip-arrow absolute h-2 w-2 rotate-45 bg-inherit
62
14
  before:absolute before:h-2 before:w-2 before:border before:border-foreground/30 before:content-['']
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
15
+ ${a}`})},tA=ne.forwardRef(function(t,r){const{children:s,style:i,...a}=t,c=sd(),u=tE([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(eA,{})]}):null}),nA=I.forwardRef(function({children:t,asChild:r=!1,...s},i){const a=sd(),c=tE([a.refs.setReference,i,t?.ref]);return r&&I.isValidElement(t)?I.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})}),fE={bottom:"top",left:"right",right:"left",top:"bottom"},Sr=({asChild:e=!0,children:t,enable:r=!0,placement:s="right",scale:i=1,trigger:a=h.jsx(Ae,{tag:"circle-info"}),...c})=>{let u=s.split("-")[0];return u=Object.keys(fE).includes(u)?u:"right",r?h.jsxs(JC,{...c,placement:s,children:[h.jsx(nA,{asChild:e,children:a}),h.jsx(tA,{style:i!==1?{transform:`scale(${i})`,transformOrigin:fE[u]}:void 0,children:t})]}):h.jsx(h.Fragment,{children:a})},rA={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"},A={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"},oA={order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag","path","subdomain"],lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupQuerystring:"lng",lookupSessionStorage:"i18nextLng",caches:["localStorage","cookie"],excludeCacheFor:["cimode"]},sA={"en-US":{translation:rA}},iA=async()=>{await ft.use(wg).use(VO).init({debug:g1,detection:oA,fallbackLng:"en-US",interpolation:{escapeValue:!1},keySeparator:!1,resources:sA})};function Kl(e,t){return h.jsx(yT,{label:e,vars:t})}const pE=()=>ft.resolvedLanguage,lA={entries:[],nextLabelIndex:0},Ko=Po((e,t)=>({...lA,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(A.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}})}}})),id=()=>Ko.getState().actions,hE=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})}),Ko.setState({entries:t,nextLabelIndex:t.length})},aA=(e,t)=>{const r=[];return t.forEach(s=>{s.type==="recordCallStart"&&s.data.controlId&&(r.push(s.data.controlId),Ko.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,[]):[]},mE={recordCallStart:e=>{const t=Ko.getState().actions.getGeneratedLabel();return Ko.getState().actions.upsertEntry({controlId:e.data.controlId,label:t}),{...e,data:{...e.data,label:t}}}},cA=e=>typeof e=="object"&&e!==null&&Object.keys(e).length>0,uA=e=>mE[e.type]!==void 0,gE=(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:De(),position:s,selected:i,type:e}),c=(p,m)=>({...p,data:{...p.data,...m}});let u=a();const f=ng[e]();return cA(f)&&(u=c(u,f)),uA(u)&&(u=mE[u.type](u)),u},Xl={action:{label:A.ACTION,nodes:{answer:{active:!0,label:A.ANSWER_CALL},hangup:{active:!0,infoLabel:A.INFO_NODE_HANG_UP,label:A.HANG_UP_CALL},play:{active:!0,infoLabel:A.INFO_NODE_PLAY,label:A.PLAY_AUDIO_TTS},sendSms:{active:!0,infoLabel:A.INFO_NODE_SEND_SMS,label:A.SEND_SMS}}},decision:{label:A.DECISION,nodes:{cond:{active:!0,infoLabel:A.INFO_NODE_COND,label:A.CONDITIONS},executeSWML:{active:!0,infoLabel:A.INFO_NODE_EXECUTE_SWML,label:A.EXECUTE_SWML},set:{active:!0,infoLabel:A.INFO_NODE_SET_VARIABLES,label:A.SET_VARIABLES},unset:{active:!0,infoLabel:A.INFO_NODE_UNSET_VARIABLES,label:A.UNSET_VARIABLES}}},forwardTo:{label:A.FORWARD,nodes:{forwardAddress:{active:!1,infoLabel:A.INFO_NODE_FORWARD_TO_ADDRESS,label:A.FORWARD_TO_ADDRESS},forwardPhone:{active:!0,infoLabel:A.INFO_NODE_FORWARD_TO_PHONE,label:A.FORWARD_TO_PHONE},forwardResource:{active:!1,infoLabel:A.INFO_NODE_FORWARD_TO_RESOURCE,label:A.FORWARD_TO_RESOURCE}}},hidden:{label:A.HIDDEN,nodes:{handleCall:{active:!0,label:A.HANDLE_CALL}}},input:{label:A.INPUT,nodes:{aiAgent:{active:!0,infoLabel:A.INFO_NODE_AI_AGENT,label:A.AI_AGENT},condRequest:{active:!0,infoLabel:A.INFO_NODE_CONDREQUEST,label:A.REQUEST},promptPlay:{active:!0,infoLabel:A.INFO_NODE_GATHER_INPUT,label:A.GATHER_INPUT},request:{active:!1,deprecated:!0,infoLabel:A.INFO_NODE_REQUEST,label:A.REQUEST}}},recording:{label:A.RECORD,nodes:{record:{active:!0,infoLabel:A.INFO_NODE_RECORD,label:A.VOICEMAIL_RECORDING},recordCallStart:{active:!0,infoLabel:A.INFO_NODE_RECORD_CALL_START,label:A.RECORD_CALL_START},recordCallStop:{active:!0,infoLabel:A.INFO_NODE_RECORD_CALL_STOP,label:A.RECORD_CALL_STOP}}}},dA=Object.entries(Xl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([r,{label:s}])=>{e.set(r,s)}),e),new Map),fA=Object.entries(Xl).reduce((e,[,{nodes:t}])=>(Object.entries(t).forEach(([r,{infoLabel:s}])=>{e.set(r,s)}),e),new Map),Ql=Ge(),pA={aiAgentMap:new Map,error:"",status:"initial"},hA=(e,t)=>({...pA,actions:{fetchAiAgents:async()=>{try{const{actions:r}=t(),{getAiAgents:s}=r;if(!s){Ql.error("getAiAgents is not defined");return}e({status:"loading"});const i=await s(),a=Jm(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";Ql.error("Error fetching aiAgents ",r),r instanceof Error&&(s=r.message),e({aiAgentMap:new Map,error:s,status:"error"})}},init:({getAiAgentsURL:r})=>{if(!r){Ql.error("getAiAgentsURL is not defined");return}const s=Cc({getAiAgentsURL:r,headers:Au()}),i=async()=>await s.getAiAgents();e(a=>({...a,actions:{...a.actions,getAiAgents:i}}))}}}),EE=(e,t)=>{if(e.find(s=>s.type==="aiAgent")){const{fetchAiAgents:s}=Dn.getState().actions;s().then(()=>{const{aiAgentMap:i,status:a}=Dn.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=>Ql.error("Error rehydrating AiAgentStore",i))}},Dn=Po()(hA),mA=()=>Dn.getState().actions;window.__useAiAgentStore=Dn;const gA=e=>!!(e&&e>=v1),EA=e=>(t,r,s)=>(s.setState=(i,a,...c)=>{const{edges:u,detachedMode:f,httpError:p,initializing:m,isCanvasInteractive:E,isInteractiveControlOn:y,nodes:v,rootAppWidth:w,viewportChanging:_}=r(),S=typeof i=="function"?i(r()):i,R=["detachedMode","httpError","initializing","isInteractiveControlOn","rootAppWidth","viewportChanging"],N="initializing"in S?S.initializing:m;if(R.some(b=>b in S)){const b=gA("rootAppWidth"in S?S.rootAppWidth:w),T="isInteractiveControlOn"in S?S.isInteractiveControlOn:y,L="detachedMode"in S?S.detachedMode:f,D=("httpError"in S?S.httpError:p)===Ym,V="viewportChanging"in S?S.viewportChanging:_;if(S.isCanvasInteractive=!!(b&&T&&!L&&!N&&!D&&!V),S.showInteractiveControl=b&&!D&&!L,E&&!S.isCanvasInteractive){const K="nodes"in S?S.nodes:v;S.nodes=K.map(G=>({...G,selected:!1}));const X="edges"in S?S.edges:u;S.edges=X.map(G=>({...G,selected:!1})),S.selectedNode=void 0}}t(S,a,...c)},e(s.setState,r,s)),yE=1e3,si=Ge(),yA=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:Ys,nodes:f}),y={documentLastUpdated:E.updated_at,documentVersion:E.document_version},v=r().dataHandlingStatus;switch(v){case"saving":t({...y,dataHandlingStatus:"queueing",deployFlowStatus:"deploy",saveFlowStatus:"saved"});break;case"holding":t({...y,saveFlowStatus:"awaiting-save"}),si.debug("Setting up a new save for held changes"),a=setTimeout(()=>{c().catch(w=>{si.error("Error Save Flow",w)})},yE);break;default:si.debug("Invalid dataHandlingStatus",v)}}catch(E){si.error("Put Flow",E),E instanceof Error&&E.message.includes(x1)?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:y,saveFlowStatus:v}=r(),w=typeof u=="function"?u(r()):u,_="initializing"in w?w.initializing:y,S="detachedMode"in w?w.detachedMode:E;!_&&!S&&(w.nodes||w.edges)?m==="queueing"?(w.saveFlowStatus="awaiting-save",t(w,f,...p),clearTimeout(i),i=setTimeout(()=>{c().catch(N=>{si.error("Error Save Flow",N)})},yE)):(w.dataHandlingStatus="holding",t(w,f,...p)):"initializing"in w&&!w.initializing?(w.dataHandlingStatus="queueing",v!=="error"&&(w.saveFlowStatus="saved"),t(w,f,...p)):t(w,f,...p)},e(s.setState,r,s)},ql=Ge(),vA={cachedResults:new Map,error:"",results:[],status:"initial",swmlScriptMap:new Map},xA={ids:"ids",name:"name"},SA=(e,t)=>({...vA,actions:{buildParamsFromQuery:r=>{const{searchParams:s}=new URL(r,window.location.href);return D1(xA).reduce((a,c)=>{const u=s.get(c);return u&&(c==="ids"?a[c]=u.split(","):a[c]=u),a},{})},buildQueryFromParams:r=>{const s=Oc(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){ql.error("getSwmlScripts is not defined");return}e({status:"loading"});const c=await i(r),u=Jm(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";ql.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){ql.error("getSwmlScriptsURL is not defined");return}const s=Cc({getSwmlScriptsURL:r,headers:Au()}),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(_=>r.has(_))??[],y=f?.filter(_=>!r.has(_))??[],v=[...new Set([...y,...E])];v.length>0&&(Array.from(a.entries()).forEach(([S,R])=>{if(S===s){const N=R.filter(b=>!v.includes(b));a.set(S,N)}}),v.forEach(S=>{c.delete(S)})),r.forEach((_,S)=>{c.set(S,_)});const w=Array.from(r.keys());a.set(p,w),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})},Km)}})(),validateScriptsFromNodes:(r,s)=>{const{actions:i}=t(),{fetchSwmlScript:a}=i,c=new Set,u=r.filter(p=>vE(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 y=E.data.connections.map(v=>p(v)??v);typeof m=="function"&&m(y,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}=qn.getState(),{updateConnection:y}=p;E==="loaded"&&f(v=>{const w=y(v,m);return w||v},(v,w)=>{s(w.id,{connections:v})})}).catch(p=>ql.error("Error rehydrating SwmlScriptStore",p))}}}),vE=e=>e.type==="forwardAddress"||e.type==="forwardPhone"||e.type==="forwardResource",_A=(e,t)=>{if(e.some(vE)){const{validateScriptsFromNodes:s}=qn.getState().actions;s(e,t)}},qn=Po()(SA),xE=()=>qn.getState().actions;window.__useSwmlScriptStore=qn;const SE=500,wA=100,et=Ge(),RA=gE("handleCall",{deletable:!1,position:{x:300,y:100}}),ld={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},NA=(e,t)=>({...ld,actions:{addNode:({nodeType:r,x:s=150,y:i=150})=>{et.debug("Add Node",r);const{nodes:a,reactFlowInstance:c}=t();if(!c)throw new Error("ReactFlowInstance not found");const u=gE(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=De();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 eg(SE),e({edges:a,nodes:c,saveFlowStatus:u})}else et.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()=>{et.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});et.info("Deploy response",i),e({deployFlowStatus:"deployed"})}catch(r){throw et.info("Deploy error",r),e({deployFlowStatus:"error"}),r}},exportStoreData:()=>{const{nodes:r,edges:s}=t();A1(r,s)},getDeployedVersionsList:async r=>{try{const{httpService:s}=t();if(!s)throw new Error("Missing httpService");const i=await s.getFlowVersions(r),a=Zm(pE());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 et.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 yp({dbRecord:r}).migrateTo(Ys),{flow_data:p}=f;if(!p)et.error("Cannot load flow: missing flowData",p);else{i||c();const m=p.nodes.map(Qm),E=p.edges.map(Xm);e({detachedMode:!0,edges:[],initializing:!0,nodes:[]}),await eg(SE),e({edges:E,nodes:m,showDeployedHistoryToast:!0}),hE(m),EE(m,a)}},onConnect:r=>{et.debug("onConnect"),e({edges:Hh(r,t().edges)})},onConnectEnd:()=>{et.debug("onConnectEnd"),e({isEdgeConnecting:!1})},onConnectStart:()=>{et.debug("onConnectStart"),e({isEdgeConnecting:!0})},onEdgeUpdate:(r,s)=>{et.debug("onEdgeUpdate"),e({edges:wR(r,s,t().edges),isEdgeUpdateSuccessful:!0})},onEdgeUpdateEnd:(r,s)=>{et.debug("onEdgeUpdateEnd"),t().isEdgeUpdateSuccessful?e({isEdgeUpdateSuccessful:!0}):t().reactFlowInstance?.deleteElements({edges:[{id:s.id}]}),e({updatingSourceHandleId:void 0})},onEdgeUpdateStart:(r,s)=>{et.debug("onEdgeUpdateStart"),e({isEdgeUpdateSuccessful:!1,updatingSourceHandleId:s.sourceHandle??void 0})},onEdgesChange:r=>{e({edges:eN(r,t().edges)})},onEdgesDelete:r=>{et.debug("onEdgesDelete [noop]",r)},onInit:async r=>{const{actions:s,deployFlowURL:i,getFlowURL:a,updateFlowURL:c}=t(),{partialUpdateNodeData:u}=s;et.log("onInit",{getFlowURL:a,updateFlowURL:c});try{const f=Cc({deployFlowURL:i,getFlowURL:a,headers:Au(),updateFlowURL:c}),[p,m]=await Promise.all([f.getFlow(),f.getFlowVersions({pageSize:1})]),y=new yp({dbRecord:p}).migrateTo(Ys),{document_version:v,flow_data:w,id:_,title:S,updated_at:R}=y;if(m.length&&m[0]){const{document_version:b}=m[0];b===v&&e({deployFlowStatus:"deployed"})}let N=w;N||(N={edges:ld.edges,flowDataVersion:Ys,nodes:ld.nodes.concat([RA])}),e({documentLastUpdated:R,documentVersion:v,edges:N.edges.map(Xm),flowId:_,flowTitle:S,httpService:f,nodes:N.nodes.map(Qm),reactFlowInstance:r}),hE(N.nodes),EE(N.nodes,u),_A(N.nodes,u)}catch(f){et.error("Could not load flow. URL:",a);let p="unknown";f instanceof Error&&f.message.includes(S1)&&(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:Em(s,t().nodes)})},onNodesDelete:r=>{et.debug("onNodesDelete");const{actions:s}=t(),{partialUpdateNodeData:i}=s;aA(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})},wA),e({viewport:{...i},viewportChanging:!0})}return s})(),onViewportChangeEnd:()=>{},onViewportChangeStart:()=>{},partialUpdateNodeData:(r,s)=>{et.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));et.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=dA.get(s.nodeType),f={connected:s.connected,id:De(),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=>{et.debug("removeEdge",r);const s=t().reactFlowInstance;s&&s.deleteElements({edges:[{id:r}]})},removeNode:r=>{et.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=Po()(EA(yA(NA))),tt=()=>ye.getState().actions;window.__useRFStore=ye;const OA={"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"}},TA=({errorType:e})=>{const t=ye(a=>a.backButtonHref),{title:r,message:s,status:i}=OA[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(A.GO_BACK)})})]})})},_E=({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"})})}),CA=({fromHandle:e,fromNode:t,fromPosition:r,fromX:s,fromY:i,toPosition:a,toX:c,toY:u})=>{if(!t)return null;const[f]=Bs({borderRadius:Gm,sourcePosition:r,sourceX:s,sourceY:i,targetPosition:a,targetX:c,targetY:u}),{height:p,strokeWidth:m,width:E}={...Uo.markerEnd,...Uo.style},y=e?.position===xe.Left,v=y?s:c,w=y?i:u;return h.jsxs("g",{className:"cfb-connection-line",children:[h.jsx("path",{fill:"none",strokeWidth:m,className:"animated",d:f}),h.jsx(_E,{height:p,strokeWidth:m,toX:v,toY:w,width:E}),y&&h.jsx("circle",{cx:c-2,cy:u,fill:"none",r:4,strokeWidth:m})]})};function AA({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 IA=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}=tt(),E=I.useRef(null),y=Ue(I.useCallback(G=>G.nodeInternals.get(s),[s])),v=Ue(I.useCallback(G=>G.nodeInternals.get(i),[i]));if(!y||!v)return null;const w=s===i,{tx:_,ty:S}=AA({isCircular:w,targetNode:v,targetX:f,targetY:p}),[R,N,b]=Bs({borderRadius:Gm,sourcePosition:a,sourceX:c,sourceY:u,targetPosition:w?xe.Bottom:xe.Left,targetX:_,targetY:S}),T=(G,te)=>{G.stopPropagation(),m(te)},L=G=>{G.currentTarget?.classList.add("highlight"),E.current?.classList.add("animate-delay-opacity","flex"),E.current?.classList.remove("hidden")},D=G=>{G.currentTarget?.classList.remove("highlight"),E.current?.classList.remove("animate-delay-opacity","flex"),E.current?.classList.add("hidden")},{height:V,strokeWidth:K,width:X}={...Uo.markerEnd,...Uo.style};return h.jsxs("g",{onMouseEnter:L,onMouseLeave:D,children:[h.jsx(Oo,{path:R,...t}),h.jsx(_E,{height:V,strokeWidth:K,toX:_,toY:S,width:X}),h.jsx(YN,{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:G=>T(G,r),ref:E,style:{transform:`translate(-50%, -50%) translate(${N}px,${b}px)`},children:[h.jsx(Ae,{tag:"trash-can",className:"py-0.5 px-1.5 text-background"}),h.jsx("span",{className:"sr-only",children:M(A.REMOVE_EDGE)})]})})]})},bA=/^[\w\d -']+$/,LA=/^\d+$/,DA=/^\d|\*|#$/,kA=/^[\d*#$]{0,12}$/,MA=/^.{1,20}$/,Xo={MAX:3600,MIN:0},PA=/^[a-z0-9_]{1,20}$/,Be={MAX:99,MIN:1},Qo=e=>t=>!!e.exec(t),ad=e=>{if(!Vt(e))return!0;try{return!!new URL(e)}catch{return!1}},It=e=>Vt(e)?Qo(LA)(e):!0,UA=e=>Vt(e)?Qo(DA)(e):!0,FA=e=>Vt(e)?Qo(bA)(e):!0,jA=e=>Vt(e)?Qo(PA)(e):!0,wE=e=>Vt(e)?Qo(kA)(e):!0,VA=e=>Vt(e)?Qo(MA)(e):!0,Jl=e=>{if(!Vt(e))return!0;try{return JSON.parse(e),!0}catch{return!1}},ke=e=>!!Vt(e),ii=(e,t)=>{if(typeof e=="string"&&!Vt(e))return!0;const r=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(r)&&r>=t},li=(e,t)=>{if(typeof e=="string"&&!Vt(e))return!0;const r=typeof e!="number"?parseInt(e,10):e;return!Number.isNaN(r)&&r<=t},_r=(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())},Zl={aiAgent:{fieldValidators:{agent:[ke]},validate:e=>qo({nodeData:e,nodeType:"aiAgent"}),validateField:(e,t)=>be({name:e,nodeType:"aiAgent",value:t})},cond:{fieldValidators:{value:[ke]},validate:e=>ud("cond",e),validateField:(e,t)=>be({name:e,nodeType:"cond",value:t})},condRequest:{fieldValidators:{body:[],headers:[Jl],method:[ke],saveVariables:[],url:[ke],value:[ke]},validate:e=>{const t=e,r=[];return["body","headers","method","saveVariables","url"].forEach(i=>{be({name:i,nodeType:"condRequest",value:t[i]})||r.push(i)}),[...r,...ud("condRequest",e)]},validateField:(e,t)=>be({name:e,nodeType:"condRequest",value:t})},executeSWML:{fieldValidators:{dest:[ke],meta:[Jl],params:[Jl]},validate:e=>{const t=e,r=[];return["dest","params","meta"].forEach(i=>{be({name:i,nodeType:"executeSWML",value:t[i]})||r.push(i)}),[...r,...ud("executeSWML",e)]},validateField:(e,t)=>be({name:e,nodeType:"executeSWML",value:t})},forwardAddress:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[ke],connectConfirmUrl:[ke,ad],connectFrom:[],connectTimeout:[It],connectTo:[ke],defaultFrom:[],defaultTimeout:[It],sessionTimeout:[It]},validate:e=>dd("forwardAddress",e),validateField:(e,t)=>be({name:e,nodeType:"forwardAddress",value:t})},forwardPhone:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[ke],connectConfirmUrl:[ke,ad],connectFrom:[],connectTimeout:[It],connectTo:[ke],defaultFrom:[],defaultTimeout:[It],sessionTimeout:[It]},validate:e=>dd("forwardPhone",e),validateField:(e,t)=>be({name:e,nodeType:"forwardPhone",value:t})},forwardResource:{fieldValidators:{callOrder:[],callStateEvents:[],callStateUrl:[],connectConfirmDisplayName:[],connectConfirmEnabled:[],connectConfirmId:[ke],connectConfirmUrl:[ke,ad],connectFrom:[],connectTimeout:[It],connectTo:[ke],defaultFrom:[],defaultTimeout:[It],sessionTimeout:[It]},validate:e=>dd("forwardResource",e),validateField:(e,t)=>be({name:e,nodeType:"forwardResource",value:t})},hangup:{fieldValidators:{reason:[]},validate:e=>fd("hangup",e),validateField:(e,t)=>be({name:e,nodeType:"hangup",value:t})},play:{fieldValidators:{selected:[ke],text:[ke],url:[ke]},validate:e=>fd("play",e),validateField:(e,t)=>be({name:e,nodeType:"play",value:t})},promptPlay:{fieldValidators:{command:[FA],digit:[UA],digitTimeout:[It,{test:ii,testValue:Be.MIN},{test:li,testValue:Be.MAX}],initialTimeout:[It,{test:ii,testValue:Be.MIN},{test:li,testValue:Be.MAX}],selected:[ke],text:[ke],url:[ke]},validate:e=>{const t="promptPlay",r=e,s=_r(r.options,"command"),i=_r(r.options,"digit"),a=fd("promptPlay",r),c=Nc(r.initialTimeout);c?.trim()&&!be({name:"initialTimeout",nodeType:t,value:c})&&a.push("initialTimeout");const u=Nc(r.digitTimeout);return u?.trim()&&!be({name:"digitTimeout",nodeType:t,value:u})&&a.push("digitTimeout"),r.options.forEach(f=>{const p=be({name:"command",nodeType:t,value:f.command})&&!s(f.command),m=be({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)=>be({name:e,nodeType:"promptPlay",value:t})},record:{fieldValidators:{beep:[],endSilenceTimeout:[It,{test:ii,testValue:Be.MIN},{test:li,testValue:Be.MAX}],format:[ke],initialTimeout:[It,{test:ii,testValue:Be.MIN},{test:li,testValue:Be.MAX}],maxLength:[It,{test:ii,testValue:Xo.MIN},{test:li,testValue:Xo.MAX}],stereo:[],terminators:[wE]},validate:e=>qo({nodeData:e,nodeType:"record"}),validateField:(e,t)=>be({name:e,nodeType:"record",value:t})},recordCallStart:{fieldValidators:{beep:[],controlId:[],format:[ke],label:[ke,VA],stereo:[],terminators:[wE]},validate:e=>qo({nodeData:e,nodeType:"recordCallStart"}),validateField:(e,t)=>be({name:e,nodeType:"recordCallStart",value:t})},recordCallStop:{fieldValidators:{controlId:[ke]},validate:e=>qo({nodeData:e,nodeType:"recordCallStop"}),validateField:(e,t)=>be({name:e,nodeType:"recordCallStop",value:t})},request:{fieldValidators:{body:[],headers:[Jl],method:[ke],saveVariables:[],url:[ke]},validate:e=>qo({nodeData:e,nodeType:"request"}),validateField:(e,t)=>be({name:e,nodeType:"request",value:t})},sendSms:{fieldValidators:{body:[ke],fromNumber:[ke],toNumber:[ke]},validate:e=>qo({nodeData:e,nodeType:"sendSms"}),validateField:(e,t)=>be({name:e,nodeType:"sendSms",value:t})},set:{fieldValidators:{key:[ke,jA],value:[]},validate:e=>{const t=e,r="set",s=[],i=_r(t.variables,"key");return t.variables.forEach(a=>{const c=be({name:"key",nodeType:r,value:a.key})&&!i(a.key),u=be({name:"value",nodeType:r,value:a.value});c&&u||s.push(`variable_${a.id}`)}),s},validateField:(e,t)=>be({name:e,nodeType:"set",value:t})},unset:{fieldValidators:{},validate:e=>e.variables.length>0?[]:["variables"],validateField:(e,t)=>be({name:e,nodeType:"unset",value:t})}},bt=e=>{const t=Zl?.[e];return{validate:t?.validate,validateField:t?.validateField}},RE=(e,t)=>{const r=Zl[e]?.validate;return r===void 0?[]:r(t)},cd=(e,t)=>!e||!t?!1:RE(e,t)?.length===0,$A=e=>Zl[e]?.fieldValidators,be=({name:e,nodeType:t,value:r})=>{let s=!0;return $A(t)?.[e]?.forEach(a=>{typeof a=="function"?s=s&&a(r):s=s&&a.test(r,a.testValue)}),s},qo=({nodeData:e,nodeType:t})=>{const r=Zl[t]?.fieldValidators??{},s=[];return Object.keys(r).forEach(i=>{be({name:i,nodeType:t,value:e?.[i]??""})||s.push(i)}),s},ud=(e,t)=>{const r=t,s=[];return r.options.forEach(i=>{be({name:"value",nodeType:e,value:i.value})||s.push(`condition_${i.id}`)}),s},dd=(e,t)=>{const r=[];["callOrder","callStateEvents","callStateUrl","defaultFrom","defaultTimeout"].forEach(a=>{be({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")||be({name:c,nodeType:e,value:a[c]})||r.push(`${c}_${a.id}`)})}),r},fd=(e,t)=>{const r=[];return be({name:"selected",nodeType:e,value:t?.selected})||r.push("selected"),t.selected==="url"?be({name:"url",nodeType:e,value:t.url})||r.push("url"):t.selected==="text"&&(be({name:"text",nodeType:e,value:t.text})||r.push("text")),r},Lt=({data:e,id:t})=>{const r=ye(u=>u.isCanvasInteractive),{getNodeType:s,partialUpdateNodeData:i}=tt(),{isValueDuplicate:a}=id(),c=s(t);return I.useEffect(()=>{if(c&&r){let u=cd(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]),I.useEffect(()=>{if(c==="aiAgent"&&r){const u=Dn.subscribe(f=>{if(f.status==="loaded"&&"agent"in e){const p=f.aiAgentMap.has(e.agent),m=p&&cd(c,e);m!==e.valid&&i(t,{agent:p?e.agent:"",valid:m})}});return()=>{u()}}},[e,t,r,i,c]),I.useEffect(()=>{if((f=>(c==="forwardAddress"||c==="forwardPhone"||c==="forwardResource")&&"connections"in f)(e)&&r){const f=qn.subscribe(p=>{if(p.status==="loaded"){let m=!0;const E=e.connections.map(v=>{const w=p.actions.updateConnection(v,p.swmlScriptMap);return w?(m=!1,w):v}),y=m&&cd(c,e);y!==e.valid&&i(t,{connections:E,valid:y})}});return()=>{f()}}},[e,t,r,i,c]),{getInvalidFields:()=>!c||e.valid?[]:RE(c,e),valid:()=>e.valid}},HA=({data:e,id:t,isConnectable:r,selected:s})=>{Lt({data:e,id:t});const a=Dn(c=>c.aiAgentMap.get(e.agent))?.display_name;return h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.AI_AGENT),selected:s,valid:e.valid,children:[a&&h.jsx(Xt,{children:h.jsx("p",{className:"truncate text-xs",children:a})}),h.jsx(fn,{id:t,color:"positive",isConnectable:r})]})},BA=({data:e,id:t,isConnectable:r,selected:s})=>h.jsx(pt,{id:t,isConnectable:r,nodeTitle:M(A.ANSWER_CALL),selected:s,valid:e.valid,children:h.jsx(fn,{id:t,isConnectable:r,color:"positive"})}),zA=({id:e,data:t,isConnectable:r,selected:s})=>(Lt({data:t,id:e}),h.jsx(pt,{id:e,isConnectable:r,nodeTitle:M(A.CONDITIONS),selected:s,valid:t.valid,children:h.jsxs(Ho,{children:[t.options.map((i,a)=>{const c=i.value.trim();return h.jsx(pn,{color:"positive",enabled:!!c,id:i.id,isConnectable:r,optionTitle:c?h.jsx("div",{className:"truncate",children:c}):M(A.CONDITION_NUMBER,{index:a+1})},i.id)}),h.jsx(pn,{color:"negative",id:t.fallback,isConnectable:r,optionTitle:M(A.ELSE)})]})})),WA=({data:e,id:t,isConnectable:r,selected:s})=>{Lt({data:e,id:t});const i=e.url.trim();return h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.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(Ho,{children:[e?.options?.map((a,c)=>{const u=a.value.trim();return h.jsx(pn,{color:"positive",enabled:!!u,id:a.id,isConnectable:r,optionTitle:u?h.jsx("div",{className:"truncate",children:u}):M(A.CONDITION_NUMBER,{index:c+1})},a.id)}),h.jsx(pn,{color:"negative",id:e.fallback,isConnectable:r,optionTitle:M(A.ELSE)}),h.jsx(pn,{color:"negative",id:e.error,isConnectable:r,optionTitle:M(A.FAILURE)})]})]})},GA=({data:e,id:t,isConnectable:r,selected:s})=>{Lt({data:e,id:t});const i=e.dest.trim();return h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.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(Ho,{children:[e?.options?.map((a,c)=>{const u=a.value.trim();return h.jsx(pn,{color:"positive",enabled:!!u,id:a.id,isConnectable:r,optionTitle:u?h.jsx("div",{className:"truncate",children:u}):M(A.CONDITION_NUMBER,{index:c+1})},a.id)}),h.jsx(pn,{color:"negative",id:e.fallback,isConnectable:r,optionTitle:M(A.ELSE)})]})]})},pd=3,YA={busy:A.BUSY,decline:A.DECLINE,error:A.ERROR,noAnswer:A.NO_ANSWER,success:A.SUCCESS},KA={address:A.FORWARD_TO_ADDRESS,phone:A.FORWARD_TO_PHONE,resource:A.FORWARD_TO_RESOURCE},hd=({id:e,data:t,isConnectable:r,selected:s})=>{Lt({data:t,id:e});const i=t.connections.filter(c=>c.connectTo),a=i.slice(0,pd);return h.jsxs(pt,{id:e,isConnectable:r,nodeTitle:M(KA[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>pd&&h.jsx("div",{children:`+ ${M(A.MORE_WITH_COUNT,{count:i.length-pd})}`})]}):null,h.jsx(Ho,{children:t.options.map(c=>h.jsx(pn,{color:qm(c.result),id:c.id,isConnectable:r,optionTitle:M(YA[c.result])},c.id))})]})},XA=({id:e,data:t,isConnectable:r,selected:s})=>{Lt({data:t,id:e});const i=_r(t.options,"command"),a=_r(t.options,"digit");return h.jsxs(pt,{id:e,isConnectable:r,nodeTitle:M(A.GATHER_INPUT),selected:s,valid:t.valid,children:[h.jsx(Lg,{data:t}),h.jsxs(Ho,{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(A.CALLER_PRESSES)," ",h.jsx("span",{className:"truncate rounded bg-secondary/20 px-1",children:p})]}),y=_=>h.jsxs("div",{className:"flex",children:[M(_?A.CALLER_SAYS:A.OR_CALLER_SAYS)," '",h.jsx("span",{className:"truncate",children:f}),"'"]});let v=M(A.OPTION_NUMBER,{index:u+1}),w="";switch(!0){case!!(f&&!p):v=y(!0);break;case!!(!f&&p):v=E;break;case!!(f&&p):v=E,w=y(!1);break}return h.jsx(pn,{color:"positive",enabled:m,id:c.id,isConnectable:r,optionTitle:v,optionSubtitle:w},c.id)}),t.results.map(c=>h.jsx(pn,{color:"negative",id:c.id,isConnectable:r,optionTitle:c.result==="no_input"?M(A.NO_INPUT):M(A.UNKNOWN)},c.id))]})]})},QA=({id:e,isConnectable:t,selected:r})=>h.jsx(pt,{id:e,isConnectable:t,isRoot:!0,nodeTitle:M(A.HANDLE_CALL),selected:r,deletable:!1,showValidation:!1,target:!1,children:h.jsx(fn,{id:e,color:"positive",isConnectable:t})}),md={busy:A.BUSY,decline:A.DECLINE,hangup:A.HANG_UP},qA=({data:e,id:t,isConnectable:r,selected:s})=>h.jsx(pt,{id:t,isConnectable:r,nodeTitle:M(A.HANG_UP_CALL),selected:s,valid:e.valid,children:e.reason&&h.jsx(Xt,{children:h.jsx("p",{children:M(md[e.reason])})})}),JA=({data:e,id:t,isConnectable:r,selected:s})=>(Lt({data:e,id:t}),h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.PLAY_AUDIO_TTS),selected:s,valid:e.valid,children:[h.jsx(Lg,{data:e}),h.jsx(fn,{id:t,isConnectable:r})]})),ZA=({data:e,id:t,isConnectable:r,selected:s})=>{const{label:i,valid:a}=e;return Lt({data:e,id:t}),h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.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(fn,{id:t,isConnectable:r,color:"positive"})]})},eI=({data:e,id:t,isConnectable:r,selected:s})=>{Lt({data:e,id:t});const a=Ko(c=>c.entries)?.find(c=>c.controlId===e.controlId)?.label;return h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.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(fn,{id:t,color:"positive",isConnectable:r})]})},tI=({data:e,id:t,isConnectable:r,selected:s})=>{Lt({data:e,id:t});const i=new Set(e.terminators);return h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.VOICEMAIL_RECORDING),selected:s,valid:e.valid,children:[e.terminators?h.jsxs(Xt,{children:[M(A.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(fn,{id:t,isConnectable:r,color:"positive"})]})},nI={failed:A.FAILED,success:A.SUCCESS},NE={aiAgent:HA,answer:BA,cond:zA,condRequest:WA,executeSWML:GA,forwardAddress:hd,forwardPhone:hd,forwardResource:hd,handleCall:QA,hangup:qA,play:JA,promptPlay:XA,record:tI,recordCallStart:ZA,recordCallStop:eI,request:({data:e,id:t,isConnectable:r,selected:s})=>(Lt({data:e,id:t}),h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.REQUEST),selected:s,valid:e.valid,children:[h.jsx("p",{className:"p-4 pt-0 text-xs text-negative",children:M(A.DEPRECATED)}),h.jsx(Ho,{children:e?.options?.map(i=>h.jsx(pn,{color:qm(i.result),id:i.id,isConnectable:r,optionTitle:M(nI[i.result])},i.id))})]})),sendSms:({data:e,id:t,isConnectable:r,selected:s})=>(Lt({data:e,id:t}),h.jsxs(pt,{id:t,isConnectable:r,nodeTitle:M(A.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(fn,{id:t,isConnectable:r})]})),set:({id:e,data:t,isConnectable:r,selected:s})=>{const{getInvalidFields:i}=Lt({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(pt,{id:e,isConnectable:r,nodeTitle:M(A.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(fn,{id:e,isConnectable:r,color:"positive"})]})},unset:({id:e,data:t,isConnectable:r,selected:s})=>{Lt({data:t,id:e});const i=t.variables.filter(a=>!!a.key);return h.jsxs(pt,{id:e,isConnectable:r,nodeTitle:M(A.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(fn,{id:e,isConnectable:r,color:"positive"})]})}},rI={floating:IA},oI=({children:e})=>{const t=ye(b=>b.nodes),r=ye(b=>b.edges),s=ye(b=>b.isCanvasInteractive),{onConnect:i,onConnectEnd:a,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:p,onEdgeUpdateEnd:m,onEdgeUpdateStart:E,onInit:y,onNodeDragStart:v,onNodeDragStop:w,onNodesChange:_,onNodesDelete:S,onSelectionChange:R,setFlowWrapperElement:N}=tt();return h.jsx("div",{className:"bg-sw-white !h-auto w-full",ref:b=>N(b),children:h.jsxs(jm,{attributionPosition:"bottom-left",connectionLineComponent:CA,connectionMode:mr.Strict,deleteKeyCode:s?N1:null,defaultEdgeOptions:Uo,edges:r,edgeTypes:rI,elementsSelectable:s,fitViewOptions:Cu,multiSelectionKeyCode:s?O1:null,nodes:t,nodesConnectable:s,nodesDraggable:s,nodeTypes:NE,onConnect:i,onConnectEnd:a,onConnectStart:c,onEdgesChange:u,onEdgesDelete:f,onEdgeUpdate:s?p:void 0,onEdgeUpdateEnd:m,onEdgeUpdateStart:E,onInit:y,onNodeDragStart:v,onNodeDragStop:w,onNodesChange:_,onNodesDelete:S,onSelectionChange:R,selectionKeyCode:s?T1:null,snapGrid:[Nl,Nl],snapToGrid:!0,children:[h.jsx(d1,{className:"bg-background-alt text-grid",color:"currentColor",gap:[Nl,Nl],variant:Kt.Dots}),e]})})},sI=()=>{const e=ye(u=>u.initializing),t=ye(u=>u.reactFlowInstance),{setInitializing:r,setViewportChanging:s}=tt(),i=I.useRef(!1),a=JN({includeHiddenNodes:!0}),c=I.useMemo(()=>()=>{t?.fitView(Cu)},[t]);I.useEffect(()=>{let u;e?!i.current&&!a?i.current=!0:i.current&&a&&(clearTimeout(u),s(!0),c(),u=setTimeout(()=>{s(!1)},Cu.duration),r(!1),i.current=!1):i.current=!1},[e,c,a,r,s])},iI=()=>{const{onViewportChange:e,onViewportChangeEnd:t,onViewportChangeStart:r}=tt();return sI(),XN({onChange:e,onEnd:t,onStart:r}),null},lI=()=>{const e=ye(r=>r.selectedNode),t=e?fA.get(e.type):void 0;return t?h.jsx(js,{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(Ae,{className:"shrink-0 text-primary",tag:"circle-info",size:"xl"}),h.jsx("div",{className:"text-xs font-medium",children:Kl(t)})]})}):null},aI=e=>{const t=I.useRef(),r=KN(),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)}}},cI="/hello/.test('%{foo}')",uI=()=>({id:De(),value:""}),gd=({nodeData:e,handleOnUpdate:t,placeholder:r=cI})=>{const{validateField:s}=bt("cond"),[i,a]=I.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,uI()]})},u=E=>y=>{y.preventDefault();const v=[...i.options];v.splice(E,1),a({...i,options:v});const w=[...e.options];w.splice(E,1),t({options:w})},f=(E,y)=>{const v=[...e.options];if(!v[E])throw new Error(`Option not found at index ${E}`);const{name:w,value:_}=y,S=[...i.options];S[E]={...S[E],initial:!1,[w]:s(w,_)},a({...i,options:S}),v[E]={...v[E],[w]:_},t({options:v})},p=(E,y)=>{const v=E.target,{name:w,value:_}=v;t({initial:!1}),w==="value"?y!==void 0&&f(y,{name:w,value:_}):Ge().error(`Unhandled input name: ${w}`)},m=({index:E,name:y})=>{const v=i.options[E];return v?.[y]||v?.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,y,v)=>h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ae,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[v.length>1&&h.jsx($o,{className:"absolute right-0 top-0",handleDelete:u(y),label:M(A.REMOVE_CONDITION,{index:y+1}),size:"sm",show:!0}),h.jsxs("label",{className:"mb-2 block",children:[M(A.CONDITION_NUMBER,{index:y+1}),h.jsx("input",{className:`w-full ${m({index:y,name:"value"})?"":"invalid"}`,name:"value",onChange:w=>p(w,y),placeholder:r,type:"text",value:E.value}),h.jsx("p",{className:"requirements",role:"alert",children:M(A.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(A.ADD_CONDITION)})})]})},dI=Ge(),ai=(e,t)=>[e,t].filter(Boolean).join("-").toLowerCase(),fI={idsByKey:{},languageById:{},voiceById:{}},pI=(e,t)=>({...fI,actions:{getGenderByKeys:({languageId:r})=>{const{idsByKey:s}=t(),i=r?.split(",").map(c=>ai(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=>ai(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{dI.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(),y={gender:E,id:m,key:`${f.language_code}-${E}-${f.signalwire_id}`,name:`${f.friendly_name.trim()} ${p?"(premium)":""}`,premium:p};a[m]=y,c[f.language_code]={id:f.language_code,name:f.language};const v=ai(f.language_code);v in u||(u[v]=[]),u[v]?.push(y);const w=ai(E);w in u||(u[w]=[]),u[w]?.push(y);const _=ai(f.language_code,E);_ in u||(u[_]=[]),u[_]?.push(y)}),e({idsByKey:u,languageById:c,voiceById:a})}catch(s){console.error("Error",s)}}}}),Ed=Po()(pI),hI=()=>Ed.getState().actions;window.__useVoiceStore=Ed;const OE=e=>h.jsx("option",{value:e.id,children:e.name},e.key??e.id),mI=({onChange:e,languageId:t,gender:r,voiceId:s})=>{const{getLanguages:i,getVoicesByKeys:a,getGenderByKeys:c}=hI();return h.jsxs(h.Fragment,{children:[h.jsxs(An,{className:"w-full",label:M(A.LANGUAGE),name:"language",onChange:e,value:t??"",children:[h.jsx("option",{value:"",children:M(A.SELECT)}),i().map(OE)]}),h.jsxs(An,{className:"w-full capitalize",label:M(A.GENDER),name:"gender",onChange:e,value:r??"",children:[h.jsx("option",{value:"",children:M(A.SELECT)}),c({languageId:t}).map(u=>h.jsx("option",{value:u,children:u},u))]}),h.jsxs(An,{className:"w-full",label:M(A.VOICE),name:"voice",onChange:e,value:s??"",children:[h.jsx("option",{value:"",children:M(A.SELECT)}),a({gender:r,languageId:t}).map(OE)]})]})},TE={text:A.TEXT_TO_SPEECH,url:A.PLAY_AUDIO_FILE},CE=({handleOnUpdate:e,label:t,nodeData:r,showDefaultOption:s})=>{const{validateField:i}=bt("play"),[a,c]=I.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;I.useEffect(()=>{!u&&!s&&e({selected:"url"})},[e,u,s]);const f=m=>{const E=m.target,{name:y,value:v}=E;switch(y){case"selected":case"text":case"url":c({...a,[y]:i(y,v)}),e({initial:!1,[y]:v});break;default:throw new Error(`Unhandled input name: ${y}`)}},p=m=>{const E=m.target,{name:y,value:v}=E;switch(y){case"language":e({gender:void 0,language:v,voice:void 0});break;case"gender":e({gender:v,voice:void 0});break;default:e({[y]:v})}};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(A.SELECT)}),Object.keys(TE).map(m=>h.jsx("option",{value:m,children:M(TE[m])},m))]})]}),u&&h.jsx(gI,{nodeData:r,onChange:f,voiceSettingsChangeHandler:p,selected:u,valid:a[u]})]})},gI=({nodeData:e,onChange:t,voiceSettingsChangeHandler:r,selected:s,valid:i})=>{const a=e[s],u={text:h.jsxs(h.Fragment,{children:[h.jsx(mI,{onChange:r,languageId:e.language,gender:e.gender,voiceId:e.voice}),h.jsx(Kn,{errorText:M(A.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(A.TEXT),name:s,onChange:t,placeholder:M(A.WRITE_SOMETHING),valid:i,value:a})]}),url:h.jsx(Kn,{errorText:M(A.ERROR_URL_IS_REQUIRED),inputMode:"url",label:M(A.AUDIO_FILE),name:s,onChange:t,placeholder:M(A.ENTER_URL),valid:i,value:a})}[s];return h.jsx(h.Fragment,{children:u})},EI=[{field:"stereo",subtitle:A.STEREO_SUBTITLE,title:A.STEREO},{field:"beep",subtitle:A.BEEP_SUBTITLE,title:A.BEEP}],AE=({handleOnUpdate:e,nodeData:t,type:r})=>{const{validateField:s}=bt("record"),[i,a]=I.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:EI.map(f=>{const p=t[f.field];return h.jsx("div",{children:h.jsx(Dl,{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(A.TERMINATORS),h.jsx("span",{className:"block text-xxs text-foreground/50",children:M(A.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(A.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(A.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:Xo.MIN,max:Xo.MAX,name:"maxLength",onChange:u,placeholder:M(A.SECONDS),type:"number",value:t.maxLength}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Xo.MAX,min:Xo.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(A.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:Be.MIN,max:Be.MAX,name:"initialTimeout",onChange:u,placeholder:M(A.SECONDS),type:"number",value:t.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Be.MAX,min:Be.MIN})})]})]}),h.jsxs("label",{className:"mb-2 block",children:[h.jsx("div",{className:"w-full",children:M(A.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:Be.MIN,max:Be.MAX,name:"endSilenceTimeout",onChange:u,placeholder:M(A.SECONDS),type:"number",value:t.endSilenceTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Be.MAX,min:Be.MIN})})]})]})]}),h.jsxs(An,{className:"w-full",label:M(A.FORMAT),name:"format",onChange:u,value:t.format,children:[h.jsx("option",{value:"mp3",children:"MP3"}),h.jsx("option",{value:"wav",children:"WAV"})]})]})},wt=({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(Ae,{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})})]}),yI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("aiAgent"),[s,i]=I.useState({agent:e.initial||r("agent",e.agent)}),a=Dn(_=>_.aiAgentMap.values()),c=Dn(_=>_.error),u=Dn(_=>_.status),{fetchAiAgents:f}=mA();I.useEffect(()=>{f()},[f]);const p=Array.from(a),m=u==="loading",E=!!c||u==="error",y=E||u==="initial",v=_=>{const S=_.target,{name:R,value:N}=S;i({...s,[R]:r(R,N)}),t({initial:!1,[R]:N})},w=I.useId();return h.jsx(wt,{title:M(A.AI_AGENT),children:h.jsx("div",{className:"mx-3",children:!E&&p.length?h.jsxs("div",{className:"relative",children:[h.jsxs(An,{id:w,className:`${s.agent?"":"invalid"}`,disabled:y,label:M(A.AI_AGENT_NAME),name:"agent",onChange:v,value:e.agent,children:[h.jsx("option",{value:"",children:M(A.SELECT)}),p.map(_=>h.jsx("option",{value:_.id,children:_.display_name},_.id))]}),h.jsx(IE,{className:"absolute top-0 right-0 mx-1",handleClickResync:f,isLoading:m}),e.agent&&h.jsx("p",{children:h.jsx(bE,{agent:e.agent,mode:"edit",className:"mb-2",children:M(A.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(A.ERROR_FETCHING_AI_AGENTS)}):h.jsxs(h.Fragment,{children:[M(A.ERROR_ADD_AI_AGENT_FIRST),h.jsx(bE,{mode:"add",className:"mt-2 block",children:M(A.ADD_AI_AGENT)})]})}),h.jsx(IE,{className:"mx-1",handleClickResync:f,isLoading:m})]})})})},IE=({className:e="",isLoading:t,handleClickResync:r})=>h.jsx(Sr,{placement:"bottom-end",trigger:h.jsxs("button",{className:`overflow-hidden ${t?"text-disabled":""} ${e}`,disabled:t,onClick:r,type:"button",children:[h.jsx(Ae,{className:`${t?"animate-spin":""}`,tag:"arrows-rotate"}),h.jsx("span",{className:"sr-only",children:M(A.RESYNC_AI_AGENTS)})]}),children:h.jsx("p",{className:"text-sm",children:M(A.RESYNC_AI_AGENTS)})}),bE=({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})},vI=["GET","POST","PUT","DELETE"],xI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("condRequest"),[s,i]=I.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(wt,{title:M(A.REQUEST),children:[h.jsxs("div",{className:"border-b-4 border-foreground/10 px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(A.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(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(An,{className:"w-full",label:M(A.METHOD),name:"method",onChange:c,value:e.method,children:vI.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Dl,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:M(A.SAVE_VARIABLES_SUBTITLE),title:M(A.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.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(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.REQUEST_BODY),name:"body",onChange:a,placeholder:M(A.STRING_OR_JSON),valid:s.body,value:e.body??""})})]}),h.jsx(gd,{nodeData:e,handleOnUpdate:t})]})},SI=({nodeData:e,handleOnUpdate:t})=>{const r=I.useRef();return h.jsx(wt,{formRef:r,title:M(A.CONDITIONS),children:h.jsx("div",{children:h.jsx(gd,{nodeData:e,handleOnUpdate:t})})})},_I=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("executeSWML"),[s,i]=I.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(wt,{title:M(A.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(A.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(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.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(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.META),name:"meta",onChange:a,placeholder:M(A.JSON_OBJECT),valid:s.meta,value:e.meta??""})})]}),h.jsx(gd,{nodeData:e,handleOnUpdate:t,placeholder:"return_value === '1'"})]})},LE=(e,t)=>{I.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])},yd=e=>{const[t,r]=I.useReducer((s,i)=>({...s,...i}),e);return[t,r]},wI=Ge(),RI=({enable:e,searchParams:t})=>{const r=qn(E=>E.results),s=qn(E=>E.status),i=qn(E=>E.error),{buildParamsFromQuery:a,buildQueryFromParams:c,getCachedResults:u,fetchSwmlScript:f,setResults:p}=xE(),m=c(t);return I.useEffect(()=>{if(!e)return;const E=u(m);E&&p(E);const y=a(m),v=setTimeout(()=>{f(y).catch(w=>{wI.error("Error fetching swml scripts",w)})},Km);return()=>clearTimeout(v)},[a,c,e,f,u,m,p]),[r,s,i]},vd=e=>e==="external",NI={externalValue:"",focusedId:"",focusedName:"",open:!1,query:""},OI=({confirmId:e,confirmName:t,confirmUrl:r,onChange:s,valid:i})=>{const a={displayName:M(A.EXTERNAL_URL),id:"external"},c=I.useRef(null),u=I.useRef(null),f=I.useRef(null),p=I.useRef({}),m=I.useId(),E=I.useId(),y=I.useId(),[v,w]=yd({...NI,externalValue:vd(e)?r:"",query:t??""}),_=vd(e),S=v.query===""||v.query.toLocaleLowerCase()===t.toLocaleLowerCase(),[R,N]=RI({enable:v.open&&!v.focusedName,searchParams:{name:S?"":v.query}}),b=[{displayName:M(A.EXTERNAL_URL),id:a.id},...R],T=S?b:R,L=()=>w({focusedId:"",focusedName:""}),D=j=>{w({open:!0,query:j.target.value}),L()},V=j=>{w({externalValue:j.target.value}),s({connectConfirmDisplayName:a.displayName,connectConfirmId:a.id,connectConfirmUrl:j.target.value})},K=()=>{w({focusedId:e,open:!0}),te()},X=()=>{w({open:!1}),L()},G=()=>v.open?X():K(),te=()=>{u.current?.focus()},re=j=>{const ee=tg(b,"id",j);w({query:ee.displayName});const oe=se=>"requestUrl"in se?se.requestUrl:v.externalValue;s({connectConfirmDisplayName:ee.displayName,connectConfirmId:ee.id,connectConfirmUrl:oe(ee)}),X()},J=j=>{te(),re(j)},C=j=>{const ee=v.focusedId||e||"",oe=L1(j,ee,T),se=oe&&p.current[oe?.id];if(se){se?.focus({preventScroll:!0}),se?.scrollIntoView({block:"nearest"});const ue=tg(b,"id",se.id);w({focusedId:ue.id,focusedName:ue.displayName}),u.current&&(u.current.value=ue.displayName)}else te();v.open||K()},z=()=>{p.current[v.focusedId]&&re(v.focusedId)},H=()=>{v.query!==t&&w({query:t}),X()},W=j=>{const{key:ee}=j;switch(ee){case"ArrowDown":case"ArrowUp":j.preventDefault(),C(ee),te();break;case"Enter":j.preventDefault(),z();break;case"Escape":j.preventDefault(),H();break}};I.useEffect(()=>{_&&f.current&&f.current.focus()},[_]),LE(c,X);const P=v.open&&!T.length,U=N==="loading"&&P,$=N==="error",k=t&&e===""&&r==="";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:`relative mb-2 block ${$?"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(A.HANDLE_VIA)}),h.jsxs("div",{className:"relative pb-1",children:[h.jsx("input",{"aria-activedescendant":v.open?v.focusedId:void 0,"aria-invalid":P,"aria-autocomplete":"list","aria-controls":v.open?m:void 0,"aria-expanded":v.open,"aria-labelledby":E,autoComplete:"off",className:`${$||k?"invalid":""} rounded-md border border-foreground !p-2 !pr-8`,disabled:$,onChange:D,onClick:K,onKeyDown:W,placeholder:v.open?M(A.SEARCH_FOR_INTERNAL_SCRIPT):M(A.EXTERNAL_OR_INTERNAL_RESOURCE),ref:u,role:"combobox",type:"text",value:v.focusedName||v.query}),h.jsxs("button",{"aria-controls":v.open?m:void 0,"aria-expanded":v.open,"aria-haspopup":"listbox","aria-labelledby":`${E} ${y}`,className:`${v.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:$,id:y,onClick:G,tabIndex:-1,type:"button",children:[U&&h.jsx(Ae,{className:"absolute top-3 right-7 animate-spin",tag:"arrows-rotate",size:"xs"}),h.jsx("span",{className:"sr-only",children:M(v.open?A.TOGGLE_CLOSE:A.TOGGLE_OPEN)})]}),h.jsxs("p",{className:"requirements w-full",role:"alert",children:[k&&M(A.SCRIPT_NOT_FOUND),$&&M(A.ERROR_FETCHING_SWML_SCRIPTS)]})]}),!$&&v.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:W,children:T.length?h.jsxs(h.Fragment,{children:[T.length===1&&vd(T?.[0]?.id)&&(N==="loaded"||N==="loading")&&h.jsx(xd,{displayName:M(N==="loading"?A.STATUS_LOADING:A.NO_SCRIPTS_FOUND)}),T.map(({displayName:j,id:ee},oe)=>{const se=e===ee,ue=v.focusedId?v.focusedId===ee:oe===0;return h.jsx(xd,{active:se,focus:ue,displayName:j,handleOnClick:()=>J(ee),id:ee,ref:pe=>p.current[ee]=pe},ee)})]}):h.jsx(xd,{displayName:M(U?A.STATUS_LOADING:A.NO_RESULTS)})})]}),_&&h.jsxs("label",{className:"mb-2 block",children:[h.jsx("span",{className:"sr-only",children:M(A.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:V,placeholder:M(A.ENTER_URL),ref:f,type:"url",value:v.externalValue}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_URL_IS_REQUIRED)})]})]}),!R.length&&!_&&h.jsx("div",{className:"mb-2",children:h.jsx("p",{children:h.jsx(TI,{children:M(A.ADD_SWML_SCRIPTS)})})})]})},xd=I.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})}),TI=({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}),CI=({confirmId:e,confirmName:t,confirmUrl:r,enabled:s,handleOnChange:i,onCheck:a,valid:c})=>{const u=I.useId(),{validateCache:f}=xE();return I.useEffect(()=>{s&&f()},[s,f]),h.jsxs(h.Fragment,{children:[h.jsx(Dl,{"aria-controls":u,"aria-expanded":s,checked:s,clickHandler:a,name:"connectConfirmEnabled",subtitle:M(A.SWML_TO_EXECUTE),title:M(A.ENABLE_WHISPER)}),s&&h.jsx("div",{id:u,children:h.jsx(OI,{onChange:i,confirmId:e,confirmName:t,confirmUrl:r,valid:c})})]})},AI={forwardAddress:{add:A.ADD_ADDRESS,call:A.CALL_ADDRESSES,optionNumber:A.ADDRESS_NUMBER,remove:A.REMOVE_ADDRESS,title:A.FORWARD_TO_ADDRESS},forwardPhone:{add:A.ADD_PHONE_NUMBER,call:A.CALL_NUMBERS,optionNumber:A.PHONE_NUMBER_NUMBER,remove:A.REMOVE_PHONE_NUMBER,title:A.FORWARD_TO_PHONE},forwardResource:{add:A.ADD_RESOURCE,call:A.CALL_RESOURCES,optionNumber:A.RESOURCE_NUMBER,remove:A.REMOVE_RESOURCE,title:A.FORWARD_TO_RESOURCE}},DE={parallel:A.SIMULTANEOUSLY,serial:A.SEQUENTIALLY},II=()=>({connectConfirmDisplayName:"",connectConfirmEnabled:!1,connectConfirmId:"",connectConfirmUrl:"",connectFrom:"",connectTimeout:"",connectTo:"",id:De()}),Sd=({nodeType:e,nodeData:t,handleOnUpdate:r})=>{const{validateField:s}=bt(e),i=I.useRef(),[a,c]=I.useState(["serial","parallel"].includes(t.callOrder)?t.callOrder:"serial"),u=AI[e],[f,p]=I.useState({callOrder:t.initial||s("callOrder",a),callStateEvents:t.initial||s("callStateEvents",a),callStateUrl:t.initial||s("callStateUrl",a),connections:t.connections?.map(b=>({connectConfirmId:s("connectConfirmId",b.connectConfirmId),connectConfirmUrl:s("connectConfirmUrl",b.connectConfirmUrl),connectFrom:s("connectFrom",b.connectFrom),connectTimeout:s("connectTimeout",b.connectTimeout),connectTo:s("connectTo",b.connectTo),initial:t.initial})),defaultFrom:t.initial||s("defaultFrom",t.defaultFrom),defaultTimeout:t.initial||s("defaultTimeout",t.defaultTimeout)}),m=b=>{b.preventDefault(),p({...f,connections:[...f.connections,{connectConfirmId:!0,connectConfirmUrl:!0,connectFrom:!0,connectTimeout:!0,connectTo:!0,initial:!0}]}),r({callOrder:a,connections:[...t.connections,II()]})},E=b=>T=>{T.preventDefault();const L=[...f.connections];L.splice(b,1),p({...f,connections:L});const D=[...t.connections];D.splice(b,1),r({callOrder:D.length===1?"single":a,connections:D})},y=(b,T,L)=>{const D=[...t.connections],V=D[b];if(!V)throw new Error(`Option not found at index ${b}`);const K=T?.name,X=T?.value,te={...K?{[K]:X}:{},...L,id:V.id},re=[...f.connections],J=Object.keys(te).reduce((H,W)=>{const P=te[W],U=W;return H[U]=s(W,P),H},{initial:!1}),C=re.map((H,W)=>W===b?{...H,...J}:H);p({...f,connections:C});const z=D.map(H=>H.id===te.id?{...H,...te}:H);r({connections:z,initial:!1})},v=b=>{const T=b.currentTarget.value;c(T),r({callOrder:T})},w=(b,T)=>{y(b,void 0,T)},_=(b,T)=>{w(b,{connectConfirmEnabled:T})},S=b=>T=>w(b,{...T}),R=(b,T)=>{const L=b.target,{name:D,value:V}=L;switch(D){case"callStateEvents":case"callStateUrl":case"defaultTimeout":case"defaultFrom":p({...f,[D]:s(D,V)}),r({initial:!1,[D]:V});break;case"connectFrom":case"connectTimeout":case"connectTo":if(T===void 0)throw new Error(`Option index not provided: ${D}`);y(T,{name:D,value:V});break;default:throw new Error(`Unhandled input name: ${D}`)}},N=({index:b,name:T})=>{const L=f.connections[b];return!!(L?.[T]||L?.initial)};return h.jsxs(wt,{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(A.DEFAULT_FROM),h.jsx(ei,{className:"w-full",direction:"from",name:"defaultFrom",onChange:R,placeholder:M(A.FROM),type:"tel",value:t.defaultFrom,valid:f.defaultFrom}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.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:R,placeholder:M(A.SECONDS),type:"number",value:t.defaultTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.CALL_STATE_URL),h.jsx("input",{className:`w-full ${f.callStateUrl?"":"invalid"}`,name:"callStateUrl",onChange:R,placeholder:"https://example.com/api",type:"url",value:t.callStateUrl}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.CALL_STATE_EVENTS),h.jsx("input",{className:`w-full ${f.callStateEvents?"":"invalid"}`,name:"callStateEvents",onChange:R,placeholder:"Created, ringing, answered, ended",type:"text",value:t.callStateEvents}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.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((b,T,L)=>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(Ae,{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})})]}),L.length>1&&h.jsx($o,{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(A.TO)}),h.jsx(ei,{className:"w-full",direction:"to",name:"connectTo",onChange:D=>R(D,T),type:e==="forwardPhone"?"tel":"text",valid:N({index:T,name:"connectTo"}),value:b.connectTo}),h.jsx("p",{className:"requirements",role:"alert",children:M(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[h.jsx("div",{className:"sr-only",children:M(A.FROM)}),h.jsx(ei,{className:"w-full",direction:"from",name:"connectFrom",onChange:D=>R(D,T),placeholder:M(A.FROM),type:"text",valid:N({index:T,name:"connectFrom"}),value:b.connectFrom}),h.jsx("p",{className:"requirements",role:"alert",children:M(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block pl-2",children:[M(A.TIMEOUT),h.jsxs("div",{className:"flex flex-wrap items-center gap-x-2",children:[h.jsx("input",{className:`${N({index:T,name:"connectTimeout"})?"":"invalid"}`,inputMode:"numeric",min:0,name:"connectTimeout",onChange:D=>R(D,T),placeholder:M(A.SECONDS),type:"number",value:b.connectTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_IS_REQUIRED)})]})]}),h.jsx("div",{className:"mb-2 block pl-2",children:h.jsx(CI,{confirmId:b.connectConfirmId,confirmName:b.connectConfirmDisplayName,confirmUrl:b.connectConfirmUrl,enabled:b.connectConfirmEnabled,handleOnChange:S(T),onCheck:()=>_(T,!b.connectConfirmEnabled),valid:N({index:T,name:"connectConfirmUrl"})&&N({index:T,name:"connectConfirmId"})})})]})},b.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(An,{className:"w-full",label:M(u.call),name:"callOrder",onChange:v,value:a,children:Object.keys(DE).map(b=>h.jsx("option",{value:b,children:M(DE[b])},b))})})]})},bI=()=>({command:"",digit:"",id:De()}),LI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("promptPlay"),s=I.useRef(),[i,a]=I.useState({digitTimeout:e.initial||r("digitTimeout",e.digitTimeout),initialTimeout:e.initial||r("initialTimeout",e.initialTimeout),options:e.options.map(v=>({command:r("command",v.command),digit:r("digit",v.digit),initial:e.initial}))}),c=_r(e.options,"command"),u=_r(e.options,"digit"),f=v=>{v.preventDefault(),a({...i,options:[...i.options,{command:!0,digit:!0,initial:!0}]}),t({options:[...e.options,bI()]})},p=v=>w=>{w.preventDefault();const _=[...i.options];_.splice(v,1),a({...i,options:_});const S=[...e.options];S.splice(v,1),t({options:S})},m=(v,w)=>{const _=[...e.options];if(!_[v])throw new Error(`Option not found at index ${v}`);const{name:S,value:R}=w,N=[...i.options];N[v]={...N[v],initial:!1,[S]:r(S,R)},a({...i,options:N}),_[v]={..._[v],[S]:R},t({options:_})},E=(v,w)=>{const _=v.target,{name:S,value:R}=_;switch(t({initial:!1}),S){case"digit":case"command":w!==void 0&&m(w,{name:S,value:R});break;case"digitTimeout":case"initialTimeout":{a({...i,[S]:r(S,R)}),t({[S]:R});break}default:throw new Error(`Unhandled input field name: ${S}`)}},y=({index:v,name:w})=>{const _=i.options[v];if(_?.initial)return!0;if(!_?.[w])return!1;const S=e.options?.[v];return Vt(S?.digit)||Vt(S?.command)};return h.jsxs(wt,{formRef:s,title:M(A.GATHER_INPUT),children:[h.jsx("div",{className:"border-b-4 border-foreground/10 px-3 pb-3",children:h.jsx(CE,{handleOnUpdate:t,label:M(A.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((v,w,_)=>{const S=c(v.command),R=u(v.digit);return h.jsxs("li",{className:"flex pt-3",children:[h.jsx("div",{className:"w-8 shrink-0 text-center",children:h.jsx(Ae,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[_.length>1&&h.jsx($o,{className:"absolute right-0 top-0",handleDelete:p(w),label:M(A.REMOVE_OPTION,{index:w+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:M(A.OPTION_NUMBER,{index:w+1})}),h.jsxs("label",{className:"mb-2 block",children:[M(A.CALLER_PRESSES),h.jsx("input",{className:`${y({index:w,name:"digit"})&&!R?"":"invalid"}`,name:"digit",onChange:N=>E(N,w),placeholder:M(A.KEYPAD_VALUE),type:"text",value:v.digit}),h.jsx("p",{className:"requirements",role:"alert",children:M(R?A.ERROR_DUPLICATE_TELEPHONE_KEY:A.ERROR_TELEPHONE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.OR_SAYS),h.jsx("input",{className:`w-full ${y({index:w,name:"command"})&&!S?"":"invalid"}`,name:"command",onChange:N=>E(N,w),placeholder:M(A.SPOKEN_PROMPT),type:"text",value:v.command}),h.jsx("p",{className:"requirements",role:"alert",children:M(S?A.ERROR_DUPLICATE_COMMAND:A.ERROR_TEXT_IS_REQUIRED)})]})]})]})]},v.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(A.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(A.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:Be.MIN,max:Be.MAX,name:"initialTimeout",onChange:E,placeholder:M(A.SECONDS),type:"number",value:e.initialTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Be.MAX,min:Be.MIN})})]})]}),h.jsxs("label",{children:[h.jsx("div",{className:"w-full",children:M(A.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:Be.MIN,max:Be.MAX,name:"digitTimeout",onChange:E,placeholder:M(A.SECONDS),type:"number",value:e.digitTimeout}),h.jsx("p",{className:"requirements w-full",role:"alert",children:M(A.ERROR_NUMBER_MIN_MAX_IS_REQUIRED,{max:Be.MAX,min:Be.MIN})})]})]})]})]})},DI=({handleOnUpdate:e,nodeData:t})=>{const{validateField:r}=bt("play"),[s,i]=I.useState({reason:t.initial||r("reason",t.reason)}),a=c=>{const u=c.target,{name:f,value:p}=u;if(f==="reason")i({...s,[f]:r(f,p)}),e({initial:!1,[f]:p});else throw new Error(`Unhandled input name: ${f}`)};return h.jsx(wt,{title:M(A.HANG_UP_CALL),children:h.jsx("div",{className:"mx-3",children:h.jsxs(An,{className:"w-full",label:`${M(A.REASON)} (${M(A.OPTIONAL)})`,name:"reason",onChange:a,value:t.reason,children:[h.jsx("option",{value:"",children:M(A.SELECT)}),Object.keys(md).map(c=>h.jsx("option",{value:c,children:M(md[c])},c))]})})})},kI=({nodeData:e,handleOnUpdate:t})=>{const r=I.useRef();return h.jsx(wt,{formRef:r,title:M(A.PLAY_AUDIO_TTS),children:h.jsx("div",{className:"mx-3",children:h.jsx(CE,{handleOnUpdate:t,label:M(A.CHOOSE_OPTION_TTS_AUDIO),nodeData:e,showDefaultOption:!0})})})},MI=({nodeData:e,handleOnUpdate:t})=>{const r=I.useRef(),{validateField:s}=bt("recordCallStart"),[i,a]=I.useState({label:e.initial||s("label",e.label)}),[c,u]=I.useState(!1),{upsertEntry:f,isValueDuplicate:p}=id();I.useEffect(()=>{u(p(e.label,e.controlId))},[p,e.controlId,e.label]);const m=E=>{const y=E.target,{name:v,value:w}=y;a({...i,[v]:s(v,w)}),t({initial:!1,[v]:w}),f({controlId:e.controlId,label:w})};return h.jsxs(wt,{title:M(A.RECORD_CALL_START),formRef:r,children:[h.jsx("div",{className:"px-3 pb-3",children:h.jsxs("label",{children:[M(A.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?A.ERROR_DUPLICATE_RECORDING_LABEL:A.ERROR_RECORDING_LABEL_REQUIRED)})]})}),h.jsx("div",{className:"px-3",children:h.jsx(AE,{handleOnUpdate:t,nodeData:e,type:"call"})})]})},PI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("recordCallStop"),[s,i]=I.useState({controlId:e.initial||r("controlId",e.controlId)}),{getEntries:a}=id(),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(wt,{title:M(A.RECORD_CALL_STOP),children:h.jsx("div",{className:"px-3",children:c.length?h.jsxs(An,{className:`w-full ${s.controlId?"":"invalid"}`,label:M(A.RECORDING_NAME),name:"controlId",value:e.controlId,onChange:u,children:[h.jsx("option",{value:"",children:M(A.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(A.ERROR_ADD_RECORDING_FIRST)})})})},UI=({nodeData:e,handleOnUpdate:t})=>h.jsx(wt,{title:M(A.VOICEMAIL_RECORDING),children:h.jsx("div",{className:"mx-3",children:h.jsx(AE,{handleOnUpdate:t,nodeData:e,type:"voicemail"})})}),FI=["GET","POST","PUT","DELETE"],jI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("request"),[s,i]=I.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(wt,{title:M(A.REQUEST),children:h.jsxs("div",{className:"px-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(A.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(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("div",{className:"mb-1",children:h.jsx(An,{className:"w-full",label:M(A.METHOD),name:"method",onChange:c,value:e.method,children:FI.map(f=>h.jsx("option",{value:f,children:f},f))})}),h.jsx("div",{className:"mb-4",children:h.jsx(Dl,{checked:e.saveVariables,clickHandler:u,name:"saveVariables",subtitle:M(A.SAVE_VARIABLES_SUBTITLE),title:M(A.SAVE_VARIABLES)})}),h.jsx("label",{className:"mb-2 block",children:h.jsx(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.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(Kn,{errorText:M(A.ERROR_INVALID_JSON),inputMode:"text",label:M(A.REQUEST_BODY),name:"body",onChange:a,placeholder:M(A.STRING_OR_JSON),valid:s.body,value:e.body??""})})]})})},VI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("sendSms"),[s,i]=I.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(wt,{title:M(A.SEND_SMS),children:h.jsxs("div",{className:"mx-3",children:[h.jsxs("label",{className:"mb-2 block",children:[M(A.TO_PHONE_NUMBER),h.jsx(ei,{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(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.FROM_PHONE_NUMBER),h.jsx(ei,{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(A.ERROR_VALUE_IS_REQUIRED)})]}),h.jsx("label",{children:h.jsx(Kn,{errorText:M(A.ERROR_VALUE_IS_REQUIRED),inputMode:"text",label:M(A.SMS_TEXT),name:"body",onChange:a,placeholder:M(A.WRITE_SOMETHING),valid:s.body,value:e.body})})]})})},$I=()=>({id:De(),key:"",value:""}),HI=({nodeData:e,handleOnUpdate:t})=>{const{validateField:r}=bt("set"),[s,i]=I.useState({variables:e.variables.map(E=>({key:e.initial||r("key",E.key),value:e.initial||r("value",E.value)}))}),a=_r(e.variables,"key"),c=E=>{E?.preventDefault(),i({...s,variables:[...s.variables,{key:!0,value:!0}]}),t({variables:[...e.variables,$I()]})},u=(E,y)=>{const v=[...e.variables];let w=v[E];if(!w)throw new Error(`Variable not found at index ${E}`);const{name:_,value:S}=y,R=[...s.variables];R[E]={...R[E],[_]:r(_,S)},i({...s,variables:R}),w={...v[E],[_]:S},v[E]=w,t({initial:!1,variables:v})},f=E=>y=>{y.preventDefault();const v=[...s.variables];v.splice(E,1),i({...s,variables:v});const w=[...e.variables];w.splice(E,1),t({variables:w})},p=(E,y)=>{const v=E.target,{name:w,value:_}=v;switch(w){case"key":case"value":y!==void 0&&u(y,{name:w,value:_});break;default:throw new Error(`Unhandled input name: ${w}`)}},m=({index:E,name:y})=>s.variables[E]?.[y];return h.jsxs(wt,{title:M(A.SET_VARIABLES),children:[h.jsx("ol",{className:"divide-y-4 divide-foreground/10 border-b-4 border-foreground/10",children:e.variables?.map((E,y,v)=>{const w=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(Ae,{className:"text-foreground/60",size:"xs",tag:"bars"})}),h.jsxs("div",{className:"relative mr-3",children:[v.length>1&&h.jsx($o,{className:"absolute right-0 top-0",handleDelete:f(y),label:M(A.REMOVE_VARIABLE,{index:y+1}),size:"sm",show:!0}),h.jsxs("fieldset",{children:[h.jsx("legend",{className:"sr-only",children:M(A.VARIABLE_NUMBER,{index:y+1})}),h.jsxs("label",{className:"mb-2 block",children:[M(A.KEY),h.jsx("input",{className:`w-full ${m({index:y,name:"key"})&&!w?"":"invalid"}`,name:"key",onChange:_=>p(_,y),type:"text",value:E.key}),h.jsx("p",{className:"requirements",role:"alert",children:M(w?A.ERROR_DUPLICATE_VARIABLE_KEY:A.ERROR_VARIABLE_KEY_REQUIRED)})]}),h.jsxs("label",{className:"mb-2 block",children:[M(A.VALUE),h.jsx("input",{className:`w-full ${m({index:y,name:"value"})?"":"invalid"}`,name:"value",onChange:_=>p(_,y),type:"text",value:E.value}),h.jsx("p",{className:"requirements",role:"alert",children:M(A.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(A.ADD_VARIABLE)})})]})},BI=e=>({id:De(),key:e}),zI=({nodeData:e,handleOnUpdate:t})=>{const a={currentFocus:void 0,listOpen:!1,setVariablesList:ye(S=>S.nodes).reduce((S,R)=>{if(R.type==="set"){const N=R.data.variables.map(b=>({id:b.id,key:b.key}));return[...S,...N]}else if(R.type==="unset")return[...S,...R.data.variables];return S},[]).reduce((S,R)=>(S.find(N=>N.key===R.key)||S.push(R),S),[]).map(S=>({...S,selected:!!e.variables.find(R=>R.key===S.key)})).sort((S,R)=>S.key.toLowerCase().localeCompare(R.key.toLowerCase()))},[c,u]=yd(a),f=S=>c.setVariablesList.map(R=>R.id===S?{...R,selected:!R.selected}:R),p=S=>{const R=c.setVariablesList.find(N=>N.id===S);if(!R)throw new Error("Variable not found");if(R.selected)m(R.id);else{const N=[...e.variables,BI(R.key)];u({setVariablesList:f(R.id)}),t({variables:N})}},m=S=>{const R=c.setVariablesList.filter(N=>N.selected&&N.id!==S);u({setVariablesList:f(S)}),t({variables:R})},E=I.useRef(null);LE(E,()=>u({listOpen:!1}));const y=S=>{(S.key==="Escape"||S.key==="Esc")&&u({listOpen:!1})},v=(S,R)=>{S.preventDefault(),(S.key===" "||S.code==="Space"||S.key==="Enter")&&p(R),y(S)},w=()=>{u({listOpen:!c.listOpen})},_=e.variables.length;return h.jsx(wt,{title:M(A.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(A.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
16
+ 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:w,onKeyDown:y,type:"button",children:_>0?M(A.NUMBER_OF_VARIABLES_SELECTED,{count:_}):M(A.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(A.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:R=>v(R,S.id),type:"checkbox"}),S.key]})},S.id)})]})]})]}),_>0&&h.jsxs("section",{className:"pt-3",children:[h.jsx("h3",{className:"mb-2 text-xs font-medium text-foreground",children:M(A.UNSET_VARIABLES)}),h.jsx("ul",{className:"flex flex-wrap gap-2",children:c.setVariablesList.map(S=>S.selected&&h.jsx(ET,{handleClick:()=>m(S.id),children:S.key},S.id))})]})]})})},kE={aiAgent:({data:e,formUpdate:t})=>h.jsx(yI,{handleOnUpdate:t,nodeData:e}),cond:({data:e,formUpdate:t})=>h.jsx(SI,{handleOnUpdate:t,nodeData:e}),condRequest:({data:e,formUpdate:t})=>h.jsx(xI,{handleOnUpdate:t,nodeData:e}),executeSWML:({data:e,formUpdate:t})=>h.jsx(_I,{handleOnUpdate:t,nodeData:e}),forwardAddress:({data:e,formUpdate:t})=>h.jsx(Sd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardAddress"}),forwardPhone:({data:e,formUpdate:t})=>h.jsx(Sd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardPhone"}),forwardResource:({data:e,formUpdate:t})=>h.jsx(Sd,{handleOnUpdate:t,nodeData:e,nodeType:"forwardResource"}),hangup:({data:e,formUpdate:t})=>h.jsx(DI,{handleOnUpdate:t,nodeData:e}),play:({data:e,formUpdate:t})=>h.jsx(kI,{handleOnUpdate:t,nodeData:e}),promptPlay:({data:e,formUpdate:t})=>h.jsx(LI,{handleOnUpdate:t,nodeData:e}),record:({data:e,formUpdate:t})=>h.jsx(UI,{handleOnUpdate:t,nodeData:e}),recordCallStart:({data:e,formUpdate:t})=>h.jsx(MI,{handleOnUpdate:t,nodeData:e}),recordCallStop:({data:e,formUpdate:t})=>h.jsx(PI,{handleOnUpdate:t,nodeData:e}),request:({data:e,formUpdate:t})=>h.jsx(jI,{handleOnUpdate:t,nodeData:e}),sendSms:({data:e,formUpdate:t})=>h.jsx(VI,{handleOnUpdate:t,nodeData:e}),set:({data:e,formUpdate:t})=>h.jsx(HI,{handleOnUpdate:t,nodeData:e}),unset:({data:e,formUpdate:t})=>h.jsx(zI,{handleOnUpdate:t,nodeData:e})},WI=(e,t)=>{if("options"in t)switch(e.type){case"promptPlay":case"cond":case"condRequest":return!0}return!1},GI=e=>{if(e in kE)return kE[e]},YI=()=>{const{partialUpdateNodeData:e,removeNode:t}=tt(),r=ye(p=>p.selectedNode),s=r?.id,a=ye(p=>p.nodes).find(p=>p.id===s)?.data,{updateDynamicHandles:c}=aI(r);if(!(r&&a&&s))return null;const u=p=>{WI(r,p)&&c(p),e(s,p)},f=GI(r.type);return f?h.jsxs(js,{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($o,{handleDelete:()=>t(s),label:M(A.DELETE_NODE),show:!0,showLabel:!0})})]}):null},ME=I.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
17
  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: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"})});
18
+ ${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(Ae,{className:"flex-shrink-0 self-start",tag:i}),h.jsx("p",{className:"text-xs font-semibold",children:a})]}),r]})}),KI=()=>{const{addToast:e,restoreDeployedFlow:t,cancelDetachedMode:r}=tt();if(!ye(c=>c.showDeployedHistoryToast))return null;const i=()=>{t(),e({message:M(A.VERSION_RESTORED),status:"success"})},a=()=>{r()};return h.jsx(ME,{animate:!1,className:"gap-x-14",message:M(A.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(A.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(A.CANCEL)})]})})},PE=({onKeyPress:e})=>{const t=Io(["Escape","Esc"]);return I.useEffect(()=>{t&&typeof e=="function"&&e()},[t,e]),{isPressed:t}},XI={offset:[0,.5,1],opacity:[1,0,0],pointerEvents:["none","none","auto"],transform:["scale(1.1) translateY(0%)","scale(0.5) translateY(-100%)"]},QI={duration:w1*2,easing:"ease-in-out",fill:"forwards"},qI=({durationMs:e,id:t,permanent:r})=>{const s=e??R1,[i,a]=I.useState(null),{deleteToast:c}=tt(),u=I.useCallback(()=>{let f;const p=()=>c(t);return i instanceof HTMLElement?(f=i.animate(XI,QI),f.addEventListener("finish",p,{once:!0})):p(),()=>f?.removeEventListener("finish",p)},[t,c,i]);return PE({onKeyPress:u}),I.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}},UE=({durationMs:e,id:t,message:r,permanent:s,status:i})=>{const{deleteToastCallback:a,setToastRef:c}=qI({durationMs:e,id:t,permanent:s});return h.jsx(ME,{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(Ae,{tag:"circle-xmark",size:"xl"}),h.jsx("span",{className:"sr-only",children:M(A.CLOSE)})]})})},JI={error:UE,success:UE},ZI=()=>{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=JI[r.status];return h.jsx(s,{durationMs:r.durationMs,id:r.id,message:r.message,permanent:r.permanent,status:r.status},r.id)})})},e2=({asRole:e="alert",open:t=!1,type:r="overlay"})=>{const[s,i]=ne.useState(t);I.useEffect(()=>{i(t)},[t]);const a=I.useCallback(()=>i(!1),[]),c=I.useCallback(()=>i(!0),[]);return{asRole:e,closeContainer:a,isOpen:s,openContainer:c,type:r}},FE=I.createContext(null),_d=()=>{const e=I.useContext(FE);if(e==null)throw new Error("Toast components must be wrapped in <ToastContainer />");return e},t2=({children:e,...t})=>{const r=e2(t);return h.jsx(FE.Provider,{value:r,children:e})},jE=({iconAs:e,title:t,children:r})=>{const{asRole:s}=_d();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(Ae,{tag:e??"circle-exclamation"})}),t]}),h.jsx("div",{className:"mt-2 text-sm leading-5",children:r})]})},n2=({children:e})=>{const{closeContainer:t,isOpen:r,type:s}=_d(),{getRootElement:i}=tt(),a=i(),c=I.useRef(null);return I.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?tu.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},VE=({asRole:e,open:t,children:r,type:s})=>h.jsx(t2,{asRole:e,open:t,type:s,children:h.jsx(n2,{children:r})}),r2=()=>{const t=ye(r=>r.httpError)===Ym;return t?h.jsx(VE,{asRole:"dialog",open:t,type:"overlay",children:h.jsx(jE,{title:M(A.DOCUMENT_OUT_OF_SYNC),children:h.jsx(o2,{})})}):null},o2=()=>{const{closeContainer:e}=_d(),t=()=>{window.location.reload()};return h.jsxs(h.Fragment,{children:[Kl(A.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(A.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(A.RESYNC)})]})]})},s2=Ge(),i2=()=>{const e=ye(t=>t.showDeployWarning);return h.jsx(VE,{asRole:"dialog",open:e,type:"overlay",children:h.jsx(jE,{title:M(A.DEPLOY_WARNING),children:h.jsx(l2,{})})})},l2=()=>{const{deployFlow:e,setShowDeployWarning:t,setShowValidationWarnings:r}=tt(),s=()=>{t(!1),r(!0)},i=()=>{t(!1)},a=()=>{e().catch(c=>{s2.error(c)}),i()};return h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"mb-4",children:Kl(A.TOAST_DEPLOY_WARNING)}),h.jsx(bg,{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(A.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(A.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=I.forwardRef(function({asTag:t="div",children:r,className:s="",hiddenSmallScreen:i=!1,...a},c){const u=t,p=`${a2} ${u==="button"?"":c2} ${i?u2:""} ${s}`;return h.jsx(u,{className:p,ref:c,...a,children:r})}),f2=()=>{const e=ye(c=>c.showValidationWarnings),t=ye(c=>c.validationWarnings),r=ye(c=>c.detachedMode),{setShowValidationWarnings:s}=tt(),i=()=>s(!e),a=()=>{e&&s(!1)};return!t.size||r?(a(),null):h.jsx(Sr,{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:[M(A.WARNING),h.jsxs("div",{className:"flex items-center justify-center pl-1",children:[h.jsx("span",{className:"sr-only",children:M(A.MORE_INFO_STATUS_ERROR)}),h.jsx(Ae,{className:"text-warning",tag:"circle-exclamation"})]})]}),children:h.jsx(bg,{children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("h2",{className:"text-xs font-semibold",children:[h.jsx(Ae,{className:"mr-1",tag:"circle-exclamation"}),M(A.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(A.CLOSE)}),h.jsx(Ae,{tag:"xmark",size:"lg"})]})]})})})},p2=()=>{const e=ye(s=>s.isDraggingNode),t=ye(s=>s.showInteractiveControl),r=s=>{ye.setState({isInteractiveControlOn:s})};return h.jsx(s1,{className:`mt-2.5 rounded-[0.25rem] ${e?"group/control-buttons":""}`,position:"top-left",onInteractiveChange:r,showInteractive:t,children:h.jsx(f2,{})})},h2=".react-flow__panel",m2=16,$E={cursor:"no-drop",transform:"translate(0px, 0px) scale(1)",visibility:"hidden",zIndex:"5"},HE=e=>{const t=e.getBoundingClientRect();return{isCursorIntersecting:({clientX:r,clientY:s})=>t.top<=s&&t.bottom>=s&&t.left<=r&&t.right>=r}},g2=e=>{const t=e.querySelectorAll(h2);return Array.from(t).map(r=>HE(r).isCursorIntersecting)},E2=e=>({resetDragNodeStyles:()=>{Object.entries($E).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})`}}),y2=({handleMouseMove:e,handleMouseUp:t,root:r})=>(r.addEventListener("mousemove",e),r.addEventListener("mouseup",t),{removeListeners:()=>{r.removeEventListener("mousemove",e),r.removeEventListener("mouseup",t)}}),v2=()=>{const e=I.useRef(null),t=ye(y=>y.dragNodeType),r=ye(y=>y.flowWrapperElement),s=ye(y=>y.viewport.zoom),{addNode:i,getRootElement:a,setDragNodeType:c}=tt(),u=a();if(I.useEffect(()=>{if(e.current&&t&&r&&u){let y=!1;const v=m2*s,w=e.current,_=HE(r).isCursorIntersecting,S=g2(r),{resetDragNodeStyles:R,updateDragNodeStyles:N}=E2(w),{removeListeners:b}=y2({handleMouseMove:T=>{const{clientX:L,clientY:D}=T,V=L-v,K=D-v;y=_({clientX:L,clientY:D})&&!S.some(X=>X({clientX:L,clientY:D})),N({isOverDropTarget:y,scale:y?s:1,xPos:V,yPos:K})},handleMouseUp:T=>{if(y){const L=r.getBoundingClientRect();i({nodeType:t,x:T.clientX-L.left-v,y:T.clientY-L.top-v})}c(void 0)},root:u});return()=>{b(),R()}}},[i,t,r,u,c,s]),!t)return null;const f=NE[t],p=ng[t](),m=De(),E={...p,initial:!1,valid:!0};return h.jsx("section",{className:"react-flow__node fixed left-0 top-0",ref:e,style:$E,children:h.jsx(f,{data:E,dragging:!0,id:m,isConnectable:!0,selected:!0,type:t,xPos:0,yPos:0,zIndex:0})})},x2={};function BE(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 ci=e=>t=>{try{const r=e(t);return r instanceof Promise?r:{then(s){return ci(s)(r)},catch(s){return this}}}catch(r){return{then(s){return this},catch(s){return ci(s)(r)}}}},S2=(e,t)=>(r,s,i)=>{let a={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,R)=>({...R,...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=ci(a.serialize),E=()=>{const S=a.partialize({...s()});let R;const N=m({state:S,version:a.version}).then(b=>p.setItem(a.name,b)).catch(b=>{R=b});if(R)throw R;return N},y=i.setState;i.setState=(S,R)=>{y(S,R),E()};const v=e((...S)=>{r(...S),E()},s,i);let w;const _=()=>{var S;if(!p)return;c=!1,u.forEach(N=>N(s()));const R=((S=a.onRehydrateStorage)==null?void 0:S.call(a,s()))||void 0;return ci(p.getItem.bind(p))(a.name).then(N=>{if(N)return a.deserialize(N)}).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==a.version){if(a.migrate)return a.migrate(N.state,N.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return N.state}).then(N=>{var b;return w=a.merge(N,(b=s())!=null?b:v),r(w,!0),E()}).then(()=>{R?.(w,void 0),c=!0,f.forEach(N=>N(w))}).catch(N=>{R?.(void 0,N)})};return i.persist={setOptions:S=>{a={...a,...S},S.getStorage&&(p=S.getStorage())},clearStorage:()=>{p?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>c,onHydrate:S=>(u.add(S),()=>{u.delete(S)}),onFinishHydration:S=>(f.add(S),()=>{f.delete(S)})},_(),w||v},_2=(e,t)=>(r,s,i)=>{let a={storage:BE(()=>localStorage),partialize:_=>_,version:0,merge:(_,S)=>({...S,..._}),...t},c=!1;const u=new Set,f=new Set;let p=a.storage;if(!p)return e((..._)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),r(..._)},s,i);const m=()=>{const _=a.partialize({...s()});return p.setItem(a.name,{state:_,version:a.version})},E=i.setState;i.setState=(_,S)=>{E(_,S),m()};const y=e((..._)=>{r(..._),m()},s,i);i.getInitialState=()=>y;let v;const w=()=>{var _,S;if(!p)return;c=!1,u.forEach(N=>{var b;return N((b=s())!=null?b:y)});const R=((S=a.onRehydrateStorage)==null?void 0:S.call(a,(_=s())!=null?_:y))||void 0;return ci(p.getItem.bind(p))(a.name).then(N=>{if(N)if(typeof N.version=="number"&&N.version!==a.version){if(a.migrate)return[!0,a.migrate(N.state,N.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,N.state];return[!1,void 0]}).then(N=>{var b;const[T,L]=N;if(v=a.merge(L,(b=s())!=null?b:y),r(v,!0),T)return m()}).then(()=>{R?.(v,void 0),v=s(),c=!0,f.forEach(N=>N(v))}).catch(N=>{R?.(void 0,N)})};return i.persist={setOptions:_=>{a={...a,..._},_.storage&&(p=_.storage)},clearStorage:()=>{p?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>w(),hasHydrated:()=>c,onHydrate:_=>(u.add(_),()=>{u.delete(_)}),onFinishHydration:_=>(f.add(_),()=>{f.delete(_)})},a.skipHydration||w(),v||y},w2=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?((x2?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),S2(e,t)):_2(e,t),zE=window,WE={showAllNodes:!1,showDevOptions:!1},eo=Po()(w2((e,t)=>({...WE,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:BE(()=>localStorage),version:0})),GE=()=>eo.getState().actions;eo.subscribe(e=>{console.log("feature flags changed",e)});const R2=e=>{const t=(s,i)=>{eo.setState(a=>({...a,[s]:i}))},r=s=>{const i=eo.getState(),a={...s};return Object.entries(i).forEach(([c,u])=>{c in a&&typeof u=="boolean"&&(a[c]=u)}),a};if(zE){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)}});zE.swFlags=s}},N2=()=>R2(WE),ea={currentColor:{negative:"fill-current",primary:"fill-current"},light:{negative:"fill-negative",primary:"fill-primary"}},O2={"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]"},T2=I.forwardRef(function({className:t="",size:r="md",type:s="light"},i){const a=O2[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:ea[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:ea[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:ea[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:ea[s].negative})]})}),C2={[A.FLOW_DATA_VERSION]:Ys,[A.PKG_VERSION]:y1},A2=()=>{const e=()=>{r.current?.open===!1&&r.current.showModal()},t=()=>{r.current?.open&&r.current.close()},r=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(T2,{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(A.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(A.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(A.CLOSE)}),h.jsx(Ae,{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:[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(A.CLOSE)})})]})]})})]})},I2={deploy:A.STATUS_DEPLOY,deployed:A.STATUS_DEPLOYED,deploying:A.STATUS_DEPLOYING,error:A.STATUS_DEPLOY_ERROR},YE={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=ye(N=>N.deployFlowStatus),t=ye(N=>N.deployFlowURL),r=ye(N=>N.detachedMode),s=ye(N=>N.documentVersion),i=ye(N=>N.httpError),a=ye(N=>N.saveFlowStatus),{deployFlow:c,getValidationWarnings:u,setShowDeployWarning:f}=tt(),p={error:void 0,prevDocVersion:s},[m,E]=yd(p),y=I2[e],v=async()=>{if(u().size>0)f(!0);else try{E({error:void 0}),await c()}catch(N){N instanceof Error?E({error:N.message}):E({error:"Failed to deploy!"})}};I.useEffect(()=>{a==="saved"&&s!==m.prevDocVersion&&E({prevDocVersion:s})},[m.prevDocVersion,s,a,E]);const w=a!=="saved"||e==="deployed"||e==="deploying",_=i==="document-sync"?YE.deploying:YE[e];let S="";e==="deploy"&&(S=a==="saved"?"bg-primary":"bg-focus");const R=`${S} ${_}`;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
19
+ text-xs font-medium transition-colors ${R}`,disabled:w,onClick:v,children:[M(y),h.jsx(Sr,{placement:"right",trigger:h.jsx("span",{className:"flex items-center justify-center pl-1",role:"tooltip",tabIndex:0,children:e==="error"?h.jsx(Ae,{tag:"circle-exclamation"}):h.jsx(h.Fragment,{})}),children:e==="error"?M(A.MORE_INFO_DEPLOY_ERROR,{message:m.error}):M(A.MORE_INFO_DEPLOY)})]})},L2=()=>{const e=ye(t=>t.backButtonHref);return e?h.jsxs("a",{href:e,children:[h.jsx("span",{className:"sr-only",children:M(A.NAVIGATE_BACK)}),h.jsx(Ae,{tag:"arrow-left",className:"text-negative",size:"lg"})]}):null},D2=()=>{const e=ye(c=>c.showDeployedHistory),t=ye(c=>c.httpError==="document-sync"),{cancelDetachedMode:r,setShowDeployedHistory:s}=tt(),i=()=>{e?r():s(!0)},a=e?"text-background bg-foreground":"text-foreground bg-foreground/10";return h.jsx(Sr,{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(A.VERSION_HISTORY)}),h.jsx(Ae,{tag:"clock-rotate-left",size:"xs"})]}),children:M(A.VERSION_HISTORY)})},k2=({isDisabled:e,isSelected:t,itemIndex:r,onClick:s,onSelected:i,relativeTimeSince:a,version:c})=>{const u=I.useRef(null),f=E=>{i(E)},p=()=>{t||(f(r),s(r))},m=E=>{E.preventDefault();const{key:y}=E;(y==="Enter"||y===" ")&&s(r),y==="ArrowUp"&&f(r-1),y==="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(Ae,{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(A.VERSION_LIST_ITEM,{number:c})}),h.jsx("p",{className:"text-xxs",children:h.jsx("time",{children:a})})]})]})})},M2=200,KE=Ge(),P2=()=>{const e=ye(R=>R.deployedVersionsList),t=ye(R=>R.saveFlowStatus),r=ye(R=>R.showDeployedHistory),{cancelDetachedMode:s,getDeployedVersionsList:i,migrateAndLoadDeployedFlow:a}=tt();PE({onKeyPress:r?s:void 0});const c=I.useRef(),[u,f]=I.useState("loading"),[p,m]=I.useState(null);p!==null&&!r&&m(null);const E=I.useCallback(R=>{R>=0&&R<=e.length-1?m(R):m(null)},[e.length]),y=I.useCallback(R=>{const N=c.current?.[R];N?(KE.info("load version",N.id),a(N)):KE.error("version not found")},[a]),v=I.useCallback(()=>{f("loading"),i({pageSize:M2}).then(R=>{f("loaded"),c.current=R}).catch(()=>{f("error"),c.current=void 0})},[i]);I.useLayoutEffect(()=>{r&&v()},[v,r]);const w=u==="error",_=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(Ae,{className:"text-xs text-foreground/50",tag:"clock-rotate-left"}),M(A.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(A.CLOSE)}),h.jsx(Ae,{tag:"xmark"})]})]}),h.jsxs("div",{className:`${_?"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 ${_?"":"h-full"}`,children:[h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[w?h.jsx(Ae,{className:"text-negative",tag:"circle-exclamation"}):h.jsx(Ae,{className:"animate-spin",tag:"arrows-rotate"}),h.jsx("p",{"aria-live":w?"assertive":"polite",className:`${w?"text-negative":"font-bold uppercase text-foreground/50"}`,role:w?"alert":"status",children:M(w?A.ERROR_FETCHING_DEPLOYED_VERSIONS:A.STATUS_LOADING)})]}),w?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:v,type:"button",children:M(A.RESYNC)})}):null]}):null,!_&&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
20
+ `,children:h.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-2 gap-x-2",children:[h.jsx(Ae,{tag:"circle-exclamation"}),Kl(A.NO_DEPLOYED_VERSIONS)]})}):null,_?h.jsx("ol",{children:e.map((R,N)=>h.jsx(k2,{itemIndex:N,isDisabled:!S,isSelected:N===p,onClick:y,onSelected:E,relativeTimeSince:R.relativeTimeSince,version:R.version},R.id))}):null]})]}):null},U2=()=>{const{getFlagNames:e}=GE();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(F2,{flagName:t},t))})]})},F2=({flagName:e})=>{const{toggleFlag:t}=GE(),s=eo(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})]})},j2=()=>{const[e,t]=I.useState(!1),r=()=>{t(s=>!s)};return h.jsx(Sr,{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(Ae,{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(A.HELP),h.jsx("span",{className:"sr-only",children:M(A.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:M(Xl[e].label),nodes:Object.entries(Xl[e].nodes).reduce((r,[s,i])=>(((typeof i.active=="boolean"?i.active:i.active[E1])||t)&&r.push({deprecated:!!i.deprecated,title:M(i.label),type:s}),r),[]).sort((r,s)=>r.title.localeCompare(s.title))}),XE=Ge(),$2=["action","forwardTo","recording","input","decision"],H2=()=>{const e=eo(c=>c.showAllNodes),t=ye(c=>c.isCanvasInteractive),{addNode:r,setDragNodeType:s}=tt(),i=I.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?r({nodeType:u}):XE.error("No nodeType found on click event")},[r]),a=I.useCallback(c=>{c.preventDefault();const{nodeType:u}=c.currentTarget.dataset;u?s(u):XE.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:a,showAllNodes:e})},c))})},B2=({enableNodeButtons:e=!0,group:t,handleOnClick:r,handleDragStart:s,showAllNodes:i})=>{const a=V2(t,i),c=`ngm-heading-${I1(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
21
+ 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(Ae,{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(A.DEPRECATED)]})]})]})},u.type))})]})},z2=()=>{const{addToast:e,restoreDeployedFlow:t}=tt(),r=ye(i=>i.workingFlowCopy),s=()=>{t(),e({message:M(A.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
22
+ text-background transition-colors hover:bg-primary/90`,onClick:s,children:M(A.RESTORE)}):null},W2={"awaiting-save":A.STATUS_SAVING,"document-sync":A.STATUS_LOCKED,error:A.STATUS_ERROR,initial:A.STATUS_LOADING,saved:A.STATUS_SAVED,saving:A.STATUS_SAVING},QE=e=>(e.preventDefault(),e.returnValue=""),qE=(e,t)=>e==="document-sync"?e:t,G2=()=>{const e=ye(y=>y.detachedMode),t=ye(y=>y.saveFlowStatus),r=ye(y=>y.httpError),[s,i]=I.useState(!0),[a,c]=I.useState(qE(r,t)),u=W2[a],f=t==="error"||r,p=qE(r,t),m=I.useRef(!1);I.useEffect(()=>{p==="initial"&&!m.current?(m.current=!0,c(p),i(!1),setTimeout(()=>{i(!0)},_1)):p!=="initial"&&s&&(m.current=!1,c(p))},[s,p]),I.useEffect(()=>{if(!(t==="saved"||r))return addEventListener("beforeunload",QE,{capture:!0}),()=>{removeEventListener("beforeunload",QE,{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(Y2,{}):M(u)}),f&&h.jsx(Sr,{placement:"bottom",trigger:h.jsxs("div",{role:"tooltip",tabIndex:0,children:[h.jsx("span",{className:"sr-only",children:M(A.MORE_INFO_STATUS_ERROR)}),h.jsx(Ae,{tag:"circle-exclamation"})]}),children:M(r==="document-sync"?A.INFO_STATUS_ERROR_OUT_OF_SYNC:A.INFO_STATUS_ERROR)})]})})},Y2=()=>{const e=ye(a=>a.documentLastUpdated),t=I.useCallback((a,...c)=>Zm(pE(),{numeric:"always",style:"narrow"})(a,{excludeUnits:{second:!0},...c}),[]),r=e?t(e):void 0,[s,i]=I.useState(r);return I.useEffect(()=>{if(!e)return;const a=setInterval(()=>{i(t(e))},1e3);return()=>clearInterval(a)},[e,t]),h.jsxs(h.Fragment,{children:[M(A.SAVED)," ",h.jsx("time",{children:s})]})},K2=()=>{const e=eo(c=>c.showDevOptions),{exportStoreData:t}=tt(),r=ye(c=>c.flowTitle),s=ye(c=>c.showDeployedHistory),i=I.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(L2,{}),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(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(P2,{})]}),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(j2,{})]})})]}),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(Ae,{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(U2,{})]})})})]})},X2=()=>{const e=I.useRef(null),[t,r]=I.useState(),[s,i]=I.useState(null);return I.useLayoutEffect(()=>(e.current=new ResizeObserver(([a])=>r(a)),s&&e.current.observe(s),()=>e.current?.disconnect()),[s]),{observerEntry:t,setTarget:i}},Q2=({rootAppHeight:e,rootAppWidth:t})=>{ye.setState({rootAppHeight:e,rootAppWidth:t})},q2=()=>{const{observerEntry:e,setTarget:t}=X2();return I.useEffect(()=>{e&&(Ge().log("resized",{rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}),Q2({rootAppHeight:e.contentRect.height,rootAppWidth:e.contentRect.width}))},[e]),{rootTarget:t}};function J2(){Ge().debug("Hello World!");const{rootTarget:e}=q2(),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(TA,{errorType:r}):h.jsxs(h.Fragment,{children:[h.jsx(K2,{}),h.jsx(r2,{}),h.jsx(i2,{}),h.jsxs(Ou,{children:[h.jsx(iI,{}),h.jsxs(oI,{children:[h.jsxs(js,{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(KI,{}),h.jsx(ZI,{})]}),h.jsx(v2,{}),h.jsx(p2,{}),h.jsx(YI,{}),h.jsx(lI,{})]})]})]})})})}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")}',JE=Ge(),eb=e=>{if(!e||!e.getFlowURL||!e.updateFlowURL)throw new TypeError("Invalid or missing required params")};function tb(e){eb(e);const{backButtonHref:t,deployFlowURL:r,getAiAgentsURL:s=`${window.location.origin}${Uv}`,getFlowURL:i,getSwmlScriptsURL:a=`${window.location.origin}${Fv}`,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;Ed.getState().actions.init({voicesURL:p}).catch(y=>{JE.error("Error initializing voices",y)});const m=document.getElementById(c);if(ye.setState({backButtonHref:t,deployFlowURL:r,getFlowURL:i,rootElement:m,rootElementId:c,updateFlowURL:f}),s&&Dn.getState().actions.init({getAiAgentsURL:s}),a&&qn.getState().actions.init({getSwmlScriptsURL:a}),iA().catch(y=>{JE.error("Error initializing i18n",y)}),N2(),!m)throw new Error(`Id: '${c}' not found in the DOM`);m.attachShadow({mode:"open"}),m.shadowRoot&&mx.createRoot(m.shadowRoot).render(h.jsxs(I.StrictMode,{children:[h.jsx("link",{type:"text/css",rel:"stylesheet",href:u}),h.jsx(J2,{})]}));const E=document.createElement("style");document.head.appendChild(E),E.appendChild(document.createTextNode(Z2))}vo.main=tb,Object.defineProperty(vo,Symbol.toStringTag,{value:"Module"})}));