From 790ef3678cb60266dabb6cb90107be5ba0f37d94 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 18 Oct 2023 15:27:09 +0000 Subject: [PATCH] ci: automatic build fixes --- .../{index-e8118d7f.js => index-be5f7c88.js} | 75 ++++++++++++++----- build/index.html | 7 +- build/svg-icons/BudgetIcon.svg | 3 + 3 files changed, 65 insertions(+), 20 deletions(-) rename build/assets/{index-e8118d7f.js => index-be5f7c88.js} (99%) create mode 100644 build/svg-icons/BudgetIcon.svg diff --git a/build/assets/index-e8118d7f.js b/build/assets/index-be5f7c88.js similarity index 99% rename from build/assets/index-e8118d7f.js rename to build/assets/index-be5f7c88.js index 0831c390f..48d7b91d0 100644 --- a/build/assets/index-e8118d7f.js +++ b/build/assets/index-be5f7c88.js @@ -95,7 +95,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * Copyright (c) 2014-2015, 2017, Jon Schlinkert. * Released under the MIT License. - */var split=splitString,extend$3=extendShallow,isPlainObject$3=isPlainObject$5,isObject$h=isExtendable,setValue=function(tt,et,nt){if(!isObject$h(tt)||(Array.isArray(et)&&(et=[].concat.apply([],et).join(".")),typeof et!="string"))return tt;for(var rt=split(et,{sep:".",brackets:!0}).filter(isValidKey),it=rt.length,ot=-1,at=tt;++ottt.filter(Boolean).join(".");function getKeyPath(tt){const et=tt.split(".");return[et.pop(),et.join(".")||void 0]}function getValuesForPaths(tt,et){return Object.entries(pick$1(tt,et)).reduce((nt,[,{value:rt,disabled:it,key:ot}])=>(nt[ot]=it?void 0:rt,nt),{})}function useCompareMemoize(tt,et){const nt=reactExports.useRef();return(et?dequal:shallow$2)(tt,nt.current)||(nt.current=tt),nt.current}function useDeepMemo(tt,et){return reactExports.useMemo(tt,useCompareMemoize(et,!0))}function useToggle(tt){const et=reactExports.useRef(null),nt=reactExports.useRef(null),rt=reactExports.useRef(!0);return reactExports.useLayoutEffect(()=>{tt||(et.current.style.height="0px",et.current.style.overflow="hidden")},[]),reactExports.useEffect(()=>{if(rt.current){rt.current=!1;return}let it;const ot=et.current,at=()=>{tt&&(ot.style.removeProperty("height"),ot.style.removeProperty("overflow"),nt.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};ot.addEventListener("transitionend",at,{once:!0});const{height:st}=nt.current.getBoundingClientRect();return ot.style.height=st+"px",tt||(ot.style.overflow="hidden",it=window.setTimeout(()=>ot.style.height="0px",50)),()=>{ot.removeEventListener("transitionend",at),clearTimeout(it)}},[tt]),{wrapperRef:et,contentRef:nt}}const useVisiblePaths=tt=>{const[et,nt]=reactExports.useState(tt.getVisiblePaths());return reactExports.useEffect(()=>{nt(tt.getVisiblePaths());const rt=tt.useStore.subscribe(tt.getVisiblePaths,nt,{equalityFn:shallow$2});return()=>rt()},[tt]),et};function useValuesForPath(tt,et,nt){return tt.useStore(it=>{const ot=_objectSpread2$1(_objectSpread2$1({},nt),it.data);return getValuesForPaths(ot,et)},shallow$2)}function usePopin(tt=3){const et=reactExports.useRef(null),nt=reactExports.useRef(null),[rt,it]=reactExports.useState(!1),ot=reactExports.useCallback(()=>it(!0),[]),at=reactExports.useCallback(()=>it(!1),[]);return reactExports.useLayoutEffect(()=>{if(rt){const{bottom:st,top:lt,left:ct}=et.current.getBoundingClientRect(),{height:ut}=nt.current.getBoundingClientRect(),ht=st+ut>window.innerHeight-40?"up":"down";nt.current.style.position="fixed",nt.current.style.zIndex="10000",nt.current.style.left=ct+"px",ht==="down"?nt.current.style.top=st+tt+"px":nt.current.style.bottom=window.innerHeight-lt+tt+"px"}},[tt,rt]),{popinRef:et,wrapperRef:nt,shown:rt,show:ot,hide:at}}k$8([namesPlugin]);const convertMap={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};v8n.extend({color:()=>tt=>w$5(tt).isValid()});const schema$2=tt=>v8n().color().test(tt);function convert$5(tt,{format:et,hasAlpha:nt,isString:rt}){const it=convertMap[et]+(rt&&et!=="hex"?"String":""),ot=tt[it]();return typeof ot=="object"&&!nt?omit$1(ot,["a"]):ot}const sanitize$2=(tt,et)=>{const nt=w$5(tt);if(!nt.isValid())throw Error("Invalid color");return convert$5(nt,et)},format$1$1=(tt,et)=>convert$5(w$5(tt),_objectSpread2$1(_objectSpread2$1({},et),{},{isString:!0,format:"hex"})),normalize$3=({value:tt})=>{const et=I$2(tt),nt=et==="name"?"hex":et,rt=typeof tt=="object"?"a"in tt:et==="hex"&&tt.length===8||/^(rgba)|(hsla)|(hsva)/.test(tt),it={format:nt,hasAlpha:rt,isString:typeof tt=="string"};return{value:sanitize$2(tt,it),settings:it}};var props$2=Object.freeze({__proto__:null,schema:schema$2,sanitize:sanitize$2,format:format$1$1,normalize:normalize$3});const ColorPreview=styled$5("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),PickerContainer=styled$5("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),PickerWrapper=styled$5("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function convertToRgb(tt,et){return et!=="rgb"?w$5(tt).toRgb():tt}function Color$2({value:tt,displayValue:et,settings:nt,onUpdate:rt}){const{emitOnEditStart:it,emitOnEditEnd:ot}=useInputContext(),{format:at,hasAlpha:st}=nt,{popinRef:lt,wrapperRef:ct,shown:ut,show:ht,hide:dt}=usePopin(),pt=reactExports.useRef(0),[mt,gt]=reactExports.useState(()=>convertToRgb(tt,at)),yt=st?Ce:Ne$1,bt=()=>{gt(convertToRgb(tt,at)),ht(),it()},vt=()=>{dt(),ot(),window.clearTimeout(pt.current)},xt=()=>{pt.current=window.setTimeout(vt,500)};return reactExports.useEffect(()=>()=>window.clearTimeout(pt.current),[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(ColorPreview,{ref:lt,active:ut,onClick:()=>bt(),style:{color:et}}),ut&&React$1.createElement(Portal$2,null,React$1.createElement(Overlay$1,{onPointerUp:vt}),React$1.createElement(PickerWrapper,{ref:ct,onMouseEnter:()=>window.clearTimeout(pt.current),onMouseLeave:kt=>kt.buttons===0&&xt()},React$1.createElement(yt,{color:mt,onChange:rt}))))}function ColorComponent(){const{value:tt,displayValue:et,label:nt,onChange:rt,onUpdate:it,settings:ot}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,nt),React$1.createElement(PickerContainer,null,React$1.createElement(Color$2,{value:tt,displayValue:et,onChange:rt,onUpdate:it,settings:ot}),React$1.createElement(ValueInput,{value:et,onChange:rt,onUpdate:it})))}var color$3=_objectSpread2$1({component:ColorComponent},props$2);function Vector3dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt}))}var vector3d=_objectSpread2$1({component:Vector3dComponent},getVectorPlugin(["x","y","z"]));const JoystickTrigger=styled$5("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),JoystickPlayground=styled$5("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function Joystick({value:tt,settings:et,onUpdate:nt}){const rt=reactExports.useRef(),it=reactExports.useRef(0),ot=reactExports.useRef(0),at=reactExports.useRef(1),[st,lt]=reactExports.useState(!1),[ct,ut]=reactExports.useState(!1),[ht,dt]=useTransform(),pt=reactExports.useRef(null),mt=reactExports.useRef(null);reactExports.useLayoutEffect(()=>{if(st){const{top:Pt,left:Ct,width:wt,height:It}=pt.current.getBoundingClientRect();mt.current.style.left=Ct+wt/2+"px",mt.current.style.top=Pt+It/2+"px"}},[st]);const{keys:[gt,yt],joystick:bt}=et,vt=bt==="invertY"?1:-1,{[gt]:{step:xt},[yt]:{step:kt}}=et,St=useTh("sizes","joystickWidth"),Tt=useTh("sizes","joystickHeight"),At=parseFloat(St)*.8/2,Et=parseFloat(Tt)*.8/2,$t=reactExports.useCallback(()=>{rt.current||(ut(!0),it.current&&dt({x:it.current*At}),ot.current&&dt({y:ot.current*-Et}),rt.current=window.setInterval(()=>{nt(Pt=>{const Ct=xt*it.current*at.current,wt=vt*kt*ot.current*at.current;return Array.isArray(Pt)?{[gt]:Pt[0]+Ct,[yt]:Pt[1]+wt}:{[gt]:Pt[gt]+Ct,[yt]:Pt[yt]+wt}})},16))},[At,Et,nt,dt,xt,kt,gt,yt,vt]),Dt=reactExports.useCallback(()=>{window.clearTimeout(rt.current),rt.current=void 0,ut(!1)},[]);reactExports.useEffect(()=>{function Pt(Ct){at.current=multiplyStep(Ct)}return window.addEventListener("keydown",Pt),window.addEventListener("keyup",Pt),()=>{window.clearTimeout(rt.current),window.removeEventListener("keydown",Pt),window.removeEventListener("keyup",Pt)}},[]);const jt=useDrag$1(({first:Pt,active:Ct,delta:[wt,It],movement:[Ot,Wt]})=>{Pt&<(!0);const zt=clamp$8(Ot,-At,At),Ft=clamp$8(Wt,-Et,Et);it.current=Math.abs(Ot)>Math.abs(zt)?Math.sign(Ot-zt):0,ot.current=Math.abs(Wt)>Math.abs(Ft)?Math.sign(Ft-Wt):0;let Nt=tt[gt],Ut=tt[yt];Ct?(it.current||(Nt+=wt*xt*at.current,dt({x:zt})),ot.current||(Ut-=vt*It*kt*at.current,dt({y:Ft})),it.current||ot.current?$t():Dt(),nt({[gt]:Nt,[yt]:Ut})):(lt(!1),it.current=0,ot.current=0,dt({x:0,y:0}),Dt())});return React$1.createElement(JoystickTrigger,_extends$t({ref:pt},jt()),st&&React$1.createElement(Portal$2,null,React$1.createElement(JoystickPlayground,{ref:mt,isOutOfBounds:ct},React$1.createElement("div",null),React$1.createElement("span",{ref:ht}))))}const Container$1=styled$5("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function Vector2dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Container$1,{withJoystick:!!rt.joystick},rt.joystick&&React$1.createElement(Joystick,{value:et,settings:rt,onUpdate:nt}),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt})))}const _excluded$7$1=["joystick"],plugin=getVectorPlugin(["x","y"]),normalize$2$1=tt=>{let{joystick:et=!0}=tt,nt=_objectWithoutProperties$l(tt,_excluded$7$1);const{value:rt,settings:it}=plugin.normalize(nt);return{value:rt,settings:_objectSpread2$1(_objectSpread2$1({},it),{},{joystick:et})}};var vector2d=_objectSpread2$1(_objectSpread2$1({component:Vector2dComponent},plugin),{},{normalize:normalize$2$1});const sanitize$1=tt=>{if(tt!==void 0){if(tt instanceof File)try{return URL.createObjectURL(tt)}catch{return}if(typeof tt=="string"&&tt.indexOf("blob:")===0)return tt;throw Error("Invalid image format [undefined | blob | File].")}},schema$1=(tt,et)=>typeof et=="object"&&"image"in et,normalize$1$1=({image:tt})=>({value:tt});var props$1=Object.freeze({__proto__:null,sanitize:sanitize$1,schema:schema$1,normalize:normalize$1$1});const ImageContainer=styled$5("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),DropZone=styled$5("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),ImagePreview=styled$5("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),ImageLargePreview=styled$5("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),Instructions=styled$5("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),Remove=styled$5("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function ImageComponent(){const{label:tt,value:et,onUpdate:nt,disabled:rt}=useInputContext(),{popinRef:it,wrapperRef:ot,shown:at,show:st,hide:lt}=usePopin(),ct=reactExports.useCallback(mt=>{mt.length&&nt(mt[0])},[nt]),ut=reactExports.useCallback(mt=>{mt.stopPropagation(),nt(void 0)},[nt]),{getRootProps:ht,getInputProps:dt,isDragAccept:pt}=useDropzone({maxFiles:1,accept:"image/*",onDrop:ct,disabled:rt});return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(ImageContainer,null,React$1.createElement(ImagePreview,{ref:it,hasImage:!!et,onPointerDown:()=>!!et&&st(),onPointerUp:lt,style:{backgroundImage:et?`url(${et})`:"none"}}),at&&!!et&&React$1.createElement(Portal$2,null,React$1.createElement(Overlay$1,{onPointerUp:lt,style:{cursor:"pointer"}}),React$1.createElement(ImageLargePreview,{ref:ot,style:{backgroundImage:`url(${et})`}})),React$1.createElement(DropZone,ht({isDragAccept:pt}),React$1.createElement("input",dt()),React$1.createElement(Instructions,null,pt?"drop image":"click or drop")),React$1.createElement(Remove,{onClick:ut,disabled:!et})))}var image=_objectSpread2$1({component:ImageComponent},props$1);const number$5=v8n().number(),schema=(tt,et)=>v8n().array().length(2).every.number().test(tt)&&v8n().schema({min:number$5,max:number$5}).test(et),format$2=tt=>({min:tt[0],max:tt[1]}),sanitize=(tt,{bounds:[et,nt]},rt)=>{const it=Array.isArray(tt)?format$2(tt):tt,ot={min:rt[0],max:rt[1]},{min:at,max:st}=_objectSpread2$1(_objectSpread2$1({},ot),it);return[clamp$8(Number(at),et,Math.max(et,st)),clamp$8(Number(st),Math.min(nt,at),nt)]},normalize$4=({value:tt,min:et,max:nt})=>{const rt={min:et,max:nt},it=normalizeKeyedNumberSettings(format$2(tt),{min:rt,max:rt}),ot=[et,nt],at=_objectSpread2$1(_objectSpread2$1({},it),{},{bounds:ot});return{value:sanitize(format$2(tt),at,tt),settings:at}};var props$3=Object.freeze({__proto__:null,schema,format:format$2,sanitize,normalize:normalize$4});const _excluded$6$1=["value","bounds","onDrag"],_excluded2$1$1=["bounds"],Container=styled$5("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function IntervalSlider(tt){let{value:et,bounds:[nt,rt],onDrag:it}=tt,ot=_objectWithoutProperties$l(tt,_excluded$6$1);const at=reactExports.useRef(null),st=reactExports.useRef(null),lt=reactExports.useRef(null),ct=reactExports.useRef(0),ut=useTh("sizes","scrubberWidth"),ht=useDrag$1(({event:mt,first:gt,xy:[yt],movement:[bt],memo:vt={}})=>{if(gt){const{width:kt,left:St}=at.current.getBoundingClientRect();ct.current=kt-parseFloat(ut);const Tt=(mt==null?void 0:mt.target)===st.current||(mt==null?void 0:mt.target)===lt.current;vt.pos=invertedRange((yt-St)/kt,nt,rt);const At=Math.abs(vt.pos-et.min)-Math.abs(vt.pos-et.max);vt.key=At<0||At===0&&vt.pos<=et.min?"min":"max",Tt&&(vt.pos=et[vt.key])}const xt=vt.pos+invertedRange(bt/ct.current,0,rt-nt);return it({[vt.key]:sanitizeStep(xt,ot[vt.key])}),vt}),dt=`calc(${range$8(et.min,nt,rt)} * (100% - ${ut} - 8px) + 4px)`,pt=`calc(${1-range$8(et.max,nt,rt)} * (100% - ${ut} - 8px) + 4px)`;return React$1.createElement(RangeWrapper,_extends$t({ref:at},ht()),React$1.createElement(Range,null,React$1.createElement(Indicator,{style:{left:dt,right:pt}})),React$1.createElement(Scrubber,{position:"left",ref:st,style:{left:dt}}),React$1.createElement(Scrubber,{position:"right",ref:lt,style:{right:pt}}))}function IntervalComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext(),it=_objectWithoutProperties$l(rt,_excluded2$1$1);return React$1.createElement(React$1.Fragment,null,React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Container,null,React$1.createElement(IntervalSlider,_extends$t({value:et},rt,{onDrag:nt})),React$1.createElement(Vector,{value:et,settings:it,onUpdate:nt,innerLabelTrim:0}))))}var interval$1=_objectSpread2$1({component:IntervalComponent},props$3);const createEventEmitter=()=>{const tt=new Map;return{on:(et,nt)=>{let rt=tt.get(et);rt===void 0&&(rt=new Set,tt.set(et,rt)),rt.add(nt)},off:(et,nt)=>{const rt=tt.get(et);rt!==void 0&&(rt.delete(nt),rt.size===0&&tt.delete(et))},emit:(et,...nt)=>{const rt=tt.get(et);if(rt!==void 0)for(const it of rt)it(...nt)}}},_excluded$5$1=["type","value"],_excluded2$h=["onChange","transient","onEditStart","onEditEnd"],Store=function(){const et=create$4(subscribeWithSelector(()=>({data:{}}))),nt=createEventEmitter();this.storeId=getUid(),this.useStore=et;const rt={},it=new Set;this.getVisiblePaths=()=>{const at=this.getData(),st=Object.keys(at),lt=[];Object.entries(rt).forEach(([ut,ht])=>{ht.render&&st.some(dt=>dt.indexOf(ut)===0)&&!ht.render(this.get)&<.push(ut+".")});const ct=[];return it.forEach(ut=>{ut in at&&at[ut].__refCount>0&<.every(ht=>ut.indexOf(ht)===-1)&&(!at[ut].render||at[ut].render(this.get))&&ct.push(ut)}),ct},this.setOrderedPaths=at=>{at.forEach(st=>it.add(st))},this.orderPaths=at=>(this.setOrderedPaths(at),at),this.disposePaths=at=>{et.setState(st=>{const lt=st.data;return at.forEach(ct=>{if(ct in lt){const ut=lt[ct];ut.__refCount--,ut.__refCount===0&&ut.type in SpecialInputs&&delete lt[ct]}}),{data:lt}})},this.dispose=()=>{et.setState(()=>({data:{}}))},this.getFolderSettings=at=>rt[at]||{},this.getData=()=>et.getState().data,this.addData=(at,st)=>{et.setState(lt=>{const ct=lt.data;return Object.entries(at).forEach(([ut,ht])=>{let dt=ct[ut];if(dt){const{type:pt,value:mt}=ht,gt=_objectWithoutProperties$l(ht,_excluded$5$1);pt!==dt.type?warn$3(LevaErrors.INPUT_TYPE_OVERRIDE,pt):((dt.__refCount===0||st)&&Object.assign(dt,gt),dt.__refCount++)}else ct[ut]=_objectSpread2$1(_objectSpread2$1({},ht),{},{__refCount:1})}),{data:ct}})},this.setValueAtPath=(at,st,lt)=>{et.setState(ct=>{const ut=ct.data;return updateInput(ut[at],st,at,this,lt),{data:ut}})},this.setSettingsAtPath=(at,st)=>{et.setState(lt=>{const ct=lt.data;return ct[at].settings=_objectSpread2$1(_objectSpread2$1({},ct[at].settings),st),{data:ct}})},this.disableInputAtPath=(at,st)=>{et.setState(lt=>{const ct=lt.data;return ct[at].disabled=st,{data:ct}})},this.set=(at,st)=>{et.setState(lt=>{const ct=lt.data;return Object.entries(at).forEach(([ut,ht])=>{try{updateInput(ct[ut],ht,void 0,void 0,st)}catch{}}),{data:ct}})},this.getInput=at=>{try{return this.getData()[at]}catch{warn$3(LevaErrors.PATH_DOESNT_EXIST,at)}},this.get=at=>{var st;return(st=this.getInput(at))===null||st===void 0?void 0:st.value},this.emitOnEditStart=at=>{nt.emit(`onEditStart:${at}`,this.get(at),at,_objectSpread2$1(_objectSpread2$1({},this.getInput(at)),{},{get:this.get}))},this.emitOnEditEnd=at=>{nt.emit(`onEditEnd:${at}`,this.get(at),at,_objectSpread2$1(_objectSpread2$1({},this.getInput(at)),{},{get:this.get}))},this.subscribeToEditStart=(at,st)=>{const lt=`onEditStart:${at}`;return nt.on(lt,st),()=>nt.off(lt,st)},this.subscribeToEditEnd=(at,st)=>{const lt=`onEditEnd:${at}`;return nt.on(lt,st),()=>nt.off(lt,st)};const ot=(at,st,lt)=>{const ct={};return Object.entries(at).forEach(([ut,ht])=>{if(ut==="")return warn$3(LevaErrors.EMPTY_KEY);let dt=join(st,ut);if(ht.type===SpecialInputs.FOLDER){const pt=ot(ht.schema,dt,lt);Object.assign(ct,pt),dt in rt||(rt[dt]=ht.settings)}else if(ut in lt)warn$3(LevaErrors.DUPLICATE_KEYS,ut,dt,lt[ut].path);else{const pt=normalizeInput(ht,ut,dt,ct);if(pt){const{type:mt,options:gt,input:yt}=pt,{onChange:bt,transient:vt,onEditStart:xt,onEditEnd:kt}=gt,St=_objectWithoutProperties$l(gt,_excluded2$h);ct[dt]=_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({type:mt},St),yt),{},{fromPanel:!0}),lt[ut]={path:dt,onChange:bt,transient:vt,onEditStart:xt,onEditEnd:kt}}else warn$3(LevaErrors.UNKNOWN_INPUT,dt,ht)}}),ct};this.getDataFromSchema=at=>{const st={};return[ot(at,"",st),st]}},levaStore=new Store,defaultSettings$2={collapsed:!1};function folder(tt,et){return{type:SpecialInputs.FOLDER,schema:tt,settings:_objectSpread2$1(_objectSpread2$1({},defaultSettings$2),et)}}const isInput=tt=>"__levaInput"in tt,buildTree=(tt,et)=>{const nt={},rt=et?et.toLowerCase():null;return tt.forEach(it=>{const[ot,at]=getKeyPath(it);(!rt||ot.toLowerCase().indexOf(rt)>-1)&&merge$2(nt,at,{[ot]:{__levaInput:!0,path:it}})}),nt},_excluded$4$1=["type","label","path","valueKey","value","settings","setValue","disabled"];function ControlInput(tt){let{type:et,label:nt,path:rt,valueKey:it,value:ot,settings:at,setValue:st,disabled:lt}=tt,ct=_objectWithoutProperties$l(tt,_excluded$4$1);const{displayValue:ut,onChange:ht,onUpdate:dt}=useInputSetters({type:et,value:ot,settings:at,setValue:st}),pt=Plugins[et].component;return pt?React$1.createElement(InputContext.Provider,{value:_objectSpread2$1({key:it,path:rt,id:""+rt,label:nt,displayValue:ut,value:ot,onChange:ht,onUpdate:dt,settings:at,setValue:st,disabled:lt},ct)},React$1.createElement(StyledInputWrapper$1,{disabled:lt},React$1.createElement(pt,null))):(warn$3(LevaErrors.NO_COMPONENT_FOR_TYPE,et,rt),null)}const StyledButton$2=styled$5("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function Button$3({onClick:tt,settings:et,label:nt}){const rt=useStoreContext();return React$1.createElement(Row,null,React$1.createElement(StyledButton$2,{disabled:et.disabled,onClick:()=>tt(rt.get)},nt))}const StyledButtonGroup=styled$5("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),StyledButtonGroupButton=styled$5("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),getOpts=({label:tt,opts:et})=>{let nt=typeof tt=="string"&&tt.trim()===""?null:tt,rt=et;return typeof et.opts=="object"&&(rt.label!==void 0&&(nt=et.label),rt=et.opts),{label:nt,opts:rt}};function ButtonGroup(tt){const{label:et,opts:nt}=getOpts(tt),rt=useStoreContext();return React$1.createElement(Row,{input:!!et},et&&React$1.createElement(Label$4,null,et),React$1.createElement(StyledButtonGroup,null,Object.entries(nt).map(([it,ot])=>React$1.createElement(StyledButtonGroupButton,{key:it,onClick:()=>ot(rt.get)},it))))}const Canvas$2=styled$5("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),POINTS=100;function push(tt,et){tt.push(et),tt.length>POINTS&&tt.shift()}const MonitorCanvas=reactExports.forwardRef(function({initialValue:tt},et){const nt=useTh("colors","highlight3"),rt=useTh("colors","elevation2"),it=useTh("colors","highlight1"),[ot,at]=reactExports.useMemo(()=>[w$5(it).alpha(.4).toRgbString(),w$5(it).alpha(.1).toRgbString()],[it]),st=reactExports.useRef([tt]),lt=reactExports.useRef(tt),ct=reactExports.useRef(tt),ut=reactExports.useRef(),ht=reactExports.useCallback((mt,gt)=>{if(!mt)return;const{width:yt,height:bt}=mt,vt=new Path2D,xt=yt/POINTS,kt=bt*.05;for(let At=0;At({frame:mt=>{(lt.current===void 0||mtct.current)&&(ct.current=mt),push(st.current,mt),ut.current=requestAnimationFrame(()=>ht(dt.current,pt.current))}}),[dt,pt,ht]),reactExports.useEffect(()=>()=>cancelAnimationFrame(ut.current),[]),React$1.createElement(Canvas$2,{ref:dt})}),parse$2=tt=>Number.isFinite(tt)?tt.toPrecision(2):tt.toString(),MonitorLog=reactExports.forwardRef(function({initialValue:tt},et){const[nt,rt]=reactExports.useState(parse$2(tt));return reactExports.useImperativeHandle(et,()=>({frame:it=>rt(parse$2(it))}),[]),React$1.createElement("div",null,nt)});function getValue$4(tt){return typeof tt=="function"?tt():tt.current}function Monitor({label:tt,objectOrFn:et,settings:nt}){const rt=reactExports.useRef(),it=reactExports.useRef(getValue$4(et));return reactExports.useEffect(()=>{const ot=window.setInterval(()=>{var at;document.hidden||(at=rt.current)===null||at===void 0||at.frame(getValue$4(et))},nt.interval);return()=>window.clearInterval(ot)},[et,nt.interval]),React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,{align:"top"},tt),nt.graph?React$1.createElement(MonitorCanvas,{ref:rt,initialValue:it.current}):React$1.createElement(MonitorLog,{ref:rt,initialValue:it.current}))}const _excluded$3$1=["type","label","key"],specialComponents={[SpecialInputs.BUTTON]:Button$3,[SpecialInputs.BUTTON_GROUP]:ButtonGroup,[SpecialInputs.MONITOR]:Monitor},Control=React$1.memo(({path:tt})=>{const[et,{set:nt,setSettings:rt,disable:it,storeId:ot,emitOnEditStart:at,emitOnEditEnd:st}]=useInput(tt);if(!et)return null;const{type:lt,label:ct,key:ut}=et,ht=_objectWithoutProperties$l(et,_excluded$3$1);if(lt in SpecialInputs){const dt=specialComponents[lt];return React$1.createElement(dt,_extends$t({label:ct,path:tt},ht))}return lt in Plugins?React$1.createElement(ControlInput,_extends$t({key:ot+tt,type:lt,label:ct,storeId:ot,path:tt,valueKey:ut,setValue:nt,setSettings:rt,disable:it,emitOnEditStart:at,emitOnEditEnd:st},ht)):(log$2(LevaErrors.UNSUPPORTED_INPUT,lt,tt),null)});function FolderTitle({toggle:tt,toggled:et,name:nt}){return React$1.createElement(StyledTitle,{onClick:()=>tt()},React$1.createElement(Chevron,{toggled:et}),React$1.createElement("div",null,nt))}const Folder=({name:tt,path:et,tree:nt})=>{const rt=useStoreContext(),it=join(et,tt),{collapsed:ot,color:at}=rt.getFolderSettings(it),[st,lt]=reactExports.useState(!ot),ct=reactExports.useRef(null),ut=useTh("colors","folderWidgetColor"),ht=useTh("colors","folderTextColor");return reactExports.useLayoutEffect(()=>{ct.current.style.setProperty("--leva-colors-folderWidgetColor",at||ut),ct.current.style.setProperty("--leva-colors-folderTextColor",at||ht)},[at,ut,ht]),React$1.createElement(StyledFolder,{ref:ct},React$1.createElement(FolderTitle,{name:tt,toggled:st,toggle:()=>lt(dt=>!dt)}),React$1.createElement(TreeWrapper,{parent:it,tree:nt,toggled:st}))},TreeWrapper=React$1.memo(({isRoot:tt=!1,fill:et=!1,flat:nt=!1,parent:rt,tree:it,toggled:ot})=>{const{wrapperRef:at,contentRef:st}=useToggle(ot),lt=useStoreContext(),ct=([ht,dt])=>{var pt;return(isInput(dt)?(pt=lt.getInput(dt.path))===null||pt===void 0?void 0:pt.order:lt.getFolderSettings(join(rt,ht)).order)||0},ut=Object.entries(it).sort((ht,dt)=>ct(ht)-ct(dt));return React$1.createElement(StyledWrapper,{ref:at,isRoot:tt,fill:et,flat:nt},React$1.createElement(StyledContent,{ref:st,isRoot:tt,toggled:ot},ut.map(([ht,dt])=>isInput(dt)?React$1.createElement(Control,{key:dt.path,valueKey:dt.valueKey,path:dt.path}):React$1.createElement(Folder,{key:ht,name:ht,path:rt,tree:dt}))))}),StyledRoot=styled$5("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${StyledInputRow}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),iconWidth=40,Icon=styled$5("i",{$flexCenter:"",width:iconWidth,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),StyledTitleWithFilter=styled$5("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),FilterWrapper=styled$5("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${Icon}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),StyledFilterInput=styled$5("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),TitleContainer=styled$5("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:iconWidth}}}}),FilterInput=React$1.forwardRef(({setFilter:tt,toggle:et},nt)=>{const[rt,it]=reactExports.useState(""),ot=reactExports.useMemo(()=>debounce$6(tt,250),[tt]),at=()=>{tt(""),it("")},st=lt=>{const ct=lt.currentTarget.value;et(!0),it(ct)};return reactExports.useEffect(()=>{ot(rt)},[rt,ot]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledFilterInput,{ref:nt,value:rt,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:lt=>lt.stopPropagation(),onChange:st}),React$1.createElement(Icon,{onClick:()=>at(),style:{visibility:rt?"visible":"hidden"}},React$1.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},React$1.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function TitleWithFilter({setFilter:tt,onDrag:et,onDragStart:nt,onDragEnd:rt,toggle:it,toggled:ot,title:at,drag:st,filterEnabled:lt,from:ct}){const[ut,ht]=reactExports.useState(!1),dt=reactExports.useRef(null);reactExports.useEffect(()=>{var mt,gt;ut?(mt=dt.current)===null||mt===void 0||mt.focus():(gt=dt.current)===null||gt===void 0||gt.blur()},[ut]);const pt=useDrag$1(({offset:[mt,gt],first:yt,last:bt})=>{et({x:mt,y:gt}),yt&&nt({x:mt,y:gt}),bt&&rt({x:mt,y:gt})},{filterTaps:!0,from:({offset:[mt,gt]})=>[(ct==null?void 0:ct.x)||mt,(ct==null?void 0:ct.y)||gt]});return reactExports.useEffect(()=>{const mt=gt=>{gt.key==="L"&>.shiftKey&>.metaKey&&ht(yt=>!yt)};return window.addEventListener("keydown",mt),()=>window.removeEventListener("keydown",mt)},[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledTitleWithFilter,{mode:st?"drag":void 0},React$1.createElement(Icon,{active:!ot,onClick:()=>it()},React$1.createElement(Chevron,{toggled:ot,width:12,height:8})),React$1.createElement(TitleContainer,_extends$t({},st?pt():{},{drag:st,filterEnabled:lt}),at===void 0&&st?React$1.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},React$1.createElement("circle",{cx:"2",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"14",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"26",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"2",cy:"12",r:"2"}),React$1.createElement("circle",{cx:"14",cy:"12",r:"2"}),React$1.createElement("circle",{cx:"26",cy:"12",r:"2"})):at),lt&&React$1.createElement(Icon,{active:ut,onClick:()=>ht(mt=>!mt)},React$1.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},React$1.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),React$1.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),React$1.createElement(FilterWrapper,{toggled:ut},React$1.createElement(FilterInput,{ref:dt,setFilter:tt,toggle:it})))}const _excluded$2$1=["store","hidden","theme","collapsed"];function LevaRoot(tt){let{store:et,hidden:nt=!1,theme:rt,collapsed:it=!1}=tt,ot=_objectWithoutProperties$l(tt,_excluded$2$1);const at=useDeepMemo(()=>mergeTheme(rt),[rt]),[st,lt]=reactExports.useState(!it),ct=typeof it=="object"?!it.collapsed:st,ut=reactExports.useMemo(()=>typeof it=="object"?ht=>{typeof ht=="function"?it.onChange(!ht(!it.collapsed)):it.onChange(!ht)}:lt,[it]);return!et||nt?null:React$1.createElement(ThemeContext$3.Provider,{value:at},React$1.createElement(LevaCore,_extends$t({store:et},ot,{toggled:ct,setToggle:ut,rootClass:at.className})))}const LevaCore=React$1.memo(({store:tt,rootClass:et,fill:nt=!1,flat:rt=!1,neverHide:it=!1,oneLineLabels:ot=!1,titleBar:at={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:st=!1,toggled:lt,setToggle:ct})=>{var ut,ht;const dt=useVisiblePaths(tt),[pt,mt]=reactExports.useState(""),gt=reactExports.useMemo(()=>buildTree(dt,pt),[dt,pt]),[yt,bt]=useTransform(),vt=it||dt.length>0,xt=typeof at=="object"&&at.title||void 0,kt=typeof at=="object"&&(ut=at.drag)!==null&&ut!==void 0?ut:!0,St=typeof at=="object"&&(ht=at.filter)!==null&&ht!==void 0?ht:!0,Tt=typeof at=="object"&&at.position||void 0,At=typeof at=="object"&&at.onDrag||void 0,Et=typeof at=="object"&&at.onDragStart||void 0,$t=typeof at=="object"&&at.onDragEnd||void 0;return React$1.useEffect(()=>{bt({x:Tt==null?void 0:Tt.x,y:Tt==null?void 0:Tt.y})},[Tt,bt]),globalStyles(),React$1.createElement(PanelSettingsContext.Provider,{value:{hideCopyButton:st}},React$1.createElement(StyledRoot,{ref:yt,className:et,fill:nt,flat:rt,oneLineLabels:ot,hideTitleBar:!at,style:{display:vt?"block":"none"}},at&&React$1.createElement(TitleWithFilter,{onDrag:Dt=>{bt(Dt),At==null||At(Dt)},onDragStart:Dt=>Et==null?void 0:Et(Dt),onDragEnd:Dt=>$t==null?void 0:$t(Dt),setFilter:mt,toggle:Dt=>ct(jt=>Dt??!jt),toggled:lt,title:xt,drag:kt,filterEnabled:St,from:Tt}),vt&&React$1.createElement(StoreContext$1.Provider,{value:tt},React$1.createElement(TreeWrapper,{isRoot:!0,fill:nt,flat:rt,tree:gt,toggled:lt}))))}),_excluded$1$3=["isRoot"];let rootInitialized=!1,rootEl=null;function Leva(tt){let{isRoot:et=!1}=tt,nt=_objectWithoutProperties$l(tt,_excluded$1$3);return reactExports.useEffect(()=>(rootInitialized=!0,!et&&rootEl&&(rootEl.remove(),rootEl=null),()=>{et||(rootInitialized=!1)}),[et]),React$1.createElement(LevaRoot,_extends$t({store:levaStore},nt))}function useRenderRoot(tt){reactExports.useEffect(()=>{tt&&!rootInitialized&&(rootEl||(rootEl=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(rootEl),render(React$1.createElement(Leva,{isRoot:!0}),rootEl))),rootInitialized=!0)},[tt])}function parseArgs(tt,et,nt,rt,it){let ot,at,st,lt,ct;return typeof tt=="string"?(at=tt,ot=et,Array.isArray(nt)?ct=nt:nt&&("store"in nt?(lt=nt,ct=rt):(st=nt,Array.isArray(rt)?ct=rt:(lt=rt,ct=it)))):(ot=tt,Array.isArray(et)?ct=et:(lt=et,ct=nt)),{schema:ot,folderName:at,folderSettings:st,hookSettings:lt,deps:ct||[]}}function useControls(tt,et,nt,rt,it){const{folderName:ot,schema:at,folderSettings:st,hookSettings:lt,deps:ct}=parseArgs(tt,et,nt,rt,it),ut=typeof at=="function",ht=reactExports.useRef(!1),dt=reactExports.useRef(!0),pt=useDeepMemo(()=>{ht.current=!0;const jt=typeof at=="function"?at():at;return ot?{[ot]:folder(jt,st)}:jt},ct),mt=!(lt!=null&<.store);useRenderRoot(mt);const[gt]=reactExports.useState(()=>(lt==null?void 0:lt.store)||levaStore),[yt,bt]=reactExports.useMemo(()=>gt.getDataFromSchema(pt),[gt,pt]),[vt,xt,kt,St,Tt]=reactExports.useMemo(()=>{const jt=[],Pt=[],Ct={},wt={},It={};return Object.values(bt).forEach(({path:Ot,onChange:Wt,onEditStart:zt,onEditEnd:Ft,transient:Nt})=>{jt.push(Ot),Wt?(Ct[Ot]=Wt,Nt||Pt.push(Ot)):Pt.push(Ot),zt&&(wt[Ot]=zt),Ft&&(It[Ot]=Ft)}),[jt,Pt,Ct,wt,It]},[bt]),At=reactExports.useMemo(()=>gt.orderPaths(vt),[vt,gt]),Et=useValuesForPath(gt,xt,yt),$t=reactExports.useCallback(jt=>{const Pt=Object.entries(jt).reduce((Ct,[wt,It])=>Object.assign(Ct,{[bt[wt].path]:It}),{});gt.set(Pt,!1)},[gt,bt]),Dt=reactExports.useCallback(jt=>gt.get(bt[jt].path),[gt,bt]);return reactExports.useEffect(()=>{const jt=!dt.current&&ht.current;return gt.addData(yt,jt),dt.current=!1,ht.current=!1,()=>gt.disposePaths(At)},[gt,At,yt]),reactExports.useEffect(()=>{const jt=[];return Object.entries(kt).forEach(([Pt,Ct])=>{Ct(gt.get(Pt),Pt,_objectSpread2$1({initial:!0,get:gt.get},gt.getInput(Pt)));const wt=gt.useStore.subscribe(It=>{const Ot=It.data[Pt];return[Ot.disabled?void 0:Ot.value,Ot]},([It,Ot])=>Ct(It,Pt,_objectSpread2$1({initial:!1,get:gt.get},Ot)),{equalityFn:shallow$2});jt.push(wt)}),()=>jt.forEach(Pt=>Pt())},[gt,kt]),reactExports.useEffect(()=>{const jt=[];return Object.entries(St).forEach(([Pt,Ct])=>jt.push(gt.subscribeToEditStart(Pt,Ct))),Object.entries(Tt).forEach(([Pt,Ct])=>jt.push(gt.subscribeToEditEnd(Pt,Ct))),()=>jt.forEach(Pt=>Pt())},[St,Tt,gt]),ut?[Et,$t,Dt]:Et}register(LevaInputs.SELECT,select$1);register(LevaInputs.IMAGE,image);register(LevaInputs.NUMBER,number$6);register(LevaInputs.COLOR,color$3);register(LevaInputs.STRING,string$1);register(LevaInputs.BOOLEAN,boolean);register(LevaInputs.INTERVAL,interval$1);register(LevaInputs.VECTOR3D,vector3d);register(LevaInputs.VECTOR2D,vector2d);var isCheckBoxInput=tt=>tt.type==="checkbox",isDateObject=tt=>tt instanceof Date,isNullOrUndefined=tt=>tt==null;const isObjectType=tt=>typeof tt=="object";var isObject$f=tt=>!isNullOrUndefined(tt)&&!Array.isArray(tt)&&isObjectType(tt)&&!isDateObject(tt),getEventValue=tt=>isObject$f(tt)&&tt.target?isCheckBoxInput(tt.target)?tt.target.checked:tt.target.value:tt,getNodeParentName=tt=>tt.substring(0,tt.search(/\.\d+(\.|$)/))||tt,isNameInFieldArray=(tt,et)=>tt.has(getNodeParentName(et)),isPlainObject$2=tt=>{const et=tt.constructor&&tt.constructor.prototype;return isObject$f(et)&&et.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(tt){let et;const nt=Array.isArray(tt);if(tt instanceof Date)et=new Date(tt);else if(tt instanceof Set)et=new Set(tt);else if(!(isWeb&&(tt instanceof Blob||tt instanceof FileList))&&(nt||isObject$f(tt)))if(et=nt?[]:{},!nt&&!isPlainObject$2(tt))et=tt;else for(const rt in tt)tt.hasOwnProperty(rt)&&(et[rt]=cloneObject(tt[rt]));else return tt;return et}var compact=tt=>Array.isArray(tt)?tt.filter(Boolean):[],isUndefined$1=tt=>tt===void 0,get$5=(tt,et,nt)=>{if(!et||!isObject$f(tt))return nt;const rt=compact(et.split(/[,[\].]+?/)).reduce((it,ot)=>isNullOrUndefined(it)?it:it[ot],tt);return isUndefined$1(rt)||rt===tt?isUndefined$1(tt[et])?nt:tt[et]:rt},isBoolean$2=tt=>typeof tt=="boolean";const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},HookFormContext=React$1.createContext(null),useFormContext=()=>React$1.useContext(HookFormContext),FormProvider=tt=>{const{children:et,...nt}=tt;return React$1.createElement(HookFormContext.Provider,{value:nt},et)};var getProxyFormState=(tt,et,nt,rt=!0)=>{const it={defaultValues:et._defaultValues};for(const ot in tt)Object.defineProperty(it,ot,{get:()=>{const at=ot;return et._proxyFormState[at]!==VALIDATION_MODE.all&&(et._proxyFormState[at]=!rt||VALIDATION_MODE.all),nt&&(nt[at]=!0),tt[at]}});return it},isEmptyObject=tt=>isObject$f(tt)&&!Object.keys(tt).length,shouldRenderFormState=(tt,et,nt,rt)=>{nt(tt);const{name:it,...ot}=tt;return isEmptyObject(ot)||Object.keys(ot).length>=Object.keys(et).length||Object.keys(ot).find(at=>et[at]===(!rt||VALIDATION_MODE.all))},convertToArrayPayload=tt=>Array.isArray(tt)?tt:[tt],shouldSubscribeByName=(tt,et,nt)=>!tt||!et||tt===et||convertToArrayPayload(tt).some(rt=>rt&&(nt?rt===et:rt.startsWith(et)||et.startsWith(rt)));function useSubscribe(tt){const et=React$1.useRef(tt);et.current=tt,React$1.useEffect(()=>{const nt=!tt.disabled&&et.current.subject&&et.current.subject.subscribe({next:et.current.next});return()=>{nt&&nt.unsubscribe()}},[tt.disabled])}function useFormState(tt){const et=useFormContext(),{control:nt=et.control,disabled:rt,name:it,exact:ot}=tt||{},[at,st]=React$1.useState(nt._formState),lt=React$1.useRef(!0),ct=React$1.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),ut=React$1.useRef(it);return ut.current=it,useSubscribe({disabled:rt,next:ht=>lt.current&&shouldSubscribeByName(ut.current,ht.name,ot)&&shouldRenderFormState(ht,ct.current,nt._updateFormState)&&st({...nt._formState,...ht}),subject:nt._subjects.state}),React$1.useEffect(()=>(lt.current=!0,ct.current.isValid&&nt._updateValid(!0),()=>{lt.current=!1}),[nt]),getProxyFormState(at,nt,ct.current,!1)}var isString$3=tt=>typeof tt=="string",generateWatchOutput=(tt,et,nt,rt,it)=>isString$3(tt)?(rt&&et.watch.add(tt),get$5(nt,tt,it)):Array.isArray(tt)?tt.map(ot=>(rt&&et.watch.add(ot),get$5(nt,ot))):(rt&&(et.watchAll=!0),nt);function useWatch(tt){const et=useFormContext(),{control:nt=et.control,name:rt,defaultValue:it,disabled:ot,exact:at}=tt||{},st=React$1.useRef(rt);st.current=rt,useSubscribe({disabled:ot,subject:nt._subjects.values,next:ut=>{shouldSubscribeByName(st.current,ut.name,at)&&ct(cloneObject(generateWatchOutput(st.current,nt._names,ut.values||nt._formValues,!1,it)))}});const[lt,ct]=React$1.useState(nt._getWatch(rt,it));return React$1.useEffect(()=>nt._removeUnmounted()),lt}var isKey$4=tt=>/^\w*$/.test(tt),stringToPath$3=tt=>compact(tt.replace(/["|']|\]/g,"").split(/\.|\[/));function set$3(tt,et,nt){let rt=-1;const it=isKey$4(et)?[et]:stringToPath$3(et),ot=it.length,at=ot-1;for(;++rt{const ut=it._options.shouldUnregister||ot,ht=(dt,pt)=>{const mt=get$5(it._fields,dt);mt&&(mt._f.mount=pt)};if(ht(nt,!0),ut){const dt=cloneObject(get$5(it._options.defaultValues,nt));set$3(it._defaultValues,nt,dt),isUndefined$1(get$5(it._formValues,nt))&&set$3(it._formValues,nt,dt)}return()=>{(at?ut&&!it._state.action:ut)?it.unregister(nt):ht(nt,!1)}},[nt,it,at,ot]),React$1.useEffect(()=>{get$5(it._fields,nt)&&it._updateDisabledField({disabled:rt,fields:it._fields,name:nt})},[rt,nt,it]),{field:{name:nt,value:st,...isBoolean$2(rt)?{disabled:rt}:{},onChange:React$1.useCallback(ut=>ct.current.onChange({target:{value:getEventValue(ut),name:nt},type:EVENTS.CHANGE}),[nt]),onBlur:React$1.useCallback(()=>ct.current.onBlur({target:{value:get$5(it._formValues,nt),name:nt},type:EVENTS.BLUR}),[nt,it]),ref:ut=>{const ht=get$5(it._fields,nt);ht&&ut&&(ht._f.ref={focus:()=>ut.focus(),select:()=>ut.select(),setCustomValidity:dt=>ut.setCustomValidity(dt),reportValidity:()=>ut.reportValidity()})}},formState:lt,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!get$5(lt.errors,nt)},isDirty:{enumerable:!0,get:()=>!!get$5(lt.dirtyFields,nt)},isTouched:{enumerable:!0,get:()=>!!get$5(lt.touchedFields,nt)},error:{enumerable:!0,get:()=>get$5(lt.errors,nt)}})}}const Controller=tt=>tt.render(useController(tt));var appendErrors=(tt,et,nt,rt,it)=>et?{...nt[tt],types:{...nt[tt]&&nt[tt].types?nt[tt].types:{},[rt]:it||!0}}:{};const focusFieldBy=(tt,et,nt)=>{for(const rt of nt||Object.keys(tt)){const it=get$5(tt,rt);if(it){const{_f:ot,...at}=it;if(ot&&et(ot.name)){if(ot.ref.focus){ot.ref.focus();break}else if(ot.refs&&ot.refs[0].focus){ot.refs[0].focus();break}}else isObject$f(at)&&focusFieldBy(at,et)}}};var getValidationModes=tt=>({isOnSubmit:!tt||tt===VALIDATION_MODE.onSubmit,isOnBlur:tt===VALIDATION_MODE.onBlur,isOnChange:tt===VALIDATION_MODE.onChange,isOnAll:tt===VALIDATION_MODE.all,isOnTouch:tt===VALIDATION_MODE.onTouched}),isWatched=(tt,et,nt)=>!nt&&(et.watchAll||et.watch.has(tt)||[...et.watch].some(rt=>tt.startsWith(rt)&&/^\.\w+/.test(tt.slice(rt.length)))),updateFieldArrayRootError=(tt,et,nt)=>{const rt=compact(get$5(tt,nt));return set$3(rt,"root",et[nt]),set$3(tt,nt,rt),tt},isFileInput=tt=>tt.type==="file",isFunction$6=tt=>typeof tt=="function",isHTMLElement$2=tt=>{if(!isWeb)return!1;const et=tt?tt.ownerDocument:0;return tt instanceof(et&&et.defaultView?et.defaultView.HTMLElement:HTMLElement)},isMessage=tt=>isString$3(tt),isRadioInput=tt=>tt.type==="radio",isRegex=tt=>tt instanceof RegExp;const defaultResult$1={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=tt=>{if(Array.isArray(tt)){if(tt.length>1){const et=tt.filter(nt=>nt&&nt.checked&&!nt.disabled).map(nt=>nt.value);return{value:et,isValid:!!et.length}}return tt[0].checked&&!tt[0].disabled?tt[0].attributes&&!isUndefined$1(tt[0].attributes.value)?isUndefined$1(tt[0].value)||tt[0].value===""?validResult:{value:tt[0].value,isValid:!0}:validResult:defaultResult$1}return defaultResult$1};const defaultReturn={isValid:!1,value:null};var getRadioValue=tt=>Array.isArray(tt)?tt.reduce((et,nt)=>nt&&nt.checked&&!nt.disabled?{isValid:!0,value:nt.value}:et,defaultReturn):defaultReturn;function getValidateError(tt,et,nt="validate"){if(isMessage(tt)||Array.isArray(tt)&&tt.every(isMessage)||isBoolean$2(tt)&&!tt)return{type:nt,message:isMessage(tt)?tt:"",ref:et}}var getValueAndMessage=tt=>isObject$f(tt)&&!isRegex(tt)?tt:{value:tt,message:""},validateField=async(tt,et,nt,rt,it)=>{const{ref:ot,refs:at,required:st,maxLength:lt,minLength:ct,min:ut,max:ht,pattern:dt,validate:pt,name:mt,valueAsNumber:gt,mount:yt,disabled:bt}=tt._f,vt=get$5(et,mt);if(!yt||bt)return{};const xt=at?at[0]:ot,kt=Pt=>{rt&&xt.reportValidity&&(xt.setCustomValidity(isBoolean$2(Pt)?"":Pt||""),xt.reportValidity())},St={},Tt=isRadioInput(ot),At=isCheckBoxInput(ot),Et=Tt||At,$t=(gt||isFileInput(ot))&&isUndefined$1(ot.value)&&isUndefined$1(vt)||isHTMLElement$2(ot)&&ot.value===""||vt===""||Array.isArray(vt)&&!vt.length,Dt=appendErrors.bind(null,mt,nt,St),jt=(Pt,Ct,wt,It=INPUT_VALIDATION_RULES.maxLength,Ot=INPUT_VALIDATION_RULES.minLength)=>{const Wt=Pt?Ct:wt;St[mt]={type:Pt?It:Ot,message:Wt,ref:ot,...Dt(Pt?It:Ot,Wt)}};if(it?!Array.isArray(vt)||!vt.length:st&&(!Et&&($t||isNullOrUndefined(vt))||isBoolean$2(vt)&&!vt||At&&!getCheckboxValue(at).isValid||Tt&&!getRadioValue(at).isValid)){const{value:Pt,message:Ct}=isMessage(st)?{value:!!st,message:st}:getValueAndMessage(st);if(Pt&&(St[mt]={type:INPUT_VALIDATION_RULES.required,message:Ct,ref:xt,...Dt(INPUT_VALIDATION_RULES.required,Ct)},!nt))return kt(Ct),St}if(!$t&&(!isNullOrUndefined(ut)||!isNullOrUndefined(ht))){let Pt,Ct;const wt=getValueAndMessage(ht),It=getValueAndMessage(ut);if(!isNullOrUndefined(vt)&&!isNaN(vt)){const Ot=ot.valueAsNumber||vt&&+vt;isNullOrUndefined(wt.value)||(Pt=Ot>wt.value),isNullOrUndefined(It.value)||(Ct=Otnew Date(new Date().toDateString()+" "+Nt),zt=ot.type=="time",Ft=ot.type=="week";isString$3(wt.value)&&vt&&(Pt=zt?Wt(vt)>Wt(wt.value):Ft?vt>wt.value:Ot>new Date(wt.value)),isString$3(It.value)&&vt&&(Ct=zt?Wt(vt)+Pt.value,It=!isNullOrUndefined(Ct.value)&&vt.length<+Ct.value;if((wt||It)&&(jt(wt,Pt.message,Ct.message),!nt))return kt(St[mt].message),St}if(dt&&!$t&&isString$3(vt)){const{value:Pt,message:Ct}=getValueAndMessage(dt);if(isRegex(Pt)&&!vt.match(Pt)&&(St[mt]={type:INPUT_VALIDATION_RULES.pattern,message:Ct,ref:ot,...Dt(INPUT_VALIDATION_RULES.pattern,Ct)},!nt))return kt(Ct),St}if(pt){if(isFunction$6(pt)){const Pt=await pt(vt,et),Ct=getValidateError(Pt,xt);if(Ct&&(St[mt]={...Ct,...Dt(INPUT_VALIDATION_RULES.validate,Ct.message)},!nt))return kt(Ct.message),St}else if(isObject$f(pt)){let Pt={};for(const Ct in pt){if(!isEmptyObject(Pt)&&!nt)break;const wt=getValidateError(await pt[Ct](vt,et),xt,Ct);wt&&(Pt={...wt,...Dt(Ct,wt.message)},kt(wt.message),nt&&(St[mt]=Pt))}if(!isEmptyObject(Pt)&&(St[mt]={ref:xt,...Pt},!nt))return St}}return kt(!0),St};function baseGet$4(tt,et){const nt=et.slice(0,-1).length;let rt=0;for(;rt{for(const ot of tt)ot.next&&ot.next(it)},subscribe:it=>(tt.push(it),{unsubscribe:()=>{tt=tt.filter(ot=>ot!==it)}}),unsubscribe:()=>{tt=[]}}}var isPrimitive=tt=>isNullOrUndefined(tt)||!isObjectType(tt);function deepEqual$2(tt,et){if(isPrimitive(tt)||isPrimitive(et))return tt===et;if(isDateObject(tt)&&isDateObject(et))return tt.getTime()===et.getTime();const nt=Object.keys(tt),rt=Object.keys(et);if(nt.length!==rt.length)return!1;for(const it of nt){const ot=tt[it];if(!rt.includes(it))return!1;if(it!=="ref"){const at=et[it];if(isDateObject(ot)&&isDateObject(at)||isObject$f(ot)&&isObject$f(at)||Array.isArray(ot)&&Array.isArray(at)?!deepEqual$2(ot,at):ot!==at)return!1}}return!0}var isMultipleSelect=tt=>tt.type==="select-multiple",isRadioOrCheckbox=tt=>isRadioInput(tt)||isCheckBoxInput(tt),live=tt=>isHTMLElement$2(tt)&&tt.isConnected,objectHasFunction=tt=>{for(const et in tt)if(isFunction$6(tt[et]))return!0;return!1};function markFieldsDirty(tt,et={}){const nt=Array.isArray(tt);if(isObject$f(tt)||nt)for(const rt in tt)Array.isArray(tt[rt])||isObject$f(tt[rt])&&!objectHasFunction(tt[rt])?(et[rt]=Array.isArray(tt[rt])?[]:{},markFieldsDirty(tt[rt],et[rt])):isNullOrUndefined(tt[rt])||(et[rt]=!0);return et}function getDirtyFieldsFromDefaultValues(tt,et,nt){const rt=Array.isArray(tt);if(isObject$f(tt)||rt)for(const it in tt)Array.isArray(tt[it])||isObject$f(tt[it])&&!objectHasFunction(tt[it])?isUndefined$1(et)||isPrimitive(nt[it])?nt[it]=Array.isArray(tt[it])?markFieldsDirty(tt[it],[]):{...markFieldsDirty(tt[it])}:getDirtyFieldsFromDefaultValues(tt[it],isNullOrUndefined(et)?{}:et[it],nt[it]):nt[it]=!deepEqual$2(tt[it],et[it]);return nt}var getDirtyFields=(tt,et)=>getDirtyFieldsFromDefaultValues(tt,et,markFieldsDirty(et)),getFieldValueAs=(tt,{valueAsNumber:et,valueAsDate:nt,setValueAs:rt})=>isUndefined$1(tt)?tt:et?tt===""?NaN:tt&&+tt:nt&&isString$3(tt)?new Date(tt):rt?rt(tt):tt;function getFieldValue(tt){const et=tt.ref;if(!(tt.refs?tt.refs.every(nt=>nt.disabled):et.disabled))return isFileInput(et)?et.files:isRadioInput(et)?getRadioValue(tt.refs).value:isMultipleSelect(et)?[...et.selectedOptions].map(({value:nt})=>nt):isCheckBoxInput(et)?getCheckboxValue(tt.refs).value:getFieldValueAs(isUndefined$1(et.value)?tt.ref.value:et.value,tt)}var getResolverOptions=(tt,et,nt,rt)=>{const it={};for(const ot of tt){const at=get$5(et,ot);at&&set$3(it,ot,at._f)}return{criteriaMode:nt,names:[...tt],fields:it,shouldUseNativeValidation:rt}},getRuleValue=tt=>isUndefined$1(tt)?tt:isRegex(tt)?tt.source:isObject$f(tt)?isRegex(tt.value)?tt.value.source:tt.value:tt,hasValidation=tt=>tt.mount&&(tt.required||tt.min||tt.max||tt.maxLength||tt.minLength||tt.pattern||tt.validate);function schemaErrorLookup(tt,et,nt){const rt=get$5(tt,nt);if(rt||isKey$4(nt))return{error:rt,name:nt};const it=nt.split(".");for(;it.length;){const ot=it.join("."),at=get$5(et,ot),st=get$5(tt,ot);if(at&&!Array.isArray(at)&&nt!==ot)return{name:nt};if(st&&st.type)return{name:ot,error:st};it.pop()}return{name:nt}}var skipValidation=(tt,et,nt,rt,it)=>it.isOnAll?!1:!nt&&it.isOnTouch?!(et||tt):(nt?rt.isOnBlur:it.isOnBlur)?!tt:(nt?rt.isOnChange:it.isOnChange)?tt:!0,unsetEmptyArray=(tt,et)=>!compact(get$5(tt,et)).length&&unset(tt,et);const defaultOptions={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(tt={},et){let nt={...defaultOptions,...tt},rt={submitCount:0,isDirty:!1,isLoading:isFunction$6(nt.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},it={},ot=isObject$f(nt.defaultValues)||isObject$f(nt.values)?cloneObject(nt.defaultValues||nt.values)||{}:{},at=nt.shouldUnregister?{}:cloneObject(ot),st={action:!1,mount:!1,watch:!1},lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set},ct,ut=0;const ht={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},dt={values:createSubject(),array:createSubject(),state:createSubject()},pt=tt.resetOptions&&tt.resetOptions.keepDirtyValues,mt=getValidationModes(nt.mode),gt=getValidationModes(nt.reValidateMode),yt=nt.criteriaMode===VALIDATION_MODE.all,bt=Tn=>cn=>{clearTimeout(ut),ut=setTimeout(Tn,cn)},vt=async Tn=>{if(ht.isValid||Tn){const cn=nt.resolver?isEmptyObject((await $t()).errors):await jt(it,!0);cn!==rt.isValid&&dt.state.next({isValid:cn})}},xt=Tn=>ht.isValidating&&dt.state.next({isValidating:Tn}),kt=(Tn,cn=[],mn,In,An=!0,wn=!0)=>{if(In&&mn){if(st.action=!0,wn&&Array.isArray(get$5(it,Tn))){const fn=mn(get$5(it,Tn),In.argA,In.argB);An&&set$3(it,Tn,fn)}if(wn&&Array.isArray(get$5(rt.errors,Tn))){const fn=mn(get$5(rt.errors,Tn),In.argA,In.argB);An&&set$3(rt.errors,Tn,fn),unsetEmptyArray(rt.errors,Tn)}if(ht.touchedFields&&wn&&Array.isArray(get$5(rt.touchedFields,Tn))){const fn=mn(get$5(rt.touchedFields,Tn),In.argA,In.argB);An&&set$3(rt.touchedFields,Tn,fn)}ht.dirtyFields&&(rt.dirtyFields=getDirtyFields(ot,at)),dt.state.next({name:Tn,isDirty:Ct(Tn,cn),dirtyFields:rt.dirtyFields,errors:rt.errors,isValid:rt.isValid})}else set$3(at,Tn,cn)},St=(Tn,cn)=>{set$3(rt.errors,Tn,cn),dt.state.next({errors:rt.errors})},Tt=(Tn,cn,mn,In)=>{const An=get$5(it,Tn);if(An){const wn=get$5(at,Tn,isUndefined$1(mn)?get$5(ot,Tn):mn);isUndefined$1(wn)||In&&In.defaultChecked||cn?set$3(at,Tn,cn?wn:getFieldValue(An._f)):Ot(Tn,wn),st.mount&&vt()}},At=(Tn,cn,mn,In,An)=>{let wn=!1,fn=!1;const pn={name:Tn};if(!mn||In){ht.isDirty&&(fn=rt.isDirty,rt.isDirty=pn.isDirty=Ct(),wn=fn!==pn.isDirty);const kn=deepEqual$2(get$5(ot,Tn),cn);fn=get$5(rt.dirtyFields,Tn),kn?unset(rt.dirtyFields,Tn):set$3(rt.dirtyFields,Tn,!0),pn.dirtyFields=rt.dirtyFields,wn=wn||ht.dirtyFields&&fn!==!kn}if(mn){const kn=get$5(rt.touchedFields,Tn);kn||(set$3(rt.touchedFields,Tn,mn),pn.touchedFields=rt.touchedFields,wn=wn||ht.touchedFields&&kn!==mn)}return wn&&An&&dt.state.next(pn),wn?pn:{}},Et=(Tn,cn,mn,In)=>{const An=get$5(rt.errors,Tn),wn=ht.isValid&&isBoolean$2(cn)&&rt.isValid!==cn;if(tt.delayError&&mn?(ct=bt(()=>St(Tn,mn)),ct(tt.delayError)):(clearTimeout(ut),ct=null,mn?set$3(rt.errors,Tn,mn):unset(rt.errors,Tn)),(mn?!deepEqual$2(An,mn):An)||!isEmptyObject(In)||wn){const fn={...In,...wn&&isBoolean$2(cn)?{isValid:cn}:{},errors:rt.errors,name:Tn};rt={...rt,...fn},dt.state.next(fn)}xt(!1)},$t=async Tn=>nt.resolver(at,nt.context,getResolverOptions(Tn||lt.mount,it,nt.criteriaMode,nt.shouldUseNativeValidation)),Dt=async Tn=>{const{errors:cn}=await $t(Tn);if(Tn)for(const mn of Tn){const In=get$5(cn,mn);In?set$3(rt.errors,mn,In):unset(rt.errors,mn)}else rt.errors=cn;return cn},jt=async(Tn,cn,mn={valid:!0})=>{for(const In in Tn){const An=Tn[In];if(An){const{_f:wn,...fn}=An;if(wn){const pn=lt.array.has(wn.name),kn=await validateField(An,at,yt,nt.shouldUseNativeValidation&&!cn,pn);if(kn[wn.name]&&(mn.valid=!1,cn))break;!cn&&(get$5(kn,wn.name)?pn?updateFieldArrayRootError(rt.errors,kn,wn.name):set$3(rt.errors,wn.name,kn[wn.name]):unset(rt.errors,wn.name))}fn&&await jt(fn,cn,mn)}}return mn.valid},Pt=()=>{for(const Tn of lt.unMount){const cn=get$5(it,Tn);cn&&(cn._f.refs?cn._f.refs.every(mn=>!live(mn)):!live(cn._f.ref))&&Kt(Tn)}lt.unMount=new Set},Ct=(Tn,cn)=>(Tn&&cn&&set$3(at,Tn,cn),!deepEqual$2(Ut(),ot)),wt=(Tn,cn,mn)=>generateWatchOutput(Tn,lt,{...st.mount?at:isUndefined$1(cn)?ot:isString$3(Tn)?{[Tn]:cn}:cn},mn,cn),It=Tn=>compact(get$5(st.mount?at:ot,Tn,tt.shouldUnregister?get$5(ot,Tn,[]):[])),Ot=(Tn,cn,mn={})=>{const In=get$5(it,Tn);let An=cn;if(In){const wn=In._f;wn&&(!wn.disabled&&set$3(at,Tn,getFieldValueAs(cn,wn)),An=isHTMLElement$2(wn.ref)&&isNullOrUndefined(cn)?"":cn,isMultipleSelect(wn.ref)?[...wn.ref.options].forEach(fn=>fn.selected=An.includes(fn.value)):wn.refs?isCheckBoxInput(wn.ref)?wn.refs.length>1?wn.refs.forEach(fn=>(!fn.defaultChecked||!fn.disabled)&&(fn.checked=Array.isArray(An)?!!An.find(pn=>pn===fn.value):An===fn.value)):wn.refs[0]&&(wn.refs[0].checked=!!An):wn.refs.forEach(fn=>fn.checked=fn.value===An):isFileInput(wn.ref)?wn.ref.value="":(wn.ref.value=An,wn.ref.type||dt.values.next({name:Tn,values:{...at}})))}(mn.shouldDirty||mn.shouldTouch)&&At(Tn,An,mn.shouldTouch,mn.shouldDirty,!0),mn.shouldValidate&&Nt(Tn)},Wt=(Tn,cn,mn)=>{for(const In in cn){const An=cn[In],wn=`${Tn}.${In}`,fn=get$5(it,wn);(lt.array.has(Tn)||!isPrimitive(An)||fn&&!fn._f)&&!isDateObject(An)?Wt(wn,An,mn):Ot(wn,An,mn)}},zt=(Tn,cn,mn={})=>{const In=get$5(it,Tn),An=lt.array.has(Tn),wn=cloneObject(cn);set$3(at,Tn,wn),An?(dt.array.next({name:Tn,values:{...at}}),(ht.isDirty||ht.dirtyFields)&&mn.shouldDirty&&dt.state.next({name:Tn,dirtyFields:getDirtyFields(ot,at),isDirty:Ct(Tn,wn)})):In&&!In._f&&!isNullOrUndefined(wn)?Wt(Tn,wn,mn):Ot(Tn,wn,mn),isWatched(Tn,lt)&&dt.state.next({...rt}),dt.values.next({name:Tn,values:{...at}}),!st.mount&&et()},Ft=async Tn=>{const cn=Tn.target;let mn=cn.name,In=!0;const An=get$5(it,mn),wn=()=>cn.type?getFieldValue(An._f):getEventValue(Tn);if(An){let fn,pn;const kn=wn(),Dn=Tn.type===EVENTS.BLUR||Tn.type===EVENTS.FOCUS_OUT,un=!hasValidation(An._f)&&!nt.resolver&&!get$5(rt.errors,mn)&&!An._f.deps||skipValidation(Dn,get$5(rt.touchedFields,mn),rt.isSubmitted,gt,mt),Zt=isWatched(mn,lt,Dn);set$3(at,mn,kn),Dn?(An._f.onBlur&&An._f.onBlur(Tn),ct&&ct(0)):An._f.onChange&&An._f.onChange(Tn);const Xt=At(mn,kn,Dn,!1),Sn=!isEmptyObject(Xt)||Zt;if(!Dn&&dt.values.next({name:mn,type:Tn.type,values:{...at}}),un)return ht.isValid&&vt(),Sn&&dt.state.next({name:mn,...Zt?{}:Xt});if(!Dn&&Zt&&dt.state.next({...rt}),xt(!0),nt.resolver){const{errors:Rn}=await $t([mn]),jn=schemaErrorLookup(rt.errors,it,mn),On=schemaErrorLookup(Rn,it,jn.name||mn);fn=On.error,mn=On.name,pn=isEmptyObject(Rn)}else fn=(await validateField(An,at,yt,nt.shouldUseNativeValidation))[mn],In=Number.isNaN(kn)||kn===get$5(at,mn,kn),In&&(fn?pn=!1:ht.isValid&&(pn=await jt(it,!0)));In&&(An._f.deps&&Nt(An._f.deps),Et(mn,pn,fn,Xt))}},Nt=async(Tn,cn={})=>{let mn,In;const An=convertToArrayPayload(Tn);if(xt(!0),nt.resolver){const wn=await Dt(isUndefined$1(Tn)?Tn:An);mn=isEmptyObject(wn),In=Tn?!An.some(fn=>get$5(wn,fn)):mn}else Tn?(In=(await Promise.all(An.map(async wn=>{const fn=get$5(it,wn);return await jt(fn&&fn._f?{[wn]:fn}:fn)}))).every(Boolean),!(!In&&!rt.isValid)&&vt()):In=mn=await jt(it);return dt.state.next({...!isString$3(Tn)||ht.isValid&&mn!==rt.isValid?{}:{name:Tn},...nt.resolver||!Tn?{isValid:mn}:{},errors:rt.errors,isValidating:!1}),cn.shouldFocus&&!In&&focusFieldBy(it,wn=>wn&&get$5(rt.errors,wn),Tn?An:lt.mount),In},Ut=Tn=>{const cn={...ot,...st.mount?at:{}};return isUndefined$1(Tn)?cn:isString$3(Tn)?get$5(cn,Tn):Tn.map(mn=>get$5(cn,mn))},Mt=(Tn,cn)=>({invalid:!!get$5((cn||rt).errors,Tn),isDirty:!!get$5((cn||rt).dirtyFields,Tn),isTouched:!!get$5((cn||rt).touchedFields,Tn),error:get$5((cn||rt).errors,Tn)}),Ht=Tn=>{Tn&&convertToArrayPayload(Tn).forEach(cn=>unset(rt.errors,cn)),dt.state.next({errors:Tn?rt.errors:{}})},en=(Tn,cn,mn)=>{const In=(get$5(it,Tn,{_f:{}})._f||{}).ref;set$3(rt.errors,Tn,{...cn,ref:In}),dt.state.next({name:Tn,errors:rt.errors,isValid:!1}),mn&&mn.shouldFocus&&In&&In.focus&&In.focus()},sn=(Tn,cn)=>isFunction$6(Tn)?dt.values.subscribe({next:mn=>Tn(wt(void 0,cn),mn)}):wt(Tn,cn,!0),Kt=(Tn,cn={})=>{for(const mn of Tn?convertToArrayPayload(Tn):lt.mount)lt.mount.delete(mn),lt.array.delete(mn),cn.keepValue||(unset(it,mn),unset(at,mn)),!cn.keepError&&unset(rt.errors,mn),!cn.keepDirty&&unset(rt.dirtyFields,mn),!cn.keepTouched&&unset(rt.touchedFields,mn),!nt.shouldUnregister&&!cn.keepDefaultValue&&unset(ot,mn);dt.values.next({values:{...at}}),dt.state.next({...rt,...cn.keepDirty?{isDirty:Ct()}:{}}),!cn.keepIsValid&&vt()},rn=({disabled:Tn,name:cn,field:mn,fields:In})=>{if(isBoolean$2(Tn)){const An=Tn?void 0:get$5(at,cn,getFieldValue(mn?mn._f:get$5(In,cn)._f));set$3(at,cn,An),At(cn,An,!1,!1,!0)}},nn=(Tn,cn={})=>{let mn=get$5(it,Tn);const In=isBoolean$2(cn.disabled);return set$3(it,Tn,{...mn||{},_f:{...mn&&mn._f?mn._f:{ref:{name:Tn}},name:Tn,mount:!0,...cn}}),lt.mount.add(Tn),mn?rn({field:mn,disabled:cn.disabled,name:Tn}):Tt(Tn,!0,cn.value),{...In?{disabled:cn.disabled}:{},...nt.progressive?{required:!!cn.required,min:getRuleValue(cn.min),max:getRuleValue(cn.max),minLength:getRuleValue(cn.minLength),maxLength:getRuleValue(cn.maxLength),pattern:getRuleValue(cn.pattern)}:{},name:Tn,onChange:Ft,onBlur:Ft,ref:An=>{if(An){nn(Tn,cn),mn=get$5(it,Tn);const wn=isUndefined$1(An.value)&&An.querySelectorAll&&An.querySelectorAll("input,select,textarea")[0]||An,fn=isRadioOrCheckbox(wn),pn=mn._f.refs||[];if(fn?pn.find(kn=>kn===wn):wn===mn._f.ref)return;set$3(it,Tn,{_f:{...mn._f,...fn?{refs:[...pn.filter(live),wn,...Array.isArray(get$5(ot,Tn))?[{}]:[]],ref:{type:wn.type,name:Tn}}:{ref:wn}}}),Tt(Tn,!1,void 0,wn)}else mn=get$5(it,Tn,{}),mn._f&&(mn._f.mount=!1),(nt.shouldUnregister||cn.shouldUnregister)&&!(isNameInFieldArray(lt.array,Tn)&&st.action)&<.unMount.add(Tn)}}},hn=()=>nt.shouldFocusError&&focusFieldBy(it,Tn=>Tn&&get$5(rt.errors,Tn),lt.mount),vn=(Tn,cn)=>async mn=>{mn&&(mn.preventDefault&&mn.preventDefault(),mn.persist&&mn.persist());let In=cloneObject(at);if(dt.state.next({isSubmitting:!0}),nt.resolver){const{errors:An,values:wn}=await $t();rt.errors=An,In=wn}else await jt(it);unset(rt.errors,"root"),isEmptyObject(rt.errors)?(dt.state.next({errors:{}}),await Tn(In,mn)):(cn&&await cn({...rt.errors},mn),hn(),setTimeout(hn)),dt.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject(rt.errors),submitCount:rt.submitCount+1,errors:rt.errors})},an=(Tn,cn={})=>{get$5(it,Tn)&&(isUndefined$1(cn.defaultValue)?zt(Tn,get$5(ot,Tn)):(zt(Tn,cn.defaultValue),set$3(ot,Tn,cn.defaultValue)),cn.keepTouched||unset(rt.touchedFields,Tn),cn.keepDirty||(unset(rt.dirtyFields,Tn),rt.isDirty=cn.defaultValue?Ct(Tn,get$5(ot,Tn)):Ct()),cn.keepError||(unset(rt.errors,Tn),ht.isValid&&vt()),dt.state.next({...rt}))},Qt=(Tn,cn={})=>{const mn=Tn?cloneObject(Tn):ot,In=cloneObject(mn),An=Tn&&!isEmptyObject(Tn)?In:ot;if(cn.keepDefaultValues||(ot=mn),!cn.keepValues){if(cn.keepDirtyValues||pt)for(const wn of lt.mount)get$5(rt.dirtyFields,wn)?set$3(An,wn,get$5(at,wn)):zt(wn,get$5(An,wn));else{if(isWeb&&isUndefined$1(Tn))for(const wn of lt.mount){const fn=get$5(it,wn);if(fn&&fn._f){const pn=Array.isArray(fn._f.refs)?fn._f.refs[0]:fn._f.ref;if(isHTMLElement$2(pn)){const kn=pn.closest("form");if(kn){kn.reset();break}}}}it={}}at=tt.shouldUnregister?cn.keepDefaultValues?cloneObject(ot):{}:cloneObject(An),dt.array.next({values:{...An}}),dt.values.next({values:{...An}})}lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!st.mount&&et(),st.mount=!ht.isValid||!!cn.keepIsValid,st.watch=!!tt.shouldUnregister,dt.state.next({submitCount:cn.keepSubmitCount?rt.submitCount:0,isDirty:cn.keepDirty?rt.isDirty:!!(cn.keepDefaultValues&&!deepEqual$2(Tn,ot)),isSubmitted:cn.keepIsSubmitted?rt.isSubmitted:!1,dirtyFields:cn.keepDirtyValues?rt.dirtyFields:cn.keepDefaultValues&&Tn?getDirtyFields(ot,Tn):{},touchedFields:cn.keepTouched?rt.touchedFields:{},errors:cn.keepErrors?rt.errors:{},isSubmitSuccessful:cn.keepIsSubmitSuccessful?rt.isSubmitSuccessful:!1,isSubmitting:!1})},_n=(Tn,cn)=>Qt(isFunction$6(Tn)?Tn(at):Tn,cn);return{control:{register:nn,unregister:Kt,getFieldState:Mt,handleSubmit:vn,setError:en,_executeSchema:$t,_getWatch:wt,_getDirty:Ct,_updateValid:vt,_removeUnmounted:Pt,_updateFieldArray:kt,_updateDisabledField:rn,_getFieldArray:It,_reset:Qt,_resetDefaultValues:()=>isFunction$6(nt.defaultValues)&&nt.defaultValues().then(Tn=>{_n(Tn,nt.resetOptions),dt.state.next({isLoading:!1})}),_updateFormState:Tn=>{rt={...rt,...Tn}},_subjects:dt,_proxyFormState:ht,get _fields(){return it},get _formValues(){return at},get _state(){return st},set _state(Tn){st=Tn},get _defaultValues(){return ot},get _names(){return lt},set _names(Tn){lt=Tn},get _formState(){return rt},set _formState(Tn){rt=Tn},get _options(){return nt},set _options(Tn){nt={...nt,...Tn}}},trigger:Nt,register:nn,handleSubmit:vn,watch:sn,setValue:zt,getValues:Ut,reset:_n,resetField:an,clearErrors:Ht,unregister:Kt,setError:en,setFocus:(Tn,cn={})=>{const mn=get$5(it,Tn),In=mn&&mn._f;if(In){const An=In.refs?In.refs[0]:In.ref;An.focus&&(An.focus(),cn.shouldSelect&&An.select())}},getFieldState:Mt}}function useForm(tt={}){const et=React$1.useRef(),nt=React$1.useRef(),[rt,it]=React$1.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$6(tt.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:isFunction$6(tt.defaultValues)?void 0:tt.defaultValues});et.current||(et.current={...createFormControl(tt,()=>it(at=>({...at}))),formState:rt});const ot=et.current.control;return ot._options=tt,useSubscribe({subject:ot._subjects.state,next:at=>{shouldRenderFormState(at,ot._proxyFormState,ot._updateFormState,!0)&&it({...ot._formState})}}),React$1.useEffect(()=>{tt.values&&!deepEqual$2(tt.values,nt.current)?(ot._reset(tt.values,ot._options.resetOptions),nt.current=tt.values):ot._resetDefaultValues()},[tt.values,ot]),React$1.useEffect(()=>{ot._state.mount||(ot._updateValid(),ot._state.mount=!0),ot._state.watch&&(ot._state.watch=!1,ot._subjects.state.next({...ot._formState})),ot._removeUnmounted()}),et.current.formState=getProxyFormState(rt,ot),et.current}const ReactToastify="";var dist$3={exports:{}},lib$4={},postMessage$2={};Object.defineProperty(postMessage$2,"__esModule",{value:!0});postMessage$2.removeEventer=postMessage$2.addEventer=postMessage$2.postMessage=void 0;function postMessage$1(tt){var et=window;if(et.sendToElectron)return et.sendToElectron("sphinx-bridge",tt);et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?et.ReactNativeWebView.postMessage(JSON.stringify(tt)):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.webkit.messageHandlers.sphinx.postMessage(tt):et.Android?et.Android.receiveMessage(JSON.stringify(tt)):et.parent.postMessage(tt,"*")}postMessage$2.postMessage=postMessage$1;function addEventer(tt){var et=window;if(et.sendToElectron){et.EE&&et.EE.once("sphinx-bridge",tt);return}else et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?document.addEventListener("message",function(nt){var rt={};try{rt=JSON.parse(nt.data)}catch{}tt({data:rt})}):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.sphinxMessage=function(nt){var rt={};try{rt=JSON.parse(nt)}catch{}tt({data:rt})}:et.Android?et.sphinxMessage=function(nt){var rt={};try{rt=JSON.parse(nt)}catch{}tt({data:rt})}:et.addEventListener("message",tt)}postMessage$2.addEventer=addEventer;function removeEventer(tt){var et=window;et.sendToElectron||(et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?document.removeEventListener("message",tt):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx||et.Android?et.sphinxMessage=null:et.removeEventListener("message",tt))}postMessage$2.removeEventer=removeEventer;(function(tt){var et=commonjsGlobal&&commonjsGlobal.__assign||function(){return et=Object.assign||function(lt){for(var ct,ut=1,ht=arguments.length;ut0&&pt[pt.length-1])&&(bt[0]===6||bt[0]===2)){ut=0;continue}if(bt[0]===3&&(!pt||bt[1]>pt[0]&&bt[1] ENABLE!"),this.isEnabled)return[2,{budget:this.budget,pubkey:this.pubkey,application:at}];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ut=pt.sent(),ht=ut.budget||ut.budget===0,ht&&ut.pubkey?(this.isEnabled=!0,this.budget=ut.budget,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[3,4];case 4:return[2,null]}})})},lt.prototype.authorize=function(ct,ut,ht){return nt(this,void 0,void 0,function(){var dt,pt,mt,gt;return rt(this,function(yt){switch(yt.label){case 0:ht&&(this.logging=!0),this.logging&&console.log("=> AUTHORIZE!"),yt.label=1;case 1:return yt.trys.push([1,3,,4]),dt=ut||!1,[4,this.postMsg(ot.AUTHORIZE,{challenge:ct,noBudget:dt})];case 2:return pt=yt.sent(),mt=pt.budget||pt.budget===0,(dt||mt)&&pt.pubkey?(this.isEnabled=!0,this.budget=pt.budget||0,this.pubkey=pt.pubkey,[2,pt]):[3,4];case 3:return gt=yt.sent(),this.logging&&console.log(gt),[3,4];case 4:return[2,null]}})})},lt.prototype.topup=function(){return nt(this,void 0,void 0,function(){var ct,ut,ht;return rt(this,function(dt){switch(dt.label){case 0:this.logging&&console.log("=> TOP UP"),dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut&&ct.pubkey?(this.budget=ct.budget,this.pubkey=ct.pubkey,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[3,4];case 4:return[2,null]}})})},lt.prototype.keysend=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt,pt;return rt(this,function(mt){switch(mt.label){case 0:if(this.logging&&console.log("=> KEYSEND"),!this.isEnabled)return[2,null];if(!ct||!ut)return[2,null];if(ct.length!==66)return[2,null];if(ut<1)return[2,null];if(ut>this.budget)return[2,null];mt.label=1;case 1:return mt.trys.push([1,3,,4]),ht={dest:ct,amt:ut},[4,this.postMsg(ot.KEYSEND,ht)];case 2:return dt=mt.sent(),dt&&dt.success&&(this.budget=this.budget-ut,dt.budget=this.budget),[2,dt];case 3:return pt=mt.sent(),this.logging&&console.log(pt),[2,null];case 4:return[2]}})})},lt.prototype.updated=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> UDPATED"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.UPDATED)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,null];case 4:return[2]}})})},lt.prototype.sendPayment=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SEND PAYMENT"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.PAYMENT,{paymentRequest:ct})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.saveLsat=function(ct,ut,ht){return nt(this,void 0,void 0,function(){var dt,pt;return rt(this,function(mt){switch(mt.label){case 0:this.logging&&console.log("=> SAVE LSAT"),mt.label=1;case 1:return mt.trys.push([1,3,,4]),[4,this.postMsg(ot.LSAT,{paymentRequest:ct,macaroon:ut,issuer:ht})];case 2:return dt=mt.sent(),[2,dt];case 3:return pt=mt.sent(),this.logging&&console.log(pt),[2,pt];case 4:return[2]}})})},lt.prototype.getLsat=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> GET LSAT"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.GETLSAT)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,ut];case 4:return[2]}})})},lt.prototype.updateLsat=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> UPDATE LSAT"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.UPDATELSAT,{identifier:ct,status:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,dt];case 4:return[2]}})})},lt.prototype.makeInvoice=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> MAKE INVOICE"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.INVOICE,{amt:ct,memo:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,null];case 4:return[2]}})})},lt.prototype.signMessage=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SIGN MESSAGE"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SIGN,{message:ct})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.verifyMessage=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> VERIFY MESSAGE"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.SIGN,{signature:ct,message:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,null];case 4:return[2]}})})},lt.prototype.reload=function(ct){return nt(this,void 0,void 0,function(){var ut,ht,dt;return rt(this,function(pt){switch(pt.label){case 0:this.logging&&console.log("=> RELOAD"),pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.RELOAD,{password:ct})];case 2:return ut=pt.sent(),ht=ut.budget||ut.budget===0,ht&&ut.pubkey?(this.isEnabled=!0,this.budget=ut.budget,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[3,4];case 4:return[2,null]}})})},lt.prototype.saveGraphData=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SAVEDATA"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SAVEDATA,{data:{type:ct.type,metaData:ct.metaData}})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.getPersonData=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> GETPERSONDATA"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.GETPERSONDATA)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,null];case 4:return[2]}})})},lt.prototype.postMsg=function(ct,ut){var ht=this;return ht.active&&Promise.reject(new Error("User is busy")),ht.active=ct,new Promise(function(dt,pt){it.postMessage(et({application:at,type:ct},ut||{}));function mt(gt){!gt.data||gt.data.application!==at||(gt.data.error?(ht.active=null,pt(gt.data.error)):(ht.active=null,dt(gt.data)),it.removeEventer(mt))}it.addEventer(mt)})},lt}();tt.default=st})(lib$4);var dist$2=dist$3.exports;Object.defineProperty(dist$2,"__esModule",{value:!0});var lib_1=lib$4,sphinx=new lib_1.default;dist$3.exports=sphinx;var distExports$1=dist$3.exports,reactIs$3={exports:{}},reactIs_production_min$2={};/** + */var split=splitString,extend$3=extendShallow,isPlainObject$3=isPlainObject$5,isObject$h=isExtendable,setValue=function(tt,et,nt){if(!isObject$h(tt)||(Array.isArray(et)&&(et=[].concat.apply([],et).join(".")),typeof et!="string"))return tt;for(var rt=split(et,{sep:".",brackets:!0}).filter(isValidKey),it=rt.length,ot=-1,at=tt;++ottt.filter(Boolean).join(".");function getKeyPath(tt){const et=tt.split(".");return[et.pop(),et.join(".")||void 0]}function getValuesForPaths(tt,et){return Object.entries(pick$1(tt,et)).reduce((nt,[,{value:rt,disabled:it,key:ot}])=>(nt[ot]=it?void 0:rt,nt),{})}function useCompareMemoize(tt,et){const nt=reactExports.useRef();return(et?dequal:shallow$2)(tt,nt.current)||(nt.current=tt),nt.current}function useDeepMemo(tt,et){return reactExports.useMemo(tt,useCompareMemoize(et,!0))}function useToggle(tt){const et=reactExports.useRef(null),nt=reactExports.useRef(null),rt=reactExports.useRef(!0);return reactExports.useLayoutEffect(()=>{tt||(et.current.style.height="0px",et.current.style.overflow="hidden")},[]),reactExports.useEffect(()=>{if(rt.current){rt.current=!1;return}let it;const ot=et.current,at=()=>{tt&&(ot.style.removeProperty("height"),ot.style.removeProperty("overflow"),nt.current.scrollIntoView({behavior:"smooth",block:"nearest"}))};ot.addEventListener("transitionend",at,{once:!0});const{height:st}=nt.current.getBoundingClientRect();return ot.style.height=st+"px",tt||(ot.style.overflow="hidden",it=window.setTimeout(()=>ot.style.height="0px",50)),()=>{ot.removeEventListener("transitionend",at),clearTimeout(it)}},[tt]),{wrapperRef:et,contentRef:nt}}const useVisiblePaths=tt=>{const[et,nt]=reactExports.useState(tt.getVisiblePaths());return reactExports.useEffect(()=>{nt(tt.getVisiblePaths());const rt=tt.useStore.subscribe(tt.getVisiblePaths,nt,{equalityFn:shallow$2});return()=>rt()},[tt]),et};function useValuesForPath(tt,et,nt){return tt.useStore(it=>{const ot=_objectSpread2$1(_objectSpread2$1({},nt),it.data);return getValuesForPaths(ot,et)},shallow$2)}function usePopin(tt=3){const et=reactExports.useRef(null),nt=reactExports.useRef(null),[rt,it]=reactExports.useState(!1),ot=reactExports.useCallback(()=>it(!0),[]),at=reactExports.useCallback(()=>it(!1),[]);return reactExports.useLayoutEffect(()=>{if(rt){const{bottom:st,top:lt,left:ct}=et.current.getBoundingClientRect(),{height:ut}=nt.current.getBoundingClientRect(),ht=st+ut>window.innerHeight-40?"up":"down";nt.current.style.position="fixed",nt.current.style.zIndex="10000",nt.current.style.left=ct+"px",ht==="down"?nt.current.style.top=st+tt+"px":nt.current.style.bottom=window.innerHeight-lt+tt+"px"}},[tt,rt]),{popinRef:et,wrapperRef:nt,shown:rt,show:ot,hide:at}}k$8([namesPlugin]);const convertMap={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};v8n.extend({color:()=>tt=>w$5(tt).isValid()});const schema$2=tt=>v8n().color().test(tt);function convert$5(tt,{format:et,hasAlpha:nt,isString:rt}){const it=convertMap[et]+(rt&&et!=="hex"?"String":""),ot=tt[it]();return typeof ot=="object"&&!nt?omit$1(ot,["a"]):ot}const sanitize$2=(tt,et)=>{const nt=w$5(tt);if(!nt.isValid())throw Error("Invalid color");return convert$5(nt,et)},format$1$1=(tt,et)=>convert$5(w$5(tt),_objectSpread2$1(_objectSpread2$1({},et),{},{isString:!0,format:"hex"})),normalize$3=({value:tt})=>{const et=I$2(tt),nt=et==="name"?"hex":et,rt=typeof tt=="object"?"a"in tt:et==="hex"&&tt.length===8||/^(rgba)|(hsla)|(hsva)/.test(tt),it={format:nt,hasAlpha:rt,isString:typeof tt=="string"};return{value:sanitize$2(tt,it),settings:it}};var props$2=Object.freeze({__proto__:null,schema:schema$2,sanitize:sanitize$2,format:format$1$1,normalize:normalize$3});const ColorPreview=styled$5("div",{position:"relative",boxSizing:"border-box",borderRadius:"$sm",overflow:"hidden",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",backgroundColor:"#fff",backgroundImage:`url('data:image/svg+xml;charset=utf-8,')`,$inputStyle:"",$hover:"",zIndex:1,variants:{active:{true:{$inputStyle:"$accent1"}}},"&::before":{content:'""',position:"absolute",top:0,bottom:0,right:0,left:0,backgroundColor:"currentColor",zIndex:1}}),PickerContainer=styled$5("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto",columnGap:"$colGap",alignItems:"center"}),PickerWrapper=styled$5("div",{width:"$colorPickerWidth",height:"$colorPickerHeight",".react-colorful":{width:"100%",height:"100%",boxShadow:"$level2",cursor:"crosshair"},".react-colorful__saturation":{borderRadius:"$sm $sm 0 0"},".react-colorful__alpha, .react-colorful__hue":{height:10},".react-colorful__last-control":{borderRadius:"0 0 $sm $sm"},".react-colorful__pointer":{height:12,width:12}});function convertToRgb(tt,et){return et!=="rgb"?w$5(tt).toRgb():tt}function Color$2({value:tt,displayValue:et,settings:nt,onUpdate:rt}){const{emitOnEditStart:it,emitOnEditEnd:ot}=useInputContext(),{format:at,hasAlpha:st}=nt,{popinRef:lt,wrapperRef:ct,shown:ut,show:ht,hide:dt}=usePopin(),pt=reactExports.useRef(0),[mt,gt]=reactExports.useState(()=>convertToRgb(tt,at)),yt=st?Ce:Ne$1,bt=()=>{gt(convertToRgb(tt,at)),ht(),it()},vt=()=>{dt(),ot(),window.clearTimeout(pt.current)},xt=()=>{pt.current=window.setTimeout(vt,500)};return reactExports.useEffect(()=>()=>window.clearTimeout(pt.current),[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(ColorPreview,{ref:lt,active:ut,onClick:()=>bt(),style:{color:et}}),ut&&React$1.createElement(Portal$2,null,React$1.createElement(Overlay$1,{onPointerUp:vt}),React$1.createElement(PickerWrapper,{ref:ct,onMouseEnter:()=>window.clearTimeout(pt.current),onMouseLeave:kt=>kt.buttons===0&&xt()},React$1.createElement(yt,{color:mt,onChange:rt}))))}function ColorComponent(){const{value:tt,displayValue:et,label:nt,onChange:rt,onUpdate:it,settings:ot}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,nt),React$1.createElement(PickerContainer,null,React$1.createElement(Color$2,{value:tt,displayValue:et,onChange:rt,onUpdate:it,settings:ot}),React$1.createElement(ValueInput,{value:et,onChange:rt,onUpdate:it})))}var color$3=_objectSpread2$1({component:ColorComponent},props$2);function Vector3dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt}))}var vector3d=_objectSpread2$1({component:Vector3dComponent},getVectorPlugin(["x","y","z"]));const JoystickTrigger=styled$5("div",{$flexCenter:"",position:"relative",backgroundColor:"$elevation3",borderRadius:"$sm",cursor:"pointer",height:"$rowHeight",width:"$rowHeight",touchAction:"none",$draggable:"",$hover:"","&:active":{cursor:"none"},"&::after":{content:'""',backgroundColor:"$accent2",height:4,width:4,borderRadius:2}}),JoystickPlayground=styled$5("div",{$flexCenter:"",width:"$joystickWidth",height:"$joystickHeight",borderRadius:"$sm",boxShadow:"$level2",position:"fixed",zIndex:1e4,overflow:"hidden",$draggable:"",transform:"translate(-50%, -50%)",variants:{isOutOfBounds:{true:{backgroundColor:"$elevation1"},false:{backgroundColor:"$elevation3"}}},"> div":{position:"absolute",$flexCenter:"",borderStyle:"solid",borderWidth:1,borderColor:"$highlight1",backgroundColor:"$elevation3",width:"80%",height:"80%","&::after,&::before":{content:'""',position:"absolute",zindex:10,backgroundColor:"$highlight1"},"&::before":{width:"100%",height:1},"&::after":{height:"100%",width:1}},"> span":{position:"relative",zindex:100,width:10,height:10,backgroundColor:"$accent2",borderRadius:"50%"}});function Joystick({value:tt,settings:et,onUpdate:nt}){const rt=reactExports.useRef(),it=reactExports.useRef(0),ot=reactExports.useRef(0),at=reactExports.useRef(1),[st,lt]=reactExports.useState(!1),[ct,ut]=reactExports.useState(!1),[ht,dt]=useTransform(),pt=reactExports.useRef(null),mt=reactExports.useRef(null);reactExports.useLayoutEffect(()=>{if(st){const{top:Pt,left:Ct,width:wt,height:It}=pt.current.getBoundingClientRect();mt.current.style.left=Ct+wt/2+"px",mt.current.style.top=Pt+It/2+"px"}},[st]);const{keys:[gt,yt],joystick:bt}=et,vt=bt==="invertY"?1:-1,{[gt]:{step:xt},[yt]:{step:kt}}=et,St=useTh("sizes","joystickWidth"),Tt=useTh("sizes","joystickHeight"),At=parseFloat(St)*.8/2,Et=parseFloat(Tt)*.8/2,$t=reactExports.useCallback(()=>{rt.current||(ut(!0),it.current&&dt({x:it.current*At}),ot.current&&dt({y:ot.current*-Et}),rt.current=window.setInterval(()=>{nt(Pt=>{const Ct=xt*it.current*at.current,wt=vt*kt*ot.current*at.current;return Array.isArray(Pt)?{[gt]:Pt[0]+Ct,[yt]:Pt[1]+wt}:{[gt]:Pt[gt]+Ct,[yt]:Pt[yt]+wt}})},16))},[At,Et,nt,dt,xt,kt,gt,yt,vt]),Dt=reactExports.useCallback(()=>{window.clearTimeout(rt.current),rt.current=void 0,ut(!1)},[]);reactExports.useEffect(()=>{function Pt(Ct){at.current=multiplyStep(Ct)}return window.addEventListener("keydown",Pt),window.addEventListener("keyup",Pt),()=>{window.clearTimeout(rt.current),window.removeEventListener("keydown",Pt),window.removeEventListener("keyup",Pt)}},[]);const jt=useDrag$1(({first:Pt,active:Ct,delta:[wt,It],movement:[Ot,Wt]})=>{Pt&<(!0);const zt=clamp$8(Ot,-At,At),Ft=clamp$8(Wt,-Et,Et);it.current=Math.abs(Ot)>Math.abs(zt)?Math.sign(Ot-zt):0,ot.current=Math.abs(Wt)>Math.abs(Ft)?Math.sign(Ft-Wt):0;let Nt=tt[gt],Ut=tt[yt];Ct?(it.current||(Nt+=wt*xt*at.current,dt({x:zt})),ot.current||(Ut-=vt*It*kt*at.current,dt({y:Ft})),it.current||ot.current?$t():Dt(),nt({[gt]:Nt,[yt]:Ut})):(lt(!1),it.current=0,ot.current=0,dt({x:0,y:0}),Dt())});return React$1.createElement(JoystickTrigger,_extends$t({ref:pt},jt()),st&&React$1.createElement(Portal$2,null,React$1.createElement(JoystickPlayground,{ref:mt,isOutOfBounds:ct},React$1.createElement("div",null),React$1.createElement("span",{ref:ht}))))}const Container$1=styled$5("div",{display:"grid",columnGap:"$colGap",variants:{withJoystick:{true:{gridTemplateColumns:"$sizes$rowHeight auto"},false:{gridTemplateColumns:"auto"}}}});function Vector2dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Container$1,{withJoystick:!!rt.joystick},rt.joystick&&React$1.createElement(Joystick,{value:et,settings:rt,onUpdate:nt}),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt})))}const _excluded$7$1=["joystick"],plugin=getVectorPlugin(["x","y"]),normalize$2$1=tt=>{let{joystick:et=!0}=tt,nt=_objectWithoutProperties$l(tt,_excluded$7$1);const{value:rt,settings:it}=plugin.normalize(nt);return{value:rt,settings:_objectSpread2$1(_objectSpread2$1({},it),{},{joystick:et})}};var vector2d=_objectSpread2$1(_objectSpread2$1({component:Vector2dComponent},plugin),{},{normalize:normalize$2$1});const sanitize$1=tt=>{if(tt!==void 0){if(tt instanceof File)try{return URL.createObjectURL(tt)}catch{return}if(typeof tt=="string"&&tt.indexOf("blob:")===0)return tt;throw Error("Invalid image format [undefined | blob | File].")}},schema$1=(tt,et)=>typeof et=="object"&&"image"in et,normalize$1$1=({image:tt})=>({value:tt});var props$1=Object.freeze({__proto__:null,sanitize:sanitize$1,schema:schema$1,normalize:normalize$1$1});const ImageContainer=styled$5("div",{position:"relative",display:"grid",gridTemplateColumns:"$sizes$rowHeight auto 20px",columnGap:"$colGap",alignItems:"center"}),DropZone=styled$5("div",{$flexCenter:"",overflow:"hidden",height:"$rowHeight",background:"$elevation3",textAlign:"center",color:"inherit",borderRadius:"$sm",outline:"none",userSelect:"none",cursor:"pointer",$inputStyle:"",$hover:"",$focusWithin:"",$active:"$accent1 $elevation1",variants:{isDragAccept:{true:{$inputStyle:"$accent1",backgroundColor:"$elevation1"}}}}),ImagePreview=styled$5("div",{boxSizing:"border-box",borderRadius:"$sm",height:"$rowHeight",width:"$rowHeight",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center",variants:{hasImage:{true:{cursor:"pointer",$hover:"",$active:""}}}}),ImageLargePreview=styled$5("div",{$flexCenter:"",width:"$imagePreviewWidth",height:"$imagePreviewHeight",borderRadius:"$sm",boxShadow:"$level2",pointerEvents:"none",$inputStyle:"",backgroundSize:"cover",backgroundPosition:"center"}),Instructions=styled$5("div",{fontSize:"0.8em",height:"100%",padding:"$rowGap $md"}),Remove=styled$5("div",{$flexCenter:"",top:"0",right:"0",marginRight:"$sm",height:"100%",cursor:"pointer",variants:{disabled:{true:{color:"$elevation3",cursor:"default"}}},"&::after,&::before":{content:'""',position:"absolute",height:2,width:10,borderRadius:1,backgroundColor:"currentColor"},"&::after":{transform:"rotate(45deg)"},"&::before":{transform:"rotate(-45deg)"}});function ImageComponent(){const{label:tt,value:et,onUpdate:nt,disabled:rt}=useInputContext(),{popinRef:it,wrapperRef:ot,shown:at,show:st,hide:lt}=usePopin(),ct=reactExports.useCallback(mt=>{mt.length&&nt(mt[0])},[nt]),ut=reactExports.useCallback(mt=>{mt.stopPropagation(),nt(void 0)},[nt]),{getRootProps:ht,getInputProps:dt,isDragAccept:pt}=useDropzone({maxFiles:1,accept:"image/*",onDrop:ct,disabled:rt});return React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(ImageContainer,null,React$1.createElement(ImagePreview,{ref:it,hasImage:!!et,onPointerDown:()=>!!et&&st(),onPointerUp:lt,style:{backgroundImage:et?`url(${et})`:"none"}}),at&&!!et&&React$1.createElement(Portal$2,null,React$1.createElement(Overlay$1,{onPointerUp:lt,style:{cursor:"pointer"}}),React$1.createElement(ImageLargePreview,{ref:ot,style:{backgroundImage:`url(${et})`}})),React$1.createElement(DropZone,ht({isDragAccept:pt}),React$1.createElement("input",dt()),React$1.createElement(Instructions,null,pt?"drop image":"click or drop")),React$1.createElement(Remove,{onClick:ut,disabled:!et})))}var image=_objectSpread2$1({component:ImageComponent},props$1);const number$5=v8n().number(),schema=(tt,et)=>v8n().array().length(2).every.number().test(tt)&&v8n().schema({min:number$5,max:number$5}).test(et),format$2=tt=>({min:tt[0],max:tt[1]}),sanitize=(tt,{bounds:[et,nt]},rt)=>{const it=Array.isArray(tt)?format$2(tt):tt,ot={min:rt[0],max:rt[1]},{min:at,max:st}=_objectSpread2$1(_objectSpread2$1({},ot),it);return[clamp$8(Number(at),et,Math.max(et,st)),clamp$8(Number(st),Math.min(nt,at),nt)]},normalize$4=({value:tt,min:et,max:nt})=>{const rt={min:et,max:nt},it=normalizeKeyedNumberSettings(format$2(tt),{min:rt,max:rt}),ot=[et,nt],at=_objectSpread2$1(_objectSpread2$1({},it),{},{bounds:ot});return{value:sanitize(format$2(tt),at,tt),settings:at}};var props$3=Object.freeze({__proto__:null,schema,format:format$2,sanitize,normalize:normalize$4});const _excluded$6$1=["value","bounds","onDrag"],_excluded2$1$1=["bounds"],Container=styled$5("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function IntervalSlider(tt){let{value:et,bounds:[nt,rt],onDrag:it}=tt,ot=_objectWithoutProperties$l(tt,_excluded$6$1);const at=reactExports.useRef(null),st=reactExports.useRef(null),lt=reactExports.useRef(null),ct=reactExports.useRef(0),ut=useTh("sizes","scrubberWidth"),ht=useDrag$1(({event:mt,first:gt,xy:[yt],movement:[bt],memo:vt={}})=>{if(gt){const{width:kt,left:St}=at.current.getBoundingClientRect();ct.current=kt-parseFloat(ut);const Tt=(mt==null?void 0:mt.target)===st.current||(mt==null?void 0:mt.target)===lt.current;vt.pos=invertedRange((yt-St)/kt,nt,rt);const At=Math.abs(vt.pos-et.min)-Math.abs(vt.pos-et.max);vt.key=At<0||At===0&&vt.pos<=et.min?"min":"max",Tt&&(vt.pos=et[vt.key])}const xt=vt.pos+invertedRange(bt/ct.current,0,rt-nt);return it({[vt.key]:sanitizeStep(xt,ot[vt.key])}),vt}),dt=`calc(${range$8(et.min,nt,rt)} * (100% - ${ut} - 8px) + 4px)`,pt=`calc(${1-range$8(et.max,nt,rt)} * (100% - ${ut} - 8px) + 4px)`;return React$1.createElement(RangeWrapper,_extends$t({ref:at},ht()),React$1.createElement(Range,null,React$1.createElement(Indicator,{style:{left:dt,right:pt}})),React$1.createElement(Scrubber,{position:"left",ref:st,style:{left:dt}}),React$1.createElement(Scrubber,{position:"right",ref:lt,style:{right:pt}}))}function IntervalComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:rt}=useInputContext(),it=_objectWithoutProperties$l(rt,_excluded2$1$1);return React$1.createElement(React$1.Fragment,null,React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,null,tt),React$1.createElement(Container,null,React$1.createElement(IntervalSlider,_extends$t({value:et},rt,{onDrag:nt})),React$1.createElement(Vector,{value:et,settings:it,onUpdate:nt,innerLabelTrim:0}))))}var interval$1=_objectSpread2$1({component:IntervalComponent},props$3);const createEventEmitter=()=>{const tt=new Map;return{on:(et,nt)=>{let rt=tt.get(et);rt===void 0&&(rt=new Set,tt.set(et,rt)),rt.add(nt)},off:(et,nt)=>{const rt=tt.get(et);rt!==void 0&&(rt.delete(nt),rt.size===0&&tt.delete(et))},emit:(et,...nt)=>{const rt=tt.get(et);if(rt!==void 0)for(const it of rt)it(...nt)}}},_excluded$5$1=["type","value"],_excluded2$h=["onChange","transient","onEditStart","onEditEnd"],Store=function(){const et=create$4(subscribeWithSelector(()=>({data:{}}))),nt=createEventEmitter();this.storeId=getUid(),this.useStore=et;const rt={},it=new Set;this.getVisiblePaths=()=>{const at=this.getData(),st=Object.keys(at),lt=[];Object.entries(rt).forEach(([ut,ht])=>{ht.render&&st.some(dt=>dt.indexOf(ut)===0)&&!ht.render(this.get)&<.push(ut+".")});const ct=[];return it.forEach(ut=>{ut in at&&at[ut].__refCount>0&<.every(ht=>ut.indexOf(ht)===-1)&&(!at[ut].render||at[ut].render(this.get))&&ct.push(ut)}),ct},this.setOrderedPaths=at=>{at.forEach(st=>it.add(st))},this.orderPaths=at=>(this.setOrderedPaths(at),at),this.disposePaths=at=>{et.setState(st=>{const lt=st.data;return at.forEach(ct=>{if(ct in lt){const ut=lt[ct];ut.__refCount--,ut.__refCount===0&&ut.type in SpecialInputs&&delete lt[ct]}}),{data:lt}})},this.dispose=()=>{et.setState(()=>({data:{}}))},this.getFolderSettings=at=>rt[at]||{},this.getData=()=>et.getState().data,this.addData=(at,st)=>{et.setState(lt=>{const ct=lt.data;return Object.entries(at).forEach(([ut,ht])=>{let dt=ct[ut];if(dt){const{type:pt,value:mt}=ht,gt=_objectWithoutProperties$l(ht,_excluded$5$1);pt!==dt.type?warn$3(LevaErrors.INPUT_TYPE_OVERRIDE,pt):((dt.__refCount===0||st)&&Object.assign(dt,gt),dt.__refCount++)}else ct[ut]=_objectSpread2$1(_objectSpread2$1({},ht),{},{__refCount:1})}),{data:ct}})},this.setValueAtPath=(at,st,lt)=>{et.setState(ct=>{const ut=ct.data;return updateInput(ut[at],st,at,this,lt),{data:ut}})},this.setSettingsAtPath=(at,st)=>{et.setState(lt=>{const ct=lt.data;return ct[at].settings=_objectSpread2$1(_objectSpread2$1({},ct[at].settings),st),{data:ct}})},this.disableInputAtPath=(at,st)=>{et.setState(lt=>{const ct=lt.data;return ct[at].disabled=st,{data:ct}})},this.set=(at,st)=>{et.setState(lt=>{const ct=lt.data;return Object.entries(at).forEach(([ut,ht])=>{try{updateInput(ct[ut],ht,void 0,void 0,st)}catch{}}),{data:ct}})},this.getInput=at=>{try{return this.getData()[at]}catch{warn$3(LevaErrors.PATH_DOESNT_EXIST,at)}},this.get=at=>{var st;return(st=this.getInput(at))===null||st===void 0?void 0:st.value},this.emitOnEditStart=at=>{nt.emit(`onEditStart:${at}`,this.get(at),at,_objectSpread2$1(_objectSpread2$1({},this.getInput(at)),{},{get:this.get}))},this.emitOnEditEnd=at=>{nt.emit(`onEditEnd:${at}`,this.get(at),at,_objectSpread2$1(_objectSpread2$1({},this.getInput(at)),{},{get:this.get}))},this.subscribeToEditStart=(at,st)=>{const lt=`onEditStart:${at}`;return nt.on(lt,st),()=>nt.off(lt,st)},this.subscribeToEditEnd=(at,st)=>{const lt=`onEditEnd:${at}`;return nt.on(lt,st),()=>nt.off(lt,st)};const ot=(at,st,lt)=>{const ct={};return Object.entries(at).forEach(([ut,ht])=>{if(ut==="")return warn$3(LevaErrors.EMPTY_KEY);let dt=join(st,ut);if(ht.type===SpecialInputs.FOLDER){const pt=ot(ht.schema,dt,lt);Object.assign(ct,pt),dt in rt||(rt[dt]=ht.settings)}else if(ut in lt)warn$3(LevaErrors.DUPLICATE_KEYS,ut,dt,lt[ut].path);else{const pt=normalizeInput(ht,ut,dt,ct);if(pt){const{type:mt,options:gt,input:yt}=pt,{onChange:bt,transient:vt,onEditStart:xt,onEditEnd:kt}=gt,St=_objectWithoutProperties$l(gt,_excluded2$h);ct[dt]=_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({type:mt},St),yt),{},{fromPanel:!0}),lt[ut]={path:dt,onChange:bt,transient:vt,onEditStart:xt,onEditEnd:kt}}else warn$3(LevaErrors.UNKNOWN_INPUT,dt,ht)}}),ct};this.getDataFromSchema=at=>{const st={};return[ot(at,"",st),st]}},levaStore=new Store,defaultSettings$2={collapsed:!1};function folder(tt,et){return{type:SpecialInputs.FOLDER,schema:tt,settings:_objectSpread2$1(_objectSpread2$1({},defaultSettings$2),et)}}const isInput=tt=>"__levaInput"in tt,buildTree=(tt,et)=>{const nt={},rt=et?et.toLowerCase():null;return tt.forEach(it=>{const[ot,at]=getKeyPath(it);(!rt||ot.toLowerCase().indexOf(rt)>-1)&&merge$2(nt,at,{[ot]:{__levaInput:!0,path:it}})}),nt},_excluded$4$1=["type","label","path","valueKey","value","settings","setValue","disabled"];function ControlInput(tt){let{type:et,label:nt,path:rt,valueKey:it,value:ot,settings:at,setValue:st,disabled:lt}=tt,ct=_objectWithoutProperties$l(tt,_excluded$4$1);const{displayValue:ut,onChange:ht,onUpdate:dt}=useInputSetters({type:et,value:ot,settings:at,setValue:st}),pt=Plugins[et].component;return pt?React$1.createElement(InputContext.Provider,{value:_objectSpread2$1({key:it,path:rt,id:""+rt,label:nt,displayValue:ut,value:ot,onChange:ht,onUpdate:dt,settings:at,setValue:st,disabled:lt},ct)},React$1.createElement(StyledInputWrapper$1,{disabled:lt},React$1.createElement(pt,null))):(warn$3(LevaErrors.NO_COMPONENT_FOR_TYPE,et,rt),null)}const StyledButton$2=styled$5("button",{display:"block",$reset:"",fontWeight:"$button",height:"$rowHeight",borderStyle:"none",borderRadius:"$sm",backgroundColor:"$elevation1",color:"$highlight1","&:not(:disabled)":{color:"$highlight3",backgroundColor:"$accent2",cursor:"pointer",$hover:"$accent3",$active:"$accent3 $accent1",$focus:""}});function Button$3({onClick:tt,settings:et,label:nt}){const rt=useStoreContext();return React$1.createElement(Row,null,React$1.createElement(StyledButton$2,{disabled:et.disabled,onClick:()=>tt(rt.get)},nt))}const StyledButtonGroup=styled$5("div",{$flex:"",justifyContent:"flex-end",gap:"$colGap"}),StyledButtonGroupButton=styled$5("button",{$reset:"",cursor:"pointer",borderRadius:"$xs","&:hover":{backgroundColor:"$elevation3"}}),getOpts=({label:tt,opts:et})=>{let nt=typeof tt=="string"&&tt.trim()===""?null:tt,rt=et;return typeof et.opts=="object"&&(rt.label!==void 0&&(nt=et.label),rt=et.opts),{label:nt,opts:rt}};function ButtonGroup(tt){const{label:et,opts:nt}=getOpts(tt),rt=useStoreContext();return React$1.createElement(Row,{input:!!et},et&&React$1.createElement(Label$4,null,et),React$1.createElement(StyledButtonGroup,null,Object.entries(nt).map(([it,ot])=>React$1.createElement(StyledButtonGroupButton,{key:it,onClick:()=>ot(rt.get)},it))))}const Canvas$2=styled$5("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),POINTS=100;function push(tt,et){tt.push(et),tt.length>POINTS&&tt.shift()}const MonitorCanvas=reactExports.forwardRef(function({initialValue:tt},et){const nt=useTh("colors","highlight3"),rt=useTh("colors","elevation2"),it=useTh("colors","highlight1"),[ot,at]=reactExports.useMemo(()=>[w$5(it).alpha(.4).toRgbString(),w$5(it).alpha(.1).toRgbString()],[it]),st=reactExports.useRef([tt]),lt=reactExports.useRef(tt),ct=reactExports.useRef(tt),ut=reactExports.useRef(),ht=reactExports.useCallback((mt,gt)=>{if(!mt)return;const{width:yt,height:bt}=mt,vt=new Path2D,xt=yt/POINTS,kt=bt*.05;for(let At=0;At({frame:mt=>{(lt.current===void 0||mtct.current)&&(ct.current=mt),push(st.current,mt),ut.current=requestAnimationFrame(()=>ht(dt.current,pt.current))}}),[dt,pt,ht]),reactExports.useEffect(()=>()=>cancelAnimationFrame(ut.current),[]),React$1.createElement(Canvas$2,{ref:dt})}),parse$2=tt=>Number.isFinite(tt)?tt.toPrecision(2):tt.toString(),MonitorLog=reactExports.forwardRef(function({initialValue:tt},et){const[nt,rt]=reactExports.useState(parse$2(tt));return reactExports.useImperativeHandle(et,()=>({frame:it=>rt(parse$2(it))}),[]),React$1.createElement("div",null,nt)});function getValue$4(tt){return typeof tt=="function"?tt():tt.current}function Monitor({label:tt,objectOrFn:et,settings:nt}){const rt=reactExports.useRef(),it=reactExports.useRef(getValue$4(et));return reactExports.useEffect(()=>{const ot=window.setInterval(()=>{var at;document.hidden||(at=rt.current)===null||at===void 0||at.frame(getValue$4(et))},nt.interval);return()=>window.clearInterval(ot)},[et,nt.interval]),React$1.createElement(Row,{input:!0},React$1.createElement(Label$4,{align:"top"},tt),nt.graph?React$1.createElement(MonitorCanvas,{ref:rt,initialValue:it.current}):React$1.createElement(MonitorLog,{ref:rt,initialValue:it.current}))}const _excluded$3$1=["type","label","key"],specialComponents={[SpecialInputs.BUTTON]:Button$3,[SpecialInputs.BUTTON_GROUP]:ButtonGroup,[SpecialInputs.MONITOR]:Monitor},Control=React$1.memo(({path:tt})=>{const[et,{set:nt,setSettings:rt,disable:it,storeId:ot,emitOnEditStart:at,emitOnEditEnd:st}]=useInput(tt);if(!et)return null;const{type:lt,label:ct,key:ut}=et,ht=_objectWithoutProperties$l(et,_excluded$3$1);if(lt in SpecialInputs){const dt=specialComponents[lt];return React$1.createElement(dt,_extends$t({label:ct,path:tt},ht))}return lt in Plugins?React$1.createElement(ControlInput,_extends$t({key:ot+tt,type:lt,label:ct,storeId:ot,path:tt,valueKey:ut,setValue:nt,setSettings:rt,disable:it,emitOnEditStart:at,emitOnEditEnd:st},ht)):(log$2(LevaErrors.UNSUPPORTED_INPUT,lt,tt),null)});function FolderTitle({toggle:tt,toggled:et,name:nt}){return React$1.createElement(StyledTitle,{onClick:()=>tt()},React$1.createElement(Chevron,{toggled:et}),React$1.createElement("div",null,nt))}const Folder=({name:tt,path:et,tree:nt})=>{const rt=useStoreContext(),it=join(et,tt),{collapsed:ot,color:at}=rt.getFolderSettings(it),[st,lt]=reactExports.useState(!ot),ct=reactExports.useRef(null),ut=useTh("colors","folderWidgetColor"),ht=useTh("colors","folderTextColor");return reactExports.useLayoutEffect(()=>{ct.current.style.setProperty("--leva-colors-folderWidgetColor",at||ut),ct.current.style.setProperty("--leva-colors-folderTextColor",at||ht)},[at,ut,ht]),React$1.createElement(StyledFolder,{ref:ct},React$1.createElement(FolderTitle,{name:tt,toggled:st,toggle:()=>lt(dt=>!dt)}),React$1.createElement(TreeWrapper,{parent:it,tree:nt,toggled:st}))},TreeWrapper=React$1.memo(({isRoot:tt=!1,fill:et=!1,flat:nt=!1,parent:rt,tree:it,toggled:ot})=>{const{wrapperRef:at,contentRef:st}=useToggle(ot),lt=useStoreContext(),ct=([ht,dt])=>{var pt;return(isInput(dt)?(pt=lt.getInput(dt.path))===null||pt===void 0?void 0:pt.order:lt.getFolderSettings(join(rt,ht)).order)||0},ut=Object.entries(it).sort((ht,dt)=>ct(ht)-ct(dt));return React$1.createElement(StyledWrapper,{ref:at,isRoot:tt,fill:et,flat:nt},React$1.createElement(StyledContent,{ref:st,isRoot:tt,toggled:ot},ut.map(([ht,dt])=>isInput(dt)?React$1.createElement(Control,{key:dt.path,valueKey:dt.valueKey,path:dt.path}):React$1.createElement(Folder,{key:ht,name:ht,path:rt,tree:dt}))))}),StyledRoot=styled$5("div",{position:"relative",fontFamily:"$mono",fontSize:"$root",color:"$rootText",backgroundColor:"$elevation1",variants:{fill:{false:{position:"fixed",top:"10px",right:"10px",zIndex:1e3,width:"$rootWidth"},true:{position:"relative",width:"100%"}},flat:{false:{borderRadius:"$lg",boxShadow:"$level1"}},oneLineLabels:{true:{[`${StyledInputRow}`]:{gridTemplateColumns:"auto",gridAutoColumns:"minmax(max-content, 1fr)",gridAutoRows:"minmax($sizes$rowHeight), auto)",rowGap:0,columnGap:0,marginTop:"$rowGap"}}},hideTitleBar:{true:{$$titleBarHeight:"0px"},false:{$$titleBarHeight:"$sizes$titleBarHeight"}}},"&,*,*:after,*:before":{boxSizing:"border-box"},"*::selection":{backgroundColor:"$accent2"}}),iconWidth=40,Icon=styled$5("i",{$flexCenter:"",width:iconWidth,userSelect:"none",cursor:"pointer","> svg":{fill:"$highlight1",transition:"transform 350ms ease, fill 250ms ease"},"&:hover > svg":{fill:"$highlight3"},variants:{active:{true:{"> svg":{fill:"$highlight2"}}}}}),StyledTitleWithFilter=styled$5("div",{display:"flex",alignItems:"stretch",justifyContent:"space-between",height:"$titleBarHeight",variants:{mode:{drag:{cursor:"grab"}}}}),FilterWrapper=styled$5("div",{$flex:"",position:"relative",width:"100%",overflow:"hidden",transition:"height 250ms ease",color:"$highlight3",paddingLeft:"$md",[`> ${Icon}`]:{height:30},variants:{toggled:{true:{height:30},false:{height:0}}}}),StyledFilterInput=styled$5("input",{$reset:"",flex:1,position:"relative",height:30,width:"100%",backgroundColor:"transparent",fontSize:"10px",borderRadius:"$root","&:focus":{},"&::placeholder":{color:"$highlight2"}}),TitleContainer=styled$5("div",{touchAction:"none",$flexCenter:"",flex:1,"> svg":{fill:"$highlight1"},color:"$highlight1",variants:{drag:{true:{$draggable:"","> svg":{transition:"fill 250ms ease"},"&:hover":{color:"$highlight3"},"&:hover > svg":{fill:"$highlight3"}}},filterEnabled:{false:{paddingRight:iconWidth}}}}),FilterInput=React$1.forwardRef(({setFilter:tt,toggle:et},nt)=>{const[rt,it]=reactExports.useState(""),ot=reactExports.useMemo(()=>debounce$6(tt,250),[tt]),at=()=>{tt(""),it("")},st=lt=>{const ct=lt.currentTarget.value;et(!0),it(ct)};return reactExports.useEffect(()=>{ot(rt)},[rt,ot]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledFilterInput,{ref:nt,value:rt,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:lt=>lt.stopPropagation(),onChange:st}),React$1.createElement(Icon,{onClick:()=>at(),style:{visibility:rt?"visible":"hidden"}},React$1.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"14",width:"14",viewBox:"0 0 20 20",fill:"currentColor"},React$1.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}))))});function TitleWithFilter({setFilter:tt,onDrag:et,onDragStart:nt,onDragEnd:rt,toggle:it,toggled:ot,title:at,drag:st,filterEnabled:lt,from:ct}){const[ut,ht]=reactExports.useState(!1),dt=reactExports.useRef(null);reactExports.useEffect(()=>{var mt,gt;ut?(mt=dt.current)===null||mt===void 0||mt.focus():(gt=dt.current)===null||gt===void 0||gt.blur()},[ut]);const pt=useDrag$1(({offset:[mt,gt],first:yt,last:bt})=>{et({x:mt,y:gt}),yt&&nt({x:mt,y:gt}),bt&&rt({x:mt,y:gt})},{filterTaps:!0,from:({offset:[mt,gt]})=>[(ct==null?void 0:ct.x)||mt,(ct==null?void 0:ct.y)||gt]});return reactExports.useEffect(()=>{const mt=gt=>{gt.key==="L"&>.shiftKey&>.metaKey&&ht(yt=>!yt)};return window.addEventListener("keydown",mt),()=>window.removeEventListener("keydown",mt)},[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledTitleWithFilter,{mode:st?"drag":void 0},React$1.createElement(Icon,{active:!ot,onClick:()=>it()},React$1.createElement(Chevron,{toggled:ot,width:12,height:8})),React$1.createElement(TitleContainer,_extends$t({},st?pt():{},{drag:st,filterEnabled:lt}),at===void 0&&st?React$1.createElement("svg",{width:"20",height:"10",viewBox:"0 0 28 14",xmlns:"http://www.w3.org/2000/svg"},React$1.createElement("circle",{cx:"2",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"14",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"26",cy:"2",r:"2"}),React$1.createElement("circle",{cx:"2",cy:"12",r:"2"}),React$1.createElement("circle",{cx:"14",cy:"12",r:"2"}),React$1.createElement("circle",{cx:"26",cy:"12",r:"2"})):at),lt&&React$1.createElement(Icon,{active:ut,onClick:()=>ht(mt=>!mt)},React$1.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"20",viewBox:"0 0 20 20"},React$1.createElement("path",{d:"M9 9a2 2 0 114 0 2 2 0 01-4 0z"}),React$1.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm1-13a4 4 0 00-3.446 6.032l-2.261 2.26a1 1 0 101.414 1.415l2.261-2.261A4 4 0 1011 5z",clipRule:"evenodd"})))),React$1.createElement(FilterWrapper,{toggled:ut},React$1.createElement(FilterInput,{ref:dt,setFilter:tt,toggle:it})))}const _excluded$2$1=["store","hidden","theme","collapsed"];function LevaRoot(tt){let{store:et,hidden:nt=!1,theme:rt,collapsed:it=!1}=tt,ot=_objectWithoutProperties$l(tt,_excluded$2$1);const at=useDeepMemo(()=>mergeTheme(rt),[rt]),[st,lt]=reactExports.useState(!it),ct=typeof it=="object"?!it.collapsed:st,ut=reactExports.useMemo(()=>typeof it=="object"?ht=>{typeof ht=="function"?it.onChange(!ht(!it.collapsed)):it.onChange(!ht)}:lt,[it]);return!et||nt?null:React$1.createElement(ThemeContext$3.Provider,{value:at},React$1.createElement(LevaCore,_extends$t({store:et},ot,{toggled:ct,setToggle:ut,rootClass:at.className})))}const LevaCore=React$1.memo(({store:tt,rootClass:et,fill:nt=!1,flat:rt=!1,neverHide:it=!1,oneLineLabels:ot=!1,titleBar:at={title:void 0,drag:!0,filter:!0,position:void 0,onDrag:void 0,onDragStart:void 0,onDragEnd:void 0},hideCopyButton:st=!1,toggled:lt,setToggle:ct})=>{var ut,ht;const dt=useVisiblePaths(tt),[pt,mt]=reactExports.useState(""),gt=reactExports.useMemo(()=>buildTree(dt,pt),[dt,pt]),[yt,bt]=useTransform(),vt=it||dt.length>0,xt=typeof at=="object"&&at.title||void 0,kt=typeof at=="object"&&(ut=at.drag)!==null&&ut!==void 0?ut:!0,St=typeof at=="object"&&(ht=at.filter)!==null&&ht!==void 0?ht:!0,Tt=typeof at=="object"&&at.position||void 0,At=typeof at=="object"&&at.onDrag||void 0,Et=typeof at=="object"&&at.onDragStart||void 0,$t=typeof at=="object"&&at.onDragEnd||void 0;return React$1.useEffect(()=>{bt({x:Tt==null?void 0:Tt.x,y:Tt==null?void 0:Tt.y})},[Tt,bt]),globalStyles(),React$1.createElement(PanelSettingsContext.Provider,{value:{hideCopyButton:st}},React$1.createElement(StyledRoot,{ref:yt,className:et,fill:nt,flat:rt,oneLineLabels:ot,hideTitleBar:!at,style:{display:vt?"block":"none"}},at&&React$1.createElement(TitleWithFilter,{onDrag:Dt=>{bt(Dt),At==null||At(Dt)},onDragStart:Dt=>Et==null?void 0:Et(Dt),onDragEnd:Dt=>$t==null?void 0:$t(Dt),setFilter:mt,toggle:Dt=>ct(jt=>Dt??!jt),toggled:lt,title:xt,drag:kt,filterEnabled:St,from:Tt}),vt&&React$1.createElement(StoreContext$1.Provider,{value:tt},React$1.createElement(TreeWrapper,{isRoot:!0,fill:nt,flat:rt,tree:gt,toggled:lt}))))}),_excluded$1$3=["isRoot"];let rootInitialized=!1,rootEl=null;function Leva(tt){let{isRoot:et=!1}=tt,nt=_objectWithoutProperties$l(tt,_excluded$1$3);return reactExports.useEffect(()=>(rootInitialized=!0,!et&&rootEl&&(rootEl.remove(),rootEl=null),()=>{et||(rootInitialized=!1)}),[et]),React$1.createElement(LevaRoot,_extends$t({store:levaStore},nt))}function useRenderRoot(tt){reactExports.useEffect(()=>{tt&&!rootInitialized&&(rootEl||(rootEl=document.getElementById("leva__root")||Object.assign(document.createElement("div"),{id:"leva__root"}),document.body&&(document.body.appendChild(rootEl),render(React$1.createElement(Leva,{isRoot:!0}),rootEl))),rootInitialized=!0)},[tt])}function parseArgs(tt,et,nt,rt,it){let ot,at,st,lt,ct;return typeof tt=="string"?(at=tt,ot=et,Array.isArray(nt)?ct=nt:nt&&("store"in nt?(lt=nt,ct=rt):(st=nt,Array.isArray(rt)?ct=rt:(lt=rt,ct=it)))):(ot=tt,Array.isArray(et)?ct=et:(lt=et,ct=nt)),{schema:ot,folderName:at,folderSettings:st,hookSettings:lt,deps:ct||[]}}function useControls(tt,et,nt,rt,it){const{folderName:ot,schema:at,folderSettings:st,hookSettings:lt,deps:ct}=parseArgs(tt,et,nt,rt,it),ut=typeof at=="function",ht=reactExports.useRef(!1),dt=reactExports.useRef(!0),pt=useDeepMemo(()=>{ht.current=!0;const jt=typeof at=="function"?at():at;return ot?{[ot]:folder(jt,st)}:jt},ct),mt=!(lt!=null&<.store);useRenderRoot(mt);const[gt]=reactExports.useState(()=>(lt==null?void 0:lt.store)||levaStore),[yt,bt]=reactExports.useMemo(()=>gt.getDataFromSchema(pt),[gt,pt]),[vt,xt,kt,St,Tt]=reactExports.useMemo(()=>{const jt=[],Pt=[],Ct={},wt={},It={};return Object.values(bt).forEach(({path:Ot,onChange:Wt,onEditStart:zt,onEditEnd:Ft,transient:Nt})=>{jt.push(Ot),Wt?(Ct[Ot]=Wt,Nt||Pt.push(Ot)):Pt.push(Ot),zt&&(wt[Ot]=zt),Ft&&(It[Ot]=Ft)}),[jt,Pt,Ct,wt,It]},[bt]),At=reactExports.useMemo(()=>gt.orderPaths(vt),[vt,gt]),Et=useValuesForPath(gt,xt,yt),$t=reactExports.useCallback(jt=>{const Pt=Object.entries(jt).reduce((Ct,[wt,It])=>Object.assign(Ct,{[bt[wt].path]:It}),{});gt.set(Pt,!1)},[gt,bt]),Dt=reactExports.useCallback(jt=>gt.get(bt[jt].path),[gt,bt]);return reactExports.useEffect(()=>{const jt=!dt.current&&ht.current;return gt.addData(yt,jt),dt.current=!1,ht.current=!1,()=>gt.disposePaths(At)},[gt,At,yt]),reactExports.useEffect(()=>{const jt=[];return Object.entries(kt).forEach(([Pt,Ct])=>{Ct(gt.get(Pt),Pt,_objectSpread2$1({initial:!0,get:gt.get},gt.getInput(Pt)));const wt=gt.useStore.subscribe(It=>{const Ot=It.data[Pt];return[Ot.disabled?void 0:Ot.value,Ot]},([It,Ot])=>Ct(It,Pt,_objectSpread2$1({initial:!1,get:gt.get},Ot)),{equalityFn:shallow$2});jt.push(wt)}),()=>jt.forEach(Pt=>Pt())},[gt,kt]),reactExports.useEffect(()=>{const jt=[];return Object.entries(St).forEach(([Pt,Ct])=>jt.push(gt.subscribeToEditStart(Pt,Ct))),Object.entries(Tt).forEach(([Pt,Ct])=>jt.push(gt.subscribeToEditEnd(Pt,Ct))),()=>jt.forEach(Pt=>Pt())},[St,Tt,gt]),ut?[Et,$t,Dt]:Et}register(LevaInputs.SELECT,select$1);register(LevaInputs.IMAGE,image);register(LevaInputs.NUMBER,number$6);register(LevaInputs.COLOR,color$3);register(LevaInputs.STRING,string$1);register(LevaInputs.BOOLEAN,boolean);register(LevaInputs.INTERVAL,interval$1);register(LevaInputs.VECTOR3D,vector3d);register(LevaInputs.VECTOR2D,vector2d);var isCheckBoxInput=tt=>tt.type==="checkbox",isDateObject=tt=>tt instanceof Date,isNullOrUndefined=tt=>tt==null;const isObjectType=tt=>typeof tt=="object";var isObject$f=tt=>!isNullOrUndefined(tt)&&!Array.isArray(tt)&&isObjectType(tt)&&!isDateObject(tt),getEventValue=tt=>isObject$f(tt)&&tt.target?isCheckBoxInput(tt.target)?tt.target.checked:tt.target.value:tt,getNodeParentName=tt=>tt.substring(0,tt.search(/\.\d+(\.|$)/))||tt,isNameInFieldArray=(tt,et)=>tt.has(getNodeParentName(et)),isPlainObject$2=tt=>{const et=tt.constructor&&tt.constructor.prototype;return isObject$f(et)&&et.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(tt){let et;const nt=Array.isArray(tt);if(tt instanceof Date)et=new Date(tt);else if(tt instanceof Set)et=new Set(tt);else if(!(isWeb&&(tt instanceof Blob||tt instanceof FileList))&&(nt||isObject$f(tt)))if(et=nt?[]:{},!nt&&!isPlainObject$2(tt))et=tt;else for(const rt in tt)tt.hasOwnProperty(rt)&&(et[rt]=cloneObject(tt[rt]));else return tt;return et}var compact=tt=>Array.isArray(tt)?tt.filter(Boolean):[],isUndefined$1=tt=>tt===void 0,get$5=(tt,et,nt)=>{if(!et||!isObject$f(tt))return nt;const rt=compact(et.split(/[,[\].]+?/)).reduce((it,ot)=>isNullOrUndefined(it)?it:it[ot],tt);return isUndefined$1(rt)||rt===tt?isUndefined$1(tt[et])?nt:tt[et]:rt},isBoolean$2=tt=>typeof tt=="boolean";const EVENTS={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},VALIDATION_MODE={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},INPUT_VALIDATION_RULES={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},HookFormContext=React$1.createContext(null),useFormContext=()=>React$1.useContext(HookFormContext),FormProvider=tt=>{const{children:et,...nt}=tt;return React$1.createElement(HookFormContext.Provider,{value:nt},et)};var getProxyFormState=(tt,et,nt,rt=!0)=>{const it={defaultValues:et._defaultValues};for(const ot in tt)Object.defineProperty(it,ot,{get:()=>{const at=ot;return et._proxyFormState[at]!==VALIDATION_MODE.all&&(et._proxyFormState[at]=!rt||VALIDATION_MODE.all),nt&&(nt[at]=!0),tt[at]}});return it},isEmptyObject=tt=>isObject$f(tt)&&!Object.keys(tt).length,shouldRenderFormState=(tt,et,nt,rt)=>{nt(tt);const{name:it,...ot}=tt;return isEmptyObject(ot)||Object.keys(ot).length>=Object.keys(et).length||Object.keys(ot).find(at=>et[at]===(!rt||VALIDATION_MODE.all))},convertToArrayPayload=tt=>Array.isArray(tt)?tt:[tt],shouldSubscribeByName=(tt,et,nt)=>!tt||!et||tt===et||convertToArrayPayload(tt).some(rt=>rt&&(nt?rt===et:rt.startsWith(et)||et.startsWith(rt)));function useSubscribe(tt){const et=React$1.useRef(tt);et.current=tt,React$1.useEffect(()=>{const nt=!tt.disabled&&et.current.subject&&et.current.subject.subscribe({next:et.current.next});return()=>{nt&&nt.unsubscribe()}},[tt.disabled])}function useFormState(tt){const et=useFormContext(),{control:nt=et.control,disabled:rt,name:it,exact:ot}=tt||{},[at,st]=React$1.useState(nt._formState),lt=React$1.useRef(!0),ct=React$1.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),ut=React$1.useRef(it);return ut.current=it,useSubscribe({disabled:rt,next:ht=>lt.current&&shouldSubscribeByName(ut.current,ht.name,ot)&&shouldRenderFormState(ht,ct.current,nt._updateFormState)&&st({...nt._formState,...ht}),subject:nt._subjects.state}),React$1.useEffect(()=>(lt.current=!0,ct.current.isValid&&nt._updateValid(!0),()=>{lt.current=!1}),[nt]),getProxyFormState(at,nt,ct.current,!1)}var isString$3=tt=>typeof tt=="string",generateWatchOutput=(tt,et,nt,rt,it)=>isString$3(tt)?(rt&&et.watch.add(tt),get$5(nt,tt,it)):Array.isArray(tt)?tt.map(ot=>(rt&&et.watch.add(ot),get$5(nt,ot))):(rt&&(et.watchAll=!0),nt);function useWatch(tt){const et=useFormContext(),{control:nt=et.control,name:rt,defaultValue:it,disabled:ot,exact:at}=tt||{},st=React$1.useRef(rt);st.current=rt,useSubscribe({disabled:ot,subject:nt._subjects.values,next:ut=>{shouldSubscribeByName(st.current,ut.name,at)&&ct(cloneObject(generateWatchOutput(st.current,nt._names,ut.values||nt._formValues,!1,it)))}});const[lt,ct]=React$1.useState(nt._getWatch(rt,it));return React$1.useEffect(()=>nt._removeUnmounted()),lt}var isKey$4=tt=>/^\w*$/.test(tt),stringToPath$3=tt=>compact(tt.replace(/["|']|\]/g,"").split(/\.|\[/));function set$3(tt,et,nt){let rt=-1;const it=isKey$4(et)?[et]:stringToPath$3(et),ot=it.length,at=ot-1;for(;++rt{const ut=it._options.shouldUnregister||ot,ht=(dt,pt)=>{const mt=get$5(it._fields,dt);mt&&(mt._f.mount=pt)};if(ht(nt,!0),ut){const dt=cloneObject(get$5(it._options.defaultValues,nt));set$3(it._defaultValues,nt,dt),isUndefined$1(get$5(it._formValues,nt))&&set$3(it._formValues,nt,dt)}return()=>{(at?ut&&!it._state.action:ut)?it.unregister(nt):ht(nt,!1)}},[nt,it,at,ot]),React$1.useEffect(()=>{get$5(it._fields,nt)&&it._updateDisabledField({disabled:rt,fields:it._fields,name:nt})},[rt,nt,it]),{field:{name:nt,value:st,...isBoolean$2(rt)?{disabled:rt}:{},onChange:React$1.useCallback(ut=>ct.current.onChange({target:{value:getEventValue(ut),name:nt},type:EVENTS.CHANGE}),[nt]),onBlur:React$1.useCallback(()=>ct.current.onBlur({target:{value:get$5(it._formValues,nt),name:nt},type:EVENTS.BLUR}),[nt,it]),ref:ut=>{const ht=get$5(it._fields,nt);ht&&ut&&(ht._f.ref={focus:()=>ut.focus(),select:()=>ut.select(),setCustomValidity:dt=>ut.setCustomValidity(dt),reportValidity:()=>ut.reportValidity()})}},formState:lt,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!get$5(lt.errors,nt)},isDirty:{enumerable:!0,get:()=>!!get$5(lt.dirtyFields,nt)},isTouched:{enumerable:!0,get:()=>!!get$5(lt.touchedFields,nt)},error:{enumerable:!0,get:()=>get$5(lt.errors,nt)}})}}const Controller=tt=>tt.render(useController(tt));var appendErrors=(tt,et,nt,rt,it)=>et?{...nt[tt],types:{...nt[tt]&&nt[tt].types?nt[tt].types:{},[rt]:it||!0}}:{};const focusFieldBy=(tt,et,nt)=>{for(const rt of nt||Object.keys(tt)){const it=get$5(tt,rt);if(it){const{_f:ot,...at}=it;if(ot&&et(ot.name)){if(ot.ref.focus){ot.ref.focus();break}else if(ot.refs&&ot.refs[0].focus){ot.refs[0].focus();break}}else isObject$f(at)&&focusFieldBy(at,et)}}};var getValidationModes=tt=>({isOnSubmit:!tt||tt===VALIDATION_MODE.onSubmit,isOnBlur:tt===VALIDATION_MODE.onBlur,isOnChange:tt===VALIDATION_MODE.onChange,isOnAll:tt===VALIDATION_MODE.all,isOnTouch:tt===VALIDATION_MODE.onTouched}),isWatched=(tt,et,nt)=>!nt&&(et.watchAll||et.watch.has(tt)||[...et.watch].some(rt=>tt.startsWith(rt)&&/^\.\w+/.test(tt.slice(rt.length)))),updateFieldArrayRootError=(tt,et,nt)=>{const rt=compact(get$5(tt,nt));return set$3(rt,"root",et[nt]),set$3(tt,nt,rt),tt},isFileInput=tt=>tt.type==="file",isFunction$6=tt=>typeof tt=="function",isHTMLElement$2=tt=>{if(!isWeb)return!1;const et=tt?tt.ownerDocument:0;return tt instanceof(et&&et.defaultView?et.defaultView.HTMLElement:HTMLElement)},isMessage=tt=>isString$3(tt),isRadioInput=tt=>tt.type==="radio",isRegex=tt=>tt instanceof RegExp;const defaultResult$1={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=tt=>{if(Array.isArray(tt)){if(tt.length>1){const et=tt.filter(nt=>nt&&nt.checked&&!nt.disabled).map(nt=>nt.value);return{value:et,isValid:!!et.length}}return tt[0].checked&&!tt[0].disabled?tt[0].attributes&&!isUndefined$1(tt[0].attributes.value)?isUndefined$1(tt[0].value)||tt[0].value===""?validResult:{value:tt[0].value,isValid:!0}:validResult:defaultResult$1}return defaultResult$1};const defaultReturn={isValid:!1,value:null};var getRadioValue=tt=>Array.isArray(tt)?tt.reduce((et,nt)=>nt&&nt.checked&&!nt.disabled?{isValid:!0,value:nt.value}:et,defaultReturn):defaultReturn;function getValidateError(tt,et,nt="validate"){if(isMessage(tt)||Array.isArray(tt)&&tt.every(isMessage)||isBoolean$2(tt)&&!tt)return{type:nt,message:isMessage(tt)?tt:"",ref:et}}var getValueAndMessage=tt=>isObject$f(tt)&&!isRegex(tt)?tt:{value:tt,message:""},validateField=async(tt,et,nt,rt,it)=>{const{ref:ot,refs:at,required:st,maxLength:lt,minLength:ct,min:ut,max:ht,pattern:dt,validate:pt,name:mt,valueAsNumber:gt,mount:yt,disabled:bt}=tt._f,vt=get$5(et,mt);if(!yt||bt)return{};const xt=at?at[0]:ot,kt=Pt=>{rt&&xt.reportValidity&&(xt.setCustomValidity(isBoolean$2(Pt)?"":Pt||""),xt.reportValidity())},St={},Tt=isRadioInput(ot),At=isCheckBoxInput(ot),Et=Tt||At,$t=(gt||isFileInput(ot))&&isUndefined$1(ot.value)&&isUndefined$1(vt)||isHTMLElement$2(ot)&&ot.value===""||vt===""||Array.isArray(vt)&&!vt.length,Dt=appendErrors.bind(null,mt,nt,St),jt=(Pt,Ct,wt,It=INPUT_VALIDATION_RULES.maxLength,Ot=INPUT_VALIDATION_RULES.minLength)=>{const Wt=Pt?Ct:wt;St[mt]={type:Pt?It:Ot,message:Wt,ref:ot,...Dt(Pt?It:Ot,Wt)}};if(it?!Array.isArray(vt)||!vt.length:st&&(!Et&&($t||isNullOrUndefined(vt))||isBoolean$2(vt)&&!vt||At&&!getCheckboxValue(at).isValid||Tt&&!getRadioValue(at).isValid)){const{value:Pt,message:Ct}=isMessage(st)?{value:!!st,message:st}:getValueAndMessage(st);if(Pt&&(St[mt]={type:INPUT_VALIDATION_RULES.required,message:Ct,ref:xt,...Dt(INPUT_VALIDATION_RULES.required,Ct)},!nt))return kt(Ct),St}if(!$t&&(!isNullOrUndefined(ut)||!isNullOrUndefined(ht))){let Pt,Ct;const wt=getValueAndMessage(ht),It=getValueAndMessage(ut);if(!isNullOrUndefined(vt)&&!isNaN(vt)){const Ot=ot.valueAsNumber||vt&&+vt;isNullOrUndefined(wt.value)||(Pt=Ot>wt.value),isNullOrUndefined(It.value)||(Ct=Otnew Date(new Date().toDateString()+" "+Nt),zt=ot.type=="time",Ft=ot.type=="week";isString$3(wt.value)&&vt&&(Pt=zt?Wt(vt)>Wt(wt.value):Ft?vt>wt.value:Ot>new Date(wt.value)),isString$3(It.value)&&vt&&(Ct=zt?Wt(vt)+Pt.value,It=!isNullOrUndefined(Ct.value)&&vt.length<+Ct.value;if((wt||It)&&(jt(wt,Pt.message,Ct.message),!nt))return kt(St[mt].message),St}if(dt&&!$t&&isString$3(vt)){const{value:Pt,message:Ct}=getValueAndMessage(dt);if(isRegex(Pt)&&!vt.match(Pt)&&(St[mt]={type:INPUT_VALIDATION_RULES.pattern,message:Ct,ref:ot,...Dt(INPUT_VALIDATION_RULES.pattern,Ct)},!nt))return kt(Ct),St}if(pt){if(isFunction$6(pt)){const Pt=await pt(vt,et),Ct=getValidateError(Pt,xt);if(Ct&&(St[mt]={...Ct,...Dt(INPUT_VALIDATION_RULES.validate,Ct.message)},!nt))return kt(Ct.message),St}else if(isObject$f(pt)){let Pt={};for(const Ct in pt){if(!isEmptyObject(Pt)&&!nt)break;const wt=getValidateError(await pt[Ct](vt,et),xt,Ct);wt&&(Pt={...wt,...Dt(Ct,wt.message)},kt(wt.message),nt&&(St[mt]=Pt))}if(!isEmptyObject(Pt)&&(St[mt]={ref:xt,...Pt},!nt))return St}}return kt(!0),St};function baseGet$4(tt,et){const nt=et.slice(0,-1).length;let rt=0;for(;rt{for(const ot of tt)ot.next&&ot.next(it)},subscribe:it=>(tt.push(it),{unsubscribe:()=>{tt=tt.filter(ot=>ot!==it)}}),unsubscribe:()=>{tt=[]}}}var isPrimitive=tt=>isNullOrUndefined(tt)||!isObjectType(tt);function deepEqual$2(tt,et){if(isPrimitive(tt)||isPrimitive(et))return tt===et;if(isDateObject(tt)&&isDateObject(et))return tt.getTime()===et.getTime();const nt=Object.keys(tt),rt=Object.keys(et);if(nt.length!==rt.length)return!1;for(const it of nt){const ot=tt[it];if(!rt.includes(it))return!1;if(it!=="ref"){const at=et[it];if(isDateObject(ot)&&isDateObject(at)||isObject$f(ot)&&isObject$f(at)||Array.isArray(ot)&&Array.isArray(at)?!deepEqual$2(ot,at):ot!==at)return!1}}return!0}var isMultipleSelect=tt=>tt.type==="select-multiple",isRadioOrCheckbox=tt=>isRadioInput(tt)||isCheckBoxInput(tt),live=tt=>isHTMLElement$2(tt)&&tt.isConnected,objectHasFunction=tt=>{for(const et in tt)if(isFunction$6(tt[et]))return!0;return!1};function markFieldsDirty(tt,et={}){const nt=Array.isArray(tt);if(isObject$f(tt)||nt)for(const rt in tt)Array.isArray(tt[rt])||isObject$f(tt[rt])&&!objectHasFunction(tt[rt])?(et[rt]=Array.isArray(tt[rt])?[]:{},markFieldsDirty(tt[rt],et[rt])):isNullOrUndefined(tt[rt])||(et[rt]=!0);return et}function getDirtyFieldsFromDefaultValues(tt,et,nt){const rt=Array.isArray(tt);if(isObject$f(tt)||rt)for(const it in tt)Array.isArray(tt[it])||isObject$f(tt[it])&&!objectHasFunction(tt[it])?isUndefined$1(et)||isPrimitive(nt[it])?nt[it]=Array.isArray(tt[it])?markFieldsDirty(tt[it],[]):{...markFieldsDirty(tt[it])}:getDirtyFieldsFromDefaultValues(tt[it],isNullOrUndefined(et)?{}:et[it],nt[it]):nt[it]=!deepEqual$2(tt[it],et[it]);return nt}var getDirtyFields=(tt,et)=>getDirtyFieldsFromDefaultValues(tt,et,markFieldsDirty(et)),getFieldValueAs=(tt,{valueAsNumber:et,valueAsDate:nt,setValueAs:rt})=>isUndefined$1(tt)?tt:et?tt===""?NaN:tt&&+tt:nt&&isString$3(tt)?new Date(tt):rt?rt(tt):tt;function getFieldValue(tt){const et=tt.ref;if(!(tt.refs?tt.refs.every(nt=>nt.disabled):et.disabled))return isFileInput(et)?et.files:isRadioInput(et)?getRadioValue(tt.refs).value:isMultipleSelect(et)?[...et.selectedOptions].map(({value:nt})=>nt):isCheckBoxInput(et)?getCheckboxValue(tt.refs).value:getFieldValueAs(isUndefined$1(et.value)?tt.ref.value:et.value,tt)}var getResolverOptions=(tt,et,nt,rt)=>{const it={};for(const ot of tt){const at=get$5(et,ot);at&&set$3(it,ot,at._f)}return{criteriaMode:nt,names:[...tt],fields:it,shouldUseNativeValidation:rt}},getRuleValue=tt=>isUndefined$1(tt)?tt:isRegex(tt)?tt.source:isObject$f(tt)?isRegex(tt.value)?tt.value.source:tt.value:tt,hasValidation=tt=>tt.mount&&(tt.required||tt.min||tt.max||tt.maxLength||tt.minLength||tt.pattern||tt.validate);function schemaErrorLookup(tt,et,nt){const rt=get$5(tt,nt);if(rt||isKey$4(nt))return{error:rt,name:nt};const it=nt.split(".");for(;it.length;){const ot=it.join("."),at=get$5(et,ot),st=get$5(tt,ot);if(at&&!Array.isArray(at)&&nt!==ot)return{name:nt};if(st&&st.type)return{name:ot,error:st};it.pop()}return{name:nt}}var skipValidation=(tt,et,nt,rt,it)=>it.isOnAll?!1:!nt&&it.isOnTouch?!(et||tt):(nt?rt.isOnBlur:it.isOnBlur)?!tt:(nt?rt.isOnChange:it.isOnChange)?tt:!0,unsetEmptyArray=(tt,et)=>!compact(get$5(tt,et)).length&&unset(tt,et);const defaultOptions={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(tt={},et){let nt={...defaultOptions,...tt},rt={submitCount:0,isDirty:!1,isLoading:isFunction$6(nt.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},it={},ot=isObject$f(nt.defaultValues)||isObject$f(nt.values)?cloneObject(nt.defaultValues||nt.values)||{}:{},at=nt.shouldUnregister?{}:cloneObject(ot),st={action:!1,mount:!1,watch:!1},lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set},ct,ut=0;const ht={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},dt={values:createSubject(),array:createSubject(),state:createSubject()},pt=tt.resetOptions&&tt.resetOptions.keepDirtyValues,mt=getValidationModes(nt.mode),gt=getValidationModes(nt.reValidateMode),yt=nt.criteriaMode===VALIDATION_MODE.all,bt=Tn=>cn=>{clearTimeout(ut),ut=setTimeout(Tn,cn)},vt=async Tn=>{if(ht.isValid||Tn){const cn=nt.resolver?isEmptyObject((await $t()).errors):await jt(it,!0);cn!==rt.isValid&&dt.state.next({isValid:cn})}},xt=Tn=>ht.isValidating&&dt.state.next({isValidating:Tn}),kt=(Tn,cn=[],mn,In,An=!0,wn=!0)=>{if(In&&mn){if(st.action=!0,wn&&Array.isArray(get$5(it,Tn))){const fn=mn(get$5(it,Tn),In.argA,In.argB);An&&set$3(it,Tn,fn)}if(wn&&Array.isArray(get$5(rt.errors,Tn))){const fn=mn(get$5(rt.errors,Tn),In.argA,In.argB);An&&set$3(rt.errors,Tn,fn),unsetEmptyArray(rt.errors,Tn)}if(ht.touchedFields&&wn&&Array.isArray(get$5(rt.touchedFields,Tn))){const fn=mn(get$5(rt.touchedFields,Tn),In.argA,In.argB);An&&set$3(rt.touchedFields,Tn,fn)}ht.dirtyFields&&(rt.dirtyFields=getDirtyFields(ot,at)),dt.state.next({name:Tn,isDirty:Ct(Tn,cn),dirtyFields:rt.dirtyFields,errors:rt.errors,isValid:rt.isValid})}else set$3(at,Tn,cn)},St=(Tn,cn)=>{set$3(rt.errors,Tn,cn),dt.state.next({errors:rt.errors})},Tt=(Tn,cn,mn,In)=>{const An=get$5(it,Tn);if(An){const wn=get$5(at,Tn,isUndefined$1(mn)?get$5(ot,Tn):mn);isUndefined$1(wn)||In&&In.defaultChecked||cn?set$3(at,Tn,cn?wn:getFieldValue(An._f)):Ot(Tn,wn),st.mount&&vt()}},At=(Tn,cn,mn,In,An)=>{let wn=!1,fn=!1;const pn={name:Tn};if(!mn||In){ht.isDirty&&(fn=rt.isDirty,rt.isDirty=pn.isDirty=Ct(),wn=fn!==pn.isDirty);const kn=deepEqual$2(get$5(ot,Tn),cn);fn=get$5(rt.dirtyFields,Tn),kn?unset(rt.dirtyFields,Tn):set$3(rt.dirtyFields,Tn,!0),pn.dirtyFields=rt.dirtyFields,wn=wn||ht.dirtyFields&&fn!==!kn}if(mn){const kn=get$5(rt.touchedFields,Tn);kn||(set$3(rt.touchedFields,Tn,mn),pn.touchedFields=rt.touchedFields,wn=wn||ht.touchedFields&&kn!==mn)}return wn&&An&&dt.state.next(pn),wn?pn:{}},Et=(Tn,cn,mn,In)=>{const An=get$5(rt.errors,Tn),wn=ht.isValid&&isBoolean$2(cn)&&rt.isValid!==cn;if(tt.delayError&&mn?(ct=bt(()=>St(Tn,mn)),ct(tt.delayError)):(clearTimeout(ut),ct=null,mn?set$3(rt.errors,Tn,mn):unset(rt.errors,Tn)),(mn?!deepEqual$2(An,mn):An)||!isEmptyObject(In)||wn){const fn={...In,...wn&&isBoolean$2(cn)?{isValid:cn}:{},errors:rt.errors,name:Tn};rt={...rt,...fn},dt.state.next(fn)}xt(!1)},$t=async Tn=>nt.resolver(at,nt.context,getResolverOptions(Tn||lt.mount,it,nt.criteriaMode,nt.shouldUseNativeValidation)),Dt=async Tn=>{const{errors:cn}=await $t(Tn);if(Tn)for(const mn of Tn){const In=get$5(cn,mn);In?set$3(rt.errors,mn,In):unset(rt.errors,mn)}else rt.errors=cn;return cn},jt=async(Tn,cn,mn={valid:!0})=>{for(const In in Tn){const An=Tn[In];if(An){const{_f:wn,...fn}=An;if(wn){const pn=lt.array.has(wn.name),kn=await validateField(An,at,yt,nt.shouldUseNativeValidation&&!cn,pn);if(kn[wn.name]&&(mn.valid=!1,cn))break;!cn&&(get$5(kn,wn.name)?pn?updateFieldArrayRootError(rt.errors,kn,wn.name):set$3(rt.errors,wn.name,kn[wn.name]):unset(rt.errors,wn.name))}fn&&await jt(fn,cn,mn)}}return mn.valid},Pt=()=>{for(const Tn of lt.unMount){const cn=get$5(it,Tn);cn&&(cn._f.refs?cn._f.refs.every(mn=>!live(mn)):!live(cn._f.ref))&&Kt(Tn)}lt.unMount=new Set},Ct=(Tn,cn)=>(Tn&&cn&&set$3(at,Tn,cn),!deepEqual$2(Ut(),ot)),wt=(Tn,cn,mn)=>generateWatchOutput(Tn,lt,{...st.mount?at:isUndefined$1(cn)?ot:isString$3(Tn)?{[Tn]:cn}:cn},mn,cn),It=Tn=>compact(get$5(st.mount?at:ot,Tn,tt.shouldUnregister?get$5(ot,Tn,[]):[])),Ot=(Tn,cn,mn={})=>{const In=get$5(it,Tn);let An=cn;if(In){const wn=In._f;wn&&(!wn.disabled&&set$3(at,Tn,getFieldValueAs(cn,wn)),An=isHTMLElement$2(wn.ref)&&isNullOrUndefined(cn)?"":cn,isMultipleSelect(wn.ref)?[...wn.ref.options].forEach(fn=>fn.selected=An.includes(fn.value)):wn.refs?isCheckBoxInput(wn.ref)?wn.refs.length>1?wn.refs.forEach(fn=>(!fn.defaultChecked||!fn.disabled)&&(fn.checked=Array.isArray(An)?!!An.find(pn=>pn===fn.value):An===fn.value)):wn.refs[0]&&(wn.refs[0].checked=!!An):wn.refs.forEach(fn=>fn.checked=fn.value===An):isFileInput(wn.ref)?wn.ref.value="":(wn.ref.value=An,wn.ref.type||dt.values.next({name:Tn,values:{...at}})))}(mn.shouldDirty||mn.shouldTouch)&&At(Tn,An,mn.shouldTouch,mn.shouldDirty,!0),mn.shouldValidate&&Nt(Tn)},Wt=(Tn,cn,mn)=>{for(const In in cn){const An=cn[In],wn=`${Tn}.${In}`,fn=get$5(it,wn);(lt.array.has(Tn)||!isPrimitive(An)||fn&&!fn._f)&&!isDateObject(An)?Wt(wn,An,mn):Ot(wn,An,mn)}},zt=(Tn,cn,mn={})=>{const In=get$5(it,Tn),An=lt.array.has(Tn),wn=cloneObject(cn);set$3(at,Tn,wn),An?(dt.array.next({name:Tn,values:{...at}}),(ht.isDirty||ht.dirtyFields)&&mn.shouldDirty&&dt.state.next({name:Tn,dirtyFields:getDirtyFields(ot,at),isDirty:Ct(Tn,wn)})):In&&!In._f&&!isNullOrUndefined(wn)?Wt(Tn,wn,mn):Ot(Tn,wn,mn),isWatched(Tn,lt)&&dt.state.next({...rt}),dt.values.next({name:Tn,values:{...at}}),!st.mount&&et()},Ft=async Tn=>{const cn=Tn.target;let mn=cn.name,In=!0;const An=get$5(it,mn),wn=()=>cn.type?getFieldValue(An._f):getEventValue(Tn);if(An){let fn,pn;const kn=wn(),Dn=Tn.type===EVENTS.BLUR||Tn.type===EVENTS.FOCUS_OUT,un=!hasValidation(An._f)&&!nt.resolver&&!get$5(rt.errors,mn)&&!An._f.deps||skipValidation(Dn,get$5(rt.touchedFields,mn),rt.isSubmitted,gt,mt),Zt=isWatched(mn,lt,Dn);set$3(at,mn,kn),Dn?(An._f.onBlur&&An._f.onBlur(Tn),ct&&ct(0)):An._f.onChange&&An._f.onChange(Tn);const Xt=At(mn,kn,Dn,!1),Sn=!isEmptyObject(Xt)||Zt;if(!Dn&&dt.values.next({name:mn,type:Tn.type,values:{...at}}),un)return ht.isValid&&vt(),Sn&&dt.state.next({name:mn,...Zt?{}:Xt});if(!Dn&&Zt&&dt.state.next({...rt}),xt(!0),nt.resolver){const{errors:Rn}=await $t([mn]),jn=schemaErrorLookup(rt.errors,it,mn),On=schemaErrorLookup(Rn,it,jn.name||mn);fn=On.error,mn=On.name,pn=isEmptyObject(Rn)}else fn=(await validateField(An,at,yt,nt.shouldUseNativeValidation))[mn],In=Number.isNaN(kn)||kn===get$5(at,mn,kn),In&&(fn?pn=!1:ht.isValid&&(pn=await jt(it,!0)));In&&(An._f.deps&&Nt(An._f.deps),Et(mn,pn,fn,Xt))}},Nt=async(Tn,cn={})=>{let mn,In;const An=convertToArrayPayload(Tn);if(xt(!0),nt.resolver){const wn=await Dt(isUndefined$1(Tn)?Tn:An);mn=isEmptyObject(wn),In=Tn?!An.some(fn=>get$5(wn,fn)):mn}else Tn?(In=(await Promise.all(An.map(async wn=>{const fn=get$5(it,wn);return await jt(fn&&fn._f?{[wn]:fn}:fn)}))).every(Boolean),!(!In&&!rt.isValid)&&vt()):In=mn=await jt(it);return dt.state.next({...!isString$3(Tn)||ht.isValid&&mn!==rt.isValid?{}:{name:Tn},...nt.resolver||!Tn?{isValid:mn}:{},errors:rt.errors,isValidating:!1}),cn.shouldFocus&&!In&&focusFieldBy(it,wn=>wn&&get$5(rt.errors,wn),Tn?An:lt.mount),In},Ut=Tn=>{const cn={...ot,...st.mount?at:{}};return isUndefined$1(Tn)?cn:isString$3(Tn)?get$5(cn,Tn):Tn.map(mn=>get$5(cn,mn))},Mt=(Tn,cn)=>({invalid:!!get$5((cn||rt).errors,Tn),isDirty:!!get$5((cn||rt).dirtyFields,Tn),isTouched:!!get$5((cn||rt).touchedFields,Tn),error:get$5((cn||rt).errors,Tn)}),Ht=Tn=>{Tn&&convertToArrayPayload(Tn).forEach(cn=>unset(rt.errors,cn)),dt.state.next({errors:Tn?rt.errors:{}})},en=(Tn,cn,mn)=>{const In=(get$5(it,Tn,{_f:{}})._f||{}).ref;set$3(rt.errors,Tn,{...cn,ref:In}),dt.state.next({name:Tn,errors:rt.errors,isValid:!1}),mn&&mn.shouldFocus&&In&&In.focus&&In.focus()},sn=(Tn,cn)=>isFunction$6(Tn)?dt.values.subscribe({next:mn=>Tn(wt(void 0,cn),mn)}):wt(Tn,cn,!0),Kt=(Tn,cn={})=>{for(const mn of Tn?convertToArrayPayload(Tn):lt.mount)lt.mount.delete(mn),lt.array.delete(mn),cn.keepValue||(unset(it,mn),unset(at,mn)),!cn.keepError&&unset(rt.errors,mn),!cn.keepDirty&&unset(rt.dirtyFields,mn),!cn.keepTouched&&unset(rt.touchedFields,mn),!nt.shouldUnregister&&!cn.keepDefaultValue&&unset(ot,mn);dt.values.next({values:{...at}}),dt.state.next({...rt,...cn.keepDirty?{isDirty:Ct()}:{}}),!cn.keepIsValid&&vt()},rn=({disabled:Tn,name:cn,field:mn,fields:In})=>{if(isBoolean$2(Tn)){const An=Tn?void 0:get$5(at,cn,getFieldValue(mn?mn._f:get$5(In,cn)._f));set$3(at,cn,An),At(cn,An,!1,!1,!0)}},nn=(Tn,cn={})=>{let mn=get$5(it,Tn);const In=isBoolean$2(cn.disabled);return set$3(it,Tn,{...mn||{},_f:{...mn&&mn._f?mn._f:{ref:{name:Tn}},name:Tn,mount:!0,...cn}}),lt.mount.add(Tn),mn?rn({field:mn,disabled:cn.disabled,name:Tn}):Tt(Tn,!0,cn.value),{...In?{disabled:cn.disabled}:{},...nt.progressive?{required:!!cn.required,min:getRuleValue(cn.min),max:getRuleValue(cn.max),minLength:getRuleValue(cn.minLength),maxLength:getRuleValue(cn.maxLength),pattern:getRuleValue(cn.pattern)}:{},name:Tn,onChange:Ft,onBlur:Ft,ref:An=>{if(An){nn(Tn,cn),mn=get$5(it,Tn);const wn=isUndefined$1(An.value)&&An.querySelectorAll&&An.querySelectorAll("input,select,textarea")[0]||An,fn=isRadioOrCheckbox(wn),pn=mn._f.refs||[];if(fn?pn.find(kn=>kn===wn):wn===mn._f.ref)return;set$3(it,Tn,{_f:{...mn._f,...fn?{refs:[...pn.filter(live),wn,...Array.isArray(get$5(ot,Tn))?[{}]:[]],ref:{type:wn.type,name:Tn}}:{ref:wn}}}),Tt(Tn,!1,void 0,wn)}else mn=get$5(it,Tn,{}),mn._f&&(mn._f.mount=!1),(nt.shouldUnregister||cn.shouldUnregister)&&!(isNameInFieldArray(lt.array,Tn)&&st.action)&<.unMount.add(Tn)}}},hn=()=>nt.shouldFocusError&&focusFieldBy(it,Tn=>Tn&&get$5(rt.errors,Tn),lt.mount),vn=(Tn,cn)=>async mn=>{mn&&(mn.preventDefault&&mn.preventDefault(),mn.persist&&mn.persist());let In=cloneObject(at);if(dt.state.next({isSubmitting:!0}),nt.resolver){const{errors:An,values:wn}=await $t();rt.errors=An,In=wn}else await jt(it);unset(rt.errors,"root"),isEmptyObject(rt.errors)?(dt.state.next({errors:{}}),await Tn(In,mn)):(cn&&await cn({...rt.errors},mn),hn(),setTimeout(hn)),dt.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject(rt.errors),submitCount:rt.submitCount+1,errors:rt.errors})},an=(Tn,cn={})=>{get$5(it,Tn)&&(isUndefined$1(cn.defaultValue)?zt(Tn,get$5(ot,Tn)):(zt(Tn,cn.defaultValue),set$3(ot,Tn,cn.defaultValue)),cn.keepTouched||unset(rt.touchedFields,Tn),cn.keepDirty||(unset(rt.dirtyFields,Tn),rt.isDirty=cn.defaultValue?Ct(Tn,get$5(ot,Tn)):Ct()),cn.keepError||(unset(rt.errors,Tn),ht.isValid&&vt()),dt.state.next({...rt}))},Qt=(Tn,cn={})=>{const mn=Tn?cloneObject(Tn):ot,In=cloneObject(mn),An=Tn&&!isEmptyObject(Tn)?In:ot;if(cn.keepDefaultValues||(ot=mn),!cn.keepValues){if(cn.keepDirtyValues||pt)for(const wn of lt.mount)get$5(rt.dirtyFields,wn)?set$3(An,wn,get$5(at,wn)):zt(wn,get$5(An,wn));else{if(isWeb&&isUndefined$1(Tn))for(const wn of lt.mount){const fn=get$5(it,wn);if(fn&&fn._f){const pn=Array.isArray(fn._f.refs)?fn._f.refs[0]:fn._f.ref;if(isHTMLElement$2(pn)){const kn=pn.closest("form");if(kn){kn.reset();break}}}}it={}}at=tt.shouldUnregister?cn.keepDefaultValues?cloneObject(ot):{}:cloneObject(An),dt.array.next({values:{...An}}),dt.values.next({values:{...An}})}lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!st.mount&&et(),st.mount=!ht.isValid||!!cn.keepIsValid,st.watch=!!tt.shouldUnregister,dt.state.next({submitCount:cn.keepSubmitCount?rt.submitCount:0,isDirty:cn.keepDirty?rt.isDirty:!!(cn.keepDefaultValues&&!deepEqual$2(Tn,ot)),isSubmitted:cn.keepIsSubmitted?rt.isSubmitted:!1,dirtyFields:cn.keepDirtyValues?rt.dirtyFields:cn.keepDefaultValues&&Tn?getDirtyFields(ot,Tn):{},touchedFields:cn.keepTouched?rt.touchedFields:{},errors:cn.keepErrors?rt.errors:{},isSubmitSuccessful:cn.keepIsSubmitSuccessful?rt.isSubmitSuccessful:!1,isSubmitting:!1})},_n=(Tn,cn)=>Qt(isFunction$6(Tn)?Tn(at):Tn,cn);return{control:{register:nn,unregister:Kt,getFieldState:Mt,handleSubmit:vn,setError:en,_executeSchema:$t,_getWatch:wt,_getDirty:Ct,_updateValid:vt,_removeUnmounted:Pt,_updateFieldArray:kt,_updateDisabledField:rn,_getFieldArray:It,_reset:Qt,_resetDefaultValues:()=>isFunction$6(nt.defaultValues)&&nt.defaultValues().then(Tn=>{_n(Tn,nt.resetOptions),dt.state.next({isLoading:!1})}),_updateFormState:Tn=>{rt={...rt,...Tn}},_subjects:dt,_proxyFormState:ht,get _fields(){return it},get _formValues(){return at},get _state(){return st},set _state(Tn){st=Tn},get _defaultValues(){return ot},get _names(){return lt},set _names(Tn){lt=Tn},get _formState(){return rt},set _formState(Tn){rt=Tn},get _options(){return nt},set _options(Tn){nt={...nt,...Tn}}},trigger:Nt,register:nn,handleSubmit:vn,watch:sn,setValue:zt,getValues:Ut,reset:_n,resetField:an,clearErrors:Ht,unregister:Kt,setError:en,setFocus:(Tn,cn={})=>{const mn=get$5(it,Tn),In=mn&&mn._f;if(In){const An=In.refs?In.refs[0]:In.ref;An.focus&&(An.focus(),cn.shouldSelect&&An.select())}},getFieldState:Mt}}function useForm(tt={}){const et=React$1.useRef(),nt=React$1.useRef(),[rt,it]=React$1.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$6(tt.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:isFunction$6(tt.defaultValues)?void 0:tt.defaultValues});et.current||(et.current={...createFormControl(tt,()=>it(at=>({...at}))),formState:rt});const ot=et.current.control;return ot._options=tt,useSubscribe({subject:ot._subjects.state,next:at=>{shouldRenderFormState(at,ot._proxyFormState,ot._updateFormState,!0)&&it({...ot._formState})}}),React$1.useEffect(()=>{tt.values&&!deepEqual$2(tt.values,nt.current)?(ot._reset(tt.values,ot._options.resetOptions),nt.current=tt.values):ot._resetDefaultValues()},[tt.values,ot]),React$1.useEffect(()=>{ot._state.mount||(ot._updateValid(),ot._state.mount=!0),ot._state.watch&&(ot._state.watch=!1,ot._subjects.state.next({...ot._formState})),ot._removeUnmounted()}),et.current.formState=getProxyFormState(rt,ot),et.current}const ReactToastify="";var dist$3={exports:{}},lib$4={},postMessage$2={};Object.defineProperty(postMessage$2,"__esModule",{value:!0});postMessage$2.removeEventer=postMessage$2.addEventer=postMessage$2.postMessage=void 0;function postMessage$1(tt){var et=window;if(et.sendToElectron)return et.sendToElectron("sphinx-bridge",tt);et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?et.ReactNativeWebView.postMessage(JSON.stringify(tt)):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.webkit.messageHandlers.sphinx.postMessage(tt):et.Android?et.Android.receiveMessage(JSON.stringify(tt)):et.parent.postMessage(tt,"*")}postMessage$2.postMessage=postMessage$1;function addEventer(tt){var et=window;if(et.sendToElectron){et.EE&&et.EE.once("sphinx-bridge",tt);return}else et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?document.addEventListener("message",function(nt){var rt={};try{rt=JSON.parse(nt.data)}catch{}tt({data:rt})}):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.sphinxMessage=function(nt){var rt={};try{rt=JSON.parse(nt)}catch{}tt({data:rt})}:et.Android?et.sphinxMessage=function(nt){var rt={};try{rt=JSON.parse(nt)}catch{}tt({data:rt})}:et.addEventListener("message",tt)}postMessage$2.addEventer=addEventer;function removeEventer(tt){var et=window;et.sendToElectron||(et.ReactNativeWebView&&et.ReactNativeWebView.postMessage?document.removeEventListener("message",tt):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx||et.Android?et.sphinxMessage=null:et.removeEventListener("message",tt))}postMessage$2.removeEventer=removeEventer;(function(tt){var et=commonjsGlobal&&commonjsGlobal.__assign||function(){return et=Object.assign||function(lt){for(var ct,ut=1,ht=arguments.length;ut0&&pt[pt.length-1])&&(bt[0]===6||bt[0]===2)){ut=0;continue}if(bt[0]===3&&(!pt||bt[1]>pt[0]&&bt[1] ENABLE!"),this.isEnabled)return[2,{budget:this.budget,pubkey:this.pubkey,application:at}];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ut=pt.sent(),ht=ut.budget||ut.budget===0,ht&&ut.pubkey?(this.isEnabled=!0,this.budget=ut.budget,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[3,4];case 4:return[2,null]}})})},lt.prototype.authorize=function(ct,ut,ht){return nt(this,void 0,void 0,function(){var dt,pt,mt,gt;return rt(this,function(yt){switch(yt.label){case 0:ht&&(this.logging=!0),this.logging&&console.log("=> AUTHORIZE!"),yt.label=1;case 1:return yt.trys.push([1,3,,4]),dt=ut||!1,[4,this.postMsg(ot.AUTHORIZE,{challenge:ct,noBudget:dt})];case 2:return pt=yt.sent(),mt=pt.budget||pt.budget===0,(dt||mt)&&pt.pubkey?(this.isEnabled=!0,this.budget=pt.budget||0,this.pubkey=pt.pubkey,[2,pt]):[3,4];case 3:return gt=yt.sent(),this.logging&&console.log(gt),[3,4];case 4:return[2,null]}})})},lt.prototype.topup=function(){return nt(this,void 0,void 0,function(){var ct,ut,ht;return rt(this,function(dt){switch(dt.label){case 0:this.logging&&console.log("=> TOP UP"),dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut&&ct.pubkey?(this.budget=ct.budget,this.pubkey=ct.pubkey,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[3,4];case 4:return[2,null]}})})},lt.prototype.keysend=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt,pt;return rt(this,function(mt){switch(mt.label){case 0:if(this.logging&&console.log("=> KEYSEND"),!this.isEnabled)return[2,null];if(!ct||!ut)return[2,null];if(ct.length!==66)return[2,null];if(ut<1)return[2,null];if(ut>this.budget)return[2,null];mt.label=1;case 1:return mt.trys.push([1,3,,4]),ht={dest:ct,amt:ut},[4,this.postMsg(ot.KEYSEND,ht)];case 2:return dt=mt.sent(),dt&&dt.success&&(this.budget=this.budget-ut,dt.budget=this.budget),[2,dt];case 3:return pt=mt.sent(),this.logging&&console.log(pt),[2,null];case 4:return[2]}})})},lt.prototype.updated=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> UDPATED"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.UPDATED)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,null];case 4:return[2]}})})},lt.prototype.sendPayment=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SEND PAYMENT"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.PAYMENT,{paymentRequest:ct})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.saveLsat=function(ct,ut,ht){return nt(this,void 0,void 0,function(){var dt,pt;return rt(this,function(mt){switch(mt.label){case 0:this.logging&&console.log("=> SAVE LSAT"),mt.label=1;case 1:return mt.trys.push([1,3,,4]),[4,this.postMsg(ot.LSAT,{paymentRequest:ct,macaroon:ut,issuer:ht})];case 2:return dt=mt.sent(),[2,dt];case 3:return pt=mt.sent(),this.logging&&console.log(pt),[2,pt];case 4:return[2]}})})},lt.prototype.getLsat=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> GET LSAT"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.GETLSAT,{issuer:ct})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,ht];case 4:return[2]}})})},lt.prototype.updateLsat=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> UPDATE LSAT"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.UPDATELSAT,{identifier:ct,status:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,dt];case 4:return[2]}})})},lt.prototype.makeInvoice=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> MAKE INVOICE"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.INVOICE,{amt:ct,memo:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,null];case 4:return[2]}})})},lt.prototype.signMessage=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SIGN MESSAGE"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SIGN,{message:ct})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.verifyMessage=function(ct,ut){return nt(this,void 0,void 0,function(){var ht,dt;return rt(this,function(pt){switch(pt.label){case 0:if(this.logging&&console.log("=> VERIFY MESSAGE"),!this.isEnabled)return[2,null];pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.SIGN,{signature:ct,message:ut})];case 2:return ht=pt.sent(),[2,ht];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[2,null];case 4:return[2]}})})},lt.prototype.reload=function(ct){return nt(this,void 0,void 0,function(){var ut,ht,dt;return rt(this,function(pt){switch(pt.label){case 0:this.logging&&console.log("=> RELOAD"),pt.label=1;case 1:return pt.trys.push([1,3,,4]),[4,this.postMsg(ot.RELOAD,{password:ct})];case 2:return ut=pt.sent(),ht=ut.budget||ut.budget===0,ht&&ut.pubkey?(this.isEnabled=!0,this.budget=ut.budget,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return dt=pt.sent(),this.logging&&console.log(dt),[3,4];case 4:return[2,null]}})})},lt.prototype.saveGraphData=function(ct){return nt(this,void 0,void 0,function(){var ut,ht;return rt(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SAVEDATA"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SAVEDATA,{data:{type:ct.type,metaData:ct.metaData}})];case 2:return ut=dt.sent(),[2,ut];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.getPersonData=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> GETPERSONDATA"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.GETPERSONDATA)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,null];case 4:return[2]}})})},lt.prototype.getBudget=function(){return nt(this,void 0,void 0,function(){var ct,ut;return rt(this,function(ht){switch(ht.label){case 0:if(this.logging&&console.log("=> GETBUDGET"),!this.isEnabled)return[2,null];ht.label=1;case 1:return ht.trys.push([1,3,,4]),[4,this.postMsg(ot.GETBUDGET)];case 2:return ct=ht.sent(),[2,ct];case 3:return ut=ht.sent(),this.logging&&console.log(ut),[2,null];case 4:return[2]}})})},lt.prototype.postMsg=function(ct,ut){var ht=this;return ht.active&&Promise.reject(new Error("User is busy")),ht.active=ct,new Promise(function(dt,pt){it.postMessage(et({application:at,type:ct},ut||{}));function mt(gt){!gt.data||gt.data.application!==at||(gt.data.error?(ht.active=null,pt(gt.data.error)):(ht.active=null,dt(gt.data)),it.removeEventer(mt))}it.addEventer(mt)})},lt}();tt.default=st})(lib$4);var dist$2=dist$3.exports;Object.defineProperty(dist$2,"__esModule",{value:!0});var lib_1=lib$4,sphinx=new lib_1.default;dist$3.exports=sphinx;var distExports$1=dist$3.exports,reactIs$3={exports:{}},reactIs_production_min$2={};/** * @license React * react-is.production.min.js * @@ -546,9 +546,9 @@ PROCEED WITH CAUTION! color: ${colors.GRAY6}; cursor: pointer; z-index: 1; -`,BaseModal=({background:tt="modalBg",children:et,id:nt,hideBg:rt,kind:it,preventOutsideClose:ot,noWrap:at=!1,onClose:st})=>{const{visible:lt,close:ct}=useModal(nt);return lt?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Bg,{align:"center",hideBg:rt,justify:"center",onClick:ut=>{ot||(ut.stopPropagation(),ct())},children:jsxRuntimeExports.jsxs(ModalContainer,{background:tt,borderRadius:9,id:nt,kind:it,onClick:ut=>{ut.stopPropagation()},px:at?0:20,py:at?0:20,children:[st&&jsxRuntimeExports.jsx(CloseButton$7,{onClick:st,children:jsxRuntimeExports.jsx(ClearIcon$1,{})}),et]})})}):null},{origin:origin$1,host}=window.location,isDevelopment=origin$1==="http://localhost:3000"||origin$1==="http://localhost:3001"||origin$1==="https://sphinx-jarvis-david.sphinx1.repl.co",getUrlFormEnv=()=>({}).VITE_APP_API_URL,API_URL=getUrlFormEnv()||apiUrlFromSwarmHost()||"https://knowledge-graph.sphinx.chat";console.log("🚀 ~ file: index.ts:12 ~ API_URL:",API_URL);console.log("🚀 ~ file: index.ts:12 ~ getUrlFormEnv:",getUrlFormEnv());const isChileGraph=API_URL.includes("boltwall");function apiUrlFromSwarmHost(){if(host.includes("swarm")&&host.startsWith("nav")){const tt=host.split(".");tt[0]="boltwall";const nt=`https://${tt.join(".")}`;return console.log("API URL:",nt),nt}}const AWS_IMAGE_BUCKET_URL="https://stakwork-uploads.s3.amazonaws.com/",CLOUDFRONT_IMAGE_BUCKET_URL="https://d1gd7b7slyku8k.cloudfront.net/",GRAPH_FOG_COLOR="blue",GRAPH_GROUND_COLOR=13421772,GRAPH_LIGHT_INTENSITY=.8,BOOST_SUCCESS="Boosted successfully",BOOST_ERROR_BUDGET="Boost failed, insufficient budget",NODE_ADD_SUCCESS="Submitted!",NODE_ADD_ERROR="Submission failed, please try again.",NODE_RELATIVE_HIGHLIGHT_COLORS={children:{nodeColor:"green",segmentColor:4063109},guests:{nodeColor:"purple",segmentColor:14504191},topics:{nodeColor:"purple",segmentColor:5273842},pathway:{nodeColor:"#ffffff",segmentColor:16777215}},LINK="link",TWITTER_HANDLE="twitter_handle",GITHUB_REPOSITORY="github_repository",YOUTUBE_CHANNEL="youtube_channel",WEB_PAGE="web_page",RSS="rss",TWITTER_SOURCE="tweet",TOPIC="topic",DOCUMENT="document",isE2E=!!{}.VITE_APP_IS_E2E,request=async(tt,et)=>{const nt=await fetch(tt,et);if(!nt.ok)throw nt;return nt.json()},api={delete:(tt,et)=>request(`${API_URL}${tt}`,{headers:{...et,"Content-Type":"application/json"},method:"DELETE"}),get:(tt,et)=>request(`${API_URL}${tt}`,et?{headers:et}:void 0),post:(tt,et,nt)=>request(`${API_URL}${tt}`,{body:et,headers:{...nt,"Content-Type":"application/json"},method:"POST"}),put:(tt,et,nt)=>request(`${API_URL}${tt}`,{body:et,headers:{...nt,"Content-Type":"application/json"},method:"PUT"})},defaultParams={skip:"0",limit:"500"},getRadarData=async(tt=defaultParams)=>await api.get(`/radar?${new URLSearchParams({...defaultParams,...tt}).toString()}`),getTopicsData=async(tt=defaultParams)=>await api.get(`/topics?${new URLSearchParams({...defaultParams,...tt}).toString()}`),getAboutData=async()=>await api.get("/about"),postAboutData=async tt=>await api.post("/about",JSON.stringify(tt)),triggerRadarJob=async()=>api.get("/radar/trigger-job"),putRadarData=async(tt,et)=>await api.put(`/radar/${tt}`,JSON.stringify(et)),putNodeData=async tt=>await api.put("/node",JSON.stringify(tt)),approveRadarData=async(tt,et)=>await api.put(`/radar/${tt}/approve`,JSON.stringify({approve:"True",pubkey:et})),deleteRadarData=async tt=>await api.delete(`/radar/${tt}`),getLSat=async()=>{try{const tt=localStorage.getItem("lsat");if(tt){const nt=JSON.parse(tt);return lsatToken(nt.macaroon,nt.preimage)}if(await distExports$1.enable()){const nt=await distExports$1.getLsat();return nt.macaroon?(localStorage.setItem("lsat",JSON.stringify({macaroon:nt.macaroon,identifier:nt.identifier,preimage:nt.preimage})),lsatToken(nt.macaroon,nt.preimage)):""}return""}catch(tt){return console.warn(tt),""}};function lsatToken(tt,et){return`LSAT ${tt}:${et}`}var lib$2={},client={},errors={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var tt=function(et,nt){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(rt,it){rt.__proto__=it}||function(rt,it){for(var ot in it)Object.prototype.hasOwnProperty.call(it,ot)&&(rt[ot]=it[ot])},tt(et,nt)};return function(et,nt){if(typeof nt!="function"&&nt!==null)throw new TypeError("Class extends value "+String(nt)+" is not a constructor or null");tt(et,nt);function rt(){this.constructor=et}et.prototype=nt===null?Object.create(nt):(rt.prototype=nt.prototype,new rt)}}();Object.defineProperty(errors,"__esModule",{value:!0});errors.InternalError=errors.InvalidDataError=errors.RoutingError=errors.UnsupportedMethodError=errors.ConnectionError=errors.RejectionError=errors.MissingProviderError=void 0;function fixError(tt,et,nt){if(Object.setPrototypeOf(tt,nt.prototype),et===nt)if(tt.name=et.name,Error.captureStackTrace)Error.captureStackTrace(tt,nt);else{var rt=new Error(tt.message).stack;rt&&(tt.stack=fixStack(rt,"new ".concat(et.name)))}}function fixStack(tt,et){if(!tt||!et)return tt;var nt=new RegExp("\\s+at\\s".concat(et,"\\s")),rt=tt.split(` +`,BaseModal=({background:tt="modalBg",children:et,id:nt,hideBg:rt,kind:it,preventOutsideClose:ot,noWrap:at=!1,onClose:st})=>{const{visible:lt,close:ct}=useModal(nt);return lt?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Bg,{align:"center",hideBg:rt,justify:"center",onClick:ut=>{ot||(ut.stopPropagation(),ct())},children:jsxRuntimeExports.jsxs(ModalContainer,{background:tt,borderRadius:9,id:nt,kind:it,onClick:ut=>{ut.stopPropagation()},px:at?0:20,py:at?0:20,children:[st&&jsxRuntimeExports.jsx(CloseButton$7,{onClick:st,children:jsxRuntimeExports.jsx(ClearIcon$1,{})}),et]})})}):null},{origin:origin$1,host}=window.location,isDevelopment=origin$1==="http://localhost:3000"||origin$1==="http://localhost:3001"||origin$1==="https://sphinx-jarvis-david.sphinx1.repl.co",getUrlFormEnv=()=>({}).VITE_APP_API_URL,API_URL=getUrlFormEnv()||apiUrlFromSwarmHost()||"https://knowledge-graph.sphinx.chat";console.log("🚀 ~ file: index.ts:12 ~ API_URL:",API_URL);console.log("🚀 ~ file: index.ts:12 ~ getUrlFormEnv:",getUrlFormEnv());const isChileGraph=API_URL.includes("boltwall");function apiUrlFromSwarmHost(){if(host.includes("swarm")&&host.startsWith("nav")){const tt=host.split(".");tt[0]="boltwall";const nt=`https://${tt.join(".")}`;return console.log("API URL:",nt),nt}}const AWS_IMAGE_BUCKET_URL="https://stakwork-uploads.s3.amazonaws.com/",CLOUDFRONT_IMAGE_BUCKET_URL="https://d1gd7b7slyku8k.cloudfront.net/",GRAPH_FOG_COLOR="blue",GRAPH_GROUND_COLOR=13421772,GRAPH_LIGHT_INTENSITY=.8,BOOST_SUCCESS="Boosted successfully",BOOST_ERROR_BUDGET="Boost failed, insufficient budget",NODE_ADD_SUCCESS="Submitted!",NODE_ADD_ERROR="Submission failed, please try again.",NODE_RELATIVE_HIGHLIGHT_COLORS={children:{nodeColor:"green",segmentColor:4063109},guests:{nodeColor:"purple",segmentColor:14504191},topics:{nodeColor:"purple",segmentColor:5273842},pathway:{nodeColor:"#ffffff",segmentColor:16777215}},LINK="link",TWITTER_HANDLE="twitter_handle",GITHUB_REPOSITORY="github_repository",YOUTUBE_CHANNEL="youtube_channel",WEB_PAGE="web_page",RSS="rss",TWITTER_SOURCE="tweet",TOPIC="topic",DOCUMENT="document",isE2E=!!{}.VITE_APP_IS_E2E,request=async(tt,et)=>{const nt=await fetch(tt,et);if(!nt.ok)throw nt;return nt.json()},api={delete:(tt,et)=>request(`${API_URL}${tt}`,{headers:{...et,"Content-Type":"application/json"},method:"DELETE"}),get:(tt,et)=>request(`${API_URL}${tt}`,et?{headers:et}:void 0),post:(tt,et,nt)=>request(`${API_URL}${tt}`,{body:et,headers:{...nt,"Content-Type":"application/json"},method:"POST"}),put:(tt,et,nt)=>request(`${API_URL}${tt}`,{body:et,headers:{...nt,"Content-Type":"application/json"},method:"PUT"})},defaultParams={skip:"0",limit:"500"},getRadarData=async(tt=defaultParams)=>await api.get(`/radar?${new URLSearchParams({...defaultParams,...tt}).toString()}`),getTopicsData=async(tt=defaultParams)=>await api.get(`/topics?${new URLSearchParams({...defaultParams,...tt}).toString()}`),getAboutData=async()=>await api.get("/about"),postAboutData=async tt=>await api.post("/about",JSON.stringify(tt)),triggerRadarJob=async()=>api.get("/radar/trigger-job"),putRadarData=async(tt,et)=>await api.put(`/radar/${tt}`,JSON.stringify(et)),putNodeData=async tt=>await api.put("/node",JSON.stringify(tt)),approveRadarData=async(tt,et)=>await api.put(`/radar/${tt}/approve`,JSON.stringify({approve:"True",pubkey:et})),deleteRadarData=async tt=>await api.delete(`/radar/${tt}`),defaultData$9={isAdmin:!1,pubKey:"",budget:0},useUserStore=react(tt=>({...defaultData$9,setIsAdmin:et=>tt({isAdmin:et}),setPubKey:et=>tt({pubKey:et}),setBudget:et=>tt({budget:et})})),getLSat=async()=>{try{const tt=localStorage.getItem("lsat");if(tt){const nt=JSON.parse(tt);return lsatToken(nt.macaroon,nt.preimage)}if(await distExports$1.enable()){const nt=await distExports$1.getLsat();return nt.macaroon?(localStorage.setItem("lsat",JSON.stringify({macaroon:nt.macaroon,identifier:nt.identifier,preimage:nt.preimage})),lsatToken(nt.macaroon,nt.preimage)):""}return""}catch(tt){return console.warn(tt),""}};function lsatToken(tt,et){return`LSAT ${tt}:${et}`}var lib$2={},client={},errors={},__extends$1=commonjsGlobal&&commonjsGlobal.__extends||function(){var tt=function(et,nt){return tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(rt,it){rt.__proto__=it}||function(rt,it){for(var ot in it)Object.prototype.hasOwnProperty.call(it,ot)&&(rt[ot]=it[ot])},tt(et,nt)};return function(et,nt){if(typeof nt!="function"&&nt!==null)throw new TypeError("Class extends value "+String(nt)+" is not a constructor or null");tt(et,nt);function rt(){this.constructor=et}et.prototype=nt===null?Object.create(nt):(rt.prototype=nt.prototype,new rt)}}();Object.defineProperty(errors,"__esModule",{value:!0});errors.InternalError=errors.InvalidDataError=errors.RoutingError=errors.UnsupportedMethodError=errors.ConnectionError=errors.RejectionError=errors.MissingProviderError=void 0;function fixError(tt,et,nt){if(Object.setPrototypeOf(tt,nt.prototype),et===nt)if(tt.name=et.name,Error.captureStackTrace)Error.captureStackTrace(tt,nt);else{var rt=new Error(tt.message).stack;rt&&(tt.stack=fixStack(rt,"new ".concat(et.name)))}}function fixStack(tt,et){if(!tt||!et)return tt;var nt=new RegExp("\\s+at\\s".concat(et,"\\s")),rt=tt.split(` `),it=rt.filter(function(ot){return!ot.match(nt)});return it.join(` -`)}var MissingProviderError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.MissingProviderError=MissingProviderError;var RejectionError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.RejectionError=RejectionError;var ConnectionError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.ConnectionError=ConnectionError;var UnsupportedMethodError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.UnsupportedMethodError=UnsupportedMethodError;var RoutingError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.RoutingError=RoutingError;var InvalidDataError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.InvalidDataError=InvalidDataError;var InternalError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.InternalError=InternalError;Object.defineProperty(client,"__esModule",{value:!0});client.requestProvider=void 0;var errors_1=errors;function requestProvider(tt){return new Promise(function(et,nt){if(typeof window>"u")return nt(new Error("Must be called in a browser context"));var rt=window.webln;if(!rt)return nt(new errors_1.MissingProviderError("Your browser has no WebLN provider"));rt.enable().then(function(){return et(rt)}).catch(function(it){return nt(it)})})}client.requestProvider=requestProvider;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});(function(tt){var et=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(rt,it,ot,at){at===void 0&&(at=ot);var st=Object.getOwnPropertyDescriptor(it,ot);(!st||("get"in st?!it.__esModule:st.writable||st.configurable))&&(st={enumerable:!0,get:function(){return it[ot]}}),Object.defineProperty(rt,at,st)}:function(rt,it,ot,at){at===void 0&&(at=ot),rt[at]=it[ot]}),nt=commonjsGlobal&&commonjsGlobal.__exportStar||function(rt,it){for(var ot in rt)ot!=="default"&&!Object.prototype.hasOwnProperty.call(it,ot)&&et(it,rt,ot)};Object.defineProperty(tt,"__esModule",{value:!0}),nt(client,tt),nt(provider,tt),nt(errors,tt)})(lib$2);async function payLsat(tt){if(await distExports$1.enable()){const it=localStorage.getItem("lsat");if(it){localStorage.removeItem("lsat");const at=JSON.parse(it);await distExports$1.updateLsat(at.identifier,"expired")}const ot=await distExports$1.saveLsat(tt.invoice,tt.baseMacaroon,window.location.host);ot.success===!1&&await distExports$1.topup(),localStorage.setItem("lsat",JSON.stringify({macaroon:tt.baseMacaroon,identifier:tt.id,preimage:ot.lsat.split(":")[1]}));return}localStorage.removeItem("lsat");const rt=await(await lib$2.requestProvider()).sendPayment(tt.invoice);localStorage.setItem("lsat",JSON.stringify({macaroon:tt.baseMacaroon,identifier:tt.id,preimage:rt.preimage}))}const defaultData$9={isAdmin:!1,pubKey:""},useUserStore=react(tt=>({...defaultData$9,setIsAdmin:et=>tt({isAdmin:et}),setPubKey:et=>tt({pubKey:et})})),executeIfTetsRunning=tt=>{isE2E&&tt()};function executeIfProd(tt){return isDevelopment||isE2E?null:tt()}function addToGlobalForE2e(tt,et){executeIfTetsRunning(()=>{window.e2e||(window.e2e={}),window.e2e[et]=tt})}const E2E=()=>{const tt=useUserStore();return reactExports.useEffect(()=>{isE2E&&(console.log({isE2E}),addToGlobalForE2e(tt,"userStore"))},[tt]),jsxRuntimeExports.jsx("div",{id:"e2e-check"})},E2ETests=reactExports.memo(()=>isE2E?jsxRuntimeExports.jsx(E2E,{}):null);function timeToMilliseconds(tt){const[et,nt,rt]=tt.split(":").map(Number);return Number((et*60*60*1e3+nt*60*1e3+rt*1e3).toFixed(6))}/** +`)}var MissingProviderError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.MissingProviderError=MissingProviderError;var RejectionError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.RejectionError=RejectionError;var ConnectionError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.ConnectionError=ConnectionError;var UnsupportedMethodError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.UnsupportedMethodError=UnsupportedMethodError;var RoutingError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.RoutingError=RoutingError;var InvalidDataError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.InvalidDataError=InvalidDataError;var InternalError=function(tt){__extends$1(et,tt);function et(nt){var rt=this.constructor,it=tt.call(this,nt)||this;return fixError(it,rt,et),it}return et}(Error);errors.InternalError=InternalError;Object.defineProperty(client,"__esModule",{value:!0});client.requestProvider=void 0;var errors_1=errors;function requestProvider(tt){return new Promise(function(et,nt){if(typeof window>"u")return nt(new Error("Must be called in a browser context"));var rt=window.webln;if(!rt)return nt(new errors_1.MissingProviderError("Your browser has no WebLN provider"));rt.enable().then(function(){return et(rt)}).catch(function(it){return nt(it)})})}client.requestProvider=requestProvider;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});(function(tt){var et=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(rt,it,ot,at){at===void 0&&(at=ot);var st=Object.getOwnPropertyDescriptor(it,ot);(!st||("get"in st?!it.__esModule:st.writable||st.configurable))&&(st={enumerable:!0,get:function(){return it[ot]}}),Object.defineProperty(rt,at,st)}:function(rt,it,ot,at){at===void 0&&(at=ot),rt[at]=it[ot]}),nt=commonjsGlobal&&commonjsGlobal.__exportStar||function(rt,it){for(var ot in rt)ot!=="default"&&!Object.prototype.hasOwnProperty.call(it,ot)&&et(it,rt,ot)};Object.defineProperty(tt,"__esModule",{value:!0}),nt(client,tt),nt(provider,tt),nt(errors,tt)})(lib$2);async function payLsat(tt){if(await distExports$1.enable()){const it=localStorage.getItem("lsat");if(it){localStorage.removeItem("lsat");const at=JSON.parse(it);await distExports$1.updateLsat(at.identifier,"expired")}const ot=await distExports$1.saveLsat(tt.invoice,tt.baseMacaroon,window.location.host);ot.success===!1&&await distExports$1.topup(),localStorage.setItem("lsat",JSON.stringify({macaroon:tt.baseMacaroon,identifier:tt.id,preimage:ot.lsat.split(":")[1]}));return}localStorage.removeItem("lsat");const rt=await(await lib$2.requestProvider()).sendPayment(tt.invoice);localStorage.setItem("lsat",JSON.stringify({macaroon:tt.baseMacaroon,identifier:tt.id,preimage:rt.preimage}))}async function updateBudget(tt){await distExports$1.enable();const et=await distExports$1.getBudget();(et==null?void 0:et.msg)==="Invalid Action"?tt(null):et!=null&&et.budget&&tt(et.budget)}const executeIfTetsRunning=tt=>{isE2E&&tt()};function executeIfProd(tt){return isDevelopment||isE2E?null:tt()}function addToGlobalForE2e(tt,et){executeIfTetsRunning(()=>{window.e2e||(window.e2e={}),window.e2e[et]=tt})}const E2E=()=>{const tt=useUserStore();return reactExports.useEffect(()=>{isE2E&&(console.log({isE2E}),addToGlobalForE2e(tt,"userStore"))},[tt]),jsxRuntimeExports.jsx("div",{id:"e2e-check"})},E2ETests=reactExports.memo(()=>isE2E?jsxRuntimeExports.jsx(E2E,{}):null);function timeToMilliseconds(tt){const[et,nt,rt]=tt.split(":").map(Number);return Number((et*60*60*1e3+nt*60*1e3+rt*1e3).toFixed(6))}/** * @license * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT @@ -3721,7 +3721,7 @@ A Bitcoin Podcast. `},{children:["1ba72c1d-ff22-4572-ad24-8171bfce9de3","5efbc2c3-e67a-4b16-9c9d-285bdd37e906"],episode_title:"Bitcoin Charlotte Book Club - Sovereign Individual Ch 1-7",guests:[{name:"Bolt",profile_picture:"https://pbs.twimg.com/profile_images/1352721439879786496/wfevZ8bG_400x400.jpg",ref_id:"b165e497-f255-4ce5-9762-30c90dcf776d",twitter_handle:"Bitcoin_CLT"},{name:"Victor",profile_picture:"https://pbs.twimg.com/profile_images/1519726025013350400/GHxSzgA3_400x400.jpg",ref_id:"d91fff8d-e4c6-4aeb-9f32-021e4a4ff9a6",twitter_handle:"victorwong"},{name:"George",profile_picture:"https://pbs.twimg.com/profile_images/1173474608856608768/vEBnPUdm_400x400.jpg",ref_id:"5946bdf6-8feb-43aa-b2ca-46b2944b0572",twitter_handle:"GeorgeNotFound"},{name:"Mark",profile_picture:"https://pbs.twimg.com/profile_images/1511102924310544387/j6E29xq6_400x400.jpg",ref_id:"c8cd0c95-c105-41c4-8fae-9dbfa76d84f2",twitter_handle:"markiplier"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/fe6bdbce-e91d-43cf-ab33-0e98bffabecc.jpg",node_type:"episode",ref_id:"9dcca755-0a20-45e5-8e4d-dfe2800b9c6f",show_title:"Bitcoin Charlotte"},{children:["821f7b5c-c6ad-422b-b4e1-ed34f915e4af"],episode_title:"TABConf Mixtape Vol 2: Sound Bites from TABConf",guests:[{name:"Michael",profile_picture:"https://pbs.twimg.com/profile_images/1558687629599657990/vf-bU14b_400x400.jpg",ref_id:"c7b4faa1-db77-4459-b03f-0e41e15efae7",twitter_handle:"MichaelHawaii"},{name:"Ben",profile_picture:"https://pbs.twimg.com/profile_images/1580596905721171969/0NnLeJWA_400x400.jpg",ref_id:"da0132b9-0d19-43e6-bc1a-9c7818c79ba4",twitter_handle:"benshapiro"},{name:"brandon",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"8a27da7a-c05c-44da-8247-3c5f68bc3164",twitter_handle:"ThrillerBitcoin"},{name:"shane",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"2e5ce678-7d04-4a48-8bd1-281329ea9424",twitter_handle:"ThrillerBitcoin"},{name:"exfrog",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"d0dc102c-404e-4753-9290-9a3fe27fe2ee",twitter_handle:"ThrillerBitcoin"},{name:"josh",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"34eb29e3-da86-485f-b20a-059f7d41f6ad",twitter_handle:"ThrillerBitcoin"},{name:"autumn",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"3224f2ec-3e77-485f-88b8-6930e19f8ac6",twitter_handle:"ThrillerBitcoin"},{name:"buck",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"00a55ec0-9b1a-482a-893a-345d350a33a0",twitter_handle:"ThrillerBitcoin"},{name:"stephen",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"9dc56711-eacc-4691-821e-fe2a26855ea9",twitter_handle:"ThrillerBitcoin"},{name:"hodl",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"b012eda0-b78c-46e7-ab46-6a7139584fc7",twitter_handle:"ThrillerBitcoin"},{name:"evan",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"9a8418e9-8976-425c-95ce-ed2fe307e380",twitter_handle:"ThrillerBitcoin"},{name:"muzz",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"444b8330-caa1-4bcf-8144-7d9110ae2242",twitter_handle:"ThrillerBitcoin"},{name:"thomas",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"e2140e58-314d-4425-bc97-20f52f951866",twitter_handle:"ThrillerBitcoin"},{name:"justin",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"2ce04090-b9b1-4e84-a87f-9c9dc9ececec",twitter_handle:"ThrillerBitcoin"},{name:"stakamoto",profile_picture:"https://pbs.twimg.com/profile_images/1575598727812812803/4FkPb0vt_400x400.jpg",ref_id:"8b249d9b-8521-4e0e-bf24-2d8b8721d26b",twitter_handle:"ThrillerBitcoin"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4240c90e-0086-4ece-bfe5-84a282c5059e.jpg",node_type:"episode",ref_id:"b8289cbb-ec69-49a8-b6ab-c1fd808acc09",show_title:"Thriller Bitcoin"},{children:["c13cad10-b242-4812-ad19-3bce525dfeb0"],episode_title:"Pieter Wuille and Tim Ruffing - Nesting, ROAST, Half-Aggregation, Adaptor Signatures (part 2)",guests:[{name:"Tim Ruffing",profile_picture:"https://pbs.twimg.com/profile_images/925128264502439936/XcmMIk8k_400x400.jpg",ref_id:"222f7374-6d68-4934-81ed-37567c515b59",twitter_handle:"real_or_random"},{name:"Pieter Wuille",profile_picture:"https://pbs.twimg.com/profile_images/1264051937172836353/n7gHdLbB_400x400.jpg",ref_id:"40260d2f-3480-47d6-8515-d2e780901273",twitter_handle:"pwuille"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/24a144b0-7ca3-40e9-9c42-86b9fce0b662.jpg",node_type:"episode",ref_id:"daddd93e-7bc6-4c50-a150-5199b437afc9",show_title:"The Chaincode Podcast"},{children:["2a01dc8c-19f7-47a8-bfa8-92645a7314c0","1510e150-aee2-42cb-ac57-79b4997bb6cb","9abcd65c-f311-4a4a-ae65-bbef89f36fc7"],episode_title:"BR023 - OP_VAULT for Bitcoin Covenants Panel ft. James O'Beirne, Rijndael, Antoine Poinsot & Carman",guests:[{name:"Carman",profile_picture:"https://pbs.twimg.com/profile_images/1609775498971725824/5vyAafE3_400x400.jpg",ref_id:"09405d70-6fa6-4f2c-92f1-a2951ad56447",twitter_handle:"benthecarman"},{name:"Antoine Poinsot",profile_picture:"https://pbs.twimg.com/profile_images/1108377445936316423/ArRDGbr5_400x400.jpg",ref_id:"1ba10809-b3e6-4e37-a906-697a0368b814",twitter_handle:"darosior"},{name:"Rijndael",profile_picture:"https://pbs.twimg.com/profile_images/1542705395873058817/0zsy4Yur_400x400.jpg",ref_id:"861d5324-8ede-4059-826f-f29abca5d7e6",twitter_handle:"rot13maxi"},{name:"James O'Beirne",profile_picture:"https://pbs.twimg.com/profile_images/1542173995650408450/iDxrdmuj_400x400.jpg",ref_id:"e8e48fcf-9e54-4c66-9b20-aacf5c5b504e",twitter_handle:"jamesob"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f1879df9-9bc6-4a76-951f-24548da768ef.jpg",node_type:"episode",ref_id:"56bf65e9-41d5-42e1-95d6-239e4c835781",show_title:"Bitcoin.Review Podcast with NVK & Guests"},{children:["62034201-203b-42ff-9884-a850d6298caf"],episode_title:"BR020 - Zeus, Alby, Bitcoin Knots Keys Leaked +MORE ft. Sjors, Schmidty, Evan Kaloudis & Justin Moon",guests:[{name:"Sjors",profile_picture:"",ref_id:"fa5c587a-09ef-4cbd-b470-cfc78163f749",twitter_handle:""},{name:"Evan Kaloudis",profile_picture:"https://pbs.twimg.com/profile_images/1596923848997445633/DqxrGpkW_400x400.jpg",ref_id:"420172fa-9431-4ba4-965c-adab17648d1b",twitter_handle:"evankaloudis"},{name:"Schmidty",profile_picture:"https://pbs.twimg.com/profile_images/1334879848280494083/A6ssSEfV_400x400.jpg",ref_id:"28f55137-e733-4f5b-b988-7cb60ef0d330",twitter_handle:"bitschmidty"},{name:"Justin Moon",profile_picture:"https://pbs.twimg.com/profile_images/1512674225651335169/iYHDJQcy_400x400.jpg",ref_id:"1d2cdf64-358f-4b00-8f2b-0c94f798dc2c",twitter_handle:"_JustinMoon_"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f1879df9-9bc6-4a76-951f-24548da768ef.jpg",node_type:"episode",ref_id:"ff88a8b8-bcd6-4d86-8a65-8a68def35b9f",show_title:"Bitcoin.Review Podcast with NVK & Guests"},{children:["08600eb8-a8b1-4be4-b505-3adc409da2f8","1958362b-b149-4466-b873-4d22a36d67d8"],episode_title:"BR019 - Proof of Keys Day Twitter Space ft. Lopp, Craig Raw, Lazy Ninja, mshodl, Rijndael & guests",guests:[],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f1879df9-9bc6-4a76-951f-24548da768ef.jpg",node_type:"episode",ref_id:"810a3acb-e30e-46bc-8c67-1d504b2e7c09",show_title:"Bitcoin.Review Podcast with NVK & Guests"},{children:["f9d1d228-19db-4a2d-bfb3-7853fd745ea0","88a4665a-7414-4ccd-96e4-3fb43f93d9bc"],episode_title:"Taproot Activation Q&A with Bitcoin Devs - TABConf 2021",guests:[{name:"Andrew Chow",profile_picture:"https://pbs.twimg.com/profile_images/1452266201770496010/44FHCtZM_400x400.jpg",ref_id:"f96d87ca-5060-4021-aeb9-61db03312027",twitter_handle:"andrewrchow"},{name:"Ben Carman",profile_picture:"https://pbs.twimg.com/profile_images/1550704386007089152/pLwUSeff_400x400.jpg",ref_id:"1d1e95ba-b4af-415f-aafe-85c6dd7571b8",twitter_handle:"benthecarman"},{name:"Matt Corallo",profile_picture:"https://pbs.twimg.com/profile_images/697361498587451394/_rX0-O0W_400x400.png",ref_id:"08cb3c45-c0bc-4a60-ae5b-a1283d352c8b",twitter_handle:"TheBlueMatt"},{name:"Pieter Wuille",profile_picture:"https://pbs.twimg.com/profile_images/1264051937172836353/n7gHdLbB_400x400.jpg",ref_id:"40260d2f-3480-47d6-8515-d2e780901273",twitter_handle:"pwuille"},{name:"Vivek Kasarabada",profile_picture:"",ref_id:"60ed22d0-8cf3-410e-8a7c-9c343ae109ca",twitter_handle:""},{name:"Murch",profile_picture:"https://pbs.twimg.com/profile_images/1269477743525130241/-U843Cmt_400x400.png",ref_id:"3e2c1c73-a057-4475-9782-3bb0d3d8cc62",twitter_handle:"murchandamus"},{name:"Andrew Poelstra",profile_picture:"https://pbs.twimg.com/profile_images/1316562683009921024/FSscAYvJ_400x400.jpg",ref_id:"15fb9c53-c988-4af1-bbf0-4832d71b0a01",twitter_handle:"Blockstream"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"episode",ref_id:"f7e75069-adf6-41b0-9bb7-a6a2aa846493",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["cd29b1a1-f94b-4eee-84ce-ddf8a4fcb0c5"],episode_title:"Lightning for Plebs - TABConf 2021",guests:[{name:"ketominer",profile_picture:"https://pbs.twimg.com/profile_images/1245972079528329218/YDUD9N2Q_400x400.jpg",ref_id:"2f8b0b59-6f23-4c89-973c-668cc7666998",twitter_handle:"ketominer"},{name:"Ryan Gentry",profile_picture:"https://pbs.twimg.com/profile_images/1362751223217160203/ekMa_yY-_400x400.jpg",ref_id:"8fe78b55-bc38-40df-9cb5-ffd5c84166a2",twitter_handle:"RyanTheGentry"},{name:"Dread",profile_picture:"https://pbs.twimg.com/profile_images/1532557131819491328/vvs1cD-7_400x400.jpg",ref_id:"e61af76b-8fbd-4719-b753-0a70edd22fa8",twitter_handle:"PoleVaultDream"},{name:"Andre Neves",profile_picture:"https://pbs.twimg.com/profile_images/1604172627550969856/bYCGb7Ev_400x400.jpg",ref_id:"227e071d-f8a6-4137-8078-729fa9eb3a13",twitter_handle:"andreneves"},{name:"Nate G",profile_picture:"https://pbs.twimg.com/profile_images/1542983032507858944/9w_UUx5Z_400x400.jpg",ref_id:"bda29551-f17f-452c-9204-4d6cafdf4f3b",twitter_handle:"natecgriffin"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"episode",ref_id:"6eb2a481-408f-4989-9f28-67789651259a",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["6731ba0c-c57b-4fb1-a2f6-6e1ec641e830"],episode_title:"Brink Projects: Research and Improvements for Bitcoin - TABConf 2021",guests:[{name:"Gloria Zhao",profile_picture:"https://pbs.twimg.com/profile_images/1144496084330266631/aPKPfoX3_400x400.png",ref_id:"cebd71c3-4ccf-452d-8ba7-4982f49fd060",twitter_handle:"GloriaHuiZhao"},{name:"Mike Schmidt",profile_picture:"https://pbs.twimg.com/profile_images/1320935020589158400/gFovyRlj_400x400.jpg",ref_id:"d503db9b-a7b1-49e1-8ef6-7541df3c2473",twitter_handle:"nytmike"},{name:"Jesse Posner",profile_picture:"https://pbs.twimg.com/profile_images/1467067234484830213/T6PtLZq1_400x400.jpg",ref_id:"bb55767f-dfbb-4182-8dd8-e1b08e0c6ad6",twitter_handle:"jesseposner"},{name:"Larry Ruane",profile_picture:"https://pbs.twimg.com/profile_images/1226076521/bike_crop_400x400.JPG",ref_id:"ce38f2dd-d41f-4957-ad83-671c3dc29cc5",twitter_handle:"larryruane"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"episode",ref_id:"89049a1c-0171-4999-b003-57e1b57d92b2",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["acdb65ab-789f-480c-9f88-414599d19a43"],episode_title:"Scaling Bitcoin Off-Chain - TABConf 2021",guests:[{name:"Graham Krizek",profile_picture:"https://pbs.twimg.com/profile_images/1600169182347288582/yNztRz0g_400x400.jpg",ref_id:"186974f3-37dd-4d62-9d88-1b7fa88c6cce",twitter_handle:"gkrizek"},{name:"Stephen Livera",profile_picture:"https://pbs.twimg.com/profile_images/1362551718110580740/v-W5Q2uo_400x400.jpg",ref_id:"9c9974bd-6a59-480f-8d5a-12b634b15b39",twitter_handle:"stephanlivera"},{name:"Alex Bosworth",profile_picture:"https://pbs.twimg.com/profile_images/1364274244960481281/G5gNi3di_400x400.jpg",ref_id:"2389663a-f7f8-42a7-99da-551089a9ea6a",twitter_handle:"alexbosworth"},{name:"Matt Corallo",profile_picture:"https://pbs.twimg.com/profile_images/697361498587451394/_rX0-O0W_400x400.png",ref_id:"08cb3c45-c0bc-4a60-ae5b-a1283d352c8b",twitter_handle:"TheBlueMatt"},{name:"Niftynei",profile_picture:"https://pbs.twimg.com/profile_images/1594756549162975240/J-4dbH6W_400x400.jpg",ref_id:"5e9f617b-cc12-4e3d-9fb5-ad058f14b171",twitter_handle:"niftynei"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"episode",ref_id:"d842ce17-a4c0-49a6-bdc5-5268f1d61779",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["65a9d9c6-3211-444a-a49f-f4a34b9ab5fb","d96fca70-c1c7-4b71-9d35-9aadf2820909"],episode_title:"Scaling Bitcoin On-Chain - TABConf 2021",guests:[{name:"Andrew Chow",profile_picture:"https://pbs.twimg.com/profile_images/1452266201770496010/44FHCtZM_400x400.jpg",ref_id:"f96d87ca-5060-4021-aeb9-61db03312027",twitter_handle:"andrewrchow"},{name:"Mark Erhardt Murch",profile_picture:"https://pbs.twimg.com/profile_images/1269477743525130241/-U843Cmt_400x400.png",ref_id:"ef2f2f68-ae16-4e78-80cb-0be9bd156988",twitter_handle:"Murchandamus"},{name:"Andrew Poelstra",profile_picture:"https://pbs.twimg.com/profile_images/1316562683009921024/FSscAYvJ_400x400.jpg",ref_id:"15fb9c53-c988-4af1-bbf0-4832d71b0a01",twitter_handle:"Blockstream"},{name:"Peter Wuille",profile_picture:"https://pbs.twimg.com/profile_images/1264051937172836353/n7gHdLbB_400x400.jpg",ref_id:"fb836ce4-a933-4419-99d8-932fe65219a1",twitter_handle:"pwuille"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"episode",ref_id:"8d9b0689-2e69-44c1-afe2-3519e999390a",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["9f69933d-69fe-47a0-af4d-9d80726e60aa","f507641d-2514-41d3-a4f3-9b218136fa98","addee850-119f-472c-87c2-05fc0642abeb"],episode_title:"Cool Apps Built on Lightning - March 16, 2022 - Voltage Twitter Spaces",guests:[{name:"Chad Atkins",profile_picture:"https://pbs.twimg.com/profile_images/1200611447979544576/W9ocRJTb_400x400.jpg",ref_id:"62da3c50-0a46-400b-81a3-5f482f5b8fee",twitter_handle:"Chemchad"},{name:"Michael Atwood",profile_picture:"https://pbs.twimg.com/profile_images/1362207977470521345/Jy2_Ge60_400x400.jpg",ref_id:"16359ade-afb9-4a37-be0b-0844a6134327",twitter_handle:"Dooowta"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"episode",ref_id:"3b818893-4605-499c-a467-5abcc23f9483",show_title:"Voltage"},{children:["c7beffcd-bb44-4cf9-a04a-a26f6439114c","3db5f375-817e-4275-980c-6475803c430b"],episode_title:"Lightning Networks Impact on Music w/ Michael Rhee, Founder of Wavlake - Voltage Twitter Spaces",guests:[{name:"Michael Rhee",profile_picture:"https://pbs.twimg.com/profile_images/1348612450/IMG_0298_400x400.JPG",ref_id:"91302fb9-2d08-400e-bd1f-2d52e0af5508",twitter_handle:"rheedio"},{name:"@rheedio",profile_picture:"https://pbs.twimg.com/profile_images/1348612450/IMG_0298_400x400.JPG",ref_id:"a20f5e1f-5969-47a6-b986-faf29c0c4da0",twitter_handle:"rheedio"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"episode",ref_id:"a44e78cd-dc66-4b67-9523-7ddff0d3655f",show_title:"Voltage"},{children:["f10270d7-1cdc-4922-853a-1f8247750382","d2d3e71f-24ad-4cf3-b516-f63ac5283d50"],episode_title:"TRUBIT bringing Digital Loyalty Assets to Bitcoin - Voltage Twitter Spaces",guests:[{name:"@0xLinden",profile_picture:"https://pbs.twimg.com/profile_images/1439365331202437125/JBiXogun_400x400.jpg",ref_id:"b8bb4402-8f86-4220-9dee-0fa28ff8de72",twitter_handle:"0xLinden"},{name:"Stephen Doge",profile_picture:"https://pbs.twimg.com/profile_images/1215979900387184641/nZXkhgoP_400x400.jpg",ref_id:"076972a2-cdab-4766-8c66-618472b80772",twitter_handle:"StephenDodge20"},{name:"@617a7a",profile_picture:"https://pbs.twimg.com/profile_images/1548336437308715016/FUZFJf9k_400x400.jpg",ref_id:"148d77a5-6e95-4855-9e17-19e68f648898",twitter_handle:"617a7a"},{name:"@ian__major",profile_picture:"https://pbs.twimg.com/profile_images/1427414299169984517/Hw0ux6ie_400x400.jpg",ref_id:"7ed41a74-21a4-43a4-9a05-e977c981b6d3",twitter_handle:"ian__major"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"episode",ref_id:"0c4f330b-a39d-4312-9775-58b42c7c9723",show_title:"Voltage"},{children:["076eecc3-0553-4bb7-8fe2-9f43a6d54f79","4310fd96-1c4f-42a7-b72f-60fc5968c75d","3d451e38-8616-43bc-8269-c3b8ce7d9b15","ca89bac3-188b-4e90-8d0b-fe42d0abf067","d0f57eb5-87ba-4180-ad39-96589093a0f0"],episode_title:"Small Businesses Embracing Bitcoin w/ Michael from Oshi App - Voltage Twitter Spaces",guests:[{name:"Michael Atwood",profile_picture:"https://pbs.twimg.com/profile_images/1362207977470521345/Jy2_Ge60_400x400.jpg",ref_id:"16359ade-afb9-4a37-be0b-0844a6134327",twitter_handle:"Dooowta"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"episode",ref_id:"205a0650-fefe-4aaf-a894-faa8b72d966a",show_title:"Voltage"},{children:["e9443306-25af-42d3-830d-ed6a26721103"],episode_title:"Austin Bitcoin Design Club Interview w/ Sahil, FuturePaul, and Car",guests:[{name:"Car Gonzalez",profile_picture:"https://pbs.twimg.com/profile_images/1541855444720836608/F4v02BuD_400x400.jpg",ref_id:"b554604d-47eb-4c7c-b6c9-87a062e6a844",twitter_handle:"Car_mdq_2010"},{name:"Sahil Chaturvedi",profile_picture:"https://pbs.twimg.com/profile_images/1362511727066107904/yP4o43cz_400x400.jpg",ref_id:"8b56eaa4-c9d6-46e8-a313-fbccd0ee86b5",twitter_handle:"SahilC0"},{name:"Future Paul",profile_picture:"https://pbs.twimg.com/profile_images/1508452962917666821/1QheRD09_400x400.jpg",ref_id:"ec933e22-f395-4817-b608-4337eaaf60a4",twitter_handle:"futurepaul"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"episode",ref_id:"a60dc641-5d14-4960-ab73-66ff199edd1d",show_title:"Voltage"},{children:["f3d0a35e-3e21-4c0c-874c-d6f2b1f37eed"],episode_title:"The Future of Bitcoin Technology with Pierre Rochard, Dhruv Bansal, Warren Togami and Guy Swann",guests:[{name:"Warren Togami",profile_picture:"https://pbs.twimg.com/profile_images/1577819570039128065/bBmumEx9_400x400.jpg",ref_id:"f082b94a-673f-4b99-b46e-49a342b5792a",twitter_handle:"wtogami"},{name:"Dhruv Bansal",profile_picture:"https://pbs.twimg.com/profile_images/908397811284172800/kR9kKNsE_400x400.jpg",ref_id:"6ed2b14a-d97d-4a3f-b5b5-4c3222d85624",twitter_handle:"dhruvbansal"},{name:"Pierre Rochard",profile_picture:"https://pbs.twimg.com/profile_images/1567258180861792256/EEEBkvQR_400x400.jpg",ref_id:"426b30ba-7c24-4558-b926-ec307756a876",twitter_handle:"BitcoinPierre"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/492cbcce-3744-4d8b-b2ca-3a7f063e798a.jpg",node_type:"episode",ref_id:"3af98dc1-5e7c-4ef3-ad74-b9b6afaee8b9",show_title:"Swan Bitcoin"},{children:["6e890ef3-7358-40d6-a01f-44f444dbabfc"],episode_title:"#Bitcoin Mining Saves the World - Brought to you by Marathon",guests:[{name:"Steve Barbour",profile_picture:"https://pbs.twimg.com/profile_images/1592714173469065216/q8kXPyQI_400x400.jpg",ref_id:"63a731b8-4759-4360-9e9d-d66f884e12d8",twitter_handle:"SGBarbour"},{name:"Nathaniel Harmon",profile_picture:"https://pbs.twimg.com/profile_images/1578090357102780416/etXW-RA9_400x400.jpg",ref_id:"9105fb4e-4150-4c25-90f1-8ea770585749",twitter_handle:"NateHawaii"},{name:"Taylor Monnig",profile_picture:"https://pbs.twimg.com/profile_images/1599563776621219840/mvb8y3zY_400x400.jpg",ref_id:"b8513b01-ff94-4d7f-944f-5c92e1126885",twitter_handle:"taylorbmonnig"},{name:"Harry Suddock",profile_picture:"",ref_id:"6440ea0f-c982-4b76-b7c2-9c6bf7e9a4a9",twitter_handle:""}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/492cbcce-3744-4d8b-b2ca-3a7f063e798a.jpg",node_type:"episode",ref_id:"625d9252-2f5e-4f53-b577-dd2dfd4d4749",show_title:"Swan Bitcoin"},{children:["876e20ef-be1b-44e6-a77d-4af5beb33ad4"],episode_title:"Austin Bitcoin Club: August - Value for Value Panel",guests:[{name:"Justin Rezvani",profile_picture:"https://pbs.twimg.com/profile_images/1574666257781104641/hWG0vkSQ_400x400.jpg",ref_id:"b00877d0-ccbe-4c77-9c8c-88ab15063150",twitter_handle:"justin_rezvani"},{name:"Lyle Pratt",profile_picture:"https://pbs.twimg.com/profile_images/1477702801962721285/KqnrA7oU_400x400.jpg",ref_id:"ab752a01-84bb-4260-a683-2eb5798b1dce",twitter_handle:"lylepratt"},{name:"Keyan Kousha",profile_picture:"https://pbs.twimg.com/profile_images/1403763601391951878/ybuppfHt_400x400.jpg",ref_id:"7ef39c9b-63ba-4dd0-989e-2230afb45129",twitter_handle:"k00bideh"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b29c81c8-cccd-4a6b-b78f-3c1591a54d27.jpg",node_type:"episode",ref_id:"8eef2f82-bbf9-4fef-ba3d-102679d4a1a5",show_title:"Austin Bitcoin Club"},{children:["b9fd54d3-49e8-44e1-a208-7780d50a3b3a"],episode_title:"Synonym Spaces Lightning Tokens",guests:[{name:"Paolo Ardoino",profile_picture:"https://pbs.twimg.com/profile_images/1583467513198923781/nCWMWFIn_400x400.jpg",ref_id:"9bb3e215-6065-4fe2-aac5-2b1d5545d48c",twitter_handle:"paoloardoino"},{name:"John Carvalho",profile_picture:"https://pbs.twimg.com/profile_images/1601964735016177676/c1mAfspt_400x400.jpg",ref_id:"f28f037f-a3af-48af-bdd3-28023219b524",twitter_handle:"BitcoinErrorLog"},{name:"Reza Bandegi",profile_picture:"https://pbs.twimg.com/profile_images/1446675390370500614/4LGHNSkl_400x400.jpg",ref_id:"ead50c13-2f13-4ffc-86b5-5a3eb49a5804",twitter_handle:"r32a_"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/63e0cbc0-731d-4ea0-9dd2-2b8b841eb28a.jpg",node_type:"episode",ref_id:"a1e3c3cf-2045-4c33-8152-0e162b7ca729",show_title:"Synonym"},{children:["d98bc278-4c35-4325-992c-78437ccf3569","144eff69-fd7a-48da-b92f-bb5b13e0b4f7","9f9305dd-fff2-4bb3-9e3f-698a55090999"],episode_title:"Blockware Intelligence Podcast: 2022 Highlights",guests:[{name:"Michael",profile_picture:"https://pbs.twimg.com/profile_images/1558687629599657990/vf-bU14b_400x400.jpg",ref_id:"c7b4faa1-db77-4459-b03f-0e41e15efae7",twitter_handle:"MichaelHawaii"},{name:"Cory Klippsten",profile_picture:"https://pbs.twimg.com/profile_images/1569687200857755648/fxiCeaqc_400x400.jpg",ref_id:"ddfb9b4c-4e6a-4f4c-a01b-e6bb1bc55464",twitter_handle:"coryklippsten"},{name:"Joe Consorti",profile_picture:"https://pbs.twimg.com/profile_images/1596902707511664640/GYGWVDts_400x400.jpg",ref_id:"8d2024b2-03bb-454d-9bd6-bb121904b76a",twitter_handle:"JoeConsorti"},{name:"Jeff Booth",profile_picture:"https://pbs.twimg.com/profile_images/1362957991410954241/spiaMAg2_400x400.jpg",ref_id:"f1143bcc-9ab9-4716-8259-0e5b026f8039",twitter_handle:"JeffBooth"},{name:"James Lavish",profile_picture:"https://pbs.twimg.com/profile_images/1466279082157502464/flD6cWI3_400x400.jpg",ref_id:"cf06ab2d-2ff3-4d7b-bef6-b996ae68517a",twitter_handle:"jameslavish"},{name:"Adam O",profile_picture:"https://pbs.twimg.com/profile_images/1395896857990160391/tJpgS2_p_400x400.jpg",ref_id:"95af0dd3-1e27-41b9-a36b-8a2c44438e85",twitter_handle:"denverbitcoin"},{name:"Jack Mallers",profile_picture:"https://pbs.twimg.com/profile_images/1599778945699909632/O0qc9ykA_400x400.jpg",ref_id:"d2e4aac5-e5e1-42fc-8f08-b3a77c076a64",twitter_handle:"jackmallers"},{name:"Lyn Alden",profile_picture:"https://pbs.twimg.com/profile_images/1521181379677073414/bm4LcJTr_400x400.jpg",ref_id:"903381dd-4b8a-4b59-8ecd-3281ae3ba297",twitter_handle:"LynAldenContact"},{name:"Dylan LeClair",profile_picture:"https://pbs.twimg.com/profile_images/1508157904913899522/3l7ctauV_400x400.jpg",ref_id:"283edea0-55cf-4245-95df-8d6d3dcb1851",twitter_handle:"DylanLeClair_"},{name:"Jeff Ross",profile_picture:"https://pbs.twimg.com/profile_images/1475554600094552064/DSlPG1lx_400x400.jpg",ref_id:"ae6ee2a2-1cf7-41a0-8366-ff6e94a6403c",twitter_handle:"VailshireCap"},{name:"Stacy Herbert",profile_picture:"https://pbs.twimg.com/profile_images/1546484196750905346/5WYPz-bc_400x400.jpg",ref_id:"7477463b-1f3a-4b83-94c3-9d5a63b576c0",twitter_handle:"Stacyherbert"},{name:"Greg Foss",profile_picture:"https://pbs.twimg.com/profile_images/1552599670945464320/3OgqRHNo_400x400.jpg",ref_id:"853d9f80-f6cf-490f-9d1e-f29cdc6acc6f",twitter_handle:"FossGregfoss"},{name:"Preston Pysh",profile_picture:"https://pbs.twimg.com/profile_images/1408783276081299462/f4Ye5n7-_400x400.jpg",ref_id:"01ad2c81-2d0c-44a9-93a1-42c07287aa80",twitter_handle:"PrestonPysh"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ea2cf2ae-76de-4185-818c-384b3b06228b.jpg",node_type:"episode",ref_id:"e06b030a-063e-4894-9914-d326220f75f8",show_title:"Blockware Intelligence"},{children:["87520be0-ad60-48d0-aba6-44aec1452a09"],episode_title:"A Christmas Trip! | EP 20",guests:[{name:"Erik Cason",profile_picture:"https://pbs.twimg.com/profile_images/1528431738145361921/roDCkAUy_400x400.jpg",ref_id:"345e1da8-42ed-442b-8b90-ecb44bab61a1",twitter_handle:"Erikcason"},{name:"FractalEncrypt",profile_picture:"https://pbs.twimg.com/profile_images/1588218887807680512/lFJArP4n_400x400.jpg",ref_id:"888ea071-8312-4aca-b229-7447217e59f0",twitter_handle:"FractalEncrypt"}],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e79b1a57-ecd0-4df3-b8ec-1a1a55d047e7.jpg",node_type:"episode",ref_id:"b707bbd8-1a9e-4aee-8e0e-2fe0be24c851",show_title:"Pleb UnderGround"},{children:["d4948551-6ec5-4649-a700-364592e09edd","25e36282-297b-4f9d-b6e9-da65731be8a8","53cab9be-0f22-42a2-aef5-87920c2431cf","6028f484-d0b9-424a-87e5-d0dcb39f9fc7","092e9794-afc9-41fe-a635-4802777415a1","092e9794-afc9-41fe-a635-4802777415a1","36f1f7e1-df70-4528-8474-4bba448b1ed0","36f1f7e1-df70-4528-8474-4bba448b1ed0","6d267cc1-22b1-42fc-9b60-9701e64a75d0","6d267cc1-22b1-42fc-9b60-9701e64a75d0"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/7de0d293-8ae3-4362-8500-8f7300f3fe41.jpg",node_type:"show",ref_id:"7de0d293-8ae3-4362-8500-8f7300f3fe41",show_title:"Unchained"},{children:["a7afaa66-6878-40c2-97fd-88a20ae007fd","910f5aab-7896-4c19-8649-64dcef44c369"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4e607036-8fde-48ef-ab76-9c2ac4bab031.jpg",node_type:"show",ref_id:"4e607036-8fde-48ef-ab76-9c2ac4bab031",show_title:"What Bitcoin Did with Peter McCormack"},{children:["47c54384-785c-4a4b-bad1-cac242d8f190","aa033894-120f-494e-9d6b-c6d62dfb0a69","aa033894-120f-494e-9d6b-c6d62dfb0a69","53402b84-7b30-4fec-a741-d9ef8fa03389","53402b84-7b30-4fec-a741-d9ef8fa03389","53402b84-7b30-4fec-a741-d9ef8fa03389","3a9db5f7-6722-469c-a0c6-6b157f44f33f","3a9db5f7-6722-469c-a0c6-6b157f44f33f","3a9db5f7-6722-469c-a0c6-6b157f44f33f"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/9e7e229f-2631-4542-b5d7-7fcd502798dc.jpg",node_type:"show",ref_id:"9e7e229f-2631-4542-b5d7-7fcd502798dc",show_title:"Bitcoin Audible"},{children:["fccdc763-2b69-4418-9a7a-78cdfe615ba9"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b6c52903-5124-43f4-8632-bc9aeb941f2e.jpg",node_type:"show",ref_id:"b6c52903-5124-43f4-8632-bc9aeb941f2e",show_title:"The Kevin Rooke Show"},{children:["ae631d96-3b81-4308-bcc1-a57f81339b5c","ae631d96-3b81-4308-bcc1-a57f81339b5c","4bea6c89-43b4-4e5e-9fea-0662d9ee7c00","4bea6c89-43b4-4e5e-9fea-0662d9ee7c00"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b79a3eb8-bcd0-4338-b979-d32aef360785.jpg",node_type:"show",ref_id:"b79a3eb8-bcd0-4338-b979-d32aef360785",show_title:"Stephan Livera Podcast"},{children:["46277681-3564-4504-9ca8-e2f41d658d28","b05fa33c-fc91-4b55-a592-85eaa1a5b3fd","b723d81b-9c99-4797-b3a8-67f824924f0c","eaeec64e-8e03-4826-a7c5-e1969a71ca2d","922ae599-5631-4ffe-977e-a9174fc028bb","b534755c-92b6-4df1-b1f9-a28578661f48","b317d76a-25e6-42f6-bc97-3de9f6c3f081","94e1df77-e561-4361-b8ad-e98862d6e51a","94e1df77-e561-4361-b8ad-e98862d6e51a","94e1df77-e561-4361-b8ad-e98862d6e51a","10c6d370-de6e-4a37-9981-d2c27e69d9e0","a52e09df-91bc-4997-ad65-725ee971af2b","a52e09df-91bc-4997-ad65-725ee971af2b","95403824-42d5-4fe8-b50b-72e08ab368c8","2e6613fa-ef17-413b-9158-0e3be5d5ae51","2e6613fa-ef17-413b-9158-0e3be5d5ae51","2e6613fa-ef17-413b-9158-0e3be5d5ae51","c0895c34-042b-4f51-a884-2330d9f83bc7","638c47da-8592-4d7b-aa1a-20e28fa0499f","638c47da-8592-4d7b-aa1a-20e28fa0499f","2e84c98a-d7d8-4341-a129-3f4eaebe1e3e","6b8fbd46-fa4a-4d07-a142-9aeb242d249f","f3b67780-d9c2-4a20-ab5c-115032a05b3a","f3b67780-d9c2-4a20-ab5c-115032a05b3a","1bf7b1ea-f717-4c0f-ae66-0e00b26603df","7070839d-051e-48e4-bd9a-95c09b310db2","728d91e9-025d-43a7-8467-2c8d264ddf59","728d91e9-025d-43a7-8467-2c8d264ddf59","c8ae0def-c33c-4d17-af4e-31ddaeedaf8a","c8ae0def-c33c-4d17-af4e-31ddaeedaf8a","c8ae0def-c33c-4d17-af4e-31ddaeedaf8a","c8ae0def-c33c-4d17-af4e-31ddaeedaf8a","b87feb17-6926-4295-b2c2-d1c2e9d49ca8","b87feb17-6926-4295-b2c2-d1c2e9d49ca8","b87feb17-6926-4295-b2c2-d1c2e9d49ca8","f29a41a4-6764-439e-9fcf-74fefaffc681","065c0900-4e3c-48a0-87b8-4068dc441c82","87cd8227-9464-45ed-8512-4e545d3812c2","2f714adf-e499-4c1f-9864-016a00737153","bbf0a536-990b-49b4-a9c3-a2a40fa38f88","bbf0a536-990b-49b4-a9c3-a2a40fa38f88","0ade0cc4-6303-4e28-8b00-6b3e659c1e3a","9523aa00-daf4-42af-b25b-75d9682bc5a6"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/419512c2-e309-4b25-bfe2-cd481d53f66d.jpg",node_type:"show",ref_id:"419512c2-e309-4b25-bfe2-cd481d53f66d",show_title:"BTC Sessions"},{children:["919ca76f-b3c7-48f1-9f5f-872537d43632"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/7934bd86-9344-4f1a-9c36-ea5f63ae418e.jpg",node_type:"show",ref_id:"7934bd86-9344-4f1a-9c36-ea5f63ae418e",show_title:"The Pomp Podcast"},{children:["ded2e35d-9fec-4bad-90f7-f3102d4eebd5"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/5fc9c8b0-687f-487e-bde3-bea15e155e3e.jpg",node_type:"show",ref_id:"5fc9c8b0-687f-487e-bde3-bea15e155e3e",show_title:"Bitcoin Takeover Podcast"},{children:["2536a974-d668-4ac2-8613-0b37aa0ca08c","2536a974-d668-4ac2-8613-0b37aa0ca08c","2536a974-d668-4ac2-8613-0b37aa0ca08c","2536a974-d668-4ac2-8613-0b37aa0ca08c","2536a974-d668-4ac2-8613-0b37aa0ca08c"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/3e178b7d-b8b9-4fd4-ba36-017b834537da.jpg",node_type:"show",ref_id:"3e178b7d-b8b9-4fd4-ba36-017b834537da",show_title:"Bitcoin Fixes This"},{children:["43dd10a8-c5d5-4643-9432-93868289f163","6e8b01d5-df4f-4124-a13a-3ee9c93c8eb2","3475140b-3e58-494f-b929-59e6ec5f1636"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/1583c7c4-f4f2-4e52-8f27-a1eaeb6289fd.jpg",node_type:"show",ref_id:"1583c7c4-f4f2-4e52-8f27-a1eaeb6289fd",show_title:"Bitcoin Magazine Podcast"},{children:["68309686-0bf0-4156-8f95-615ba255fdc4","52f31c46-14c5-49f1-9836-70862c6f6567","665facde-c1bd-4091-a071-09e28606b863"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/a09a2c49-84f1-4d0b-b150-6e6103f4ee41.jpg",node_type:"show",ref_id:"a09a2c49-84f1-4d0b-b150-6e6103f4ee41",show_title:"Citadel Dispatch"},{children:["274ecab4-c5d8-4ad7-9e16-b1cb5dd39d13","274ecab4-c5d8-4ad7-9e16-b1cb5dd39d13","933d3953-2983-4a8b-a4dc-e9615eeecb88","8a89a96d-5877-4d00-9e11-c33d19ed7264","8a89a96d-5877-4d00-9e11-c33d19ed7264","8a89a96d-5877-4d00-9e11-c33d19ed7264","249e2426-55d6-473c-bbe0-4bebf74594e9","249e2426-55d6-473c-bbe0-4bebf74594e9","0f13f1e8-6031-4920-86bf-c2fbcaaed641","0f13f1e8-6031-4920-86bf-c2fbcaaed641"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/cd6b8d64-bd52-4f1e-86b3-ca8ba2eb169f.jpg",node_type:"show",ref_id:"cd6b8d64-bd52-4f1e-86b3-ca8ba2eb169f",show_title:"Bitcoin.Review"},{children:["993787ca-ce29-4d5b-b834-37a83ea2125a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/afa24463-19f7-4875-b6f4-b261d1d6c648.jpg",node_type:"show",ref_id:"afa24463-19f7-4875-b6f4-b261d1d6c648",show_title:"Orange Pill Podcast"},{children:["72c4dd20-64fa-4d68-a0bd-ac50207ae1c0","cc447ce2-af39-4938-8ec8-2d70a6cfd851"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/99d17d22-4448-4267-9065-f55b341f43d2.jpg",node_type:"show",ref_id:"99d17d22-4448-4267-9065-f55b341f43d2",show_title:"The Money Movement"},{children:["337981db-17c3-4c4e-8195-26cda6855ead","337981db-17c3-4c4e-8195-26cda6855ead"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ca3ab815-dc2e-408a-a0c5-8bbe50270a97.jpg",node_type:"show",ref_id:"ca3ab815-dc2e-408a-a0c5-8bbe50270a97",show_title:'The "What is Money?" Show'},{children:["b43f377d-6599-421b-af45-a8ecee409420","b43f377d-6599-421b-af45-a8ecee409420"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/abd94520-1490-42aa-b349-9e861494a654.jpg",node_type:"show",ref_id:"abd94520-1490-42aa-b349-9e861494a654",show_title:"Economy Guy"},{children:["705db675-bc09-4cba-b578-e9904f339f55"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/58189b3c-aa25-408d-8c5e-76f97c9501da.jpg",node_type:"show",ref_id:"58189b3c-aa25-408d-8c5e-76f97c9501da",show_title:"Mises University 2017"},{children:["a12faf50-f4fb-472d-b3a1-030747594fa5","a12faf50-f4fb-472d-b3a1-030747594fa5"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/5cdd0aef-f1a7-4d3b-8336-7f81c2db4a40.jpg",node_type:"show",ref_id:"5cdd0aef-f1a7-4d3b-8336-7f81c2db4a40",show_title:"The Bitcoin Standard Podcast"},{children:["87054fe7-6a5c-471a-b518-5e9414d0c644"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4bb9069b-a373-4b1c-9cda-024b2bf4dc84.jpg",node_type:"show",ref_id:"4bb9069b-a373-4b1c-9cda-024b2bf4dc84",show_title:"We Study Billionaires - The Investor’s Podcast Network"},{children:["04dd4023-ed42-4259-921c-e305af656389"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/3325efce-80a8-490c-8645-cad1b9a22d94.jpg",node_type:"show",ref_id:"3325efce-80a8-490c-8645-cad1b9a22d94",show_title:"Crypto Voices"},{children:["c6ecd519-ce8f-45b5-89ca-30a6a017f5d6"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/357dc2db-2643-49f0-9393-5a20ed21d0fe.jpg",node_type:"show",ref_id:"357dc2db-2643-49f0-9393-5a20ed21d0fe",show_title:"The Anita Posch Show: A Bitcoin only podcast"},{children:["b94dbd49-6ac1-497c-8f5b-d13140968920"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/710ac70a-11fc-40ec-a2a2-01b92fb8015e.jpg",node_type:"show",ref_id:"710ac70a-11fc-40ec-a2a2-01b92fb8015e",show_title:"Quoth the Raven"},{children:["406ce1e1-5f39-4c94-907c-eb5e501d2c64"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/da1bbdc0-4d0a-43ed-8345-ee43102db244.jpg",node_type:"show",ref_id:"da1bbdc0-4d0a-43ed-8345-ee43102db244",show_title:"Mercatus Policy Download"},{children:["9585c916-c55a-4284-b348-f8a52c24dc8d","9585c916-c55a-4284-b348-f8a52c24dc8d","9585c916-c55a-4284-b348-f8a52c24dc8d","1d938eb2-3bc2-4268-85d1-8967a1292a18","1d938eb2-3bc2-4268-85d1-8967a1292a18"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/93a6fe5b-364c-43f4-9f38-7da3e811460b.jpg",node_type:"show",ref_id:"93a6fe5b-364c-43f4-9f38-7da3e811460b",show_title:"CRYPTO 101"},{children:["50ab3e37-ccb3-4902-825b-a9da36579707","50ab3e37-ccb3-4902-825b-a9da36579707","50ab3e37-ccb3-4902-825b-a9da36579707"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/6ec51741-3d93-4116-a619-d62a7cee1feb.jpg",node_type:"show",ref_id:"6ec51741-3d93-4116-a619-d62a7cee1feb",show_title:"Radio Rothbard"},{children:["8ec14282-c5bc-4da6-b516-3140efaf6b8f","8ec14282-c5bc-4da6-b516-3140efaf6b8f","8ec14282-c5bc-4da6-b516-3140efaf6b8f","8ec14282-c5bc-4da6-b516-3140efaf6b8f","2fee3ffd-e6f5-4fbf-9cac-2b8977b93b79"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f2b2a2b2-8869-4256-94b9-a91c91c1ce7e.jpg",node_type:"show",ref_id:"f2b2a2b2-8869-4256-94b9-a91c91c1ce7e",show_title:"Economics For Business"},{children:["a77be405-8402-477a-9d72-b96d1e7ea63b","32aad837-d99a-4b5a-b6ea-e12c590b925a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ef62c7ab-ef09-47b7-9af4-2ebe2384a72f.jpg",node_type:"show",ref_id:"ef62c7ab-ef09-47b7-9af4-2ebe2384a72f",show_title:"Austrian Economics: An Introductory Course"},{children:["62e4eee0-25ba-495a-a7e6-dd0685a75d13","23ea78f2-8e21-42fe-980a-8c6ff04c2748","23ea78f2-8e21-42fe-980a-8c6ff04c2748","b51b127d-9641-42a7-aac5-bd5b1228f52a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/8e52e9c4-52e8-4dea-8ed9-8c6a7fcef25a.jpg",node_type:"show",ref_id:"8e52e9c4-52e8-4dea-8ed9-8c6a7fcef25a",show_title:"The Macro View"},{children:["f18bb143-9582-41f3-b65b-1dbe8de6cfc3"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/3ab6c599-bbcd-4c8f-beef-bcf509ed4afa.jpg",node_type:"show",ref_id:"3ab6c599-bbcd-4c8f-beef-bcf509ed4afa",show_title:"Voices of the Data Economy"},{children:["14dbb9b7-ec35-49e5-bbb9-1f2d626a5d6f"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/5e0220b3-7c70-4423-bb76-3b75bc132fad.jpg",node_type:"show",ref_id:"5e0220b3-7c70-4423-bb76-3b75bc132fad",show_title:"Carnivore Cast"},{children:["c6996d2f-8541-4622-968f-4e4dee7f78e4","41f7e1a4-f5b9-4a7e-8dbd-ee3fcb15260f"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/a8e3517b-b44d-4270-adaa-57587896b1e7.jpg",node_type:"show",ref_id:"a8e3517b-b44d-4270-adaa-57587896b1e7",show_title:"Keto Life Support"},{children:["4b228b78-99c7-4884-b91d-9dc711bde8e6"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4ae5cf53-106f-4ba8-9a77-3ef1de3b44b6.jpg",node_type:"show",ref_id:"4ae5cf53-106f-4ba8-9a77-3ef1de3b44b6",show_title:"Trading Bitcoin: The Tone Vays Podcast"},{children:["556a9506-357d-4dea-a6bb-75f391f7340d"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/1c3fe064-f637-41ea-8a4b-a533ef5985b1.jpg",node_type:"show",ref_id:"1c3fe064-f637-41ea-8a4b-a533ef5985b1",show_title:"aantonop"},{children:["1b47b05f-8f86-4e19-9694-d4255e9e89ac","1b47b05f-8f86-4e19-9694-d4255e9e89ac"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/56bbafde-60ef-4e4b-b930-978429c6a635.jpg",node_type:"show",ref_id:"56bbafde-60ef-4e4b-b930-978429c6a635",show_title:"Global Bitcoin Fest"},{children:["a0826cdb-6198-4416-bd12-1dd5aa09a075","c6447277-9a58-411f-85e1-5ac166884ce5","c6447277-9a58-411f-85e1-5ac166884ce5","c6447277-9a58-411f-85e1-5ac166884ce5","c6447277-9a58-411f-85e1-5ac166884ce5","8418f2a4-1874-403a-9e58-7a76a8e09d4f","a7dcf3bf-b9f2-41f1-a3f3-ffd2db3a0b96","a7dcf3bf-b9f2-41f1-a3f3-ffd2db3a0b96","a7dcf3bf-b9f2-41f1-a3f3-ffd2db3a0b96","47406d36-917a-47f7-b89e-26181d6070bc","47406d36-917a-47f7-b89e-26181d6070bc","47406d36-917a-47f7-b89e-26181d6070bc","dc7b8177-4cef-4da2-bb05-b12dfe4c05bb","dc7b8177-4cef-4da2-bb05-b12dfe4c05bb","dc7b8177-4cef-4da2-bb05-b12dfe4c05bb","dc7b8177-4cef-4da2-bb05-b12dfe4c05bb"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/9b2e17f2-71c5-4f1e-a3e7-720d06dab810.jpg",node_type:"show",ref_id:"9b2e17f2-71c5-4f1e-a3e7-720d06dab810",show_title:"Satoshi’s Journal"},{children:["fb60247a-9b2e-41d4-83f4-f4cf92eb20f4","fb60247a-9b2e-41d4-83f4-f4cf92eb20f4","fb60247a-9b2e-41d4-83f4-f4cf92eb20f4","87a2efa8-6b4c-486d-8511-d6a95cb84514","87a2efa8-6b4c-486d-8511-d6a95cb84514","87a2efa8-6b4c-486d-8511-d6a95cb84514","87a2efa8-6b4c-486d-8511-d6a95cb84514","87a2efa8-6b4c-486d-8511-d6a95cb84514","de9ef389-d0ee-4ce1-ad23-38bfafa28a35","de9ef389-d0ee-4ce1-ad23-38bfafa28a35"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/0c42d408-e518-4ecf-b282-d864a8c14002.jpg",node_type:"show",ref_id:"0c42d408-e518-4ecf-b282-d864a8c14002",show_title:"PUBLORD"},{children:["94726593-cead-47f6-8029-6848f277358c","2c2ac736-0711-4418-8a44-6f9de54cbe6f","2c2ac736-0711-4418-8a44-6f9de54cbe6f","2c2ac736-0711-4418-8a44-6f9de54cbe6f","883300ba-aeb4-42e5-bbd2-7c989e481a3b","883300ba-aeb4-42e5-bbd2-7c989e481a3b","883300ba-aeb4-42e5-bbd2-7c989e481a3b","883300ba-aeb4-42e5-bbd2-7c989e481a3b","a41902c1-9f41-4ea4-b135-0d2078f6074b","6334a91f-b1db-4f05-a381-bc68b121dfb3","3b7e4cc5-bc15-45e9-bb7a-373fa4cca6f1","3b7e4cc5-bc15-45e9-bb7a-373fa4cca6f1","3b7e4cc5-bc15-45e9-bb7a-373fa4cca6f1","3b7e4cc5-bc15-45e9-bb7a-373fa4cca6f1","3b7e4cc5-bc15-45e9-bb7a-373fa4cca6f1","f8a66979-3fac-4793-bad0-8ede604e211b","1d671494-3407-4619-92b0-99c7d6f95f86","9ae3fabe-5d43-47bc-9ab0-541df990773a","a119635b-a66a-4a90-a7e3-2a7929666a82","a119635b-a66a-4a90-a7e3-2a7929666a82","a119635b-a66a-4a90-a7e3-2a7929666a82","a119635b-a66a-4a90-a7e3-2a7929666a82","6fe2326f-7cad-4efb-abed-206db564556e","6fe2326f-7cad-4efb-abed-206db564556e","141ef1e6-e6ec-4d29-a52a-01be662b21ae","141ef1e6-e6ec-4d29-a52a-01be662b21ae","141ef1e6-e6ec-4d29-a52a-01be662b21ae","15cae8e2-7cb3-4c60-9b3a-32cb4b231c26","15cae8e2-7cb3-4c60-9b3a-32cb4b231c26","3bc946bc-82f4-48d3-9bd2-fab82353774d","3bc946bc-82f4-48d3-9bd2-fab82353774d","3bc946bc-82f4-48d3-9bd2-fab82353774d","3bc946bc-82f4-48d3-9bd2-fab82353774d","3bc946bc-82f4-48d3-9bd2-fab82353774d","80617a1c-8bf7-404d-928c-86fc32d643fe","80617a1c-8bf7-404d-928c-86fc32d643fe","d28e279c-4539-4ec8-b187-1b6447bdb6be"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/239722cb-4216-414a-a17b-5adf9d52e15a.jpg",node_type:"show",ref_id:"239722cb-4216-414a-a17b-5adf9d52e15a",show_title:"Swan.com"},{children:["aba10d42-f204-4853-99c4-c8a22f846945","6c6c782e-382c-44c3-9b0a-5c598ef73ddc"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f3a55dda-3dd5-4f62-99c1-bab3a88c27c1.jpg",node_type:"show",ref_id:"f3a55dda-3dd5-4f62-99c1-bab3a88c27c1",show_title:"Bitcoin Magazine"},{children:["7bebf6d3-5f24-4988-9141-7ed42c826983","7bebf6d3-5f24-4988-9141-7ed42c826983"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/7c53ad3c-1ce2-4661-8896-4c40dcc23b4d.jpg",node_type:"show",ref_id:"7c53ad3c-1ce2-4661-8896-4c40dcc23b4d",show_title:"Blockware Solutions"},{children:["de789489-56bc-4012-b7c3-9dc92a937161","62ca7c93-e509-438e-87b3-43400a320f8d","62ca7c93-e509-438e-87b3-43400a320f8d","62ca7c93-e509-438e-87b3-43400a320f8d"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/624262ef-b30f-4114-8061-e310187e6bb4.jpg",node_type:"show",ref_id:"624262ef-b30f-4114-8061-e310187e6bb4",show_title:"Property and Freedom Society"},{children:["0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7","0992287c-f653-4032-b06c-e8d65e2536e7"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/c9bb5d58-c781-464d-878a-8b6c469ba198.jpg",node_type:"show",ref_id:"c9bb5d58-c781-464d-878a-8b6c469ba198",show_title:"Geyser 🌊"},{children:["79ea2957-1161-4729-aacb-1981d9237e22","79ea2957-1161-4729-aacb-1981d9237e22","79ea2957-1161-4729-aacb-1981d9237e22","79ea2957-1161-4729-aacb-1981d9237e22"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/75ec86b1-cb6d-467f-a66e-5e642e5c126a.jpg",node_type:"show",ref_id:"75ec86b1-cb6d-467f-a66e-5e642e5c126a",show_title:"Bitcoin Venetians Book Club"},{children:["c0dabc11-aced-4078-93be-bca753fc2b14","c0dabc11-aced-4078-93be-bca753fc2b14","c0dabc11-aced-4078-93be-bca753fc2b14","c0dabc11-aced-4078-93be-bca753fc2b14","c0dabc11-aced-4078-93be-bca753fc2b14","d2e9db27-864c-4ee5-a7ae-abcf895bda98","d2e9db27-864c-4ee5-a7ae-abcf895bda98","d2e9db27-864c-4ee5-a7ae-abcf895bda98","d2e9db27-864c-4ee5-a7ae-abcf895bda98","d2e9db27-864c-4ee5-a7ae-abcf895bda98","6e8c90dc-12fa-415d-bf33-f286a4c5d1b1","6e8c90dc-12fa-415d-bf33-f286a4c5d1b1"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ae91fac6-a1af-4877-9a92-e793d556ee66.jpg",node_type:"show",ref_id:"ae91fac6-a1af-4877-9a92-e793d556ee66",show_title:"Compass Mining"},{children:["5c8bc8cf-4d41-4c71-8154-aafbd1ed20c1","f7310238-67ab-4a2d-8679-72f6511934be","f7310238-67ab-4a2d-8679-72f6511934be","f7310238-67ab-4a2d-8679-72f6511934be","f7310238-67ab-4a2d-8679-72f6511934be","99f0ab76-b0f5-4947-8341-759b5dff5341","99f0ab76-b0f5-4947-8341-759b5dff5341","99f0ab76-b0f5-4947-8341-759b5dff5341","c775e780-43ca-46c6-b5ef-e65b0103ee61","c775e780-43ca-46c6-b5ef-e65b0103ee61"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/965489b4-a414-4fd0-ab8c-55911b1596aa.jpg",node_type:"show",ref_id:"965489b4-a414-4fd0-ab8c-55911b1596aa",show_title:"BOLT FUN"},{children:["54fa34c9-0729-42ab-92d5-e5f8289ed32a","54fa34c9-0729-42ab-92d5-e5f8289ed32a","54fa34c9-0729-42ab-92d5-e5f8289ed32a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2a1450bc-0649-4dc5-8ec9-1474af1ea1c3.jpg",node_type:"show",ref_id:"2a1450bc-0649-4dc5-8ec9-1474af1ea1c3",show_title:"Anders_🍆"},{children:["258c5ca5-52a6-4ce3-9994-e629263123d8"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4127f08c-505a-4a7d-935f-e93e87204089.jpg",node_type:"show",ref_id:"4127f08c-505a-4a7d-935f-e93e87204089",show_title:"Wicked Smart Bitcoin ∞/21M"},{children:["08c3748a-a85d-4d4f-a702-1fc3f1c46f33"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b2dd8be4-74b5-47b2-b470-e568657f3a0d.jpg",node_type:"show",ref_id:"b2dd8be4-74b5-47b2-b470-e568657f3a0d",show_title:"Art of Tomas"},{children:["d862511e-6330-48b3-9d4a-44e8f754f0a5","d862511e-6330-48b3-9d4a-44e8f754f0a5","d862511e-6330-48b3-9d4a-44e8f754f0a5"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e8ad867b-9cbe-4126-9f37-313b4d2329a5.jpg",node_type:"show",ref_id:"e8ad867b-9cbe-4126-9f37-313b4d2329a5",show_title:"Dr Karl Goldkamp - Keto Naturopath"},{children:["21d1d401-626c-4ec2-ba30-3c08f08ec3ea","21d1d401-626c-4ec2-ba30-3c08f08ec3ea"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/046c6869-0627-4825-8ecf-45ff0aed97b6.jpg",node_type:"show",ref_id:"046c6869-0627-4825-8ecf-45ff0aed97b6",show_title:"Alexandria The Great 🌋⛏🇿🇼"},{children:["18e340ea-90ef-4200-a19d-dc82e1e18e21"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/30180c4d-27f9-4215-81e0-6a22b16aba43.jpg",node_type:"show",ref_id:"30180c4d-27f9-4215-81e0-6a22b16aba43",show_title:"okin@8333.mobi ⚡️ 🏰"},{children:["9f12b8c2-175e-4078-9871-99a2edf2e0f3","9f12b8c2-175e-4078-9871-99a2edf2e0f3","9f12b8c2-175e-4078-9871-99a2edf2e0f3","9f12b8c2-175e-4078-9871-99a2edf2e0f3"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/99046513-2614-4eae-9de4-5781ba4b330a.jpg",node_type:"show",ref_id:"99046513-2614-4eae-9de4-5781ba4b330a",show_title:"STX:LDN"},{children:["03b5ca12-0aeb-4f04-aed0-746681d93b56"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/da64b29e-c2c0-41a6-ba29-acbaa2d022e8.jpg",node_type:"show",ref_id:"da64b29e-c2c0-41a6-ba29-acbaa2d022e8",show_title:"Rabbit Hole Recap"},{children:["70bb863d-7226-4b9e-b13e-673f94a3eb86","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3","06494953-4c8e-4376-9450-9efb8b00acc3"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e1eca67b-d372-4031-bf1f-8f0ff7fe6092.jpg",node_type:"show",ref_id:"e1eca67b-d372-4031-bf1f-8f0ff7fe6092",show_title:`Once Bitten! A Bitcoin Podcast. -`},{children:["9dcca755-0a20-45e5-8e4d-dfe2800b9c6f","9dcca755-0a20-45e5-8e4d-dfe2800b9c6f"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/fe6bdbce-e91d-43cf-ab33-0e98bffabecc.jpg",node_type:"show",ref_id:"fe6bdbce-e91d-43cf-ab33-0e98bffabecc",show_title:"Bitcoin Charlotte"},{children:["b8289cbb-ec69-49a8-b6ab-c1fd808acc09"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4240c90e-0086-4ece-bfe5-84a282c5059e.jpg",node_type:"show",ref_id:"4240c90e-0086-4ece-bfe5-84a282c5059e",show_title:"Thriller Bitcoin"},{children:["daddd93e-7bc6-4c50-a150-5199b437afc9"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/24a144b0-7ca3-40e9-9c42-86b9fce0b662.jpg",node_type:"show",ref_id:"24a144b0-7ca3-40e9-9c42-86b9fce0b662",show_title:"The Chaincode Podcast"},{children:["56bf65e9-41d5-42e1-95d6-239e4c835781","56bf65e9-41d5-42e1-95d6-239e4c835781","56bf65e9-41d5-42e1-95d6-239e4c835781","ff88a8b8-bcd6-4d86-8a65-8a68def35b9f","810a3acb-e30e-46bc-8c67-1d504b2e7c09","810a3acb-e30e-46bc-8c67-1d504b2e7c09"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f1879df9-9bc6-4a76-951f-24548da768ef.jpg",node_type:"show",ref_id:"f1879df9-9bc6-4a76-951f-24548da768ef",show_title:"Bitcoin.Review Podcast with NVK & Guests"},{children:["f7e75069-adf6-41b0-9bb7-a6a2aa846493","f7e75069-adf6-41b0-9bb7-a6a2aa846493","6eb2a481-408f-4989-9f28-67789651259a","89049a1c-0171-4999-b003-57e1b57d92b2","d842ce17-a4c0-49a6-bdc5-5268f1d61779","8d9b0689-2e69-44c1-afe2-3519e999390a","8d9b0689-2e69-44c1-afe2-3519e999390a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"show",ref_id:"e7d2a4ca-6b44-4a45-a94c-6f48987979f7",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["3b818893-4605-499c-a467-5abcc23f9483","3b818893-4605-499c-a467-5abcc23f9483","3b818893-4605-499c-a467-5abcc23f9483","a44e78cd-dc66-4b67-9523-7ddff0d3655f","a44e78cd-dc66-4b67-9523-7ddff0d3655f","0c4f330b-a39d-4312-9775-58b42c7c9723","0c4f330b-a39d-4312-9775-58b42c7c9723","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","a60dc641-5d14-4960-ab73-66ff199edd1d"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"show",ref_id:"2ec62250-4755-4616-8342-096a2cfab95f",show_title:"Voltage"},{children:["3af98dc1-5e7c-4ef3-ad74-b9b6afaee8b9","625d9252-2f5e-4f53-b577-dd2dfd4d4749"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/492cbcce-3744-4d8b-b2ca-3a7f063e798a.jpg",node_type:"show",ref_id:"492cbcce-3744-4d8b-b2ca-3a7f063e798a",show_title:"Swan Bitcoin"},{children:["8eef2f82-bbf9-4fef-ba3d-102679d4a1a5"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b29c81c8-cccd-4a6b-b78f-3c1591a54d27.jpg",node_type:"show",ref_id:"b29c81c8-cccd-4a6b-b78f-3c1591a54d27",show_title:"Austin Bitcoin Club"},{children:["a1e3c3cf-2045-4c33-8152-0e162b7ca729"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/63e0cbc0-731d-4ea0-9dd2-2b8b841eb28a.jpg",node_type:"show",ref_id:"63e0cbc0-731d-4ea0-9dd2-2b8b841eb28a",show_title:"Synonym"},{children:["e06b030a-063e-4894-9914-d326220f75f8","e06b030a-063e-4894-9914-d326220f75f8","e06b030a-063e-4894-9914-d326220f75f8"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ea2cf2ae-76de-4185-818c-384b3b06228b.jpg",node_type:"show",ref_id:"ea2cf2ae-76de-4185-818c-384b3b06228b",show_title:"Blockware Intelligence"},{children:["b707bbd8-1a9e-4aee-8e0e-2fe0be24c851"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e79b1a57-ecd0-4df3-b8ec-1a1a55d047e7.jpg",node_type:"show",ref_id:"e79b1a57-ecd0-4df3-b8ec-1a1a55d047e7",show_title:"Pleb UnderGround"}],related:[{episode_title:"The Orange Sun ☀️ #Bitcoin vs. Fiat",ref_id:"e5b1ad5b-2ce2-4192-a6d9-e99f0e3e88b5",show_title:"Satoshi’s Journal"},{episode_title:"Orange Sun 🌞 Why Ethereum is a shitcoin/scam & Bitcoin News",ref_id:"0645c5a3-b511-471d-9d8e-ef63b4dfe340",show_title:"Satoshi’s Journal"},{episode_title:"#Bitcoin Beats⚡🎶 by @SatoshisJournal Genesis Block walkthrough",ref_id:"aba7b4db-77bb-40c4-a0d4-4ce20da7b9ba",show_title:"Satoshi’s Journal"},{episode_title:"The Orange Sun 🌞 Does Price = Value? #Bitcoin",ref_id:"a0826cdb-6198-4416-bd12-1dd5aa09a075",show_title:"Satoshi’s Journal"},{episode_title:"#Bitcoin Beats⚡🎶 by @SatoshisJournal w @NEEDcreations & @DJSATOSHI18",ref_id:"fd00f285-c11e-40ba-8af9-b67265ac321b",show_title:"Satoshi’s Journal"},{episode_title:'The Orange Sun ☀️ Reading/Discussion of "The Book of Satoshi."',ref_id:"fcbe1196-c55d-476f-92d6-4dcba954eaf3",show_title:"Satoshi’s Journal"},{episode_title:'The Orange 🌞 Reading/Discussion "The Book of Satoshi" & Bitcoin News',ref_id:"c6447277-9a58-411f-85e1-5ac166884ce5",show_title:"Satoshi’s Journal"},{episode_title:"The Orange Sun 🌞 Bitcoin News and Talk - Happy Holidays!",ref_id:"d0b59017-ae64-47d4-be5c-c1531c9d480f",show_title:"Satoshi’s Journal"},{episode_title:`The Orange Sun 🌞 Reading/Discussion Tomer Strolight's "Why Bitcoin?"`,ref_id:"95848760-3863-4595-b049-f25826eba2d3",show_title:"Satoshi’s Journal"}]},typesWeighedByChildren=["show","episode"],getSuperficialNodeWeight=(tt,et)=>{var rt;return tt.weight?tt.weight:typesWeighedByChildren.includes(tt.node_type)?((rt=tt==null?void 0:tt.children)==null?void 0:rt.length)||0:et.filter(it=>it.sourceRef===tt.ref_id||it.targetRef===tt.ref_id).length},getMaxSuperficialWeightPerNodeType=(tt,et)=>{const nt={};return tt.forEach(rt=>{const it=getSuperficialNodeWeight(rt,et);(!nt[rt.node_type]||nt[rt.node_type]tt.clone().normalize().clone().negate().normalize().multiplyScalar(et).add(tt),getPositionFromLngLat=(tt,et,nt)=>{const rt=et*Math.PI/180,it=(tt-180)*Math.PI/180,ot=-nt*Math.cos(rt)*Math.cos(it),at=nt*Math.sin(rt),st=nt*Math.cos(rt)*Math.sin(it);return new Vector3(ot,at,st)},generateEarthGraphPositions=tt=>{const et=tt.map(rt=>{const{longitude:it,latitude:ot}=rt.longitude&&rt.latitude?rt:{longitude:getRandomLngLat(),latitude:getRandomLngLat()},at=getPositionFromLngLat(it,ot,dataRadius);return{...rt,...at}}),nt=generateLinksFromNodeData(et,!0,!0);return{nodes:et,links:nt}};function forceCenter(tt,et,nt){var rt,it=1;tt==null&&(tt=0),et==null&&(et=0),nt==null&&(nt=0);function ot(){var at,st=rt.length,lt,ct=0,ut=0,ht=0;for(at=0;at=(lt=(at+st)/2))?at=lt:st=lt,rt=it,!(it=it[ht=+ut]))return rt[ht]=ot,tt;if(ct=+tt._x.call(null,it.data),et===ct)return ot.next=it,rt?rt[ht]=ot:tt._root=ot,tt;do rt=rt?rt[ht]=new Array(2):tt._root=new Array(2),(ut=et>=(lt=(at+st)/2))?at=lt:st=lt;while((ht=+ut)==(dt=+(ct>=lt)));return rt[dt]=it,rt[ht]=ot,tt}function addAll$2(tt){Array.isArray(tt)||(tt=Array.from(tt));const et=tt.length,nt=new Float64Array(et);let rt=1/0,it=-1/0;for(let ot=0,at;otit&&(it=at));if(rt>it)return this;this.cover(rt).cover(it);for(let ot=0;ottt||tt>=nt;)switch(at=+(ttat||(ot=ct.x1)=ht))&&(ct=st[st.length-1],st[st.length-1]=st[st.length-1-ut],st[st.length-1-ut]=ct)}else{var dt=Math.abs(tt-+this._x.call(null,lt.data));dt=(ct=(at+st)/2))?at=ct:st=ct,et=nt,!(nt=nt[ht=+ut]))return this;if(!nt.length)break;et[ht+1&1]&&(rt=et,dt=ht)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[ht]=ot:delete et[ht],(nt=et[0]||et[1])&&nt===(et[1]||et[0])&&!nt.length&&(rt?rt[dt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll$2(tt){for(var et=0,nt=tt.length;et=(ht=(st+ct)/2))?st=ht:ct=ht,(yt=nt>=(dt=(lt+ut)/2))?lt=dt:ut=dt,it=ot,!(ot=ot[bt=yt<<1|gt]))return it[bt]=at,tt;if(pt=+tt._x.call(null,ot.data),mt=+tt._y.call(null,ot.data),et===pt&&nt===mt)return at.next=ot,it?it[bt]=at:tt._root=at,tt;do it=it?it[bt]=new Array(4):tt._root=new Array(4),(gt=et>=(ht=(st+ct)/2))?st=ht:ct=ht,(yt=nt>=(dt=(lt+ut)/2))?lt=dt:ut=dt;while((bt=yt<<1|gt)===(vt=(mt>=dt)<<1|pt>=ht));return it[vt]=ot,it[bt]=at,tt}function addAll$1(tt){var et,nt,rt=tt.length,it,ot,at=new Array(rt),st=new Array(rt),lt=1/0,ct=1/0,ut=-1/0,ht=-1/0;for(nt=0;ntut&&(ut=it),otht&&(ht=ot));if(lt>ut||ct>ht)return this;for(this.cover(lt,ct).cover(ut,ht),nt=0;nttt||tt>=it||rt>et||et>=ot;)switch(ct=(etut||(st=mt.y0)>ht||(lt=mt.x1)=bt)<<1|tt>=yt)&&(mt=dt[dt.length-1],dt[dt.length-1]=dt[dt.length-1-gt],dt[dt.length-1-gt]=mt)}else{var vt=tt-+this._x.call(null,pt.data),xt=et-+this._y.call(null,pt.data),kt=vt*vt+xt*xt;if(kt=(dt=(at+lt)/2))?at=dt:lt=dt,(gt=ht>=(pt=(st+ct)/2))?st=pt:ct=pt,et=nt,!(nt=nt[yt=gt<<1|mt]))return this;if(!nt.length)break;(et[yt+1&3]||et[yt+2&3]||et[yt+3&3])&&(rt=et,bt=yt)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[yt]=ot:delete et[yt],(nt=et[0]||et[1]||et[2]||et[3])&&nt===(et[3]||et[2]||et[1]||et[0])&&!nt.length&&(rt?rt[bt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll$1(tt){for(var et=0,nt=tt.length;et=(mt=(lt+ht)/2))?lt=mt:ht=mt,(St=nt>=(gt=(ct+dt)/2))?ct=gt:dt=gt,(Tt=rt>=(yt=(ut+pt)/2))?ut=yt:pt=yt,ot=at,!(at=at[At=Tt<<2|St<<1|kt]))return ot[At]=st,tt;if(bt=+tt._x.call(null,at.data),vt=+tt._y.call(null,at.data),xt=+tt._z.call(null,at.data),et===bt&&nt===vt&&rt===xt)return st.next=at,ot?ot[At]=st:tt._root=st,tt;do ot=ot?ot[At]=new Array(8):tt._root=new Array(8),(kt=et>=(mt=(lt+ht)/2))?lt=mt:ht=mt,(St=nt>=(gt=(ct+dt)/2))?ct=gt:dt=gt,(Tt=rt>=(yt=(ut+pt)/2))?ut=yt:pt=yt;while((At=Tt<<2|St<<1|kt)===(Et=(xt>=yt)<<2|(vt>=gt)<<1|bt>=mt));return ot[Et]=at,ot[At]=st,tt}function addAll(tt){Array.isArray(tt)||(tt=Array.from(tt));const et=tt.length,nt=new Float64Array(et),rt=new Float64Array(et),it=new Float64Array(et);let ot=1/0,at=1/0,st=1/0,lt=-1/0,ct=-1/0,ut=-1/0;for(let ht=0,dt,pt,mt,gt;htlt&&(lt=pt),mtct&&(ct=mt),gtut&&(ut=gt));if(ot>lt||at>ct||st>ut)return this;this.cover(ot,at,st).cover(lt,ct,ut);for(let ht=0;httt||tt>=at||it>et||et>=st||ot>nt||nt>=lt;)switch(dt=(ntmt||(ct=xt.y0)>gt||(ut=xt.z0)>yt||(ht=xt.x1)=At)<<2|(et>=Tt)<<1|tt>=St)&&(xt=bt[bt.length-1],bt[bt.length-1]=bt[bt.length-1-kt],bt[bt.length-1-kt]=xt)}else{var Et=tt-+this._x.call(null,vt.data),$t=et-+this._y.call(null,vt.data),Dt=nt-+this._z.call(null,vt.data),jt=Et*Et+$t*$t+Dt*Dt;if(jt=(gt=(at+ct)/2))?at=gt:ct=gt,(xt=pt>=(yt=(st+ut)/2))?st=yt:ut=yt,(kt=mt>=(bt=(lt+ht)/2))?lt=bt:ht=bt,et=nt,!(nt=nt[St=kt<<2|xt<<1|vt]))return this;if(!nt.length)break;(et[St+1&7]||et[St+2&7]||et[St+3&7]||et[St+4&7]||et[St+5&7]||et[St+6&7]||et[St+7&7])&&(rt=et,Tt=St)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[St]=ot:delete et[St],(nt=et[0]||et[1]||et[2]||et[3]||et[4]||et[5]||et[6]||et[7])&&nt===(et[7]||et[6]||et[5]||et[4]||et[3]||et[2]||et[1]||et[0])&&!nt.length&&(rt?rt[Tt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll(tt){for(var et=0,nt=tt.length;et1&&(gt=pt.y+pt.vy),nt>2&&(yt=pt.z+pt.vz),dt.visit(kt);function kt(St,Tt,At,Et,$t,Dt,jt){var Pt=[Tt,At,Et,$t,Dt,jt],Ct=Pt[0],wt=Pt[1],It=Pt[2],Ot=Pt[nt],Wt=Pt[nt+1],zt=Pt[nt+2],Ft=St.data,Nt=St.r,Ut=bt+Nt;if(Ft){if(Ft.index>pt.index){var Mt=mt-Ft.x-Ft.vx,Ht=nt>1?gt-Ft.y-Ft.vy:0,en=nt>2?yt-Ft.z-Ft.vz:0,sn=Mt*Mt+Ht*Ht+en*en;sn1&&Ht===0&&(Ht=jiggle(it),sn+=Ht*Ht),nt>2&&en===0&&(en=jiggle(it),sn+=en*en),sn=(Ut-(sn=Math.sqrt(sn)))/sn*ot,pt.vx+=(Mt*=sn)*(Ut=(Nt*=Nt)/(vt+Nt)),nt>1&&(pt.vy+=(Ht*=sn)*Ut),nt>2&&(pt.vz+=(en*=sn)*Ut),Ft.vx-=Mt*(Ut=1-Ut),nt>1&&(Ft.vy-=Ht*Ut),nt>2&&(Ft.vz-=en*Ut))}return}return Ct>mt+Ut||Ot1&&(wt>gt+Ut||Wt2&&(It>yt+Ut||ztut.r&&(ut.r=ut[ht].r)}function ct(){if(et){var ut,ht=et.length,dt;for(rt=new Array(ht),ut=0;uttypeof dt=="function")||Math.random,nt=ht.find(dt=>[1,2,3].includes(dt))||2,ct()},st.iterations=function(ut){return arguments.length?(at=+ut,st):at},st.strength=function(ut){return arguments.length?(ot=+ut,st):ot},st.radius=function(ut){return arguments.length?(tt=typeof ut=="function"?ut:constant$7(+ut),ct(),st):tt},st}function index$1(tt){return tt.index}function find$2(tt,et){var nt=tt.get(et);if(!nt)throw new Error("node not found: "+et);return nt}function forceLink(tt){var et=index$1,nt=dt,rt,it=constant$7(30),ot,at,st,lt,ct,ut,ht=1;tt==null&&(tt=[]);function dt(bt){return 1/Math.min(lt[bt.source.index],lt[bt.target.index])}function pt(bt){for(var vt=0,xt=tt.length;vt1&&($t=At.y+At.vy-Tt.y-Tt.vy||jiggle(ut)),st>2&&(Dt=At.z+At.vz-Tt.z-Tt.vz||jiggle(ut)),jt=Math.sqrt(Et*Et+$t*$t+Dt*Dt),jt=(jt-ot[kt])/jt*bt*rt[kt],Et*=jt,$t*=jt,Dt*=jt,At.vx-=Et*(Pt=ct[kt]),st>1&&(At.vy-=$t*Pt),st>2&&(At.vz-=Dt*Pt),Tt.vx+=Et*(Pt=1-Pt),st>1&&(Tt.vy+=$t*Pt),st>2&&(Tt.vz+=Dt*Pt)}function mt(){if(at){var bt,vt=at.length,xt=tt.length,kt=new Map(at.map((Tt,At)=>[et(Tt,At,at),Tt])),St;for(bt=0,lt=new Array(vt);bttypeof xt=="function")||Math.random,st=vt.find(xt=>[1,2,3].includes(xt))||2,mt()},pt.links=function(bt){return arguments.length?(tt=bt,mt(),pt):tt},pt.id=function(bt){return arguments.length?(et=bt,pt):et},pt.iterations=function(bt){return arguments.length?(ht=+bt,pt):ht},pt.strength=function(bt){return arguments.length?(nt=typeof bt=="function"?bt:constant$7(+bt),gt(),pt):nt},pt.distance=function(bt){return arguments.length?(it=typeof bt=="function"?bt:constant$7(+bt),yt(),pt):it},pt}var noop$6={value:()=>{}};function dispatch(){for(var tt=0,et=arguments.length,nt={},rt;tt=0&&(rt=nt.slice(it+1),nt=nt.slice(0,it)),nt&&!et.hasOwnProperty(nt))throw new Error("unknown type: "+nt);return{type:nt,name:rt}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(tt,et){var nt=this._,rt=parseTypenames$1(tt+"",nt),it,ot=-1,at=rt.length;if(arguments.length<2){for(;++ot0)for(var nt=new Array(it),rt=0,it,ot;rt=0&&tt._call.call(void 0,et),tt=tt._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout$1=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var tt=clock.now(),et=tt-clockLast;et>pokeDelay&&(clockSkew-=et,clockLast=tt)}function nap(){for(var tt,et=taskHead,nt,rt=1/0;et;)et._call?(rt>et._time&&(rt=et._time),tt=et,et=et._next):(nt=et._next,et._next=null,et=tt?tt._next=nt:taskHead=nt);taskTail=tt,sleep(rt)}function sleep(tt){if(!frame){timeout$1&&(timeout$1=clearTimeout(timeout$1));var et=tt-clockNow;et>24?(tt<1/0&&(timeout$1=setTimeout(wake,tt-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function timeout(tt,et,nt){var rt=new Timer$1;return et=et==null?0:+et,rt.restart(it=>{rt.stop(),tt(it+et)},et,nt),rt}const a$2=1664525,c$4=1013904223,m$3=4294967296;function lcg(){let tt=1;return()=>(tt=(a$2*tt+c$4)%m$3)/m$3}var MAX_DIMENSIONS=3;function x$2(tt){return tt.x}function y$2(tt){return tt.y}function z$1(tt){return tt.z}var initialRadius=10,initialAngleRoll=Math.PI*(3-Math.sqrt(5)),initialAngleYaw=Math.PI*20/(9+Math.sqrt(221));function forceSimulation(tt,et){et=et||2;var nt=Math.min(MAX_DIMENSIONS,Math.max(1,Math.round(et))),rt,it=1,ot=.001,at=1-Math.pow(ot,1/300),st=0,lt=.6,ct=new Map,ut=timer$1(pt),ht=dispatch("tick","end"),dt=lcg();tt==null&&(tt=[]);function pt(){mt(),ht.call("tick",rt),it1&&(kt.fy==null?kt.y+=kt.vy*=lt:(kt.y=kt.fy,kt.vy=0)),nt>2&&(kt.fz==null?kt.z+=kt.vz*=lt:(kt.z=kt.fz,kt.vz=0));return rt}function gt(){for(var bt=0,vt=tt.length,xt;bt1&&isNaN(xt.y)||nt>2&&isNaN(xt.z)){var kt=initialRadius*(nt>2?Math.cbrt(.5+bt):nt>1?Math.sqrt(.5+bt):bt),St=bt*initialAngleRoll,Tt=bt*initialAngleYaw;nt===1?xt.x=kt:nt===2?(xt.x=kt*Math.cos(St),xt.y=kt*Math.sin(St)):(xt.x=kt*Math.sin(St)*Math.cos(Tt),xt.y=kt*Math.cos(St),xt.z=kt*Math.sin(St)*Math.sin(Tt))}(isNaN(xt.vx)||nt>1&&isNaN(xt.vy)||nt>2&&isNaN(xt.vz))&&(xt.vx=0,nt>1&&(xt.vy=0),nt>2&&(xt.vz=0))}}function yt(bt){return bt.initialize&&bt.initialize(tt,dt,nt),bt}return gt(),rt={tick:mt,restart:function(){return ut.restart(pt),rt},stop:function(){return ut.stop(),rt},numDimensions:function(bt){return arguments.length?(nt=Math.min(MAX_DIMENSIONS,Math.max(1,Math.round(bt))),ct.forEach(yt),rt):nt},nodes:function(bt){return arguments.length?(tt=bt,gt(),ct.forEach(yt),rt):tt},alpha:function(bt){return arguments.length?(it=+bt,rt):it},alphaMin:function(bt){return arguments.length?(ot=+bt,rt):ot},alphaDecay:function(bt){return arguments.length?(at=+bt,rt):+at},alphaTarget:function(bt){return arguments.length?(st=+bt,rt):st},velocityDecay:function(bt){return arguments.length?(lt=1-bt,rt):1-lt},randomSource:function(bt){return arguments.length?(dt=bt,ct.forEach(yt),rt):dt},force:function(bt,vt){return arguments.length>1?(vt==null?ct.delete(bt):ct.set(bt,yt(vt)),rt):ct.get(bt)},find:function(){var bt=Array.prototype.slice.call(arguments),vt=bt.shift()||0,xt=(nt>1?bt.shift():null)||0,kt=(nt>2?bt.shift():null)||0,St=bt.shift()||1/0,Tt=0,At=tt.length,Et,$t,Dt,jt,Pt,Ct;for(St*=St,Tt=0;Tt1?(ht.on(bt,vt),rt):ht.on(bt)}}}function forceManyBody(){var tt,et,nt,rt,it,ot=constant$7(-30),at,st=1,lt=1/0,ct=.81;function ut(mt){var gt,yt=tt.length,bt=(et===1?binarytree(tt,x$2):et===2?quadtree(tt,x$2,y$2):et===3?octree(tt,x$2,y$2,z$1):null).visitAfter(dt);for(it=mt,gt=0;gt1&&(mt.y=kt/vt),et>2&&(mt.z=St/vt)}else{yt=mt,yt.x=yt.data.x,et>1&&(yt.y=yt.data.y),et>2&&(yt.z=yt.data.z);do gt+=at[yt.data.index];while(yt=yt.next)}mt.value=gt}function pt(mt,gt,yt,bt,vt){if(!mt.value)return!0;var xt=[yt,bt,vt][et-1],kt=mt.x-nt.x,St=et>1?mt.y-nt.y:0,Tt=et>2?mt.z-nt.z:0,At=xt-gt,Et=kt*kt+St*St+Tt*Tt;if(At*At/ct1&&St===0&&(St=jiggle(rt),Et+=St*St),et>2&&Tt===0&&(Tt=jiggle(rt),Et+=Tt*Tt),Et1&&(nt.vy+=St*mt.value*it/Et),et>2&&(nt.vz+=Tt*mt.value*it/Et)),!0;if(mt.length||Et>=lt)return;(mt.data!==nt||mt.next)&&(kt===0&&(kt=jiggle(rt),Et+=kt*kt),et>1&&St===0&&(St=jiggle(rt),Et+=St*St),et>2&&Tt===0&&(Tt=jiggle(rt),Et+=Tt*Tt),Et1&&(nt.vy+=St*At),et>2&&(nt.vz+=Tt*At));while(mt=mt.next)}return ut.initialize=function(mt,...gt){tt=mt,rt=gt.find(yt=>typeof yt=="function")||Math.random,et=gt.find(yt=>[1,2,3].includes(yt))||2,ht()},ut.strength=function(mt){return arguments.length?(ot=typeof mt=="function"?mt:constant$7(+mt),ht(),ut):ot},ut.distanceMin=function(mt){return arguments.length?(st=mt*mt,ut):Math.sqrt(st)},ut.distanceMax=function(mt){return arguments.length?(lt=mt*mt,ut):Math.sqrt(lt)},ut.theta=function(mt){return arguments.length?(ct=mt*mt,ut):Math.sqrt(ct)},ut}const simulation=forceSimulation().stop(),defaults$2={numDimensions:3,velocityDecay:.9,forceChargeStrength:-20,forceChargeMinDistance:10,forceChargeMaxDistance:8e3,forceLinkStrength:.04,forceCenterStrength:.85,disableCollide:!1,disableCenter:!1,disableLink:!1,disableCharge:!1,forceCollideRadiusMethod:tt=>(tt.scale||1)*6+200,forceLinkDistanceMethod:tt=>{const et=tt.source.node_type;let nt=50;switch(et){case"topic":nt=30;break;case"guest":nt=30;break;case"clip":nt=10;break;case"episode":nt=15;break}return nt*2}},runForceSimulation=(tt,et,{numDimensions:nt=defaults$2.numDimensions,velocityDecay:rt=defaults$2.velocityDecay,forceChargeStrength:it=defaults$2.forceChargeStrength,forceChargeMinDistance:ot=defaults$2.forceChargeMinDistance,forceChargeMaxDistance:at=defaults$2.forceChargeMaxDistance,forceLinkStrength:st=defaults$2.forceLinkStrength,forceCenterStrength:lt=defaults$2.forceCenterStrength,forceLinkDistanceMethod:ct=defaults$2.forceLinkDistanceMethod,forceCollideRadiusMethod:ut=defaults$2.forceCollideRadiusMethod,disableCollide:ht=defaults$2.disableCollide,disableCenter:dt=defaults$2.disableCenter,disableLink:pt=defaults$2.disableLink,disableCharge:mt=defaults$2.disableCharge})=>(simulation.alpha(1).stop().numDimensions(nt).velocityDecay(rt).force("collide",ht?null:forceCollide().radius(ut).iterations(1)).force("center",dt?null:forceCenter().strength(lt)).force("charge",mt?null:forceManyBody().strength(it).distanceMin(ot).distanceMax(at)).nodes(tt).force("link",pt?null:forceLink().distance(ct).strength(st).id(gt=>gt.id).links(et.filter(gt=>!gt.onlyVisibleOnSelect))).alpha(1).restart(),simulation),simulationTicks$1=60,collisionTicks$1=20,runSimulationPhase$1=tt=>{for(let et=0;et{tt.force("collide",forceCollide().radius(et=>(et.scale||1)*20).iterations(1));for(let et=0;et{const et=tt.map(ot=>({...ot,x:0,y:0,z:0})),nt=generateLinksFromNodeData(et,!1,!1),rt=runForceSimulation(et,nt,{numDimensions:3,forceLinkStrength:.5,forceChargeStrength:-40,forceCenterStrength:.3,velocityDecay:.5});runSimulationPhase$1(rt),runCollisionPhase$1(rt),rt.stop();const it=nt.map(ot=>{const at=et.find(ht=>ht.ref_id===ot.sourceRef),st=et.find(ht=>ht.ref_id===ot.targetRef),lt=["guest","topic"].some(ht=>ht===(at==null?void 0:at.node_type)||ht===(st==null?void 0:st.node_type)),ct=new Vector3((at==null?void 0:at.x)||0,(at==null?void 0:at.y)||0,(at==null?void 0:at.z)||0),ut=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0);return{...ot,onlyVisibleOnSelect:lt,sourcePosition:ct,targetPosition:ut}});return{nodes:et,links:it}},sortAB=(tt,et,nt)=>{let rt=-2;return tt===nt&&et===nt?rt=0:tt===nt&&et!==nt?rt=-1:tt!==nt&&et===nt&&(rt=1),rt},sortNodesByHierarchy=tt=>tt.map(nt=>nt).sort((nt,rt)=>{let it=0;return nt.node_type==="show"||rt.node_type==="show"?it=sortAB(nt.node_type,rt.node_type,"show"):nt.node_type==="episode"||rt.node_type==="episode"?it=sortAB(nt.node_type,rt.node_type,"episode"):nt.node_type==="clip"||rt.node_type==="clip"?it=sortAB(nt.node_type,rt.node_type,"clip"):nt.node_type!=="guest"&&rt.node_type==="guest"?it=sortAB(nt.node_type,rt.node_type,"guest"):it=0,it});function getMyParents(tt,et){const{ref_id:nt}=tt;return!nt||!et?[]:et.filter(it=>{var ot;return(ot=it.children)==null?void 0:ot.includes(nt)})}function getMyChildren(tt,et){return et.filter(rt=>rt.ref_id&&tt.includes(rt.ref_id))}const simulationTicks=60,collisionTicks=20,universeScale$1=5e3,universeCube={scale:universeScale$1/2,position:{x:0,y:0,z:0}};function generateNodePosition$1(tt,et){const{scale:nt,position:rt}=universeCube,it={x:rt.x+Math.random()*nt-nt*.5,y:rt.y+Math.random()*nt-nt*.5,z:rt.z+Math.random()*nt-nt*.5},ot=getMyParents(tt,et),at=ot!=null&&ot.length?new Vector3(ot[0].x,ot[0].y,ot[0].z):null;return at&&(it.x=at.x,it.y=at.y,it.z=at.z),new Vector3(it.x,it.y,it.z)}const runSimulationPhase=tt=>{for(let et=0;et{tt.force("collide",forceCollide().radius(et=>(et.scale||1)*20).iterations(1));for(let et=0;et{const et=[],nt=tt.map(at=>{const st=generateNodePosition$1(at,et),lt={...at,...st};return et.push(lt),lt}),rt=generateLinksFromNodeData(nt,!0,!0),it=runForceSimulation(nt,rt,{numDimensions:3,forceLinkStrength:.01,forceChargeStrength:-80,velocityDecay:.5,disableCenter:!0,disableCharge:!0});runSimulationPhase(it),runCollisionPhase(it),it.stop();const ot=rt.map(at=>{const st=nt.find(dt=>dt.ref_id===at.sourceRef),lt=nt.find(dt=>dt.ref_id===at.targetRef),ct=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);return{...at,onlyVisibleOnSelect:!0,sourcePosition:ct,targetPosition:ut}});return{nodes:nt,links:ot}},universeScale=5e3,padding=300,guestCube={scale:universeScale/2,position:{x:0,y:0,z:universeScale/2+padding}},topicCube={scale:universeScale/2,position:{x:0,y:0,z:-(universeScale/2+padding)}},dataCube={scale:universeScale/2,position:{x:0,y:0,z:0}};function generateGuestNodePosition(){const{scale:tt,position:et}=guestCube,nt={x:et.x+Math.random()*tt-tt*.5,y:et.y+Math.random()*tt-tt*.5,z:et.z+Math.random()*tt-tt*.5},rt=1,it=10;return new Vector3(nt.x+rt*it,nt.y+rt*it,nt.z+rt*it)}function generateTopicNodePosition(){const{scale:tt,position:et}=topicCube,nt={x:et.x+Math.random()*tt-tt*.5,y:et.y+Math.random()*tt-tt*.5,z:et.z+Math.random()*tt-tt*.5},rt=1,it=10;return new Vector3(nt.x+rt*it,nt.y+rt*it,nt.z+rt*it)}function generateNearbyPosition(tt,et,nt=1){let it=0,ot=10*1;const at=0;switch(et){case"episode":ot+=50*(nt||0);break;case"clip":ot=0,it+=50*(nt||0);break}const st=new Vector3;return st.x=tt.x+it,st.y=tt.y+ot,st.z=tt.z+at,st}function generateNodePosition(tt,et,nt){const{ref_id:rt}=tt,{scale:it,position:ot}=dataCube,at={x:ot.x+Math.random()*it-it*.5,y:ot.y+Math.random()*it-it*.5,z:ot.z+Math.random()*it-it*.5},st=getMyParents(tt,nt);let lt=null;if(st!=null&&st.length){const ht=st[0],pt=getMyChildren(ht.children||[],et).findIndex(mt=>mt.ref_id===rt);lt=generateNearbyPosition(new Vector3(ht.x,ht.y,ht.z),tt.node_type,pt+1)}lt&&(at.x=lt.x,at.y=lt.y,at.z=lt.z);const ct=1,ut=1;return new Vector3(at.x+ct*ut,at.y+ct*ut,at.z+ct*ut)}const generateSplitGraphPositions=tt=>{const et=sortNodesByHierarchy(tt),nt=[],rt=et.map(at=>{let st=new Vector3(0,0,0);switch(at.node_type){case"guest":st=generateGuestNodePosition();break;case"topic":st=generateTopicNodePosition();break;case"data_series":st=generateNodePosition({},et,nt);break;default:st=generateNodePosition(at,et,nt);break}const lt={...at,...st};return nt.push(lt),lt}),ot=generateLinksFromNodeData(rt,!0,!0).map(at=>{const st=rt.find(dt=>dt.ref_id===at.sourceRef),lt=rt.find(dt=>dt.ref_id===at.targetRef);let ct=!1;((st==null?void 0:st.node_type)==="guest"||(st==null?void 0:st.node_type)==="topic"||(lt==null?void 0:lt.node_type)==="guest"||(lt==null?void 0:lt.node_type)==="topic")&&(ct=!0);const ut=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0),ht=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);return{...at,onlyVisibleOnSelect:ct,sourcePosition:ut,targetPosition:ht}});return rt.sort((at,st)=>(st.weight||0)-(at.weight||0)),{nodes:rt,links:ot}},getGraphDataPositions=(tt,et)=>tt==="split"?generateSplitGraphPositions(et):tt==="sphere"?generateSphereGraphPositions(et):tt==="earth"?generateEarthGraphPositions(et):generateForceGraphPositions(et),defaultData$8={links:[],nodes:[]},shouldIncludeTopics=!0,maxScale=26,fetchGraphData=async tt=>{try{return getGraphData(tt)}catch{return defaultData$8}},fetchNodes=async tt=>{if(!tt)try{return await api.get("/prediction/content/latest")}catch(nt){return console.error(nt),mock}if(isDevelopment||isE2E)return await api.get(`/v2/searching?word=${tt}&free=true`);const et=await getLSat();try{return await api.get(`/v2/search?word=${tt}`,{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));return await payLsat(rt),fetchNodes(tt)}throw nt}},getTrends=async()=>{const tt="/get_trends";return await api.get(tt)},getSentimentData=async tt=>{const et=tt&&new URLSearchParams(tt),nt=et?`/sentiments?${et.toString()}`:"/sentiments";if(isE2E)return await api.get(nt);const rt=await getLSat();try{return await api.get(nt,{Authorization:rt})}catch(it){if(it.status===402){const ot=distExports.Lsat.fromHeader(it.headers.get("www-authenticate"));return await payLsat(ot),getSentimentData(tt)}throw it}},postInstagraph=async tt=>{const et=await getLSat();try{return api.post("/instagraph",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));return await payLsat(rt),postInstagraph(tt)}throw nt}},postTeachMe=async tt=>{const et=await getLSat();try{return api.post("/teachme",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));return await payLsat(rt),postTeachMe(tt)}throw nt}},postAskQuestion=async tt=>{const et=await getLSat();try{return api.post("/ask_question",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));return await payLsat(rt),postAskQuestion(tt)}throw nt}},getNodeScale=tt=>{switch(tt.node_type){case"guest":case"episode":case"document":return 2;case"show":return 3;default:return 1.5}};function generateTopicNodesFromMap(tt,et){Object.entries(tt).forEach(([nt,rt],it)=>{const{children:ot,position:at}=rt,{x:st,y:lt,z:ct}=at,ut=ot.length*2>maxScale?maxScale:ot.length*2,ht=`topic_node_${it}`;et({x:st,y:lt,z:ct,children:ot,colors:["#000"],id:ht,label:nt,name:nt,type:"topic",node_type:"topic",ref_id:ht,scale:ut,show_title:nt,text:nt,weight:0})})}function generateGuestNodesFromMap(tt,et){Object.entries(tt).forEach(([nt,rt],it)=>{const ot=rt.children,at=ot.length*2>maxScale?maxScale:ot.length*2,st=nt||`guestnode_${it}`,lt={...rt,x:0,y:0,z:0,colors:["#000"],id:st,image_url:rt.imageUrl,label:rt.name,name:rt.name,node_type:"guest",ref_id:st,scale:at,show_title:rt.name,text:rt.twitterHandle,type:"guest",weight:0};et(lt)})}const getGraphData=async tt=>{const{graphStyle:et}=useDataStore.getState();let nt=[];const rt={},it={};try{const ot=await fetchNodes(tt),at=Array.isArray(ot.data_series)?ot.data_series:[],st=[...ot.exact,...ot.related,...at];let lt=0;st.length&&st.forEach((dt,pt)=>{var yt;if(dt.weight&<bt.ref_id===dt.ref_id))return;const gt=(yt=dt.image_url)==null?void 0:yt.replace(AWS_IMAGE_BUCKET_URL,CLOUDFRONT_IMAGE_BUCKET_URL).replace(".jpg","_s.jpg");nt.push({...dt,scale:getNodeScale(dt),id:dt.ref_id||dt.tweet_id||dt.id,image_url:gt,type:dt.type||dt.node_type}),dt.node_type==="episode"&&dt.ref_id&&(dt.guests||[]).forEach(vt=>{var kt;const xt=vt;xt.name&&xt.ref_id&&dt.ref_id&&(it[xt.ref_id]={children:[...((kt=it[xt.ref_id])==null?void 0:kt.children)||[],dt.ref_id],imageUrl:xt.profile_picture||"",name:xt.name,twitterHandle:xt.twitter_handle})})}),generateGuestNodesFromMap(it,dt=>{nt.push(dt)}),st.forEach(dt=>{const{topics:pt,ref_id:mt,show_title:gt}=dt;pt&&pt.forEach(yt=>{yt!==tt&>&&(rt[yt]&&!rt[yt].children.includes(mt||gt)?rt[yt].children.push(mt||gt):rt[yt]={position:new Vector3(0,0,0),children:[mt||gt]})})}),shouldIncludeTopics&&generateTopicNodesFromMap(rt,dt=>{nt.push(dt)});const ct=getGraphDataPositions(et,nt),{links:ut}=ct;nt=ct.nodes,nt.sort((dt,pt)=>(pt.weight||0)-(dt.weight||0));const ht=getMaxSuperficialWeightPerNodeType(nt,ut);return nt=addWeightNormalizationToNodes(lt,ht,nt,ut),{links:ut,nodes:nt}}catch(ot){return console.error(ot),defaultData$8}},getSegmentColor=(tt,et)=>tt==="topic"||et==="topic"?NODE_RELATIVE_HIGHLIGHT_COLORS.topics.segmentColor:tt==="guest"||et==="guest"?NODE_RELATIVE_HIGHLIGHT_COLORS.guests.segmentColor:NODE_RELATIVE_HIGHLIGHT_COLORS.children.segmentColor,generateLinksFromNodeData=(tt,et,nt)=>{const rt=[];return tt.forEach(it=>{const{children:ot,guests:at}=it;ot==null||ot.forEach(st=>{if(it.ref_id){const lt=tt.find(ht=>ht.ref_id===st)||null;if(!lt)return;const ct=new Vector3(it.x||0,it.y||0,it.z||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);rt.push({onlyVisibleOnSelect:et,color:getSegmentColor(it.node_type,(lt==null?void 0:lt.node_type)||""),source:it.ref_id,sourceRef:it.ref_id,sourcePosition:ct,target:st,targetRef:st,targetPosition:ut})}}),at==null||at.forEach(st=>{if(st&&typeof st!="string"&&it.ref_id){const lt=tt.find(ht=>ht.ref_id===(st==null?void 0:st.ref_id))||null;if(!lt)return;const ct=new Vector3(it.x||0,it.y||0,it.z||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);rt.push({onlyVisibleOnSelect:nt,color:getSegmentColor(it.node_type,"guest"),source:it.ref_id,sourceRef:it.ref_id,sourcePosition:ct,target:st==null?void 0:st.ref_id,targetRef:st==null?void 0:st.ref_id,targetPosition:ut})}})}),rt},addWeightNormalizationToNodes=(tt,et,nt,rt)=>nt.map(it=>{let ot=(it.weight||0)/tt;return!it.weight&&et[it.node_type]&&(ot=getSuperficialNodeWeight(it,rt)/et[it.node_type]),{...it,weight:ot}}),saveConsumedContent=async tt=>{await executeIfProd(async()=>{if(!await distExports$1.enable(!0)){console.error("Sphinx enable failed, means no pubkey and no budget (including budget of 0)");return}try{await distExports$1.saveGraphData({metaData:{date:Math.floor(new Date().getTime()/1e3),...tt},type:"second_brain_consumed_content"})}catch(nt){console.warn(nt)}})},saveSearchTerm=async()=>{await executeIfProd(async()=>{await distExports$1.enable(!0)||console.log("Sphinx enable failed, means no pubkey and no budget (including budget of 0)")})},graphStyles=["split","force","sphere","earth"],defaultData$7={categoryFilter:null,data:null,selectionGraphData:{nodes:[],links:[]},scrollEventsDisabled:!1,disableCameraRotation:!1,graphRadius:isChileGraph?1600:3056,graphStyle:"split",isFetching:!1,isTimestampLoaded:!1,queuedSources:null,topics:null,hoveredNode:null,selectedNode:null,selectedTimestamp:null,sources:null,sphinxModalIsOpen:!1,cameraFocusTrigger:!1,selectedNodeRelativeIds:[],nearbyNodeIds:[],showSelectionGraph:!1,showTeachMe:!1,hideNodeDetails:!1},useDataStore=react((tt,et)=>({...defaultData$7,fetchData:async nt=>{if(et().isFetching)return;tt({isFetching:!0,sphinxModalIsOpen:!0});const rt=await fetchGraphData(nt||"");nt&&await saveSearchTerm(),tt({data:rt,isFetching:!1,sphinxModalIsOpen:!1,disableCameraRotation:!1,nearbyNodeIds:[],selectedNodeRelativeIds:[],showSelectionGraph:!1,showTeachMe:!1})},setIsFetching:nt=>tt({isFetching:nt}),setData:nt=>tt({data:nt}),setSelectionData:nt=>tt({selectionGraphData:nt}),setScrollEventsDisabled:nt=>tt({scrollEventsDisabled:nt}),setCategoryFilter:nt=>tt({categoryFilter:nt}),setDisableCameraRotation:nt=>tt({disableCameraRotation:nt}),setGraphRadius:nt=>tt({graphRadius:nt}),setGraphStyle:nt=>tt({graphStyle:nt}),setQueuedSources:nt=>tt({queuedSources:nt}),setTopics:nt=>tt({topics:nt}),setHoveredNode:nt=>tt({hoveredNode:nt}),setSelectedNode:nt=>{const rt=et().selectedNode;if((rt==null?void 0:rt.ref_id)!==(nt==null?void 0:nt.ref_id)){const{data:it}=et(),ot=(it==null?void 0:it.nodes.filter(at=>at.ref_id&&nodesAreRelatives(at,nt)).map(at=>(at==null?void 0:at.ref_id)||""))||[];tt({hoveredNode:null,isTimestampLoaded:!1,selectedNode:nt,disableCameraRotation:!0,selectedNodeRelativeIds:ot})}},setSelectedTimestamp:nt=>tt({selectedTimestamp:nt}),setSources:nt=>tt({sources:nt}),setSphinxModalOpen:nt=>tt({sphinxModalIsOpen:nt}),setCameraFocusTrigger:nt=>tt({cameraFocusTrigger:nt}),setNearbyNodeIds:nt=>{const rt=et().nearbyNodeIds;(nt.length!==rt.length||nt[0]!==rt[0])&&tt({nearbyNodeIds:nt})},setShowSelectionGraph:nt=>tt({showSelectionGraph:nt}),setHideNodeDetails:nt=>tt({hideNodeDetails:nt}),setTeachMe:nt=>tt({showTeachMe:nt})})),useSelectedNode=()=>useDataStore(tt=>tt.selectedNode),setIsTimestampLoaded=tt=>useDataStore.setState({isTimestampLoaded:tt}),topupFromToast=async()=>{try{const tt=await distExports$1.topup();if(!tt)throw new Error("Topup failed");if(tt.budget<5)throw new Error("You set a budget of less than 5 sats");toast(jsxRuntimeExports.jsx(ToastMessage,{message:`You set a budget of ${tt.budget} sats`}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:"success"})}catch(tt){tt instanceof Error&&toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt.message}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:"error"})}},ToastMessage=({message:tt})=>tt===BOOST_ERROR_BUDGET?jsxRuntimeExports.jsxs("div",{children:[tt,jsxRuntimeExports.jsx(ButtonWrapper,{onClick:topupFromToast,type:"button",children:jsxRuntimeExports.jsx(Text$3,{color:"white",kind:"medium",children:"Topup"})})]}):jsxRuntimeExports.jsx("div",{children:tt}),ButtonWrapper=styled$4.button` +`},{children:["9dcca755-0a20-45e5-8e4d-dfe2800b9c6f","9dcca755-0a20-45e5-8e4d-dfe2800b9c6f"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/fe6bdbce-e91d-43cf-ab33-0e98bffabecc.jpg",node_type:"show",ref_id:"fe6bdbce-e91d-43cf-ab33-0e98bffabecc",show_title:"Bitcoin Charlotte"},{children:["b8289cbb-ec69-49a8-b6ab-c1fd808acc09"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/4240c90e-0086-4ece-bfe5-84a282c5059e.jpg",node_type:"show",ref_id:"4240c90e-0086-4ece-bfe5-84a282c5059e",show_title:"Thriller Bitcoin"},{children:["daddd93e-7bc6-4c50-a150-5199b437afc9"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/24a144b0-7ca3-40e9-9c42-86b9fce0b662.jpg",node_type:"show",ref_id:"24a144b0-7ca3-40e9-9c42-86b9fce0b662",show_title:"The Chaincode Podcast"},{children:["56bf65e9-41d5-42e1-95d6-239e4c835781","56bf65e9-41d5-42e1-95d6-239e4c835781","56bf65e9-41d5-42e1-95d6-239e4c835781","ff88a8b8-bcd6-4d86-8a65-8a68def35b9f","810a3acb-e30e-46bc-8c67-1d504b2e7c09","810a3acb-e30e-46bc-8c67-1d504b2e7c09"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/f1879df9-9bc6-4a76-951f-24548da768ef.jpg",node_type:"show",ref_id:"f1879df9-9bc6-4a76-951f-24548da768ef",show_title:"Bitcoin.Review Podcast with NVK & Guests"},{children:["f7e75069-adf6-41b0-9bb7-a6a2aa846493","f7e75069-adf6-41b0-9bb7-a6a2aa846493","6eb2a481-408f-4989-9f28-67789651259a","89049a1c-0171-4999-b003-57e1b57d92b2","d842ce17-a4c0-49a6-bdc5-5268f1d61779","8d9b0689-2e69-44c1-afe2-3519e999390a","8d9b0689-2e69-44c1-afe2-3519e999390a"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e7d2a4ca-6b44-4a45-a94c-6f48987979f7.jpg",node_type:"show",ref_id:"e7d2a4ca-6b44-4a45-a94c-6f48987979f7",show_title:"TABConf (The Atlanta Bitcoin Conference)"},{children:["3b818893-4605-499c-a467-5abcc23f9483","3b818893-4605-499c-a467-5abcc23f9483","3b818893-4605-499c-a467-5abcc23f9483","a44e78cd-dc66-4b67-9523-7ddff0d3655f","a44e78cd-dc66-4b67-9523-7ddff0d3655f","0c4f330b-a39d-4312-9775-58b42c7c9723","0c4f330b-a39d-4312-9775-58b42c7c9723","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","205a0650-fefe-4aaf-a894-faa8b72d966a","a60dc641-5d14-4960-ab73-66ff199edd1d"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/2ec62250-4755-4616-8342-096a2cfab95f.jpg",node_type:"show",ref_id:"2ec62250-4755-4616-8342-096a2cfab95f",show_title:"Voltage"},{children:["3af98dc1-5e7c-4ef3-ad74-b9b6afaee8b9","625d9252-2f5e-4f53-b577-dd2dfd4d4749"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/492cbcce-3744-4d8b-b2ca-3a7f063e798a.jpg",node_type:"show",ref_id:"492cbcce-3744-4d8b-b2ca-3a7f063e798a",show_title:"Swan Bitcoin"},{children:["8eef2f82-bbf9-4fef-ba3d-102679d4a1a5"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/b29c81c8-cccd-4a6b-b78f-3c1591a54d27.jpg",node_type:"show",ref_id:"b29c81c8-cccd-4a6b-b78f-3c1591a54d27",show_title:"Austin Bitcoin Club"},{children:["a1e3c3cf-2045-4c33-8152-0e162b7ca729"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/63e0cbc0-731d-4ea0-9dd2-2b8b841eb28a.jpg",node_type:"show",ref_id:"63e0cbc0-731d-4ea0-9dd2-2b8b841eb28a",show_title:"Synonym"},{children:["e06b030a-063e-4894-9914-d326220f75f8","e06b030a-063e-4894-9914-d326220f75f8","e06b030a-063e-4894-9914-d326220f75f8"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/ea2cf2ae-76de-4185-818c-384b3b06228b.jpg",node_type:"show",ref_id:"ea2cf2ae-76de-4185-818c-384b3b06228b",show_title:"Blockware Intelligence"},{children:["b707bbd8-1a9e-4aee-8e0e-2fe0be24c851"],image_url:"https://stakwork-uploads.s3.amazonaws.com/knowledge-graph-joe/content-images/e79b1a57-ecd0-4df3-b8ec-1a1a55d047e7.jpg",node_type:"show",ref_id:"e79b1a57-ecd0-4df3-b8ec-1a1a55d047e7",show_title:"Pleb UnderGround"}],related:[{episode_title:"The Orange Sun ☀️ #Bitcoin vs. Fiat",ref_id:"e5b1ad5b-2ce2-4192-a6d9-e99f0e3e88b5",show_title:"Satoshi’s Journal"},{episode_title:"Orange Sun 🌞 Why Ethereum is a shitcoin/scam & Bitcoin News",ref_id:"0645c5a3-b511-471d-9d8e-ef63b4dfe340",show_title:"Satoshi’s Journal"},{episode_title:"#Bitcoin Beats⚡🎶 by @SatoshisJournal Genesis Block walkthrough",ref_id:"aba7b4db-77bb-40c4-a0d4-4ce20da7b9ba",show_title:"Satoshi’s Journal"},{episode_title:"The Orange Sun 🌞 Does Price = Value? #Bitcoin",ref_id:"a0826cdb-6198-4416-bd12-1dd5aa09a075",show_title:"Satoshi’s Journal"},{episode_title:"#Bitcoin Beats⚡🎶 by @SatoshisJournal w @NEEDcreations & @DJSATOSHI18",ref_id:"fd00f285-c11e-40ba-8af9-b67265ac321b",show_title:"Satoshi’s Journal"},{episode_title:'The Orange Sun ☀️ Reading/Discussion of "The Book of Satoshi."',ref_id:"fcbe1196-c55d-476f-92d6-4dcba954eaf3",show_title:"Satoshi’s Journal"},{episode_title:'The Orange 🌞 Reading/Discussion "The Book of Satoshi" & Bitcoin News',ref_id:"c6447277-9a58-411f-85e1-5ac166884ce5",show_title:"Satoshi’s Journal"},{episode_title:"The Orange Sun 🌞 Bitcoin News and Talk - Happy Holidays!",ref_id:"d0b59017-ae64-47d4-be5c-c1531c9d480f",show_title:"Satoshi’s Journal"},{episode_title:`The Orange Sun 🌞 Reading/Discussion Tomer Strolight's "Why Bitcoin?"`,ref_id:"95848760-3863-4595-b049-f25826eba2d3",show_title:"Satoshi’s Journal"}]},typesWeighedByChildren=["show","episode"],getSuperficialNodeWeight=(tt,et)=>{var rt;return tt.weight?tt.weight:typesWeighedByChildren.includes(tt.node_type)?((rt=tt==null?void 0:tt.children)==null?void 0:rt.length)||0:et.filter(it=>it.sourceRef===tt.ref_id||it.targetRef===tt.ref_id).length},getMaxSuperficialWeightPerNodeType=(tt,et)=>{const nt={};return tt.forEach(rt=>{const it=getSuperficialNodeWeight(rt,et);(!nt[rt.node_type]||nt[rt.node_type]tt.clone().normalize().clone().negate().normalize().multiplyScalar(et).add(tt),getPositionFromLngLat=(tt,et,nt)=>{const rt=et*Math.PI/180,it=(tt-180)*Math.PI/180,ot=-nt*Math.cos(rt)*Math.cos(it),at=nt*Math.sin(rt),st=nt*Math.cos(rt)*Math.sin(it);return new Vector3(ot,at,st)},generateEarthGraphPositions=tt=>{const et=tt.map(rt=>{const{longitude:it,latitude:ot}=rt.longitude&&rt.latitude?rt:{longitude:getRandomLngLat(),latitude:getRandomLngLat()},at=getPositionFromLngLat(it,ot,dataRadius);return{...rt,...at}}),nt=generateLinksFromNodeData(et,!0,!0);return{nodes:et,links:nt}};function forceCenter(tt,et,nt){var rt,it=1;tt==null&&(tt=0),et==null&&(et=0),nt==null&&(nt=0);function ot(){var at,st=rt.length,lt,ct=0,ut=0,ht=0;for(at=0;at=(lt=(at+st)/2))?at=lt:st=lt,rt=it,!(it=it[ht=+ut]))return rt[ht]=ot,tt;if(ct=+tt._x.call(null,it.data),et===ct)return ot.next=it,rt?rt[ht]=ot:tt._root=ot,tt;do rt=rt?rt[ht]=new Array(2):tt._root=new Array(2),(ut=et>=(lt=(at+st)/2))?at=lt:st=lt;while((ht=+ut)==(dt=+(ct>=lt)));return rt[dt]=it,rt[ht]=ot,tt}function addAll$2(tt){Array.isArray(tt)||(tt=Array.from(tt));const et=tt.length,nt=new Float64Array(et);let rt=1/0,it=-1/0;for(let ot=0,at;otit&&(it=at));if(rt>it)return this;this.cover(rt).cover(it);for(let ot=0;ottt||tt>=nt;)switch(at=+(ttat||(ot=ct.x1)=ht))&&(ct=st[st.length-1],st[st.length-1]=st[st.length-1-ut],st[st.length-1-ut]=ct)}else{var dt=Math.abs(tt-+this._x.call(null,lt.data));dt=(ct=(at+st)/2))?at=ct:st=ct,et=nt,!(nt=nt[ht=+ut]))return this;if(!nt.length)break;et[ht+1&1]&&(rt=et,dt=ht)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[ht]=ot:delete et[ht],(nt=et[0]||et[1])&&nt===(et[1]||et[0])&&!nt.length&&(rt?rt[dt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll$2(tt){for(var et=0,nt=tt.length;et=(ht=(st+ct)/2))?st=ht:ct=ht,(yt=nt>=(dt=(lt+ut)/2))?lt=dt:ut=dt,it=ot,!(ot=ot[bt=yt<<1|gt]))return it[bt]=at,tt;if(pt=+tt._x.call(null,ot.data),mt=+tt._y.call(null,ot.data),et===pt&&nt===mt)return at.next=ot,it?it[bt]=at:tt._root=at,tt;do it=it?it[bt]=new Array(4):tt._root=new Array(4),(gt=et>=(ht=(st+ct)/2))?st=ht:ct=ht,(yt=nt>=(dt=(lt+ut)/2))?lt=dt:ut=dt;while((bt=yt<<1|gt)===(vt=(mt>=dt)<<1|pt>=ht));return it[vt]=ot,it[bt]=at,tt}function addAll$1(tt){var et,nt,rt=tt.length,it,ot,at=new Array(rt),st=new Array(rt),lt=1/0,ct=1/0,ut=-1/0,ht=-1/0;for(nt=0;ntut&&(ut=it),otht&&(ht=ot));if(lt>ut||ct>ht)return this;for(this.cover(lt,ct).cover(ut,ht),nt=0;nttt||tt>=it||rt>et||et>=ot;)switch(ct=(etut||(st=mt.y0)>ht||(lt=mt.x1)=bt)<<1|tt>=yt)&&(mt=dt[dt.length-1],dt[dt.length-1]=dt[dt.length-1-gt],dt[dt.length-1-gt]=mt)}else{var vt=tt-+this._x.call(null,pt.data),xt=et-+this._y.call(null,pt.data),kt=vt*vt+xt*xt;if(kt=(dt=(at+lt)/2))?at=dt:lt=dt,(gt=ht>=(pt=(st+ct)/2))?st=pt:ct=pt,et=nt,!(nt=nt[yt=gt<<1|mt]))return this;if(!nt.length)break;(et[yt+1&3]||et[yt+2&3]||et[yt+3&3])&&(rt=et,bt=yt)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[yt]=ot:delete et[yt],(nt=et[0]||et[1]||et[2]||et[3])&&nt===(et[3]||et[2]||et[1]||et[0])&&!nt.length&&(rt?rt[bt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll$1(tt){for(var et=0,nt=tt.length;et=(mt=(lt+ht)/2))?lt=mt:ht=mt,(St=nt>=(gt=(ct+dt)/2))?ct=gt:dt=gt,(Tt=rt>=(yt=(ut+pt)/2))?ut=yt:pt=yt,ot=at,!(at=at[At=Tt<<2|St<<1|kt]))return ot[At]=st,tt;if(bt=+tt._x.call(null,at.data),vt=+tt._y.call(null,at.data),xt=+tt._z.call(null,at.data),et===bt&&nt===vt&&rt===xt)return st.next=at,ot?ot[At]=st:tt._root=st,tt;do ot=ot?ot[At]=new Array(8):tt._root=new Array(8),(kt=et>=(mt=(lt+ht)/2))?lt=mt:ht=mt,(St=nt>=(gt=(ct+dt)/2))?ct=gt:dt=gt,(Tt=rt>=(yt=(ut+pt)/2))?ut=yt:pt=yt;while((At=Tt<<2|St<<1|kt)===(Et=(xt>=yt)<<2|(vt>=gt)<<1|bt>=mt));return ot[Et]=at,ot[At]=st,tt}function addAll(tt){Array.isArray(tt)||(tt=Array.from(tt));const et=tt.length,nt=new Float64Array(et),rt=new Float64Array(et),it=new Float64Array(et);let ot=1/0,at=1/0,st=1/0,lt=-1/0,ct=-1/0,ut=-1/0;for(let ht=0,dt,pt,mt,gt;htlt&&(lt=pt),mtct&&(ct=mt),gtut&&(ut=gt));if(ot>lt||at>ct||st>ut)return this;this.cover(ot,at,st).cover(lt,ct,ut);for(let ht=0;httt||tt>=at||it>et||et>=st||ot>nt||nt>=lt;)switch(dt=(ntmt||(ct=xt.y0)>gt||(ut=xt.z0)>yt||(ht=xt.x1)=At)<<2|(et>=Tt)<<1|tt>=St)&&(xt=bt[bt.length-1],bt[bt.length-1]=bt[bt.length-1-kt],bt[bt.length-1-kt]=xt)}else{var Et=tt-+this._x.call(null,vt.data),$t=et-+this._y.call(null,vt.data),Dt=nt-+this._z.call(null,vt.data),jt=Et*Et+$t*$t+Dt*Dt;if(jt=(gt=(at+ct)/2))?at=gt:ct=gt,(xt=pt>=(yt=(st+ut)/2))?st=yt:ut=yt,(kt=mt>=(bt=(lt+ht)/2))?lt=bt:ht=bt,et=nt,!(nt=nt[St=kt<<2|xt<<1|vt]))return this;if(!nt.length)break;(et[St+1&7]||et[St+2&7]||et[St+3&7]||et[St+4&7]||et[St+5&7]||et[St+6&7]||et[St+7&7])&&(rt=et,Tt=St)}for(;nt.data!==tt;)if(it=nt,!(nt=nt.next))return this;return(ot=nt.next)&&delete nt.next,it?(ot?it.next=ot:delete it.next,this):et?(ot?et[St]=ot:delete et[St],(nt=et[0]||et[1]||et[2]||et[3]||et[4]||et[5]||et[6]||et[7])&&nt===(et[7]||et[6]||et[5]||et[4]||et[3]||et[2]||et[1]||et[0])&&!nt.length&&(rt?rt[Tt]=nt:this._root=nt),this):(this._root=ot,this)}function removeAll(tt){for(var et=0,nt=tt.length;et1&&(gt=pt.y+pt.vy),nt>2&&(yt=pt.z+pt.vz),dt.visit(kt);function kt(St,Tt,At,Et,$t,Dt,jt){var Pt=[Tt,At,Et,$t,Dt,jt],Ct=Pt[0],wt=Pt[1],It=Pt[2],Ot=Pt[nt],Wt=Pt[nt+1],zt=Pt[nt+2],Ft=St.data,Nt=St.r,Ut=bt+Nt;if(Ft){if(Ft.index>pt.index){var Mt=mt-Ft.x-Ft.vx,Ht=nt>1?gt-Ft.y-Ft.vy:0,en=nt>2?yt-Ft.z-Ft.vz:0,sn=Mt*Mt+Ht*Ht+en*en;sn1&&Ht===0&&(Ht=jiggle(it),sn+=Ht*Ht),nt>2&&en===0&&(en=jiggle(it),sn+=en*en),sn=(Ut-(sn=Math.sqrt(sn)))/sn*ot,pt.vx+=(Mt*=sn)*(Ut=(Nt*=Nt)/(vt+Nt)),nt>1&&(pt.vy+=(Ht*=sn)*Ut),nt>2&&(pt.vz+=(en*=sn)*Ut),Ft.vx-=Mt*(Ut=1-Ut),nt>1&&(Ft.vy-=Ht*Ut),nt>2&&(Ft.vz-=en*Ut))}return}return Ct>mt+Ut||Ot1&&(wt>gt+Ut||Wt2&&(It>yt+Ut||ztut.r&&(ut.r=ut[ht].r)}function ct(){if(et){var ut,ht=et.length,dt;for(rt=new Array(ht),ut=0;uttypeof dt=="function")||Math.random,nt=ht.find(dt=>[1,2,3].includes(dt))||2,ct()},st.iterations=function(ut){return arguments.length?(at=+ut,st):at},st.strength=function(ut){return arguments.length?(ot=+ut,st):ot},st.radius=function(ut){return arguments.length?(tt=typeof ut=="function"?ut:constant$7(+ut),ct(),st):tt},st}function index$1(tt){return tt.index}function find$2(tt,et){var nt=tt.get(et);if(!nt)throw new Error("node not found: "+et);return nt}function forceLink(tt){var et=index$1,nt=dt,rt,it=constant$7(30),ot,at,st,lt,ct,ut,ht=1;tt==null&&(tt=[]);function dt(bt){return 1/Math.min(lt[bt.source.index],lt[bt.target.index])}function pt(bt){for(var vt=0,xt=tt.length;vt1&&($t=At.y+At.vy-Tt.y-Tt.vy||jiggle(ut)),st>2&&(Dt=At.z+At.vz-Tt.z-Tt.vz||jiggle(ut)),jt=Math.sqrt(Et*Et+$t*$t+Dt*Dt),jt=(jt-ot[kt])/jt*bt*rt[kt],Et*=jt,$t*=jt,Dt*=jt,At.vx-=Et*(Pt=ct[kt]),st>1&&(At.vy-=$t*Pt),st>2&&(At.vz-=Dt*Pt),Tt.vx+=Et*(Pt=1-Pt),st>1&&(Tt.vy+=$t*Pt),st>2&&(Tt.vz+=Dt*Pt)}function mt(){if(at){var bt,vt=at.length,xt=tt.length,kt=new Map(at.map((Tt,At)=>[et(Tt,At,at),Tt])),St;for(bt=0,lt=new Array(vt);bttypeof xt=="function")||Math.random,st=vt.find(xt=>[1,2,3].includes(xt))||2,mt()},pt.links=function(bt){return arguments.length?(tt=bt,mt(),pt):tt},pt.id=function(bt){return arguments.length?(et=bt,pt):et},pt.iterations=function(bt){return arguments.length?(ht=+bt,pt):ht},pt.strength=function(bt){return arguments.length?(nt=typeof bt=="function"?bt:constant$7(+bt),gt(),pt):nt},pt.distance=function(bt){return arguments.length?(it=typeof bt=="function"?bt:constant$7(+bt),yt(),pt):it},pt}var noop$6={value:()=>{}};function dispatch(){for(var tt=0,et=arguments.length,nt={},rt;tt=0&&(rt=nt.slice(it+1),nt=nt.slice(0,it)),nt&&!et.hasOwnProperty(nt))throw new Error("unknown type: "+nt);return{type:nt,name:rt}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(tt,et){var nt=this._,rt=parseTypenames$1(tt+"",nt),it,ot=-1,at=rt.length;if(arguments.length<2){for(;++ot0)for(var nt=new Array(it),rt=0,it,ot;rt=0&&tt._call.call(void 0,et),tt=tt._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout$1=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var tt=clock.now(),et=tt-clockLast;et>pokeDelay&&(clockSkew-=et,clockLast=tt)}function nap(){for(var tt,et=taskHead,nt,rt=1/0;et;)et._call?(rt>et._time&&(rt=et._time),tt=et,et=et._next):(nt=et._next,et._next=null,et=tt?tt._next=nt:taskHead=nt);taskTail=tt,sleep(rt)}function sleep(tt){if(!frame){timeout$1&&(timeout$1=clearTimeout(timeout$1));var et=tt-clockNow;et>24?(tt<1/0&&(timeout$1=setTimeout(wake,tt-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function timeout(tt,et,nt){var rt=new Timer$1;return et=et==null?0:+et,rt.restart(it=>{rt.stop(),tt(it+et)},et,nt),rt}const a$2=1664525,c$4=1013904223,m$3=4294967296;function lcg(){let tt=1;return()=>(tt=(a$2*tt+c$4)%m$3)/m$3}var MAX_DIMENSIONS=3;function x$2(tt){return tt.x}function y$2(tt){return tt.y}function z$1(tt){return tt.z}var initialRadius=10,initialAngleRoll=Math.PI*(3-Math.sqrt(5)),initialAngleYaw=Math.PI*20/(9+Math.sqrt(221));function forceSimulation(tt,et){et=et||2;var nt=Math.min(MAX_DIMENSIONS,Math.max(1,Math.round(et))),rt,it=1,ot=.001,at=1-Math.pow(ot,1/300),st=0,lt=.6,ct=new Map,ut=timer$1(pt),ht=dispatch("tick","end"),dt=lcg();tt==null&&(tt=[]);function pt(){mt(),ht.call("tick",rt),it1&&(kt.fy==null?kt.y+=kt.vy*=lt:(kt.y=kt.fy,kt.vy=0)),nt>2&&(kt.fz==null?kt.z+=kt.vz*=lt:(kt.z=kt.fz,kt.vz=0));return rt}function gt(){for(var bt=0,vt=tt.length,xt;bt1&&isNaN(xt.y)||nt>2&&isNaN(xt.z)){var kt=initialRadius*(nt>2?Math.cbrt(.5+bt):nt>1?Math.sqrt(.5+bt):bt),St=bt*initialAngleRoll,Tt=bt*initialAngleYaw;nt===1?xt.x=kt:nt===2?(xt.x=kt*Math.cos(St),xt.y=kt*Math.sin(St)):(xt.x=kt*Math.sin(St)*Math.cos(Tt),xt.y=kt*Math.cos(St),xt.z=kt*Math.sin(St)*Math.sin(Tt))}(isNaN(xt.vx)||nt>1&&isNaN(xt.vy)||nt>2&&isNaN(xt.vz))&&(xt.vx=0,nt>1&&(xt.vy=0),nt>2&&(xt.vz=0))}}function yt(bt){return bt.initialize&&bt.initialize(tt,dt,nt),bt}return gt(),rt={tick:mt,restart:function(){return ut.restart(pt),rt},stop:function(){return ut.stop(),rt},numDimensions:function(bt){return arguments.length?(nt=Math.min(MAX_DIMENSIONS,Math.max(1,Math.round(bt))),ct.forEach(yt),rt):nt},nodes:function(bt){return arguments.length?(tt=bt,gt(),ct.forEach(yt),rt):tt},alpha:function(bt){return arguments.length?(it=+bt,rt):it},alphaMin:function(bt){return arguments.length?(ot=+bt,rt):ot},alphaDecay:function(bt){return arguments.length?(at=+bt,rt):+at},alphaTarget:function(bt){return arguments.length?(st=+bt,rt):st},velocityDecay:function(bt){return arguments.length?(lt=1-bt,rt):1-lt},randomSource:function(bt){return arguments.length?(dt=bt,ct.forEach(yt),rt):dt},force:function(bt,vt){return arguments.length>1?(vt==null?ct.delete(bt):ct.set(bt,yt(vt)),rt):ct.get(bt)},find:function(){var bt=Array.prototype.slice.call(arguments),vt=bt.shift()||0,xt=(nt>1?bt.shift():null)||0,kt=(nt>2?bt.shift():null)||0,St=bt.shift()||1/0,Tt=0,At=tt.length,Et,$t,Dt,jt,Pt,Ct;for(St*=St,Tt=0;Tt1?(ht.on(bt,vt),rt):ht.on(bt)}}}function forceManyBody(){var tt,et,nt,rt,it,ot=constant$7(-30),at,st=1,lt=1/0,ct=.81;function ut(mt){var gt,yt=tt.length,bt=(et===1?binarytree(tt,x$2):et===2?quadtree(tt,x$2,y$2):et===3?octree(tt,x$2,y$2,z$1):null).visitAfter(dt);for(it=mt,gt=0;gt1&&(mt.y=kt/vt),et>2&&(mt.z=St/vt)}else{yt=mt,yt.x=yt.data.x,et>1&&(yt.y=yt.data.y),et>2&&(yt.z=yt.data.z);do gt+=at[yt.data.index];while(yt=yt.next)}mt.value=gt}function pt(mt,gt,yt,bt,vt){if(!mt.value)return!0;var xt=[yt,bt,vt][et-1],kt=mt.x-nt.x,St=et>1?mt.y-nt.y:0,Tt=et>2?mt.z-nt.z:0,At=xt-gt,Et=kt*kt+St*St+Tt*Tt;if(At*At/ct1&&St===0&&(St=jiggle(rt),Et+=St*St),et>2&&Tt===0&&(Tt=jiggle(rt),Et+=Tt*Tt),Et1&&(nt.vy+=St*mt.value*it/Et),et>2&&(nt.vz+=Tt*mt.value*it/Et)),!0;if(mt.length||Et>=lt)return;(mt.data!==nt||mt.next)&&(kt===0&&(kt=jiggle(rt),Et+=kt*kt),et>1&&St===0&&(St=jiggle(rt),Et+=St*St),et>2&&Tt===0&&(Tt=jiggle(rt),Et+=Tt*Tt),Et1&&(nt.vy+=St*At),et>2&&(nt.vz+=Tt*At));while(mt=mt.next)}return ut.initialize=function(mt,...gt){tt=mt,rt=gt.find(yt=>typeof yt=="function")||Math.random,et=gt.find(yt=>[1,2,3].includes(yt))||2,ht()},ut.strength=function(mt){return arguments.length?(ot=typeof mt=="function"?mt:constant$7(+mt),ht(),ut):ot},ut.distanceMin=function(mt){return arguments.length?(st=mt*mt,ut):Math.sqrt(st)},ut.distanceMax=function(mt){return arguments.length?(lt=mt*mt,ut):Math.sqrt(lt)},ut.theta=function(mt){return arguments.length?(ct=mt*mt,ut):Math.sqrt(ct)},ut}const simulation=forceSimulation().stop(),defaults$2={numDimensions:3,velocityDecay:.9,forceChargeStrength:-20,forceChargeMinDistance:10,forceChargeMaxDistance:8e3,forceLinkStrength:.04,forceCenterStrength:.85,disableCollide:!1,disableCenter:!1,disableLink:!1,disableCharge:!1,forceCollideRadiusMethod:tt=>(tt.scale||1)*6+200,forceLinkDistanceMethod:tt=>{const et=tt.source.node_type;let nt=50;switch(et){case"topic":nt=30;break;case"guest":nt=30;break;case"clip":nt=10;break;case"episode":nt=15;break}return nt*2}},runForceSimulation=(tt,et,{numDimensions:nt=defaults$2.numDimensions,velocityDecay:rt=defaults$2.velocityDecay,forceChargeStrength:it=defaults$2.forceChargeStrength,forceChargeMinDistance:ot=defaults$2.forceChargeMinDistance,forceChargeMaxDistance:at=defaults$2.forceChargeMaxDistance,forceLinkStrength:st=defaults$2.forceLinkStrength,forceCenterStrength:lt=defaults$2.forceCenterStrength,forceLinkDistanceMethod:ct=defaults$2.forceLinkDistanceMethod,forceCollideRadiusMethod:ut=defaults$2.forceCollideRadiusMethod,disableCollide:ht=defaults$2.disableCollide,disableCenter:dt=defaults$2.disableCenter,disableLink:pt=defaults$2.disableLink,disableCharge:mt=defaults$2.disableCharge})=>(simulation.alpha(1).stop().numDimensions(nt).velocityDecay(rt).force("collide",ht?null:forceCollide().radius(ut).iterations(1)).force("center",dt?null:forceCenter().strength(lt)).force("charge",mt?null:forceManyBody().strength(it).distanceMin(ot).distanceMax(at)).nodes(tt).force("link",pt?null:forceLink().distance(ct).strength(st).id(gt=>gt.id).links(et.filter(gt=>!gt.onlyVisibleOnSelect))).alpha(1).restart(),simulation),simulationTicks$1=60,collisionTicks$1=20,runSimulationPhase$1=tt=>{for(let et=0;et{tt.force("collide",forceCollide().radius(et=>(et.scale||1)*20).iterations(1));for(let et=0;et{const et=tt.map(ot=>({...ot,x:0,y:0,z:0})),nt=generateLinksFromNodeData(et,!1,!1),rt=runForceSimulation(et,nt,{numDimensions:3,forceLinkStrength:.5,forceChargeStrength:-40,forceCenterStrength:.3,velocityDecay:.5});runSimulationPhase$1(rt),runCollisionPhase$1(rt),rt.stop();const it=nt.map(ot=>{const at=et.find(ht=>ht.ref_id===ot.sourceRef),st=et.find(ht=>ht.ref_id===ot.targetRef),lt=["guest","topic"].some(ht=>ht===(at==null?void 0:at.node_type)||ht===(st==null?void 0:st.node_type)),ct=new Vector3((at==null?void 0:at.x)||0,(at==null?void 0:at.y)||0,(at==null?void 0:at.z)||0),ut=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0);return{...ot,onlyVisibleOnSelect:lt,sourcePosition:ct,targetPosition:ut}});return{nodes:et,links:it}},sortAB=(tt,et,nt)=>{let rt=-2;return tt===nt&&et===nt?rt=0:tt===nt&&et!==nt?rt=-1:tt!==nt&&et===nt&&(rt=1),rt},sortNodesByHierarchy=tt=>tt.map(nt=>nt).sort((nt,rt)=>{let it=0;return nt.node_type==="show"||rt.node_type==="show"?it=sortAB(nt.node_type,rt.node_type,"show"):nt.node_type==="episode"||rt.node_type==="episode"?it=sortAB(nt.node_type,rt.node_type,"episode"):nt.node_type==="clip"||rt.node_type==="clip"?it=sortAB(nt.node_type,rt.node_type,"clip"):nt.node_type!=="guest"&&rt.node_type==="guest"?it=sortAB(nt.node_type,rt.node_type,"guest"):it=0,it});function getMyParents(tt,et){const{ref_id:nt}=tt;return!nt||!et?[]:et.filter(it=>{var ot;return(ot=it.children)==null?void 0:ot.includes(nt)})}function getMyChildren(tt,et){return et.filter(rt=>rt.ref_id&&tt.includes(rt.ref_id))}const simulationTicks=60,collisionTicks=20,universeScale$1=5e3,universeCube={scale:universeScale$1/2,position:{x:0,y:0,z:0}};function generateNodePosition$1(tt,et){const{scale:nt,position:rt}=universeCube,it={x:rt.x+Math.random()*nt-nt*.5,y:rt.y+Math.random()*nt-nt*.5,z:rt.z+Math.random()*nt-nt*.5},ot=getMyParents(tt,et),at=ot!=null&&ot.length?new Vector3(ot[0].x,ot[0].y,ot[0].z):null;return at&&(it.x=at.x,it.y=at.y,it.z=at.z),new Vector3(it.x,it.y,it.z)}const runSimulationPhase=tt=>{for(let et=0;et{tt.force("collide",forceCollide().radius(et=>(et.scale||1)*20).iterations(1));for(let et=0;et{const et=[],nt=tt.map(at=>{const st=generateNodePosition$1(at,et),lt={...at,...st};return et.push(lt),lt}),rt=generateLinksFromNodeData(nt,!0,!0),it=runForceSimulation(nt,rt,{numDimensions:3,forceLinkStrength:.01,forceChargeStrength:-80,velocityDecay:.5,disableCenter:!0,disableCharge:!0});runSimulationPhase(it),runCollisionPhase(it),it.stop();const ot=rt.map(at=>{const st=nt.find(dt=>dt.ref_id===at.sourceRef),lt=nt.find(dt=>dt.ref_id===at.targetRef),ct=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);return{...at,onlyVisibleOnSelect:!0,sourcePosition:ct,targetPosition:ut}});return{nodes:nt,links:ot}},universeScale=5e3,padding=300,guestCube={scale:universeScale/2,position:{x:0,y:0,z:universeScale/2+padding}},topicCube={scale:universeScale/2,position:{x:0,y:0,z:-(universeScale/2+padding)}},dataCube={scale:universeScale/2,position:{x:0,y:0,z:0}};function generateGuestNodePosition(){const{scale:tt,position:et}=guestCube,nt={x:et.x+Math.random()*tt-tt*.5,y:et.y+Math.random()*tt-tt*.5,z:et.z+Math.random()*tt-tt*.5},rt=1,it=10;return new Vector3(nt.x+rt*it,nt.y+rt*it,nt.z+rt*it)}function generateTopicNodePosition(){const{scale:tt,position:et}=topicCube,nt={x:et.x+Math.random()*tt-tt*.5,y:et.y+Math.random()*tt-tt*.5,z:et.z+Math.random()*tt-tt*.5},rt=1,it=10;return new Vector3(nt.x+rt*it,nt.y+rt*it,nt.z+rt*it)}function generateNearbyPosition(tt,et,nt=1){let it=0,ot=10*1;const at=0;switch(et){case"episode":ot+=50*(nt||0);break;case"clip":ot=0,it+=50*(nt||0);break}const st=new Vector3;return st.x=tt.x+it,st.y=tt.y+ot,st.z=tt.z+at,st}function generateNodePosition(tt,et,nt){const{ref_id:rt}=tt,{scale:it,position:ot}=dataCube,at={x:ot.x+Math.random()*it-it*.5,y:ot.y+Math.random()*it-it*.5,z:ot.z+Math.random()*it-it*.5},st=getMyParents(tt,nt);let lt=null;if(st!=null&&st.length){const ht=st[0],pt=getMyChildren(ht.children||[],et).findIndex(mt=>mt.ref_id===rt);lt=generateNearbyPosition(new Vector3(ht.x,ht.y,ht.z),tt.node_type,pt+1)}lt&&(at.x=lt.x,at.y=lt.y,at.z=lt.z);const ct=1,ut=1;return new Vector3(at.x+ct*ut,at.y+ct*ut,at.z+ct*ut)}const generateSplitGraphPositions=tt=>{const et=sortNodesByHierarchy(tt),nt=[],rt=et.map(at=>{let st=new Vector3(0,0,0);switch(at.node_type){case"guest":st=generateGuestNodePosition();break;case"topic":st=generateTopicNodePosition();break;case"data_series":st=generateNodePosition({},et,nt);break;default:st=generateNodePosition(at,et,nt);break}const lt={...at,...st};return nt.push(lt),lt}),ot=generateLinksFromNodeData(rt,!0,!0).map(at=>{const st=rt.find(dt=>dt.ref_id===at.sourceRef),lt=rt.find(dt=>dt.ref_id===at.targetRef);let ct=!1;((st==null?void 0:st.node_type)==="guest"||(st==null?void 0:st.node_type)==="topic"||(lt==null?void 0:lt.node_type)==="guest"||(lt==null?void 0:lt.node_type)==="topic")&&(ct=!0);const ut=new Vector3((st==null?void 0:st.x)||0,(st==null?void 0:st.y)||0,(st==null?void 0:st.z)||0),ht=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);return{...at,onlyVisibleOnSelect:ct,sourcePosition:ut,targetPosition:ht}});return rt.sort((at,st)=>(st.weight||0)-(at.weight||0)),{nodes:rt,links:ot}},getGraphDataPositions=(tt,et)=>tt==="split"?generateSplitGraphPositions(et):tt==="sphere"?generateSphereGraphPositions(et):tt==="earth"?generateEarthGraphPositions(et):generateForceGraphPositions(et),defaultData$8={links:[],nodes:[]},shouldIncludeTopics=!0,maxScale=26,fetchGraphData=async tt=>{try{return getGraphData(tt)}catch{return defaultData$8}},fetchNodes=async tt=>{if(!tt)try{return await api.get("/prediction/content/latest")}catch(nt){return console.error(nt),mock}if(isDevelopment||isE2E)return await api.get(`/v2/searching?word=${tt}&free=true`);const et=await getLSat();try{return await api.get(`/v2/search?word=${tt}`,{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));return await payLsat(rt),fetchNodes(tt)}throw nt}},getTrends=async()=>{const tt="/get_trends";return await api.get(tt)},getSentimentData=async tt=>{const et=tt&&new URLSearchParams(tt),nt=et?`/sentiments?${et.toString()}`:"/sentiments";if(isE2E)return await api.get(nt);const rt=await getLSat();try{return await api.get(nt,{Authorization:rt})}catch(it){if(it.status===402){const ot=distExports.Lsat.fromHeader(it.headers.get("www-authenticate"));return await payLsat(ot),getSentimentData(tt)}throw it}},postInstagraph=async tt=>{const et=await getLSat();try{await api.post("/instagraph",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));await payLsat(rt),await postInstagraph(tt);return}throw nt}},postTeachMe=async tt=>{const et=await getLSat();try{await api.post("/teachme",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));await payLsat(rt),await postTeachMe(tt);return}throw nt}},postAskQuestion=async tt=>{const et=await getLSat();try{await api.post("/ask_question",JSON.stringify(tt),{Authorization:et})}catch(nt){if(nt.status===402){const rt=distExports.Lsat.fromHeader(nt.headers.get("www-authenticate"));await payLsat(rt),await postAskQuestion(tt);return}throw nt}},getNodeScale=tt=>{switch(tt.node_type){case"guest":case"episode":case"document":return 2;case"show":return 3;default:return 1.5}};function generateTopicNodesFromMap(tt,et){Object.entries(tt).forEach(([nt,rt],it)=>{const{children:ot,position:at}=rt,{x:st,y:lt,z:ct}=at,ut=ot.length*2>maxScale?maxScale:ot.length*2,ht=`topic_node_${it}`;et({x:st,y:lt,z:ct,children:ot,colors:["#000"],id:ht,label:nt,name:nt,type:"topic",node_type:"topic",ref_id:ht,scale:ut,show_title:nt,text:nt,weight:0})})}function generateGuestNodesFromMap(tt,et){Object.entries(tt).forEach(([nt,rt],it)=>{const ot=rt.children,at=ot.length*2>maxScale?maxScale:ot.length*2,st=nt||`guestnode_${it}`,lt={...rt,x:0,y:0,z:0,colors:["#000"],id:st,image_url:rt.imageUrl,label:rt.name,name:rt.name,node_type:"guest",ref_id:st,scale:at,show_title:rt.name,text:rt.twitterHandle,type:"guest",weight:0};et(lt)})}const getGraphData=async tt=>{const{graphStyle:et}=useDataStore.getState();let nt=[];const rt={},it={};try{const ot=await fetchNodes(tt),at=Array.isArray(ot.data_series)?ot.data_series:[],st=[...ot.exact,...ot.related,...at];let lt=0;st.length&&st.forEach((dt,pt)=>{var yt;if(dt.weight&<bt.ref_id===dt.ref_id))return;const gt=(yt=dt.image_url)==null?void 0:yt.replace(AWS_IMAGE_BUCKET_URL,CLOUDFRONT_IMAGE_BUCKET_URL).replace(".jpg","_s.jpg");nt.push({...dt,scale:getNodeScale(dt),id:dt.ref_id||dt.tweet_id||dt.id,image_url:gt,type:dt.type||dt.node_type}),dt.node_type==="episode"&&dt.ref_id&&(dt.guests||[]).forEach(vt=>{var kt;const xt=vt;xt.name&&xt.ref_id&&dt.ref_id&&(it[xt.ref_id]={children:[...((kt=it[xt.ref_id])==null?void 0:kt.children)||[],dt.ref_id],imageUrl:xt.profile_picture||"",name:xt.name,twitterHandle:xt.twitter_handle})})}),generateGuestNodesFromMap(it,dt=>{nt.push(dt)}),st.forEach(dt=>{const{topics:pt,ref_id:mt,show_title:gt}=dt;pt&&pt.forEach(yt=>{yt!==tt&>&&(rt[yt]&&!rt[yt].children.includes(mt||gt)?rt[yt].children.push(mt||gt):rt[yt]={position:new Vector3(0,0,0),children:[mt||gt]})})}),shouldIncludeTopics&&generateTopicNodesFromMap(rt,dt=>{nt.push(dt)});const ct=getGraphDataPositions(et,nt),{links:ut}=ct;nt=ct.nodes,nt.sort((dt,pt)=>(pt.weight||0)-(dt.weight||0));const ht=getMaxSuperficialWeightPerNodeType(nt,ut);return nt=addWeightNormalizationToNodes(lt,ht,nt,ut),{links:ut,nodes:nt}}catch(ot){return console.error(ot),defaultData$8}},getSegmentColor=(tt,et)=>tt==="topic"||et==="topic"?NODE_RELATIVE_HIGHLIGHT_COLORS.topics.segmentColor:tt==="guest"||et==="guest"?NODE_RELATIVE_HIGHLIGHT_COLORS.guests.segmentColor:NODE_RELATIVE_HIGHLIGHT_COLORS.children.segmentColor,generateLinksFromNodeData=(tt,et,nt)=>{const rt=[];return tt.forEach(it=>{const{children:ot,guests:at}=it;ot==null||ot.forEach(st=>{if(it.ref_id){const lt=tt.find(ht=>ht.ref_id===st)||null;if(!lt)return;const ct=new Vector3(it.x||0,it.y||0,it.z||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);rt.push({onlyVisibleOnSelect:et,color:getSegmentColor(it.node_type,(lt==null?void 0:lt.node_type)||""),source:it.ref_id,sourceRef:it.ref_id,sourcePosition:ct,target:st,targetRef:st,targetPosition:ut})}}),at==null||at.forEach(st=>{if(st&&typeof st!="string"&&it.ref_id){const lt=tt.find(ht=>ht.ref_id===(st==null?void 0:st.ref_id))||null;if(!lt)return;const ct=new Vector3(it.x||0,it.y||0,it.z||0),ut=new Vector3((lt==null?void 0:lt.x)||0,(lt==null?void 0:lt.y)||0,(lt==null?void 0:lt.z)||0);rt.push({onlyVisibleOnSelect:nt,color:getSegmentColor(it.node_type,"guest"),source:it.ref_id,sourceRef:it.ref_id,sourcePosition:ct,target:st==null?void 0:st.ref_id,targetRef:st==null?void 0:st.ref_id,targetPosition:ut})}})}),rt},addWeightNormalizationToNodes=(tt,et,nt,rt)=>nt.map(it=>{let ot=(it.weight||0)/tt;return!it.weight&&et[it.node_type]&&(ot=getSuperficialNodeWeight(it,rt)/et[it.node_type]),{...it,weight:ot}}),saveConsumedContent=async tt=>{await executeIfProd(async()=>{if(!await distExports$1.enable(!0)){console.error("Sphinx enable failed, means no pubkey and no budget (including budget of 0)");return}try{await distExports$1.saveGraphData({metaData:{date:Math.floor(new Date().getTime()/1e3),...tt},type:"second_brain_consumed_content"})}catch(nt){console.warn(nt)}})},saveSearchTerm=async()=>{await executeIfProd(async()=>{await distExports$1.enable(!0)||console.log("Sphinx enable failed, means no pubkey and no budget (including budget of 0)")})},graphStyles=["split","force","sphere","earth"],defaultData$7={categoryFilter:null,data:null,selectionGraphData:{nodes:[],links:[]},scrollEventsDisabled:!1,disableCameraRotation:!1,graphRadius:isChileGraph?1600:3056,graphStyle:"split",isFetching:!1,isTimestampLoaded:!1,queuedSources:null,topics:null,hoveredNode:null,selectedNode:null,selectedTimestamp:null,sources:null,sphinxModalIsOpen:!1,cameraFocusTrigger:!1,selectedNodeRelativeIds:[],nearbyNodeIds:[],showSelectionGraph:!1,showTeachMe:!1,hideNodeDetails:!1},useDataStore=react((tt,et)=>({...defaultData$7,fetchData:async nt=>{if(et().isFetching)return;tt({isFetching:!0,sphinxModalIsOpen:!0});const rt=await fetchGraphData(nt||"");nt&&await saveSearchTerm(),tt({data:rt,isFetching:!1,sphinxModalIsOpen:!1,disableCameraRotation:!1,nearbyNodeIds:[],selectedNodeRelativeIds:[],showSelectionGraph:!1,showTeachMe:!1})},setIsFetching:nt=>tt({isFetching:nt}),setData:nt=>tt({data:nt}),setSelectionData:nt=>tt({selectionGraphData:nt}),setScrollEventsDisabled:nt=>tt({scrollEventsDisabled:nt}),setCategoryFilter:nt=>tt({categoryFilter:nt}),setDisableCameraRotation:nt=>tt({disableCameraRotation:nt}),setGraphRadius:nt=>tt({graphRadius:nt}),setGraphStyle:nt=>tt({graphStyle:nt}),setQueuedSources:nt=>tt({queuedSources:nt}),setTopics:nt=>tt({topics:nt}),setHoveredNode:nt=>tt({hoveredNode:nt}),setSelectedNode:nt=>{const rt=et().selectedNode;if((rt==null?void 0:rt.ref_id)!==(nt==null?void 0:nt.ref_id)){const{data:it}=et(),ot=(it==null?void 0:it.nodes.filter(at=>at.ref_id&&nodesAreRelatives(at,nt)).map(at=>(at==null?void 0:at.ref_id)||""))||[];tt({hoveredNode:null,isTimestampLoaded:!1,selectedNode:nt,disableCameraRotation:!0,selectedNodeRelativeIds:ot})}},setSelectedTimestamp:nt=>tt({selectedTimestamp:nt}),setSources:nt=>tt({sources:nt}),setSphinxModalOpen:nt=>tt({sphinxModalIsOpen:nt}),setCameraFocusTrigger:nt=>tt({cameraFocusTrigger:nt}),setNearbyNodeIds:nt=>{const rt=et().nearbyNodeIds;(nt.length!==rt.length||nt[0]!==rt[0])&&tt({nearbyNodeIds:nt})},setShowSelectionGraph:nt=>tt({showSelectionGraph:nt}),setHideNodeDetails:nt=>tt({hideNodeDetails:nt}),setTeachMe:nt=>tt({showTeachMe:nt})})),useSelectedNode=()=>useDataStore(tt=>tt.selectedNode),setIsTimestampLoaded=tt=>useDataStore.setState({isTimestampLoaded:tt}),topupFromToast=async()=>{try{const tt=await distExports$1.topup();if(!tt)throw new Error("Topup failed");if(tt.budget<5)throw new Error("You set a budget of less than 5 sats");toast(jsxRuntimeExports.jsx(ToastMessage,{message:`You set a budget of ${tt.budget} sats`}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:"success"})}catch(tt){tt instanceof Error&&toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt.message}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:"error"})}},ToastMessage=({message:tt})=>tt===BOOST_ERROR_BUDGET?jsxRuntimeExports.jsxs("div",{children:[tt,jsxRuntimeExports.jsx(ButtonWrapper,{onClick:topupFromToast,type:"button",children:jsxRuntimeExports.jsx(Text$3,{color:"white",kind:"medium",children:"Topup"})})]}):jsxRuntimeExports.jsx("div",{children:tt}),ButtonWrapper=styled$4.button` background: ${colors.gray200}; border: 1px solid ${colors.white}; border-radius: 2px; @@ -4025,7 +4025,7 @@ A Bitcoin Podcast. Enter a valid link to the YouTube video or Twitter Space you were watching, choose a start and end timestamp to encompass the segment you found interesting or useful, provide a brief description of what the segment is about, and add topic tags that are relevant to the segment. Hit "Add node", and your clip will be added to the graph shortly. -Your pubkey will be submitted with your clip, and any boosts your clip receives will go to you!`,infoMessageSource="If you come across a source that produces ongoing content (e.g. a twitter account, youtube channel, etc). You can add it to the source table for your graph. Once the source is added to the table we will gather new content produced by that source, process it, and add it to your graph.",notify$1=tt=>{toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt}),{icon:tt===NODE_ADD_SUCCESS?jsxRuntimeExports.jsx(MdCheckCircle,{color:colors.primaryGreen}):jsxRuntimeExports.jsx(MdWarning,{color:colors.primaryRed}),position:toast.POSITION.BOTTOM_CENTER,type:tt===NODE_ADD_SUCCESS?"success":"error"})},handleSubmit=async(tt,et,nt,rt)=>{var st;const it={};if(nt===LINK)it.media_url=tt.link,tt.withTimeStamps?(it.content_type="clip",it.job_response={tags:[{description:tt.description,"end-time":timeToMilliseconds(tt.endTime),"start-time":timeToMilliseconds(tt.startTime),tag:(st=tt.tags)==null?void 0:st.join(", ")}]}):tt.withLocation?(it.latitude=tt.latitude,it.longitude=tt.longitude):it.content_type;else if(nt===TWITTER_SOURCE){const lt=/(?:https?:\/\/)?(?:www\.)?twitter\.com\/\w+\/status\/\d+/,ct=/^[0-9]{16,}$/;if(lt.test(tt.tweet)){const ut=/\/status\/(\d+)/,ht=tt.tweet.match(ut);if(ht!=null&&ht[1]){const[,dt]=ht;it.tweet_id=dt}}else it.tweet_id=tt.tweet;if(!ct.test(it.tweet_id))return;tt.withLocation&&(it.latitude=tt.latitude,it.longitude=tt.longitude),it.content_type="tweet"}else nt===WEB_PAGE?(it.content_type="webpage",it.web_page=tt.web_page):nt===DOCUMENT?(it.content_type="document",it.text=tt.document):(it.source_type=nt,nt===TWITTER_HANDLE?it.source=(tt.source||"").replace(/[@]/g,""):it.source=tt.source);let ot="";await executeIfProd(async()=>{const lt=await distExports$1.enable();it.pubkey=lt==null?void 0:lt.pubkey,ot=await getLSat()});const at=CONTENT_TYPES.includes(nt)?"add_node":"radar";try{const lt=await api.post(`/${at}`,JSON.stringify(it),{Authorization:ot});if(lt.error){const{message:ct}=lt.error;throw new Error(ct)}at==="radar"&&await rt(),notify$1(NODE_ADD_SUCCESS),et()}catch(lt){if(lt.status===402){const ct=distExports.Lsat.fromHeader(lt.headers.get("www-authenticate"));await payLsat(ct),await handleSubmit(tt,et,nt,rt)}lt instanceof Error&&(notify$1(NODE_ADD_ERROR),et())}},CONTENT_TYPE_OPTIONS={content:{[LINK]:{component:SourceUrl,label:"Youtube / Twitter space / Mp3"},[TWITTER_SOURCE]:{component:TwitId,label:"Tweet"},[WEB_PAGE]:{component:WebPage,label:"Webpage (Text)"},[DOCUMENT]:{component:Document,label:"Document"}},source:{[GITHUB_REPOSITORY]:{component:GithubRepository,label:"Github repository"},[RSS]:{component:RSSFeed,label:"RSS feed"},[TOPIC]:{component:Topic$1,label:"Topic"},[TWITTER_HANDLE]:{component:TwitterHandle$2,label:"Twitter handle"},[YOUTUBE_CHANNEL]:{component:YoutubeChannel,label:"Youtube channel"}}},CONTENT_TYPES=Object.keys(CONTENT_TYPE_OPTIONS.content),AddNodeModal=()=>{const{close:tt,addNodeModalData:et}=useModal("addNode"),[nt,rt]=reactExports.useState(""),it=useDataStore(kt=>kt.setSources),ot=et?CONTENT_TYPE_OPTIONS[et]:null,at=et==="source"?infoMessageSource:infoMessageContent,st=useForm({mode:"onSubmit"}),{reset:lt,watch:ct,setValue:ut}=st,{isSubmitting:ht}=st.formState,dt=()=>{rt(""),lt(),tt()},pt=async()=>{if([TWITTER_HANDLE,TOPIC].includes(nt))try{const kt=await getRadarData();it(kt.data)}catch(kt){console.warn(kt)}},mt=st.handleSubmit(async kt=>{await handleSubmit(kt,dt,nt,pt)}),gt=ot?Object.keys(ot).map(kt=>({label:ot[kt].label,value:kt})):[],yt=nt?[{label:nt,value:nt}]:[],bt=ct("startTime"),vt=nt&&ot?ot[nt].component:()=>null,xt={setValue:ut,startTime:bt};return ot&&jsxRuntimeExports.jsx(BaseModal,{id:"addNode",preventOutsideClose:!0,children:jsxRuntimeExports.jsx(FormProvider,{...st,children:jsxRuntimeExports.jsx("form",{id:"add-node-form",onSubmit:mt,children:jsxRuntimeExports.jsxs(Wrapper$o,{children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"space-between",pb:32,children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",children:[nt&&jsxRuntimeExports.jsx(BackButton,{onClick:()=>rt(""),children:jsxRuntimeExports.jsx(MdKeyboardBackspace,{color:colors.white,size:24})}),jsxRuntimeExports.jsxs(Text$3,{kind:"bigHeadingBold",children:["Add ",et]})]}),jsxRuntimeExports.jsxs(InfoIcon,{role:"tooltip",tabIndex:0,children:[jsxRuntimeExports.jsx(MdInfo,{}),jsxRuntimeExports.jsx("div",{className:"tooltip",children:at})]})]}),jsxRuntimeExports.jsx(CloseButton$5,{id:"add-node-close-button",onClick:dt,onKeyDown:kt=>{(kt.key==="Enter"||kt.key==="Space")&&dt()},role:"button",tabIndex:0,children:jsxRuntimeExports.jsx(MdClose,{color:"white"})})]}),nt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(vt,{...xt})}),jsxRuntimeExports.jsx(Flex,{pt:16,px:4,tabIndex:0,children:jsxRuntimeExports.jsx(Text$3,{color:"lightGray",kind:"tinyBold",children:"Your pubkey will be submitted with your input, so you can receive sats that your content earns."})}),jsxRuntimeExports.jsx(Flex,{pt:8,children:ht?jsxRuntimeExports.jsx(SubmitLoader$1,{children:jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.white,size:20})}):jsxRuntimeExports.jsx(Button,{disabled:ht,id:"add-node-submit-cta",kind:"big",type:"submit",children:`Add ${et}`})})]}):jsxRuntimeExports.jsxs(Stack$5,{alignItems:{xs:"stretch",sm:"flex-start",minHeight:"160px"},component:"div",direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:2,children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Text$3,{kind:"mediumBold",children:"What do you want to add?"})}),jsxRuntimeExports.jsx(Flex,{grow:1,children:jsxRuntimeExports.jsx(StyledSelect$1,{className:clsx$1(yt.length&&"hasSelected","cy-select-content-type"),clearable:!0,onChange:kt=>{rt(kt.length?kt[0].value:"")},options:gt,placeholder:`Select ${et} type`,searchable:!1,values:yt})})]})]})})})})},CloseButton$5=styled$4(Flex)` +Your pubkey will be submitted with your clip, and any boosts your clip receives will go to you!`,infoMessageSource="If you come across a source that produces ongoing content (e.g. a twitter account, youtube channel, etc). You can add it to the source table for your graph. Once the source is added to the table we will gather new content produced by that source, process it, and add it to your graph.",notify$1=tt=>{toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt}),{icon:tt===NODE_ADD_SUCCESS?jsxRuntimeExports.jsx(MdCheckCircle,{color:colors.primaryGreen}):jsxRuntimeExports.jsx(MdWarning,{color:colors.primaryRed}),position:toast.POSITION.BOTTOM_CENTER,type:tt===NODE_ADD_SUCCESS?"success":"error"})},handleSubmit=async(tt,et,nt,rt,it)=>{var lt;const ot={};if(nt===LINK)ot.media_url=tt.link,tt.withTimeStamps?(ot.content_type="clip",ot.job_response={tags:[{description:tt.description,"end-time":timeToMilliseconds(tt.endTime),"start-time":timeToMilliseconds(tt.startTime),tag:(lt=tt.tags)==null?void 0:lt.join(", ")}]}):tt.withLocation?(ot.latitude=tt.latitude,ot.longitude=tt.longitude):ot.content_type;else if(nt===TWITTER_SOURCE){const ct=/(?:https?:\/\/)?(?:www\.)?twitter\.com\/\w+\/status\/\d+/,ut=/^[0-9]{16,}$/;if(ct.test(tt.tweet)){const ht=/\/status\/(\d+)/,dt=tt.tweet.match(ht);if(dt!=null&&dt[1]){const[,pt]=dt;ot.tweet_id=pt}}else ot.tweet_id=tt.tweet;if(!ut.test(ot.tweet_id))return;tt.withLocation&&(ot.latitude=tt.latitude,ot.longitude=tt.longitude),ot.content_type="tweet"}else nt===WEB_PAGE?(ot.content_type="webpage",ot.web_page=tt.web_page):nt===DOCUMENT?(ot.content_type="document",ot.text=tt.document):(ot.source_type=nt,nt===TWITTER_HANDLE?ot.source=(tt.source||"").replace(/[@]/g,""):ot.source=tt.source);let at="";await executeIfProd(async()=>{const ct=await distExports$1.enable();ot.pubkey=ct==null?void 0:ct.pubkey,at=await getLSat()});const st=CONTENT_TYPES.includes(nt)?"add_node":"radar";try{const ct=await api.post(`/${st}`,JSON.stringify(ot),{Authorization:at});if(ct.error){const{message:ut}=ct.error;throw new Error(ut)}st==="radar"&&await rt(),notify$1(NODE_ADD_SUCCESS),et()}catch(ct){if(ct.status===402){const ut=distExports.Lsat.fromHeader(ct.headers.get("www-authenticate"));await payLsat(ut),await updateBudget(it),await handleSubmit(tt,et,nt,rt,it)}ct instanceof Error&&(notify$1(NODE_ADD_ERROR),et())}},CONTENT_TYPE_OPTIONS={content:{[LINK]:{component:SourceUrl,label:"Youtube / Twitter space / Mp3"},[TWITTER_SOURCE]:{component:TwitId,label:"Tweet"},[WEB_PAGE]:{component:WebPage,label:"Webpage (Text)"},[DOCUMENT]:{component:Document,label:"Document"}},source:{[GITHUB_REPOSITORY]:{component:GithubRepository,label:"Github repository"},[RSS]:{component:RSSFeed,label:"RSS feed"},[TOPIC]:{component:Topic$1,label:"Topic"},[TWITTER_HANDLE]:{component:TwitterHandle$2,label:"Twitter handle"},[YOUTUBE_CHANNEL]:{component:YoutubeChannel,label:"Youtube channel"}}},CONTENT_TYPES=Object.keys(CONTENT_TYPE_OPTIONS.content),AddNodeModal=()=>{const{close:tt,addNodeModalData:et}=useModal("addNode"),[nt,rt]=reactExports.useState(""),it=useDataStore(St=>St.setSources),[ot]=useUserStore(St=>[St.setBudget]),at=et?CONTENT_TYPE_OPTIONS[et]:null,st=et==="source"?infoMessageSource:infoMessageContent,lt=useForm({mode:"onSubmit"}),{reset:ct,watch:ut,setValue:ht}=lt,{isSubmitting:dt}=lt.formState,pt=()=>{rt(""),ct(),tt()},mt=async()=>{if([TWITTER_HANDLE,TOPIC].includes(nt))try{const St=await getRadarData();it(St.data)}catch(St){console.warn(St)}},gt=lt.handleSubmit(async St=>{await handleSubmit(St,pt,nt,mt,ot)}),yt=at?Object.keys(at).map(St=>({label:at[St].label,value:St})):[],bt=nt?[{label:nt,value:nt}]:[],vt=ut("startTime"),xt=nt&&at?at[nt].component:()=>null,kt={setValue:ht,startTime:vt};return at&&jsxRuntimeExports.jsx(BaseModal,{id:"addNode",preventOutsideClose:!0,children:jsxRuntimeExports.jsx(FormProvider,{...lt,children:jsxRuntimeExports.jsx("form",{id:"add-node-form",onSubmit:gt,children:jsxRuntimeExports.jsxs(Wrapper$o,{children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"space-between",pb:32,children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",children:[jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",children:[nt&&jsxRuntimeExports.jsx(BackButton,{onClick:()=>rt(""),children:jsxRuntimeExports.jsx(MdKeyboardBackspace,{color:colors.white,size:24})}),jsxRuntimeExports.jsxs(Text$3,{kind:"bigHeadingBold",children:["Add ",et]})]}),jsxRuntimeExports.jsxs(InfoIcon,{role:"tooltip",tabIndex:0,children:[jsxRuntimeExports.jsx(MdInfo,{}),jsxRuntimeExports.jsx("div",{className:"tooltip",children:st})]})]}),jsxRuntimeExports.jsx(CloseButton$5,{id:"add-node-close-button",onClick:pt,onKeyDown:St=>{(St.key==="Enter"||St.key==="Space")&&pt()},role:"button",tabIndex:0,children:jsxRuntimeExports.jsx(MdClose,{color:"white"})})]}),nt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(xt,{...kt})}),jsxRuntimeExports.jsx(Flex,{pt:16,px:4,tabIndex:0,children:jsxRuntimeExports.jsx(Text$3,{color:"lightGray",kind:"tinyBold",children:"Your pubkey will be submitted with your input, so you can receive sats that your content earns."})}),jsxRuntimeExports.jsx(Flex,{pt:8,children:dt?jsxRuntimeExports.jsx(SubmitLoader$1,{children:jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.white,size:20})}):jsxRuntimeExports.jsx(Button,{disabled:dt,id:"add-node-submit-cta",kind:"big",type:"submit",children:`Add ${et}`})})]}):jsxRuntimeExports.jsxs(Stack$5,{alignItems:{xs:"stretch",sm:"flex-start",minHeight:"160px"},component:"div",direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:2,children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Text$3,{kind:"mediumBold",children:"What do you want to add?"})}),jsxRuntimeExports.jsx(Flex,{grow:1,children:jsxRuntimeExports.jsx(StyledSelect$1,{className:clsx$1(bt.length&&"hasSelected","cy-select-content-type"),clearable:!0,onChange:St=>{rt(St.length?St[0].value:"")},options:yt,placeholder:`Select ${et} type`,searchable:!1,values:bt})})]})]})})})})},CloseButton$5=styled$4(Flex)` cursor: pointer; svg { @@ -6847,7 +6847,7 @@ void main() { `,Fallback=()=>jsxRuntimeExports.jsx(Html$1,{children:jsxRuntimeExports.jsx(Loader$1,{})}),Content$1=()=>{const{universeColor:tt}=useControls("universe",{universeColor:colors.black}),et=useSelectedNode(),nt=reactExports.useMemo(()=>et!=null&&et.node_type?getNodeColorByType(et.node_type):outlineEffectColor,[et]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("color",{args:[tt],attach:"background"}),jsxRuntimeExports.jsx(Lights,{}),jsxRuntimeExports.jsx(Controls,{}),jsxRuntimeExports.jsxs(Selection$2,{children:[jsxRuntimeExports.jsxs(EffectComposer,{autoClear:!1,multisampling:8,children:[jsxRuntimeExports.jsx(Vignette,{darkness:.7,eskil:!1,offset:.05}),jsxRuntimeExports.jsx(Bloom,{luminanceThreshold:1,mipmapBlur:!0,resolutionX:Resolution.AUTO_SIZE,resolutionY:Resolution.AUTO_SIZE}),jsxRuntimeExports.jsx(Outline,{blendFunction:BlendFunction.SCREEN,blur:!0,edgeStrength:4,hiddenEdgeColor:nt,visibleEdgeColor:nt})]}),jsxRuntimeExports.jsx(Graph,{})]})]})};let wheelEventTimeout=null;const cameraProps={aspect:window.innerWidth/window.innerHeight,far:3e4,near:1,position:[initialCameraPosition.x,initialCameraPosition.y,initialCameraPosition.z]},_Universe=()=>{const[tt,et,nt]=[useControlStore(at=>at.setIsUserScrollingOnHtmlPanel),useControlStore(at=>at.setIsUserScrolling),useControlStore(at=>at.setUserMovedCamera)],rt=useDataStore(at=>at.isFetching),it=reactExports.useCallback(at=>{var ct;const{target:st}=at,{offsetParent:lt}=st;wheelEventTimeout&&clearTimeout(wheelEventTimeout),(ct=lt==null?void 0:lt.classList)!=null&&ct.contains("html-panel")&<.clientHeight{et(!1),tt(!1)},200)},[et,tt,nt]),ot=reactExports.useCallback(at=>addToGlobalForE2e(at,"threeState"),[]);return jsxRuntimeExports.jsxs(Wrapper$m,{children:[jsxRuntimeExports.jsx(Overlay,{}),jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:null,children:jsxRuntimeExports.jsxs(Canvas$1,{camera:cameraProps,id:"universe-canvas",onCreated:ot,onWheel:it,children:[isDevelopment&&jsxRuntimeExports.jsx(Perf,{position:"top-right"}),jsxRuntimeExports.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx(Fallback,{}),children:[jsxRuntimeExports.jsx(Preload,{}),jsxRuntimeExports.jsx(AdaptiveDpr,{}),jsxRuntimeExports.jsx(AdaptiveEvents,{}),jsxRuntimeExports.jsx(Content$1,{})]})]})}),rt&&jsxRuntimeExports.jsx(Preloader,{fullSize:!1})]})},Wrapper$m=styled$4(Flex)` flex: 1 1 100%; position: relative; -`,Universe=reactExports.memo(_Universe),defaultData$3={askedQuestions:null,askedQuestionsAnswers:null,hasQuestionInProgress:!1,hasTeachingInProgress:!1,hasInstagraphInProgress:!1,teachMeAnswer:null,instgraphAnswser:null},useTeachStore=react(tt=>({...defaultData$3,setAskedQuestion:et=>tt(nt=>({askedQuestions:[...nt.askedQuestions||[],et],hasQuestionInProgress:!0})),setAskedQuestionAnswer:et=>tt(nt=>({askedQuestionsAnswers:[...nt.askedQuestionsAnswers||[],et],hasQuestionInProgress:!1})),setHasQuestionInProgress:et=>tt({hasQuestionInProgress:et}),setHasTeachingInProgress:et=>tt({hasTeachingInProgress:et}),setHasInstagraphInProgress:et=>tt({hasInstagraphInProgress:et}),setTeachMeAnswer:et=>tt({hasTeachingInProgress:!1,teachMeAnswer:et}),setInstagraphAnswer:et=>{var nt,rt,it,ot;(nt=et==null?void 0:et.instagraph)!=null&&nt.edges&&((rt=et==null?void 0:et.instagraph)!=null&&rt.nodes)&&tt({hasInstagraphInProgress:!1,instgraphAnswser:{edges:(it=et==null?void 0:et.instagraph)==null?void 0:it.edges,nodes:(ot=et==null?void 0:et.instagraph)==null?void 0:ot.nodes}})}})),version="0.1.84",StyledTableCell=styled$4(TableCell$1)` +`,Universe=reactExports.memo(_Universe),defaultData$3={askedQuestions:null,askedQuestionsAnswers:null,hasQuestionInProgress:!1,hasTeachingInProgress:!1,hasInstagraphInProgress:!1,teachMeAnswer:null,instgraphAnswser:null},useTeachStore=react(tt=>({...defaultData$3,setAskedQuestion:et=>tt(nt=>({askedQuestions:[...nt.askedQuestions||[],et],hasQuestionInProgress:!0})),setAskedQuestionAnswer:et=>tt(nt=>({askedQuestionsAnswers:[...nt.askedQuestionsAnswers||[],et],hasQuestionInProgress:!1})),setHasQuestionInProgress:et=>tt({hasQuestionInProgress:et}),setHasTeachingInProgress:et=>tt({hasTeachingInProgress:et}),setHasInstagraphInProgress:et=>tt({hasInstagraphInProgress:et}),setTeachMeAnswer:et=>tt({hasTeachingInProgress:!1,teachMeAnswer:et}),setInstagraphAnswer:et=>{var nt,rt,it,ot;(nt=et==null?void 0:et.instagraph)!=null&&nt.edges&&((rt=et==null?void 0:et.instagraph)!=null&&rt.nodes)&&tt({hasInstagraphInProgress:!1,instgraphAnswser:{edges:(it=et==null?void 0:et.instagraph)==null?void 0:it.edges,nodes:(ot=et==null?void 0:et.instagraph)==null?void 0:ot.nodes}})}})),version="0.1.85",StyledTableCell=styled$4(TableCell$1)` && { color: ${colors.white}; border: none; @@ -6903,7 +6903,7 @@ void main() { ${Text$3} { margin-bottom: 0; } -`,sourcesMapper={[GITHUB_REPOSITORY]:"Github repository",[RSS]:"RSS link",[TOPIC]:"Topic",[TWITTER_HANDLE]:"Twitter Handle",[YOUTUBE_CHANNEL]:"Youtube channel"},TWITTER_LINK="https://twitter.com",FilterOffIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"filter_alt_off",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1543_23288",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1543_23288)",children:jsxRuntimeExports.jsx("path",{id:"filter_alt_off_2",d:"M14.8 11.9748L6.82503 3.9998H19C19.4167 3.9998 19.7167 4.18314 19.9 4.5498C20.0834 4.91647 20.05 5.26647 19.8 5.5998L14.8 11.9748ZM19.775 22.5998L14 16.8248V18.9998C14 19.2831 13.9042 19.5206 13.7125 19.7123C13.5209 19.904 13.2834 19.9998 13 19.9998H11C10.7167 19.9998 10.4792 19.904 10.2875 19.7123C10.0959 19.5206 10 19.2831 10 18.9998V12.8248L1.40002 4.2248L2.80002 2.7998L21.2 21.1998L19.775 22.5998Z",fill:"currentColor"})})]})}),ConfirmPopover=({message:tt="Are you sure you want to delete this item?",onConfirm:et,children:nt,anchorOrigin:rt={vertical:"bottom",horizontal:"center"},transformOrigin:it={vertical:"top",horizontal:"center"}})=>{const[ot,at]=reactExports.useState(null),st=dt=>{at(dt.currentTarget)},lt=()=>{at(null)},ct=()=>{et(),lt()},ut=()=>{lt()},ht=!!ot;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{children:React$1.cloneElement(nt,{onClick:st})}),jsxRuntimeExports.jsx(Popover$1,{anchorEl:ot,anchorOrigin:rt,onClose:lt,open:ht,transformOrigin:it,children:jsxRuntimeExports.jsxs(Wrapper$l,{justify:"space-around",children:[jsxRuntimeExports.jsx(Text$3,{children:tt}),jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"center",pt:8,children:[jsxRuntimeExports.jsx(Button,{kind:"small",onClick:ct,children:"Yes"}),jsxRuntimeExports.jsx(Button,{className:"secondary",kind:"small",onClick:ut,children:"No"})]})]})})]})},Wrapper$l=styled$4(Flex)` +`,sourcesMapper={[GITHUB_REPOSITORY]:"Github repository",[RSS]:"RSS link",[TOPIC]:"Topic",[TWITTER_HANDLE]:"Twitter Handle",[YOUTUBE_CHANNEL]:"Youtube channel"},TWITTER_LINK="https://twitter.com",ConfirmPopover=({message:tt="Are you sure you want to delete this item?",onConfirm:et,children:nt,anchorOrigin:rt={vertical:"bottom",horizontal:"center"},transformOrigin:it={vertical:"top",horizontal:"center"}})=>{const[ot,at]=reactExports.useState(null),st=dt=>{at(dt.currentTarget)},lt=()=>{at(null)},ct=()=>{et(),lt()},ut=()=>{lt()},ht=!!ot;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{children:React$1.cloneElement(nt,{onClick:st})}),jsxRuntimeExports.jsx(Popover$1,{anchorEl:ot,anchorOrigin:rt,onClose:lt,open:ht,transformOrigin:it,children:jsxRuntimeExports.jsxs(Wrapper$l,{justify:"space-around",children:[jsxRuntimeExports.jsx(Text$3,{children:tt}),jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"center",pt:8,children:[jsxRuntimeExports.jsx(Button,{kind:"small",onClick:ct,children:"Yes"}),jsxRuntimeExports.jsx(Button,{className:"secondary",kind:"small",onClick:ut,children:"No"})]})]})})]})},Wrapper$l=styled$4(Flex)` background: ${colors.headerBackground}; color: ${colors.white}; padding: 16px 8px; @@ -6913,7 +6913,7 @@ void main() { background: transparent; border: 1px solid ${colors.primaryButton}; } -`,Table$2=({data:tt})=>{const et=useDataStore(at=>at.setQueuedSources),[nt,rt]=reactExports.useState(""),it=async at=>{if(tt!=null&&tt.length)try{const st=await distExports$1.enable();await approveRadarData(at,st.pubkey),et(tt.filter(lt=>lt.ref_id!==at))}catch(st){console.warn(st)}},ot=async at=>{if(!(!at||!(tt!=null&&tt.length))){rt(at);try{await deleteRadarData(at),et(tt==null?void 0:tt.filter(st=>st.ref_id!==at))}catch(st){console.warn(st)}finally{rt("")}}};return tt!=null&&tt.length?jsxRuntimeExports.jsxs(MaterialTable,{component:"table",children:[jsxRuntimeExports.jsx(StyledTableHead,{children:jsxRuntimeExports.jsxs(TableRow$1,{component:"tr",children:[jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"}),jsxRuntimeExports.jsx(StyledTableCell,{children:"Type"}),jsxRuntimeExports.jsx(StyledTableCell,{children:"Source"}),jsxRuntimeExports.jsx(StyledTableCell,{}),jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"})]})}),(tt==null?void 0:tt.length)&&jsxRuntimeExports.jsx("tbody",{children:tt==null?void 0:tt.map(at=>jsxRuntimeExports.jsxs(StyledTableRow,{children:[jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"}),jsxRuntimeExports.jsx(StyledTableCell,{children:sourcesMapper[at.source_type]}),jsxRuntimeExports.jsx(StyledTableCell,{width:"268px",children:at.source_type==="twitter_handle"?jsxRuntimeExports.jsxs(StyledLink$1,{href:`${TWITTER_LINK}/${at.source}`,target:"_blank",children:["@",at.source]}):jsxRuntimeExports.jsx("div",{children:at.source})}),jsxRuntimeExports.jsx(StyledTableCell,{className:"cell-center",children:jsxRuntimeExports.jsxs(Flex,{direction:"row",justify:"space-between",children:[jsxRuntimeExports.jsx("div",{className:"approve-wrapper",children:jsxRuntimeExports.jsx(IconWrapper$4,{className:"centered",onClick:()=>it(at.ref_id),children:jsxRuntimeExports.jsx(MdCheckCircle,{color:colors.primaryGreen,fontSize:24})})}),jsxRuntimeExports.jsx("div",{className:"delete-wrapper",children:nt===at.ref_id?jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.white,size:16}):jsxRuntimeExports.jsx(ConfirmPopover,{message:"Are you sure ?",onConfirm:()=>ot(at.ref_id),children:jsxRuntimeExports.jsx(IconWrapper$4,{className:"centered",children:jsxRuntimeExports.jsx(MdCancel,{color:colors.primaryRed,fontSize:24})})})})]})}),jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"})]},at.source))})]}):jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text$3,{children:"There is not any results for selected filters"}),jsxRuntimeExports.jsx(FilterOffIcon,{})]})},IconWrapper$4=styled$4(Flex)` +`,FilterOffIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"filter_alt_off",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1543_23288",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1543_23288)",children:jsxRuntimeExports.jsx("path",{id:"filter_alt_off_2",d:"M14.8 11.9748L6.82503 3.9998H19C19.4167 3.9998 19.7167 4.18314 19.9 4.5498C20.0834 4.91647 20.05 5.26647 19.8 5.5998L14.8 11.9748ZM19.775 22.5998L14 16.8248V18.9998C14 19.2831 13.9042 19.5206 13.7125 19.7123C13.5209 19.904 13.2834 19.9998 13 19.9998H11C10.7167 19.9998 10.4792 19.904 10.2875 19.7123C10.0959 19.5206 10 19.2831 10 18.9998V12.8248L1.40002 4.2248L2.80002 2.7998L21.2 21.1998L19.775 22.5998Z",fill:"currentColor"})})]})}),Table$2=({data:tt})=>{const et=useDataStore(at=>at.setQueuedSources),[nt,rt]=reactExports.useState(""),it=async at=>{if(tt!=null&&tt.length)try{const st=await distExports$1.enable();await approveRadarData(at,st.pubkey),et(tt.filter(lt=>lt.ref_id!==at))}catch(st){console.warn(st)}},ot=async at=>{if(!(!at||!(tt!=null&&tt.length))){rt(at);try{await deleteRadarData(at),et(tt==null?void 0:tt.filter(st=>st.ref_id!==at))}catch(st){console.warn(st)}finally{rt("")}}};return tt!=null&&tt.length?jsxRuntimeExports.jsxs(MaterialTable,{component:"table",children:[jsxRuntimeExports.jsx(StyledTableHead,{children:jsxRuntimeExports.jsxs(TableRow$1,{component:"tr",children:[jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"}),jsxRuntimeExports.jsx(StyledTableCell,{children:"Type"}),jsxRuntimeExports.jsx(StyledTableCell,{children:"Source"}),jsxRuntimeExports.jsx(StyledTableCell,{}),jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"})]})}),(tt==null?void 0:tt.length)&&jsxRuntimeExports.jsx("tbody",{children:tt==null?void 0:tt.map(at=>jsxRuntimeExports.jsxs(StyledTableRow,{children:[jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"}),jsxRuntimeExports.jsx(StyledTableCell,{children:sourcesMapper[at.source_type]}),jsxRuntimeExports.jsx(StyledTableCell,{width:"268px",children:at.source_type==="twitter_handle"?jsxRuntimeExports.jsxs(StyledLink$1,{href:`${TWITTER_LINK}/${at.source}`,target:"_blank",children:["@",at.source]}):jsxRuntimeExports.jsx("div",{children:at.source})}),jsxRuntimeExports.jsx(StyledTableCell,{className:"cell-center",children:jsxRuntimeExports.jsxs(Flex,{direction:"row",justify:"space-between",children:[jsxRuntimeExports.jsx("div",{className:"approve-wrapper",children:jsxRuntimeExports.jsx(IconWrapper$4,{className:"centered",onClick:()=>it(at.ref_id),children:jsxRuntimeExports.jsx(MdCheckCircle,{color:colors.primaryGreen,fontSize:24})})}),jsxRuntimeExports.jsx("div",{className:"delete-wrapper",children:nt===at.ref_id?jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.white,size:16}):jsxRuntimeExports.jsx(ConfirmPopover,{message:"Are you sure ?",onConfirm:()=>ot(at.ref_id),children:jsxRuntimeExports.jsx(IconWrapper$4,{className:"centered",children:jsxRuntimeExports.jsx(MdCancel,{color:colors.primaryRed,fontSize:24})})})})]})}),jsxRuntimeExports.jsx(StyledTableCell,{className:"empty"})]},at.source))})]}):jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(Text$3,{children:"There is not any results for selected filters"}),jsxRuntimeExports.jsx(FilterOffIcon,{})]})},IconWrapper$4=styled$4(Flex)` width: 20px; height: 20px; border-radius: 50%; @@ -7194,7 +7194,9 @@ __p += '`),Ho&&(Or+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+Or+`return __p -}`;var Lo=dw(function(){return $o(Wn,uo+"return "+Or).apply(nt,Xn)});if(Lo.source=Or,o1(Lo))throw Lo;return Lo}function sx(Rt){return Qo(Rt).toLowerCase()}function lx(Rt){return Qo(Rt).toUpperCase()}function cx(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return wm(Rt);if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=ss(Vt),Wn=_a(yn,Bn),Xn=cp(yn,Bn)+1;return Uu(yn,Wn,Xn).join("")}function ux(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return Rt.slice(0,fp(Rt)+1);if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=cp(yn,ss(Vt))+1;return Uu(yn,0,Bn).join("")}function hx(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return Rt.replace(xn,"");if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=_a(yn,ss(Vt));return Uu(yn,Bn).join("")}function dx(Rt,Vt){var Yt=Dt,yn=jt;if(ds(Vt)){var Bn="separator"in Vt?Vt.separator:Bn;Yt="length"in Vt?Do(Vt.length):Yt,yn="omission"in Vt?js(Vt.omission):yn}Rt=Qo(Rt);var Wn=Rt.length;if(qu(Rt)){var Xn=ss(Rt);Wn=Xn.length}if(Yt>=Wn)return Rt;var Qn=Yt-ru(yn);if(Qn<1)return yn;var ar=Xn?Uu(Xn,0,Qn).join(""):Rt.slice(0,Qn);if(Bn===nt)return ar+yn;if(Xn&&(Qn+=ar.length-Qn),a1(Bn)){if(Rt.slice(Qn).search(Bn)){var Ir,Cr=ar;for(Bn.global||(Bn=Es(Bn.source,Qo(lr.exec(Bn))+"g")),Bn.lastIndex=0;Ir=Bn.exec(Cr);)var Or=Ir.index;ar=ar.slice(0,Or===nt?Qn:Or)}}else if(Rt.indexOf(js(Bn),Qn)!=Qn){var Qr=ar.lastIndexOf(Bn);Qr>-1&&(ar=ar.slice(0,Qr))}return ar+yn}function fx(Rt){return Rt=Qo(Rt),Rt&&io.test(Rt)?Rt.replace(fr,pp):Rt}var mx=Bt(function(Rt,Vt,Yt){return Rt+(Yt?" ":"")+Vt.toUpperCase()}),c1=E0("toUpperCase");function hw(Rt,Vt,Yt){return Rt=Qo(Rt),Vt=Yt?nt:Vt,Vt===nt?Up(Rt)?mp(Rt):jy(Rt):Rt.match(Vt)||[]}var dw=mo(function(Rt,Vt){try{return Vo(Rt,nt,Vt)}catch(Yt){return o1(Yt)?Yt:new To(Yt)}}),gx=jo(function(Rt,Vt){return ws(Vt,function(Yt){Yt=Wu(Yt),lu(Rt,Yt,r1(Rt[Yt],Rt))}),Rt});function yx(Rt){var Vt=Rt==null?0:Rt.length,Yt=wo();return Rt=Vt?ba(Rt,function(yn){if(typeof yn[1]!="function")throw new Gs(at);return[Yt(yn[0]),yn[1]]}):[],mo(function(yn){for(var Bn=-1;++Bnzt)return[];var Yt=Ut,yn=Ms(Rt,Ut);Vt=wo(Vt),Rt-=Ut;for(var Bn=wu(yn,Vt);++Yt0||Vt<0)?new yo(Yt):(Rt<0?Yt=Yt.takeRight(-Rt):Rt&&(Yt=Yt.drop(Rt)),Vt!==nt&&(Vt=Do(Vt),Yt=Vt<0?Yt.dropRight(-Vt):Yt.take(Vt-Rt)),Yt)},yo.prototype.takeRightWhile=function(Rt){return this.reverse().takeWhile(Rt).reverse()},yo.prototype.toArray=function(){return this.take(Ut)},xl(yo.prototype,function(Rt,Vt){var Yt=/^(?:filter|find|map|reject)|While$/.test(Vt),yn=/^(?:head|last)$/.test(Vt),Bn=Fn[yn?"take"+(Vt=="last"?"Right":""):Vt],Wn=yn||/^find/.test(Vt);Bn&&(Fn.prototype[Vt]=function(){var Xn=this.__wrapped__,Qn=yn?[1]:arguments,ar=Xn instanceof yo,Ir=Qn[0],Cr=ar||Mo(Xn),Or=function(Uo){var Ho=Bn.apply(Fn,Ll([Uo],Qn));return yn&&Qr?Ho[0]:Ho};Cr&&Yt&&typeof Ir=="function"&&Ir.length!=1&&(ar=Cr=!1);var Qr=this.__chain__,uo=!!this.__actions__.length,So=Wn&&!Qr,Lo=ar&&!uo;if(!Wn&&Cr){Xn=Lo?Xn:new yo(this);var Eo=Rt.apply(Xn,Qn);return Eo.__actions__.push({func:A0,args:[Or],thisArg:nt}),new Rs(Eo,Qr)}return So&&Lo?Rt.apply(this,Qn):(Eo=this.thru(Or),So?yn?Eo.value()[0]:Eo.value():Eo)})}),ws(["pop","push","shift","sort","splice","unshift"],function(Rt){var Vt=$u[Rt],Yt=/^(?:push|sort|unshift)$/.test(Rt)?"tap":"thru",yn=/^(?:pop|shift)$/.test(Rt);Fn.prototype[Rt]=function(){var Bn=arguments;if(yn&&!this.__chain__){var Wn=this.value();return Vt.apply(Mo(Wn)?Wn:[],Bn)}return this[Yt](function(Xn){return Vt.apply(Mo(Xn)?Xn:[],Bn)})}}),xl(yo.prototype,function(Rt,Vt){var Yt=Fn[Vt];if(Yt){var yn=Yt.name+"";qo.call(Zu,yn)||(Zu[yn]=[]),Zu[yn].push({name:Vt,func:Yt})}}),Zu[Cn(nt,bt).name]=[{name:"wrapper",func:nt}],yo.prototype.clone=L0,yo.prototype.reverse=F0,yo.prototype.value=yl,Fn.prototype.at=Fv,Fn.prototype.chain=Uv,Fn.prototype.commit=zv,Fn.prototype.next=Wv,Fn.prototype.plant=Hv,Fn.prototype.reverse=Gv,Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=qv,Fn.prototype.first=Fn.prototype.head,Mu&&(Fn.prototype[Mu]=Vv),Fn},Cu=zy();ls?((ls.exports=Cu)._=Cu,gu._=Cu):ns._=Cu}).call(commonjsGlobal)})(lodash,lodash.exports);var lodashExports=lodash.exports;const AudioIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Audio",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_147",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_147)",children:jsxRuntimeExports.jsx("path",{id:"headphones",d:"M4.48719 13.6667H3.53851C3.20175 13.6667 2.91671 13.55 2.68337 13.3167C2.45004 13.0833 2.33337 12.7983 2.33337 12.4615V8.00002C2.33337 7.21337 2.4821 6.47654 2.77954 5.78952C3.07697 5.10251 3.48124 4.50345 3.99234 3.99234C4.50345 3.48124 5.10247 3.07697 5.78941 2.77954C6.47634 2.4821 7.21309 2.33337 7.99966 2.33337C8.78622 2.33337 9.5231 2.4821 10.2103 2.77954C10.8975 3.07697 11.4966 3.48124 12.0077 3.99234C12.5188 4.50345 12.9231 5.10251 13.2205 5.78952C13.518 6.47654 13.6667 7.21337 13.6667 8.00002V12.4615C13.6667 12.7983 13.55 13.0833 13.3167 13.3167C13.0833 13.55 12.7983 13.6667 12.4615 13.6667H11.5129C11.1814 13.6667 10.8977 13.5487 10.6617 13.3127C10.4257 13.0767 10.3077 12.793 10.3077 12.4615V10.1539C10.3077 9.82247 10.4257 9.53878 10.6617 9.30278C10.8977 9.06676 11.1814 8.94876 11.5129 8.94876H12.6667V8.00002C12.6667 6.70002 12.2139 5.59725 11.3084 4.69169C10.4028 3.78614 9.30002 3.33336 8.00002 3.33336C6.70002 3.33336 5.59725 3.78614 4.69169 4.69169C3.78614 5.59725 3.33336 6.70002 3.33336 8.00002V8.94876H4.48719C4.8186 8.94876 5.10231 9.06676 5.33831 9.30278C5.57431 9.53878 5.69231 9.82247 5.69231 10.1539V12.4615C5.69231 12.793 5.57431 13.0767 5.33831 13.3127C5.10231 13.5487 4.8186 13.6667 4.48719 13.6667Z",fill:"currentColor"})})]})}),NodesIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Nodes",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_141",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_141)",children:jsxRuntimeExports.jsx("path",{id:"hub",d:"M4.00071 15.1667C3.49166 15.1667 3.05873 14.9886 2.70189 14.6322C2.34506 14.2759 2.16664 13.8432 2.16664 13.3341C2.16664 12.8251 2.3449 12.3922 2.70141 12.0353C3.05793 11.6785 3.49084 11.5001 4.00014 11.5001C4.14275 11.5001 4.28286 11.5178 4.42048 11.5533C4.55808 11.5887 4.68799 11.6364 4.81021 11.6962L6.13204 10.0513C5.85512 9.74962 5.66409 9.41201 5.55896 9.03851C5.45384 8.66501 5.43247 8.28938 5.49486 7.91161L3.57431 7.2757C3.40679 7.54493 3.18652 7.76074 2.91351 7.92313C2.6405 8.08552 2.33598 8.16671 1.99996 8.16671C1.4907 8.16671 1.05784 7.98855 0.701359 7.63221C0.344882 7.27588 0.166637 6.84319 0.166626 6.33415C0.166626 5.8251 0.344793 5.39217 0.701126 5.03533C1.05746 4.6785 1.49015 4.50008 1.99919 4.50008C2.50824 4.50008 2.94118 4.67832 3.29801 5.0348C3.65484 5.39128 3.83326 5.82414 3.83328 6.3334C3.83328 6.37272 3.83221 6.40563 3.83008 6.43211C3.82794 6.45861 3.82688 6.48511 3.82688 6.51161L5.74101 7.177C5.92476 6.83683 6.17711 6.54496 6.49806 6.30138C6.81899 6.05779 7.18715 5.90138 7.60253 5.83215V3.78595C7.17347 3.68509 6.82689 3.46821 6.56279 3.13531C6.29869 2.80241 6.16664 2.42312 6.16664 1.99742C6.16664 1.49064 6.34481 1.05883 6.70114 0.701999C7.05748 0.345166 7.49016 0.166748 7.99921 0.166748C8.50825 0.166748 8.94119 0.344987 9.29803 0.701465C9.65486 1.05794 9.83328 1.49081 9.83328 2.00007C9.83328 2.424 9.69951 2.80241 9.43199 3.13531C9.16448 3.46821 8.81961 3.68509 8.39739 3.78595V5.83215C8.81277 5.90138 9.17986 6.05779 9.49866 6.30138C9.81746 6.54496 10.0709 6.83683 10.2589 7.177L12.173 6.51161C12.1688 6.48084 12.1666 6.45327 12.1666 6.42892V6.3334C12.1666 5.82414 12.3448 5.39128 12.7011 5.0348C13.0575 4.67832 13.4902 4.50008 13.9992 4.50008C14.5083 4.50008 14.9412 4.67825 15.298 5.03458C15.6549 5.39091 15.8333 5.8236 15.8333 6.33265C15.8333 6.84169 15.655 7.27463 15.2986 7.63146C14.9421 7.9883 14.5092 8.16671 14 8.16671C13.6653 8.16671 13.3594 8.08552 13.0823 7.92313C12.8052 7.76074 12.5863 7.54493 12.4256 7.2757L10.5051 7.91161C10.5674 8.28938 10.5461 8.6633 10.441 9.03338C10.3358 9.40347 10.1448 9.74065 9.86788 10.0449L11.1897 11.6796C11.3119 11.624 11.4418 11.5802 11.5794 11.5481C11.7171 11.5161 11.8572 11.5001 11.9998 11.5001C12.5091 11.5001 12.942 11.6782 13.2985 12.0346C13.655 12.3909 13.8333 12.8236 13.8333 13.3326C13.8333 13.8417 13.6551 14.2746 13.2988 14.6315C12.9424 14.9883 12.5098 15.1667 12.0007 15.1667C11.4917 15.1667 11.0587 14.9885 10.7019 14.632C10.3451 14.2755 10.1666 13.8427 10.1666 13.3334C10.1666 13.1232 10.2006 12.9208 10.2686 12.7264C10.3365 12.5319 10.438 12.3535 10.573 12.1911L9.25123 10.5334C8.8726 10.759 8.45488 10.8718 7.99804 10.8718C7.54121 10.8718 7.12134 10.759 6.73844 10.5334L5.42688 12.1911C5.55764 12.3535 5.65807 12.5319 5.72816 12.7264C5.79824 12.9208 5.83328 13.1232 5.83328 13.3334C5.83328 13.8427 5.65511 14.2755 5.29878 14.632C4.94244 14.9885 4.50975 15.1667 4.00071 15.1667Z",fill:"currentColor"})})]})}),TwitterIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Twitter",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_167",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_167)",children:jsxRuntimeExports.jsx("g",{id:"X",children:jsxRuntimeExports.jsx("path",{id:"path1009",d:"M2.0317 2L7.05085 8.71109L2 14.1675H3.13674L7.55875 9.39033L11.1316 14.1675H15L9.69845 7.07891L14.3997 2H13.263L9.19054 6.39967L5.90008 2H2.0317ZM3.70336 2.83733H5.48051L13.3281 13.33H11.5509L3.70336 2.83733Z",fill:"currentColor"})})})]})}),VideoIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Video",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_153",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_153)",children:jsxRuntimeExports.jsx("path",{id:"Subtract","fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.3782 3.03719C15.0725 3.22309 15.6201 3.76987 15.8053 4.46427C16.1429 5.72367 16.1429 8.35001 16.1429 8.35001C16.1429 8.35001 16.1429 10.9773 15.8053 12.2358C15.6201 12.9302 15.0725 13.4769 14.3782 13.6628C13.1197 14 8.07143 14 8.07143 14C8.07143 14 3.02403 14 1.76471 13.6628C1.07038 13.4769 0.522808 12.9302 0.337533 12.2358C0 10.9764 0 8.35001 0 8.35001C0 8.35001 0 5.72367 0.337533 4.46427C0.522808 3.76987 1.07038 3.22309 1.76471 3.03719C3.02312 2.70001 8.07143 2.70001 8.07143 2.70001C8.07143 2.70001 13.1197 2.70001 14.3782 3.03719ZM10.4931 8.35003L6.45735 5.9286V10.7715L10.4931 8.35003Z",fill:"currentColor"})})]})}),EpisodeIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Episode",children:[jsxRuntimeExports.jsx("rect",{id:"Rectangle 4456",x:"0.5",y:"5.625",width:"1em",height:"1em",rx:"0.5",stroke:"white"}),jsxRuntimeExports.jsx("path",{id:"Rectangle 4457",d:"M2.0625 3.0625H12.0625C12.6148 3.0625 13.0625 3.51022 13.0625 4.0625V9.9375",stroke:"white"}),jsxRuntimeExports.jsx("path",{id:"Rectangle 4458",d:"M4.125 1H14.125C14.6773 1 15.125 1.44772 15.125 2V7.875",stroke:"white"})]})}),Stats=()=>{const[tt,et]=reactExports.useState(null);return reactExports.useEffect(()=>{(async()=>{try{const rt=await api.get("/stats");rt&&et({numAudio:rt.num_audio,numContributors:rt.num_contributors,numDaily:rt.num_daily,numEpisodes:rt.num_episodes,numNodes:rt.num_nodes,numTwitterSpace:rt.num_twitter_space,numVideo:rt.num_video})}catch{lodashExports.noop()}})()},[]),tt?jsxRuntimeExports.jsxs(StatisticsWrapper,{children:[jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(NodesIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numNodes})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(EpisodeIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numEpisodes})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(AudioIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numAudio})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(VideoIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numVideo})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(TwitterIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numTwitterSpace})]})]}):null},StatisticsWrapper=styled$4(Flex).attrs({align:"center",direction:"row",grow:1,justify:"flex-start"})``,Stat=styled$4(Flex).attrs({align:"center",direction:"row",justify:"flex-start"})` +}`;var Lo=dw(function(){return $o(Wn,uo+"return "+Or).apply(nt,Xn)});if(Lo.source=Or,o1(Lo))throw Lo;return Lo}function sx(Rt){return Qo(Rt).toLowerCase()}function lx(Rt){return Qo(Rt).toUpperCase()}function cx(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return wm(Rt);if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=ss(Vt),Wn=_a(yn,Bn),Xn=cp(yn,Bn)+1;return Uu(yn,Wn,Xn).join("")}function ux(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return Rt.slice(0,fp(Rt)+1);if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=cp(yn,ss(Vt))+1;return Uu(yn,0,Bn).join("")}function hx(Rt,Vt,Yt){if(Rt=Qo(Rt),Rt&&(Yt||Vt===nt))return Rt.replace(xn,"");if(!Rt||!(Vt=js(Vt)))return Rt;var yn=ss(Rt),Bn=_a(yn,ss(Vt));return Uu(yn,Bn).join("")}function dx(Rt,Vt){var Yt=Dt,yn=jt;if(ds(Vt)){var Bn="separator"in Vt?Vt.separator:Bn;Yt="length"in Vt?Do(Vt.length):Yt,yn="omission"in Vt?js(Vt.omission):yn}Rt=Qo(Rt);var Wn=Rt.length;if(qu(Rt)){var Xn=ss(Rt);Wn=Xn.length}if(Yt>=Wn)return Rt;var Qn=Yt-ru(yn);if(Qn<1)return yn;var ar=Xn?Uu(Xn,0,Qn).join(""):Rt.slice(0,Qn);if(Bn===nt)return ar+yn;if(Xn&&(Qn+=ar.length-Qn),a1(Bn)){if(Rt.slice(Qn).search(Bn)){var Ir,Cr=ar;for(Bn.global||(Bn=Es(Bn.source,Qo(lr.exec(Bn))+"g")),Bn.lastIndex=0;Ir=Bn.exec(Cr);)var Or=Ir.index;ar=ar.slice(0,Or===nt?Qn:Or)}}else if(Rt.indexOf(js(Bn),Qn)!=Qn){var Qr=ar.lastIndexOf(Bn);Qr>-1&&(ar=ar.slice(0,Qr))}return ar+yn}function fx(Rt){return Rt=Qo(Rt),Rt&&io.test(Rt)?Rt.replace(fr,pp):Rt}var mx=Bt(function(Rt,Vt,Yt){return Rt+(Yt?" ":"")+Vt.toUpperCase()}),c1=E0("toUpperCase");function hw(Rt,Vt,Yt){return Rt=Qo(Rt),Vt=Yt?nt:Vt,Vt===nt?Up(Rt)?mp(Rt):jy(Rt):Rt.match(Vt)||[]}var dw=mo(function(Rt,Vt){try{return Vo(Rt,nt,Vt)}catch(Yt){return o1(Yt)?Yt:new To(Yt)}}),gx=jo(function(Rt,Vt){return ws(Vt,function(Yt){Yt=Wu(Yt),lu(Rt,Yt,r1(Rt[Yt],Rt))}),Rt});function yx(Rt){var Vt=Rt==null?0:Rt.length,Yt=wo();return Rt=Vt?ba(Rt,function(yn){if(typeof yn[1]!="function")throw new Gs(at);return[Yt(yn[0]),yn[1]]}):[],mo(function(yn){for(var Bn=-1;++Bnzt)return[];var Yt=Ut,yn=Ms(Rt,Ut);Vt=wo(Vt),Rt-=Ut;for(var Bn=wu(yn,Vt);++Yt0||Vt<0)?new yo(Yt):(Rt<0?Yt=Yt.takeRight(-Rt):Rt&&(Yt=Yt.drop(Rt)),Vt!==nt&&(Vt=Do(Vt),Yt=Vt<0?Yt.dropRight(-Vt):Yt.take(Vt-Rt)),Yt)},yo.prototype.takeRightWhile=function(Rt){return this.reverse().takeWhile(Rt).reverse()},yo.prototype.toArray=function(){return this.take(Ut)},xl(yo.prototype,function(Rt,Vt){var Yt=/^(?:filter|find|map|reject)|While$/.test(Vt),yn=/^(?:head|last)$/.test(Vt),Bn=Fn[yn?"take"+(Vt=="last"?"Right":""):Vt],Wn=yn||/^find/.test(Vt);Bn&&(Fn.prototype[Vt]=function(){var Xn=this.__wrapped__,Qn=yn?[1]:arguments,ar=Xn instanceof yo,Ir=Qn[0],Cr=ar||Mo(Xn),Or=function(Uo){var Ho=Bn.apply(Fn,Ll([Uo],Qn));return yn&&Qr?Ho[0]:Ho};Cr&&Yt&&typeof Ir=="function"&&Ir.length!=1&&(ar=Cr=!1);var Qr=this.__chain__,uo=!!this.__actions__.length,So=Wn&&!Qr,Lo=ar&&!uo;if(!Wn&&Cr){Xn=Lo?Xn:new yo(this);var Eo=Rt.apply(Xn,Qn);return Eo.__actions__.push({func:A0,args:[Or],thisArg:nt}),new Rs(Eo,Qr)}return So&&Lo?Rt.apply(this,Qn):(Eo=this.thru(Or),So?yn?Eo.value()[0]:Eo.value():Eo)})}),ws(["pop","push","shift","sort","splice","unshift"],function(Rt){var Vt=$u[Rt],Yt=/^(?:push|sort|unshift)$/.test(Rt)?"tap":"thru",yn=/^(?:pop|shift)$/.test(Rt);Fn.prototype[Rt]=function(){var Bn=arguments;if(yn&&!this.__chain__){var Wn=this.value();return Vt.apply(Mo(Wn)?Wn:[],Bn)}return this[Yt](function(Xn){return Vt.apply(Mo(Xn)?Xn:[],Bn)})}}),xl(yo.prototype,function(Rt,Vt){var Yt=Fn[Vt];if(Yt){var yn=Yt.name+"";qo.call(Zu,yn)||(Zu[yn]=[]),Zu[yn].push({name:Vt,func:Yt})}}),Zu[Cn(nt,bt).name]=[{name:"wrapper",func:nt}],yo.prototype.clone=L0,yo.prototype.reverse=F0,yo.prototype.value=yl,Fn.prototype.at=Fv,Fn.prototype.chain=Uv,Fn.prototype.commit=zv,Fn.prototype.next=Wv,Fn.prototype.plant=Hv,Fn.prototype.reverse=Gv,Fn.prototype.toJSON=Fn.prototype.valueOf=Fn.prototype.value=qv,Fn.prototype.first=Fn.prototype.head,Mu&&(Fn.prototype[Mu]=Vv),Fn},Cu=zy();ls?((ls.exports=Cu)._=Cu,gu._=Cu):ns._=Cu}).call(commonjsGlobal)})(lodash,lodash.exports);var lodashExports=lodash.exports;const AudioIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Audio",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_147",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_147)",children:jsxRuntimeExports.jsx("path",{id:"headphones",d:"M4.48719 13.6667H3.53851C3.20175 13.6667 2.91671 13.55 2.68337 13.3167C2.45004 13.0833 2.33337 12.7983 2.33337 12.4615V8.00002C2.33337 7.21337 2.4821 6.47654 2.77954 5.78952C3.07697 5.10251 3.48124 4.50345 3.99234 3.99234C4.50345 3.48124 5.10247 3.07697 5.78941 2.77954C6.47634 2.4821 7.21309 2.33337 7.99966 2.33337C8.78622 2.33337 9.5231 2.4821 10.2103 2.77954C10.8975 3.07697 11.4966 3.48124 12.0077 3.99234C12.5188 4.50345 12.9231 5.10251 13.2205 5.78952C13.518 6.47654 13.6667 7.21337 13.6667 8.00002V12.4615C13.6667 12.7983 13.55 13.0833 13.3167 13.3167C13.0833 13.55 12.7983 13.6667 12.4615 13.6667H11.5129C11.1814 13.6667 10.8977 13.5487 10.6617 13.3127C10.4257 13.0767 10.3077 12.793 10.3077 12.4615V10.1539C10.3077 9.82247 10.4257 9.53878 10.6617 9.30278C10.8977 9.06676 11.1814 8.94876 11.5129 8.94876H12.6667V8.00002C12.6667 6.70002 12.2139 5.59725 11.3084 4.69169C10.4028 3.78614 9.30002 3.33336 8.00002 3.33336C6.70002 3.33336 5.59725 3.78614 4.69169 4.69169C3.78614 5.59725 3.33336 6.70002 3.33336 8.00002V8.94876H4.48719C4.8186 8.94876 5.10231 9.06676 5.33831 9.30278C5.57431 9.53878 5.69231 9.82247 5.69231 10.1539V12.4615C5.69231 12.793 5.57431 13.0767 5.33831 13.3127C5.10231 13.5487 4.8186 13.6667 4.48719 13.6667Z",fill:"currentColor"})})]})}),BudgetIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 22 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M14 16C11.7667 16 9.875 15.225 8.325 13.675C6.775 12.125 6 10.2333 6 8C6 5.76667 6.775 3.875 8.325 2.325C9.875 0.775 11.7667 0 14 0C16.2333 0 18.125 0.775 19.675 2.325C21.225 3.875 22 5.76667 22 8C22 10.2333 21.225 12.125 19.675 13.675C18.125 15.225 16.2333 16 14 16ZM4.625 15.25C3.225 14.6 2.10433 13.625 1.263 12.325C0.421 11.025 0 9.58333 0 8C0 6.41667 0.421 4.975 1.263 3.675C2.10433 2.375 3.225 1.4 4.625 0.75C4.975 0.583333 5.29167 0.595667 5.575 0.787C5.85833 0.979 6 1.29167 6 1.725C6 1.89167 5.946 2.054 5.838 2.212C5.72933 2.37067 5.59167 2.49167 5.425 2.575C4.375 3.05833 3.54167 3.78733 2.925 4.762C2.30833 5.73733 2 6.81667 2 8C2 9.18333 2.30833 10.2623 2.925 11.237C3.54167 12.2123 4.375 12.9417 5.425 13.425C5.59167 13.5083 5.72933 13.625 5.838 13.775C5.946 13.925 6 14.0917 6 14.275C6 14.6917 5.85833 15 5.575 15.2C5.29167 15.4 4.975 15.4167 4.625 15.25ZM14 14C15.6667 14 17.0833 13.4167 18.25 12.25C19.4167 11.0833 20 9.66667 20 8C20 6.33333 19.4167 4.91667 18.25 3.75C17.0833 2.58333 15.6667 2 14 2C12.3333 2 10.9167 2.58333 9.75 3.75C8.58333 4.91667 8 6.33333 8 8C8 9.66667 8.58333 11.0833 9.75 12.25C10.9167 13.4167 12.3333 14 14 14Z",fill:"currentColor"})}),NodesIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Nodes",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_141",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_141)",children:jsxRuntimeExports.jsx("path",{id:"hub",d:"M4.00071 15.1667C3.49166 15.1667 3.05873 14.9886 2.70189 14.6322C2.34506 14.2759 2.16664 13.8432 2.16664 13.3341C2.16664 12.8251 2.3449 12.3922 2.70141 12.0353C3.05793 11.6785 3.49084 11.5001 4.00014 11.5001C4.14275 11.5001 4.28286 11.5178 4.42048 11.5533C4.55808 11.5887 4.68799 11.6364 4.81021 11.6962L6.13204 10.0513C5.85512 9.74962 5.66409 9.41201 5.55896 9.03851C5.45384 8.66501 5.43247 8.28938 5.49486 7.91161L3.57431 7.2757C3.40679 7.54493 3.18652 7.76074 2.91351 7.92313C2.6405 8.08552 2.33598 8.16671 1.99996 8.16671C1.4907 8.16671 1.05784 7.98855 0.701359 7.63221C0.344882 7.27588 0.166637 6.84319 0.166626 6.33415C0.166626 5.8251 0.344793 5.39217 0.701126 5.03533C1.05746 4.6785 1.49015 4.50008 1.99919 4.50008C2.50824 4.50008 2.94118 4.67832 3.29801 5.0348C3.65484 5.39128 3.83326 5.82414 3.83328 6.3334C3.83328 6.37272 3.83221 6.40563 3.83008 6.43211C3.82794 6.45861 3.82688 6.48511 3.82688 6.51161L5.74101 7.177C5.92476 6.83683 6.17711 6.54496 6.49806 6.30138C6.81899 6.05779 7.18715 5.90138 7.60253 5.83215V3.78595C7.17347 3.68509 6.82689 3.46821 6.56279 3.13531C6.29869 2.80241 6.16664 2.42312 6.16664 1.99742C6.16664 1.49064 6.34481 1.05883 6.70114 0.701999C7.05748 0.345166 7.49016 0.166748 7.99921 0.166748C8.50825 0.166748 8.94119 0.344987 9.29803 0.701465C9.65486 1.05794 9.83328 1.49081 9.83328 2.00007C9.83328 2.424 9.69951 2.80241 9.43199 3.13531C9.16448 3.46821 8.81961 3.68509 8.39739 3.78595V5.83215C8.81277 5.90138 9.17986 6.05779 9.49866 6.30138C9.81746 6.54496 10.0709 6.83683 10.2589 7.177L12.173 6.51161C12.1688 6.48084 12.1666 6.45327 12.1666 6.42892V6.3334C12.1666 5.82414 12.3448 5.39128 12.7011 5.0348C13.0575 4.67832 13.4902 4.50008 13.9992 4.50008C14.5083 4.50008 14.9412 4.67825 15.298 5.03458C15.6549 5.39091 15.8333 5.8236 15.8333 6.33265C15.8333 6.84169 15.655 7.27463 15.2986 7.63146C14.9421 7.9883 14.5092 8.16671 14 8.16671C13.6653 8.16671 13.3594 8.08552 13.0823 7.92313C12.8052 7.76074 12.5863 7.54493 12.4256 7.2757L10.5051 7.91161C10.5674 8.28938 10.5461 8.6633 10.441 9.03338C10.3358 9.40347 10.1448 9.74065 9.86788 10.0449L11.1897 11.6796C11.3119 11.624 11.4418 11.5802 11.5794 11.5481C11.7171 11.5161 11.8572 11.5001 11.9998 11.5001C12.5091 11.5001 12.942 11.6782 13.2985 12.0346C13.655 12.3909 13.8333 12.8236 13.8333 13.3326C13.8333 13.8417 13.6551 14.2746 13.2988 14.6315C12.9424 14.9883 12.5098 15.1667 12.0007 15.1667C11.4917 15.1667 11.0587 14.9885 10.7019 14.632C10.3451 14.2755 10.1666 13.8427 10.1666 13.3334C10.1666 13.1232 10.2006 12.9208 10.2686 12.7264C10.3365 12.5319 10.438 12.3535 10.573 12.1911L9.25123 10.5334C8.8726 10.759 8.45488 10.8718 7.99804 10.8718C7.54121 10.8718 7.12134 10.759 6.73844 10.5334L5.42688 12.1911C5.55764 12.3535 5.65807 12.5319 5.72816 12.7264C5.79824 12.9208 5.83328 13.1232 5.83328 13.3334C5.83328 13.8427 5.65511 14.2755 5.29878 14.632C4.94244 14.9885 4.50975 15.1667 4.00071 15.1667Z",fill:"currentColor"})})]})}),TwitterIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Twitter",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_167",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_167)",children:jsxRuntimeExports.jsx("g",{id:"X",children:jsxRuntimeExports.jsx("path",{id:"path1009",d:"M2.0317 2L7.05085 8.71109L2 14.1675H3.13674L7.55875 9.39033L11.1316 14.1675H15L9.69845 7.07891L14.3997 2H13.263L9.19054 6.39967L5.90008 2H2.0317ZM3.70336 2.83733H5.48051L13.3281 13.33H11.5509L3.70336 2.83733Z",fill:"currentColor"})})})]})}),VideoIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Video",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1506_153",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"16",height:"16",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1506_153)",children:jsxRuntimeExports.jsx("path",{id:"Subtract","fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.3782 3.03719C15.0725 3.22309 15.6201 3.76987 15.8053 4.46427C16.1429 5.72367 16.1429 8.35001 16.1429 8.35001C16.1429 8.35001 16.1429 10.9773 15.8053 12.2358C15.6201 12.9302 15.0725 13.4769 14.3782 13.6628C13.1197 14 8.07143 14 8.07143 14C8.07143 14 3.02403 14 1.76471 13.6628C1.07038 13.4769 0.522808 12.9302 0.337533 12.2358C0 10.9764 0 8.35001 0 8.35001C0 8.35001 0 5.72367 0.337533 4.46427C0.522808 3.76987 1.07038 3.22309 1.76471 3.03719C3.02312 2.70001 8.07143 2.70001 8.07143 2.70001C8.07143 2.70001 13.1197 2.70001 14.3782 3.03719ZM10.4931 8.35003L6.45735 5.9286V10.7715L10.4931 8.35003Z",fill:"currentColor"})})]})}),EpisodeIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 16 12",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"Episode",children:[jsxRuntimeExports.jsx("rect",{id:"Rectangle 4456",x:"0.5",y:"5.625",width:"1em",height:"1em",rx:"0.5",stroke:"white"}),jsxRuntimeExports.jsx("path",{id:"Rectangle 4457",d:"M2.0625 3.0625H12.0625C12.6148 3.0625 13.0625 3.51022 13.0625 4.0625V9.9375",stroke:"white"}),jsxRuntimeExports.jsx("path",{id:"Rectangle 4458",d:"M4.125 1H14.125C14.6773 1 15.125 1.44772 15.125 2V7.875",stroke:"white"})]})}),Stats=()=>{const[tt,et]=reactExports.useState(null),[nt]=useUserStore(it=>[it.budget]);function rt(it){return it===null?"?":it.toLocaleString().split(",").join(" ")}return reactExports.useEffect(()=>{(async()=>{try{const ot=await api.get("/stats");ot&&et({numAudio:ot.num_audio,numContributors:ot.num_contributors,numDaily:ot.num_daily,numEpisodes:ot.num_episodes,numNodes:ot.num_nodes,numTwitterSpace:ot.num_twitter_space,numVideo:ot.num_video})}catch{lodashExports.noop()}})()},[]),tt?jsxRuntimeExports.jsxs(StatisticsContainer,{children:[jsxRuntimeExports.jsxs(StatisticsWrapper,{children:[jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(NodesIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numNodes})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(EpisodeIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numEpisodes})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(AudioIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numAudio})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(VideoIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numVideo})]}),jsxRuntimeExports.jsxs(Stat,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(TwitterIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:tt.numTwitterSpace})]})]}),jsxRuntimeExports.jsx(StatisticsBudget,{children:jsxRuntimeExports.jsxs(Budget,{children:[jsxRuntimeExports.jsx("div",{className:"icon",children:jsxRuntimeExports.jsx(BudgetIcon,{})}),jsxRuntimeExports.jsx("div",{className:"text",children:jsxRuntimeExports.jsxs("p",{children:[`${rt(nt)} `," ",jsxRuntimeExports.jsx("span",{className:"budgetUnit",children:"SAT"})]})})]})})]}):null},StatisticsWrapper=styled$4(Flex).attrs({align:"center",direction:"row",grow:1,justify:"flex-start"})``,StatisticsBudget=styled$4(Flex).attrs({align:"center",direction:"row",grow:1,justify:"flex-end"})``,StatisticsContainer=styled$4(Flex).attrs({align:"center",direction:"row",grow:1})` + justify-content: between; +`,Stat=styled$4(Flex).attrs({align:"center",direction:"row",justify:"flex-start"})` color: ${colors.white}; background: ${colors.BG1}; padding: 6px 10px 6px 8px; @@ -7222,12 +7224,51 @@ function print() { __p += __j.call(arguments, '') } .text { } +`,Budget=styled$4(Flex).attrs({align:"center",direction:"row"})` + display: flex; + height: 2.5rem; + padding: 0.75rem 0.9375rem 0.75rem 0.9375rem; + align-items: center; + gap: 0.625rem; + color: ${colors.white}; + background: ${colors.BG1}; + font-family: Barlow; + font-size: 0.75rem; + font-style: normal; + font-weight: 500; + line-height: normal; + letter-spacing: 0.0075rem; + border-radius: 12.5rem; + + &:hover { + background: ${colors.BUTTON1_PRESS}; + } + + &:active { + background: ${colors.BUTTON1}; + } + + .icon { + display: flex; + align-items: center; + justify-content: center; + } + + .budgetUnit { + color: ${colors.GRAY6}; + } + + .text { + display: flex; + align-items: center; + justify-content: center; + } `,defaultData$2={description:"",mission_statement:"",search_term:"",title:""},AppBar=()=>{const[tt,et]=reactExports.useState(defaultData$2);return reactExports.useEffect(()=>{(async()=>{try{const rt=await getAboutData();et(rt)}catch(rt){console.warn(rt)}})()},[]),jsxRuntimeExports.jsxs(Header$1,{children:[jsxRuntimeExports.jsxs(TitleWrapper,{children:[jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:tt.title&&jsxRuntimeExports.jsx(Text$3,{className:"title",color:"white",children:tt.title})}),jsxRuntimeExports.jsx(Text$3,{className:"subtitle",children:" Second Brain"})]}),jsxRuntimeExports.jsx(Stats,{})]})},Header$1=styled$4(Flex).attrs({align:"center",direction:"row",grow:1,justify:"flex-start"})` height: 64px; position: absolute; top: 0px; left: 64px; - right: 64px; + right: 32px; transition: opacity 1s; z-index: 99; padding: 20px 23px; @@ -7343,12 +7384,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$5(tt,et){if(tt){if(typeof tt=="string")return _arrayLikeToArray$5(tt,et);var nt=Object.prototype.toString.call(tt).slice(8,-1);if(nt==="Object"&&tt.constructor&&(nt=tt.constructor.name),nt==="Map"||nt==="Set")return Array.from(tt);if(nt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(nt))return _arrayLikeToArray$5(tt,et)}}function _iterableToArray$3(tt){if(typeof Symbol<"u"&&tt[Symbol.iterator]!=null||tt["@@iterator"]!=null)return Array.from(tt)}function _arrayWithoutHoles$3(tt){if(Array.isArray(tt))return _arrayLikeToArray$5(tt)}function _arrayLikeToArray$5(tt,et){(et==null||et>tt.length)&&(et=tt.length);for(var nt=0,rt=new Array(et);nt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _getPrototypeOf$3(tt){return _getPrototypeOf$3=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(nt){return nt.__proto__||Object.getPrototypeOf(nt)},_getPrototypeOf$3(tt)}function _defineProperty$4(tt,et,nt){return et=_toPropertyKey$3(et),et in tt?Object.defineProperty(tt,et,{value:nt,enumerable:!0,configurable:!0,writable:!0}):tt[et]=nt,tt}function _toPropertyKey$3(tt){var et=_toPrimitive$3(tt,"string");return _typeof$4(et)==="symbol"?et:String(et)}function _toPrimitive$3(tt,et){if(_typeof$4(tt)!=="object"||tt===null)return tt;var nt=tt[Symbol.toPrimitive];if(nt!==void 0){var rt=nt.call(tt,et||"default");if(_typeof$4(rt)!=="object")return rt;throw new TypeError("@@toPrimitive must return a primitive value.")}return(et==="string"?String:Number)(tt)}var Line=function(tt){_inherits$3(nt,tt);var et=_createSuper$3(nt);function nt(){var rt;_classCallCheck$4(this,nt);for(var it=arguments.length,ot=new Array(it),at=0;atdt){mt=[].concat(_toConsumableArray$3(ct.slice(0,gt)),[dt-yt]);break}var bt=mt.length%2===0?[0,pt]:[pt];return[].concat(_toConsumableArray$3(nt.repeat(ct,ht)),_toConsumableArray$3(mt),bt).map(function(vt){return"".concat(vt,"px")}).join(", ")}),_defineProperty$4(_assertThisInitialized$3(rt),"id",uniqueId("recharts-line-")),_defineProperty$4(_assertThisInitialized$3(rt),"pathRef",function(st){rt.mainCurve=st}),_defineProperty$4(_assertThisInitialized$3(rt),"handleAnimationEnd",function(){rt.setState({isAnimationFinished:!0}),rt.props.onAnimationEnd&&rt.props.onAnimationEnd()}),_defineProperty$4(_assertThisInitialized$3(rt),"handleAnimationStart",function(){rt.setState({isAnimationFinished:!1}),rt.props.onAnimationStart&&rt.props.onAnimationStart()}),rt}return _createClass$4(nt,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var it=this.getTotalLength();this.setState({totalLength:it})}}},{key:"getTotalLength",value:function(){var it=this.mainCurve;try{return it&&it.getTotalLength&&it.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(it,ot){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var at=this.props,st=at.points,lt=at.xAxis,ct=at.yAxis,ut=at.layout,ht=at.children,dt=findAllByType(ht,ErrorBar);if(!dt)return null;var pt=function(yt,bt){return{x:yt.x,y:yt.y,value:yt.value,errorVal:getValueByDataKey(yt.payload,bt)}},mt={clipPath:it?"url(#clipPath-".concat(ot,")"):null};return React$1.createElement(Layer,mt,dt.map(function(gt,yt){return React$1.cloneElement(gt,{key:"bar-".concat(yt),data:st,xAxis:lt,yAxis:ct,layout:ut,dataPointFormatter:pt})}))}},{key:"renderDots",value:function(it,ot,at){var st=this.props.isAnimationActive;if(st&&!this.state.isAnimationFinished)return null;var lt=this.props,ct=lt.dot,ut=lt.points,ht=lt.dataKey,dt=filterProps(this.props),pt=filterProps(ct,!0),mt=ut.map(function(yt,bt){var vt=_objectSpread$3(_objectSpread$3(_objectSpread$3({key:"dot-".concat(bt),r:3},dt),pt),{},{value:yt.value,dataKey:ht,cx:yt.x,cy:yt.y,index:bt,payload:yt.payload});return nt.renderDotItem(ct,vt)}),gt={clipPath:it?"url(#clipPath-".concat(ot?"":"dots-").concat(at,")"):null};return React$1.createElement(Layer,_extends$4({className:"recharts-line-dots",key:"dots"},gt),mt)}},{key:"renderCurveStatically",value:function(it,ot,at,st){var lt=this.props,ct=lt.type,ut=lt.layout,ht=lt.connectNulls;lt.ref;var dt=_objectWithoutProperties$2(lt,_excluded$2),pt=_objectSpread$3(_objectSpread$3(_objectSpread$3({},filterProps(dt,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:ot?"url(#clipPath-".concat(at,")"):null,points:it},st),{},{type:ct,layout:ut,connectNulls:ht});return React$1.createElement(Curve,_extends$4({},pt,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(it,ot){var at=this,st=this.props,lt=st.points,ct=st.strokeDasharray,ut=st.isAnimationActive,ht=st.animationBegin,dt=st.animationDuration,pt=st.animationEasing,mt=st.animationId,gt=st.animateNewValues,yt=st.width,bt=st.height,vt=this.state,xt=vt.prevPoints,kt=vt.totalLength;return React$1.createElement(Animate,{begin:ht,duration:dt,isActive:ut,easing:pt,from:{t:0},to:{t:1},key:"line-".concat(mt),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(St){var Tt=St.t;if(xt){var At=xt.length/lt.length,Et=lt.map(function(Ct,wt){var It=Math.floor(wt*At);if(xt[It]){var Ot=xt[It],Wt=interpolateNumber$2(Ot.x,Ct.x),zt=interpolateNumber$2(Ot.y,Ct.y);return _objectSpread$3(_objectSpread$3({},Ct),{},{x:Wt(Tt),y:zt(Tt)})}if(gt){var Ft=interpolateNumber$2(yt*2,Ct.x),Nt=interpolateNumber$2(bt/2,Ct.y);return _objectSpread$3(_objectSpread$3({},Ct),{},{x:Ft(Tt),y:Nt(Tt)})}return _objectSpread$3(_objectSpread$3({},Ct),{},{x:Ct.x,y:Ct.y})});return at.renderCurveStatically(Et,it,ot)}var $t=interpolateNumber$2(0,kt),Dt=$t(Tt),jt;if(ct){var Pt="".concat(ct).split(/[,\s]+/gim).map(function(Ct){return parseFloat(Ct)});jt=at.getStrokeDasharray(Dt,kt,Pt)}else jt="".concat(Dt,"px ").concat(kt-Dt,"px");return at.renderCurveStatically(lt,it,ot,{strokeDasharray:jt})})}},{key:"renderCurve",value:function(it,ot){var at=this.props,st=at.points,lt=at.isAnimationActive,ct=this.state,ut=ct.prevPoints,ht=ct.totalLength;return lt&&st&&st.length&&(!ut&&ht>0||!_isEqual(ut,st))?this.renderCurveWithAnimation(it,ot):this.renderCurveStatically(st,it,ot)}},{key:"render",value:function(){var it,ot=this.props,at=ot.hide,st=ot.dot,lt=ot.points,ct=ot.className,ut=ot.xAxis,ht=ot.yAxis,dt=ot.top,pt=ot.left,mt=ot.width,gt=ot.height,yt=ot.isAnimationActive,bt=ot.id;if(at||!lt||!lt.length)return null;var vt=this.state.isAnimationFinished,xt=lt.length===1,kt=classNames("recharts-line",ct),St=ut&&ut.allowDataOverflow,Tt=ht&&ht.allowDataOverflow,At=St||Tt,Et=_isNil(bt)?this.id:bt,$t=(it=filterProps(st))!==null&&it!==void 0?it:{r:3,strokeWidth:2},Dt=$t.r,jt=Dt===void 0?3:Dt,Pt=$t.strokeWidth,Ct=Pt===void 0?2:Pt,wt=isDotProps(st)?st:{},It=wt.clipDot,Ot=It===void 0?!0:It,Wt=jt*2+Ct;return React$1.createElement(Layer,{className:kt},St||Tt?React$1.createElement("defs",null,React$1.createElement("clipPath",{id:"clipPath-".concat(Et)},React$1.createElement("rect",{x:St?pt:pt-mt/2,y:Tt?dt:dt-gt/2,width:St?mt:mt*2,height:Tt?gt:gt*2})),!Ot&&React$1.createElement("clipPath",{id:"clipPath-dots-".concat(Et)},React$1.createElement("rect",{x:pt-Wt/2,y:dt-Wt/2,width:mt+Wt,height:gt+Wt}))):null,!xt&&this.renderCurve(At,Et),this.renderErrorBar(At,Et),(xt||st)&&this.renderDots(At,Ot,Et),(!yt||vt)&&LabelList.renderCallByParent(this.props,lt))}}],[{key:"getDerivedStateFromProps",value:function(it,ot){return it.animationId!==ot.prevAnimationId?{prevAnimationId:it.animationId,curPoints:it.points,prevPoints:ot.curPoints}:it.points!==ot.curPoints?{curPoints:it.points}:null}},{key:"repeat",value:function(it,ot){for(var at=it.length%2!==0?[].concat(_toConsumableArray$3(it),[0]):it,st=[],lt=0;lt=0)&&Object.prototype.propertyIsEnumerable.call(tt,rt)&&(nt[rt]=tt[rt])}return nt}function _objectWithoutPropertiesLoose$1(tt,et){if(tt==null)return{};var nt={},rt=Object.keys(tt),it,ot;for(ot=0;ot=0)&&(nt[it]=tt[it]);return nt}function ScatterSymbol(tt){var et=tt.option,nt=tt.isActive,rt=_objectWithoutProperties$1(tt,_excluded$1);return typeof et=="string"?React$1.createElement(Shape,_extends$3({option:React$1.createElement(Symbols,_extends$3({type:et},rt)),isActive:nt,shapeType:"symbols"},rt)):React$1.createElement(Shape,_extends$3({option:et,isActive:nt,shapeType:"symbols"},rt))}function _typeof$3(tt){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(et){return typeof et}:function(et){return et&&typeof Symbol=="function"&&et.constructor===Symbol&&et!==Symbol.prototype?"symbol":typeof et},_typeof$3(tt)}function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(tt){for(var et=1;et"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _getPrototypeOf$2(tt){return _getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(nt){return nt.__proto__||Object.getPrototypeOf(nt)},_getPrototypeOf$2(tt)}function _defineProperty$3(tt,et,nt){return et=_toPropertyKey$2(et),et in tt?Object.defineProperty(tt,et,{value:nt,enumerable:!0,configurable:!0,writable:!0}):tt[et]=nt,tt}function _toPropertyKey$2(tt){var et=_toPrimitive$2(tt,"string");return _typeof$3(et)==="symbol"?et:String(et)}function _toPrimitive$2(tt,et){if(_typeof$3(tt)!=="object"||tt===null)return tt;var nt=tt[Symbol.toPrimitive];if(nt!==void 0){var rt=nt.call(tt,et||"default");if(_typeof$3(rt)!=="object")return rt;throw new TypeError("@@toPrimitive must return a primitive value.")}return(et==="string"?String:Number)(tt)}var Scatter=function(tt){_inherits$2(nt,tt);var et=_createSuper$2(nt);function nt(){var rt;_classCallCheck$3(this,nt);for(var it=arguments.length,ot=new Array(it),at=0;at-1?it[ot?et[at]:at]:void 0}}var _createFind=createFind$1,toFinite=toFinite_1;function toInteger$1(tt){var et=toFinite(tt),nt=et%1;return et===et?nt?et-nt:et:0}var toInteger_1=toInteger$1,baseFindIndex=_baseFindIndex,baseIteratee=_baseIteratee,toInteger=toInteger_1,nativeMax=Math.max;function findIndex$1(tt,et,nt){var rt=tt==null?0:tt.length;if(!rt)return-1;var it=nt==null?0:toInteger(nt);return it<0&&(it=nativeMax(rt+it,0)),baseFindIndex(tt,baseIteratee(et),it)}var findIndex_1=findIndex$1,createFind=_createFind,findIndex=findIndex_1,find$1=createFind(findIndex),find_1=find$1;const _find=getDefaultExportFromCjs(find_1);var prefix="Invariant failed";function invariant(tt,et){if(!tt)throw new Error(prefix)}function getRadialCursorPoints(tt){var et=tt.cx,nt=tt.cy,rt=tt.radius,it=tt.startAngle,ot=tt.endAngle,at=polarToCartesian(et,nt,rt,it),st=polarToCartesian(et,nt,rt,ot);return{points:[at,st],cx:et,cy:nt,radius:rt,startAngle:it,endAngle:ot}}function _toConsumableArray$2(tt){return _arrayWithoutHoles$2(tt)||_iterableToArray$2(tt)||_unsupportedIterableToArray$4(tt)||_nonIterableSpread$2()}function _nonIterableSpread$2(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$4(tt,et){if(tt){if(typeof tt=="string")return _arrayLikeToArray$4(tt,et);var nt=Object.prototype.toString.call(tt).slice(8,-1);if(nt==="Object"&&tt.constructor&&(nt=tt.constructor.name),nt==="Map"||nt==="Set")return Array.from(tt);if(nt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(nt))return _arrayLikeToArray$4(tt,et)}}function _iterableToArray$2(tt){if(typeof Symbol<"u"&&tt[Symbol.iterator]!=null||tt["@@iterator"]!=null)return Array.from(tt)}function _arrayWithoutHoles$2(tt){if(Array.isArray(tt))return _arrayLikeToArray$4(tt)}function _arrayLikeToArray$4(tt,et){(et==null||et>tt.length)&&(et=tt.length);for(var nt=0,rt=new Array(et);nt=0)&&Object.prototype.propertyIsEnumerable.call(tt,rt)&&(nt[rt]=tt[rt])}return nt}function _objectWithoutPropertiesLoose(tt,et){if(tt==null)return{};var nt={},rt=Object.keys(tt),it,ot;for(ot=0;ot=0)&&(nt[it]=tt[it]);return nt}function _classCallCheck$1(tt,et){if(!(tt instanceof et))throw new TypeError("Cannot call a class as a function")}function _defineProperties$1(tt,et){for(var nt=0;nt"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function _getPrototypeOf$1(tt){return _getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(nt){return nt.__proto__||Object.getPrototypeOf(nt)},_getPrototypeOf$1(tt)}function _toConsumableArray$1(tt){return _arrayWithoutHoles$1(tt)||_iterableToArray$1(tt)||_unsupportedIterableToArray$3(tt)||_nonIterableSpread$1()}function _nonIterableSpread$1(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$3(tt,et){if(tt){if(typeof tt=="string")return _arrayLikeToArray$3(tt,et);var nt=Object.prototype.toString.call(tt).slice(8,-1);if(nt==="Object"&&tt.constructor&&(nt=tt.constructor.name),nt==="Map"||nt==="Set")return Array.from(tt);if(nt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(nt))return _arrayLikeToArray$3(tt,et)}}function _iterableToArray$1(tt){if(typeof Symbol<"u"&&tt[Symbol.iterator]!=null||tt["@@iterator"]!=null)return Array.from(tt)}function _arrayWithoutHoles$1(tt){if(Array.isArray(tt))return _arrayLikeToArray$3(tt)}function _arrayLikeToArray$3(tt,et){(et==null||et>tt.length)&&(et=tt.length);for(var nt=0,rt=new Array(et);nt0?st:rt&&rt.props&&rt.props.data&&rt.props.data.length>0?rt.props.data:et&&et.length&&isNumber(ot)&&isNumber(at)?et.slice(ot,at+1):[]};function getDefaultDomainByAxisType(tt){return tt==="number"?[0,"auto"]:void 0}var getTooltipContent=function(et,nt,rt,it){var ot=et.graphicalItems,at=et.tooltipAxis,st=getDisplayedData(nt,et);return rt<0||!ot||!ot.length||rt>=st.length?null:ot.reduce(function(lt,ct){var ut=ct.props.hide;if(ut)return lt;var ht=ct.props.data,dt=ht===void 0?nt:ht,pt;if(at.dataKey&&!at.allowDuplicatedCategory){var mt=dt===void 0?st:dt;pt=findEntryInArray(mt,at.dataKey,it)}else pt=dt&&dt[rt]||st[rt];return pt?[].concat(_toConsumableArray$1(lt),[getTooltipItem(ct,pt)]):lt},[])},getTooltipData=function(et,nt,rt,it){var ot=it||{x:et.chartX,y:et.chartY},at=calculateTooltipPos(ot,rt),st=et.orderedTooltipTicks,lt=et.tooltipAxis,ct=et.tooltipTicks,ut=calculateActiveTickIndex(at,st,ct,lt);if(ut>=0&&ct){var ht=ct[ut]&&ct[ut].value,dt=getTooltipContent(et,nt,ut,ht),pt=getActiveCoordinate(rt,st,ut,ot);return{activeTooltipIndex:ut,activeLabel:ht,activePayload:dt,activeCoordinate:pt}}return null},getAxisMapByAxes=function(et,nt){var rt=nt.axes,it=nt.graphicalItems,ot=nt.axisType,at=nt.axisIdKey,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.layout,ht=et.children,dt=et.stackOffset,pt=isCategoricalAxis(ut,ot),mt=rt.reduce(function(gt,yt){var bt,vt=yt.props,xt=vt.type,kt=vt.dataKey,St=vt.allowDataOverflow,Tt=vt.allowDuplicatedCategory,At=vt.scale,Et=vt.ticks,$t=vt.includeHidden,Dt=yt.props[at];if(gt[Dt])return gt;var jt=getDisplayedData(et.data,{graphicalItems:it.filter(function(Ht){return Ht.props[at]===Dt}),dataStartIndex:lt,dataEndIndex:ct}),Pt=jt.length,Ct,wt,It;isDomainSpecifiedByUser(yt.props.domain,St,xt)&&(Ct=parseSpecifiedDomain(yt.props.domain,null,St),pt&&(xt==="number"||At!=="auto")&&(It=getDomainOfDataByKey(jt,kt,"category")));var Ot=getDefaultDomainByAxisType(xt);if(!Ct||Ct.length===0){var Wt,zt=(Wt=yt.props.domain)!==null&&Wt!==void 0?Wt:Ot;if(kt){if(Ct=getDomainOfDataByKey(jt,kt,xt),xt==="category"&&pt){var Ft=hasDuplicate(Ct);Tt&&Ft?(wt=Ct,Ct=_range(0,Pt)):Tt||(Ct=parseDomainOfCategoryAxis(zt,Ct,yt).reduce(function(Ht,en){return Ht.indexOf(en)>=0?Ht:[].concat(_toConsumableArray$1(Ht),[en])},[]))}else if(xt==="category")Tt?Ct=Ct.filter(function(Ht){return Ht!==""&&!_isNil(Ht)}):Ct=parseDomainOfCategoryAxis(zt,Ct,yt).reduce(function(Ht,en){return Ht.indexOf(en)>=0||en===""||_isNil(en)?Ht:[].concat(_toConsumableArray$1(Ht),[en])},[]);else if(xt==="number"){var Nt=parseErrorBarsOfAxis(jt,it.filter(function(Ht){return Ht.props[at]===Dt&&($t||!Ht.props.hide)}),kt,ot,ut);Nt&&(Ct=Nt)}pt&&(xt==="number"||At!=="auto")&&(It=getDomainOfDataByKey(jt,kt,"category"))}else pt?Ct=_range(0,Pt):st&&st[Dt]&&st[Dt].hasStack&&xt==="number"?Ct=dt==="expand"?[0,1]:getDomainOfStackGroups(st[Dt].stackGroups,lt,ct):Ct=getDomainOfItemsWithSameAxis(jt,it.filter(function(Ht){return Ht.props[at]===Dt&&($t||!Ht.props.hide)}),xt,ut,!0);if(xt==="number")Ct=detectReferenceElementsDomain(ht,Ct,Dt,ot,Et),zt&&(Ct=parseSpecifiedDomain(zt,Ct,St));else if(xt==="category"&&zt){var Ut=zt,Mt=Ct.every(function(Ht){return Ut.indexOf(Ht)>=0});Mt&&(Ct=Ut)}}return _objectSpread$1(_objectSpread$1({},gt),{},_defineProperty$1({},Dt,_objectSpread$1(_objectSpread$1({},yt.props),{},{axisType:ot,domain:Ct,categoricalDomain:It,duplicateDomain:wt,originalDomain:(bt=yt.props.domain)!==null&&bt!==void 0?bt:Ot,isCategorical:pt,layout:ut})))},{});return mt},getAxisMapByItems=function(et,nt){var rt=nt.graphicalItems,it=nt.Axis,ot=nt.axisType,at=nt.axisIdKey,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.layout,ht=et.children,dt=getDisplayedData(et.data,{graphicalItems:rt,dataStartIndex:lt,dataEndIndex:ct}),pt=dt.length,mt=isCategoricalAxis(ut,ot),gt=-1,yt=rt.reduce(function(bt,vt){var xt=vt.props[at],kt=getDefaultDomainByAxisType("number");if(!bt[xt]){gt++;var St;return mt?St=_range(0,pt):st&&st[xt]&&st[xt].hasStack?(St=getDomainOfStackGroups(st[xt].stackGroups,lt,ct),St=detectReferenceElementsDomain(ht,St,xt,ot)):(St=parseSpecifiedDomain(kt,getDomainOfItemsWithSameAxis(dt,rt.filter(function(Tt){return Tt.props[at]===xt&&!Tt.props.hide}),"number",ut),it.defaultProps.allowDataOverflow),St=detectReferenceElementsDomain(ht,St,xt,ot)),_objectSpread$1(_objectSpread$1({},bt),{},_defineProperty$1({},xt,_objectSpread$1(_objectSpread$1({axisType:ot},it.defaultProps),{},{hide:!0,orientation:_get(ORIENT_MAP,"".concat(ot,".").concat(gt%2),null),domain:St,originalDomain:kt,isCategorical:mt,layout:ut})))}return bt},{});return yt},getAxisMap=function(et,nt){var rt=nt.axisType,it=rt===void 0?"xAxis":rt,ot=nt.AxisComp,at=nt.graphicalItems,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.children,ht="".concat(it,"Id"),dt=findAllByType(ut,ot),pt={};return dt&&dt.length?pt=getAxisMapByAxes(et,{axes:dt,graphicalItems:at,axisType:it,axisIdKey:ht,stackGroups:st,dataStartIndex:lt,dataEndIndex:ct}):at&&at.length&&(pt=getAxisMapByItems(et,{Axis:ot,graphicalItems:at,axisType:it,axisIdKey:ht,stackGroups:st,dataStartIndex:lt,dataEndIndex:ct})),pt},tooltipTicksGenerator=function(et){var nt=getAnyElementOfObject(et),rt=getTicksOfAxis(nt,!1,!0);return{tooltipTicks:rt,orderedTooltipTicks:_sortBy(rt,function(it){return it.coordinate}),tooltipAxis:nt,tooltipAxisBandSize:getBandSizeOfAxis(nt,rt)}},createDefaultState=function(et){var nt,rt,it=et.children,ot=et.defaultShowTooltip,at=findChildByType(it,Brush),st=at&&at.props&&at.props.startIndex||0,lt=(at==null||(nt=at.props)===null||nt===void 0?void 0:nt.endIndex)!==void 0?at==null||(rt=at.props)===null||rt===void 0?void 0:rt.endIndex:et.data&&et.data.length-1||0;return{chartX:0,chartY:0,dataStartIndex:st,dataEndIndex:lt,activeTooltipIndex:-1,isTooltipActive:_isNil(ot)?!1:ot}},hasGraphicalBarItem=function(et){return!et||!et.length?!1:et.some(function(nt){var rt=getDisplayName(nt&&nt.type);return rt&&rt.indexOf("Bar")>=0})},getAxisNameByLayout=function(et){return et==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:et==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:et==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},calculateOffset=function(et,nt){var rt=et.props,it=et.graphicalItems,ot=et.xAxisMap,at=ot===void 0?{}:ot,st=et.yAxisMap,lt=st===void 0?{}:st,ct=rt.width,ut=rt.height,ht=rt.children,dt=rt.margin||{},pt=findChildByType(ht,Brush),mt=findChildByType(ht,Legend),gt=Object.keys(lt).reduce(function(xt,kt){var St=lt[kt],Tt=St.orientation;return!St.mirror&&!St.hide?_objectSpread$1(_objectSpread$1({},xt),{},_defineProperty$1({},Tt,xt[Tt]+St.width)):xt},{left:dt.left||0,right:dt.right||0}),yt=Object.keys(at).reduce(function(xt,kt){var St=at[kt],Tt=St.orientation;return!St.mirror&&!St.hide?_objectSpread$1(_objectSpread$1({},xt),{},_defineProperty$1({},Tt,_get(xt,"".concat(Tt))+St.height)):xt},{top:dt.top||0,bottom:dt.bottom||0}),bt=_objectSpread$1(_objectSpread$1({},yt),gt),vt=bt.bottom;return pt&&(bt.bottom+=pt.props.height||Brush.defaultProps.height),mt&&nt&&(bt=appendOffsetOfLegend(bt,it,rt,nt)),_objectSpread$1(_objectSpread$1({brushBottom:vt},bt),{},{width:ct-bt.left-bt.right,height:ut-bt.top-bt.bottom})},generateCategoricalChart=function(et){var nt,rt=et.chartName,it=et.GraphicalChild,ot=et.defaultTooltipEventType,at=ot===void 0?"axis":ot,st=et.validateTooltipEventTypes,lt=st===void 0?["axis"]:st,ct=et.axisComponents,ut=et.legendContent,ht=et.formatAxisMap,dt=et.defaultProps,pt=function(yt,bt){var vt=bt.graphicalItems,xt=bt.stackGroups,kt=bt.offset,St=bt.updateId,Tt=bt.dataStartIndex,At=bt.dataEndIndex,Et=yt.barSize,$t=yt.layout,Dt=yt.barGap,jt=yt.barCategoryGap,Pt=yt.maxBarSize,Ct=getAxisNameByLayout($t),wt=Ct.numericAxisName,It=Ct.cateAxisName,Ot=hasGraphicalBarItem(vt),Wt=Ot&&getBarSizeList({barSize:Et,stackGroups:xt}),zt=[];return vt.forEach(function(Ft,Nt){var Ut=getDisplayedData(yt.data,{dataStartIndex:Tt,dataEndIndex:At},Ft),Mt=Ft.props,Ht=Mt.dataKey,en=Mt.maxBarSize,sn=Ft.props["".concat(wt,"Id")],Kt=Ft.props["".concat(It,"Id")],rn={},nn=ct.reduce(function(An,wn){var fn,pn=bt["".concat(wn.axisType,"Map")],kn=Ft.props["".concat(wn.axisType,"Id")];pn&&pn[kn]||wn.axisType==="zAxis"||invariant(!1);var Dn=pn[kn];return _objectSpread$1(_objectSpread$1({},An),{},(fn={},_defineProperty$1(fn,wn.axisType,Dn),_defineProperty$1(fn,"".concat(wn.axisType,"Ticks"),getTicksOfAxis(Dn)),fn))},rn),hn=nn[It],vn=nn["".concat(It,"Ticks")],an=xt&&xt[sn]&&xt[sn].hasStack&&getStackedDataOfItem(Ft,xt[sn].stackGroups),Qt=getDisplayName(Ft.type).indexOf("Bar")>=0,_n=getBandSizeOfAxis(hn,vn),Pn=[];if(Qt){var $n,Nn,Tn=_isNil(en)?Pt:en,cn=($n=(Nn=getBandSizeOfAxis(hn,vn,!0))!==null&&Nn!==void 0?Nn:Tn)!==null&&$n!==void 0?$n:0;Pn=getBarPosition({barGap:Dt,barCategoryGap:jt,bandSize:cn!==_n?cn:_n,sizeList:Wt[Kt],maxBarSize:Tn}),cn!==_n&&(Pn=Pn.map(function(An){return _objectSpread$1(_objectSpread$1({},An),{},{position:_objectSpread$1(_objectSpread$1({},An.position),{},{offset:An.position.offset-cn/2})})}))}var mn=Ft&&Ft.type&&Ft.type.getComposedData;if(mn){var In;zt.push({props:_objectSpread$1(_objectSpread$1({},mn(_objectSpread$1(_objectSpread$1({},nn),{},{displayedData:Ut,props:yt,dataKey:Ht,item:Ft,bandSize:_n,barPosition:Pn,offset:kt,stackedData:an,layout:$t,dataStartIndex:Tt,dataEndIndex:At}))),{},(In={key:Ft.key||"item-".concat(Nt)},_defineProperty$1(In,wt,nn[wt]),_defineProperty$1(In,It,nn[It]),_defineProperty$1(In,"animationId",St),In)),childIndex:parseChildIndex(Ft,yt.children),item:Ft})}}),zt},mt=function(yt,bt){var vt=yt.props,xt=yt.dataStartIndex,kt=yt.dataEndIndex,St=yt.updateId;if(!validateWidthHeight({props:vt}))return null;var Tt=vt.children,At=vt.layout,Et=vt.stackOffset,$t=vt.data,Dt=vt.reverseStackOrder,jt=getAxisNameByLayout(At),Pt=jt.numericAxisName,Ct=jt.cateAxisName,wt=findAllByType(Tt,it),It=getStackGroupsByAxisId($t,wt,"".concat(Pt,"Id"),"".concat(Ct,"Id"),Et,Dt),Ot=ct.reduce(function(Ut,Mt){var Ht="".concat(Mt.axisType,"Map");return _objectSpread$1(_objectSpread$1({},Ut),{},_defineProperty$1({},Ht,getAxisMap(vt,_objectSpread$1(_objectSpread$1({},Mt),{},{graphicalItems:wt,stackGroups:Mt.axisType===Pt&&It,dataStartIndex:xt,dataEndIndex:kt}))))},{}),Wt=calculateOffset(_objectSpread$1(_objectSpread$1({},Ot),{},{props:vt,graphicalItems:wt}),bt==null?void 0:bt.legendBBox);Object.keys(Ot).forEach(function(Ut){Ot[Ut]=ht(vt,Ot[Ut],Wt,Ut.replace("Map",""),rt)});var zt=Ot["".concat(Ct,"Map")],Ft=tooltipTicksGenerator(zt),Nt=pt(vt,_objectSpread$1(_objectSpread$1({},Ot),{},{dataStartIndex:xt,dataEndIndex:kt,updateId:St,graphicalItems:wt,stackGroups:It,offset:Wt}));return _objectSpread$1(_objectSpread$1({formattedGraphicalItems:Nt,graphicalItems:wt,offset:Wt,stackGroups:It},Ft),Ot)};return nt=function(gt){_inherits$1(bt,gt);var yt=_createSuper$1(bt);function bt(vt){var xt;return _classCallCheck$1(this,bt),xt=yt.call(this,vt),_defineProperty$1(_assertThisInitialized$1(xt),"accessibilityManager",new AccessibilityManager),_defineProperty$1(_assertThisInitialized$1(xt),"clearDefer",function(){xt.cancelDefer&&(xt.cancelDefer(),xt.cancelDefer=null)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleLegendBBoxUpdate",function(kt){if(kt){var St=xt.state,Tt=St.dataStartIndex,At=St.dataEndIndex,Et=St.updateId;xt.setState(_objectSpread$1({legendBBox:kt},mt({props:xt.props,dataStartIndex:Tt,dataEndIndex:At,updateId:Et},_objectSpread$1(_objectSpread$1({},xt.state),{},{legendBBox:kt}))))}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleReceiveSyncEvent",function(kt,St,Tt){var At=xt.props.syncId;At===kt&&St!==xt.uniqueChartId&&(xt.clearDefer(),xt.cancelDefer=deferer(xt.applySyncEvent.bind(_assertThisInitialized$1(xt),Tt)))}),_defineProperty$1(_assertThisInitialized$1(xt),"handleBrushChange",function(kt){var St=kt.startIndex,Tt=kt.endIndex;if(St!==xt.state.dataStartIndex||Tt!==xt.state.dataEndIndex){var At=xt.state.updateId;xt.setState(function(){return _objectSpread$1({dataStartIndex:St,dataEndIndex:Tt},mt({props:xt.props,dataStartIndex:St,dataEndIndex:Tt,updateId:At},xt.state))}),xt.triggerSyncEvent({dataStartIndex:St,dataEndIndex:Tt})}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseEnter",function(kt){var St=xt.props.onMouseEnter,Tt=xt.getMouseInfo(kt);if(Tt){var At=_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0});xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"triggeredAfterMouseMove",function(kt){var St=xt.props.onMouseMove,Tt=xt.getMouseInfo(kt),At=Tt?_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0}):{isTooltipActive:!1};xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleItemMouseEnter",function(kt){xt.setState(function(){return{isTooltipActive:!0,activeItem:kt,activePayload:kt.tooltipPayload,activeCoordinate:kt.tooltipPosition||{x:kt.cx,y:kt.cy}}})}),_defineProperty$1(_assertThisInitialized$1(xt),"handleItemMouseLeave",function(){xt.setState(function(){return{isTooltipActive:!1}})}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseMove",function(kt){kt&&_isFunction$1(kt.persist)&&kt.persist(),xt.triggeredAfterMouseMove(kt)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseLeave",function(kt){var St=xt.props.onMouseLeave,Tt={isTooltipActive:!1};xt.setState(Tt),xt.triggerSyncEvent(Tt),_isFunction$1(St)&&St(Tt,kt),xt.cancelThrottledTriggerAfterMouseMove()}),_defineProperty$1(_assertThisInitialized$1(xt),"handleOuterEvent",function(kt){var St=getReactEventByType(kt),Tt=_get(xt.props,"".concat(St));if(St&&_isFunction$1(Tt)){var At;/.*touch.*/i.test(St)?At=xt.getMouseInfo(kt.changedTouches[0]):At=xt.getMouseInfo(kt);var Et=Tt;Et(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleClick",function(kt){var St=xt.props.onClick,Tt=xt.getMouseInfo(kt);if(Tt){var At=_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0});xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseDown",function(kt){var St=xt.props.onMouseDown;if(_isFunction$1(St)){var Tt=xt.getMouseInfo(kt);St(Tt,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseUp",function(kt){var St=xt.props.onMouseUp;if(_isFunction$1(St)){var Tt=xt.getMouseInfo(kt);St(Tt,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchMove",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseMove(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchStart",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseDown(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchEnd",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseUp(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"verticalCoordinatesGenerator",function(kt,St){var Tt=kt.xAxis,At=kt.width,Et=kt.height,$t=kt.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$1(_objectSpread$1(_objectSpread$1({},CartesianAxis.defaultProps),Tt),{},{ticks:getTicksOfAxis(Tt,!0),viewBox:{x:0,y:0,width:At,height:Et}})),$t.left,$t.left+$t.width,St)}),_defineProperty$1(_assertThisInitialized$1(xt),"horizontalCoordinatesGenerator",function(kt,St){var Tt=kt.yAxis,At=kt.width,Et=kt.height,$t=kt.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$1(_objectSpread$1(_objectSpread$1({},CartesianAxis.defaultProps),Tt),{},{ticks:getTicksOfAxis(Tt,!0),viewBox:{x:0,y:0,width:At,height:Et}})),$t.top,$t.top+$t.height,St)}),_defineProperty$1(_assertThisInitialized$1(xt),"axesTicksGenerator",function(kt){return getTicksOfAxis(kt,!0)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderCursor",function(kt){var St=xt.state,Tt=St.isTooltipActive,At=St.activeCoordinate,Et=St.activePayload,$t=St.offset,Dt=St.activeTooltipIndex,jt=St.tooltipAxisBandSize,Pt=xt.getTooltipEventType();if(!kt||!kt.props.cursor||!Tt||!At||rt!=="ScatterChart"&&Pt!=="axis")return null;var Ct=xt.props.layout,wt,It=Curve;if(rt==="ScatterChart")wt=At,It=Cross;else if(rt==="BarChart")wt=getCursorRectangle(Ct,At,$t,jt),It=Rectangle;else if(Ct==="radial"){var Ot=getRadialCursorPoints(At),Wt=Ot.cx,zt=Ot.cy,Ft=Ot.radius,Nt=Ot.startAngle,Ut=Ot.endAngle;wt={cx:Wt,cy:zt,startAngle:Nt,endAngle:Ut,innerRadius:Ft,outerRadius:Ft},It=Sector}else wt={points:getCursorPoints(Ct,At,$t)},It=Curve;var Mt=kt.key||"_recharts-cursor",Ht=_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({stroke:"#ccc",pointerEvents:"none"},$t),wt),filterProps(kt.props.cursor)),{},{payload:Et,payloadIndex:Dt,key:Mt,className:"recharts-tooltip-cursor"});return reactExports.isValidElement(kt.props.cursor)?reactExports.cloneElement(kt.props.cursor,Ht):reactExports.createElement(It,Ht)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderPolarAxis",function(kt,St,Tt){var At=_get(kt,"type.axisType"),Et=_get(xt.state,"".concat(At,"Map")),$t=Et&&Et[kt.props["".concat(At,"Id")]];return reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({},$t),{},{className:At,key:kt.key||"".concat(St,"-").concat(Tt),ticks:getTicksOfAxis($t,!0)}))}),_defineProperty$1(_assertThisInitialized$1(xt),"renderXAxis",function(kt,St,Tt){var At=xt.state.xAxisMap,Et=At[kt.props.xAxisId];return xt.renderAxis(Et,kt,St,Tt)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderYAxis",function(kt,St,Tt){var At=xt.state.yAxisMap,Et=At[kt.props.yAxisId];return xt.renderAxis(Et,kt,St,Tt)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderGrid",function(kt){var St=xt.state,Tt=St.xAxisMap,At=St.yAxisMap,Et=St.offset,$t=xt.props,Dt=$t.width,jt=$t.height,Pt=getAnyElementOfObject(Tt),Ct=_find(At,function(Ot){return _every(Ot.domain,isFinit)}),wt=Ct||getAnyElementOfObject(At),It=kt.props||{};return reactExports.cloneElement(kt,{key:kt.key||"grid",x:isNumber(It.x)?It.x:Et.left,y:isNumber(It.y)?It.y:Et.top,width:isNumber(It.width)?It.width:Et.width,height:isNumber(It.height)?It.height:Et.height,xAxis:Pt,yAxis:wt,offset:Et,chartWidth:Dt,chartHeight:jt,verticalCoordinatesGenerator:It.verticalCoordinatesGenerator||xt.verticalCoordinatesGenerator,horizontalCoordinatesGenerator:It.horizontalCoordinatesGenerator||xt.horizontalCoordinatesGenerator})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderPolarGrid",function(kt){var St=kt.props,Tt=St.radialLines,At=St.polarAngles,Et=St.polarRadius,$t=xt.state,Dt=$t.radiusAxisMap,jt=$t.angleAxisMap,Pt=getAnyElementOfObject(Dt),Ct=getAnyElementOfObject(jt),wt=Ct.cx,It=Ct.cy,Ot=Ct.innerRadius,Wt=Ct.outerRadius;return reactExports.cloneElement(kt,{polarAngles:_isArray$1(At)?At:getTicksOfAxis(Ct,!0).map(function(zt){return zt.coordinate}),polarRadius:_isArray$1(Et)?Et:getTicksOfAxis(Pt,!0).map(function(zt){return zt.coordinate}),cx:wt,cy:It,innerRadius:Ot,outerRadius:Wt,key:kt.key||"polar-grid",radialLines:Tt})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderLegend",function(){var kt=xt.state.formattedGraphicalItems,St=xt.props,Tt=St.children,At=St.width,Et=St.height,$t=xt.props.margin||{},Dt=At-($t.left||0)-($t.right||0),jt=getLegendProps({children:Tt,formattedGraphicalItems:kt,legendWidth:Dt,legendContent:ut});if(!jt)return null;var Pt=jt.item,Ct=_objectWithoutProperties(jt,_excluded);return reactExports.cloneElement(Pt,_objectSpread$1(_objectSpread$1({},Ct),{},{chartWidth:At,chartHeight:Et,margin:$t,onBBoxUpdate:xt.handleLegendBBoxUpdate}))}),_defineProperty$1(_assertThisInitialized$1(xt),"renderTooltip",function(){var kt=xt.props.children,St=findChildByType(kt,Tooltip);if(!St)return null;var Tt=xt.state,At=Tt.isTooltipActive,Et=Tt.activeCoordinate,$t=Tt.activePayload,Dt=Tt.activeLabel,jt=Tt.offset;return reactExports.cloneElement(St,{viewBox:_objectSpread$1(_objectSpread$1({},jt),{},{x:jt.left,y:jt.top}),active:At,label:Dt,payload:At?$t:[],coordinate:Et})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderBrush",function(kt){var St=xt.props,Tt=St.margin,At=St.data,Et=xt.state,$t=Et.offset,Dt=Et.dataStartIndex,jt=Et.dataEndIndex,Pt=Et.updateId;return reactExports.cloneElement(kt,{key:kt.key||"_recharts-brush",onChange:combineEventHandlers(xt.handleBrushChange,null,kt.props.onChange),data:At,x:isNumber(kt.props.x)?kt.props.x:$t.left,y:isNumber(kt.props.y)?kt.props.y:$t.top+$t.height+$t.brushBottom-(Tt.bottom||0),width:isNumber(kt.props.width)?kt.props.width:$t.width,startIndex:Dt,endIndex:jt,updateId:"brush-".concat(Pt)})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderReferenceElement",function(kt,St,Tt){if(!kt)return null;var At=_assertThisInitialized$1(xt),Et=At.clipPathId,$t=xt.state,Dt=$t.xAxisMap,jt=$t.yAxisMap,Pt=$t.offset,Ct=kt.props,wt=Ct.xAxisId,It=Ct.yAxisId;return reactExports.cloneElement(kt,{key:kt.key||"".concat(St,"-").concat(Tt),xAxis:Dt[wt],yAxis:jt[It],viewBox:{x:Pt.left,y:Pt.top,width:Pt.width,height:Pt.height},clipPathId:Et})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderActivePoints",function(kt){var St=kt.item,Tt=kt.activePoint,At=kt.basePoint,Et=kt.childIndex,$t=kt.isRange,Dt=[],jt=St.props.key,Pt=St.item.props,Ct=Pt.activeDot,wt=Pt.dataKey,It=_objectSpread$1(_objectSpread$1({index:Et,dataKey:wt,cx:Tt.x,cy:Tt.y,r:4,fill:getMainColorOfGraphicItem(St.item),strokeWidth:2,stroke:"#fff",payload:Tt.payload,value:Tt.value,key:"".concat(jt,"-activePoint-").concat(Et)},filterProps(Ct)),adaptEventHandlers(Ct));return Dt.push(bt.renderActiveDot(Ct,It)),At?Dt.push(bt.renderActiveDot(Ct,_objectSpread$1(_objectSpread$1({},It),{},{cx:At.x,cy:At.y,key:"".concat(jt,"-basePoint-").concat(Et)}))):$t&&Dt.push(null),Dt}),_defineProperty$1(_assertThisInitialized$1(xt),"renderGraphicChild",function(kt,St,Tt){var At=xt.filterFormatItem(kt,St,Tt);if(!At)return null;var Et=xt.getTooltipEventType(),$t=xt.state,Dt=$t.isTooltipActive,jt=$t.tooltipAxis,Pt=$t.activeTooltipIndex,Ct=$t.activeLabel,wt=xt.props.children,It=findChildByType(wt,Tooltip),Ot=At.props,Wt=Ot.points,zt=Ot.isRange,Ft=Ot.baseLine,Nt=At.item.props,Ut=Nt.activeDot,Mt=Nt.hide,Ht=Nt.activeBar,en=Nt.activeShape,sn=!!(!Mt&&Dt&&It&&(Ut||Ht||en)),Kt={};Et!=="axis"&&It&&It.props.trigger==="click"?Kt={onClick:combineEventHandlers(xt.handleItemMouseEnter,null,kt.props.onCLick)}:Et!=="axis"&&(Kt={onMouseLeave:combineEventHandlers(xt.handleItemMouseLeave,null,kt.props.onMouseLeave),onMouseEnter:combineEventHandlers(xt.handleItemMouseEnter,null,kt.props.onMouseEnter)});var rn=reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({},At.props),Kt));function nn(In){return typeof jt.dataKey=="function"?jt.dataKey(In.payload):null}if(sn)if(Pt>=0){var hn,vn;if(jt.dataKey&&!jt.allowDuplicatedCategory){var an=typeof jt.dataKey=="function"?nn:"payload.".concat(jt.dataKey.toString());hn=findEntryInArray(Wt,an,Ct),vn=zt&&Ft&&findEntryInArray(Ft,an,Ct)}else hn=Wt==null?void 0:Wt[Pt],vn=zt&&Ft&&Ft[Pt];if(en||Ht){var Qt=kt.props.activeIndex!==void 0?kt.props.activeIndex:Pt;return[reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1(_objectSpread$1({},At.props),Kt),{},{activeIndex:Qt})),null,null]}if(!_isNil(hn))return[rn].concat(_toConsumableArray$1(xt.renderActivePoints({item:At,activePoint:hn,basePoint:vn,childIndex:Pt,isRange:zt})))}else{var _n,Pn=(_n=xt.getItemByXY(xt.state.activeCoordinate))!==null&&_n!==void 0?_n:{graphicalItem:rn},$n=Pn.graphicalItem,Nn=$n.item,Tn=Nn===void 0?kt:Nn,cn=$n.childIndex,mn=_objectSpread$1(_objectSpread$1(_objectSpread$1({},At.props),Kt),{},{activeIndex:cn});return[reactExports.cloneElement(Tn,mn),null,null]}return zt?[rn,null,null]:[rn,null]}),_defineProperty$1(_assertThisInitialized$1(xt),"renderCustomized",function(kt,St,Tt){return reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({key:"recharts-customized-".concat(Tt)},xt.props),xt.state))}),xt.uniqueChartId=_isNil(vt.id)?uniqueId("recharts"):vt.id,xt.clipPathId="".concat(xt.uniqueChartId,"-clip"),vt.throttleDelay&&(xt.triggeredAfterMouseMove=_throttle(xt.triggeredAfterMouseMove,vt.throttleDelay)),xt.state={},xt}return _createClass$1(bt,[{key:"componentDidMount",value:function(){var xt,kt;_isNil(this.props.syncId)||this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(xt=this.props.margin.left)!==null&&xt!==void 0?xt:0,top:(kt=this.props.margin.top)!==null&&kt!==void 0?kt:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.handleMouseMove,layout:this.props.layout})}},{key:"getSnapshotBeforeUpdate",value:function(xt,kt){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==kt.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==xt.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==xt.margin){var St,Tt;this.accessibilityManager.setDetails({offset:{left:(St=this.props.margin.left)!==null&&St!==void 0?St:0,top:(Tt=this.props.margin.top)!==null&&Tt!==void 0?Tt:0}})}return null}},{key:"componentDidUpdate",value:function(xt){_isNil(xt.syncId)&&!_isNil(this.props.syncId)&&this.addListener(),!_isNil(xt.syncId)&&_isNil(this.props.syncId)&&this.removeListener()}},{key:"componentWillUnmount",value:function(){this.clearDefer(),_isNil(this.props.syncId)||this.removeListener(),this.cancelThrottledTriggerAfterMouseMove()}},{key:"cancelThrottledTriggerAfterMouseMove",value:function(){typeof this.triggeredAfterMouseMove.cancel=="function"&&this.triggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var xt=findChildByType(this.props.children,Tooltip);if(xt&&_isBoolean(xt.props.shared)){var kt=xt.props.shared?"axis":"item";return lt.indexOf(kt)>=0?kt:at}return at}},{key:"getMouseInfo",value:function(xt){var kt;if(!this.container)return null;var St=getOffset(this.container),Tt=calculateChartCoordinate(xt,St),At=this.container,Et=At==null||(kt=At.getBoundingClientRect())===null||kt===void 0?void 0:kt.width,$t=At.offsetWidth,Dt=Et/$t||1,jt=this.inRange(Tt.chartX,Tt.chartY,Dt);if(!jt)return null;var Pt=this.state,Ct=Pt.xAxisMap,wt=Pt.yAxisMap,It=this.getTooltipEventType();if(It!=="axis"&&Ct&&wt){var Ot=getAnyElementOfObject(Ct).scale,Wt=getAnyElementOfObject(wt).scale,zt=Ot&&Ot.invert?Ot.invert(Tt.chartX):null,Ft=Wt&&Wt.invert?Wt.invert(Tt.chartY):null;return _objectSpread$1(_objectSpread$1({},Tt),{},{xValue:zt,yValue:Ft})}var Nt=getTooltipData(this.state,this.props.data,this.props.layout,jt);return Nt?_objectSpread$1(_objectSpread$1({},Tt),Nt):null}},{key:"inRange",value:function(xt,kt){var St=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Tt=this.props.layout,At=xt/St,Et=kt/St;if(Tt==="horizontal"||Tt==="vertical"){var $t=this.state.offset,Dt=At>=$t.left&&At<=$t.left+$t.width&&Et>=$t.top&&Et<=$t.top+$t.height;return Dt?{x:At,y:Et}:null}var jt=this.state,Pt=jt.angleAxisMap,Ct=jt.radiusAxisMap;if(Pt&&Ct){var wt=getAnyElementOfObject(Pt);return inRangeOfSector({x:At,y:Et},wt)}return null}},{key:"parseEventsOfWrapper",value:function(){var xt=this.props.children,kt=this.getTooltipEventType(),St=findChildByType(xt,Tooltip),Tt={};St&&kt==="axis"&&(St.props.trigger==="click"?Tt={onClick:this.handleClick}:Tt={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var At=adaptEventHandlers(this.props,this.handleOuterEvent);return _objectSpread$1(_objectSpread$1({},At),Tt)}},{key:"addListener",value:function(){eventCenter.on(SYNC_EVENT,this.handleReceiveSyncEvent),eventCenter.setMaxListeners&&eventCenter._maxListeners&&eventCenter.setMaxListeners(eventCenter._maxListeners+1)}},{key:"removeListener",value:function(){eventCenter.removeListener(SYNC_EVENT,this.handleReceiveSyncEvent),eventCenter.setMaxListeners&&eventCenter._maxListeners&&eventCenter.setMaxListeners(eventCenter._maxListeners-1)}},{key:"triggerSyncEvent",value:function(xt){var kt=this.props.syncId;_isNil(kt)||eventCenter.emit(SYNC_EVENT,kt,this.uniqueChartId,xt)}},{key:"applySyncEvent",value:function(xt){var kt=this.props,St=kt.layout,Tt=kt.syncMethod,At=this.state.updateId,Et=xt.dataStartIndex,$t=xt.dataEndIndex;if(!_isNil(xt.dataStartIndex)||!_isNil(xt.dataEndIndex))this.setState(_objectSpread$1({dataStartIndex:Et,dataEndIndex:$t},mt({props:this.props,dataStartIndex:Et,dataEndIndex:$t,updateId:At},this.state)));else if(_isNil(xt.activeTooltipIndex))this.setState(xt);else{var Dt=xt.chartX,jt=xt.chartY,Pt=xt.activeTooltipIndex,Ct=this.state,wt=Ct.offset,It=Ct.tooltipTicks;if(!wt)return;if(typeof Tt=="function")Pt=Tt(It,xt);else if(Tt==="value"){Pt=-1;for(var Ot=0;OtjsxRuntimeExports.jsx(Dot,{cx:tt,cy:et,fill:colors.blueTextAccent,r:2}),SentimentChart=({data:tt,width:et=500,height:nt=300})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:(tt==null?void 0:tt.length)&&jsxRuntimeExports.jsxs(LineChart,{data:tt,height:nt,id:"cy-sentiment-chart",margin:{bottom:5,left:-20,right:30,top:5},width:et,children:[jsxRuntimeExports.jsx(CartesianGrid,{stroke:colors.lightBlue300,strokeDasharray:"5 5"}),jsxRuntimeExports.jsx(XAxis,{dataKey:"date",interval:Math.floor(tt.length/3),stroke:colors.blueTextAccent}),jsxRuntimeExports.jsx(YAxis,{domain:[0,10],stroke:colors.blueTextAccent}),jsxRuntimeExports.jsx(Tooltip,{}),jsxRuntimeExports.jsx(Line,{dataKey:"score",dot:jsxRuntimeExports.jsx(RenderDot$1,{}),stroke:"#8884d8",type:"monotone"})]})}),SentimentAnalysis=reactExports.memo(()=>{const tt=useAppStore(pt=>pt.currentSearch),[et,nt]=reactExports.useState(void 0),rt=hooks().startOf("day"),it=hooks().subtract(1,"year"),ot=3600*24,[at,st]=reactExports.useState(hooks().startOf("day").subtract(20,"day")),lt=(Math.round((rt.unix()-at.unix())/ot)+1)*50,[ct,ut]=reactExports.useState(!1),ht=async()=>{tt&&(ut(!0),await executeIfProd(()=>distExports$1.enable()),getSentimentData({topic:tt,cutoff_date:String(at.unix())}).then(pt=>{console.log(pt==null?void 0:pt.data),nt(pt==null?void 0:pt.data.filter(mt=>mt.date).map(mt=>({date:hooks.unix(Number(String(mt.date).split(".")[0])).format("MM/DD/YY"),score:mt.sentiment_score})))}).catch(console.error).finally(()=>{ut(!1)}))},dt=reactExports.useRef(null);return jsxRuntimeExports.jsxs(Stack$5,{component:"div",flexGrow:1,p:1,spacing:2,width:"100%",children:[ct&&jsxRuntimeExports.jsx(Stack$5,{alignItems:"center",component:"div",flexGrow:1,p:4,spacing:2,width:"100%",children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),!ct&&jsxRuntimeExports.jsxs(ChartWrapper$1,{ref:dt,children:[jsxRuntimeExports.jsx(SentimentChart,{data:et,height:280,width:352}),Array.isArray(et)&&!ct&&!et.length&&jsxRuntimeExports.jsx(Text$3,{children:"No data for this period"})]}),jsxRuntimeExports.jsx(DatePicker,{format:"L",label:"From",maxDate:rt,minDate:it,onChange:pt=>st(pt??hooks()),sx:{background:colors.inputBg1,color:"text.primary"},value:at}),jsxRuntimeExports.jsx(Slider$1,{component:"div",getAriaValueText:pt=>hooks(pt).format("L"),id:"cy-sentiment-analysis-slider",marks:!0,max:rt.unix(),min:it.unix(),onChange:(pt,mt)=>{st(hooks.unix(mt))},step:ot,value:at.unix(),valueLabelDisplay:"auto",valueLabelFormat:pt=>hooks.unix(pt).format("L")}),jsxRuntimeExports.jsxs(StyledButton$1,{className:"button",id:"cy-get-sentiment-analysis-btn",onClick:ht,children:["Create a chart for ",lt.toFixed()," SATS"]})]})}),ChartWrapper$1=styled$4.div` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$3(tt,et){if(tt){if(typeof tt=="string")return _arrayLikeToArray$3(tt,et);var nt=Object.prototype.toString.call(tt).slice(8,-1);if(nt==="Object"&&tt.constructor&&(nt=tt.constructor.name),nt==="Map"||nt==="Set")return Array.from(tt);if(nt==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(nt))return _arrayLikeToArray$3(tt,et)}}function _iterableToArray$1(tt){if(typeof Symbol<"u"&&tt[Symbol.iterator]!=null||tt["@@iterator"]!=null)return Array.from(tt)}function _arrayWithoutHoles$1(tt){if(Array.isArray(tt))return _arrayLikeToArray$3(tt)}function _arrayLikeToArray$3(tt,et){(et==null||et>tt.length)&&(et=tt.length);for(var nt=0,rt=new Array(et);nt0?st:rt&&rt.props&&rt.props.data&&rt.props.data.length>0?rt.props.data:et&&et.length&&isNumber(ot)&&isNumber(at)?et.slice(ot,at+1):[]};function getDefaultDomainByAxisType(tt){return tt==="number"?[0,"auto"]:void 0}var getTooltipContent=function(et,nt,rt,it){var ot=et.graphicalItems,at=et.tooltipAxis,st=getDisplayedData(nt,et);return rt<0||!ot||!ot.length||rt>=st.length?null:ot.reduce(function(lt,ct){var ut=ct.props.hide;if(ut)return lt;var ht=ct.props.data,dt=ht===void 0?nt:ht,pt;if(at.dataKey&&!at.allowDuplicatedCategory){var mt=dt===void 0?st:dt;pt=findEntryInArray(mt,at.dataKey,it)}else pt=dt&&dt[rt]||st[rt];return pt?[].concat(_toConsumableArray$1(lt),[getTooltipItem(ct,pt)]):lt},[])},getTooltipData=function(et,nt,rt,it){var ot=it||{x:et.chartX,y:et.chartY},at=calculateTooltipPos(ot,rt),st=et.orderedTooltipTicks,lt=et.tooltipAxis,ct=et.tooltipTicks,ut=calculateActiveTickIndex(at,st,ct,lt);if(ut>=0&&ct){var ht=ct[ut]&&ct[ut].value,dt=getTooltipContent(et,nt,ut,ht),pt=getActiveCoordinate(rt,st,ut,ot);return{activeTooltipIndex:ut,activeLabel:ht,activePayload:dt,activeCoordinate:pt}}return null},getAxisMapByAxes=function(et,nt){var rt=nt.axes,it=nt.graphicalItems,ot=nt.axisType,at=nt.axisIdKey,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.layout,ht=et.children,dt=et.stackOffset,pt=isCategoricalAxis(ut,ot),mt=rt.reduce(function(gt,yt){var bt,vt=yt.props,xt=vt.type,kt=vt.dataKey,St=vt.allowDataOverflow,Tt=vt.allowDuplicatedCategory,At=vt.scale,Et=vt.ticks,$t=vt.includeHidden,Dt=yt.props[at];if(gt[Dt])return gt;var jt=getDisplayedData(et.data,{graphicalItems:it.filter(function(Ht){return Ht.props[at]===Dt}),dataStartIndex:lt,dataEndIndex:ct}),Pt=jt.length,Ct,wt,It;isDomainSpecifiedByUser(yt.props.domain,St,xt)&&(Ct=parseSpecifiedDomain(yt.props.domain,null,St),pt&&(xt==="number"||At!=="auto")&&(It=getDomainOfDataByKey(jt,kt,"category")));var Ot=getDefaultDomainByAxisType(xt);if(!Ct||Ct.length===0){var Wt,zt=(Wt=yt.props.domain)!==null&&Wt!==void 0?Wt:Ot;if(kt){if(Ct=getDomainOfDataByKey(jt,kt,xt),xt==="category"&&pt){var Ft=hasDuplicate(Ct);Tt&&Ft?(wt=Ct,Ct=_range(0,Pt)):Tt||(Ct=parseDomainOfCategoryAxis(zt,Ct,yt).reduce(function(Ht,en){return Ht.indexOf(en)>=0?Ht:[].concat(_toConsumableArray$1(Ht),[en])},[]))}else if(xt==="category")Tt?Ct=Ct.filter(function(Ht){return Ht!==""&&!_isNil(Ht)}):Ct=parseDomainOfCategoryAxis(zt,Ct,yt).reduce(function(Ht,en){return Ht.indexOf(en)>=0||en===""||_isNil(en)?Ht:[].concat(_toConsumableArray$1(Ht),[en])},[]);else if(xt==="number"){var Nt=parseErrorBarsOfAxis(jt,it.filter(function(Ht){return Ht.props[at]===Dt&&($t||!Ht.props.hide)}),kt,ot,ut);Nt&&(Ct=Nt)}pt&&(xt==="number"||At!=="auto")&&(It=getDomainOfDataByKey(jt,kt,"category"))}else pt?Ct=_range(0,Pt):st&&st[Dt]&&st[Dt].hasStack&&xt==="number"?Ct=dt==="expand"?[0,1]:getDomainOfStackGroups(st[Dt].stackGroups,lt,ct):Ct=getDomainOfItemsWithSameAxis(jt,it.filter(function(Ht){return Ht.props[at]===Dt&&($t||!Ht.props.hide)}),xt,ut,!0);if(xt==="number")Ct=detectReferenceElementsDomain(ht,Ct,Dt,ot,Et),zt&&(Ct=parseSpecifiedDomain(zt,Ct,St));else if(xt==="category"&&zt){var Ut=zt,Mt=Ct.every(function(Ht){return Ut.indexOf(Ht)>=0});Mt&&(Ct=Ut)}}return _objectSpread$1(_objectSpread$1({},gt),{},_defineProperty$1({},Dt,_objectSpread$1(_objectSpread$1({},yt.props),{},{axisType:ot,domain:Ct,categoricalDomain:It,duplicateDomain:wt,originalDomain:(bt=yt.props.domain)!==null&&bt!==void 0?bt:Ot,isCategorical:pt,layout:ut})))},{});return mt},getAxisMapByItems=function(et,nt){var rt=nt.graphicalItems,it=nt.Axis,ot=nt.axisType,at=nt.axisIdKey,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.layout,ht=et.children,dt=getDisplayedData(et.data,{graphicalItems:rt,dataStartIndex:lt,dataEndIndex:ct}),pt=dt.length,mt=isCategoricalAxis(ut,ot),gt=-1,yt=rt.reduce(function(bt,vt){var xt=vt.props[at],kt=getDefaultDomainByAxisType("number");if(!bt[xt]){gt++;var St;return mt?St=_range(0,pt):st&&st[xt]&&st[xt].hasStack?(St=getDomainOfStackGroups(st[xt].stackGroups,lt,ct),St=detectReferenceElementsDomain(ht,St,xt,ot)):(St=parseSpecifiedDomain(kt,getDomainOfItemsWithSameAxis(dt,rt.filter(function(Tt){return Tt.props[at]===xt&&!Tt.props.hide}),"number",ut),it.defaultProps.allowDataOverflow),St=detectReferenceElementsDomain(ht,St,xt,ot)),_objectSpread$1(_objectSpread$1({},bt),{},_defineProperty$1({},xt,_objectSpread$1(_objectSpread$1({axisType:ot},it.defaultProps),{},{hide:!0,orientation:_get(ORIENT_MAP,"".concat(ot,".").concat(gt%2),null),domain:St,originalDomain:kt,isCategorical:mt,layout:ut})))}return bt},{});return yt},getAxisMap=function(et,nt){var rt=nt.axisType,it=rt===void 0?"xAxis":rt,ot=nt.AxisComp,at=nt.graphicalItems,st=nt.stackGroups,lt=nt.dataStartIndex,ct=nt.dataEndIndex,ut=et.children,ht="".concat(it,"Id"),dt=findAllByType(ut,ot),pt={};return dt&&dt.length?pt=getAxisMapByAxes(et,{axes:dt,graphicalItems:at,axisType:it,axisIdKey:ht,stackGroups:st,dataStartIndex:lt,dataEndIndex:ct}):at&&at.length&&(pt=getAxisMapByItems(et,{Axis:ot,graphicalItems:at,axisType:it,axisIdKey:ht,stackGroups:st,dataStartIndex:lt,dataEndIndex:ct})),pt},tooltipTicksGenerator=function(et){var nt=getAnyElementOfObject(et),rt=getTicksOfAxis(nt,!1,!0);return{tooltipTicks:rt,orderedTooltipTicks:_sortBy(rt,function(it){return it.coordinate}),tooltipAxis:nt,tooltipAxisBandSize:getBandSizeOfAxis(nt,rt)}},createDefaultState=function(et){var nt,rt,it=et.children,ot=et.defaultShowTooltip,at=findChildByType(it,Brush),st=at&&at.props&&at.props.startIndex||0,lt=(at==null||(nt=at.props)===null||nt===void 0?void 0:nt.endIndex)!==void 0?at==null||(rt=at.props)===null||rt===void 0?void 0:rt.endIndex:et.data&&et.data.length-1||0;return{chartX:0,chartY:0,dataStartIndex:st,dataEndIndex:lt,activeTooltipIndex:-1,isTooltipActive:_isNil(ot)?!1:ot}},hasGraphicalBarItem=function(et){return!et||!et.length?!1:et.some(function(nt){var rt=getDisplayName(nt&&nt.type);return rt&&rt.indexOf("Bar")>=0})},getAxisNameByLayout=function(et){return et==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:et==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:et==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},calculateOffset=function(et,nt){var rt=et.props,it=et.graphicalItems,ot=et.xAxisMap,at=ot===void 0?{}:ot,st=et.yAxisMap,lt=st===void 0?{}:st,ct=rt.width,ut=rt.height,ht=rt.children,dt=rt.margin||{},pt=findChildByType(ht,Brush),mt=findChildByType(ht,Legend),gt=Object.keys(lt).reduce(function(xt,kt){var St=lt[kt],Tt=St.orientation;return!St.mirror&&!St.hide?_objectSpread$1(_objectSpread$1({},xt),{},_defineProperty$1({},Tt,xt[Tt]+St.width)):xt},{left:dt.left||0,right:dt.right||0}),yt=Object.keys(at).reduce(function(xt,kt){var St=at[kt],Tt=St.orientation;return!St.mirror&&!St.hide?_objectSpread$1(_objectSpread$1({},xt),{},_defineProperty$1({},Tt,_get(xt,"".concat(Tt))+St.height)):xt},{top:dt.top||0,bottom:dt.bottom||0}),bt=_objectSpread$1(_objectSpread$1({},yt),gt),vt=bt.bottom;return pt&&(bt.bottom+=pt.props.height||Brush.defaultProps.height),mt&&nt&&(bt=appendOffsetOfLegend(bt,it,rt,nt)),_objectSpread$1(_objectSpread$1({brushBottom:vt},bt),{},{width:ct-bt.left-bt.right,height:ut-bt.top-bt.bottom})},generateCategoricalChart=function(et){var nt,rt=et.chartName,it=et.GraphicalChild,ot=et.defaultTooltipEventType,at=ot===void 0?"axis":ot,st=et.validateTooltipEventTypes,lt=st===void 0?["axis"]:st,ct=et.axisComponents,ut=et.legendContent,ht=et.formatAxisMap,dt=et.defaultProps,pt=function(yt,bt){var vt=bt.graphicalItems,xt=bt.stackGroups,kt=bt.offset,St=bt.updateId,Tt=bt.dataStartIndex,At=bt.dataEndIndex,Et=yt.barSize,$t=yt.layout,Dt=yt.barGap,jt=yt.barCategoryGap,Pt=yt.maxBarSize,Ct=getAxisNameByLayout($t),wt=Ct.numericAxisName,It=Ct.cateAxisName,Ot=hasGraphicalBarItem(vt),Wt=Ot&&getBarSizeList({barSize:Et,stackGroups:xt}),zt=[];return vt.forEach(function(Ft,Nt){var Ut=getDisplayedData(yt.data,{dataStartIndex:Tt,dataEndIndex:At},Ft),Mt=Ft.props,Ht=Mt.dataKey,en=Mt.maxBarSize,sn=Ft.props["".concat(wt,"Id")],Kt=Ft.props["".concat(It,"Id")],rn={},nn=ct.reduce(function(An,wn){var fn,pn=bt["".concat(wn.axisType,"Map")],kn=Ft.props["".concat(wn.axisType,"Id")];pn&&pn[kn]||wn.axisType==="zAxis"||invariant(!1);var Dn=pn[kn];return _objectSpread$1(_objectSpread$1({},An),{},(fn={},_defineProperty$1(fn,wn.axisType,Dn),_defineProperty$1(fn,"".concat(wn.axisType,"Ticks"),getTicksOfAxis(Dn)),fn))},rn),hn=nn[It],vn=nn["".concat(It,"Ticks")],an=xt&&xt[sn]&&xt[sn].hasStack&&getStackedDataOfItem(Ft,xt[sn].stackGroups),Qt=getDisplayName(Ft.type).indexOf("Bar")>=0,_n=getBandSizeOfAxis(hn,vn),Pn=[];if(Qt){var $n,Nn,Tn=_isNil(en)?Pt:en,cn=($n=(Nn=getBandSizeOfAxis(hn,vn,!0))!==null&&Nn!==void 0?Nn:Tn)!==null&&$n!==void 0?$n:0;Pn=getBarPosition({barGap:Dt,barCategoryGap:jt,bandSize:cn!==_n?cn:_n,sizeList:Wt[Kt],maxBarSize:Tn}),cn!==_n&&(Pn=Pn.map(function(An){return _objectSpread$1(_objectSpread$1({},An),{},{position:_objectSpread$1(_objectSpread$1({},An.position),{},{offset:An.position.offset-cn/2})})}))}var mn=Ft&&Ft.type&&Ft.type.getComposedData;if(mn){var In;zt.push({props:_objectSpread$1(_objectSpread$1({},mn(_objectSpread$1(_objectSpread$1({},nn),{},{displayedData:Ut,props:yt,dataKey:Ht,item:Ft,bandSize:_n,barPosition:Pn,offset:kt,stackedData:an,layout:$t,dataStartIndex:Tt,dataEndIndex:At}))),{},(In={key:Ft.key||"item-".concat(Nt)},_defineProperty$1(In,wt,nn[wt]),_defineProperty$1(In,It,nn[It]),_defineProperty$1(In,"animationId",St),In)),childIndex:parseChildIndex(Ft,yt.children),item:Ft})}}),zt},mt=function(yt,bt){var vt=yt.props,xt=yt.dataStartIndex,kt=yt.dataEndIndex,St=yt.updateId;if(!validateWidthHeight({props:vt}))return null;var Tt=vt.children,At=vt.layout,Et=vt.stackOffset,$t=vt.data,Dt=vt.reverseStackOrder,jt=getAxisNameByLayout(At),Pt=jt.numericAxisName,Ct=jt.cateAxisName,wt=findAllByType(Tt,it),It=getStackGroupsByAxisId($t,wt,"".concat(Pt,"Id"),"".concat(Ct,"Id"),Et,Dt),Ot=ct.reduce(function(Ut,Mt){var Ht="".concat(Mt.axisType,"Map");return _objectSpread$1(_objectSpread$1({},Ut),{},_defineProperty$1({},Ht,getAxisMap(vt,_objectSpread$1(_objectSpread$1({},Mt),{},{graphicalItems:wt,stackGroups:Mt.axisType===Pt&&It,dataStartIndex:xt,dataEndIndex:kt}))))},{}),Wt=calculateOffset(_objectSpread$1(_objectSpread$1({},Ot),{},{props:vt,graphicalItems:wt}),bt==null?void 0:bt.legendBBox);Object.keys(Ot).forEach(function(Ut){Ot[Ut]=ht(vt,Ot[Ut],Wt,Ut.replace("Map",""),rt)});var zt=Ot["".concat(Ct,"Map")],Ft=tooltipTicksGenerator(zt),Nt=pt(vt,_objectSpread$1(_objectSpread$1({},Ot),{},{dataStartIndex:xt,dataEndIndex:kt,updateId:St,graphicalItems:wt,stackGroups:It,offset:Wt}));return _objectSpread$1(_objectSpread$1({formattedGraphicalItems:Nt,graphicalItems:wt,offset:Wt,stackGroups:It},Ft),Ot)};return nt=function(gt){_inherits$1(bt,gt);var yt=_createSuper$1(bt);function bt(vt){var xt;return _classCallCheck$1(this,bt),xt=yt.call(this,vt),_defineProperty$1(_assertThisInitialized$1(xt),"accessibilityManager",new AccessibilityManager),_defineProperty$1(_assertThisInitialized$1(xt),"clearDefer",function(){xt.cancelDefer&&(xt.cancelDefer(),xt.cancelDefer=null)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleLegendBBoxUpdate",function(kt){if(kt){var St=xt.state,Tt=St.dataStartIndex,At=St.dataEndIndex,Et=St.updateId;xt.setState(_objectSpread$1({legendBBox:kt},mt({props:xt.props,dataStartIndex:Tt,dataEndIndex:At,updateId:Et},_objectSpread$1(_objectSpread$1({},xt.state),{},{legendBBox:kt}))))}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleReceiveSyncEvent",function(kt,St,Tt){var At=xt.props.syncId;At===kt&&St!==xt.uniqueChartId&&(xt.clearDefer(),xt.cancelDefer=deferer(xt.applySyncEvent.bind(_assertThisInitialized$1(xt),Tt)))}),_defineProperty$1(_assertThisInitialized$1(xt),"handleBrushChange",function(kt){var St=kt.startIndex,Tt=kt.endIndex;if(St!==xt.state.dataStartIndex||Tt!==xt.state.dataEndIndex){var At=xt.state.updateId;xt.setState(function(){return _objectSpread$1({dataStartIndex:St,dataEndIndex:Tt},mt({props:xt.props,dataStartIndex:St,dataEndIndex:Tt,updateId:At},xt.state))}),xt.triggerSyncEvent({dataStartIndex:St,dataEndIndex:Tt})}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseEnter",function(kt){var St=xt.props.onMouseEnter,Tt=xt.getMouseInfo(kt);if(Tt){var At=_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0});xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"triggeredAfterMouseMove",function(kt){var St=xt.props.onMouseMove,Tt=xt.getMouseInfo(kt),At=Tt?_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0}):{isTooltipActive:!1};xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleItemMouseEnter",function(kt){xt.setState(function(){return{isTooltipActive:!0,activeItem:kt,activePayload:kt.tooltipPayload,activeCoordinate:kt.tooltipPosition||{x:kt.cx,y:kt.cy}}})}),_defineProperty$1(_assertThisInitialized$1(xt),"handleItemMouseLeave",function(){xt.setState(function(){return{isTooltipActive:!1}})}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseMove",function(kt){kt&&_isFunction$1(kt.persist)&&kt.persist(),xt.triggeredAfterMouseMove(kt)}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseLeave",function(kt){var St=xt.props.onMouseLeave,Tt={isTooltipActive:!1};xt.setState(Tt),xt.triggerSyncEvent(Tt),_isFunction$1(St)&&St(Tt,kt),xt.cancelThrottledTriggerAfterMouseMove()}),_defineProperty$1(_assertThisInitialized$1(xt),"handleOuterEvent",function(kt){var St=getReactEventByType(kt),Tt=_get(xt.props,"".concat(St));if(St&&_isFunction$1(Tt)){var At;/.*touch.*/i.test(St)?At=xt.getMouseInfo(kt.changedTouches[0]):At=xt.getMouseInfo(kt);var Et=Tt;Et(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleClick",function(kt){var St=xt.props.onClick,Tt=xt.getMouseInfo(kt);if(Tt){var At=_objectSpread$1(_objectSpread$1({},Tt),{},{isTooltipActive:!0});xt.setState(At),xt.triggerSyncEvent(At),_isFunction$1(St)&&St(At,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseDown",function(kt){var St=xt.props.onMouseDown;if(_isFunction$1(St)){var Tt=xt.getMouseInfo(kt);St(Tt,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleMouseUp",function(kt){var St=xt.props.onMouseUp;if(_isFunction$1(St)){var Tt=xt.getMouseInfo(kt);St(Tt,kt)}}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchMove",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseMove(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchStart",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseDown(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"handleTouchEnd",function(kt){kt.changedTouches!=null&&kt.changedTouches.length>0&&xt.handleMouseUp(kt.changedTouches[0])}),_defineProperty$1(_assertThisInitialized$1(xt),"verticalCoordinatesGenerator",function(kt,St){var Tt=kt.xAxis,At=kt.width,Et=kt.height,$t=kt.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$1(_objectSpread$1(_objectSpread$1({},CartesianAxis.defaultProps),Tt),{},{ticks:getTicksOfAxis(Tt,!0),viewBox:{x:0,y:0,width:At,height:Et}})),$t.left,$t.left+$t.width,St)}),_defineProperty$1(_assertThisInitialized$1(xt),"horizontalCoordinatesGenerator",function(kt,St){var Tt=kt.yAxis,At=kt.width,Et=kt.height,$t=kt.offset;return getCoordinatesOfGrid(getTicks(_objectSpread$1(_objectSpread$1(_objectSpread$1({},CartesianAxis.defaultProps),Tt),{},{ticks:getTicksOfAxis(Tt,!0),viewBox:{x:0,y:0,width:At,height:Et}})),$t.top,$t.top+$t.height,St)}),_defineProperty$1(_assertThisInitialized$1(xt),"axesTicksGenerator",function(kt){return getTicksOfAxis(kt,!0)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderCursor",function(kt){var St=xt.state,Tt=St.isTooltipActive,At=St.activeCoordinate,Et=St.activePayload,$t=St.offset,Dt=St.activeTooltipIndex,jt=St.tooltipAxisBandSize,Pt=xt.getTooltipEventType();if(!kt||!kt.props.cursor||!Tt||!At||rt!=="ScatterChart"&&Pt!=="axis")return null;var Ct=xt.props.layout,wt,It=Curve;if(rt==="ScatterChart")wt=At,It=Cross;else if(rt==="BarChart")wt=getCursorRectangle(Ct,At,$t,jt),It=Rectangle;else if(Ct==="radial"){var Ot=getRadialCursorPoints(At),Wt=Ot.cx,zt=Ot.cy,Ft=Ot.radius,Nt=Ot.startAngle,Ut=Ot.endAngle;wt={cx:Wt,cy:zt,startAngle:Nt,endAngle:Ut,innerRadius:Ft,outerRadius:Ft},It=Sector}else wt={points:getCursorPoints(Ct,At,$t)},It=Curve;var Mt=kt.key||"_recharts-cursor",Ht=_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({stroke:"#ccc",pointerEvents:"none"},$t),wt),filterProps(kt.props.cursor)),{},{payload:Et,payloadIndex:Dt,key:Mt,className:"recharts-tooltip-cursor"});return reactExports.isValidElement(kt.props.cursor)?reactExports.cloneElement(kt.props.cursor,Ht):reactExports.createElement(It,Ht)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderPolarAxis",function(kt,St,Tt){var At=_get(kt,"type.axisType"),Et=_get(xt.state,"".concat(At,"Map")),$t=Et&&Et[kt.props["".concat(At,"Id")]];return reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({},$t),{},{className:At,key:kt.key||"".concat(St,"-").concat(Tt),ticks:getTicksOfAxis($t,!0)}))}),_defineProperty$1(_assertThisInitialized$1(xt),"renderXAxis",function(kt,St,Tt){var At=xt.state.xAxisMap,Et=At[kt.props.xAxisId];return xt.renderAxis(Et,kt,St,Tt)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderYAxis",function(kt,St,Tt){var At=xt.state.yAxisMap,Et=At[kt.props.yAxisId];return xt.renderAxis(Et,kt,St,Tt)}),_defineProperty$1(_assertThisInitialized$1(xt),"renderGrid",function(kt){var St=xt.state,Tt=St.xAxisMap,At=St.yAxisMap,Et=St.offset,$t=xt.props,Dt=$t.width,jt=$t.height,Pt=getAnyElementOfObject(Tt),Ct=_find(At,function(Ot){return _every(Ot.domain,isFinit)}),wt=Ct||getAnyElementOfObject(At),It=kt.props||{};return reactExports.cloneElement(kt,{key:kt.key||"grid",x:isNumber(It.x)?It.x:Et.left,y:isNumber(It.y)?It.y:Et.top,width:isNumber(It.width)?It.width:Et.width,height:isNumber(It.height)?It.height:Et.height,xAxis:Pt,yAxis:wt,offset:Et,chartWidth:Dt,chartHeight:jt,verticalCoordinatesGenerator:It.verticalCoordinatesGenerator||xt.verticalCoordinatesGenerator,horizontalCoordinatesGenerator:It.horizontalCoordinatesGenerator||xt.horizontalCoordinatesGenerator})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderPolarGrid",function(kt){var St=kt.props,Tt=St.radialLines,At=St.polarAngles,Et=St.polarRadius,$t=xt.state,Dt=$t.radiusAxisMap,jt=$t.angleAxisMap,Pt=getAnyElementOfObject(Dt),Ct=getAnyElementOfObject(jt),wt=Ct.cx,It=Ct.cy,Ot=Ct.innerRadius,Wt=Ct.outerRadius;return reactExports.cloneElement(kt,{polarAngles:_isArray$1(At)?At:getTicksOfAxis(Ct,!0).map(function(zt){return zt.coordinate}),polarRadius:_isArray$1(Et)?Et:getTicksOfAxis(Pt,!0).map(function(zt){return zt.coordinate}),cx:wt,cy:It,innerRadius:Ot,outerRadius:Wt,key:kt.key||"polar-grid",radialLines:Tt})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderLegend",function(){var kt=xt.state.formattedGraphicalItems,St=xt.props,Tt=St.children,At=St.width,Et=St.height,$t=xt.props.margin||{},Dt=At-($t.left||0)-($t.right||0),jt=getLegendProps({children:Tt,formattedGraphicalItems:kt,legendWidth:Dt,legendContent:ut});if(!jt)return null;var Pt=jt.item,Ct=_objectWithoutProperties(jt,_excluded);return reactExports.cloneElement(Pt,_objectSpread$1(_objectSpread$1({},Ct),{},{chartWidth:At,chartHeight:Et,margin:$t,onBBoxUpdate:xt.handleLegendBBoxUpdate}))}),_defineProperty$1(_assertThisInitialized$1(xt),"renderTooltip",function(){var kt=xt.props.children,St=findChildByType(kt,Tooltip);if(!St)return null;var Tt=xt.state,At=Tt.isTooltipActive,Et=Tt.activeCoordinate,$t=Tt.activePayload,Dt=Tt.activeLabel,jt=Tt.offset;return reactExports.cloneElement(St,{viewBox:_objectSpread$1(_objectSpread$1({},jt),{},{x:jt.left,y:jt.top}),active:At,label:Dt,payload:At?$t:[],coordinate:Et})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderBrush",function(kt){var St=xt.props,Tt=St.margin,At=St.data,Et=xt.state,$t=Et.offset,Dt=Et.dataStartIndex,jt=Et.dataEndIndex,Pt=Et.updateId;return reactExports.cloneElement(kt,{key:kt.key||"_recharts-brush",onChange:combineEventHandlers(xt.handleBrushChange,null,kt.props.onChange),data:At,x:isNumber(kt.props.x)?kt.props.x:$t.left,y:isNumber(kt.props.y)?kt.props.y:$t.top+$t.height+$t.brushBottom-(Tt.bottom||0),width:isNumber(kt.props.width)?kt.props.width:$t.width,startIndex:Dt,endIndex:jt,updateId:"brush-".concat(Pt)})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderReferenceElement",function(kt,St,Tt){if(!kt)return null;var At=_assertThisInitialized$1(xt),Et=At.clipPathId,$t=xt.state,Dt=$t.xAxisMap,jt=$t.yAxisMap,Pt=$t.offset,Ct=kt.props,wt=Ct.xAxisId,It=Ct.yAxisId;return reactExports.cloneElement(kt,{key:kt.key||"".concat(St,"-").concat(Tt),xAxis:Dt[wt],yAxis:jt[It],viewBox:{x:Pt.left,y:Pt.top,width:Pt.width,height:Pt.height},clipPathId:Et})}),_defineProperty$1(_assertThisInitialized$1(xt),"renderActivePoints",function(kt){var St=kt.item,Tt=kt.activePoint,At=kt.basePoint,Et=kt.childIndex,$t=kt.isRange,Dt=[],jt=St.props.key,Pt=St.item.props,Ct=Pt.activeDot,wt=Pt.dataKey,It=_objectSpread$1(_objectSpread$1({index:Et,dataKey:wt,cx:Tt.x,cy:Tt.y,r:4,fill:getMainColorOfGraphicItem(St.item),strokeWidth:2,stroke:"#fff",payload:Tt.payload,value:Tt.value,key:"".concat(jt,"-activePoint-").concat(Et)},filterProps(Ct)),adaptEventHandlers(Ct));return Dt.push(bt.renderActiveDot(Ct,It)),At?Dt.push(bt.renderActiveDot(Ct,_objectSpread$1(_objectSpread$1({},It),{},{cx:At.x,cy:At.y,key:"".concat(jt,"-basePoint-").concat(Et)}))):$t&&Dt.push(null),Dt}),_defineProperty$1(_assertThisInitialized$1(xt),"renderGraphicChild",function(kt,St,Tt){var At=xt.filterFormatItem(kt,St,Tt);if(!At)return null;var Et=xt.getTooltipEventType(),$t=xt.state,Dt=$t.isTooltipActive,jt=$t.tooltipAxis,Pt=$t.activeTooltipIndex,Ct=$t.activeLabel,wt=xt.props.children,It=findChildByType(wt,Tooltip),Ot=At.props,Wt=Ot.points,zt=Ot.isRange,Ft=Ot.baseLine,Nt=At.item.props,Ut=Nt.activeDot,Mt=Nt.hide,Ht=Nt.activeBar,en=Nt.activeShape,sn=!!(!Mt&&Dt&&It&&(Ut||Ht||en)),Kt={};Et!=="axis"&&It&&It.props.trigger==="click"?Kt={onClick:combineEventHandlers(xt.handleItemMouseEnter,null,kt.props.onCLick)}:Et!=="axis"&&(Kt={onMouseLeave:combineEventHandlers(xt.handleItemMouseLeave,null,kt.props.onMouseLeave),onMouseEnter:combineEventHandlers(xt.handleItemMouseEnter,null,kt.props.onMouseEnter)});var rn=reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({},At.props),Kt));function nn(In){return typeof jt.dataKey=="function"?jt.dataKey(In.payload):null}if(sn)if(Pt>=0){var hn,vn;if(jt.dataKey&&!jt.allowDuplicatedCategory){var an=typeof jt.dataKey=="function"?nn:"payload.".concat(jt.dataKey.toString());hn=findEntryInArray(Wt,an,Ct),vn=zt&&Ft&&findEntryInArray(Ft,an,Ct)}else hn=Wt==null?void 0:Wt[Pt],vn=zt&&Ft&&Ft[Pt];if(en||Ht){var Qt=kt.props.activeIndex!==void 0?kt.props.activeIndex:Pt;return[reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1(_objectSpread$1({},At.props),Kt),{},{activeIndex:Qt})),null,null]}if(!_isNil(hn))return[rn].concat(_toConsumableArray$1(xt.renderActivePoints({item:At,activePoint:hn,basePoint:vn,childIndex:Pt,isRange:zt})))}else{var _n,Pn=(_n=xt.getItemByXY(xt.state.activeCoordinate))!==null&&_n!==void 0?_n:{graphicalItem:rn},$n=Pn.graphicalItem,Nn=$n.item,Tn=Nn===void 0?kt:Nn,cn=$n.childIndex,mn=_objectSpread$1(_objectSpread$1(_objectSpread$1({},At.props),Kt),{},{activeIndex:cn});return[reactExports.cloneElement(Tn,mn),null,null]}return zt?[rn,null,null]:[rn,null]}),_defineProperty$1(_assertThisInitialized$1(xt),"renderCustomized",function(kt,St,Tt){return reactExports.cloneElement(kt,_objectSpread$1(_objectSpread$1({key:"recharts-customized-".concat(Tt)},xt.props),xt.state))}),xt.uniqueChartId=_isNil(vt.id)?uniqueId("recharts"):vt.id,xt.clipPathId="".concat(xt.uniqueChartId,"-clip"),vt.throttleDelay&&(xt.triggeredAfterMouseMove=_throttle(xt.triggeredAfterMouseMove,vt.throttleDelay)),xt.state={},xt}return _createClass$1(bt,[{key:"componentDidMount",value:function(){var xt,kt;_isNil(this.props.syncId)||this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(xt=this.props.margin.left)!==null&&xt!==void 0?xt:0,top:(kt=this.props.margin.top)!==null&&kt!==void 0?kt:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.handleMouseMove,layout:this.props.layout})}},{key:"getSnapshotBeforeUpdate",value:function(xt,kt){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==kt.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==xt.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==xt.margin){var St,Tt;this.accessibilityManager.setDetails({offset:{left:(St=this.props.margin.left)!==null&&St!==void 0?St:0,top:(Tt=this.props.margin.top)!==null&&Tt!==void 0?Tt:0}})}return null}},{key:"componentDidUpdate",value:function(xt){_isNil(xt.syncId)&&!_isNil(this.props.syncId)&&this.addListener(),!_isNil(xt.syncId)&&_isNil(this.props.syncId)&&this.removeListener()}},{key:"componentWillUnmount",value:function(){this.clearDefer(),_isNil(this.props.syncId)||this.removeListener(),this.cancelThrottledTriggerAfterMouseMove()}},{key:"cancelThrottledTriggerAfterMouseMove",value:function(){typeof this.triggeredAfterMouseMove.cancel=="function"&&this.triggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var xt=findChildByType(this.props.children,Tooltip);if(xt&&_isBoolean(xt.props.shared)){var kt=xt.props.shared?"axis":"item";return lt.indexOf(kt)>=0?kt:at}return at}},{key:"getMouseInfo",value:function(xt){var kt;if(!this.container)return null;var St=getOffset(this.container),Tt=calculateChartCoordinate(xt,St),At=this.container,Et=At==null||(kt=At.getBoundingClientRect())===null||kt===void 0?void 0:kt.width,$t=At.offsetWidth,Dt=Et/$t||1,jt=this.inRange(Tt.chartX,Tt.chartY,Dt);if(!jt)return null;var Pt=this.state,Ct=Pt.xAxisMap,wt=Pt.yAxisMap,It=this.getTooltipEventType();if(It!=="axis"&&Ct&&wt){var Ot=getAnyElementOfObject(Ct).scale,Wt=getAnyElementOfObject(wt).scale,zt=Ot&&Ot.invert?Ot.invert(Tt.chartX):null,Ft=Wt&&Wt.invert?Wt.invert(Tt.chartY):null;return _objectSpread$1(_objectSpread$1({},Tt),{},{xValue:zt,yValue:Ft})}var Nt=getTooltipData(this.state,this.props.data,this.props.layout,jt);return Nt?_objectSpread$1(_objectSpread$1({},Tt),Nt):null}},{key:"inRange",value:function(xt,kt){var St=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,Tt=this.props.layout,At=xt/St,Et=kt/St;if(Tt==="horizontal"||Tt==="vertical"){var $t=this.state.offset,Dt=At>=$t.left&&At<=$t.left+$t.width&&Et>=$t.top&&Et<=$t.top+$t.height;return Dt?{x:At,y:Et}:null}var jt=this.state,Pt=jt.angleAxisMap,Ct=jt.radiusAxisMap;if(Pt&&Ct){var wt=getAnyElementOfObject(Pt);return inRangeOfSector({x:At,y:Et},wt)}return null}},{key:"parseEventsOfWrapper",value:function(){var xt=this.props.children,kt=this.getTooltipEventType(),St=findChildByType(xt,Tooltip),Tt={};St&&kt==="axis"&&(St.props.trigger==="click"?Tt={onClick:this.handleClick}:Tt={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var At=adaptEventHandlers(this.props,this.handleOuterEvent);return _objectSpread$1(_objectSpread$1({},At),Tt)}},{key:"addListener",value:function(){eventCenter.on(SYNC_EVENT,this.handleReceiveSyncEvent),eventCenter.setMaxListeners&&eventCenter._maxListeners&&eventCenter.setMaxListeners(eventCenter._maxListeners+1)}},{key:"removeListener",value:function(){eventCenter.removeListener(SYNC_EVENT,this.handleReceiveSyncEvent),eventCenter.setMaxListeners&&eventCenter._maxListeners&&eventCenter.setMaxListeners(eventCenter._maxListeners-1)}},{key:"triggerSyncEvent",value:function(xt){var kt=this.props.syncId;_isNil(kt)||eventCenter.emit(SYNC_EVENT,kt,this.uniqueChartId,xt)}},{key:"applySyncEvent",value:function(xt){var kt=this.props,St=kt.layout,Tt=kt.syncMethod,At=this.state.updateId,Et=xt.dataStartIndex,$t=xt.dataEndIndex;if(!_isNil(xt.dataStartIndex)||!_isNil(xt.dataEndIndex))this.setState(_objectSpread$1({dataStartIndex:Et,dataEndIndex:$t},mt({props:this.props,dataStartIndex:Et,dataEndIndex:$t,updateId:At},this.state)));else if(_isNil(xt.activeTooltipIndex))this.setState(xt);else{var Dt=xt.chartX,jt=xt.chartY,Pt=xt.activeTooltipIndex,Ct=this.state,wt=Ct.offset,It=Ct.tooltipTicks;if(!wt)return;if(typeof Tt=="function")Pt=Tt(It,xt);else if(Tt==="value"){Pt=-1;for(var Ot=0;OtjsxRuntimeExports.jsx(Dot,{cx:tt,cy:et,fill:colors.blueTextAccent,r:2}),SentimentChart=({data:tt,width:et=500,height:nt=300})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:(tt==null?void 0:tt.length)&&jsxRuntimeExports.jsxs(LineChart,{data:tt,height:nt,id:"cy-sentiment-chart",margin:{bottom:5,left:-20,right:30,top:5},width:et,children:[jsxRuntimeExports.jsx(CartesianGrid,{stroke:colors.lightBlue300,strokeDasharray:"5 5"}),jsxRuntimeExports.jsx(XAxis,{dataKey:"date",interval:Math.floor(tt.length/3),stroke:colors.blueTextAccent}),jsxRuntimeExports.jsx(YAxis,{domain:[0,10],stroke:colors.blueTextAccent}),jsxRuntimeExports.jsx(Tooltip,{}),jsxRuntimeExports.jsx(Line,{dataKey:"score",dot:jsxRuntimeExports.jsx(RenderDot$1,{}),stroke:"#8884d8",type:"monotone"})]})}),SentimentAnalysis=reactExports.memo(()=>{const tt=useAppStore(mt=>mt.currentSearch),[et,nt]=reactExports.useState(void 0),rt=hooks().startOf("day"),it=hooks().subtract(1,"year"),ot=3600*24,[at]=useUserStore(mt=>[mt.setBudget]),[st,lt]=reactExports.useState(hooks().startOf("day").subtract(20,"day")),ct=(Math.round((rt.unix()-st.unix())/ot)+1)*50,[ut,ht]=reactExports.useState(!1),dt=async()=>{tt&&(ht(!0),await executeIfProd(()=>distExports$1.enable()),getSentimentData({topic:tt,cutoff_date:String(st.unix())}).then(async mt=>{console.log(mt==null?void 0:mt.data),nt(mt==null?void 0:mt.data.filter(gt=>gt.date).map(gt=>({date:hooks.unix(Number(String(gt.date).split(".")[0])).format("MM/DD/YY"),score:gt.sentiment_score}))),await updateBudget(at)}).catch(console.error).finally(()=>{ht(!1)}))},pt=reactExports.useRef(null);return jsxRuntimeExports.jsxs(Stack$5,{component:"div",flexGrow:1,p:1,spacing:2,width:"100%",children:[ut&&jsxRuntimeExports.jsx(Stack$5,{alignItems:"center",component:"div",flexGrow:1,p:4,spacing:2,width:"100%",children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),!ut&&jsxRuntimeExports.jsxs(ChartWrapper$1,{ref:pt,children:[jsxRuntimeExports.jsx(SentimentChart,{data:et,height:280,width:352}),Array.isArray(et)&&!ut&&!et.length&&jsxRuntimeExports.jsx(Text$3,{children:"No data for this period"})]}),jsxRuntimeExports.jsx(DatePicker,{format:"L",label:"From",maxDate:rt,minDate:it,onChange:mt=>lt(mt??hooks()),sx:{background:colors.inputBg1,color:"text.primary"},value:st}),jsxRuntimeExports.jsx(Slider$1,{component:"div",getAriaValueText:mt=>hooks(mt).format("L"),id:"cy-sentiment-analysis-slider",marks:!0,max:rt.unix(),min:it.unix(),onChange:(mt,gt)=>{lt(hooks.unix(gt))},step:ot,value:st.unix(),valueLabelDisplay:"auto",valueLabelFormat:mt=>hooks.unix(mt).format("L")}),jsxRuntimeExports.jsxs(StyledButton$1,{className:"button",id:"cy-get-sentiment-analysis-btn",onClick:dt,children:["Create a chart for ",ct.toFixed()," SATS"]})]})}),ChartWrapper$1=styled$4.div` flex: 1 1 auto; width: 100%; `,StyledButton$1=styled$4(Button)` height: 48px; -`,TABS=[{label:"Teach me",value:"teachMe"},{label:"Ask question",value:"askQuestion"},{label:"Sentiment Analysis",value:"sentiment"}],ActionsMenu=({onChange:tt,active:et})=>{const nt=(rt,it)=>{tt(TABS[it].value)};return et?jsxRuntimeExports.jsx(MenuWrapper,{direction:"row",id:"cy-helper-menu",maxWidth:"100%",mb:3,overflow:"auto",spacing:1,children:TABS.map((rt,it)=>jsxRuntimeExports.jsx(Chip$1,{color:rt.value===et?"primary":"default",component:"div",id:rt.value,label:rt.label,onClick:ot=>nt(ot,it)},rt.value))}):jsxRuntimeExports.jsx(Stack$5,{component:"div",flexGrow:1,id:"cy-helper-menu",justifyContent:"flex-end",mb:1,spacing:1,children:TABS.map((rt,it)=>jsxRuntimeExports.jsx(Chip$1,{component:"div",id:rt.value,label:rt.label,onClick:ot=>nt(ot,it)},rt.value))})},MenuWrapper=styled$1(Stack$5)(()=>({"&::-webkit-scrollbar":{width:"1px",height:"4px"},"&::-webkit-scrollbar-thumb":{width:"1px",height:"4px"}})),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(tt=>{PACKET_TYPES_REVERSE[PACKET_TYPES[tt]]=tt});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=tt=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt&&tt.buffer instanceof ArrayBuffer,encodePacket=({type:tt,data:et},nt,rt)=>withNativeBlob$1&&et instanceof Blob?nt?rt(et):encodeBlobAsBase64(et,rt):withNativeArrayBuffer$2&&(et instanceof ArrayBuffer||isView$1(et))?nt?rt(et):encodeBlobAsBase64(new Blob([et]),rt):rt(PACKET_TYPES[tt]+(et||"")),encodeBlobAsBase64=(tt,et)=>{const nt=new FileReader;return nt.onload=function(){const rt=nt.result.split(",")[1];et("b"+(rt||""))},nt.readAsDataURL(tt)};function toArray(tt){return tt instanceof Uint8Array?tt:tt instanceof ArrayBuffer?new Uint8Array(tt):new Uint8Array(tt.buffer,tt.byteOffset,tt.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(tt,et){if(withNativeBlob$1&&tt.data instanceof Blob)return tt.data.arrayBuffer().then(toArray).then(et);if(withNativeArrayBuffer$2&&(tt.data instanceof ArrayBuffer||isView$1(tt.data)))return et(toArray(tt.data));encodePacket(tt,!1,nt=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),et(TEXT_ENCODER.encode(nt))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let tt=0;tt{let et=tt.length*.75,nt=tt.length,rt,it=0,ot,at,st,lt;tt[tt.length-1]==="="&&(et--,tt[tt.length-2]==="="&&et--);const ct=new ArrayBuffer(et),ut=new Uint8Array(ct);for(rt=0;rt>4,ut[it++]=(at&15)<<4|st>>2,ut[it++]=(st&3)<<6|lt&63;return ct},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(tt,et)=>{if(typeof tt!="string")return{type:"message",data:mapBinary(tt,et)};const nt=tt.charAt(0);return nt==="b"?{type:"message",data:decodeBase64Packet(tt.substring(1),et)}:PACKET_TYPES_REVERSE[nt]?tt.length>1?{type:PACKET_TYPES_REVERSE[nt],data:tt.substring(1)}:{type:PACKET_TYPES_REVERSE[nt]}:ERROR_PACKET},decodeBase64Packet=(tt,et)=>{if(withNativeArrayBuffer$1){const nt=decode$1(tt);return mapBinary(nt,et)}else return{base64:!0,data:tt}},mapBinary=(tt,et)=>{switch(et){case"blob":return tt instanceof Blob?tt:new Blob([tt]);case"arraybuffer":default:return tt instanceof ArrayBuffer?tt:tt.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(tt,et)=>{const nt=tt.length,rt=new Array(nt);let it=0;tt.forEach((ot,at)=>{encodePacket(ot,!1,st=>{rt[at]=st,++it===nt&&et(rt.join(SEPARATOR))})})},decodePayload=(tt,et)=>{const nt=tt.split(SEPARATOR),rt=[];for(let it=0;it{const rt=nt.length;let it;if(rt<126)it=new Uint8Array(1),new DataView(it.buffer).setUint8(0,rt);else if(rt<65536){it=new Uint8Array(3);const ot=new DataView(it.buffer);ot.setUint8(0,126),ot.setUint16(1,rt)}else{it=new Uint8Array(9);const ot=new DataView(it.buffer);ot.setUint8(0,127),ot.setBigUint64(1,BigInt(rt))}tt.data&&typeof tt.data!="string"&&(it[0]|=128),et.enqueue(it),et.enqueue(nt)})}})}let TEXT_DECODER;function totalLength(tt){return tt.reduce((et,nt)=>et+nt.length,0)}function concatChunks(tt,et){if(tt[0].length===et)return tt.shift();const nt=new Uint8Array(et);let rt=0;for(let it=0;itMath.pow(2,53-32)-1){st.enqueue(ERROR_PACKET);break}it=ut*Math.pow(2,32)+ct.getUint32(4),rt=3}else{if(totalLength(nt)tt){st.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(tt){if(tt)return mixin(tt)}function mixin(tt){for(var et in Emitter.prototype)tt[et]=Emitter.prototype[et];return tt}Emitter.prototype.on=Emitter.prototype.addEventListener=function(tt,et){return this._callbacks=this._callbacks||{},(this._callbacks["$"+tt]=this._callbacks["$"+tt]||[]).push(et),this};Emitter.prototype.once=function(tt,et){function nt(){this.off(tt,nt),et.apply(this,arguments)}return nt.fn=et,this.on(tt,nt),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(tt,et){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var nt=this._callbacks["$"+tt];if(!nt)return this;if(arguments.length==1)return delete this._callbacks["$"+tt],this;for(var rt,it=0;ittypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(tt,...et){return et.reduce((nt,rt)=>(tt.hasOwnProperty(rt)&&(nt[rt]=tt[rt]),nt),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(tt,et){et.useNativeTimers?(tt.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),tt.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(tt.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),tt.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(tt){return typeof tt=="string"?utf8Length(tt):Math.ceil((tt.byteLength||tt.size)*BASE64_OVERHEAD)}function utf8Length(tt){let et=0,nt=0;for(let rt=0,it=tt.length;rt=57344?nt+=3:(rt++,nt+=4);return nt}function encode$1(tt){let et="";for(let nt in tt)tt.hasOwnProperty(nt)&&(et.length&&(et+="&"),et+=encodeURIComponent(nt)+"="+encodeURIComponent(tt[nt]));return et}function decode(tt){let et={},nt=tt.split("&");for(let rt=0,it=nt.length;rt0);return et}function yeast(){const tt=encode(+new Date);return tt!==prev?(seed=0,prev=tt):tt+"."+encode(seed++)}for(;i{this.readyState="paused",et()};if(this.polling||!this.writable){let rt=0;this.polling&&(rt++,this.once("pollComplete",function(){--rt||nt()})),this.writable||(rt++,this.once("drain",function(){--rt||nt()}))}else nt()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(et){const nt=rt=>{if(this.readyState==="opening"&&rt.type==="open"&&this.onOpen(),rt.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(rt)};decodePayload(et,this.socket.binaryType).forEach(nt),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const et=()=>{this.write([{type:"close"}])};this.readyState==="open"?et():this.once("open",et)}write(et){this.writable=!1,encodePayload(et,nt=>{this.doWrite(nt,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const et=this.opts.secure?"https":"http",nt=this.query||{};return this.opts.timestampRequests!==!1&&(nt[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!nt.sid&&(nt.b64=1),this.createUri(et,nt)}request(et={}){return Object.assign(et,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),et)}doWrite(et,nt){const rt=this.request({method:"POST",data:et});rt.on("success",nt),rt.on("error",(it,ot)=>{this.onError("xhr post error",it,ot)})}doPoll(){const et=this.request();et.on("data",this.onData.bind(this)),et.on("error",(nt,rt)=>{this.onError("xhr poll error",nt,rt)}),this.pollXhr=et}}let Request$1=class D0 extends Emitter{constructor(et,nt){super(),installTimerFunctions(this,nt),this.opts=nt,this.method=nt.method||"GET",this.uri=et,this.data=nt.data!==void 0?nt.data:null,this.create()}create(){var et;const nt=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");nt.xdomain=!!this.opts.xd;const rt=this.xhr=new XHR(nt);try{rt.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){rt.setDisableHeaderCheck&&rt.setDisableHeaderCheck(!0);for(let it in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(it)&&rt.setRequestHeader(it,this.opts.extraHeaders[it])}}catch{}if(this.method==="POST")try{rt.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{rt.setRequestHeader("Accept","*/*")}catch{}(et=this.opts.cookieJar)===null||et===void 0||et.addCookies(rt),"withCredentials"in rt&&(rt.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(rt.timeout=this.opts.requestTimeout),rt.onreadystatechange=()=>{var it;rt.readyState===3&&((it=this.opts.cookieJar)===null||it===void 0||it.parseCookies(rt)),rt.readyState===4&&(rt.status===200||rt.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof rt.status=="number"?rt.status:0)},0))},rt.send(this.data)}catch(it){this.setTimeoutFn(()=>{this.onError(it)},0);return}typeof document<"u"&&(this.index=D0.requestsCount++,D0.requests[this.index]=this)}onError(et){this.emitReserved("error",et,this.xhr),this.cleanup(!0)}cleanup(et){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,et)try{this.xhr.abort()}catch{}typeof document<"u"&&delete D0.requests[this.index],this.xhr=null}}onLoad(){const et=this.xhr.responseText;et!==null&&(this.emitReserved("data",et),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const tt="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(tt,unloadHandler,!1)}}function unloadHandler(){for(let tt in Request$1.requests)Request$1.requests.hasOwnProperty(tt)&&Request$1.requests[tt].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?et=>Promise.resolve().then(et):(et,nt)=>nt(et,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(et){super(et),this.supportsBinary=!et.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const et=this.uri(),nt=this.opts.protocols,rt=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(rt.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?nt?new WebSocket(et,nt):new WebSocket(et):new WebSocket(et,nt,rt)}catch(it){return this.emitReserved("error",it)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=et=>this.onClose({description:"websocket connection closed",context:et}),this.ws.onmessage=et=>this.onData(et.data),this.ws.onerror=et=>this.onError("websocket error",et)}write(et){this.writable=!1;for(let nt=0;nt{const at={};try{usingBrowserWebSocket&&this.ws.send(ot)}catch{}it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const et=this.opts.secure?"wss":"ws",nt=this.query||{};return this.opts.timestampRequests&&(nt[this.opts.timestampParam]=yeast()),this.supportsBinary||(nt.b64=1),this.createUri(et,nt)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(et=>{this.onError("webtransport error",et)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(et=>{const nt=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),rt=et.readable.pipeThrough(nt).getReader(),it=createPacketEncoderStream();it.readable.pipeTo(et.writable),this.writer=it.writable.getWriter();const ot=()=>{rt.read().then(({done:st,value:lt})=>{st||(this.onPacket(lt),ot())}).catch(st=>{})};ot();const at={type:"open"};this.query.sid&&(at.data=`{"sid":"${this.query.sid}"}`),this.writer.write(at).then(()=>this.onOpen())})}))}write(et){this.writable=!1;for(let nt=0;nt{it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var et;(et=this.transport)===null||et===void 0||et.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse(tt){const et=tt,nt=tt.indexOf("["),rt=tt.indexOf("]");nt!=-1&&rt!=-1&&(tt=tt.substring(0,nt)+tt.substring(nt,rt).replace(/:/g,";")+tt.substring(rt,tt.length));let it=re.exec(tt||""),ot={},at=14;for(;at--;)ot[parts[at]]=it[at]||"";return nt!=-1&&rt!=-1&&(ot.source=et,ot.host=ot.host.substring(1,ot.host.length-1).replace(/;/g,":"),ot.authority=ot.authority.replace("[","").replace("]","").replace(/;/g,":"),ot.ipv6uri=!0),ot.pathNames=pathNames(ot,ot.path),ot.queryKey=queryKey(ot,ot.query),ot}function pathNames(tt,et){const nt=/\/{2,9}/g,rt=et.replace(nt,"/").split("/");return(et.slice(0,1)=="/"||et.length===0)&&rt.splice(0,1),et.slice(-1)=="/"&&rt.splice(rt.length-1,1),rt}function queryKey(tt,et){const nt={};return et.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(rt,it,ot){it&&(nt[it]=ot)}),nt}let Socket$1=class Gm extends Emitter{constructor(et,nt={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],et&&typeof et=="object"&&(nt=et,et=null),et?(et=parse(et),nt.hostname=et.host,nt.secure=et.protocol==="https"||et.protocol==="wss",nt.port=et.port,et.query&&(nt.query=et.query)):nt.host&&(nt.hostname=parse(nt.host).host),installTimerFunctions(this,nt),this.secure=nt.secure!=null?nt.secure:typeof location<"u"&&location.protocol==="https:",nt.hostname&&!nt.port&&(nt.port=this.secure?"443":"80"),this.hostname=nt.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=nt.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=nt.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},nt),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(et){const nt=Object.assign({},this.opts.query);nt.EIO=protocol$1,nt.transport=et,this.id&&(nt.sid=this.id);const rt=Object.assign({},this.opts,{query:nt,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[et]);return new transports[et](rt)}open(){let et;if(this.opts.rememberUpgrade&&Gm.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)et="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else et=this.transports[0];this.readyState="opening";try{et=this.createTransport(et)}catch{this.transports.shift(),this.open();return}et.open(),this.setTransport(et)}setTransport(et){this.transport&&this.transport.removeAllListeners(),this.transport=et,et.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",nt=>this.onClose("transport close",nt))}probe(et){let nt=this.createTransport(et),rt=!1;Gm.priorWebsocketSuccess=!1;const it=()=>{rt||(nt.send([{type:"ping",data:"probe"}]),nt.once("packet",ht=>{if(!rt)if(ht.type==="pong"&&ht.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",nt),!nt)return;Gm.priorWebsocketSuccess=nt.name==="websocket",this.transport.pause(()=>{rt||this.readyState!=="closed"&&(ut(),this.setTransport(nt),nt.send([{type:"upgrade"}]),this.emitReserved("upgrade",nt),nt=null,this.upgrading=!1,this.flush())})}else{const dt=new Error("probe error");dt.transport=nt.name,this.emitReserved("upgradeError",dt)}}))};function ot(){rt||(rt=!0,ut(),nt.close(),nt=null)}const at=ht=>{const dt=new Error("probe error: "+ht);dt.transport=nt.name,ot(),this.emitReserved("upgradeError",dt)};function st(){at("transport closed")}function lt(){at("socket closed")}function ct(ht){nt&&ht.name!==nt.name&&ot()}const ut=()=>{nt.removeListener("open",it),nt.removeListener("error",at),nt.removeListener("close",st),this.off("close",lt),this.off("upgrading",ct)};nt.once("open",it),nt.once("error",at),nt.once("close",st),this.once("close",lt),this.once("upgrading",ct),this.upgrades.indexOf("webtransport")!==-1&&et!=="webtransport"?this.setTimeoutFn(()=>{rt||nt.open()},200):nt.open()}onOpen(){if(this.readyState="open",Gm.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let et=0;const nt=this.upgrades.length;for(;et{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const et=this.getWritablePackets();this.transport.send(et),this.prevBufferLen=et.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let nt=1;for(let rt=0;rt0&&nt>this.maxPayload)return this.writeBuffer.slice(0,rt);nt+=2}return this.writeBuffer}write(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}send(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}sendPacket(et,nt,rt,it){if(typeof nt=="function"&&(it=nt,nt=void 0),typeof rt=="function"&&(it=rt,rt=null),this.readyState==="closing"||this.readyState==="closed")return;rt=rt||{},rt.compress=rt.compress!==!1;const ot={type:et,data:nt,options:rt};this.emitReserved("packetCreate",ot),this.writeBuffer.push(ot),it&&this.once("flush",it),this.flush()}close(){const et=()=>{this.onClose("forced close"),this.transport.close()},nt=()=>{this.off("upgrade",nt),this.off("upgradeError",nt),et()},rt=()=>{this.once("upgrade",nt),this.once("upgradeError",nt)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?rt():et()}):this.upgrading?rt():et()),this}onError(et){Gm.priorWebsocketSuccess=!1,this.emitReserved("error",et),this.onClose("transport error",et)}onClose(et,nt){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",et,nt),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(et){const nt=[];let rt=0;const it=et.length;for(;rttypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(tt){return withNativeArrayBuffer&&(tt instanceof ArrayBuffer||isView(tt))||withNativeBlob&&tt instanceof Blob||withNativeFile&&tt instanceof File}function hasBinary(tt,et){if(!tt||typeof tt!="object")return!1;if(Array.isArray(tt)){for(let nt=0,rt=tt.length;nt=0&&tt.num{delete this.acks[et];for(let at=0;at{this.io.clearTimeoutFn(ot),nt.apply(this,[null,...at])}}emitWithAck(et,...nt){const rt=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((it,ot)=>{nt.push((at,st)=>rt?at?ot(at):it(st):it(at)),this.emit(et,...nt)})}_addToQueue(et){let nt;typeof et[et.length-1]=="function"&&(nt=et.pop());const rt={id:this._queueSeq++,tryCount:0,pending:!1,args:et,flags:Object.assign({fromQueue:!0},this.flags)};et.push((it,...ot)=>rt!==this._queue[0]?void 0:(it!==null?rt.tryCount>this._opts.retries&&(this._queue.shift(),nt&&nt(it)):(this._queue.shift(),nt&&nt(null,...ot)),rt.pending=!1,this._drainQueue())),this._queue.push(rt),this._drainQueue()}_drainQueue(et=!1){if(!this.connected||this._queue.length===0)return;const nt=this._queue[0];nt.pending&&!et||(nt.pending=!0,nt.tryCount++,this.flags=nt.flags,this.emit.apply(this,nt.args))}packet(et){et.nsp=this.nsp,this.io._packet(et)}onopen(){typeof this.auth=="function"?this.auth(et=>{this._sendConnectPacket(et)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(et){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},et):et})}onerror(et){this.connected||this.emitReserved("connect_error",et)}onclose(et,nt){this.connected=!1,delete this.id,this.emitReserved("disconnect",et,nt)}onpacket(et){if(et.nsp===this.nsp)switch(et.type){case PacketType.CONNECT:et.data&&et.data.sid?this.onconnect(et.data.sid,et.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(et);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(et);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const rt=new Error(et.data.message);rt.data=et.data.data,this.emitReserved("connect_error",rt);break}}onevent(et){const nt=et.data||[];et.id!=null&&nt.push(this.ack(et.id)),this.connected?this.emitEvent(nt):this.receiveBuffer.push(Object.freeze(nt))}emitEvent(et){if(this._anyListeners&&this._anyListeners.length){const nt=this._anyListeners.slice();for(const rt of nt)rt.apply(this,et)}super.emit.apply(this,et),this._pid&&et.length&&typeof et[et.length-1]=="string"&&(this._lastOffset=et[et.length-1])}ack(et){const nt=this;let rt=!1;return function(...it){rt||(rt=!0,nt.packet({type:PacketType.ACK,id:et,data:it}))}}onack(et){const nt=this.acks[et.id];typeof nt=="function"&&(nt.apply(this,et.data),delete this.acks[et.id])}onconnect(et,nt){this.id=et,this.recovered=nt&&this._pid===nt,this._pid=nt,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(et=>this.emitEvent(et)),this.receiveBuffer=[],this.sendBuffer.forEach(et=>{this.notifyOutgoingListeners(et),this.packet(et)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(et=>et()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(et){return this.flags.compress=et,this}get volatile(){return this.flags.volatile=!0,this}timeout(et){return this.flags.timeout=et,this}onAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(et),this}prependAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(et),this}offAny(et){if(!this._anyListeners)return this;if(et){const nt=this._anyListeners;for(let rt=0;rt0&&tt.jitter<=1?tt.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var tt=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var et=Math.random(),nt=Math.floor(et*this.jitter*tt);tt=Math.floor(et*10)&1?tt+nt:tt-nt}return Math.min(tt,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(tt){this.ms=tt};Backoff.prototype.setMax=function(tt){this.max=tt};Backoff.prototype.setJitter=function(tt){this.jitter=tt};class Manager extends Emitter{constructor(et,nt){var rt;super(),this.nsps={},this.subs=[],et&&typeof et=="object"&&(nt=et,et=void 0),nt=nt||{},nt.path=nt.path||"/socket.io",this.opts=nt,installTimerFunctions(this,nt),this.reconnection(nt.reconnection!==!1),this.reconnectionAttempts(nt.reconnectionAttempts||1/0),this.reconnectionDelay(nt.reconnectionDelay||1e3),this.reconnectionDelayMax(nt.reconnectionDelayMax||5e3),this.randomizationFactor((rt=nt.randomizationFactor)!==null&&rt!==void 0?rt:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(nt.timeout==null?2e4:nt.timeout),this._readyState="closed",this.uri=et;const it=nt.parser||parser;this.encoder=new it.Encoder,this.decoder=new it.Decoder,this._autoConnect=nt.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(et){return arguments.length?(this._reconnection=!!et,this):this._reconnection}reconnectionAttempts(et){return et===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=et,this)}reconnectionDelay(et){var nt;return et===void 0?this._reconnectionDelay:(this._reconnectionDelay=et,(nt=this.backoff)===null||nt===void 0||nt.setMin(et),this)}randomizationFactor(et){var nt;return et===void 0?this._randomizationFactor:(this._randomizationFactor=et,(nt=this.backoff)===null||nt===void 0||nt.setJitter(et),this)}reconnectionDelayMax(et){var nt;return et===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=et,(nt=this.backoff)===null||nt===void 0||nt.setMax(et),this)}timeout(et){return arguments.length?(this._timeout=et,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(et){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const nt=this.engine,rt=this;this._readyState="opening",this.skipReconnect=!1;const it=on(nt,"open",function(){rt.onopen(),et&&et()}),ot=st=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",st),et?et(st):this.maybeReconnectOnOpen()},at=on(nt,"error",ot);if(this._timeout!==!1){const st=this._timeout,lt=this.setTimeoutFn(()=>{it(),ot(new Error("timeout")),nt.close()},st);this.opts.autoUnref&<.unref(),this.subs.push(()=>{this.clearTimeoutFn(lt)})}return this.subs.push(it),this.subs.push(at),this}connect(et){return this.open(et)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const et=this.engine;this.subs.push(on(et,"ping",this.onping.bind(this)),on(et,"data",this.ondata.bind(this)),on(et,"error",this.onerror.bind(this)),on(et,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(et){try{this.decoder.add(et)}catch(nt){this.onclose("parse error",nt)}}ondecoded(et){nextTick(()=>{this.emitReserved("packet",et)},this.setTimeoutFn)}onerror(et){this.emitReserved("error",et)}socket(et,nt){let rt=this.nsps[et];return rt?this._autoConnect&&!rt.active&&rt.connect():(rt=new Socket(this,et,nt),this.nsps[et]=rt),rt}_destroy(et){const nt=Object.keys(this.nsps);for(const rt of nt)if(this.nsps[rt].active)return;this._close()}_packet(et){const nt=this.encoder.encode(et);for(let rt=0;rtet()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(et,nt){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",et,nt),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const et=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const nt=this.backoff.duration();this._reconnecting=!0;const rt=this.setTimeoutFn(()=>{et.skipReconnect||(this.emitReserved("reconnect_attempt",et.backoff.attempts),!et.skipReconnect&&et.open(it=>{it?(et._reconnecting=!1,et.reconnect(),this.emitReserved("reconnect_error",it)):et.onreconnect()}))},nt);this.opts.autoUnref&&rt.unref(),this.subs.push(()=>{this.clearTimeoutFn(rt)})}}onreconnect(){const et=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",et)}}const cache={};function lookup(tt,et){typeof tt=="object"&&(et=tt,tt=void 0),et=et||{};const nt=url(tt,et.path||"/socket.io"),rt=nt.source,it=nt.id,ot=nt.path,at=cache[it]&&ot in cache[it].nsps,st=et.forceNew||et["force new connection"]||et.multiplex===!1||at;let lt;return st?lt=new Manager(rt,et):(cache[it]||(cache[it]=new Manager(rt,et)),lt=cache[it]),nt.query&&!et.query&&(et.query=nt.queryKey),lt.socket(nt.path,et)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const useSocket=()=>{const[tt,et]=reactExports.useState(null);return reactExports.useEffect(()=>{const nt=lookup(API_URL);return et(nt),()=>{nt.disconnect()}},[]),tt},ITEM_HEIGHT=48,ITEM_PADDING_TOP=8,MenuProps={PaperProps:{style:{maxHeight:ITEM_HEIGHT*4.5+ITEM_PADDING_TOP,width:250}}},names=["Beginner","Intermediate","Advanced","Expert"],AskQuestion=()=>{const tt=useDataStore(vt=>vt.data),[et,nt]=reactExports.useState(""),[rt,it]=reactExports.useState("Beginner"),ot=useAppStore(vt=>vt.currentSearch),at=reactExports.useRef(!1),st=useSocket(),[lt,ct,ut,ht,dt]=useTeachStore(vt=>[vt.askedQuestions,vt.askedQuestionsAnswers,vt.setAskedQuestion,vt.setAskedQuestionAnswer,vt.hasQuestionInProgress]),pt=reactExports.useCallback(vt=>{ht(vt.answer),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Response is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[ht]);reactExports.useEffect(()=>{at.current||pt&&st&&(st.on("askquestionhook",pt),at.current=!0)},[pt,st]);const mt=async()=>{et&&(ut(et),nt(""));try{const vt=tt==null?void 0:tt.nodes.filter(St=>St.text),xt=vt==null?void 0:vt.slice(0,5),kt=(xt!=null&&xt.length?xt.map(St=>St.text).join(" "):"").substring(0,2500).replace(/[?&=+/#]/g,St=>`\\${St}`);ot&&(await distExports$1.enable(),await postAskQuestion({expertise_level:rt,question_text:et,search_term:ot,transcripts:kt}),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing response for you"}),{type:"success"}))}catch(vt){console.error(vt)}},gt=rt&&et.trim()&&!dt,yt=vt=>{it(vt.target.value)},bt=async vt=>{if(dt){vt.preventDefault();return}vt.keyCode===13&&vt.shiftKey===!1&>&&(vt.preventDefault(),mt())};return jsxRuntimeExports.jsxs(AskQuestionContainer,{children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(FormControl$1,{component:"div",children:[jsxRuntimeExports.jsx(StyledInput,{id:"select-label",size:"small",children:"Expertise level"}),jsxRuntimeExports.jsx(StyledSelect,{id:"demo-multiple-name",input:jsxRuntimeExports.jsx(OutlinedInput$1,{label:"Expertise level"}),labelId:"select-label",MenuProps,onChange:yt,size:"small",value:rt,children:names.map(vt=>jsxRuntimeExports.jsx(MenuItem$1,{component:"li",value:vt,children:vt},vt))})]})})}),jsxRuntimeExports.jsx(ResponsesWrapper,{children:lt==null?void 0:lt.map((vt,xt)=>jsxRuntimeExports.jsxs(Flex,{className:"response",py:12,children:[jsxRuntimeExports.jsx(Text$3,{kind:"medium",children:vt}),jsxRuntimeExports.jsx(Flex,{py:12,children:(ct==null?void 0:ct[xt])!==void 0?jsxRuntimeExports.jsx(Text$3,{color:"unreadMsgText",children:ct[xt]}):jsxRuntimeExports.jsxs(Flex,{align:"center",py:12,children:[jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(Text$3,{children:"Generating response"})})]})})]},vt))}),jsxRuntimeExports.jsxs(TextAreaWrapper,{onKeyDown:bt,py:12,tabIndex:-1,children:[jsxRuntimeExports.jsx(StyledTextarea,{disabled:dt,onChange:vt=>nt(vt.target.value),placeholder:"Enter your question",value:et}),jsxRuntimeExports.jsx(IconWrapper$1,{children:jsxRuntimeExports.jsx(MdSend,{color:gt?colors.white:colors.gray300,size:"18"})})]})]})},AskQuestionContainer=styled$4.div` +`,TABS=[{label:"Teach me",value:"teachMe"},{label:"Ask question",value:"askQuestion"},{label:"Sentiment Analysis",value:"sentiment"}],ActionsMenu=({onChange:tt,active:et})=>{const nt=(rt,it)=>{tt(TABS[it].value)};return et?jsxRuntimeExports.jsx(MenuWrapper,{direction:"row",id:"cy-helper-menu",maxWidth:"100%",mb:3,overflow:"auto",spacing:1,children:TABS.map((rt,it)=>jsxRuntimeExports.jsx(Chip$1,{color:rt.value===et?"primary":"default",component:"div",id:rt.value,label:rt.label,onClick:ot=>nt(ot,it)},rt.value))}):jsxRuntimeExports.jsx(Stack$5,{component:"div",flexGrow:1,id:"cy-helper-menu",justifyContent:"flex-end",mb:1,spacing:1,children:TABS.map((rt,it)=>jsxRuntimeExports.jsx(Chip$1,{component:"div",id:rt.value,label:rt.label,onClick:ot=>nt(ot,it)},rt.value))})},MenuWrapper=styled$1(Stack$5)(()=>({"&::-webkit-scrollbar":{width:"1px",height:"4px"},"&::-webkit-scrollbar-thumb":{width:"1px",height:"4px"}})),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(tt=>{PACKET_TYPES_REVERSE[PACKET_TYPES[tt]]=tt});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=tt=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt&&tt.buffer instanceof ArrayBuffer,encodePacket=({type:tt,data:et},nt,rt)=>withNativeBlob$1&&et instanceof Blob?nt?rt(et):encodeBlobAsBase64(et,rt):withNativeArrayBuffer$2&&(et instanceof ArrayBuffer||isView$1(et))?nt?rt(et):encodeBlobAsBase64(new Blob([et]),rt):rt(PACKET_TYPES[tt]+(et||"")),encodeBlobAsBase64=(tt,et)=>{const nt=new FileReader;return nt.onload=function(){const rt=nt.result.split(",")[1];et("b"+(rt||""))},nt.readAsDataURL(tt)};function toArray(tt){return tt instanceof Uint8Array?tt:tt instanceof ArrayBuffer?new Uint8Array(tt):new Uint8Array(tt.buffer,tt.byteOffset,tt.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(tt,et){if(withNativeBlob$1&&tt.data instanceof Blob)return tt.data.arrayBuffer().then(toArray).then(et);if(withNativeArrayBuffer$2&&(tt.data instanceof ArrayBuffer||isView$1(tt.data)))return et(toArray(tt.data));encodePacket(tt,!1,nt=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),et(TEXT_ENCODER.encode(nt))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let tt=0;tt{let et=tt.length*.75,nt=tt.length,rt,it=0,ot,at,st,lt;tt[tt.length-1]==="="&&(et--,tt[tt.length-2]==="="&&et--);const ct=new ArrayBuffer(et),ut=new Uint8Array(ct);for(rt=0;rt>4,ut[it++]=(at&15)<<4|st>>2,ut[it++]=(st&3)<<6|lt&63;return ct},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(tt,et)=>{if(typeof tt!="string")return{type:"message",data:mapBinary(tt,et)};const nt=tt.charAt(0);return nt==="b"?{type:"message",data:decodeBase64Packet(tt.substring(1),et)}:PACKET_TYPES_REVERSE[nt]?tt.length>1?{type:PACKET_TYPES_REVERSE[nt],data:tt.substring(1)}:{type:PACKET_TYPES_REVERSE[nt]}:ERROR_PACKET},decodeBase64Packet=(tt,et)=>{if(withNativeArrayBuffer$1){const nt=decode$1(tt);return mapBinary(nt,et)}else return{base64:!0,data:tt}},mapBinary=(tt,et)=>{switch(et){case"blob":return tt instanceof Blob?tt:new Blob([tt]);case"arraybuffer":default:return tt instanceof ArrayBuffer?tt:tt.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(tt,et)=>{const nt=tt.length,rt=new Array(nt);let it=0;tt.forEach((ot,at)=>{encodePacket(ot,!1,st=>{rt[at]=st,++it===nt&&et(rt.join(SEPARATOR))})})},decodePayload=(tt,et)=>{const nt=tt.split(SEPARATOR),rt=[];for(let it=0;it{const rt=nt.length;let it;if(rt<126)it=new Uint8Array(1),new DataView(it.buffer).setUint8(0,rt);else if(rt<65536){it=new Uint8Array(3);const ot=new DataView(it.buffer);ot.setUint8(0,126),ot.setUint16(1,rt)}else{it=new Uint8Array(9);const ot=new DataView(it.buffer);ot.setUint8(0,127),ot.setBigUint64(1,BigInt(rt))}tt.data&&typeof tt.data!="string"&&(it[0]|=128),et.enqueue(it),et.enqueue(nt)})}})}let TEXT_DECODER;function totalLength(tt){return tt.reduce((et,nt)=>et+nt.length,0)}function concatChunks(tt,et){if(tt[0].length===et)return tt.shift();const nt=new Uint8Array(et);let rt=0;for(let it=0;itMath.pow(2,53-32)-1){st.enqueue(ERROR_PACKET);break}it=ut*Math.pow(2,32)+ct.getUint32(4),rt=3}else{if(totalLength(nt)tt){st.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(tt){if(tt)return mixin(tt)}function mixin(tt){for(var et in Emitter.prototype)tt[et]=Emitter.prototype[et];return tt}Emitter.prototype.on=Emitter.prototype.addEventListener=function(tt,et){return this._callbacks=this._callbacks||{},(this._callbacks["$"+tt]=this._callbacks["$"+tt]||[]).push(et),this};Emitter.prototype.once=function(tt,et){function nt(){this.off(tt,nt),et.apply(this,arguments)}return nt.fn=et,this.on(tt,nt),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(tt,et){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var nt=this._callbacks["$"+tt];if(!nt)return this;if(arguments.length==1)return delete this._callbacks["$"+tt],this;for(var rt,it=0;ittypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(tt,...et){return et.reduce((nt,rt)=>(tt.hasOwnProperty(rt)&&(nt[rt]=tt[rt]),nt),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(tt,et){et.useNativeTimers?(tt.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),tt.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(tt.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),tt.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(tt){return typeof tt=="string"?utf8Length(tt):Math.ceil((tt.byteLength||tt.size)*BASE64_OVERHEAD)}function utf8Length(tt){let et=0,nt=0;for(let rt=0,it=tt.length;rt=57344?nt+=3:(rt++,nt+=4);return nt}function encode$1(tt){let et="";for(let nt in tt)tt.hasOwnProperty(nt)&&(et.length&&(et+="&"),et+=encodeURIComponent(nt)+"="+encodeURIComponent(tt[nt]));return et}function decode(tt){let et={},nt=tt.split("&");for(let rt=0,it=nt.length;rt0);return et}function yeast(){const tt=encode(+new Date);return tt!==prev?(seed=0,prev=tt):tt+"."+encode(seed++)}for(;i{this.readyState="paused",et()};if(this.polling||!this.writable){let rt=0;this.polling&&(rt++,this.once("pollComplete",function(){--rt||nt()})),this.writable||(rt++,this.once("drain",function(){--rt||nt()}))}else nt()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(et){const nt=rt=>{if(this.readyState==="opening"&&rt.type==="open"&&this.onOpen(),rt.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(rt)};decodePayload(et,this.socket.binaryType).forEach(nt),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const et=()=>{this.write([{type:"close"}])};this.readyState==="open"?et():this.once("open",et)}write(et){this.writable=!1,encodePayload(et,nt=>{this.doWrite(nt,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const et=this.opts.secure?"https":"http",nt=this.query||{};return this.opts.timestampRequests!==!1&&(nt[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!nt.sid&&(nt.b64=1),this.createUri(et,nt)}request(et={}){return Object.assign(et,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),et)}doWrite(et,nt){const rt=this.request({method:"POST",data:et});rt.on("success",nt),rt.on("error",(it,ot)=>{this.onError("xhr post error",it,ot)})}doPoll(){const et=this.request();et.on("data",this.onData.bind(this)),et.on("error",(nt,rt)=>{this.onError("xhr poll error",nt,rt)}),this.pollXhr=et}}let Request$1=class D0 extends Emitter{constructor(et,nt){super(),installTimerFunctions(this,nt),this.opts=nt,this.method=nt.method||"GET",this.uri=et,this.data=nt.data!==void 0?nt.data:null,this.create()}create(){var et;const nt=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");nt.xdomain=!!this.opts.xd;const rt=this.xhr=new XHR(nt);try{rt.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){rt.setDisableHeaderCheck&&rt.setDisableHeaderCheck(!0);for(let it in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(it)&&rt.setRequestHeader(it,this.opts.extraHeaders[it])}}catch{}if(this.method==="POST")try{rt.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{rt.setRequestHeader("Accept","*/*")}catch{}(et=this.opts.cookieJar)===null||et===void 0||et.addCookies(rt),"withCredentials"in rt&&(rt.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(rt.timeout=this.opts.requestTimeout),rt.onreadystatechange=()=>{var it;rt.readyState===3&&((it=this.opts.cookieJar)===null||it===void 0||it.parseCookies(rt)),rt.readyState===4&&(rt.status===200||rt.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof rt.status=="number"?rt.status:0)},0))},rt.send(this.data)}catch(it){this.setTimeoutFn(()=>{this.onError(it)},0);return}typeof document<"u"&&(this.index=D0.requestsCount++,D0.requests[this.index]=this)}onError(et){this.emitReserved("error",et,this.xhr),this.cleanup(!0)}cleanup(et){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,et)try{this.xhr.abort()}catch{}typeof document<"u"&&delete D0.requests[this.index],this.xhr=null}}onLoad(){const et=this.xhr.responseText;et!==null&&(this.emitReserved("data",et),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const tt="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(tt,unloadHandler,!1)}}function unloadHandler(){for(let tt in Request$1.requests)Request$1.requests.hasOwnProperty(tt)&&Request$1.requests[tt].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?et=>Promise.resolve().then(et):(et,nt)=>nt(et,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(et){super(et),this.supportsBinary=!et.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const et=this.uri(),nt=this.opts.protocols,rt=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(rt.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?nt?new WebSocket(et,nt):new WebSocket(et):new WebSocket(et,nt,rt)}catch(it){return this.emitReserved("error",it)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=et=>this.onClose({description:"websocket connection closed",context:et}),this.ws.onmessage=et=>this.onData(et.data),this.ws.onerror=et=>this.onError("websocket error",et)}write(et){this.writable=!1;for(let nt=0;nt{const at={};try{usingBrowserWebSocket&&this.ws.send(ot)}catch{}it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const et=this.opts.secure?"wss":"ws",nt=this.query||{};return this.opts.timestampRequests&&(nt[this.opts.timestampParam]=yeast()),this.supportsBinary||(nt.b64=1),this.createUri(et,nt)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(et=>{this.onError("webtransport error",et)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(et=>{const nt=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),rt=et.readable.pipeThrough(nt).getReader(),it=createPacketEncoderStream();it.readable.pipeTo(et.writable),this.writer=it.writable.getWriter();const ot=()=>{rt.read().then(({done:st,value:lt})=>{st||(this.onPacket(lt),ot())}).catch(st=>{})};ot();const at={type:"open"};this.query.sid&&(at.data=`{"sid":"${this.query.sid}"}`),this.writer.write(at).then(()=>this.onOpen())})}))}write(et){this.writable=!1;for(let nt=0;nt{it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var et;(et=this.transport)===null||et===void 0||et.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse(tt){const et=tt,nt=tt.indexOf("["),rt=tt.indexOf("]");nt!=-1&&rt!=-1&&(tt=tt.substring(0,nt)+tt.substring(nt,rt).replace(/:/g,";")+tt.substring(rt,tt.length));let it=re.exec(tt||""),ot={},at=14;for(;at--;)ot[parts[at]]=it[at]||"";return nt!=-1&&rt!=-1&&(ot.source=et,ot.host=ot.host.substring(1,ot.host.length-1).replace(/;/g,":"),ot.authority=ot.authority.replace("[","").replace("]","").replace(/;/g,":"),ot.ipv6uri=!0),ot.pathNames=pathNames(ot,ot.path),ot.queryKey=queryKey(ot,ot.query),ot}function pathNames(tt,et){const nt=/\/{2,9}/g,rt=et.replace(nt,"/").split("/");return(et.slice(0,1)=="/"||et.length===0)&&rt.splice(0,1),et.slice(-1)=="/"&&rt.splice(rt.length-1,1),rt}function queryKey(tt,et){const nt={};return et.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(rt,it,ot){it&&(nt[it]=ot)}),nt}let Socket$1=class Gm extends Emitter{constructor(et,nt={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],et&&typeof et=="object"&&(nt=et,et=null),et?(et=parse(et),nt.hostname=et.host,nt.secure=et.protocol==="https"||et.protocol==="wss",nt.port=et.port,et.query&&(nt.query=et.query)):nt.host&&(nt.hostname=parse(nt.host).host),installTimerFunctions(this,nt),this.secure=nt.secure!=null?nt.secure:typeof location<"u"&&location.protocol==="https:",nt.hostname&&!nt.port&&(nt.port=this.secure?"443":"80"),this.hostname=nt.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=nt.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=nt.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},nt),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(et){const nt=Object.assign({},this.opts.query);nt.EIO=protocol$1,nt.transport=et,this.id&&(nt.sid=this.id);const rt=Object.assign({},this.opts,{query:nt,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[et]);return new transports[et](rt)}open(){let et;if(this.opts.rememberUpgrade&&Gm.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)et="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else et=this.transports[0];this.readyState="opening";try{et=this.createTransport(et)}catch{this.transports.shift(),this.open();return}et.open(),this.setTransport(et)}setTransport(et){this.transport&&this.transport.removeAllListeners(),this.transport=et,et.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",nt=>this.onClose("transport close",nt))}probe(et){let nt=this.createTransport(et),rt=!1;Gm.priorWebsocketSuccess=!1;const it=()=>{rt||(nt.send([{type:"ping",data:"probe"}]),nt.once("packet",ht=>{if(!rt)if(ht.type==="pong"&&ht.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",nt),!nt)return;Gm.priorWebsocketSuccess=nt.name==="websocket",this.transport.pause(()=>{rt||this.readyState!=="closed"&&(ut(),this.setTransport(nt),nt.send([{type:"upgrade"}]),this.emitReserved("upgrade",nt),nt=null,this.upgrading=!1,this.flush())})}else{const dt=new Error("probe error");dt.transport=nt.name,this.emitReserved("upgradeError",dt)}}))};function ot(){rt||(rt=!0,ut(),nt.close(),nt=null)}const at=ht=>{const dt=new Error("probe error: "+ht);dt.transport=nt.name,ot(),this.emitReserved("upgradeError",dt)};function st(){at("transport closed")}function lt(){at("socket closed")}function ct(ht){nt&&ht.name!==nt.name&&ot()}const ut=()=>{nt.removeListener("open",it),nt.removeListener("error",at),nt.removeListener("close",st),this.off("close",lt),this.off("upgrading",ct)};nt.once("open",it),nt.once("error",at),nt.once("close",st),this.once("close",lt),this.once("upgrading",ct),this.upgrades.indexOf("webtransport")!==-1&&et!=="webtransport"?this.setTimeoutFn(()=>{rt||nt.open()},200):nt.open()}onOpen(){if(this.readyState="open",Gm.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let et=0;const nt=this.upgrades.length;for(;et{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const et=this.getWritablePackets();this.transport.send(et),this.prevBufferLen=et.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let nt=1;for(let rt=0;rt0&&nt>this.maxPayload)return this.writeBuffer.slice(0,rt);nt+=2}return this.writeBuffer}write(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}send(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}sendPacket(et,nt,rt,it){if(typeof nt=="function"&&(it=nt,nt=void 0),typeof rt=="function"&&(it=rt,rt=null),this.readyState==="closing"||this.readyState==="closed")return;rt=rt||{},rt.compress=rt.compress!==!1;const ot={type:et,data:nt,options:rt};this.emitReserved("packetCreate",ot),this.writeBuffer.push(ot),it&&this.once("flush",it),this.flush()}close(){const et=()=>{this.onClose("forced close"),this.transport.close()},nt=()=>{this.off("upgrade",nt),this.off("upgradeError",nt),et()},rt=()=>{this.once("upgrade",nt),this.once("upgradeError",nt)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?rt():et()}):this.upgrading?rt():et()),this}onError(et){Gm.priorWebsocketSuccess=!1,this.emitReserved("error",et),this.onClose("transport error",et)}onClose(et,nt){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",et,nt),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(et){const nt=[];let rt=0;const it=et.length;for(;rttypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt.buffer instanceof ArrayBuffer,toString=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString.call(File)==="[object FileConstructor]";function isBinary(tt){return withNativeArrayBuffer&&(tt instanceof ArrayBuffer||isView(tt))||withNativeBlob&&tt instanceof Blob||withNativeFile&&tt instanceof File}function hasBinary(tt,et){if(!tt||typeof tt!="object")return!1;if(Array.isArray(tt)){for(let nt=0,rt=tt.length;nt=0&&tt.num{delete this.acks[et];for(let at=0;at{this.io.clearTimeoutFn(ot),nt.apply(this,[null,...at])}}emitWithAck(et,...nt){const rt=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((it,ot)=>{nt.push((at,st)=>rt?at?ot(at):it(st):it(at)),this.emit(et,...nt)})}_addToQueue(et){let nt;typeof et[et.length-1]=="function"&&(nt=et.pop());const rt={id:this._queueSeq++,tryCount:0,pending:!1,args:et,flags:Object.assign({fromQueue:!0},this.flags)};et.push((it,...ot)=>rt!==this._queue[0]?void 0:(it!==null?rt.tryCount>this._opts.retries&&(this._queue.shift(),nt&&nt(it)):(this._queue.shift(),nt&&nt(null,...ot)),rt.pending=!1,this._drainQueue())),this._queue.push(rt),this._drainQueue()}_drainQueue(et=!1){if(!this.connected||this._queue.length===0)return;const nt=this._queue[0];nt.pending&&!et||(nt.pending=!0,nt.tryCount++,this.flags=nt.flags,this.emit.apply(this,nt.args))}packet(et){et.nsp=this.nsp,this.io._packet(et)}onopen(){typeof this.auth=="function"?this.auth(et=>{this._sendConnectPacket(et)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(et){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},et):et})}onerror(et){this.connected||this.emitReserved("connect_error",et)}onclose(et,nt){this.connected=!1,delete this.id,this.emitReserved("disconnect",et,nt)}onpacket(et){if(et.nsp===this.nsp)switch(et.type){case PacketType.CONNECT:et.data&&et.data.sid?this.onconnect(et.data.sid,et.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(et);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(et);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const rt=new Error(et.data.message);rt.data=et.data.data,this.emitReserved("connect_error",rt);break}}onevent(et){const nt=et.data||[];et.id!=null&&nt.push(this.ack(et.id)),this.connected?this.emitEvent(nt):this.receiveBuffer.push(Object.freeze(nt))}emitEvent(et){if(this._anyListeners&&this._anyListeners.length){const nt=this._anyListeners.slice();for(const rt of nt)rt.apply(this,et)}super.emit.apply(this,et),this._pid&&et.length&&typeof et[et.length-1]=="string"&&(this._lastOffset=et[et.length-1])}ack(et){const nt=this;let rt=!1;return function(...it){rt||(rt=!0,nt.packet({type:PacketType.ACK,id:et,data:it}))}}onack(et){const nt=this.acks[et.id];typeof nt=="function"&&(nt.apply(this,et.data),delete this.acks[et.id])}onconnect(et,nt){this.id=et,this.recovered=nt&&this._pid===nt,this._pid=nt,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(et=>this.emitEvent(et)),this.receiveBuffer=[],this.sendBuffer.forEach(et=>{this.notifyOutgoingListeners(et),this.packet(et)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(et=>et()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(et){return this.flags.compress=et,this}get volatile(){return this.flags.volatile=!0,this}timeout(et){return this.flags.timeout=et,this}onAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(et),this}prependAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(et),this}offAny(et){if(!this._anyListeners)return this;if(et){const nt=this._anyListeners;for(let rt=0;rt0&&tt.jitter<=1?tt.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var tt=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var et=Math.random(),nt=Math.floor(et*this.jitter*tt);tt=Math.floor(et*10)&1?tt+nt:tt-nt}return Math.min(tt,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(tt){this.ms=tt};Backoff.prototype.setMax=function(tt){this.max=tt};Backoff.prototype.setJitter=function(tt){this.jitter=tt};class Manager extends Emitter{constructor(et,nt){var rt;super(),this.nsps={},this.subs=[],et&&typeof et=="object"&&(nt=et,et=void 0),nt=nt||{},nt.path=nt.path||"/socket.io",this.opts=nt,installTimerFunctions(this,nt),this.reconnection(nt.reconnection!==!1),this.reconnectionAttempts(nt.reconnectionAttempts||1/0),this.reconnectionDelay(nt.reconnectionDelay||1e3),this.reconnectionDelayMax(nt.reconnectionDelayMax||5e3),this.randomizationFactor((rt=nt.randomizationFactor)!==null&&rt!==void 0?rt:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(nt.timeout==null?2e4:nt.timeout),this._readyState="closed",this.uri=et;const it=nt.parser||parser;this.encoder=new it.Encoder,this.decoder=new it.Decoder,this._autoConnect=nt.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(et){return arguments.length?(this._reconnection=!!et,this):this._reconnection}reconnectionAttempts(et){return et===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=et,this)}reconnectionDelay(et){var nt;return et===void 0?this._reconnectionDelay:(this._reconnectionDelay=et,(nt=this.backoff)===null||nt===void 0||nt.setMin(et),this)}randomizationFactor(et){var nt;return et===void 0?this._randomizationFactor:(this._randomizationFactor=et,(nt=this.backoff)===null||nt===void 0||nt.setJitter(et),this)}reconnectionDelayMax(et){var nt;return et===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=et,(nt=this.backoff)===null||nt===void 0||nt.setMax(et),this)}timeout(et){return arguments.length?(this._timeout=et,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(et){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const nt=this.engine,rt=this;this._readyState="opening",this.skipReconnect=!1;const it=on(nt,"open",function(){rt.onopen(),et&&et()}),ot=st=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",st),et?et(st):this.maybeReconnectOnOpen()},at=on(nt,"error",ot);if(this._timeout!==!1){const st=this._timeout,lt=this.setTimeoutFn(()=>{it(),ot(new Error("timeout")),nt.close()},st);this.opts.autoUnref&<.unref(),this.subs.push(()=>{this.clearTimeoutFn(lt)})}return this.subs.push(it),this.subs.push(at),this}connect(et){return this.open(et)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const et=this.engine;this.subs.push(on(et,"ping",this.onping.bind(this)),on(et,"data",this.ondata.bind(this)),on(et,"error",this.onerror.bind(this)),on(et,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(et){try{this.decoder.add(et)}catch(nt){this.onclose("parse error",nt)}}ondecoded(et){nextTick(()=>{this.emitReserved("packet",et)},this.setTimeoutFn)}onerror(et){this.emitReserved("error",et)}socket(et,nt){let rt=this.nsps[et];return rt?this._autoConnect&&!rt.active&&rt.connect():(rt=new Socket(this,et,nt),this.nsps[et]=rt),rt}_destroy(et){const nt=Object.keys(this.nsps);for(const rt of nt)if(this.nsps[rt].active)return;this._close()}_packet(et){const nt=this.encoder.encode(et);for(let rt=0;rtet()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(et,nt){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",et,nt),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const et=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const nt=this.backoff.duration();this._reconnecting=!0;const rt=this.setTimeoutFn(()=>{et.skipReconnect||(this.emitReserved("reconnect_attempt",et.backoff.attempts),!et.skipReconnect&&et.open(it=>{it?(et._reconnecting=!1,et.reconnect(),this.emitReserved("reconnect_error",it)):et.onreconnect()}))},nt);this.opts.autoUnref&&rt.unref(),this.subs.push(()=>{this.clearTimeoutFn(rt)})}}onreconnect(){const et=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",et)}}const cache={};function lookup(tt,et){typeof tt=="object"&&(et=tt,tt=void 0),et=et||{};const nt=url(tt,et.path||"/socket.io"),rt=nt.source,it=nt.id,ot=nt.path,at=cache[it]&&ot in cache[it].nsps,st=et.forceNew||et["force new connection"]||et.multiplex===!1||at;let lt;return st?lt=new Manager(rt,et):(cache[it]||(cache[it]=new Manager(rt,et)),lt=cache[it]),nt.query&&!et.query&&(et.query=nt.queryKey),lt.socket(nt.path,et)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const useSocket=()=>{const[tt,et]=reactExports.useState(null);return reactExports.useEffect(()=>{const nt=lookup(API_URL);return et(nt),()=>{nt.disconnect()}},[]),tt},ITEM_HEIGHT=48,ITEM_PADDING_TOP=8,MenuProps={PaperProps:{style:{maxHeight:ITEM_HEIGHT*4.5+ITEM_PADDING_TOP,width:250}}},names=["Beginner","Intermediate","Advanced","Expert"],AskQuestion=()=>{const tt=useDataStore(xt=>xt.data),[et,nt]=reactExports.useState(""),[rt,it]=reactExports.useState("Beginner"),ot=useAppStore(xt=>xt.currentSearch),at=reactExports.useRef(!1),st=useSocket(),[lt]=useUserStore(xt=>[xt.setBudget]),[ct,ut,ht,dt,pt]=useTeachStore(xt=>[xt.askedQuestions,xt.askedQuestionsAnswers,xt.setAskedQuestion,xt.setAskedQuestionAnswer,xt.hasQuestionInProgress]),mt=reactExports.useCallback(xt=>{dt(xt.answer),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Response is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[dt]);reactExports.useEffect(()=>{at.current||mt&&st&&(st.on("askquestionhook",mt),at.current=!0)},[mt,st]);const gt=async()=>{et&&(ht(et),nt(""));try{const xt=tt==null?void 0:tt.nodes.filter(Tt=>Tt.text),kt=xt==null?void 0:xt.slice(0,5),St=(kt!=null&&kt.length?kt.map(Tt=>Tt.text).join(" "):"").substring(0,2500).replace(/[?&=+/#]/g,Tt=>`\\${Tt}`);ot&&(await distExports$1.enable(),await postAskQuestion({expertise_level:rt,question_text:et,search_term:ot,transcripts:St}),await updateBudget(lt),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing response for you"}),{type:"success"}))}catch(xt){console.error(xt)}},yt=rt&&et.trim()&&!pt,bt=xt=>{it(xt.target.value)},vt=async xt=>{if(pt){xt.preventDefault();return}xt.keyCode===13&&xt.shiftKey===!1&&yt&&(xt.preventDefault(),gt())};return jsxRuntimeExports.jsxs(AskQuestionContainer,{children:[jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsx(Flex,{children:jsxRuntimeExports.jsxs(FormControl$1,{component:"div",children:[jsxRuntimeExports.jsx(StyledInput,{id:"select-label",size:"small",children:"Expertise level"}),jsxRuntimeExports.jsx(StyledSelect,{id:"demo-multiple-name",input:jsxRuntimeExports.jsx(OutlinedInput$1,{label:"Expertise level"}),labelId:"select-label",MenuProps,onChange:bt,size:"small",value:rt,children:names.map(xt=>jsxRuntimeExports.jsx(MenuItem$1,{component:"li",value:xt,children:xt},xt))})]})})}),jsxRuntimeExports.jsx(ResponsesWrapper,{children:ct==null?void 0:ct.map((xt,kt)=>jsxRuntimeExports.jsxs(Flex,{className:"response",py:12,children:[jsxRuntimeExports.jsx(Text$3,{kind:"medium",children:xt}),jsxRuntimeExports.jsx(Flex,{py:12,children:(ut==null?void 0:ut[kt])!==void 0?jsxRuntimeExports.jsx(Text$3,{color:"unreadMsgText",children:ut[kt]}):jsxRuntimeExports.jsxs(Flex,{align:"center",py:12,children:[jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(Text$3,{children:"Generating response"})})]})})]},xt))}),jsxRuntimeExports.jsxs(TextAreaWrapper,{onKeyDown:vt,py:12,tabIndex:-1,children:[jsxRuntimeExports.jsx(StyledTextarea,{disabled:pt,onChange:xt=>nt(xt.target.value),placeholder:"Enter your question",value:et}),jsxRuntimeExports.jsx(IconWrapper$1,{children:jsxRuntimeExports.jsx(MdSend,{color:yt?colors.white:colors.gray300,size:"18"})})]})]})},AskQuestionContainer=styled$4.div` margin-top: 20px; `,StyledTextarea=styled$4(TextareaAutosize)` background: ${colors.inputBg1}; @@ -7392,7 +7433,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho .response { border-bottom: 1px solid ${colors.divider2}; } -`,emptyValue={},HelperContext=reactExports.createContext(emptyValue),useHelper=()=>reactExports.useContext(HelperContext);function cc(tt){if(typeof tt=="string"||typeof tt=="number")return""+tt;let et="";if(Array.isArray(tt))for(let nt=0,rt;nt{const nt=createStore$3(tt),rt=(it,ot=et)=>useStoreWithEqualityFn(nt,it,ot);return Object.assign(rt,nt),rt},createWithEqualityFn=(tt,et)=>tt?createWithEqualityFnImpl(tt,et):createWithEqualityFnImpl;function shallow$1(tt,et){if(Object.is(tt,et))return!0;if(typeof tt!="object"||tt===null||typeof et!="object"||et===null)return!1;if(tt instanceof Map&&et instanceof Map){if(tt.size!==et.size)return!1;for(const[rt,it]of tt)if(!Object.is(it,et.get(rt)))return!1;return!0}if(tt instanceof Set&&et instanceof Set){if(tt.size!==et.size)return!1;for(const rt of tt)if(!et.has(rt))return!1;return!0}const nt=Object.keys(tt);if(nt.length!==Object.keys(et).length)return!1;for(let rt=0;rt=0&&(et=tt.slice(0,nt))!=="xmlns"&&(tt=tt.slice(nt+1)),namespaces.hasOwnProperty(et)?{space:namespaces[et],local:tt}:tt}function creatorInherit(tt){return function(){var et=this.ownerDocument,nt=this.namespaceURI;return nt===xhtml&&et.documentElement.namespaceURI===xhtml?et.createElement(tt):et.createElementNS(nt,tt)}}function creatorFixed(tt){return function(){return this.ownerDocument.createElementNS(tt.space,tt.local)}}function creator(tt){var et=namespace(tt);return(et.local?creatorFixed:creatorInherit)(et)}function none(){}function selector(tt){return tt==null?none:function(){return this.querySelector(tt)}}function selection_select(tt){typeof tt!="function"&&(tt=selector(tt));for(var et=this._groups,nt=et.length,rt=new Array(nt),it=0;it=xt&&(xt=vt+1);!(St=yt[xt])&&++xt=0;)(at=rt[it])&&(ot&&at.compareDocumentPosition(ot)^4&&ot.parentNode.insertBefore(at,ot),ot=at);return this}function selection_sort(tt){tt||(tt=ascending);function et(ht,dt){return ht&&dt?tt(ht.__data__,dt.__data__):!ht-!dt}for(var nt=this._groups,rt=nt.length,it=new Array(rt),ot=0;otet?1:tt>=et?0:NaN}function selection_call(){var tt=arguments[0];return arguments[0]=this,tt.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var tt=this._groups,et=0,nt=tt.length;et1?this.each((et==null?styleRemove$1:typeof et=="function"?styleFunction$1:styleConstant$1)(tt,et,nt??"")):styleValue(this.node(),tt)}function styleValue(tt,et){return tt.style.getPropertyValue(et)||defaultView(tt).getComputedStyle(tt,null).getPropertyValue(et)}function propertyRemove(tt){return function(){delete this[tt]}}function propertyConstant(tt,et){return function(){this[tt]=et}}function propertyFunction(tt,et){return function(){var nt=et.apply(this,arguments);nt==null?delete this[tt]:this[tt]=nt}}function selection_property(tt,et){return arguments.length>1?this.each((et==null?propertyRemove:typeof et=="function"?propertyFunction:propertyConstant)(tt,et)):this.node()[tt]}function classArray(tt){return tt.trim().split(/^|\s+/)}function classList(tt){return tt.classList||new ClassList(tt)}function ClassList(tt){this._node=tt,this._names=classArray(tt.getAttribute("class")||"")}ClassList.prototype={add:function(tt){var et=this._names.indexOf(tt);et<0&&(this._names.push(tt),this._node.setAttribute("class",this._names.join(" ")))},remove:function(tt){var et=this._names.indexOf(tt);et>=0&&(this._names.splice(et,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(tt){return this._names.indexOf(tt)>=0}};function classedAdd(tt,et){for(var nt=classList(tt),rt=-1,it=et.length;++rt=0&&(nt=et.slice(rt+1),et=et.slice(0,rt)),{type:et,name:nt}})}function onRemove(tt){return function(){var et=this.__on;if(et){for(var nt=0,rt=-1,it=et.length,ot;nt()=>tt;function DragEvent(tt,{sourceEvent:et,subject:nt,target:rt,identifier:it,active:ot,x:at,y:st,dx:lt,dy:ct,dispatch:ut}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},subject:{value:nt,enumerable:!0,configurable:!0},target:{value:rt,enumerable:!0,configurable:!0},identifier:{value:it,enumerable:!0,configurable:!0},active:{value:ot,enumerable:!0,configurable:!0},x:{value:at,enumerable:!0,configurable:!0},y:{value:st,enumerable:!0,configurable:!0},dx:{value:lt,enumerable:!0,configurable:!0},dy:{value:ct,enumerable:!0,configurable:!0},_:{value:ut}})}DragEvent.prototype.on=function(){var tt=this._.on.apply(this._,arguments);return tt===this._?this:tt};function defaultFilter$1(tt){return!tt.ctrlKey&&!tt.button}function defaultContainer(){return this.parentNode}function defaultSubject(tt,et){return et??{x:tt.x,y:tt.y}}function defaultTouchable$1(){return navigator.maxTouchPoints||"ontouchstart"in this}function drag(){var tt=defaultFilter$1,et=defaultContainer,nt=defaultSubject,rt=defaultTouchable$1,it={},ot=dispatch("start","drag","end"),at=0,st,lt,ct,ut,ht=0;function dt(kt){kt.on("mousedown.drag",pt).filter(rt).on("touchstart.drag",yt).on("touchmove.drag",bt,nonpassive).on("touchend.drag touchcancel.drag",vt).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function pt(kt,St){if(!(ut||!tt.call(this,kt,St))){var Tt=xt(this,et.call(this,kt,St),kt,St,"mouse");Tt&&(select(kt.view).on("mousemove.drag",mt,nonpassivecapture).on("mouseup.drag",gt,nonpassivecapture),dragDisable(kt.view),nopropagation$1(kt),ct=!1,st=kt.clientX,lt=kt.clientY,Tt("start",kt))}}function mt(kt){if(noevent$1(kt),!ct){var St=kt.clientX-st,Tt=kt.clientY-lt;ct=St*St+Tt*Tt>ht}it.mouse("drag",kt)}function gt(kt){select(kt.view).on("mousemove.drag mouseup.drag",null),yesdrag(kt.view,ct),noevent$1(kt),it.mouse("end",kt)}function yt(kt,St){if(tt.call(this,kt,St)){var Tt=kt.changedTouches,At=et.call(this,kt,St),Et=Tt.length,$t,Dt;for($t=0;$tCREATED)throw new Error("too late; already scheduled");return nt}function set(tt,et){var nt=get(tt,et);if(nt.state>STARTED)throw new Error("too late; already running");return nt}function get(tt,et){var nt=tt.__transition;if(!nt||!(nt=nt[et]))throw new Error("transition not found");return nt}function create(tt,et,nt){var rt=tt.__transition,it;rt[et]=nt,nt.timer=timer$1(ot,0,nt.time);function ot(ct){nt.state=SCHEDULED,nt.timer.restart(at,nt.delay,nt.time),nt.delay<=ct&&at(ct-nt.delay)}function at(ct){var ut,ht,dt,pt;if(nt.state!==SCHEDULED)return lt();for(ut in rt)if(pt=rt[ut],pt.name===nt.name){if(pt.state===STARTED)return timeout(at);pt.state===RUNNING?(pt.state=ENDED,pt.timer.stop(),pt.on.call("interrupt",tt,tt.__data__,pt.index,pt.group),delete rt[ut]):+utSTARTING&&rt.state=0&&(et=et.slice(0,nt)),!et||et==="start"})}function onFunction(tt,et,nt){var rt,it,ot=start(et)?init:set;return function(){var at=ot(this,tt),st=at.on;st!==rt&&(it=(rt=st).copy()).on(et,nt),at.on=it}}function transition_on(tt,et){var nt=this._id;return arguments.length<2?get(this.node(),nt).on.on(tt):this.each(onFunction(nt,tt,et))}function removeFunction(tt){return function(){var et=this.parentNode;for(var nt in this.__transition)if(+nt!==tt)return;et&&et.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(tt){var et=this._name,nt=this._id;typeof tt!="function"&&(tt=selector(tt));for(var rt=this._groups,it=rt.length,ot=new Array(it),at=0;at()=>tt;function ZoomEvent(tt,{sourceEvent:et,target:nt,transform:rt,dispatch:it}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},target:{value:nt,enumerable:!0,configurable:!0},transform:{value:rt,enumerable:!0,configurable:!0},_:{value:it}})}function Transform(tt,et,nt){this.k=tt,this.x=et,this.y=nt}Transform.prototype={constructor:Transform,scale:function(tt){return tt===1?this:new Transform(this.k*tt,this.x,this.y)},translate:function(tt,et){return tt===0&et===0?this:new Transform(this.k,this.x+this.k*tt,this.y+this.k*et)},apply:function(tt){return[tt[0]*this.k+this.x,tt[1]*this.k+this.y]},applyX:function(tt){return tt*this.k+this.x},applyY:function(tt){return tt*this.k+this.y},invert:function(tt){return[(tt[0]-this.x)/this.k,(tt[1]-this.y)/this.k]},invertX:function(tt){return(tt-this.x)/this.k},invertY:function(tt){return(tt-this.y)/this.k},rescaleX:function(tt){return tt.copy().domain(tt.range().map(this.invertX,this).map(tt.invert,tt))},rescaleY:function(tt){return tt.copy().domain(tt.range().map(this.invertY,this).map(tt.invert,tt))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity=new Transform(1,0,0);Transform.prototype;function nopropagation(tt){tt.stopImmediatePropagation()}function noevent(tt){tt.preventDefault(),tt.stopImmediatePropagation()}function defaultFilter(tt){return(!tt.ctrlKey||tt.type==="wheel")&&!tt.button}function defaultExtent(){var tt=this;return tt instanceof SVGElement?(tt=tt.ownerSVGElement||tt,tt.hasAttribute("viewBox")?(tt=tt.viewBox.baseVal,[[tt.x,tt.y],[tt.x+tt.width,tt.y+tt.height]]):[[0,0],[tt.width.baseVal.value,tt.height.baseVal.value]]):[[0,0],[tt.clientWidth,tt.clientHeight]]}function defaultTransform(){return this.__zoom||identity}function defaultWheelDelta(tt){return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*(tt.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(tt,et,nt){var rt=tt.invertX(et[0][0])-nt[0][0],it=tt.invertX(et[1][0])-nt[1][0],ot=tt.invertY(et[0][1])-nt[0][1],at=tt.invertY(et[1][1])-nt[1][1];return tt.translate(it>rt?(rt+it)/2:Math.min(0,rt)||Math.max(0,it),at>ot?(ot+at)/2:Math.min(0,ot)||Math.max(0,at))}function zoom(){var tt=defaultFilter,et=defaultExtent,nt=defaultConstrain,rt=defaultWheelDelta,it=defaultTouchable,ot=[0,1/0],at=[[-1/0,-1/0],[1/0,1/0]],st=250,lt=interpolateZoom,ct=dispatch("start","zoom","end"),ut,ht,dt,pt=500,mt=150,gt=0,yt=10;function bt(wt){wt.property("__zoom",defaultTransform).on("wheel.zoom",Et,{passive:!1}).on("mousedown.zoom",$t).on("dblclick.zoom",Dt).filter(it).on("touchstart.zoom",jt).on("touchmove.zoom",Pt).on("touchend.zoom touchcancel.zoom",Ct).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}bt.transform=function(wt,It,Ot,Wt){var zt=wt.selection?wt.selection():wt;zt.property("__zoom",defaultTransform),wt!==zt?St(wt,It,Ot,Wt):zt.interrupt().each(function(){Tt(this,arguments).event(Wt).start().zoom(null,typeof It=="function"?It.apply(this,arguments):It).end()})},bt.scaleBy=function(wt,It,Ot,Wt){bt.scaleTo(wt,function(){var zt=this.__zoom.k,Ft=typeof It=="function"?It.apply(this,arguments):It;return zt*Ft},Ot,Wt)},bt.scaleTo=function(wt,It,Ot,Wt){bt.transform(wt,function(){var zt=et.apply(this,arguments),Ft=this.__zoom,Nt=Ot==null?kt(zt):typeof Ot=="function"?Ot.apply(this,arguments):Ot,Ut=Ft.invert(Nt),Mt=typeof It=="function"?It.apply(this,arguments):It;return nt(xt(vt(Ft,Mt),Nt,Ut),zt,at)},Ot,Wt)},bt.translateBy=function(wt,It,Ot,Wt){bt.transform(wt,function(){return nt(this.__zoom.translate(typeof It=="function"?It.apply(this,arguments):It,typeof Ot=="function"?Ot.apply(this,arguments):Ot),et.apply(this,arguments),at)},null,Wt)},bt.translateTo=function(wt,It,Ot,Wt,zt){bt.transform(wt,function(){var Ft=et.apply(this,arguments),Nt=this.__zoom,Ut=Wt==null?kt(Ft):typeof Wt=="function"?Wt.apply(this,arguments):Wt;return nt(identity.translate(Ut[0],Ut[1]).scale(Nt.k).translate(typeof It=="function"?-It.apply(this,arguments):-It,typeof Ot=="function"?-Ot.apply(this,arguments):-Ot),Ft,at)},Wt,zt)};function vt(wt,It){return It=Math.max(ot[0],Math.min(ot[1],It)),It===wt.k?wt:new Transform(It,wt.x,wt.y)}function xt(wt,It,Ot){var Wt=It[0]-Ot[0]*wt.k,zt=It[1]-Ot[1]*wt.k;return Wt===wt.x&&zt===wt.y?wt:new Transform(wt.k,Wt,zt)}function kt(wt){return[(+wt[0][0]+ +wt[1][0])/2,(+wt[0][1]+ +wt[1][1])/2]}function St(wt,It,Ot,Wt){wt.on("start.zoom",function(){Tt(this,arguments).event(Wt).start()}).on("interrupt.zoom end.zoom",function(){Tt(this,arguments).event(Wt).end()}).tween("zoom",function(){var zt=this,Ft=arguments,Nt=Tt(zt,Ft).event(Wt),Ut=et.apply(zt,Ft),Mt=Ot==null?kt(Ut):typeof Ot=="function"?Ot.apply(zt,Ft):Ot,Ht=Math.max(Ut[1][0]-Ut[0][0],Ut[1][1]-Ut[0][1]),en=zt.__zoom,sn=typeof It=="function"?It.apply(zt,Ft):It,Kt=lt(en.invert(Mt).concat(Ht/en.k),sn.invert(Mt).concat(Ht/sn.k));return function(rn){if(rn===1)rn=sn;else{var nn=Kt(rn),hn=Ht/nn[2];rn=new Transform(hn,Mt[0]-nn[0]*hn,Mt[1]-nn[1]*hn)}Nt.zoom(null,rn)}})}function Tt(wt,It,Ot){return!Ot&&wt.__zooming||new At(wt,It)}function At(wt,It){this.that=wt,this.args=It,this.active=0,this.sourceEvent=null,this.extent=et.apply(wt,It),this.taps=0}At.prototype={event:function(wt){return wt&&(this.sourceEvent=wt),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(wt,It){return this.mouse&&wt!=="mouse"&&(this.mouse[1]=It.invert(this.mouse[0])),this.touch0&&wt!=="touch"&&(this.touch0[1]=It.invert(this.touch0[0])),this.touch1&&wt!=="touch"&&(this.touch1[1]=It.invert(this.touch1[0])),this.that.__zoom=It,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(wt){var It=select(this.that).datum();ct.call(wt,this.that,new ZoomEvent(wt,{sourceEvent:this.sourceEvent,target:bt,type:wt,transform:this.that.__zoom,dispatch:ct}),It)}};function Et(wt,...It){if(!tt.apply(this,arguments))return;var Ot=Tt(this,It).event(wt),Wt=this.__zoom,zt=Math.max(ot[0],Math.min(ot[1],Wt.k*Math.pow(2,rt.apply(this,arguments)))),Ft=pointer(wt);if(Ot.wheel)(Ot.mouse[0][0]!==Ft[0]||Ot.mouse[0][1]!==Ft[1])&&(Ot.mouse[1]=Wt.invert(Ot.mouse[0]=Ft)),clearTimeout(Ot.wheel);else{if(Wt.k===zt)return;Ot.mouse=[Ft,Wt.invert(Ft)],interrupt(this),Ot.start()}noevent(wt),Ot.wheel=setTimeout(Nt,mt),Ot.zoom("mouse",nt(xt(vt(Wt,zt),Ot.mouse[0],Ot.mouse[1]),Ot.extent,at));function Nt(){Ot.wheel=null,Ot.end()}}function $t(wt,...It){if(dt||!tt.apply(this,arguments))return;var Ot=wt.currentTarget,Wt=Tt(this,It,!0).event(wt),zt=select(wt.view).on("mousemove.zoom",Mt,!0).on("mouseup.zoom",Ht,!0),Ft=pointer(wt,Ot),Nt=wt.clientX,Ut=wt.clientY;dragDisable(wt.view),nopropagation(wt),Wt.mouse=[Ft,this.__zoom.invert(Ft)],interrupt(this),Wt.start();function Mt(en){if(noevent(en),!Wt.moved){var sn=en.clientX-Nt,Kt=en.clientY-Ut;Wt.moved=sn*sn+Kt*Kt>gt}Wt.event(en).zoom("mouse",nt(xt(Wt.that.__zoom,Wt.mouse[0]=pointer(en,Ot),Wt.mouse[1]),Wt.extent,at))}function Ht(en){zt.on("mousemove.zoom mouseup.zoom",null),yesdrag(en.view,Wt.moved),noevent(en),Wt.event(en).end()}}function Dt(wt,...It){if(tt.apply(this,arguments)){var Ot=this.__zoom,Wt=pointer(wt.changedTouches?wt.changedTouches[0]:wt,this),zt=Ot.invert(Wt),Ft=Ot.k*(wt.shiftKey?.5:2),Nt=nt(xt(vt(Ot,Ft),Wt,zt),et.apply(this,It),at);noevent(wt),st>0?select(this).transition().duration(st).call(St,Nt,Wt,wt):select(this).call(bt.transform,Nt,Wt,wt)}}function jt(wt,...It){if(tt.apply(this,arguments)){var Ot=wt.touches,Wt=Ot.length,zt=Tt(this,It,wt.changedTouches.length===Wt).event(wt),Ft,Nt,Ut,Mt;for(nopropagation(wt),Nt=0;Nt"[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:tt=>`Node type "${tt}" 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:tt=>`The old edge with id=${tt} does not exist.`,error009:tt=>`Marker type "${tt}" doesn't exist.`,error008:(tt,et)=>`Couldn't create edge for ${tt?"target":"source"} handle id: "${tt?et.targetHandle:et.sourceHandle}", edge id: ${et.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:tt=>`Edge type "${tt}" not found. Using fallback type "default".`,error012:tt=>`Node with id "${tt}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},zustandErrorMessage=errorMessages.error001();function useStore(tt,et){const nt=reactExports.useContext(StoreContext);if(nt===null)throw new Error(zustandErrorMessage);return useStoreWithEqualityFn(nt,tt,et)}const useStoreApi=()=>{const tt=reactExports.useContext(StoreContext);if(tt===null)throw new Error(zustandErrorMessage);return reactExports.useMemo(()=>({getState:tt.getState,setState:tt.setState,subscribe:tt.subscribe,destroy:tt.destroy}),[tt])},selector$g=tt=>tt.userSelectionActive?"none":"all";function Panel({position:tt,children:et,className:nt,style:rt,...it}){const ot=useStore(selector$g),at=`${tt}`.split("-");return React$1.createElement("div",{className:cc(["react-flow__panel",nt,...at]),style:{...rt,pointerEvents:ot},...it},et)}function Attribution({proOptions:tt,position:et="bottom-right"}){return tt!=null&&tt.hideAttribution?null:React$1.createElement(Panel,{position:et,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev"},React$1.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const EdgeText=({x:tt,y:et,label:nt,labelStyle:rt={},labelShowBg:it=!0,labelBgStyle:ot={},labelBgPadding:at=[2,4],labelBgBorderRadius:st=2,children:lt,className:ct,...ut})=>{const ht=reactExports.useRef(null),[dt,pt]=reactExports.useState({x:0,y:0,width:0,height:0}),mt=cc(["react-flow__edge-textwrapper",ct]);return reactExports.useEffect(()=>{if(ht.current){const gt=ht.current.getBBox();pt({x:gt.x,y:gt.y,width:gt.width,height:gt.height})}},[nt]),typeof nt>"u"||!nt?null:React$1.createElement("g",{transform:`translate(${tt-dt.width/2} ${et-dt.height/2})`,className:mt,visibility:dt.width?"visible":"hidden",...ut},it&&React$1.createElement("rect",{width:dt.width+2*at[0],x:-at[0],y:-at[1],height:dt.height+2*at[1],className:"react-flow__edge-textbg",style:ot,rx:st,ry:st}),React$1.createElement("text",{className:"react-flow__edge-text",y:dt.height/2,dy:"0.3em",ref:ht,style:rt},nt),lt)};var EdgeText$1=reactExports.memo(EdgeText);const getDimensions=tt=>({width:tt.offsetWidth,height:tt.offsetHeight}),clamp=(tt,et=0,nt=1)=>Math.min(Math.max(tt,et),nt),clampPosition=(tt={x:0,y:0},et)=>({x:clamp(tt.x,et[0][0],et[1][0]),y:clamp(tt.y,et[0][1],et[1][1])}),calcAutoPanVelocity=(tt,et,nt)=>ttnt?-clamp(Math.abs(tt-nt),1,50)/50:0,calcAutoPan=(tt,et)=>{const nt=calcAutoPanVelocity(tt.x,35,et.width-35)*20,rt=calcAutoPanVelocity(tt.y,35,et.height-35)*20;return[nt,rt]},getHostForElement=tt=>{var et;return((et=tt.getRootNode)==null?void 0:et.call(tt))||(window==null?void 0:window.document)},getBoundsOfBoxes=(tt,et)=>({x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x2,et.x2),y2:Math.max(tt.y2,et.y2)}),rectToBox=({x:tt,y:et,width:nt,height:rt})=>({x:tt,y:et,x2:tt+nt,y2:et+rt}),boxToRect=({x:tt,y:et,x2:nt,y2:rt})=>({x:tt,y:et,width:nt-tt,height:rt-et}),nodeToRect=tt=>({...tt.positionAbsolute||{x:0,y:0},width:tt.width||0,height:tt.height||0}),getOverlappingArea=(tt,et)=>{const nt=Math.max(0,Math.min(tt.x+tt.width,et.x+et.width)-Math.max(tt.x,et.x)),rt=Math.max(0,Math.min(tt.y+tt.height,et.y+et.height)-Math.max(tt.y,et.y));return Math.ceil(nt*rt)},isRectObject=tt=>isNumeric(tt.width)&&isNumeric(tt.height)&&isNumeric(tt.x)&&isNumeric(tt.y),isNumeric=tt=>!isNaN(tt)&&isFinite(tt),internalsSymbol=Symbol.for("internals"),elementSelectionKeys=["Enter"," ","Escape"],devWarn=(tt,et)=>{},isReactKeyboardEvent=tt=>"nativeEvent"in tt;function isInputDOMNode(tt){var it,ot;const et=isReactKeyboardEvent(tt)?tt.nativeEvent:tt,nt=((ot=(it=et.composedPath)==null?void 0:it.call(et))==null?void 0:ot[0])||tt.target;return["INPUT","SELECT","TEXTAREA"].includes(nt==null?void 0:nt.nodeName)||(nt==null?void 0:nt.hasAttribute("contenteditable"))||!!(nt!=null&&nt.closest(".nokey"))}const isMouseEvent=tt=>"clientX"in tt,getEventPosition=(tt,et)=>{var ot,at;const nt=isMouseEvent(tt),rt=nt?tt.clientX:(ot=tt.touches)==null?void 0:ot[0].clientX,it=nt?tt.clientY:(at=tt.touches)==null?void 0:at[0].clientY;return{x:rt-((et==null?void 0:et.left)??0),y:it-((et==null?void 0:et.top)??0)}},isMacOs=()=>{var tt;return typeof navigator<"u"&&((tt=navigator==null?void 0:navigator.userAgent)==null?void 0:tt.indexOf("Mac"))>=0},BaseEdge=({id:tt,path:et,labelX:nt,labelY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt=20})=>React$1.createElement(React$1.Fragment,null,React$1.createElement("path",{id:tt,style:ut,d:et,fill:"none",className:"react-flow__edge-path",markerEnd:ht,markerStart:dt}),pt&&React$1.createElement("path",{d:et,fill:"none",strokeOpacity:0,strokeWidth:pt,className:"react-flow__edge-interaction"}),it&&isNumeric(nt)&&isNumeric(rt)?React$1.createElement(EdgeText$1,{x:nt,y:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct}):null);BaseEdge.displayName="BaseEdge";function getMouseHandler$1(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().edges.find(ot=>ot.id===tt);it&&nt(rt,{...it})}}function getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const it=Math.abs(nt-tt)/2,ot=nt{const[yt,bt,vt]=getSimpleBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot});return React$1.createElement(BaseEdge,{path:yt,labelX:bt,labelY:vt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:gt})});SimpleBezierEdge.displayName="SimpleBezierEdge";const handleDirections={[Position.Left]:{x:-1,y:0},[Position.Right]:{x:1,y:0},[Position.Top]:{x:0,y:-1},[Position.Bottom]:{x:0,y:1}},getDirection=({source:tt,sourcePosition:et=Position.Bottom,target:nt})=>et===Position.Left||et===Position.Right?tt.xMath.sqrt(Math.pow(et.x-tt.x,2)+Math.pow(et.y-tt.y,2));function getPoints({source:tt,sourcePosition:et=Position.Bottom,target:nt,targetPosition:rt=Position.Top,center:it,offset:ot}){const at=handleDirections[et],st=handleDirections[rt],lt={x:tt.x+at.x*ot,y:tt.y+at.y*ot},ct={x:nt.x+st.x*ot,y:nt.y+st.y*ot},ut=getDirection({source:lt,sourcePosition:et,target:ct}),ht=ut.x!==0?"x":"y",dt=ut[ht];let pt=[],mt,gt;const yt={x:0,y:0},bt={x:0,y:0},[vt,xt,kt,St]=getEdgeCenter({sourceX:tt.x,sourceY:tt.y,targetX:nt.x,targetY:nt.y});if(at[ht]*st[ht]===-1){mt=it.x||vt,gt=it.y||xt;const At=[{x:mt,y:lt.y},{x:mt,y:ct.y}],Et=[{x:lt.x,y:gt},{x:ct.x,y:gt}];at[ht]===dt?pt=ht==="x"?At:Et:pt=ht==="x"?Et:At}else{const At=[{x:lt.x,y:ct.y}],Et=[{x:ct.x,y:lt.y}];if(ht==="x"?pt=at.x===dt?Et:At:pt=at.y===dt?At:Et,et===rt){const Ct=Math.abs(tt[ht]-nt[ht]);if(Ct<=ot){const wt=Math.min(ot-1,ot-Ct);at[ht]===dt?yt[ht]=(lt[ht]>tt[ht]?-1:1)*wt:bt[ht]=(ct[ht]>nt[ht]?-1:1)*wt}}if(et!==rt){const Ct=ht==="x"?"y":"x",wt=at[ht]===st[Ct],It=lt[Ct]>ct[Ct],Ot=lt[Ct]=Pt?(mt=($t.x+Dt.x)/2,gt=pt[0].y):(mt=pt[0].x,gt=($t.y+Dt.y)/2)}return[[tt,{x:lt.x+yt.x,y:lt.y+yt.y},...pt,{x:ct.x+bt.x,y:ct.y+bt.y},nt],mt,gt,kt,St]}function getBend(tt,et,nt,rt){const it=Math.min(distance(tt,et)/2,distance(et,nt)/2,rt),{x:ot,y:at}=et;if(tt.x===ot&&ot===nt.x||tt.y===at&&at===nt.y)return`L${ot} ${at}`;if(tt.y===at){const ct=tt.x{let xt="";return vt>0&&vt{const[bt,vt,xt]=getSmoothStepPath({sourceX:tt,sourceY:et,sourcePosition:ht,targetX:nt,targetY:rt,targetPosition:dt,borderRadius:gt==null?void 0:gt.borderRadius,offset:gt==null?void 0:gt.offset});return React$1.createElement(BaseEdge,{path:bt,labelX:vt,labelY:xt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:pt,markerStart:mt,interactionWidth:yt})});SmoothStepEdge.displayName="SmoothStepEdge";const StepEdge=reactExports.memo(tt=>{var et;return React$1.createElement(SmoothStepEdge,{...tt,pathOptions:reactExports.useMemo(()=>{var nt;return{borderRadius:0,offset:(nt=tt.pathOptions)==null?void 0:nt.offset}},[(et=tt.pathOptions)==null?void 0:et.offset])})});StepEdge.displayName="StepEdge";function getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const[it,ot,at,st]=getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return[`M ${tt},${et}L ${nt},${rt}`,it,ot,at,st]}const StraightEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})=>{const[mt,gt,yt]=getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return React$1.createElement(BaseEdge,{path:mt,labelX:gt,labelY:yt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})});StraightEdge.displayName="StraightEdge";function calculateControlOffset(tt,et){return tt>=0?.5*tt:et*25*Math.sqrt(-tt)}function getControlWithCurvature({pos:tt,x1:et,y1:nt,x2:rt,y2:it,c:ot}){switch(tt){case Position.Left:return[et-calculateControlOffset(et-rt,ot),nt];case Position.Right:return[et+calculateControlOffset(rt-et,ot),nt];case Position.Top:return[et,nt-calculateControlOffset(nt-it,ot)];case Position.Bottom:return[et,nt+calculateControlOffset(it-nt,ot)]}}function getBezierPath({sourceX:tt,sourceY:et,sourcePosition:nt=Position.Bottom,targetX:rt,targetY:it,targetPosition:ot=Position.Top,curvature:at=.25}){const[st,lt]=getControlWithCurvature({pos:nt,x1:tt,y1:et,x2:rt,y2:it,c:at}),[ct,ut]=getControlWithCurvature({pos:ot,x1:rt,y1:it,x2:tt,y2:et,c:at}),[ht,dt,pt,mt]=getBezierEdgeCenter({sourceX:tt,sourceY:et,targetX:rt,targetY:it,sourceControlX:st,sourceControlY:lt,targetControlX:ct,targetControlY:ut});return[`M${tt},${et} C${st},${lt} ${ct},${ut} ${rt},${it}`,ht,dt,pt,mt]}const BezierEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,sourcePosition:it=Position.Bottom,targetPosition:ot=Position.Top,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,pathOptions:gt,interactionWidth:yt})=>{const[bt,vt,xt]=getBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot,curvature:gt==null?void 0:gt.curvature});return React$1.createElement(BaseEdge,{path:bt,labelX:vt,labelY:xt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:yt})});BezierEdge.displayName="BezierEdge";const NodeIdContext=reactExports.createContext(null),Provider=NodeIdContext.Provider;NodeIdContext.Consumer;const useNodeId=()=>reactExports.useContext(NodeIdContext),isEdge=tt=>"id"in tt&&"source"in tt&&"target"in tt,getEdgeId=({source:tt,sourceHandle:et,target:nt,targetHandle:rt})=>`reactflow__edge-${tt}${et||""}-${nt}${rt||""}`,getMarkerId=(tt,et)=>typeof tt>"u"?"":typeof tt=="string"?tt:`${et?`${et}__`:""}${Object.keys(tt).sort().map(rt=>`${rt}=${tt[rt]}`).join("&")}`,connectionExists=(tt,et)=>et.some(nt=>nt.source===tt.source&&nt.target===tt.target&&(nt.sourceHandle===tt.sourceHandle||!nt.sourceHandle&&!tt.sourceHandle)&&(nt.targetHandle===tt.targetHandle||!nt.targetHandle&&!tt.targetHandle)),addEdge=(tt,et)=>{if(!tt.source||!tt.target)return et;let nt;return isEdge(tt)?nt={...tt}:nt={...tt,id:getEdgeId(tt)},connectionExists(nt,et)?et:et.concat(nt)},pointToRendererPoint=({x:tt,y:et},[nt,rt,it],ot,[at,st])=>{const lt={x:(tt-nt)/it,y:(et-rt)/it};return ot?{x:at*Math.round(lt.x/at),y:st*Math.round(lt.y/st)}:lt},rendererPointToPoint=({x:tt,y:et},[nt,rt,it])=>({x:tt*it+nt,y:et*it+rt}),getNodePositionWithOrigin=(tt,et=[0,0])=>{if(!tt)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const nt=(tt.width??0)*et[0],rt=(tt.height??0)*et[1],it={x:tt.position.x-nt,y:tt.position.y-rt};return{...it,positionAbsolute:tt.positionAbsolute?{x:tt.positionAbsolute.x-nt,y:tt.positionAbsolute.y-rt}:it}},getRectOfNodes=(tt,et=[0,0])=>{if(tt.length===0)return{x:0,y:0,width:0,height:0};const nt=tt.reduce((rt,it)=>{const{x:ot,y:at}=getNodePositionWithOrigin(it,et).positionAbsolute;return getBoundsOfBoxes(rt,rectToBox({x:ot,y:at,width:it.width||0,height:it.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return boxToRect(nt)},getNodesInside=(tt,et,[nt,rt,it]=[0,0,1],ot=!1,at=!1,st=[0,0])=>{const lt={x:(et.x-nt)/it,y:(et.y-rt)/it,width:et.width/it,height:et.height/it},ct=[];return tt.forEach(ut=>{const{width:ht,height:dt,selectable:pt=!0,hidden:mt=!1}=ut;if(at&&!pt||mt)return!1;const{positionAbsolute:gt}=getNodePositionWithOrigin(ut,st),yt={x:gt.x,y:gt.y,width:ht||0,height:dt||0},bt=getOverlappingArea(lt,yt),vt=typeof ht>"u"||typeof dt>"u"||ht===null||dt===null,xt=ot&&bt>0,kt=(ht||0)*(dt||0);(vt||xt||bt>=kt||ut.dragging)&&ct.push(ut)}),ct},getConnectedEdges=(tt,et)=>{const nt=tt.map(rt=>rt.id);return et.filter(rt=>nt.includes(rt.source)||nt.includes(rt.target))},getTransformForBounds=(tt,et,nt,rt,it,ot=.1)=>{const at=et/(tt.width*(1+ot)),st=nt/(tt.height*(1+ot)),lt=Math.min(at,st),ct=clamp(lt,rt,it),ut=tt.x+tt.width/2,ht=tt.y+tt.height/2,dt=et/2-ut*ct,pt=nt/2-ht*ct;return[dt,pt,ct]},getD3Transition=(tt,et=0)=>tt.transition().duration(et);function getHandles(tt,et,nt,rt){return(et[nt]||[]).reduce((it,ot)=>{var at,st;return`${tt.id}-${ot.id}-${nt}`!==rt&&it.push({id:ot.id||null,type:nt,nodeId:tt.id,x:(((at=tt.positionAbsolute)==null?void 0:at.x)??0)+ot.x+ot.width/2,y:(((st=tt.positionAbsolute)==null?void 0:st.y)??0)+ot.y+ot.height/2}),it},[])}function getClosestHandle(tt,et,nt,rt,it,ot){const{x:at,y:st}=getEventPosition(tt),ct=et.elementsFromPoint(at,st).find(mt=>mt.classList.contains("react-flow__handle"));if(ct){const mt=ct.getAttribute("data-nodeid");if(mt){const gt=getHandleType(void 0,ct),yt=ct.getAttribute("data-handleid"),bt=ot({nodeId:mt,id:yt,type:gt});if(bt)return{handle:{id:yt,type:gt,nodeId:mt,x:nt.x,y:nt.y},validHandleResult:bt}}}let ut=[],ht=1/0;if(it.forEach(mt=>{const gt=Math.sqrt((mt.x-nt.x)**2+(mt.y-nt.y)**2);if(gt<=rt){const yt=ot(mt);gt<=ht&&(gtmt.isValid),pt=ut.some(({handle:mt})=>mt.type==="target");return ut.find(({handle:mt,validHandleResult:gt})=>pt?mt.type==="target":dt?gt.isValid:!0)||ut[0]}const nullConnection={source:null,target:null,sourceHandle:null,targetHandle:null},defaultResult=()=>({handleDomNode:null,isValid:!1,connection:nullConnection,endHandle:null});function isValidHandle(tt,et,nt,rt,it,ot,at){const st=it==="target",lt=at.querySelector(`.react-flow__handle[data-id="${tt==null?void 0:tt.nodeId}-${tt==null?void 0:tt.id}-${tt==null?void 0:tt.type}"]`),ct={...defaultResult(),handleDomNode:lt};if(lt){const ut=getHandleType(void 0,lt),ht=lt.getAttribute("data-nodeid"),dt=lt.getAttribute("data-handleid"),pt=lt.classList.contains("connectable"),mt=lt.classList.contains("connectableend"),gt={source:st?ht:nt,sourceHandle:st?dt:rt,target:st?nt:ht,targetHandle:st?rt:dt};ct.connection=gt,pt&&mt&&(et===ConnectionMode.Strict?st&&ut==="source"||!st&&ut==="target":ht!==nt||dt!==rt)&&(ct.endHandle={nodeId:ht,handleId:dt,type:ut},ct.isValid=ot(gt))}return ct}function getHandleLookup({nodes:tt,nodeId:et,handleId:nt,handleType:rt}){return tt.reduce((it,ot)=>{if(ot[internalsSymbol]){const{handleBounds:at}=ot[internalsSymbol];let st=[],lt=[];at&&(st=getHandles(ot,at,"source",`${et}-${nt}-${rt}`),lt=getHandles(ot,at,"target",`${et}-${nt}-${rt}`)),it.push(...st,...lt)}return it},[])}function getHandleType(tt,et){return tt||(et!=null&&et.classList.contains("target")?"target":et!=null&&et.classList.contains("source")?"source":null)}function resetRecentHandle(tt){tt==null||tt.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function getConnectionStatus(tt,et){let nt=null;return et?nt="valid":tt&&!et&&(nt="invalid"),nt}function handlePointerDown({event:tt,handleId:et,nodeId:nt,onConnect:rt,isTarget:it,getState:ot,setState:at,isValidConnection:st,edgeUpdaterType:lt,onEdgeUpdateEnd:ct}){const ut=getHostForElement(tt.target),{connectionMode:ht,domNode:dt,autoPanOnConnect:pt,connectionRadius:mt,onConnectStart:gt,panBy:yt,getNodes:bt,cancelConnection:vt}=ot();let xt=0,kt;const{x:St,y:Tt}=getEventPosition(tt),At=ut==null?void 0:ut.elementFromPoint(St,Tt),Et=getHandleType(lt,At),$t=dt==null?void 0:dt.getBoundingClientRect();if(!$t||!Et)return;let Dt,jt=getEventPosition(tt,$t),Pt=!1,Ct=null,wt=!1,It=null;const Ot=getHandleLookup({nodes:bt(),nodeId:nt,handleId:et,handleType:Et}),Wt=()=>{if(!pt)return;const[Nt,Ut]=calcAutoPan(jt,$t);yt({x:Nt,y:Ut}),xt=requestAnimationFrame(Wt)};at({connectionPosition:jt,connectionStatus:null,connectionNodeId:nt,connectionHandleId:et,connectionHandleType:Et,connectionStartHandle:{nodeId:nt,handleId:et,type:Et},connectionEndHandle:null}),gt==null||gt(tt,{nodeId:nt,handleId:et,handleType:Et});function zt(Nt){const{transform:Ut}=ot();jt=getEventPosition(Nt,$t);const{handle:Mt,validHandleResult:Ht}=getClosestHandle(Nt,ut,pointToRendererPoint(jt,Ut,!1,[1,1]),mt,Ot,en=>isValidHandle(en,ht,nt,et,it?"target":"source",st,ut));if(kt=Mt,Pt||(Wt(),Pt=!0),It=Ht.handleDomNode,Ct=Ht.connection,wt=Ht.isValid,at({connectionPosition:kt&&wt?rendererPointToPoint({x:kt.x,y:kt.y},Ut):jt,connectionStatus:getConnectionStatus(!!kt,wt),connectionEndHandle:Ht.endHandle}),!kt&&!wt&&!It)return resetRecentHandle(Dt);Ct.source!==Ct.target&&It&&(resetRecentHandle(Dt),Dt=It,It.classList.add("connecting","react-flow__handle-connecting"),It.classList.toggle("valid",wt),It.classList.toggle("react-flow__handle-valid",wt))}function Ft(Nt){var Ut,Mt;(kt||It)&&Ct&&wt&&(rt==null||rt(Ct)),(Mt=(Ut=ot()).onConnectEnd)==null||Mt.call(Ut,Nt),lt&&(ct==null||ct(Nt)),resetRecentHandle(Dt),vt(),cancelAnimationFrame(xt),Pt=!1,wt=!1,Ct=null,It=null,ut.removeEventListener("mousemove",zt),ut.removeEventListener("mouseup",Ft),ut.removeEventListener("touchmove",zt),ut.removeEventListener("touchend",Ft)}ut.addEventListener("mousemove",zt),ut.addEventListener("mouseup",Ft),ut.addEventListener("touchmove",zt),ut.addEventListener("touchend",Ft)}const alwaysValid=()=>!0,selector$f=tt=>({connectionStartHandle:tt.connectionStartHandle,connectOnClick:tt.connectOnClick,noPanClassName:tt.noPanClassName}),connectingSelector=(tt,et,nt)=>rt=>{const{connectionStartHandle:it,connectionEndHandle:ot,connectionClickStartHandle:at}=rt;return{connecting:(it==null?void 0:it.nodeId)===tt&&(it==null?void 0:it.handleId)===et&&(it==null?void 0:it.type)===nt||(ot==null?void 0:ot.nodeId)===tt&&(ot==null?void 0:ot.handleId)===et&&(ot==null?void 0:ot.type)===nt,clickConnecting:(at==null?void 0:at.nodeId)===tt&&(at==null?void 0:at.handleId)===et&&(at==null?void 0:at.type)===nt}},Handle=reactExports.forwardRef(({type:tt="source",position:et=Position.Top,isValidConnection:nt,isConnectable:rt=!0,isConnectableStart:it=!0,isConnectableEnd:ot=!0,id:at,onConnect:st,children:lt,className:ct,onMouseDown:ut,onTouchStart:ht,...dt},pt)=>{var $t,Dt;const mt=at||null,gt=tt==="target",yt=useStoreApi(),bt=useNodeId(),{connectOnClick:vt,noPanClassName:xt}=useStore(selector$f,shallow$1),{connecting:kt,clickConnecting:St}=useStore(connectingSelector(bt,mt,tt),shallow$1);bt||(Dt=($t=yt.getState()).onError)==null||Dt.call($t,"010",errorMessages.error010());const Tt=jt=>{const{defaultEdgeOptions:Pt,onConnect:Ct,hasDefaultEdges:wt}=yt.getState(),It={...Pt,...jt};if(wt){const{edges:Ot,setEdges:Wt}=yt.getState();Wt(addEdge(It,Ot))}Ct==null||Ct(It),st==null||st(It)},At=jt=>{if(!bt)return;const Pt=isMouseEvent(jt);it&&(Pt&&jt.button===0||!Pt)&&handlePointerDown({event:jt,handleId:mt,nodeId:bt,onConnect:Tt,isTarget:gt,getState:yt.getState,setState:yt.setState,isValidConnection:nt||yt.getState().isValidConnection||alwaysValid}),Pt?ut==null||ut(jt):ht==null||ht(jt)},Et=jt=>{const{onClickConnectStart:Pt,onClickConnectEnd:Ct,connectionClickStartHandle:wt,connectionMode:It,isValidConnection:Ot}=yt.getState();if(!bt||!wt&&!it)return;if(!wt){Pt==null||Pt(jt,{nodeId:bt,handleId:mt,handleType:tt}),yt.setState({connectionClickStartHandle:{nodeId:bt,type:tt,handleId:mt}});return}const Wt=getHostForElement(jt.target),zt=nt||Ot||alwaysValid,{connection:Ft,isValid:Nt}=isValidHandle({nodeId:bt,id:mt,type:tt},It,wt.nodeId,wt.handleId||null,wt.type,zt,Wt);Nt&&Tt(Ft),Ct==null||Ct(jt),yt.setState({connectionClickStartHandle:null})};return React$1.createElement("div",{"data-handleid":mt,"data-nodeid":bt,"data-handlepos":et,"data-id":`${bt}-${mt}-${tt}`,className:cc(["react-flow__handle",`react-flow__handle-${et}`,"nodrag",xt,ct,{source:!gt,target:gt,connectable:rt,connectablestart:it,connectableend:ot,connecting:St,connectionindicator:rt&&(it&&!kt||ot&&kt)}]),onMouseDown:At,onTouchStart:At,onClick:vt?Et:void 0,ref:pt,...dt},lt)});Handle.displayName="Handle";var Handle$1=reactExports.memo(Handle);const DefaultNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top,sourcePosition:rt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:rt,isConnectable:et}));DefaultNode.displayName="DefaultNode";var DefaultNode$1=reactExports.memo(DefaultNode);const InputNode=({data:tt,isConnectable:et,sourcePosition:nt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:nt,isConnectable:et}));InputNode.displayName="InputNode";var InputNode$1=reactExports.memo(InputNode);const OutputNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label);OutputNode.displayName="OutputNode";var OutputNode$1=reactExports.memo(OutputNode);const GroupNode=()=>null;GroupNode.displayName="GroupNode";const selector$e=tt=>({selectedNodes:tt.getNodes().filter(et=>et.selected),selectedEdges:tt.edges.filter(et=>et.selected)}),selectId=tt=>tt.id;function areEqual(tt,et){return shallow$1(tt.selectedNodes.map(selectId),et.selectedNodes.map(selectId))&&shallow$1(tt.selectedEdges.map(selectId),et.selectedEdges.map(selectId))}const SelectionListener=reactExports.memo(({onSelectionChange:tt})=>{const et=useStoreApi(),{selectedNodes:nt,selectedEdges:rt}=useStore(selector$e,areEqual);return reactExports.useEffect(()=>{var ot,at;const it={nodes:nt,edges:rt};tt==null||tt(it),(at=(ot=et.getState()).onSelectionChange)==null||at.call(ot,it)},[nt,rt,tt]),null});SelectionListener.displayName="SelectionListener";const changeSelector=tt=>!!tt.onSelectionChange;function Wrapper$1$1({onSelectionChange:tt}){const et=useStore(changeSelector);return tt||et?React$1.createElement(SelectionListener,{onSelectionChange:tt}):null}const selector$d=tt=>({setNodes:tt.setNodes,setEdges:tt.setEdges,setDefaultNodesAndEdges:tt.setDefaultNodesAndEdges,setMinZoom:tt.setMinZoom,setMaxZoom:tt.setMaxZoom,setTranslateExtent:tt.setTranslateExtent,setNodeExtent:tt.setNodeExtent,reset:tt.reset});function useStoreUpdater(tt,et){reactExports.useEffect(()=>{typeof tt<"u"&&et(tt)},[tt])}function useDirectStoreUpdater(tt,et,nt){reactExports.useEffect(()=>{typeof et<"u"&&nt({[tt]:et})},[et])}const StoreUpdater=({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:it,onConnectStart:ot,onConnectEnd:at,onClickConnectStart:st,onClickConnectEnd:lt,nodesDraggable:ct,nodesConnectable:ut,nodesFocusable:ht,edgesFocusable:dt,edgesUpdatable:pt,elevateNodesOnSelect:mt,minZoom:gt,maxZoom:yt,nodeExtent:bt,onNodesChange:vt,onEdgesChange:xt,elementsSelectable:kt,connectionMode:St,snapGrid:Tt,snapToGrid:At,translateExtent:Et,connectOnClick:$t,defaultEdgeOptions:Dt,fitView:jt,fitViewOptions:Pt,onNodesDelete:Ct,onEdgesDelete:wt,onNodeDrag:It,onNodeDragStart:Ot,onNodeDragStop:Wt,onSelectionDrag:zt,onSelectionDragStart:Ft,onSelectionDragStop:Nt,noPanClassName:Ut,nodeOrigin:Mt,rfId:Ht,autoPanOnConnect:en,autoPanOnNodeDrag:sn,onError:Kt,connectionRadius:rn,isValidConnection:nn,nodeDragThreshold:hn})=>{const{setNodes:vn,setEdges:an,setDefaultNodesAndEdges:Qt,setMinZoom:_n,setMaxZoom:Pn,setTranslateExtent:$n,setNodeExtent:Nn,reset:Tn}=useStore(selector$d,shallow$1),cn=useStoreApi();return reactExports.useEffect(()=>{const mn=rt==null?void 0:rt.map(In=>({...In,...Dt}));return Qt(nt,mn),()=>{Tn()}},[]),useDirectStoreUpdater("defaultEdgeOptions",Dt,cn.setState),useDirectStoreUpdater("connectionMode",St,cn.setState),useDirectStoreUpdater("onConnect",it,cn.setState),useDirectStoreUpdater("onConnectStart",ot,cn.setState),useDirectStoreUpdater("onConnectEnd",at,cn.setState),useDirectStoreUpdater("onClickConnectStart",st,cn.setState),useDirectStoreUpdater("onClickConnectEnd",lt,cn.setState),useDirectStoreUpdater("nodesDraggable",ct,cn.setState),useDirectStoreUpdater("nodesConnectable",ut,cn.setState),useDirectStoreUpdater("nodesFocusable",ht,cn.setState),useDirectStoreUpdater("edgesFocusable",dt,cn.setState),useDirectStoreUpdater("edgesUpdatable",pt,cn.setState),useDirectStoreUpdater("elementsSelectable",kt,cn.setState),useDirectStoreUpdater("elevateNodesOnSelect",mt,cn.setState),useDirectStoreUpdater("snapToGrid",At,cn.setState),useDirectStoreUpdater("snapGrid",Tt,cn.setState),useDirectStoreUpdater("onNodesChange",vt,cn.setState),useDirectStoreUpdater("onEdgesChange",xt,cn.setState),useDirectStoreUpdater("connectOnClick",$t,cn.setState),useDirectStoreUpdater("fitViewOnInit",jt,cn.setState),useDirectStoreUpdater("fitViewOnInitOptions",Pt,cn.setState),useDirectStoreUpdater("onNodesDelete",Ct,cn.setState),useDirectStoreUpdater("onEdgesDelete",wt,cn.setState),useDirectStoreUpdater("onNodeDrag",It,cn.setState),useDirectStoreUpdater("onNodeDragStart",Ot,cn.setState),useDirectStoreUpdater("onNodeDragStop",Wt,cn.setState),useDirectStoreUpdater("onSelectionDrag",zt,cn.setState),useDirectStoreUpdater("onSelectionDragStart",Ft,cn.setState),useDirectStoreUpdater("onSelectionDragStop",Nt,cn.setState),useDirectStoreUpdater("noPanClassName",Ut,cn.setState),useDirectStoreUpdater("nodeOrigin",Mt,cn.setState),useDirectStoreUpdater("rfId",Ht,cn.setState),useDirectStoreUpdater("autoPanOnConnect",en,cn.setState),useDirectStoreUpdater("autoPanOnNodeDrag",sn,cn.setState),useDirectStoreUpdater("onError",Kt,cn.setState),useDirectStoreUpdater("connectionRadius",rn,cn.setState),useDirectStoreUpdater("isValidConnection",nn,cn.setState),useDirectStoreUpdater("nodeDragThreshold",hn,cn.setState),useStoreUpdater(tt,vn),useStoreUpdater(et,an),useStoreUpdater(gt,_n),useStoreUpdater(yt,Pn),useStoreUpdater(Et,$n),useStoreUpdater(bt,Nn),null},style$1={display:"none"},ariaLiveStyle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ARIA_NODE_DESC_KEY="react-flow__node-desc",ARIA_EDGE_DESC_KEY="react-flow__edge-desc",ARIA_LIVE_MESSAGE="react-flow__aria-live",selector$c=tt=>tt.ariaLiveMessage;function AriaLiveMessage({rfId:tt}){const et=useStore(selector$c);return React$1.createElement("div",{id:`${ARIA_LIVE_MESSAGE}-${tt}`,"aria-live":"assertive","aria-atomic":"true",style:ariaLiveStyle},et)}function A11yDescriptions({rfId:tt,disableKeyboardA11y:et}){return React$1.createElement(React$1.Fragment,null,React$1.createElement("div",{id:`${ARIA_NODE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select a node.",!et&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),React$1.createElement("div",{id:`${ARIA_EDGE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!et&&React$1.createElement(AriaLiveMessage,{rfId:tt}))}var useKeyPress=(tt=null,et={actInsideInputWithModifier:!0})=>{const[nt,rt]=reactExports.useState(!1),it=reactExports.useRef(!1),ot=reactExports.useRef(new Set([])),[at,st]=reactExports.useMemo(()=>{if(tt!==null){const ct=(Array.isArray(tt)?tt:[tt]).filter(ht=>typeof ht=="string").map(ht=>ht.split("+")),ut=ct.reduce((ht,dt)=>ht.concat(...dt),[]);return[ct,ut]}return[[],[]]},[tt]);return reactExports.useEffect(()=>{const lt=typeof document<"u"?document:null,ct=(et==null?void 0:et.target)||lt;if(tt!==null){const ut=pt=>{if(it.current=pt.ctrlKey||pt.metaKey||pt.shiftKey,(!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);ot.current.add(pt[gt]),isMatchingKey(at,ot.current,!1)&&(pt.preventDefault(),rt(!0))},ht=pt=>{if((!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);isMatchingKey(at,ot.current,!0)?(rt(!1),ot.current.clear()):ot.current.delete(pt[gt]),pt.key==="Meta"&&ot.current.clear(),it.current=!1},dt=()=>{ot.current.clear(),rt(!1)};return ct==null||ct.addEventListener("keydown",ut),ct==null||ct.addEventListener("keyup",ht),window.addEventListener("blur",dt),()=>{ct==null||ct.removeEventListener("keydown",ut),ct==null||ct.removeEventListener("keyup",ht),window.removeEventListener("blur",dt)}}},[tt,rt]),nt};function isMatchingKey(tt,et,nt){return tt.filter(rt=>nt||rt.length===et.size).some(rt=>rt.every(it=>et.has(it)))}function useKeyOrCode(tt,et){return et.includes(tt)?"code":"key"}function calculateXYZPosition(tt,et,nt,rt){var at,st;if(!tt.parentNode)return nt;const it=et.get(tt.parentNode),ot=getNodePositionWithOrigin(it,rt);return calculateXYZPosition(it,et,{x:(nt.x??0)+ot.x,y:(nt.y??0)+ot.y,z:(((at=it[internalsSymbol])==null?void 0:at.z)??0)>(nt.z??0)?((st=it[internalsSymbol])==null?void 0:st.z)??0:nt.z??0},rt)}function updateAbsoluteNodePositions(tt,et,nt){tt.forEach(rt=>{var it;if(rt.parentNode&&!tt.has(rt.parentNode))throw new Error(`Parent node ${rt.parentNode} not found`);if(rt.parentNode||nt!=null&&nt[rt.id]){const{x:ot,y:at,z:st}=calculateXYZPosition(rt,tt,{...rt.position,z:((it=rt[internalsSymbol])==null?void 0:it.z)??0},et);rt.positionAbsolute={x:ot,y:at},rt[internalsSymbol].z=st,nt!=null&&nt[rt.id]&&(rt[internalsSymbol].isParent=!0)}})}function createNodeInternals(tt,et,nt,rt){const it=new Map,ot={},at=rt?1e3:0;return tt.forEach(st=>{var ht;const lt=(isNumeric(st.zIndex)?st.zIndex:0)+(st.selected?at:0),ct=et.get(st.id),ut={width:ct==null?void 0:ct.width,height:ct==null?void 0:ct.height,...st,positionAbsolute:{x:st.position.x,y:st.position.y}};st.parentNode&&(ut.parentNode=st.parentNode,ot[st.parentNode]=!0),Object.defineProperty(ut,internalsSymbol,{enumerable:!1,value:{handleBounds:(ht=ct==null?void 0:ct[internalsSymbol])==null?void 0:ht.handleBounds,z:lt}}),it.set(st.id,ut)}),updateAbsoluteNodePositions(it,nt,ot),it}function fitView(tt,et={}){const{getNodes:nt,width:rt,height:it,minZoom:ot,maxZoom:at,d3Zoom:st,d3Selection:lt,fitViewOnInitDone:ct,fitViewOnInit:ut,nodeOrigin:ht}=tt(),dt=et.initial&&!ct&&ut;if(st&<&&(dt||!et.initial)){const mt=nt().filter(yt=>{var vt;const bt=et.includeHiddenNodes?yt.width&&yt.height:!yt.hidden;return(vt=et.nodes)!=null&&vt.length?bt&&et.nodes.some(xt=>xt.id===yt.id):bt}),gt=mt.every(yt=>yt.width&&yt.height);if(mt.length>0&>){const yt=getRectOfNodes(mt,ht),[bt,vt,xt]=getTransformForBounds(yt,rt,it,et.minZoom??ot,et.maxZoom??at,et.padding??.1),kt=identity.translate(bt,vt).scale(xt);return typeof et.duration=="number"&&et.duration>0?st.transform(getD3Transition(lt,et.duration),kt):st.transform(lt,kt),!0}}return!1}function handleControlledNodeSelectionChange(tt,et){return tt.forEach(nt=>{const rt=et.get(nt.id);rt&&et.set(rt.id,{...rt,[internalsSymbol]:rt[internalsSymbol],selected:nt.selected})}),new Map(et)}function handleControlledEdgeSelectionChange(tt,et){return et.map(nt=>{const rt=tt.find(it=>it.id===nt.id);return rt&&(nt.selected=rt.selected),nt})}function updateNodesAndEdgesSelections({changedNodes:tt,changedEdges:et,get:nt,set:rt}){const{nodeInternals:it,edges:ot,onNodesChange:at,onEdgesChange:st,hasDefaultNodes:lt,hasDefaultEdges:ct}=nt();tt!=null&&tt.length&&(lt&&rt({nodeInternals:handleControlledNodeSelectionChange(tt,it)}),at==null||at(tt)),et!=null&&et.length&&(ct&&rt({edges:handleControlledEdgeSelectionChange(et,ot)}),st==null||st(et))}const noop$1=()=>{},initialViewportHelper={zoomIn:noop$1,zoomOut:noop$1,zoomTo:noop$1,getZoom:()=>1,setViewport:noop$1,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:noop$1,fitBounds:noop$1,project:tt=>tt,viewportInitialized:!1},selector$b=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection}),useViewportHelper=()=>{const tt=useStoreApi(),{d3Zoom:et,d3Selection:nt}=useStore(selector$b,shallow$1);return reactExports.useMemo(()=>nt&&et?{zoomIn:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1.2),zoomOut:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1/1.2),zoomTo:(it,ot)=>et.scaleTo(getD3Transition(nt,ot==null?void 0:ot.duration),it),getZoom:()=>tt.getState().transform[2],setViewport:(it,ot)=>{const[at,st,lt]=tt.getState().transform,ct=identity.translate(it.x??at,it.y??st).scale(it.zoom??lt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),ct)},getViewport:()=>{const[it,ot,at]=tt.getState().transform;return{x:it,y:ot,zoom:at}},fitView:it=>fitView(tt.getState,it),setCenter:(it,ot,at)=>{const{width:st,height:lt,maxZoom:ct}=tt.getState(),ut=typeof(at==null?void 0:at.zoom)<"u"?at.zoom:ct,ht=st/2-it*ut,dt=lt/2-ot*ut,pt=identity.translate(ht,dt).scale(ut);et.transform(getD3Transition(nt,at==null?void 0:at.duration),pt)},fitBounds:(it,ot)=>{const{width:at,height:st,minZoom:lt,maxZoom:ct}=tt.getState(),[ut,ht,dt]=getTransformForBounds(it,at,st,lt,ct,(ot==null?void 0:ot.padding)??.1),pt=identity.translate(ut,ht).scale(dt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),pt)},project:it=>{const{transform:ot,snapToGrid:at,snapGrid:st}=tt.getState();return pointToRendererPoint(it,ot,at,st)},viewportInitialized:!0}:initialViewportHelper,[et,nt])};function useReactFlow(){const tt=useViewportHelper(),et=useStoreApi(),nt=reactExports.useCallback(()=>et.getState().getNodes().map(gt=>({...gt})),[]),rt=reactExports.useCallback(gt=>et.getState().nodeInternals.get(gt),[]),it=reactExports.useCallback(()=>{const{edges:gt=[]}=et.getState();return gt.map(yt=>({...yt}))},[]),ot=reactExports.useCallback(gt=>{const{edges:yt=[]}=et.getState();return yt.find(bt=>bt.id===gt)},[]),at=reactExports.useCallback(gt=>{const{getNodes:yt,setNodes:bt,hasDefaultNodes:vt,onNodesChange:xt}=et.getState(),kt=yt(),St=typeof gt=="function"?gt(kt):gt;if(vt)bt(St);else if(xt){const Tt=St.length===0?kt.map(At=>({type:"remove",id:At.id})):St.map(At=>({item:At,type:"reset"}));xt(Tt)}},[]),st=reactExports.useCallback(gt=>{const{edges:yt=[],setEdges:bt,hasDefaultEdges:vt,onEdgesChange:xt}=et.getState(),kt=typeof gt=="function"?gt(yt):gt;if(vt)bt(kt);else if(xt){const St=kt.length===0?yt.map(Tt=>({type:"remove",id:Tt.id})):kt.map(Tt=>({item:Tt,type:"reset"}));xt(St)}},[]),lt=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{getNodes:bt,setNodes:vt,hasDefaultNodes:xt,onNodesChange:kt}=et.getState();if(xt){const Tt=[...bt(),...yt];vt(Tt)}else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ct=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{edges:bt=[],setEdges:vt,hasDefaultEdges:xt,onEdgesChange:kt}=et.getState();if(xt)vt([...bt,...yt]);else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ut=reactExports.useCallback(()=>{const{getNodes:gt,edges:yt=[],transform:bt}=et.getState(),[vt,xt,kt]=bt;return{nodes:gt().map(St=>({...St})),edges:yt.map(St=>({...St})),viewport:{x:vt,y:xt,zoom:kt}}},[]),ht=reactExports.useCallback(({nodes:gt,edges:yt})=>{const{nodeInternals:bt,getNodes:vt,edges:xt,hasDefaultNodes:kt,hasDefaultEdges:St,onNodesDelete:Tt,onEdgesDelete:At,onNodesChange:Et,onEdgesChange:$t}=et.getState(),Dt=(gt||[]).map(It=>It.id),jt=(yt||[]).map(It=>It.id),Pt=vt().reduce((It,Ot)=>{const Wt=!Dt.includes(Ot.id)&&Ot.parentNode&&It.find(Ft=>Ft.id===Ot.parentNode);return(typeof Ot.deletable=="boolean"?Ot.deletable:!0)&&(Dt.includes(Ot.id)||Wt)&&It.push(Ot),It},[]),Ct=xt.filter(It=>typeof It.deletable=="boolean"?It.deletable:!0),wt=Ct.filter(It=>jt.includes(It.id));if(Pt||wt){const It=getConnectedEdges(Pt,Ct),Ot=[...wt,...It],Wt=Ot.reduce((zt,Ft)=>(zt.includes(Ft.id)||zt.push(Ft.id),zt),[]);if((St||kt)&&(St&&et.setState({edges:xt.filter(zt=>!Wt.includes(zt.id))}),kt&&(Pt.forEach(zt=>{bt.delete(zt.id)}),et.setState({nodeInternals:new Map(bt)}))),Wt.length>0&&(At==null||At(Ot),$t&&$t(Wt.map(zt=>({id:zt,type:"remove"})))),Pt.length>0&&(Tt==null||Tt(Pt),Et)){const zt=Pt.map(Ft=>({id:Ft.id,type:"remove"}));Et(zt)}}},[]),dt=reactExports.useCallback(gt=>{const yt=isRectObject(gt),bt=yt?null:et.getState().nodeInternals.get(gt.id);return[yt?gt:nodeToRect(bt),bt,yt]},[]),pt=reactExports.useCallback((gt,yt=!0,bt)=>{const[vt,xt,kt]=dt(gt);return vt?(bt||et.getState().getNodes()).filter(St=>{if(!kt&&(St.id===xt.id||!St.positionAbsolute))return!1;const Tt=nodeToRect(St),At=getOverlappingArea(Tt,vt);return yt&&At>0||At>=gt.width*gt.height}):[]},[]),mt=reactExports.useCallback((gt,yt,bt=!0)=>{const[vt]=dt(gt);if(!vt)return!1;const xt=getOverlappingArea(vt,yt);return bt&&xt>0||xt>=gt.width*gt.height},[]);return reactExports.useMemo(()=>({...tt,getNodes:nt,getNode:rt,getEdges:it,getEdge:ot,setNodes:at,setEdges:st,addNodes:lt,addEdges:ct,toObject:ut,deleteElements:ht,getIntersectingNodes:pt,isNodeIntersecting:mt}),[tt,nt,rt,it,ot,at,st,lt,ct,ut,ht,pt,mt])}const deleteKeyOptions={actInsideInputWithModifier:!1};var useGlobalKeyHandler=({deleteKeyCode:tt,multiSelectionKeyCode:et})=>{const nt=useStoreApi(),{deleteElements:rt}=useReactFlow(),it=useKeyPress(tt,deleteKeyOptions),ot=useKeyPress(et);reactExports.useEffect(()=>{if(it){const{edges:at,getNodes:st}=nt.getState(),lt=st().filter(ut=>ut.selected),ct=at.filter(ut=>ut.selected);rt({nodes:lt,edges:ct}),nt.setState({nodesSelectionActive:!1})}},[it]),reactExports.useEffect(()=>{nt.setState({multiSelectionActive:ot})},[ot])};function useResizeHandler(tt){const et=useStoreApi();reactExports.useEffect(()=>{let nt;const rt=()=>{var ot,at;if(!tt.current)return;const it=getDimensions(tt.current);(it.height===0||it.width===0)&&((at=(ot=et.getState()).onError)==null||at.call(ot,"004",errorMessages.error004())),et.setState({width:it.width||500,height:it.height||500})};return rt(),window.addEventListener("resize",rt),tt.current&&(nt=new ResizeObserver(()=>rt()),nt.observe(tt.current)),()=>{window.removeEventListener("resize",rt),nt&&tt.current&&nt.unobserve(tt.current)}},[])}const containerStyle={position:"absolute",width:"100%",height:"100%",top:0,left:0},viewChanged=(tt,et)=>tt.x!==et.x||tt.y!==et.y||tt.zoom!==et.k,eventToFlowTransform=tt=>({x:tt.x,y:tt.y,zoom:tt.k}),isWrappedWithClass=(tt,et)=>tt.target.closest(`.${et}`),isRightClickPan=(tt,et)=>et===2&&Array.isArray(tt)&&tt.includes(2),wheelDelta=tt=>{const et=tt.ctrlKey&&isMacOs()?10:1;return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*et},selector$a=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection,d3ZoomHandler:tt.d3ZoomHandler,userSelectionActive:tt.userSelectionActive}),ZoomPane=({onMove:tt,onMoveStart:et,onMoveEnd:nt,onPaneContextMenu:rt,zoomOnScroll:it=!0,zoomOnPinch:ot=!0,panOnScroll:at=!1,panOnScrollSpeed:st=.5,panOnScrollMode:lt=PanOnScrollMode.Free,zoomOnDoubleClick:ct=!0,elementsSelectable:ut,panOnDrag:ht=!0,defaultViewport:dt,translateExtent:pt,minZoom:mt,maxZoom:gt,zoomActivationKeyCode:yt,preventScrolling:bt=!0,children:vt,noWheelClassName:xt,noPanClassName:kt})=>{const St=reactExports.useRef(),Tt=useStoreApi(),At=reactExports.useRef(!1),Et=reactExports.useRef(!1),$t=reactExports.useRef(null),Dt=reactExports.useRef({x:0,y:0,zoom:0}),{d3Zoom:jt,d3Selection:Pt,d3ZoomHandler:Ct,userSelectionActive:wt}=useStore(selector$a,shallow$1),It=useKeyPress(yt),Ot=reactExports.useRef(0),Wt=reactExports.useRef(!1),zt=reactExports.useRef();return useResizeHandler($t),reactExports.useEffect(()=>{if($t.current){const Ft=$t.current.getBoundingClientRect(),Nt=zoom().scaleExtent([mt,gt]).translateExtent(pt),Ut=select($t.current).call(Nt),Mt=identity.translate(dt.x,dt.y).scale(clamp(dt.zoom,mt,gt)),Ht=[[0,0],[Ft.width,Ft.height]],en=Nt.constrain()(Mt,Ht,pt);Nt.transform(Ut,en),Nt.wheelDelta(wheelDelta),Tt.setState({d3Zoom:Nt,d3Selection:Ut,d3ZoomHandler:Ut.on("wheel.zoom"),transform:[en.x,en.y,en.k],domNode:$t.current.closest(".react-flow")})}},[]),reactExports.useEffect(()=>{Pt&&jt&&(at&&!It&&!wt?Pt.on("wheel.zoom",Ft=>{if(isWrappedWithClass(Ft,xt))return!1;Ft.preventDefault(),Ft.stopImmediatePropagation();const Nt=Pt.property("__zoom").k||1,Ut=isMacOs();if(Ft.ctrlKey&&ot&&Ut){const hn=pointer(Ft),vn=wheelDelta(Ft),an=Nt*Math.pow(2,vn);jt.scaleTo(Pt,an,hn,Ft);return}const Mt=Ft.deltaMode===1?20:1;let Ht=lt===PanOnScrollMode.Vertical?0:Ft.deltaX*Mt,en=lt===PanOnScrollMode.Horizontal?0:Ft.deltaY*Mt;!Ut&&Ft.shiftKey&<!==PanOnScrollMode.Vertical&&(Ht=Ft.deltaY*Mt,en=0),jt.translateBy(Pt,-(Ht/Nt)*st,-(en/Nt)*st,{internal:!0});const sn=eventToFlowTransform(Pt.property("__zoom")),{onViewportChangeStart:Kt,onViewportChange:rn,onViewportChangeEnd:nn}=Tt.getState();clearTimeout(zt.current),Wt.current||(Wt.current=!0,et==null||et(Ft,sn),Kt==null||Kt(sn)),Wt.current&&(tt==null||tt(Ft,sn),rn==null||rn(sn),zt.current=setTimeout(()=>{nt==null||nt(Ft,sn),nn==null||nn(sn),Wt.current=!1},150))},{passive:!1}):typeof Ct<"u"&&Pt.on("wheel.zoom",function(Ft,Nt){if(!bt||isWrappedWithClass(Ft,xt))return null;Ft.preventDefault(),Ct.call(this,Ft,Nt)},{passive:!1}))},[wt,at,lt,Pt,jt,Ct,It,ot,bt,xt,et,tt,nt]),reactExports.useEffect(()=>{jt&&jt.on("start",Ft=>{var Mt,Ht;if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;Ot.current=(Mt=Ft.sourceEvent)==null?void 0:Mt.button;const{onViewportChangeStart:Nt}=Tt.getState(),Ut=eventToFlowTransform(Ft.transform);At.current=!0,Dt.current=Ut,((Ht=Ft.sourceEvent)==null?void 0:Ht.type)==="mousedown"&&Tt.setState({paneDragging:!0}),Nt==null||Nt(Ut),et==null||et(Ft.sourceEvent,Ut)})},[jt,et]),reactExports.useEffect(()=>{jt&&(wt&&!At.current?jt.on("zoom",null):wt||jt.on("zoom",Ft=>{var Ut;const{onViewportChange:Nt}=Tt.getState();if(Tt.setState({transform:[Ft.transform.x,Ft.transform.y,Ft.transform.k]}),Et.current=!!(rt&&isRightClickPan(ht,Ot.current??0)),(tt||Nt)&&!((Ut=Ft.sourceEvent)!=null&&Ut.internal)){const Mt=eventToFlowTransform(Ft.transform);Nt==null||Nt(Mt),tt==null||tt(Ft.sourceEvent,Mt)}}))},[wt,jt,tt,ht,rt]),reactExports.useEffect(()=>{jt&&jt.on("end",Ft=>{if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;const{onViewportChangeEnd:Nt}=Tt.getState();if(At.current=!1,Tt.setState({paneDragging:!1}),rt&&isRightClickPan(ht,Ot.current??0)&&!Et.current&&rt(Ft.sourceEvent),Et.current=!1,(nt||Nt)&&viewChanged(Dt.current,Ft.transform)){const Ut=eventToFlowTransform(Ft.transform);Dt.current=Ut,clearTimeout(St.current),St.current=setTimeout(()=>{Nt==null||Nt(Ut),nt==null||nt(Ft.sourceEvent,Ut)},at?150:0)}})},[jt,at,ht,nt,rt]),reactExports.useEffect(()=>{jt&&jt.filter(Ft=>{const Nt=It||it,Ut=ot&&Ft.ctrlKey;if((ht===!0||Array.isArray(ht)&&ht.includes(1))&&Ft.button===1&&Ft.type==="mousedown"&&(isWrappedWithClass(Ft,"react-flow__node")||isWrappedWithClass(Ft,"react-flow__edge")))return!0;if(!ht&&!Nt&&!at&&!ct&&!ot||wt||!ct&&Ft.type==="dblclick"||isWrappedWithClass(Ft,xt)&&Ft.type==="wheel"||isWrappedWithClass(Ft,kt)&&(Ft.type!=="wheel"||at&&Ft.type==="wheel")||!ot&&Ft.ctrlKey&&Ft.type==="wheel"||!Nt&&!at&&!Ut&&Ft.type==="wheel"||!ht&&(Ft.type==="mousedown"||Ft.type==="touchstart")||Array.isArray(ht)&&!ht.includes(Ft.button)&&(Ft.type==="mousedown"||Ft.type==="touchstart"))return!1;const Mt=Array.isArray(ht)&&ht.includes(Ft.button)||!Ft.button||Ft.button<=1;return(!Ft.ctrlKey||Ft.type==="wheel")&&Mt})},[wt,jt,it,ot,at,ct,ht,ut,It]),React$1.createElement("div",{className:"react-flow__renderer",ref:$t,style:containerStyle},vt)},selector$9=tt=>({userSelectionActive:tt.userSelectionActive,userSelectionRect:tt.userSelectionRect});function UserSelection(){const{userSelectionActive:tt,userSelectionRect:et}=useStore(selector$9,shallow$1);return tt&&et?React$1.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:et.width,height:et.height,transform:`translate(${et.x}px, ${et.y}px)`}}):null}function handleParentExpand(tt,et){const nt=tt.find(rt=>rt.id===et.parentNode);if(nt){const rt=et.position.x+et.width-nt.width,it=et.position.y+et.height-nt.height;if(rt>0||it>0||et.position.x<0||et.position.y<0){if(nt.style={...nt.style},nt.style.width=nt.style.width??nt.width,nt.style.height=nt.style.height??nt.height,rt>0&&(nt.style.width+=rt),it>0&&(nt.style.height+=it),et.position.x<0){const ot=Math.abs(et.position.x);nt.position.x=nt.position.x-ot,nt.style.width+=ot,et.position.x=0}if(et.position.y<0){const ot=Math.abs(et.position.y);nt.position.y=nt.position.y-ot,nt.style.height+=ot,et.position.y=0}nt.width=nt.style.width,nt.height=nt.style.height}}}function applyChanges(tt,et){if(tt.some(rt=>rt.type==="reset"))return tt.filter(rt=>rt.type==="reset").map(rt=>rt.item);const nt=tt.filter(rt=>rt.type==="add").map(rt=>rt.item);return et.reduce((rt,it)=>{const ot=tt.filter(st=>st.id===it.id);if(ot.length===0)return rt.push(it),rt;const at={...it};for(const st of ot)if(st)switch(st.type){case"select":{at.selected=st.selected;break}case"position":{typeof st.position<"u"&&(at.position=st.position),typeof st.positionAbsolute<"u"&&(at.positionAbsolute=st.positionAbsolute),typeof st.dragging<"u"&&(at.dragging=st.dragging),at.expandParent&&handleParentExpand(rt,at);break}case"dimensions":{typeof st.dimensions<"u"&&(at.width=st.dimensions.width,at.height=st.dimensions.height),typeof st.updateStyle<"u"&&(at.style={...at.style||{},...st.dimensions}),typeof st.resizing=="boolean"&&(at.resizing=st.resizing),at.expandParent&&handleParentExpand(rt,at);break}case"remove":return rt}return rt.push(at),rt},nt)}function applyNodeChanges(tt,et){return applyChanges(tt,et)}const createSelectionChange=(tt,et)=>({id:tt,type:"select",selected:et});function getSelectionChanges(tt,et){return tt.reduce((nt,rt)=>{const it=et.includes(rt.id);return!rt.selected&&it?(rt.selected=!0,nt.push(createSelectionChange(rt.id,!0))):rt.selected&&!it&&(rt.selected=!1,nt.push(createSelectionChange(rt.id,!1))),nt},[])}const wrapHandler=(tt,et)=>nt=>{nt.target===et.current&&(tt==null||tt(nt))},selector$8=tt=>({userSelectionActive:tt.userSelectionActive,elementsSelectable:tt.elementsSelectable,dragging:tt.paneDragging}),Pane=reactExports.memo(({isSelecting:tt,selectionMode:et=SelectionMode.Full,panOnDrag:nt,onSelectionStart:rt,onSelectionEnd:it,onPaneClick:ot,onPaneContextMenu:at,onPaneScroll:st,onPaneMouseEnter:lt,onPaneMouseMove:ct,onPaneMouseLeave:ut,children:ht})=>{const dt=reactExports.useRef(null),pt=useStoreApi(),mt=reactExports.useRef(0),gt=reactExports.useRef(0),yt=reactExports.useRef(),{userSelectionActive:bt,elementsSelectable:vt,dragging:xt}=useStore(selector$8,shallow$1),kt=()=>{pt.setState({userSelectionActive:!1,userSelectionRect:null}),mt.current=0,gt.current=0},St=Ct=>{ot==null||ot(Ct),pt.getState().resetSelectedElements(),pt.setState({nodesSelectionActive:!1})},Tt=Ct=>{if(Array.isArray(nt)&&(nt!=null&&nt.includes(2))){Ct.preventDefault();return}at==null||at(Ct)},At=st?Ct=>st(Ct):void 0,Et=Ct=>{const{resetSelectedElements:wt,domNode:It}=pt.getState();if(yt.current=It==null?void 0:It.getBoundingClientRect(),!vt||!tt||Ct.button!==0||Ct.target!==dt.current||!yt.current)return;const{x:Ot,y:Wt}=getEventPosition(Ct,yt.current);wt(),pt.setState({userSelectionRect:{width:0,height:0,startX:Ot,startY:Wt,x:Ot,y:Wt}}),rt==null||rt(Ct)},$t=Ct=>{const{userSelectionRect:wt,nodeInternals:It,edges:Ot,transform:Wt,onNodesChange:zt,onEdgesChange:Ft,nodeOrigin:Nt,getNodes:Ut}=pt.getState();if(!tt||!yt.current||!wt)return;pt.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Mt=getEventPosition(Ct,yt.current),Ht=wt.startX??0,en=wt.startY??0,sn={...wt,x:Mt.xvn.id),hn=rn.map(vn=>vn.id);if(mt.current!==hn.length){mt.current=hn.length;const vn=getSelectionChanges(Kt,hn);vn.length&&(zt==null||zt(vn))}if(gt.current!==nn.length){gt.current=nn.length;const vn=getSelectionChanges(Ot,nn);vn.length&&(Ft==null||Ft(vn))}pt.setState({userSelectionRect:sn})},Dt=Ct=>{if(Ct.button!==0)return;const{userSelectionRect:wt}=pt.getState();!bt&&wt&&Ct.target===dt.current&&(St==null||St(Ct)),pt.setState({nodesSelectionActive:mt.current>0}),kt(),it==null||it(Ct)},jt=Ct=>{bt&&(pt.setState({nodesSelectionActive:mt.current>0}),it==null||it(Ct)),kt()},Pt=vt&&(tt||bt);return React$1.createElement("div",{className:cc(["react-flow__pane",{dragging:xt,selection:tt}]),onClick:Pt?void 0:wrapHandler(St,dt),onContextMenu:wrapHandler(Tt,dt),onWheel:wrapHandler(At,dt),onMouseEnter:Pt?void 0:lt,onMouseDown:Pt?Et:void 0,onMouseMove:Pt?$t:ct,onMouseUp:Pt?Dt:void 0,onMouseLeave:Pt?jt:ut,ref:dt,style:containerStyle},ht,React$1.createElement(UserSelection,null))});Pane.displayName="Pane";function isParentSelected(tt,et){if(!tt.parentNode)return!1;const nt=et.get(tt.parentNode);return nt?nt.selected?!0:isParentSelected(nt,et):!1}function hasSelector(tt,et,nt){let rt=tt;do{if(rt!=null&&rt.matches(et))return!0;if(rt===nt.current)return!1;rt=rt.parentElement}while(rt);return!1}function getDragItems(tt,et,nt,rt){return Array.from(tt.values()).filter(it=>(it.selected||it.id===rt)&&(!it.parentNode||!isParentSelected(it,tt))&&(it.draggable||et&&typeof it.draggable>"u")).map(it=>{var ot,at;return{id:it.id,position:it.position||{x:0,y:0},positionAbsolute:it.positionAbsolute||{x:0,y:0},distance:{x:nt.x-(((ot=it.positionAbsolute)==null?void 0:ot.x)??0),y:nt.y-(((at=it.positionAbsolute)==null?void 0:at.y)??0)},delta:{x:0,y:0},extent:it.extent,parentNode:it.parentNode,width:it.width,height:it.height,expandParent:it.expandParent}})}function clampNodeExtent(tt,et){return!et||et==="parent"?et:[et[0],[et[1][0]-(tt.width||0),et[1][1]-(tt.height||0)]]}function calcNextPosition(tt,et,nt,rt,it=[0,0],ot){const at=clampNodeExtent(tt,tt.extent||rt);let st=at;if(tt.extent==="parent"&&!tt.expandParent)if(tt.parentNode&&tt.width&&tt.height){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=ut&&isNumeric(ht)&&isNumeric(dt)&&isNumeric(ut.width)&&isNumeric(ut.height)?[[ht+tt.width*it[0],dt+tt.height*it[1]],[ht+ut.width-tt.width+tt.width*it[0],dt+ut.height-tt.height+tt.height*it[1]]]:st}else ot==null||ot("005",errorMessages.error005()),st=at;else if(tt.extent&&tt.parentNode&&tt.extent!=="parent"){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=[[tt.extent[0][0]+ht,tt.extent[0][1]+dt],[tt.extent[1][0]+ht,tt.extent[1][1]+dt]]}let lt={x:0,y:0};if(tt.parentNode){const ut=nt.get(tt.parentNode);lt=getNodePositionWithOrigin(ut,it).positionAbsolute}const ct=st&&st!=="parent"?clampPosition(et,st):et;return{position:{x:ct.x-lt.x,y:ct.y-lt.y},positionAbsolute:ct}}function getEventHandlerParams({nodeId:tt,dragItems:et,nodeInternals:nt}){const rt=et.map(it=>({...nt.get(it.id),position:it.position,positionAbsolute:it.positionAbsolute}));return[tt?rt.find(it=>it.id===tt):rt[0],rt]}const getHandleBounds=(tt,et,nt,rt)=>{const it=et.querySelectorAll(tt);if(!it||!it.length)return null;const ot=Array.from(it),at=et.getBoundingClientRect(),st={x:at.width*rt[0],y:at.height*rt[1]};return ot.map(lt=>{const ct=lt.getBoundingClientRect();return{id:lt.getAttribute("data-handleid"),position:lt.getAttribute("data-handlepos"),x:(ct.left-at.left-st.x)/nt,y:(ct.top-at.top-st.y)/nt,...getDimensions(lt)}})};function getMouseHandler(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().nodeInternals.get(tt);it&&nt(rt,{...it})}}function handleNodeClick({id:tt,store:et,unselect:nt=!1,nodeRef:rt}){const{addSelectedNodes:it,unselectNodesAndEdges:ot,multiSelectionActive:at,nodeInternals:st,onError:lt}=et.getState(),ct=st.get(tt);if(!ct){lt==null||lt("012",errorMessages.error012(tt));return}et.setState({nodesSelectionActive:!1}),ct.selected?(nt||ct.selected&&at)&&(ot({nodes:[ct],edges:[]}),requestAnimationFrame(()=>{var ut;return(ut=rt==null?void 0:rt.current)==null?void 0:ut.blur()})):it([tt])}function useGetPointerPosition(){const tt=useStoreApi();return reactExports.useCallback(({sourceEvent:nt})=>{const{transform:rt,snapGrid:it,snapToGrid:ot}=tt.getState(),at=nt.touches?nt.touches[0].clientX:nt.clientX,st=nt.touches?nt.touches[0].clientY:nt.clientY,lt={x:(at-rt[0])/rt[2],y:(st-rt[1])/rt[2]};return{xSnapped:ot?it[0]*Math.round(lt.x/it[0]):lt.x,ySnapped:ot?it[1]*Math.round(lt.y/it[1]):lt.y,...lt}},[])}function wrapSelectionDragFunc(tt){return(et,nt,rt)=>tt==null?void 0:tt(et,rt)}function useDrag({nodeRef:tt,disabled:et=!1,noDragClassName:nt,handleSelector:rt,nodeId:it,isSelectable:ot,selectNodesOnDrag:at}){const st=useStoreApi(),[lt,ct]=reactExports.useState(!1),ut=reactExports.useRef([]),ht=reactExports.useRef({x:null,y:null}),dt=reactExports.useRef(0),pt=reactExports.useRef(null),mt=reactExports.useRef({x:0,y:0}),gt=reactExports.useRef(null),yt=reactExports.useRef(!1),bt=reactExports.useRef(!1),vt=useGetPointerPosition();return reactExports.useEffect(()=>{if(tt!=null&&tt.current){const xt=select(tt.current),kt=({x:At,y:Et})=>{const{nodeInternals:$t,onNodeDrag:Dt,onSelectionDrag:jt,updateNodePositions:Pt,nodeExtent:Ct,snapGrid:wt,snapToGrid:It,nodeOrigin:Ot,onError:Wt}=st.getState();ht.current={x:At,y:Et};let zt=!1,Ft={x:0,y:0,x2:0,y2:0};if(ut.current.length>1&&Ct){const Ut=getRectOfNodes(ut.current,Ot);Ft=rectToBox(Ut)}if(ut.current=ut.current.map(Ut=>{const Mt={x:At-Ut.distance.x,y:Et-Ut.distance.y};It&&(Mt.x=wt[0]*Math.round(Mt.x/wt[0]),Mt.y=wt[1]*Math.round(Mt.y/wt[1]));const Ht=[[Ct[0][0],Ct[0][1]],[Ct[1][0],Ct[1][1]]];ut.current.length>1&&Ct&&!Ut.extent&&(Ht[0][0]=Ut.positionAbsolute.x-Ft.x+Ct[0][0],Ht[1][0]=Ut.positionAbsolute.x+(Ut.width??0)-Ft.x2+Ct[1][0],Ht[0][1]=Ut.positionAbsolute.y-Ft.y+Ct[0][1],Ht[1][1]=Ut.positionAbsolute.y+(Ut.height??0)-Ft.y2+Ct[1][1]);const en=calcNextPosition(Ut,Mt,$t,Ht,Ot,Wt);return zt=zt||Ut.position.x!==en.position.x||Ut.position.y!==en.position.y,Ut.position=en.position,Ut.positionAbsolute=en.positionAbsolute,Ut}),!zt)return;Pt(ut.current,!0,!0),ct(!0);const Nt=it?Dt:wrapSelectionDragFunc(jt);if(Nt&>.current){const[Ut,Mt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:$t});Nt(gt.current,Ut,Mt)}},St=()=>{if(!pt.current)return;const[At,Et]=calcAutoPan(mt.current,pt.current);if(At!==0||Et!==0){const{transform:$t,panBy:Dt}=st.getState();ht.current.x=(ht.current.x??0)-At/$t[2],ht.current.y=(ht.current.y??0)-Et/$t[2],Dt({x:At,y:Et})&&kt(ht.current)}dt.current=requestAnimationFrame(St)},Tt=At=>{var Ot;const{nodeInternals:Et,multiSelectionActive:$t,nodesDraggable:Dt,unselectNodesAndEdges:jt,onNodeDragStart:Pt,onSelectionDragStart:Ct}=st.getState();bt.current=!0;const wt=it?Pt:wrapSelectionDragFunc(Ct);(!at||!ot)&&!$t&&it&&((Ot=Et.get(it))!=null&&Ot.selected||jt()),it&&ot&&at&&handleNodeClick({id:it,store:st,nodeRef:tt});const It=vt(At);if(ht.current=It,ut.current=getDragItems(Et,Dt,It,it),wt&&ut.current){const[Wt,zt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Et});wt(At.sourceEvent,Wt,zt)}};if(et)xt.on(".drag",null);else{const At=drag().on("start",Et=>{const{domNode:$t,nodeDragThreshold:Dt}=st.getState();Dt===0&&Tt(Et);const jt=vt(Et);ht.current=jt,pt.current=($t==null?void 0:$t.getBoundingClientRect())||null,mt.current=getEventPosition(Et.sourceEvent,pt.current)}).on("drag",Et=>{var Pt,Ct;const $t=vt(Et),{autoPanOnNodeDrag:Dt,nodeDragThreshold:jt}=st.getState();if(!yt.current&&bt.current&&Dt&&(yt.current=!0,St()),!bt.current){const wt=$t.xSnapped-(((Pt=ht==null?void 0:ht.current)==null?void 0:Pt.x)??0),It=$t.ySnapped-(((Ct=ht==null?void 0:ht.current)==null?void 0:Ct.y)??0);Math.sqrt(wt*wt+It*It)>jt&&Tt(Et)}(ht.current.x!==$t.xSnapped||ht.current.y!==$t.ySnapped)&&ut.current&&bt.current&&(gt.current=Et.sourceEvent,mt.current=getEventPosition(Et.sourceEvent,pt.current),kt($t))}).on("end",Et=>{if(bt.current&&(ct(!1),yt.current=!1,bt.current=!1,cancelAnimationFrame(dt.current),ut.current)){const{updateNodePositions:$t,nodeInternals:Dt,onNodeDragStop:jt,onSelectionDragStop:Pt}=st.getState(),Ct=it?jt:wrapSelectionDragFunc(Pt);if($t(ut.current,!1,!1),Ct){const[wt,It]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Dt});Ct(Et.sourceEvent,wt,It)}}}).filter(Et=>{const $t=Et.target;return!Et.button&&(!nt||!hasSelector($t,`.${nt}`,tt))&&(!rt||hasSelector($t,rt,tt))});return xt.call(At),()=>{xt.on(".drag",null)}}}},[tt,et,nt,rt,ot,st,it,at,vt]),lt}function useUpdateNodePositions(){const tt=useStoreApi();return reactExports.useCallback(nt=>{const{nodeInternals:rt,nodeExtent:it,updateNodePositions:ot,getNodes:at,snapToGrid:st,snapGrid:lt,onError:ct,nodesDraggable:ut}=tt.getState(),ht=at().filter(vt=>vt.selected&&(vt.draggable||ut&&typeof vt.draggable>"u")),dt=st?lt[0]:5,pt=st?lt[1]:5,mt=nt.isShiftPressed?4:1,gt=nt.x*dt*mt,yt=nt.y*pt*mt,bt=ht.map(vt=>{if(vt.positionAbsolute){const xt={x:vt.positionAbsolute.x+gt,y:vt.positionAbsolute.y+yt};st&&(xt.x=lt[0]*Math.round(xt.x/lt[0]),xt.y=lt[1]*Math.round(xt.y/lt[1]));const{positionAbsolute:kt,position:St}=calcNextPosition(vt,xt,rt,it,void 0,ct);vt.position=St,vt.positionAbsolute=kt}return vt});ot(bt,!0,!1)},[])}const arrowKeyDiffs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var wrapNode=tt=>{const et=({id:nt,type:rt,data:it,xPos:ot,yPos:at,xPosOrigin:st,yPosOrigin:lt,selected:ct,onClick:ut,onMouseEnter:ht,onMouseMove:dt,onMouseLeave:pt,onContextMenu:mt,onDoubleClick:gt,style:yt,className:bt,isDraggable:vt,isSelectable:xt,isConnectable:kt,isFocusable:St,selectNodesOnDrag:Tt,sourcePosition:At,targetPosition:Et,hidden:$t,resizeObserver:Dt,dragHandle:jt,zIndex:Pt,isParent:Ct,noDragClassName:wt,noPanClassName:It,initialized:Ot,disableKeyboardA11y:Wt,ariaLabel:zt,rfId:Ft})=>{const Nt=useStoreApi(),Ut=reactExports.useRef(null),Mt=reactExports.useRef(At),Ht=reactExports.useRef(Et),en=reactExports.useRef(rt),sn=xt||vt||ut||ht||dt||pt,Kt=useUpdateNodePositions(),rn=getMouseHandler(nt,Nt.getState,ht),nn=getMouseHandler(nt,Nt.getState,dt),hn=getMouseHandler(nt,Nt.getState,pt),vn=getMouseHandler(nt,Nt.getState,mt),an=getMouseHandler(nt,Nt.getState,gt),Qt=$n=>{const{nodeDragThreshold:Nn}=Nt.getState();if(xt&&(!Tt||!vt||Nn>0)&&handleNodeClick({id:nt,store:Nt,nodeRef:Ut}),ut){const Tn=Nt.getState().nodeInternals.get(nt);Tn&&ut($n,{...Tn})}},_n=$n=>{if(!isInputDOMNode($n))if(elementSelectionKeys.includes($n.key)&&xt){const Nn=$n.key==="Escape";handleNodeClick({id:nt,store:Nt,unselect:Nn,nodeRef:Ut})}else!Wt&&vt&&ct&&Object.prototype.hasOwnProperty.call(arrowKeyDiffs,$n.key)&&(Nt.setState({ariaLiveMessage:`Moved selected node ${$n.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~ot}, y: ${~~at}`}),Kt({x:arrowKeyDiffs[$n.key].x,y:arrowKeyDiffs[$n.key].y,isShiftPressed:$n.shiftKey}))};reactExports.useEffect(()=>{if(Ut.current&&!$t){const $n=Ut.current;return Dt==null||Dt.observe($n),()=>Dt==null?void 0:Dt.unobserve($n)}},[$t]),reactExports.useEffect(()=>{const $n=en.current!==rt,Nn=Mt.current!==At,Tn=Ht.current!==Et;Ut.current&&($n||Nn||Tn)&&($n&&(en.current=rt),Nn&&(Mt.current=At),Tn&&(Ht.current=Et),Nt.getState().updateNodeDimensions([{id:nt,nodeElement:Ut.current,forceUpdate:!0}]))},[nt,rt,At,Et]);const Pn=useDrag({nodeRef:Ut,disabled:$t||!vt,noDragClassName:wt,handleSelector:jt,nodeId:nt,isSelectable:xt,selectNodesOnDrag:Tt});return $t?null:React$1.createElement("div",{className:cc(["react-flow__node",`react-flow__node-${rt}`,{[It]:vt},bt,{selected:ct,selectable:xt,parent:Ct,dragging:Pn}]),ref:Ut,style:{zIndex:Pt,transform:`translate(${st}px,${lt}px)`,pointerEvents:sn?"all":"none",visibility:Ot?"visible":"hidden",...yt},"data-id":nt,"data-testid":`rf__node-${nt}`,onMouseEnter:rn,onMouseMove:nn,onMouseLeave:hn,onContextMenu:vn,onClick:Qt,onDoubleClick:an,onKeyDown:St?_n:void 0,tabIndex:St?0:void 0,role:St?"button":void 0,"aria-describedby":Wt?void 0:`${ARIA_NODE_DESC_KEY}-${Ft}`,"aria-label":zt},React$1.createElement(Provider,{value:nt},React$1.createElement(tt,{id:nt,data:it,type:rt,xPos:ot,yPos:at,selected:ct,isConnectable:kt,sourcePosition:At,targetPosition:Et,dragging:Pn,dragHandle:jt,zIndex:Pt})))};return et.displayName="NodeWrapper",reactExports.memo(et)};const selector$7=tt=>{const et=tt.getNodes().filter(nt=>nt.selected);return{...getRectOfNodes(et,tt.nodeOrigin),transformString:`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`,userSelectionActive:tt.userSelectionActive}};function NodesSelection({onSelectionContextMenu:tt,noPanClassName:et,disableKeyboardA11y:nt}){const rt=useStoreApi(),{width:it,height:ot,x:at,y:st,transformString:lt,userSelectionActive:ct}=useStore(selector$7,shallow$1),ut=useUpdateNodePositions(),ht=reactExports.useRef(null);if(reactExports.useEffect(()=>{var mt;nt||(mt=ht.current)==null||mt.focus({preventScroll:!0})},[nt]),useDrag({nodeRef:ht}),ct||!it||!ot)return null;const dt=tt?mt=>{const gt=rt.getState().getNodes().filter(yt=>yt.selected);tt(mt,gt)}:void 0,pt=mt=>{Object.prototype.hasOwnProperty.call(arrowKeyDiffs,mt.key)&&ut({x:arrowKeyDiffs[mt.key].x,y:arrowKeyDiffs[mt.key].y,isShiftPressed:mt.shiftKey})};return React$1.createElement("div",{className:cc(["react-flow__nodesselection","react-flow__container",et]),style:{transform:lt}},React$1.createElement("div",{ref:ht,className:"react-flow__nodesselection-rect",onContextMenu:dt,tabIndex:nt?void 0:-1,onKeyDown:nt?void 0:pt,style:{width:it,height:ot,top:st,left:at}}))}var NodesSelection$1=reactExports.memo(NodesSelection);const selector$6=tt=>tt.nodesSelectionActive,FlowRenderer=({children:tt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,deleteKeyCode:st,onMove:lt,onMoveStart:ct,onMoveEnd:ut,selectionKeyCode:ht,selectionOnDrag:dt,selectionMode:pt,onSelectionStart:mt,onSelectionEnd:gt,multiSelectionKeyCode:yt,panActivationKeyCode:bt,zoomActivationKeyCode:vt,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:$t,panOnDrag:Dt,defaultViewport:jt,translateExtent:Pt,minZoom:Ct,maxZoom:wt,preventScrolling:It,onSelectionContextMenu:Ot,noWheelClassName:Wt,noPanClassName:zt,disableKeyboardA11y:Ft})=>{const Nt=useStore(selector$6),Ut=useKeyPress(ht),Ht=useKeyPress(bt)||Dt,en=Ut||dt&&Ht!==!0;return useGlobalKeyHandler({deleteKeyCode:st,multiSelectionKeyCode:yt}),React$1.createElement(ZoomPane,{onMove:lt,onMoveStart:ct,onMoveEnd:ut,onPaneContextMenu:ot,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:$t,panOnDrag:!Ut&&Ht,defaultViewport:jt,translateExtent:Pt,minZoom:Ct,maxZoom:wt,zoomActivationKeyCode:vt,preventScrolling:It,noWheelClassName:Wt,noPanClassName:zt},React$1.createElement(Pane,{onSelectionStart:mt,onSelectionEnd:gt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,panOnDrag:Ht,isSelecting:!!en,selectionMode:pt},tt,Nt&&React$1.createElement(NodesSelection$1,{onSelectionContextMenu:Ot,noPanClassName:zt,disableKeyboardA11y:Ft})))};FlowRenderer.displayName="FlowRenderer";var FlowRenderer$1=reactExports.memo(FlowRenderer);function useVisibleNodes(tt){return useStore(reactExports.useCallback(nt=>tt?getNodesInside(nt.nodeInternals,{x:0,y:0,width:nt.width,height:nt.height},nt.transform,!0):nt.getNodes(),[tt]))}function createNodeTypes(tt){const et={input:wrapNode(tt.input||InputNode$1),default:wrapNode(tt.default||DefaultNode$1),output:wrapNode(tt.output||OutputNode$1),group:wrapNode(tt.group||GroupNode)},nt={},rt=Object.keys(tt).filter(it=>!["input","default","output","group"].includes(it)).reduce((it,ot)=>(it[ot]=wrapNode(tt[ot]||DefaultNode$1),it),nt);return{...et,...rt}}const getPositionWithOrigin=({x:tt,y:et,width:nt,height:rt,origin:it})=>!nt||!rt?{x:tt,y:et}:it[0]<0||it[1]<0||it[0]>1||it[1]>1?{x:tt,y:et}:{x:tt-nt*it[0],y:et-rt*it[1]},selector$5=tt=>({nodesDraggable:tt.nodesDraggable,nodesConnectable:tt.nodesConnectable,nodesFocusable:tt.nodesFocusable,elementsSelectable:tt.elementsSelectable,updateNodeDimensions:tt.updateNodeDimensions,onError:tt.onError}),NodeRenderer=tt=>{const{nodesDraggable:et,nodesConnectable:nt,nodesFocusable:rt,elementsSelectable:it,updateNodeDimensions:ot,onError:at}=useStore(selector$5,shallow$1),st=useVisibleNodes(tt.onlyRenderVisibleElements),lt=reactExports.useRef(),ct=reactExports.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const ut=new ResizeObserver(ht=>{const dt=ht.map(pt=>({id:pt.target.getAttribute("data-id"),nodeElement:pt.target,forceUpdate:!0}));ot(dt)});return lt.current=ut,ut},[]);return reactExports.useEffect(()=>()=>{var ut;(ut=lt==null?void 0:lt.current)==null||ut.disconnect()},[]),React$1.createElement("div",{className:"react-flow__nodes",style:containerStyle},st.map(ut=>{var St,Tt;let ht=ut.type||"default";tt.nodeTypes[ht]||(at==null||at("003",errorMessages.error003(ht)),ht="default");const dt=tt.nodeTypes[ht]||tt.nodeTypes.default,pt=!!(ut.draggable||et&&typeof ut.draggable>"u"),mt=!!(ut.selectable||it&&typeof ut.selectable>"u"),gt=!!(ut.connectable||nt&&typeof ut.connectable>"u"),yt=!!(ut.focusable||rt&&typeof ut.focusable>"u"),bt=tt.nodeExtent?clampPosition(ut.positionAbsolute,tt.nodeExtent):ut.positionAbsolute,vt=(bt==null?void 0:bt.x)??0,xt=(bt==null?void 0:bt.y)??0,kt=getPositionWithOrigin({x:vt,y:xt,width:ut.width??0,height:ut.height??0,origin:tt.nodeOrigin});return React$1.createElement(dt,{key:ut.id,id:ut.id,className:ut.className,style:ut.style,type:ht,data:ut.data,sourcePosition:ut.sourcePosition||Position.Bottom,targetPosition:ut.targetPosition||Position.Top,hidden:ut.hidden,xPos:vt,yPos:xt,xPosOrigin:kt.x,yPosOrigin:kt.y,selectNodesOnDrag:tt.selectNodesOnDrag,onClick:tt.onNodeClick,onMouseEnter:tt.onNodeMouseEnter,onMouseMove:tt.onNodeMouseMove,onMouseLeave:tt.onNodeMouseLeave,onContextMenu:tt.onNodeContextMenu,onDoubleClick:tt.onNodeDoubleClick,selected:!!ut.selected,isDraggable:pt,isSelectable:mt,isConnectable:gt,isFocusable:yt,resizeObserver:ct,dragHandle:ut.dragHandle,zIndex:((St=ut[internalsSymbol])==null?void 0:St.z)??0,isParent:!!((Tt=ut[internalsSymbol])!=null&&Tt.isParent),noDragClassName:tt.noDragClassName,noPanClassName:tt.noPanClassName,initialized:!!ut.width&&!!ut.height,rfId:tt.rfId,disableKeyboardA11y:tt.disableKeyboardA11y,ariaLabel:ut.ariaLabel})}))};NodeRenderer.displayName="NodeRenderer";var NodeRenderer$1=reactExports.memo(NodeRenderer);const shiftX=(tt,et,nt)=>nt===Position.Left?tt-et:nt===Position.Right?tt+et:tt,shiftY=(tt,et,nt)=>nt===Position.Top?tt-et:nt===Position.Bottom?tt+et:tt,EdgeUpdaterClassName="react-flow__edgeupdater",EdgeAnchor=({position:tt,centerX:et,centerY:nt,radius:rt=10,onMouseDown:it,onMouseEnter:ot,onMouseOut:at,type:st})=>React$1.createElement("circle",{onMouseDown:it,onMouseEnter:ot,onMouseOut:at,className:cc([EdgeUpdaterClassName,`${EdgeUpdaterClassName}-${st}`]),cx:shiftX(et,rt,tt),cy:shiftY(nt,rt,tt),r:rt,stroke:"transparent",fill:"transparent"}),alwaysValidConnection=()=>!0;var wrapEdge=tt=>{const et=({id:nt,className:rt,type:it,data:ot,onClick:at,onEdgeDoubleClick:st,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,style:yt,source:bt,target:vt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,elementsSelectable:$t,hidden:Dt,sourceHandleId:jt,targetHandleId:Pt,onContextMenu:Ct,onMouseEnter:wt,onMouseMove:It,onMouseLeave:Ot,edgeUpdaterRadius:Wt,onEdgeUpdate:zt,onEdgeUpdateStart:Ft,onEdgeUpdateEnd:Nt,markerEnd:Ut,markerStart:Mt,rfId:Ht,ariaLabel:en,isFocusable:sn,isUpdatable:Kt,pathOptions:rn,interactionWidth:nn})=>{const hn=reactExports.useRef(null),[vn,an]=reactExports.useState(!1),[Qt,_n]=reactExports.useState(!1),Pn=useStoreApi(),$n=reactExports.useMemo(()=>`url(#${getMarkerId(Mt,Ht)})`,[Mt,Ht]),Nn=reactExports.useMemo(()=>`url(#${getMarkerId(Ut,Ht)})`,[Ut,Ht]);if(Dt)return null;const Tn=Sn=>{var qn;const{edges:Rn,addSelectedEdges:jn,unselectNodesAndEdges:On,multiSelectionActive:Zn}=Pn.getState(),Vn=Rn.find(zn=>zn.id===nt);Vn&&($t&&(Pn.setState({nodesSelectionActive:!1}),Vn.selected&&Zn?(On({nodes:[],edges:[Vn]}),(qn=hn.current)==null||qn.blur()):jn([nt])),at&&at(Sn,Vn))},cn=getMouseHandler$1(nt,Pn.getState,st),mn=getMouseHandler$1(nt,Pn.getState,Ct),In=getMouseHandler$1(nt,Pn.getState,wt),An=getMouseHandler$1(nt,Pn.getState,It),wn=getMouseHandler$1(nt,Pn.getState,Ot),fn=(Sn,Rn)=>{if(Sn.button!==0)return;const{edges:jn,isValidConnection:On}=Pn.getState(),Zn=Rn?vt:bt,Vn=(Rn?Pt:jt)||null,qn=Rn?"target":"source",zn=On||alwaysValidConnection,Jn=Rn,Hn=jn.find(xr=>xr.id===nt);_n(!0),Ft==null||Ft(Sn,Hn,qn);const pr=xr=>{_n(!1),Nt==null||Nt(xr,Hn,qn)};handlePointerDown({event:Sn,handleId:Vn,nodeId:Zn,onConnect:xr=>zt==null?void 0:zt(Hn,xr),isTarget:Jn,getState:Pn.getState,setState:Pn.setState,isValidConnection:zn,edgeUpdaterType:qn,onEdgeUpdateEnd:pr})},pn=Sn=>fn(Sn,!0),kn=Sn=>fn(Sn,!1),Dn=()=>an(!0),un=()=>an(!1),Zt=!$t&&!at,Xt=Sn=>{var Rn;if(elementSelectionKeys.includes(Sn.key)&&$t){const{unselectNodesAndEdges:jn,addSelectedEdges:On,edges:Zn}=Pn.getState();Sn.key==="Escape"?((Rn=hn.current)==null||Rn.blur(),jn({edges:[Zn.find(qn=>qn.id===nt)]})):On([nt])}};return React$1.createElement("g",{className:cc(["react-flow__edge",`react-flow__edge-${it}`,rt,{selected:lt,animated:ct,inactive:Zt,updating:vn}]),onClick:Tn,onDoubleClick:cn,onContextMenu:mn,onMouseEnter:In,onMouseMove:An,onMouseLeave:wn,onKeyDown:sn?Xt:void 0,tabIndex:sn?0:void 0,role:sn?"button":"img","data-testid":`rf__edge-${nt}`,"aria-label":en===null?void 0:en||`Edge from ${bt} to ${vt}`,"aria-describedby":sn?`${ARIA_EDGE_DESC_KEY}-${Ht}`:void 0,ref:hn},!Qt&&React$1.createElement(tt,{id:nt,source:bt,target:vt,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,data:ot,style:yt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,sourceHandleId:jt,targetHandleId:Pt,markerStart:$n,markerEnd:Nn,pathOptions:rn,interactionWidth:nn}),Kt&&React$1.createElement(React$1.Fragment,null,(Kt==="source"||Kt===!0)&&React$1.createElement(EdgeAnchor,{position:At,centerX:xt,centerY:kt,radius:Wt,onMouseDown:pn,onMouseEnter:Dn,onMouseOut:un,type:"source"}),(Kt==="target"||Kt===!0)&&React$1.createElement(EdgeAnchor,{position:Et,centerX:St,centerY:Tt,radius:Wt,onMouseDown:kn,onMouseEnter:Dn,onMouseOut:un,type:"target"})))};return et.displayName="EdgeWrapper",reactExports.memo(et)};function createEdgeTypes(tt){const et={default:wrapEdge(tt.default||BezierEdge),straight:wrapEdge(tt.bezier||StraightEdge),step:wrapEdge(tt.step||StepEdge),smoothstep:wrapEdge(tt.step||SmoothStepEdge),simplebezier:wrapEdge(tt.simplebezier||SimpleBezierEdge)},nt={},rt=Object.keys(tt).filter(it=>!["default","bezier"].includes(it)).reduce((it,ot)=>(it[ot]=wrapEdge(tt[ot]||BezierEdge),it),nt);return{...et,...rt}}function getHandlePosition(tt,et,nt=null){const rt=((nt==null?void 0:nt.x)||0)+et.x,it=((nt==null?void 0:nt.y)||0)+et.y,ot=(nt==null?void 0:nt.width)||et.width,at=(nt==null?void 0:nt.height)||et.height;switch(tt){case Position.Top:return{x:rt+ot/2,y:it};case Position.Right:return{x:rt+ot,y:it+at/2};case Position.Bottom:return{x:rt+ot/2,y:it+at};case Position.Left:return{x:rt,y:it+at/2}}}function getHandle(tt,et){return tt?tt.length===1||!et?tt[0]:et&&tt.find(nt=>nt.id===et)||null:null}const getEdgePositions=(tt,et,nt,rt,it,ot)=>{const at=getHandlePosition(nt,tt,et),st=getHandlePosition(ot,rt,it);return{sourceX:at.x,sourceY:at.y,targetX:st.x,targetY:st.y}};function isEdgeVisible({sourcePos:tt,targetPos:et,sourceWidth:nt,sourceHeight:rt,targetWidth:it,targetHeight:ot,width:at,height:st,transform:lt}){const ct={x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x+nt,et.x+it),y2:Math.max(tt.y+rt,et.y+ot)};ct.x===ct.x2&&(ct.x2+=1),ct.y===ct.y2&&(ct.y2+=1);const ut=rectToBox({x:(0-lt[0])/lt[2],y:(0-lt[1])/lt[2],width:at/lt[2],height:st/lt[2]}),ht=Math.max(0,Math.min(ut.x2,ct.x2)-Math.max(ut.x,ct.x)),dt=Math.max(0,Math.min(ut.y2,ct.y2)-Math.max(ut.y,ct.y));return Math.ceil(ht*dt)>0}function getNodeData(tt){var rt,it,ot,at,st;const et=((rt=tt==null?void 0:tt[internalsSymbol])==null?void 0:rt.handleBounds)||null,nt=et&&(tt==null?void 0:tt.width)&&(tt==null?void 0:tt.height)&&typeof((it=tt==null?void 0:tt.positionAbsolute)==null?void 0:it.x)<"u"&&typeof((ot=tt==null?void 0:tt.positionAbsolute)==null?void 0:ot.y)<"u";return[{x:((at=tt==null?void 0:tt.positionAbsolute)==null?void 0:at.x)||0,y:((st=tt==null?void 0:tt.positionAbsolute)==null?void 0:st.y)||0,width:(tt==null?void 0:tt.width)||0,height:(tt==null?void 0:tt.height)||0},et,!!nt]}const defaultEdgeTree=[{level:0,isMaxLevel:!0,edges:[]}];function groupEdgesByZLevel(tt,et,nt=!1){let rt=-1;const it=tt.reduce((at,st)=>{var ut,ht;const lt=isNumeric(st.zIndex);let ct=lt?st.zIndex:0;if(nt){const dt=et.get(st.target),pt=et.get(st.source),mt=st.selected||(dt==null?void 0:dt.selected)||(pt==null?void 0:pt.selected),gt=Math.max(((ut=pt==null?void 0:pt[internalsSymbol])==null?void 0:ut.z)||0,((ht=dt==null?void 0:dt[internalsSymbol])==null?void 0:ht.z)||0,1e3);ct=(lt?st.zIndex:0)+(mt?gt:0)}return at[ct]?at[ct].push(st):at[ct]=[st],rt=ct>rt?ct:rt,at},{}),ot=Object.entries(it).map(([at,st])=>{const lt=+at;return{edges:st,level:lt,isMaxLevel:lt===rt}});return ot.length===0?defaultEdgeTree:ot}function useVisibleEdges(tt,et,nt){const rt=useStore(reactExports.useCallback(it=>tt?it.edges.filter(ot=>{const at=et.get(ot.source),st=et.get(ot.target);return(at==null?void 0:at.width)&&(at==null?void 0:at.height)&&(st==null?void 0:st.width)&&(st==null?void 0:st.height)&&isEdgeVisible({sourcePos:at.positionAbsolute||{x:0,y:0},targetPos:st.positionAbsolute||{x:0,y:0},sourceWidth:at.width,sourceHeight:at.height,targetWidth:st.width,targetHeight:st.height,width:it.width,height:it.height,transform:it.transform})}):it.edges,[tt,et]));return groupEdgesByZLevel(rt,et,nt)}const ArrowSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ArrowClosedSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,fill:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),MarkerSymbols={[MarkerType.Arrow]:ArrowSymbol,[MarkerType.ArrowClosed]:ArrowClosedSymbol};function useMarkerSymbol(tt){const et=useStoreApi();return reactExports.useMemo(()=>{var it,ot;return Object.prototype.hasOwnProperty.call(MarkerSymbols,tt)?MarkerSymbols[tt]:((ot=(it=et.getState()).onError)==null||ot.call(it,"009",errorMessages.error009(tt)),null)},[tt])}const Marker=({id:tt,type:et,color:nt,width:rt=12.5,height:it=12.5,markerUnits:ot="strokeWidth",strokeWidth:at,orient:st="auto-start-reverse"})=>{const lt=useMarkerSymbol(et);return lt?React$1.createElement("marker",{className:"react-flow__arrowhead",id:tt,markerWidth:`${rt}`,markerHeight:`${it}`,viewBox:"-10 -10 20 20",markerUnits:ot,orient:st,refX:"0",refY:"0"},React$1.createElement(lt,{color:nt,strokeWidth:at})):null},markerSelector=({defaultColor:tt,rfId:et})=>nt=>{const rt=[];return nt.edges.reduce((it,ot)=>([ot.markerStart,ot.markerEnd].forEach(at=>{if(at&&typeof at=="object"){const st=getMarkerId(at,et);rt.includes(st)||(it.push({id:st,color:at.color||tt,...at}),rt.push(st))}}),it),[]).sort((it,ot)=>it.id.localeCompare(ot.id))},MarkerDefinitions=({defaultColor:tt,rfId:et})=>{const nt=useStore(reactExports.useCallback(markerSelector({defaultColor:tt,rfId:et}),[tt,et]),(rt,it)=>!(rt.length!==it.length||rt.some((ot,at)=>ot.id!==it[at].id)));return React$1.createElement("defs",null,nt.map(rt=>React$1.createElement(Marker,{id:rt.id,key:rt.id,type:rt.type,color:rt.color,width:rt.width,height:rt.height,markerUnits:rt.markerUnits,strokeWidth:rt.strokeWidth,orient:rt.orient})))};MarkerDefinitions.displayName="MarkerDefinitions";var MarkerDefinitions$1=reactExports.memo(MarkerDefinitions);const selector$4=tt=>({nodesConnectable:tt.nodesConnectable,edgesFocusable:tt.edgesFocusable,edgesUpdatable:tt.edgesUpdatable,elementsSelectable:tt.elementsSelectable,width:tt.width,height:tt.height,connectionMode:tt.connectionMode,nodeInternals:tt.nodeInternals,onError:tt.onError}),EdgeRenderer=({defaultMarkerColor:tt,onlyRenderVisibleElements:et,elevateEdgesOnSelect:nt,rfId:rt,edgeTypes:it,noPanClassName:ot,onEdgeUpdate:at,onEdgeContextMenu:st,onEdgeMouseEnter:lt,onEdgeMouseMove:ct,onEdgeMouseLeave:ut,onEdgeClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,children:yt})=>{const{edgesFocusable:bt,edgesUpdatable:vt,elementsSelectable:xt,width:kt,height:St,connectionMode:Tt,nodeInternals:At,onError:Et}=useStore(selector$4,shallow$1),$t=useVisibleEdges(et,At,nt);return kt?React$1.createElement(React$1.Fragment,null,$t.map(({level:Dt,edges:jt,isMaxLevel:Pt})=>React$1.createElement("svg",{key:Dt,style:{zIndex:Dt},width:kt,height:St,className:"react-flow__edges react-flow__container"},Pt&&React$1.createElement(MarkerDefinitions$1,{defaultColor:tt,rfId:rt}),React$1.createElement("g",null,jt.map(Ct=>{const[wt,It,Ot]=getNodeData(At.get(Ct.source)),[Wt,zt,Ft]=getNodeData(At.get(Ct.target));if(!Ot||!Ft)return null;let Nt=Ct.type||"default";it[Nt]||(Et==null||Et("011",errorMessages.error011(Nt)),Nt="default");const Ut=it[Nt]||it.default,Mt=Tt===ConnectionMode.Strict?zt.target:(zt.target??[]).concat(zt.source??[]),Ht=getHandle(It.source,Ct.sourceHandle),en=getHandle(Mt,Ct.targetHandle),sn=(Ht==null?void 0:Ht.position)||Position.Bottom,Kt=(en==null?void 0:en.position)||Position.Top,rn=!!(Ct.focusable||bt&&typeof Ct.focusable>"u"),nn=typeof at<"u"&&(Ct.updatable||vt&&typeof Ct.updatable>"u");if(!Ht||!en)return Et==null||Et("008",errorMessages.error008(Ht,Ct)),null;const{sourceX:hn,sourceY:vn,targetX:an,targetY:Qt}=getEdgePositions(wt,Ht,sn,Wt,en,Kt);return React$1.createElement(Ut,{key:Ct.id,id:Ct.id,className:cc([Ct.className,ot]),type:Nt,data:Ct.data,selected:!!Ct.selected,animated:!!Ct.animated,hidden:!!Ct.hidden,label:Ct.label,labelStyle:Ct.labelStyle,labelShowBg:Ct.labelShowBg,labelBgStyle:Ct.labelBgStyle,labelBgPadding:Ct.labelBgPadding,labelBgBorderRadius:Ct.labelBgBorderRadius,style:Ct.style,source:Ct.source,target:Ct.target,sourceHandleId:Ct.sourceHandle,targetHandleId:Ct.targetHandle,markerEnd:Ct.markerEnd,markerStart:Ct.markerStart,sourceX:hn,sourceY:vn,targetX:an,targetY:Qt,sourcePosition:sn,targetPosition:Kt,elementsSelectable:xt,onEdgeUpdate:at,onContextMenu:st,onMouseEnter:lt,onMouseMove:ct,onMouseLeave:ut,onClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,rfId:rt,ariaLabel:Ct.ariaLabel,isFocusable:rn,isUpdatable:nn,pathOptions:"pathOptions"in Ct?Ct.pathOptions:void 0,interactionWidth:Ct.interactionWidth})})))),yt):null};EdgeRenderer.displayName="EdgeRenderer";var EdgeRenderer$1=reactExports.memo(EdgeRenderer);const selector$3=tt=>`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`;function Viewport({children:tt}){const et=useStore(selector$3);return React$1.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:et}},tt)}function useOnInitHandler(tt){const et=useReactFlow(),nt=reactExports.useRef(!1);reactExports.useEffect(()=>{!nt.current&&et.viewportInitialized&&tt&&(setTimeout(()=>tt(et),1),nt.current=!0)},[tt,et.viewportInitialized])}const oppositePosition={[Position.Left]:Position.Right,[Position.Right]:Position.Left,[Position.Top]:Position.Bottom,[Position.Bottom]:Position.Top},ConnectionLine=({nodeId:tt,handleType:et,style:nt,type:rt=ConnectionLineType.Bezier,CustomComponent:it,connectionStatus:ot})=>{var Tt,At,Et;const{fromNode:at,handleId:st,toX:lt,toY:ct,connectionMode:ut}=useStore(reactExports.useCallback($t=>({fromNode:$t.nodeInternals.get(tt),handleId:$t.connectionHandleId,toX:($t.connectionPosition.x-$t.transform[0])/$t.transform[2],toY:($t.connectionPosition.y-$t.transform[1])/$t.transform[2],connectionMode:$t.connectionMode}),[tt]),shallow$1),ht=(Tt=at==null?void 0:at[internalsSymbol])==null?void 0:Tt.handleBounds;let dt=ht==null?void 0:ht[et];if(ut===ConnectionMode.Loose&&(dt=dt||(ht==null?void 0:ht[et==="source"?"target":"source"])),!at||!dt)return null;const pt=st?dt.find($t=>$t.id===st):dt[0],mt=pt?pt.x+pt.width/2:(at.width??0)/2,gt=pt?pt.y+pt.height/2:at.height??0,yt=(((At=at.positionAbsolute)==null?void 0:At.x)??0)+mt,bt=(((Et=at.positionAbsolute)==null?void 0:Et.y)??0)+gt,vt=pt==null?void 0:pt.position,xt=vt?oppositePosition[vt]:null;if(!vt||!xt)return null;if(it)return React$1.createElement(it,{connectionLineType:rt,connectionLineStyle:nt,fromNode:at,fromHandle:pt,fromX:yt,fromY:bt,toX:lt,toY:ct,fromPosition:vt,toPosition:xt,connectionStatus:ot});let kt="";const St={sourceX:yt,sourceY:bt,sourcePosition:vt,targetX:lt,targetY:ct,targetPosition:xt};return rt===ConnectionLineType.Bezier?[kt]=getBezierPath(St):rt===ConnectionLineType.Step?[kt]=getSmoothStepPath({...St,borderRadius:0}):rt===ConnectionLineType.SmoothStep?[kt]=getSmoothStepPath(St):rt===ConnectionLineType.SimpleBezier?[kt]=getSimpleBezierPath(St):kt=`M${yt},${bt} ${lt},${ct}`,React$1.createElement("path",{d:kt,fill:"none",className:"react-flow__connection-path",style:nt})};ConnectionLine.displayName="ConnectionLine";const selector$2=tt=>({nodeId:tt.connectionNodeId,handleType:tt.connectionHandleType,nodesConnectable:tt.nodesConnectable,connectionStatus:tt.connectionStatus,width:tt.width,height:tt.height});function ConnectionLineWrapper({containerStyle:tt,style:et,type:nt,component:rt}){const{nodeId:it,handleType:ot,nodesConnectable:at,width:st,height:lt,connectionStatus:ct}=useStore(selector$2,shallow$1);return!(it&&ot&&st&&at)?null:React$1.createElement("svg",{style:tt,width:st,height:lt,className:"react-flow__edges react-flow__connectionline react-flow__container"},React$1.createElement("g",{className:cc(["react-flow__connection",ct])},React$1.createElement(ConnectionLine,{nodeId:it,handleType:ot,style:et,type:nt,CustomComponent:rt,connectionStatus:ct})))}function useNodeOrEdgeTypes(tt,et){return reactExports.useRef(null),useStoreApi(),reactExports.useMemo(()=>et(tt),[tt])}const GraphView=({nodeTypes:tt,edgeTypes:et,onMove:nt,onMoveStart:rt,onMoveEnd:it,onInit:ot,onNodeClick:at,onEdgeClick:st,onNodeDoubleClick:lt,onEdgeDoubleClick:ct,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,onSelectionContextMenu:mt,onSelectionStart:gt,onSelectionEnd:yt,connectionLineType:bt,connectionLineStyle:vt,connectionLineComponent:xt,connectionLineContainerStyle:kt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,multiSelectionKeyCode:Et,panActivationKeyCode:$t,zoomActivationKeyCode:Dt,deleteKeyCode:jt,onlyRenderVisibleElements:Pt,elementsSelectable:Ct,selectNodesOnDrag:wt,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,preventScrolling:Ft,defaultMarkerColor:Nt,zoomOnScroll:Ut,zoomOnPinch:Mt,panOnScroll:Ht,panOnScrollSpeed:en,panOnScrollMode:sn,zoomOnDoubleClick:Kt,panOnDrag:rn,onPaneClick:nn,onPaneMouseEnter:hn,onPaneMouseMove:vn,onPaneMouseLeave:an,onPaneScroll:Qt,onPaneContextMenu:_n,onEdgeUpdate:Pn,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:Tn,onEdgeMouseLeave:cn,edgeUpdaterRadius:mn,onEdgeUpdateStart:In,onEdgeUpdateEnd:An,noDragClassName:wn,noWheelClassName:fn,noPanClassName:pn,elevateEdgesOnSelect:kn,disableKeyboardA11y:Dn,nodeOrigin:un,nodeExtent:Zt,rfId:Xt})=>{const Sn=useNodeOrEdgeTypes(tt,createNodeTypes),Rn=useNodeOrEdgeTypes(et,createEdgeTypes);return useOnInitHandler(ot),React$1.createElement(FlowRenderer$1,{onPaneClick:nn,onPaneMouseEnter:hn,onPaneMouseMove:vn,onPaneMouseLeave:an,onPaneContextMenu:_n,onPaneScroll:Qt,deleteKeyCode:jt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,onSelectionStart:gt,onSelectionEnd:yt,multiSelectionKeyCode:Et,panActivationKeyCode:$t,zoomActivationKeyCode:Dt,elementsSelectable:Ct,onMove:nt,onMoveStart:rt,onMoveEnd:it,zoomOnScroll:Ut,zoomOnPinch:Mt,zoomOnDoubleClick:Kt,panOnScroll:Ht,panOnScrollSpeed:en,panOnScrollMode:sn,panOnDrag:rn,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,onSelectionContextMenu:mt,preventScrolling:Ft,noDragClassName:wn,noWheelClassName:fn,noPanClassName:pn,disableKeyboardA11y:Dn},React$1.createElement(Viewport,null,React$1.createElement(EdgeRenderer$1,{edgeTypes:Rn,onEdgeClick:st,onEdgeDoubleClick:ct,onEdgeUpdate:Pn,onlyRenderVisibleElements:Pt,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:Tn,onEdgeMouseLeave:cn,onEdgeUpdateStart:In,onEdgeUpdateEnd:An,edgeUpdaterRadius:mn,defaultMarkerColor:Nt,noPanClassName:pn,elevateEdgesOnSelect:!!kn,disableKeyboardA11y:Dn,rfId:Xt},React$1.createElement(ConnectionLineWrapper,{style:vt,type:bt,component:xt,containerStyle:kt})),React$1.createElement("div",{className:"react-flow__edgelabel-renderer"}),React$1.createElement(NodeRenderer$1,{nodeTypes:Sn,onNodeClick:at,onNodeDoubleClick:lt,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,selectNodesOnDrag:wt,onlyRenderVisibleElements:Pt,noPanClassName:pn,noDragClassName:wn,disableKeyboardA11y:Dn,nodeOrigin:un,nodeExtent:Zt,rfId:Xt})))};GraphView.displayName="GraphView";var GraphView$1=reactExports.memo(GraphView);const infiniteExtent=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],initialState={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:infiniteExtent,nodeExtent:infiniteExtent,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ConnectionMode.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,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:devWarn,isValidConnection:void 0},createRFStore=()=>createWithEqualityFn((tt,et)=>({...initialState,setNodes:nt=>{const{nodeInternals:rt,nodeOrigin:it,elevateNodesOnSelect:ot}=et();tt({nodeInternals:createNodeInternals(nt,rt,it,ot)})},getNodes:()=>Array.from(et().nodeInternals.values()),setEdges:nt=>{const{defaultEdgeOptions:rt={}}=et();tt({edges:nt.map(it=>({...rt,...it}))})},setDefaultNodesAndEdges:(nt,rt)=>{const it=typeof nt<"u",ot=typeof rt<"u",at=it?createNodeInternals(nt,new Map,et().nodeOrigin,et().elevateNodesOnSelect):new Map;tt({nodeInternals:at,edges:ot?rt:[],hasDefaultNodes:it,hasDefaultEdges:ot})},updateNodeDimensions:nt=>{const{onNodesChange:rt,nodeInternals:it,fitViewOnInit:ot,fitViewOnInitDone:at,fitViewOnInitOptions:st,domNode:lt,nodeOrigin:ct}=et(),ut=lt==null?void 0:lt.querySelector(".react-flow__viewport");if(!ut)return;const ht=window.getComputedStyle(ut),{m22:dt}=new window.DOMMatrixReadOnly(ht.transform),pt=nt.reduce((gt,yt)=>{const bt=it.get(yt.id);if(bt){const vt=getDimensions(yt.nodeElement);!!(vt.width&&vt.height&&(bt.width!==vt.width||bt.height!==vt.height||yt.forceUpdate))&&(it.set(bt.id,{...bt,[internalsSymbol]:{...bt[internalsSymbol],handleBounds:{source:getHandleBounds(".source",yt.nodeElement,dt,ct),target:getHandleBounds(".target",yt.nodeElement,dt,ct)}},...vt}),gt.push({id:bt.id,type:"dimensions",dimensions:vt}))}return gt},[]);updateAbsoluteNodePositions(it,ct);const mt=at||ot&&!at&&fitView(et,{initial:!0,...st});tt({nodeInternals:new Map(it),fitViewOnInitDone:mt}),(pt==null?void 0:pt.length)>0&&(rt==null||rt(pt))},updateNodePositions:(nt,rt=!0,it=!1)=>{const{triggerNodeChanges:ot}=et(),at=nt.map(st=>{const lt={id:st.id,type:"position",dragging:it};return rt&&(lt.positionAbsolute=st.positionAbsolute,lt.position=st.position),lt});ot(at)},triggerNodeChanges:nt=>{const{onNodesChange:rt,nodeInternals:it,hasDefaultNodes:ot,nodeOrigin:at,getNodes:st,elevateNodesOnSelect:lt}=et();if(nt!=null&&nt.length){if(ot){const ct=applyNodeChanges(nt,st()),ut=createNodeInternals(ct,it,at,lt);tt({nodeInternals:ut})}rt==null||rt(nt)}},addSelectedNodes:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(ot(),nt),st=getSelectionChanges(it,[])),updateNodesAndEdgesSelections({changedNodes:at,changedEdges:st,get:et,set:tt})},addSelectedEdges:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(it,nt),st=getSelectionChanges(ot(),[])),updateNodesAndEdgesSelections({changedNodes:st,changedEdges:at,get:et,set:tt})},unselectNodesAndEdges:({nodes:nt,edges:rt}={})=>{const{edges:it,getNodes:ot}=et(),at=nt||ot(),st=rt||it,lt=at.map(ut=>(ut.selected=!1,createSelectionChange(ut.id,!1))),ct=st.map(ut=>createSelectionChange(ut.id,!1));updateNodesAndEdgesSelections({changedNodes:lt,changedEdges:ct,get:et,set:tt})},setMinZoom:nt=>{const{d3Zoom:rt,maxZoom:it}=et();rt==null||rt.scaleExtent([nt,it]),tt({minZoom:nt})},setMaxZoom:nt=>{const{d3Zoom:rt,minZoom:it}=et();rt==null||rt.scaleExtent([it,nt]),tt({maxZoom:nt})},setTranslateExtent:nt=>{var rt;(rt=et().d3Zoom)==null||rt.translateExtent(nt),tt({translateExtent:nt})},resetSelectedElements:()=>{const{edges:nt,getNodes:rt}=et(),ot=rt().filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1)),at=nt.filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1));updateNodesAndEdgesSelections({changedNodes:ot,changedEdges:at,get:et,set:tt})},setNodeExtent:nt=>{const{nodeInternals:rt}=et();rt.forEach(it=>{it.positionAbsolute=clampPosition(it.position,nt)}),tt({nodeExtent:nt,nodeInternals:new Map(rt)})},panBy:nt=>{const{transform:rt,width:it,height:ot,d3Zoom:at,d3Selection:st,translateExtent:lt}=et();if(!at||!st||!nt.x&&!nt.y)return!1;const ct=identity.translate(rt[0]+nt.x,rt[1]+nt.y).scale(rt[2]),ut=[[0,0],[it,ot]],ht=at==null?void 0:at.constrain()(ct,ut,lt);return at.transform(st,ht),rt[0]!==ht.x||rt[1]!==ht.y||rt[2]!==ht.k},cancelConnection:()=>tt({connectionNodeId:initialState.connectionNodeId,connectionHandleId:initialState.connectionHandleId,connectionHandleType:initialState.connectionHandleType,connectionStatus:initialState.connectionStatus,connectionStartHandle:initialState.connectionStartHandle,connectionEndHandle:initialState.connectionEndHandle}),reset:()=>tt({...initialState})}),Object.is),ReactFlowProvider=({children:tt})=>{const et=reactExports.useRef(null);return et.current||(et.current=createRFStore()),React$1.createElement(Provider$1,{value:et.current},tt)};ReactFlowProvider.displayName="ReactFlowProvider";const Wrapper$e=({children:tt})=>reactExports.useContext(StoreContext)?React$1.createElement(React$1.Fragment,null,tt):React$1.createElement(ReactFlowProvider,null,tt);Wrapper$e.displayName="ReactFlowWrapper";const defaultNodeTypes={input:InputNode$1,default:DefaultNode$1,output:OutputNode$1,group:GroupNode},defaultEdgeTypes={default:BezierEdge,straight:StraightEdge,step:StepEdge,smoothstep:SmoothStepEdge,simplebezier:SimpleBezierEdge},initNodeOrigin=[0,0],initSnapGrid=[15,15],initDefaultViewport={x:0,y:0,zoom:1},wrapperStyle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},ReactFlow=reactExports.forwardRef(({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,className:it,nodeTypes:ot=defaultNodeTypes,edgeTypes:at=defaultEdgeTypes,onNodeClick:st,onEdgeClick:lt,onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,onNodeMouseEnter:vt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:$t,onNodesDelete:Dt,onEdgesDelete:jt,onSelectionChange:Pt,onSelectionDragStart:Ct,onSelectionDrag:wt,onSelectionDragStop:It,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,connectionMode:Ft=ConnectionMode.Strict,connectionLineType:Nt=ConnectionLineType.Bezier,connectionLineStyle:Ut,connectionLineComponent:Mt,connectionLineContainerStyle:Ht,deleteKeyCode:en="Backspace",selectionKeyCode:sn="Shift",selectionOnDrag:Kt=!1,selectionMode:rn=SelectionMode.Full,panActivationKeyCode:nn="Space",multiSelectionKeyCode:hn=isMacOs()?"Meta":"Control",zoomActivationKeyCode:vn=isMacOs()?"Meta":"Control",snapToGrid:an=!1,snapGrid:Qt=initSnapGrid,onlyRenderVisibleElements:_n=!1,selectNodesOnDrag:Pn=!0,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:Tn,nodeOrigin:cn=initNodeOrigin,edgesFocusable:mn,edgesUpdatable:In,elementsSelectable:An,defaultViewport:wn=initDefaultViewport,minZoom:fn=.5,maxZoom:pn=2,translateExtent:kn=infiniteExtent,preventScrolling:Dn=!0,nodeExtent:un,defaultMarkerColor:Zt="#b1b1b7",zoomOnScroll:Xt=!0,zoomOnPinch:Sn=!0,panOnScroll:Rn=!1,panOnScrollSpeed:jn=.5,panOnScrollMode:On=PanOnScrollMode.Free,zoomOnDoubleClick:Zn=!0,panOnDrag:Vn=!0,onPaneClick:qn,onPaneMouseEnter:zn,onPaneMouseMove:Jn,onPaneMouseLeave:Hn,onPaneScroll:pr,onPaneContextMenu:fr,children:xr,onEdgeUpdate:io,onEdgeContextMenu:Tr,onEdgeDoubleClick:Ar,onEdgeMouseEnter:qr,onEdgeMouseMove:jr,onEdgeMouseLeave:Fr,onEdgeUpdateStart:ao,onEdgeUpdateEnd:Yr,edgeUpdaterRadius:Dr=10,onNodesChange:go,onEdgesChange:xn,noDragClassName:Mn="nodrag",noWheelClassName:dn="nowheel",noPanClassName:Jt="nopan",fitView:En=!1,fitViewOptions:Ln,connectOnClick:Un=!0,attributionPosition:Kn,proOptions:nr,defaultEdgeOptions:lr,elevateNodesOnSelect:cr=!0,elevateEdgesOnSelect:Hr=!1,disableKeyboardA11y:vr=!1,autoPanOnConnect:Nr=!0,autoPanOnNodeDrag:Gr=!0,connectionRadius:eo=20,isValidConnection:Zr,onError:Jr,style:wr,id:Mr,nodeDragThreshold:Ur,...Rr},Pr)=>{const Lr=Mr||"1";return React$1.createElement("div",{...Rr,style:{...wr,...wrapperStyle},ref:Pr,className:cc(["react-flow",it]),"data-testid":"rf__wrapper",id:Mr},React$1.createElement(Wrapper$e,null,React$1.createElement(GraphView$1,{onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onNodeClick:st,onEdgeClick:lt,onNodeMouseEnter:vt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,nodeTypes:ot,edgeTypes:at,connectionLineType:Nt,connectionLineStyle:Ut,connectionLineComponent:Mt,connectionLineContainerStyle:Ht,selectionKeyCode:sn,selectionOnDrag:Kt,selectionMode:rn,deleteKeyCode:en,multiSelectionKeyCode:hn,panActivationKeyCode:nn,zoomActivationKeyCode:vn,onlyRenderVisibleElements:_n,selectNodesOnDrag:Pn,defaultViewport:wn,translateExtent:kn,minZoom:fn,maxZoom:pn,preventScrolling:Dn,zoomOnScroll:Xt,zoomOnPinch:Sn,zoomOnDoubleClick:Zn,panOnScroll:Rn,panOnScrollSpeed:jn,panOnScrollMode:On,panOnDrag:Vn,onPaneClick:qn,onPaneMouseEnter:zn,onPaneMouseMove:Jn,onPaneMouseLeave:Hn,onPaneScroll:pr,onPaneContextMenu:fr,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,onEdgeUpdate:io,onEdgeContextMenu:Tr,onEdgeDoubleClick:Ar,onEdgeMouseEnter:qr,onEdgeMouseMove:jr,onEdgeMouseLeave:Fr,onEdgeUpdateStart:ao,onEdgeUpdateEnd:Yr,edgeUpdaterRadius:Dr,defaultMarkerColor:Zt,noDragClassName:Mn,noWheelClassName:dn,noPanClassName:Jt,elevateEdgesOnSelect:Hr,rfId:Lr,disableKeyboardA11y:vr,nodeOrigin:cn,nodeExtent:un}),React$1.createElement(StoreUpdater,{nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:Tn,edgesFocusable:mn,edgesUpdatable:In,elementsSelectable:An,elevateNodesOnSelect:cr,minZoom:fn,maxZoom:pn,nodeExtent:un,onNodesChange:go,onEdgesChange:xn,snapToGrid:an,snapGrid:Qt,connectionMode:Ft,translateExtent:kn,connectOnClick:Un,defaultEdgeOptions:lr,fitView:En,fitViewOptions:Ln,onNodesDelete:Dt,onEdgesDelete:jt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:$t,onSelectionDrag:wt,onSelectionDragStart:Ct,onSelectionDragStop:It,noPanClassName:Jt,nodeOrigin:cn,rfId:Lr,autoPanOnConnect:Nr,autoPanOnNodeDrag:Gr,onError:Jr,connectionRadius:eo,isValidConnection:Zr,nodeDragThreshold:Ur}),React$1.createElement(Wrapper$1$1,{onSelectionChange:Pt}),xr,React$1.createElement(Attribution,{proOptions:nr,position:Kn}),React$1.createElement(A11yDescriptions,{rfId:Lr,disableKeyboardA11y:vr})))});ReactFlow.displayName="ReactFlow";const style="",TeachMe=()=>{const[tt,et]=useDataStore(pt=>[pt.data,pt.setTeachMe]),[nt,rt]=useAppStore(pt=>[pt.currentSearch,pt.setSidebarOpen]),it=reactExports.useRef(!1),ot=useSocket(),[at,st,lt,ct]=useTeachStore(pt=>[pt.setTeachMeAnswer,pt.setHasTeachingInProgress,pt.setInstagraphAnswer,pt.setHasInstagraphInProgress]),ut=reactExports.useCallback(pt=>{at(pt.tutorial),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Tutorial is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[at]),ht=reactExports.useCallback(pt=>{lt(pt),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Instagraph is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[lt]);reactExports.useEffect(()=>{it.current||(ut&&ot&&(ot.on("teachmehook",ut),it.current=!0),ht&&ot&&(ot.on("instagraphhook",ht),it.current=!0))},[ot,ut,ht]);const dt=async()=>{if(nt){st(!0),ct(!0),rt(!0),et(!0);try{const pt=tt==null?void 0:tt.nodes.filter(yt=>yt.text),mt=pt==null?void 0:pt.slice(0,5),gt=(mt!=null&&mt.length?mt.map(yt=>yt.text).join(" "):"").substring(0,2500).replace(/[?&=+/#]/g,yt=>`\\${yt}`);await distExports$1.enable(),await postTeachMe({term:nt,transcripts:gt}),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing tutorial for you"}),{type:"success"}),await postInstagraph({term:nt,transcripts:gt}),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing an instagraph for you"}),{type:"success"})}catch{st(!1),ct(!1)}}};return jsxRuntimeExports.jsx(ButtonStyled,{onClick:()=>dt(),children:"Teach me"})},TeachMeLoader=({text:tt})=>jsxRuntimeExports.jsxs(Flex,{align:"center",justify:"center",py:12,children:[jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(Text$3,{children:tt})})]}),TeachMeText=()=>{const[tt,et,nt,rt]=useTeachStore(ot=>[ot.teachMeAnswer,ot.hasTeachingInProgress,ot.instgraphAnswser,ot.hasInstagraphInProgress]),it=!rt&&!!(nt!=null&&nt.edges)&&!!(nt!=null&&nt.nodes);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[it?jsxRuntimeExports.jsx(ReactFlow,{edges:nt==null?void 0:nt.edges,nodes:nt==null?void 0:nt.nodes}):jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating instagraph"}),et?jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating tutorial"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TeachMeAnswerFlex,{children:jsxRuntimeExports.jsx(Text$3,{children:tt})}),jsxRuntimeExports.jsx(AskQuestion,{})]})]})},ButtonStyled=styled$4(Button$2)``,TeachMeAnswerFlex=styled$4(Flex)` +`,emptyValue={},HelperContext=reactExports.createContext(emptyValue),useHelper=()=>reactExports.useContext(HelperContext);function cc(tt){if(typeof tt=="string"||typeof tt=="number")return""+tt;let et="";if(Array.isArray(tt))for(let nt=0,rt;nt{const nt=createStore$3(tt),rt=(it,ot=et)=>useStoreWithEqualityFn(nt,it,ot);return Object.assign(rt,nt),rt},createWithEqualityFn=(tt,et)=>tt?createWithEqualityFnImpl(tt,et):createWithEqualityFnImpl;function shallow$1(tt,et){if(Object.is(tt,et))return!0;if(typeof tt!="object"||tt===null||typeof et!="object"||et===null)return!1;if(tt instanceof Map&&et instanceof Map){if(tt.size!==et.size)return!1;for(const[rt,it]of tt)if(!Object.is(it,et.get(rt)))return!1;return!0}if(tt instanceof Set&&et instanceof Set){if(tt.size!==et.size)return!1;for(const rt of tt)if(!et.has(rt))return!1;return!0}const nt=Object.keys(tt);if(nt.length!==Object.keys(et).length)return!1;for(let rt=0;rt=0&&(et=tt.slice(0,nt))!=="xmlns"&&(tt=tt.slice(nt+1)),namespaces.hasOwnProperty(et)?{space:namespaces[et],local:tt}:tt}function creatorInherit(tt){return function(){var et=this.ownerDocument,nt=this.namespaceURI;return nt===xhtml&&et.documentElement.namespaceURI===xhtml?et.createElement(tt):et.createElementNS(nt,tt)}}function creatorFixed(tt){return function(){return this.ownerDocument.createElementNS(tt.space,tt.local)}}function creator(tt){var et=namespace(tt);return(et.local?creatorFixed:creatorInherit)(et)}function none(){}function selector(tt){return tt==null?none:function(){return this.querySelector(tt)}}function selection_select(tt){typeof tt!="function"&&(tt=selector(tt));for(var et=this._groups,nt=et.length,rt=new Array(nt),it=0;it=xt&&(xt=vt+1);!(St=yt[xt])&&++xt=0;)(at=rt[it])&&(ot&&at.compareDocumentPosition(ot)^4&&ot.parentNode.insertBefore(at,ot),ot=at);return this}function selection_sort(tt){tt||(tt=ascending);function et(ht,dt){return ht&&dt?tt(ht.__data__,dt.__data__):!ht-!dt}for(var nt=this._groups,rt=nt.length,it=new Array(rt),ot=0;otet?1:tt>=et?0:NaN}function selection_call(){var tt=arguments[0];return arguments[0]=this,tt.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var tt=this._groups,et=0,nt=tt.length;et1?this.each((et==null?styleRemove$1:typeof et=="function"?styleFunction$1:styleConstant$1)(tt,et,nt??"")):styleValue(this.node(),tt)}function styleValue(tt,et){return tt.style.getPropertyValue(et)||defaultView(tt).getComputedStyle(tt,null).getPropertyValue(et)}function propertyRemove(tt){return function(){delete this[tt]}}function propertyConstant(tt,et){return function(){this[tt]=et}}function propertyFunction(tt,et){return function(){var nt=et.apply(this,arguments);nt==null?delete this[tt]:this[tt]=nt}}function selection_property(tt,et){return arguments.length>1?this.each((et==null?propertyRemove:typeof et=="function"?propertyFunction:propertyConstant)(tt,et)):this.node()[tt]}function classArray(tt){return tt.trim().split(/^|\s+/)}function classList(tt){return tt.classList||new ClassList(tt)}function ClassList(tt){this._node=tt,this._names=classArray(tt.getAttribute("class")||"")}ClassList.prototype={add:function(tt){var et=this._names.indexOf(tt);et<0&&(this._names.push(tt),this._node.setAttribute("class",this._names.join(" ")))},remove:function(tt){var et=this._names.indexOf(tt);et>=0&&(this._names.splice(et,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(tt){return this._names.indexOf(tt)>=0}};function classedAdd(tt,et){for(var nt=classList(tt),rt=-1,it=et.length;++rt=0&&(nt=et.slice(rt+1),et=et.slice(0,rt)),{type:et,name:nt}})}function onRemove(tt){return function(){var et=this.__on;if(et){for(var nt=0,rt=-1,it=et.length,ot;nt()=>tt;function DragEvent(tt,{sourceEvent:et,subject:nt,target:rt,identifier:it,active:ot,x:at,y:st,dx:lt,dy:ct,dispatch:ut}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},subject:{value:nt,enumerable:!0,configurable:!0},target:{value:rt,enumerable:!0,configurable:!0},identifier:{value:it,enumerable:!0,configurable:!0},active:{value:ot,enumerable:!0,configurable:!0},x:{value:at,enumerable:!0,configurable:!0},y:{value:st,enumerable:!0,configurable:!0},dx:{value:lt,enumerable:!0,configurable:!0},dy:{value:ct,enumerable:!0,configurable:!0},_:{value:ut}})}DragEvent.prototype.on=function(){var tt=this._.on.apply(this._,arguments);return tt===this._?this:tt};function defaultFilter$1(tt){return!tt.ctrlKey&&!tt.button}function defaultContainer(){return this.parentNode}function defaultSubject(tt,et){return et??{x:tt.x,y:tt.y}}function defaultTouchable$1(){return navigator.maxTouchPoints||"ontouchstart"in this}function drag(){var tt=defaultFilter$1,et=defaultContainer,nt=defaultSubject,rt=defaultTouchable$1,it={},ot=dispatch("start","drag","end"),at=0,st,lt,ct,ut,ht=0;function dt(kt){kt.on("mousedown.drag",pt).filter(rt).on("touchstart.drag",yt).on("touchmove.drag",bt,nonpassive).on("touchend.drag touchcancel.drag",vt).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function pt(kt,St){if(!(ut||!tt.call(this,kt,St))){var Tt=xt(this,et.call(this,kt,St),kt,St,"mouse");Tt&&(select(kt.view).on("mousemove.drag",mt,nonpassivecapture).on("mouseup.drag",gt,nonpassivecapture),dragDisable(kt.view),nopropagation$1(kt),ct=!1,st=kt.clientX,lt=kt.clientY,Tt("start",kt))}}function mt(kt){if(noevent$1(kt),!ct){var St=kt.clientX-st,Tt=kt.clientY-lt;ct=St*St+Tt*Tt>ht}it.mouse("drag",kt)}function gt(kt){select(kt.view).on("mousemove.drag mouseup.drag",null),yesdrag(kt.view,ct),noevent$1(kt),it.mouse("end",kt)}function yt(kt,St){if(tt.call(this,kt,St)){var Tt=kt.changedTouches,At=et.call(this,kt,St),Et=Tt.length,$t,Dt;for($t=0;$tCREATED)throw new Error("too late; already scheduled");return nt}function set(tt,et){var nt=get(tt,et);if(nt.state>STARTED)throw new Error("too late; already running");return nt}function get(tt,et){var nt=tt.__transition;if(!nt||!(nt=nt[et]))throw new Error("transition not found");return nt}function create(tt,et,nt){var rt=tt.__transition,it;rt[et]=nt,nt.timer=timer$1(ot,0,nt.time);function ot(ct){nt.state=SCHEDULED,nt.timer.restart(at,nt.delay,nt.time),nt.delay<=ct&&at(ct-nt.delay)}function at(ct){var ut,ht,dt,pt;if(nt.state!==SCHEDULED)return lt();for(ut in rt)if(pt=rt[ut],pt.name===nt.name){if(pt.state===STARTED)return timeout(at);pt.state===RUNNING?(pt.state=ENDED,pt.timer.stop(),pt.on.call("interrupt",tt,tt.__data__,pt.index,pt.group),delete rt[ut]):+utSTARTING&&rt.state=0&&(et=et.slice(0,nt)),!et||et==="start"})}function onFunction(tt,et,nt){var rt,it,ot=start(et)?init:set;return function(){var at=ot(this,tt),st=at.on;st!==rt&&(it=(rt=st).copy()).on(et,nt),at.on=it}}function transition_on(tt,et){var nt=this._id;return arguments.length<2?get(this.node(),nt).on.on(tt):this.each(onFunction(nt,tt,et))}function removeFunction(tt){return function(){var et=this.parentNode;for(var nt in this.__transition)if(+nt!==tt)return;et&&et.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(tt){var et=this._name,nt=this._id;typeof tt!="function"&&(tt=selector(tt));for(var rt=this._groups,it=rt.length,ot=new Array(it),at=0;at()=>tt;function ZoomEvent(tt,{sourceEvent:et,target:nt,transform:rt,dispatch:it}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},target:{value:nt,enumerable:!0,configurable:!0},transform:{value:rt,enumerable:!0,configurable:!0},_:{value:it}})}function Transform(tt,et,nt){this.k=tt,this.x=et,this.y=nt}Transform.prototype={constructor:Transform,scale:function(tt){return tt===1?this:new Transform(this.k*tt,this.x,this.y)},translate:function(tt,et){return tt===0&et===0?this:new Transform(this.k,this.x+this.k*tt,this.y+this.k*et)},apply:function(tt){return[tt[0]*this.k+this.x,tt[1]*this.k+this.y]},applyX:function(tt){return tt*this.k+this.x},applyY:function(tt){return tt*this.k+this.y},invert:function(tt){return[(tt[0]-this.x)/this.k,(tt[1]-this.y)/this.k]},invertX:function(tt){return(tt-this.x)/this.k},invertY:function(tt){return(tt-this.y)/this.k},rescaleX:function(tt){return tt.copy().domain(tt.range().map(this.invertX,this).map(tt.invert,tt))},rescaleY:function(tt){return tt.copy().domain(tt.range().map(this.invertY,this).map(tt.invert,tt))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity=new Transform(1,0,0);Transform.prototype;function nopropagation(tt){tt.stopImmediatePropagation()}function noevent(tt){tt.preventDefault(),tt.stopImmediatePropagation()}function defaultFilter(tt){return(!tt.ctrlKey||tt.type==="wheel")&&!tt.button}function defaultExtent(){var tt=this;return tt instanceof SVGElement?(tt=tt.ownerSVGElement||tt,tt.hasAttribute("viewBox")?(tt=tt.viewBox.baseVal,[[tt.x,tt.y],[tt.x+tt.width,tt.y+tt.height]]):[[0,0],[tt.width.baseVal.value,tt.height.baseVal.value]]):[[0,0],[tt.clientWidth,tt.clientHeight]]}function defaultTransform(){return this.__zoom||identity}function defaultWheelDelta(tt){return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*(tt.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(tt,et,nt){var rt=tt.invertX(et[0][0])-nt[0][0],it=tt.invertX(et[1][0])-nt[1][0],ot=tt.invertY(et[0][1])-nt[0][1],at=tt.invertY(et[1][1])-nt[1][1];return tt.translate(it>rt?(rt+it)/2:Math.min(0,rt)||Math.max(0,it),at>ot?(ot+at)/2:Math.min(0,ot)||Math.max(0,at))}function zoom(){var tt=defaultFilter,et=defaultExtent,nt=defaultConstrain,rt=defaultWheelDelta,it=defaultTouchable,ot=[0,1/0],at=[[-1/0,-1/0],[1/0,1/0]],st=250,lt=interpolateZoom,ct=dispatch("start","zoom","end"),ut,ht,dt,pt=500,mt=150,gt=0,yt=10;function bt(wt){wt.property("__zoom",defaultTransform).on("wheel.zoom",Et,{passive:!1}).on("mousedown.zoom",$t).on("dblclick.zoom",Dt).filter(it).on("touchstart.zoom",jt).on("touchmove.zoom",Pt).on("touchend.zoom touchcancel.zoom",Ct).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}bt.transform=function(wt,It,Ot,Wt){var zt=wt.selection?wt.selection():wt;zt.property("__zoom",defaultTransform),wt!==zt?St(wt,It,Ot,Wt):zt.interrupt().each(function(){Tt(this,arguments).event(Wt).start().zoom(null,typeof It=="function"?It.apply(this,arguments):It).end()})},bt.scaleBy=function(wt,It,Ot,Wt){bt.scaleTo(wt,function(){var zt=this.__zoom.k,Ft=typeof It=="function"?It.apply(this,arguments):It;return zt*Ft},Ot,Wt)},bt.scaleTo=function(wt,It,Ot,Wt){bt.transform(wt,function(){var zt=et.apply(this,arguments),Ft=this.__zoom,Nt=Ot==null?kt(zt):typeof Ot=="function"?Ot.apply(this,arguments):Ot,Ut=Ft.invert(Nt),Mt=typeof It=="function"?It.apply(this,arguments):It;return nt(xt(vt(Ft,Mt),Nt,Ut),zt,at)},Ot,Wt)},bt.translateBy=function(wt,It,Ot,Wt){bt.transform(wt,function(){return nt(this.__zoom.translate(typeof It=="function"?It.apply(this,arguments):It,typeof Ot=="function"?Ot.apply(this,arguments):Ot),et.apply(this,arguments),at)},null,Wt)},bt.translateTo=function(wt,It,Ot,Wt,zt){bt.transform(wt,function(){var Ft=et.apply(this,arguments),Nt=this.__zoom,Ut=Wt==null?kt(Ft):typeof Wt=="function"?Wt.apply(this,arguments):Wt;return nt(identity.translate(Ut[0],Ut[1]).scale(Nt.k).translate(typeof It=="function"?-It.apply(this,arguments):-It,typeof Ot=="function"?-Ot.apply(this,arguments):-Ot),Ft,at)},Wt,zt)};function vt(wt,It){return It=Math.max(ot[0],Math.min(ot[1],It)),It===wt.k?wt:new Transform(It,wt.x,wt.y)}function xt(wt,It,Ot){var Wt=It[0]-Ot[0]*wt.k,zt=It[1]-Ot[1]*wt.k;return Wt===wt.x&&zt===wt.y?wt:new Transform(wt.k,Wt,zt)}function kt(wt){return[(+wt[0][0]+ +wt[1][0])/2,(+wt[0][1]+ +wt[1][1])/2]}function St(wt,It,Ot,Wt){wt.on("start.zoom",function(){Tt(this,arguments).event(Wt).start()}).on("interrupt.zoom end.zoom",function(){Tt(this,arguments).event(Wt).end()}).tween("zoom",function(){var zt=this,Ft=arguments,Nt=Tt(zt,Ft).event(Wt),Ut=et.apply(zt,Ft),Mt=Ot==null?kt(Ut):typeof Ot=="function"?Ot.apply(zt,Ft):Ot,Ht=Math.max(Ut[1][0]-Ut[0][0],Ut[1][1]-Ut[0][1]),en=zt.__zoom,sn=typeof It=="function"?It.apply(zt,Ft):It,Kt=lt(en.invert(Mt).concat(Ht/en.k),sn.invert(Mt).concat(Ht/sn.k));return function(rn){if(rn===1)rn=sn;else{var nn=Kt(rn),hn=Ht/nn[2];rn=new Transform(hn,Mt[0]-nn[0]*hn,Mt[1]-nn[1]*hn)}Nt.zoom(null,rn)}})}function Tt(wt,It,Ot){return!Ot&&wt.__zooming||new At(wt,It)}function At(wt,It){this.that=wt,this.args=It,this.active=0,this.sourceEvent=null,this.extent=et.apply(wt,It),this.taps=0}At.prototype={event:function(wt){return wt&&(this.sourceEvent=wt),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(wt,It){return this.mouse&&wt!=="mouse"&&(this.mouse[1]=It.invert(this.mouse[0])),this.touch0&&wt!=="touch"&&(this.touch0[1]=It.invert(this.touch0[0])),this.touch1&&wt!=="touch"&&(this.touch1[1]=It.invert(this.touch1[0])),this.that.__zoom=It,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(wt){var It=select(this.that).datum();ct.call(wt,this.that,new ZoomEvent(wt,{sourceEvent:this.sourceEvent,target:bt,type:wt,transform:this.that.__zoom,dispatch:ct}),It)}};function Et(wt,...It){if(!tt.apply(this,arguments))return;var Ot=Tt(this,It).event(wt),Wt=this.__zoom,zt=Math.max(ot[0],Math.min(ot[1],Wt.k*Math.pow(2,rt.apply(this,arguments)))),Ft=pointer(wt);if(Ot.wheel)(Ot.mouse[0][0]!==Ft[0]||Ot.mouse[0][1]!==Ft[1])&&(Ot.mouse[1]=Wt.invert(Ot.mouse[0]=Ft)),clearTimeout(Ot.wheel);else{if(Wt.k===zt)return;Ot.mouse=[Ft,Wt.invert(Ft)],interrupt(this),Ot.start()}noevent(wt),Ot.wheel=setTimeout(Nt,mt),Ot.zoom("mouse",nt(xt(vt(Wt,zt),Ot.mouse[0],Ot.mouse[1]),Ot.extent,at));function Nt(){Ot.wheel=null,Ot.end()}}function $t(wt,...It){if(dt||!tt.apply(this,arguments))return;var Ot=wt.currentTarget,Wt=Tt(this,It,!0).event(wt),zt=select(wt.view).on("mousemove.zoom",Mt,!0).on("mouseup.zoom",Ht,!0),Ft=pointer(wt,Ot),Nt=wt.clientX,Ut=wt.clientY;dragDisable(wt.view),nopropagation(wt),Wt.mouse=[Ft,this.__zoom.invert(Ft)],interrupt(this),Wt.start();function Mt(en){if(noevent(en),!Wt.moved){var sn=en.clientX-Nt,Kt=en.clientY-Ut;Wt.moved=sn*sn+Kt*Kt>gt}Wt.event(en).zoom("mouse",nt(xt(Wt.that.__zoom,Wt.mouse[0]=pointer(en,Ot),Wt.mouse[1]),Wt.extent,at))}function Ht(en){zt.on("mousemove.zoom mouseup.zoom",null),yesdrag(en.view,Wt.moved),noevent(en),Wt.event(en).end()}}function Dt(wt,...It){if(tt.apply(this,arguments)){var Ot=this.__zoom,Wt=pointer(wt.changedTouches?wt.changedTouches[0]:wt,this),zt=Ot.invert(Wt),Ft=Ot.k*(wt.shiftKey?.5:2),Nt=nt(xt(vt(Ot,Ft),Wt,zt),et.apply(this,It),at);noevent(wt),st>0?select(this).transition().duration(st).call(St,Nt,Wt,wt):select(this).call(bt.transform,Nt,Wt,wt)}}function jt(wt,...It){if(tt.apply(this,arguments)){var Ot=wt.touches,Wt=Ot.length,zt=Tt(this,It,wt.changedTouches.length===Wt).event(wt),Ft,Nt,Ut,Mt;for(nopropagation(wt),Nt=0;Nt"[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:tt=>`Node type "${tt}" 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:tt=>`The old edge with id=${tt} does not exist.`,error009:tt=>`Marker type "${tt}" doesn't exist.`,error008:(tt,et)=>`Couldn't create edge for ${tt?"target":"source"} handle id: "${tt?et.targetHandle:et.sourceHandle}", edge id: ${et.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:tt=>`Edge type "${tt}" not found. Using fallback type "default".`,error012:tt=>`Node with id "${tt}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},zustandErrorMessage=errorMessages.error001();function useStore(tt,et){const nt=reactExports.useContext(StoreContext);if(nt===null)throw new Error(zustandErrorMessage);return useStoreWithEqualityFn(nt,tt,et)}const useStoreApi=()=>{const tt=reactExports.useContext(StoreContext);if(tt===null)throw new Error(zustandErrorMessage);return reactExports.useMemo(()=>({getState:tt.getState,setState:tt.setState,subscribe:tt.subscribe,destroy:tt.destroy}),[tt])},selector$g=tt=>tt.userSelectionActive?"none":"all";function Panel({position:tt,children:et,className:nt,style:rt,...it}){const ot=useStore(selector$g),at=`${tt}`.split("-");return React$1.createElement("div",{className:cc(["react-flow__panel",nt,...at]),style:{...rt,pointerEvents:ot},...it},et)}function Attribution({proOptions:tt,position:et="bottom-right"}){return tt!=null&&tt.hideAttribution?null:React$1.createElement(Panel,{position:et,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev"},React$1.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const EdgeText=({x:tt,y:et,label:nt,labelStyle:rt={},labelShowBg:it=!0,labelBgStyle:ot={},labelBgPadding:at=[2,4],labelBgBorderRadius:st=2,children:lt,className:ct,...ut})=>{const ht=reactExports.useRef(null),[dt,pt]=reactExports.useState({x:0,y:0,width:0,height:0}),mt=cc(["react-flow__edge-textwrapper",ct]);return reactExports.useEffect(()=>{if(ht.current){const gt=ht.current.getBBox();pt({x:gt.x,y:gt.y,width:gt.width,height:gt.height})}},[nt]),typeof nt>"u"||!nt?null:React$1.createElement("g",{transform:`translate(${tt-dt.width/2} ${et-dt.height/2})`,className:mt,visibility:dt.width?"visible":"hidden",...ut},it&&React$1.createElement("rect",{width:dt.width+2*at[0],x:-at[0],y:-at[1],height:dt.height+2*at[1],className:"react-flow__edge-textbg",style:ot,rx:st,ry:st}),React$1.createElement("text",{className:"react-flow__edge-text",y:dt.height/2,dy:"0.3em",ref:ht,style:rt},nt),lt)};var EdgeText$1=reactExports.memo(EdgeText);const getDimensions=tt=>({width:tt.offsetWidth,height:tt.offsetHeight}),clamp=(tt,et=0,nt=1)=>Math.min(Math.max(tt,et),nt),clampPosition=(tt={x:0,y:0},et)=>({x:clamp(tt.x,et[0][0],et[1][0]),y:clamp(tt.y,et[0][1],et[1][1])}),calcAutoPanVelocity=(tt,et,nt)=>ttnt?-clamp(Math.abs(tt-nt),1,50)/50:0,calcAutoPan=(tt,et)=>{const nt=calcAutoPanVelocity(tt.x,35,et.width-35)*20,rt=calcAutoPanVelocity(tt.y,35,et.height-35)*20;return[nt,rt]},getHostForElement=tt=>{var et;return((et=tt.getRootNode)==null?void 0:et.call(tt))||(window==null?void 0:window.document)},getBoundsOfBoxes=(tt,et)=>({x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x2,et.x2),y2:Math.max(tt.y2,et.y2)}),rectToBox=({x:tt,y:et,width:nt,height:rt})=>({x:tt,y:et,x2:tt+nt,y2:et+rt}),boxToRect=({x:tt,y:et,x2:nt,y2:rt})=>({x:tt,y:et,width:nt-tt,height:rt-et}),nodeToRect=tt=>({...tt.positionAbsolute||{x:0,y:0},width:tt.width||0,height:tt.height||0}),getOverlappingArea=(tt,et)=>{const nt=Math.max(0,Math.min(tt.x+tt.width,et.x+et.width)-Math.max(tt.x,et.x)),rt=Math.max(0,Math.min(tt.y+tt.height,et.y+et.height)-Math.max(tt.y,et.y));return Math.ceil(nt*rt)},isRectObject=tt=>isNumeric(tt.width)&&isNumeric(tt.height)&&isNumeric(tt.x)&&isNumeric(tt.y),isNumeric=tt=>!isNaN(tt)&&isFinite(tt),internalsSymbol=Symbol.for("internals"),elementSelectionKeys=["Enter"," ","Escape"],devWarn=(tt,et)=>{},isReactKeyboardEvent=tt=>"nativeEvent"in tt;function isInputDOMNode(tt){var it,ot;const et=isReactKeyboardEvent(tt)?tt.nativeEvent:tt,nt=((ot=(it=et.composedPath)==null?void 0:it.call(et))==null?void 0:ot[0])||tt.target;return["INPUT","SELECT","TEXTAREA"].includes(nt==null?void 0:nt.nodeName)||(nt==null?void 0:nt.hasAttribute("contenteditable"))||!!(nt!=null&&nt.closest(".nokey"))}const isMouseEvent=tt=>"clientX"in tt,getEventPosition=(tt,et)=>{var ot,at;const nt=isMouseEvent(tt),rt=nt?tt.clientX:(ot=tt.touches)==null?void 0:ot[0].clientX,it=nt?tt.clientY:(at=tt.touches)==null?void 0:at[0].clientY;return{x:rt-((et==null?void 0:et.left)??0),y:it-((et==null?void 0:et.top)??0)}},isMacOs=()=>{var tt;return typeof navigator<"u"&&((tt=navigator==null?void 0:navigator.userAgent)==null?void 0:tt.indexOf("Mac"))>=0},BaseEdge=({id:tt,path:et,labelX:nt,labelY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt=20})=>React$1.createElement(React$1.Fragment,null,React$1.createElement("path",{id:tt,style:ut,d:et,fill:"none",className:"react-flow__edge-path",markerEnd:ht,markerStart:dt}),pt&&React$1.createElement("path",{d:et,fill:"none",strokeOpacity:0,strokeWidth:pt,className:"react-flow__edge-interaction"}),it&&isNumeric(nt)&&isNumeric(rt)?React$1.createElement(EdgeText$1,{x:nt,y:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct}):null);BaseEdge.displayName="BaseEdge";function getMouseHandler$1(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().edges.find(ot=>ot.id===tt);it&&nt(rt,{...it})}}function getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const it=Math.abs(nt-tt)/2,ot=nt{const[yt,bt,vt]=getSimpleBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot});return React$1.createElement(BaseEdge,{path:yt,labelX:bt,labelY:vt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:gt})});SimpleBezierEdge.displayName="SimpleBezierEdge";const handleDirections={[Position.Left]:{x:-1,y:0},[Position.Right]:{x:1,y:0},[Position.Top]:{x:0,y:-1},[Position.Bottom]:{x:0,y:1}},getDirection=({source:tt,sourcePosition:et=Position.Bottom,target:nt})=>et===Position.Left||et===Position.Right?tt.xMath.sqrt(Math.pow(et.x-tt.x,2)+Math.pow(et.y-tt.y,2));function getPoints({source:tt,sourcePosition:et=Position.Bottom,target:nt,targetPosition:rt=Position.Top,center:it,offset:ot}){const at=handleDirections[et],st=handleDirections[rt],lt={x:tt.x+at.x*ot,y:tt.y+at.y*ot},ct={x:nt.x+st.x*ot,y:nt.y+st.y*ot},ut=getDirection({source:lt,sourcePosition:et,target:ct}),ht=ut.x!==0?"x":"y",dt=ut[ht];let pt=[],mt,gt;const yt={x:0,y:0},bt={x:0,y:0},[vt,xt,kt,St]=getEdgeCenter({sourceX:tt.x,sourceY:tt.y,targetX:nt.x,targetY:nt.y});if(at[ht]*st[ht]===-1){mt=it.x||vt,gt=it.y||xt;const At=[{x:mt,y:lt.y},{x:mt,y:ct.y}],Et=[{x:lt.x,y:gt},{x:ct.x,y:gt}];at[ht]===dt?pt=ht==="x"?At:Et:pt=ht==="x"?Et:At}else{const At=[{x:lt.x,y:ct.y}],Et=[{x:ct.x,y:lt.y}];if(ht==="x"?pt=at.x===dt?Et:At:pt=at.y===dt?At:Et,et===rt){const Ct=Math.abs(tt[ht]-nt[ht]);if(Ct<=ot){const wt=Math.min(ot-1,ot-Ct);at[ht]===dt?yt[ht]=(lt[ht]>tt[ht]?-1:1)*wt:bt[ht]=(ct[ht]>nt[ht]?-1:1)*wt}}if(et!==rt){const Ct=ht==="x"?"y":"x",wt=at[ht]===st[Ct],It=lt[Ct]>ct[Ct],Ot=lt[Ct]=Pt?(mt=($t.x+Dt.x)/2,gt=pt[0].y):(mt=pt[0].x,gt=($t.y+Dt.y)/2)}return[[tt,{x:lt.x+yt.x,y:lt.y+yt.y},...pt,{x:ct.x+bt.x,y:ct.y+bt.y},nt],mt,gt,kt,St]}function getBend(tt,et,nt,rt){const it=Math.min(distance(tt,et)/2,distance(et,nt)/2,rt),{x:ot,y:at}=et;if(tt.x===ot&&ot===nt.x||tt.y===at&&at===nt.y)return`L${ot} ${at}`;if(tt.y===at){const ct=tt.x{let xt="";return vt>0&&vt{const[bt,vt,xt]=getSmoothStepPath({sourceX:tt,sourceY:et,sourcePosition:ht,targetX:nt,targetY:rt,targetPosition:dt,borderRadius:gt==null?void 0:gt.borderRadius,offset:gt==null?void 0:gt.offset});return React$1.createElement(BaseEdge,{path:bt,labelX:vt,labelY:xt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:pt,markerStart:mt,interactionWidth:yt})});SmoothStepEdge.displayName="SmoothStepEdge";const StepEdge=reactExports.memo(tt=>{var et;return React$1.createElement(SmoothStepEdge,{...tt,pathOptions:reactExports.useMemo(()=>{var nt;return{borderRadius:0,offset:(nt=tt.pathOptions)==null?void 0:nt.offset}},[(et=tt.pathOptions)==null?void 0:et.offset])})});StepEdge.displayName="StepEdge";function getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const[it,ot,at,st]=getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return[`M ${tt},${et}L ${nt},${rt}`,it,ot,at,st]}const StraightEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})=>{const[mt,gt,yt]=getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return React$1.createElement(BaseEdge,{path:mt,labelX:gt,labelY:yt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})});StraightEdge.displayName="StraightEdge";function calculateControlOffset(tt,et){return tt>=0?.5*tt:et*25*Math.sqrt(-tt)}function getControlWithCurvature({pos:tt,x1:et,y1:nt,x2:rt,y2:it,c:ot}){switch(tt){case Position.Left:return[et-calculateControlOffset(et-rt,ot),nt];case Position.Right:return[et+calculateControlOffset(rt-et,ot),nt];case Position.Top:return[et,nt-calculateControlOffset(nt-it,ot)];case Position.Bottom:return[et,nt+calculateControlOffset(it-nt,ot)]}}function getBezierPath({sourceX:tt,sourceY:et,sourcePosition:nt=Position.Bottom,targetX:rt,targetY:it,targetPosition:ot=Position.Top,curvature:at=.25}){const[st,lt]=getControlWithCurvature({pos:nt,x1:tt,y1:et,x2:rt,y2:it,c:at}),[ct,ut]=getControlWithCurvature({pos:ot,x1:rt,y1:it,x2:tt,y2:et,c:at}),[ht,dt,pt,mt]=getBezierEdgeCenter({sourceX:tt,sourceY:et,targetX:rt,targetY:it,sourceControlX:st,sourceControlY:lt,targetControlX:ct,targetControlY:ut});return[`M${tt},${et} C${st},${lt} ${ct},${ut} ${rt},${it}`,ht,dt,pt,mt]}const BezierEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,sourcePosition:it=Position.Bottom,targetPosition:ot=Position.Top,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,pathOptions:gt,interactionWidth:yt})=>{const[bt,vt,xt]=getBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot,curvature:gt==null?void 0:gt.curvature});return React$1.createElement(BaseEdge,{path:bt,labelX:vt,labelY:xt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:yt})});BezierEdge.displayName="BezierEdge";const NodeIdContext=reactExports.createContext(null),Provider=NodeIdContext.Provider;NodeIdContext.Consumer;const useNodeId=()=>reactExports.useContext(NodeIdContext),isEdge=tt=>"id"in tt&&"source"in tt&&"target"in tt,getEdgeId=({source:tt,sourceHandle:et,target:nt,targetHandle:rt})=>`reactflow__edge-${tt}${et||""}-${nt}${rt||""}`,getMarkerId=(tt,et)=>typeof tt>"u"?"":typeof tt=="string"?tt:`${et?`${et}__`:""}${Object.keys(tt).sort().map(rt=>`${rt}=${tt[rt]}`).join("&")}`,connectionExists=(tt,et)=>et.some(nt=>nt.source===tt.source&&nt.target===tt.target&&(nt.sourceHandle===tt.sourceHandle||!nt.sourceHandle&&!tt.sourceHandle)&&(nt.targetHandle===tt.targetHandle||!nt.targetHandle&&!tt.targetHandle)),addEdge=(tt,et)=>{if(!tt.source||!tt.target)return et;let nt;return isEdge(tt)?nt={...tt}:nt={...tt,id:getEdgeId(tt)},connectionExists(nt,et)?et:et.concat(nt)},pointToRendererPoint=({x:tt,y:et},[nt,rt,it],ot,[at,st])=>{const lt={x:(tt-nt)/it,y:(et-rt)/it};return ot?{x:at*Math.round(lt.x/at),y:st*Math.round(lt.y/st)}:lt},rendererPointToPoint=({x:tt,y:et},[nt,rt,it])=>({x:tt*it+nt,y:et*it+rt}),getNodePositionWithOrigin=(tt,et=[0,0])=>{if(!tt)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const nt=(tt.width??0)*et[0],rt=(tt.height??0)*et[1],it={x:tt.position.x-nt,y:tt.position.y-rt};return{...it,positionAbsolute:tt.positionAbsolute?{x:tt.positionAbsolute.x-nt,y:tt.positionAbsolute.y-rt}:it}},getRectOfNodes=(tt,et=[0,0])=>{if(tt.length===0)return{x:0,y:0,width:0,height:0};const nt=tt.reduce((rt,it)=>{const{x:ot,y:at}=getNodePositionWithOrigin(it,et).positionAbsolute;return getBoundsOfBoxes(rt,rectToBox({x:ot,y:at,width:it.width||0,height:it.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return boxToRect(nt)},getNodesInside=(tt,et,[nt,rt,it]=[0,0,1],ot=!1,at=!1,st=[0,0])=>{const lt={x:(et.x-nt)/it,y:(et.y-rt)/it,width:et.width/it,height:et.height/it},ct=[];return tt.forEach(ut=>{const{width:ht,height:dt,selectable:pt=!0,hidden:mt=!1}=ut;if(at&&!pt||mt)return!1;const{positionAbsolute:gt}=getNodePositionWithOrigin(ut,st),yt={x:gt.x,y:gt.y,width:ht||0,height:dt||0},bt=getOverlappingArea(lt,yt),vt=typeof ht>"u"||typeof dt>"u"||ht===null||dt===null,xt=ot&&bt>0,kt=(ht||0)*(dt||0);(vt||xt||bt>=kt||ut.dragging)&&ct.push(ut)}),ct},getConnectedEdges=(tt,et)=>{const nt=tt.map(rt=>rt.id);return et.filter(rt=>nt.includes(rt.source)||nt.includes(rt.target))},getTransformForBounds=(tt,et,nt,rt,it,ot=.1)=>{const at=et/(tt.width*(1+ot)),st=nt/(tt.height*(1+ot)),lt=Math.min(at,st),ct=clamp(lt,rt,it),ut=tt.x+tt.width/2,ht=tt.y+tt.height/2,dt=et/2-ut*ct,pt=nt/2-ht*ct;return[dt,pt,ct]},getD3Transition=(tt,et=0)=>tt.transition().duration(et);function getHandles(tt,et,nt,rt){return(et[nt]||[]).reduce((it,ot)=>{var at,st;return`${tt.id}-${ot.id}-${nt}`!==rt&&it.push({id:ot.id||null,type:nt,nodeId:tt.id,x:(((at=tt.positionAbsolute)==null?void 0:at.x)??0)+ot.x+ot.width/2,y:(((st=tt.positionAbsolute)==null?void 0:st.y)??0)+ot.y+ot.height/2}),it},[])}function getClosestHandle(tt,et,nt,rt,it,ot){const{x:at,y:st}=getEventPosition(tt),ct=et.elementsFromPoint(at,st).find(mt=>mt.classList.contains("react-flow__handle"));if(ct){const mt=ct.getAttribute("data-nodeid");if(mt){const gt=getHandleType(void 0,ct),yt=ct.getAttribute("data-handleid"),bt=ot({nodeId:mt,id:yt,type:gt});if(bt)return{handle:{id:yt,type:gt,nodeId:mt,x:nt.x,y:nt.y},validHandleResult:bt}}}let ut=[],ht=1/0;if(it.forEach(mt=>{const gt=Math.sqrt((mt.x-nt.x)**2+(mt.y-nt.y)**2);if(gt<=rt){const yt=ot(mt);gt<=ht&&(gtmt.isValid),pt=ut.some(({handle:mt})=>mt.type==="target");return ut.find(({handle:mt,validHandleResult:gt})=>pt?mt.type==="target":dt?gt.isValid:!0)||ut[0]}const nullConnection={source:null,target:null,sourceHandle:null,targetHandle:null},defaultResult=()=>({handleDomNode:null,isValid:!1,connection:nullConnection,endHandle:null});function isValidHandle(tt,et,nt,rt,it,ot,at){const st=it==="target",lt=at.querySelector(`.react-flow__handle[data-id="${tt==null?void 0:tt.nodeId}-${tt==null?void 0:tt.id}-${tt==null?void 0:tt.type}"]`),ct={...defaultResult(),handleDomNode:lt};if(lt){const ut=getHandleType(void 0,lt),ht=lt.getAttribute("data-nodeid"),dt=lt.getAttribute("data-handleid"),pt=lt.classList.contains("connectable"),mt=lt.classList.contains("connectableend"),gt={source:st?ht:nt,sourceHandle:st?dt:rt,target:st?nt:ht,targetHandle:st?rt:dt};ct.connection=gt,pt&&mt&&(et===ConnectionMode.Strict?st&&ut==="source"||!st&&ut==="target":ht!==nt||dt!==rt)&&(ct.endHandle={nodeId:ht,handleId:dt,type:ut},ct.isValid=ot(gt))}return ct}function getHandleLookup({nodes:tt,nodeId:et,handleId:nt,handleType:rt}){return tt.reduce((it,ot)=>{if(ot[internalsSymbol]){const{handleBounds:at}=ot[internalsSymbol];let st=[],lt=[];at&&(st=getHandles(ot,at,"source",`${et}-${nt}-${rt}`),lt=getHandles(ot,at,"target",`${et}-${nt}-${rt}`)),it.push(...st,...lt)}return it},[])}function getHandleType(tt,et){return tt||(et!=null&&et.classList.contains("target")?"target":et!=null&&et.classList.contains("source")?"source":null)}function resetRecentHandle(tt){tt==null||tt.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function getConnectionStatus(tt,et){let nt=null;return et?nt="valid":tt&&!et&&(nt="invalid"),nt}function handlePointerDown({event:tt,handleId:et,nodeId:nt,onConnect:rt,isTarget:it,getState:ot,setState:at,isValidConnection:st,edgeUpdaterType:lt,onEdgeUpdateEnd:ct}){const ut=getHostForElement(tt.target),{connectionMode:ht,domNode:dt,autoPanOnConnect:pt,connectionRadius:mt,onConnectStart:gt,panBy:yt,getNodes:bt,cancelConnection:vt}=ot();let xt=0,kt;const{x:St,y:Tt}=getEventPosition(tt),At=ut==null?void 0:ut.elementFromPoint(St,Tt),Et=getHandleType(lt,At),$t=dt==null?void 0:dt.getBoundingClientRect();if(!$t||!Et)return;let Dt,jt=getEventPosition(tt,$t),Pt=!1,Ct=null,wt=!1,It=null;const Ot=getHandleLookup({nodes:bt(),nodeId:nt,handleId:et,handleType:Et}),Wt=()=>{if(!pt)return;const[Nt,Ut]=calcAutoPan(jt,$t);yt({x:Nt,y:Ut}),xt=requestAnimationFrame(Wt)};at({connectionPosition:jt,connectionStatus:null,connectionNodeId:nt,connectionHandleId:et,connectionHandleType:Et,connectionStartHandle:{nodeId:nt,handleId:et,type:Et},connectionEndHandle:null}),gt==null||gt(tt,{nodeId:nt,handleId:et,handleType:Et});function zt(Nt){const{transform:Ut}=ot();jt=getEventPosition(Nt,$t);const{handle:Mt,validHandleResult:Ht}=getClosestHandle(Nt,ut,pointToRendererPoint(jt,Ut,!1,[1,1]),mt,Ot,en=>isValidHandle(en,ht,nt,et,it?"target":"source",st,ut));if(kt=Mt,Pt||(Wt(),Pt=!0),It=Ht.handleDomNode,Ct=Ht.connection,wt=Ht.isValid,at({connectionPosition:kt&&wt?rendererPointToPoint({x:kt.x,y:kt.y},Ut):jt,connectionStatus:getConnectionStatus(!!kt,wt),connectionEndHandle:Ht.endHandle}),!kt&&!wt&&!It)return resetRecentHandle(Dt);Ct.source!==Ct.target&&It&&(resetRecentHandle(Dt),Dt=It,It.classList.add("connecting","react-flow__handle-connecting"),It.classList.toggle("valid",wt),It.classList.toggle("react-flow__handle-valid",wt))}function Ft(Nt){var Ut,Mt;(kt||It)&&Ct&&wt&&(rt==null||rt(Ct)),(Mt=(Ut=ot()).onConnectEnd)==null||Mt.call(Ut,Nt),lt&&(ct==null||ct(Nt)),resetRecentHandle(Dt),vt(),cancelAnimationFrame(xt),Pt=!1,wt=!1,Ct=null,It=null,ut.removeEventListener("mousemove",zt),ut.removeEventListener("mouseup",Ft),ut.removeEventListener("touchmove",zt),ut.removeEventListener("touchend",Ft)}ut.addEventListener("mousemove",zt),ut.addEventListener("mouseup",Ft),ut.addEventListener("touchmove",zt),ut.addEventListener("touchend",Ft)}const alwaysValid=()=>!0,selector$f=tt=>({connectionStartHandle:tt.connectionStartHandle,connectOnClick:tt.connectOnClick,noPanClassName:tt.noPanClassName}),connectingSelector=(tt,et,nt)=>rt=>{const{connectionStartHandle:it,connectionEndHandle:ot,connectionClickStartHandle:at}=rt;return{connecting:(it==null?void 0:it.nodeId)===tt&&(it==null?void 0:it.handleId)===et&&(it==null?void 0:it.type)===nt||(ot==null?void 0:ot.nodeId)===tt&&(ot==null?void 0:ot.handleId)===et&&(ot==null?void 0:ot.type)===nt,clickConnecting:(at==null?void 0:at.nodeId)===tt&&(at==null?void 0:at.handleId)===et&&(at==null?void 0:at.type)===nt}},Handle=reactExports.forwardRef(({type:tt="source",position:et=Position.Top,isValidConnection:nt,isConnectable:rt=!0,isConnectableStart:it=!0,isConnectableEnd:ot=!0,id:at,onConnect:st,children:lt,className:ct,onMouseDown:ut,onTouchStart:ht,...dt},pt)=>{var $t,Dt;const mt=at||null,gt=tt==="target",yt=useStoreApi(),bt=useNodeId(),{connectOnClick:vt,noPanClassName:xt}=useStore(selector$f,shallow$1),{connecting:kt,clickConnecting:St}=useStore(connectingSelector(bt,mt,tt),shallow$1);bt||(Dt=($t=yt.getState()).onError)==null||Dt.call($t,"010",errorMessages.error010());const Tt=jt=>{const{defaultEdgeOptions:Pt,onConnect:Ct,hasDefaultEdges:wt}=yt.getState(),It={...Pt,...jt};if(wt){const{edges:Ot,setEdges:Wt}=yt.getState();Wt(addEdge(It,Ot))}Ct==null||Ct(It),st==null||st(It)},At=jt=>{if(!bt)return;const Pt=isMouseEvent(jt);it&&(Pt&&jt.button===0||!Pt)&&handlePointerDown({event:jt,handleId:mt,nodeId:bt,onConnect:Tt,isTarget:gt,getState:yt.getState,setState:yt.setState,isValidConnection:nt||yt.getState().isValidConnection||alwaysValid}),Pt?ut==null||ut(jt):ht==null||ht(jt)},Et=jt=>{const{onClickConnectStart:Pt,onClickConnectEnd:Ct,connectionClickStartHandle:wt,connectionMode:It,isValidConnection:Ot}=yt.getState();if(!bt||!wt&&!it)return;if(!wt){Pt==null||Pt(jt,{nodeId:bt,handleId:mt,handleType:tt}),yt.setState({connectionClickStartHandle:{nodeId:bt,type:tt,handleId:mt}});return}const Wt=getHostForElement(jt.target),zt=nt||Ot||alwaysValid,{connection:Ft,isValid:Nt}=isValidHandle({nodeId:bt,id:mt,type:tt},It,wt.nodeId,wt.handleId||null,wt.type,zt,Wt);Nt&&Tt(Ft),Ct==null||Ct(jt),yt.setState({connectionClickStartHandle:null})};return React$1.createElement("div",{"data-handleid":mt,"data-nodeid":bt,"data-handlepos":et,"data-id":`${bt}-${mt}-${tt}`,className:cc(["react-flow__handle",`react-flow__handle-${et}`,"nodrag",xt,ct,{source:!gt,target:gt,connectable:rt,connectablestart:it,connectableend:ot,connecting:St,connectionindicator:rt&&(it&&!kt||ot&&kt)}]),onMouseDown:At,onTouchStart:At,onClick:vt?Et:void 0,ref:pt,...dt},lt)});Handle.displayName="Handle";var Handle$1=reactExports.memo(Handle);const DefaultNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top,sourcePosition:rt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:rt,isConnectable:et}));DefaultNode.displayName="DefaultNode";var DefaultNode$1=reactExports.memo(DefaultNode);const InputNode=({data:tt,isConnectable:et,sourcePosition:nt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:nt,isConnectable:et}));InputNode.displayName="InputNode";var InputNode$1=reactExports.memo(InputNode);const OutputNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label);OutputNode.displayName="OutputNode";var OutputNode$1=reactExports.memo(OutputNode);const GroupNode=()=>null;GroupNode.displayName="GroupNode";const selector$e=tt=>({selectedNodes:tt.getNodes().filter(et=>et.selected),selectedEdges:tt.edges.filter(et=>et.selected)}),selectId=tt=>tt.id;function areEqual(tt,et){return shallow$1(tt.selectedNodes.map(selectId),et.selectedNodes.map(selectId))&&shallow$1(tt.selectedEdges.map(selectId),et.selectedEdges.map(selectId))}const SelectionListener=reactExports.memo(({onSelectionChange:tt})=>{const et=useStoreApi(),{selectedNodes:nt,selectedEdges:rt}=useStore(selector$e,areEqual);return reactExports.useEffect(()=>{var ot,at;const it={nodes:nt,edges:rt};tt==null||tt(it),(at=(ot=et.getState()).onSelectionChange)==null||at.call(ot,it)},[nt,rt,tt]),null});SelectionListener.displayName="SelectionListener";const changeSelector=tt=>!!tt.onSelectionChange;function Wrapper$1$1({onSelectionChange:tt}){const et=useStore(changeSelector);return tt||et?React$1.createElement(SelectionListener,{onSelectionChange:tt}):null}const selector$d=tt=>({setNodes:tt.setNodes,setEdges:tt.setEdges,setDefaultNodesAndEdges:tt.setDefaultNodesAndEdges,setMinZoom:tt.setMinZoom,setMaxZoom:tt.setMaxZoom,setTranslateExtent:tt.setTranslateExtent,setNodeExtent:tt.setNodeExtent,reset:tt.reset});function useStoreUpdater(tt,et){reactExports.useEffect(()=>{typeof tt<"u"&&et(tt)},[tt])}function useDirectStoreUpdater(tt,et,nt){reactExports.useEffect(()=>{typeof et<"u"&&nt({[tt]:et})},[et])}const StoreUpdater=({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:it,onConnectStart:ot,onConnectEnd:at,onClickConnectStart:st,onClickConnectEnd:lt,nodesDraggable:ct,nodesConnectable:ut,nodesFocusable:ht,edgesFocusable:dt,edgesUpdatable:pt,elevateNodesOnSelect:mt,minZoom:gt,maxZoom:yt,nodeExtent:bt,onNodesChange:vt,onEdgesChange:xt,elementsSelectable:kt,connectionMode:St,snapGrid:Tt,snapToGrid:At,translateExtent:Et,connectOnClick:$t,defaultEdgeOptions:Dt,fitView:jt,fitViewOptions:Pt,onNodesDelete:Ct,onEdgesDelete:wt,onNodeDrag:It,onNodeDragStart:Ot,onNodeDragStop:Wt,onSelectionDrag:zt,onSelectionDragStart:Ft,onSelectionDragStop:Nt,noPanClassName:Ut,nodeOrigin:Mt,rfId:Ht,autoPanOnConnect:en,autoPanOnNodeDrag:sn,onError:Kt,connectionRadius:rn,isValidConnection:nn,nodeDragThreshold:hn})=>{const{setNodes:vn,setEdges:an,setDefaultNodesAndEdges:Qt,setMinZoom:_n,setMaxZoom:Pn,setTranslateExtent:$n,setNodeExtent:Nn,reset:Tn}=useStore(selector$d,shallow$1),cn=useStoreApi();return reactExports.useEffect(()=>{const mn=rt==null?void 0:rt.map(In=>({...In,...Dt}));return Qt(nt,mn),()=>{Tn()}},[]),useDirectStoreUpdater("defaultEdgeOptions",Dt,cn.setState),useDirectStoreUpdater("connectionMode",St,cn.setState),useDirectStoreUpdater("onConnect",it,cn.setState),useDirectStoreUpdater("onConnectStart",ot,cn.setState),useDirectStoreUpdater("onConnectEnd",at,cn.setState),useDirectStoreUpdater("onClickConnectStart",st,cn.setState),useDirectStoreUpdater("onClickConnectEnd",lt,cn.setState),useDirectStoreUpdater("nodesDraggable",ct,cn.setState),useDirectStoreUpdater("nodesConnectable",ut,cn.setState),useDirectStoreUpdater("nodesFocusable",ht,cn.setState),useDirectStoreUpdater("edgesFocusable",dt,cn.setState),useDirectStoreUpdater("edgesUpdatable",pt,cn.setState),useDirectStoreUpdater("elementsSelectable",kt,cn.setState),useDirectStoreUpdater("elevateNodesOnSelect",mt,cn.setState),useDirectStoreUpdater("snapToGrid",At,cn.setState),useDirectStoreUpdater("snapGrid",Tt,cn.setState),useDirectStoreUpdater("onNodesChange",vt,cn.setState),useDirectStoreUpdater("onEdgesChange",xt,cn.setState),useDirectStoreUpdater("connectOnClick",$t,cn.setState),useDirectStoreUpdater("fitViewOnInit",jt,cn.setState),useDirectStoreUpdater("fitViewOnInitOptions",Pt,cn.setState),useDirectStoreUpdater("onNodesDelete",Ct,cn.setState),useDirectStoreUpdater("onEdgesDelete",wt,cn.setState),useDirectStoreUpdater("onNodeDrag",It,cn.setState),useDirectStoreUpdater("onNodeDragStart",Ot,cn.setState),useDirectStoreUpdater("onNodeDragStop",Wt,cn.setState),useDirectStoreUpdater("onSelectionDrag",zt,cn.setState),useDirectStoreUpdater("onSelectionDragStart",Ft,cn.setState),useDirectStoreUpdater("onSelectionDragStop",Nt,cn.setState),useDirectStoreUpdater("noPanClassName",Ut,cn.setState),useDirectStoreUpdater("nodeOrigin",Mt,cn.setState),useDirectStoreUpdater("rfId",Ht,cn.setState),useDirectStoreUpdater("autoPanOnConnect",en,cn.setState),useDirectStoreUpdater("autoPanOnNodeDrag",sn,cn.setState),useDirectStoreUpdater("onError",Kt,cn.setState),useDirectStoreUpdater("connectionRadius",rn,cn.setState),useDirectStoreUpdater("isValidConnection",nn,cn.setState),useDirectStoreUpdater("nodeDragThreshold",hn,cn.setState),useStoreUpdater(tt,vn),useStoreUpdater(et,an),useStoreUpdater(gt,_n),useStoreUpdater(yt,Pn),useStoreUpdater(Et,$n),useStoreUpdater(bt,Nn),null},style$1={display:"none"},ariaLiveStyle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ARIA_NODE_DESC_KEY="react-flow__node-desc",ARIA_EDGE_DESC_KEY="react-flow__edge-desc",ARIA_LIVE_MESSAGE="react-flow__aria-live",selector$c=tt=>tt.ariaLiveMessage;function AriaLiveMessage({rfId:tt}){const et=useStore(selector$c);return React$1.createElement("div",{id:`${ARIA_LIVE_MESSAGE}-${tt}`,"aria-live":"assertive","aria-atomic":"true",style:ariaLiveStyle},et)}function A11yDescriptions({rfId:tt,disableKeyboardA11y:et}){return React$1.createElement(React$1.Fragment,null,React$1.createElement("div",{id:`${ARIA_NODE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select a node.",!et&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),React$1.createElement("div",{id:`${ARIA_EDGE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!et&&React$1.createElement(AriaLiveMessage,{rfId:tt}))}var useKeyPress=(tt=null,et={actInsideInputWithModifier:!0})=>{const[nt,rt]=reactExports.useState(!1),it=reactExports.useRef(!1),ot=reactExports.useRef(new Set([])),[at,st]=reactExports.useMemo(()=>{if(tt!==null){const ct=(Array.isArray(tt)?tt:[tt]).filter(ht=>typeof ht=="string").map(ht=>ht.split("+")),ut=ct.reduce((ht,dt)=>ht.concat(...dt),[]);return[ct,ut]}return[[],[]]},[tt]);return reactExports.useEffect(()=>{const lt=typeof document<"u"?document:null,ct=(et==null?void 0:et.target)||lt;if(tt!==null){const ut=pt=>{if(it.current=pt.ctrlKey||pt.metaKey||pt.shiftKey,(!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);ot.current.add(pt[gt]),isMatchingKey(at,ot.current,!1)&&(pt.preventDefault(),rt(!0))},ht=pt=>{if((!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);isMatchingKey(at,ot.current,!0)?(rt(!1),ot.current.clear()):ot.current.delete(pt[gt]),pt.key==="Meta"&&ot.current.clear(),it.current=!1},dt=()=>{ot.current.clear(),rt(!1)};return ct==null||ct.addEventListener("keydown",ut),ct==null||ct.addEventListener("keyup",ht),window.addEventListener("blur",dt),()=>{ct==null||ct.removeEventListener("keydown",ut),ct==null||ct.removeEventListener("keyup",ht),window.removeEventListener("blur",dt)}}},[tt,rt]),nt};function isMatchingKey(tt,et,nt){return tt.filter(rt=>nt||rt.length===et.size).some(rt=>rt.every(it=>et.has(it)))}function useKeyOrCode(tt,et){return et.includes(tt)?"code":"key"}function calculateXYZPosition(tt,et,nt,rt){var at,st;if(!tt.parentNode)return nt;const it=et.get(tt.parentNode),ot=getNodePositionWithOrigin(it,rt);return calculateXYZPosition(it,et,{x:(nt.x??0)+ot.x,y:(nt.y??0)+ot.y,z:(((at=it[internalsSymbol])==null?void 0:at.z)??0)>(nt.z??0)?((st=it[internalsSymbol])==null?void 0:st.z)??0:nt.z??0},rt)}function updateAbsoluteNodePositions(tt,et,nt){tt.forEach(rt=>{var it;if(rt.parentNode&&!tt.has(rt.parentNode))throw new Error(`Parent node ${rt.parentNode} not found`);if(rt.parentNode||nt!=null&&nt[rt.id]){const{x:ot,y:at,z:st}=calculateXYZPosition(rt,tt,{...rt.position,z:((it=rt[internalsSymbol])==null?void 0:it.z)??0},et);rt.positionAbsolute={x:ot,y:at},rt[internalsSymbol].z=st,nt!=null&&nt[rt.id]&&(rt[internalsSymbol].isParent=!0)}})}function createNodeInternals(tt,et,nt,rt){const it=new Map,ot={},at=rt?1e3:0;return tt.forEach(st=>{var ht;const lt=(isNumeric(st.zIndex)?st.zIndex:0)+(st.selected?at:0),ct=et.get(st.id),ut={width:ct==null?void 0:ct.width,height:ct==null?void 0:ct.height,...st,positionAbsolute:{x:st.position.x,y:st.position.y}};st.parentNode&&(ut.parentNode=st.parentNode,ot[st.parentNode]=!0),Object.defineProperty(ut,internalsSymbol,{enumerable:!1,value:{handleBounds:(ht=ct==null?void 0:ct[internalsSymbol])==null?void 0:ht.handleBounds,z:lt}}),it.set(st.id,ut)}),updateAbsoluteNodePositions(it,nt,ot),it}function fitView(tt,et={}){const{getNodes:nt,width:rt,height:it,minZoom:ot,maxZoom:at,d3Zoom:st,d3Selection:lt,fitViewOnInitDone:ct,fitViewOnInit:ut,nodeOrigin:ht}=tt(),dt=et.initial&&!ct&&ut;if(st&<&&(dt||!et.initial)){const mt=nt().filter(yt=>{var vt;const bt=et.includeHiddenNodes?yt.width&&yt.height:!yt.hidden;return(vt=et.nodes)!=null&&vt.length?bt&&et.nodes.some(xt=>xt.id===yt.id):bt}),gt=mt.every(yt=>yt.width&&yt.height);if(mt.length>0&>){const yt=getRectOfNodes(mt,ht),[bt,vt,xt]=getTransformForBounds(yt,rt,it,et.minZoom??ot,et.maxZoom??at,et.padding??.1),kt=identity.translate(bt,vt).scale(xt);return typeof et.duration=="number"&&et.duration>0?st.transform(getD3Transition(lt,et.duration),kt):st.transform(lt,kt),!0}}return!1}function handleControlledNodeSelectionChange(tt,et){return tt.forEach(nt=>{const rt=et.get(nt.id);rt&&et.set(rt.id,{...rt,[internalsSymbol]:rt[internalsSymbol],selected:nt.selected})}),new Map(et)}function handleControlledEdgeSelectionChange(tt,et){return et.map(nt=>{const rt=tt.find(it=>it.id===nt.id);return rt&&(nt.selected=rt.selected),nt})}function updateNodesAndEdgesSelections({changedNodes:tt,changedEdges:et,get:nt,set:rt}){const{nodeInternals:it,edges:ot,onNodesChange:at,onEdgesChange:st,hasDefaultNodes:lt,hasDefaultEdges:ct}=nt();tt!=null&&tt.length&&(lt&&rt({nodeInternals:handleControlledNodeSelectionChange(tt,it)}),at==null||at(tt)),et!=null&&et.length&&(ct&&rt({edges:handleControlledEdgeSelectionChange(et,ot)}),st==null||st(et))}const noop$1=()=>{},initialViewportHelper={zoomIn:noop$1,zoomOut:noop$1,zoomTo:noop$1,getZoom:()=>1,setViewport:noop$1,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:noop$1,fitBounds:noop$1,project:tt=>tt,viewportInitialized:!1},selector$b=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection}),useViewportHelper=()=>{const tt=useStoreApi(),{d3Zoom:et,d3Selection:nt}=useStore(selector$b,shallow$1);return reactExports.useMemo(()=>nt&&et?{zoomIn:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1.2),zoomOut:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1/1.2),zoomTo:(it,ot)=>et.scaleTo(getD3Transition(nt,ot==null?void 0:ot.duration),it),getZoom:()=>tt.getState().transform[2],setViewport:(it,ot)=>{const[at,st,lt]=tt.getState().transform,ct=identity.translate(it.x??at,it.y??st).scale(it.zoom??lt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),ct)},getViewport:()=>{const[it,ot,at]=tt.getState().transform;return{x:it,y:ot,zoom:at}},fitView:it=>fitView(tt.getState,it),setCenter:(it,ot,at)=>{const{width:st,height:lt,maxZoom:ct}=tt.getState(),ut=typeof(at==null?void 0:at.zoom)<"u"?at.zoom:ct,ht=st/2-it*ut,dt=lt/2-ot*ut,pt=identity.translate(ht,dt).scale(ut);et.transform(getD3Transition(nt,at==null?void 0:at.duration),pt)},fitBounds:(it,ot)=>{const{width:at,height:st,minZoom:lt,maxZoom:ct}=tt.getState(),[ut,ht,dt]=getTransformForBounds(it,at,st,lt,ct,(ot==null?void 0:ot.padding)??.1),pt=identity.translate(ut,ht).scale(dt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),pt)},project:it=>{const{transform:ot,snapToGrid:at,snapGrid:st}=tt.getState();return pointToRendererPoint(it,ot,at,st)},viewportInitialized:!0}:initialViewportHelper,[et,nt])};function useReactFlow(){const tt=useViewportHelper(),et=useStoreApi(),nt=reactExports.useCallback(()=>et.getState().getNodes().map(gt=>({...gt})),[]),rt=reactExports.useCallback(gt=>et.getState().nodeInternals.get(gt),[]),it=reactExports.useCallback(()=>{const{edges:gt=[]}=et.getState();return gt.map(yt=>({...yt}))},[]),ot=reactExports.useCallback(gt=>{const{edges:yt=[]}=et.getState();return yt.find(bt=>bt.id===gt)},[]),at=reactExports.useCallback(gt=>{const{getNodes:yt,setNodes:bt,hasDefaultNodes:vt,onNodesChange:xt}=et.getState(),kt=yt(),St=typeof gt=="function"?gt(kt):gt;if(vt)bt(St);else if(xt){const Tt=St.length===0?kt.map(At=>({type:"remove",id:At.id})):St.map(At=>({item:At,type:"reset"}));xt(Tt)}},[]),st=reactExports.useCallback(gt=>{const{edges:yt=[],setEdges:bt,hasDefaultEdges:vt,onEdgesChange:xt}=et.getState(),kt=typeof gt=="function"?gt(yt):gt;if(vt)bt(kt);else if(xt){const St=kt.length===0?yt.map(Tt=>({type:"remove",id:Tt.id})):kt.map(Tt=>({item:Tt,type:"reset"}));xt(St)}},[]),lt=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{getNodes:bt,setNodes:vt,hasDefaultNodes:xt,onNodesChange:kt}=et.getState();if(xt){const Tt=[...bt(),...yt];vt(Tt)}else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ct=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{edges:bt=[],setEdges:vt,hasDefaultEdges:xt,onEdgesChange:kt}=et.getState();if(xt)vt([...bt,...yt]);else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ut=reactExports.useCallback(()=>{const{getNodes:gt,edges:yt=[],transform:bt}=et.getState(),[vt,xt,kt]=bt;return{nodes:gt().map(St=>({...St})),edges:yt.map(St=>({...St})),viewport:{x:vt,y:xt,zoom:kt}}},[]),ht=reactExports.useCallback(({nodes:gt,edges:yt})=>{const{nodeInternals:bt,getNodes:vt,edges:xt,hasDefaultNodes:kt,hasDefaultEdges:St,onNodesDelete:Tt,onEdgesDelete:At,onNodesChange:Et,onEdgesChange:$t}=et.getState(),Dt=(gt||[]).map(It=>It.id),jt=(yt||[]).map(It=>It.id),Pt=vt().reduce((It,Ot)=>{const Wt=!Dt.includes(Ot.id)&&Ot.parentNode&&It.find(Ft=>Ft.id===Ot.parentNode);return(typeof Ot.deletable=="boolean"?Ot.deletable:!0)&&(Dt.includes(Ot.id)||Wt)&&It.push(Ot),It},[]),Ct=xt.filter(It=>typeof It.deletable=="boolean"?It.deletable:!0),wt=Ct.filter(It=>jt.includes(It.id));if(Pt||wt){const It=getConnectedEdges(Pt,Ct),Ot=[...wt,...It],Wt=Ot.reduce((zt,Ft)=>(zt.includes(Ft.id)||zt.push(Ft.id),zt),[]);if((St||kt)&&(St&&et.setState({edges:xt.filter(zt=>!Wt.includes(zt.id))}),kt&&(Pt.forEach(zt=>{bt.delete(zt.id)}),et.setState({nodeInternals:new Map(bt)}))),Wt.length>0&&(At==null||At(Ot),$t&&$t(Wt.map(zt=>({id:zt,type:"remove"})))),Pt.length>0&&(Tt==null||Tt(Pt),Et)){const zt=Pt.map(Ft=>({id:Ft.id,type:"remove"}));Et(zt)}}},[]),dt=reactExports.useCallback(gt=>{const yt=isRectObject(gt),bt=yt?null:et.getState().nodeInternals.get(gt.id);return[yt?gt:nodeToRect(bt),bt,yt]},[]),pt=reactExports.useCallback((gt,yt=!0,bt)=>{const[vt,xt,kt]=dt(gt);return vt?(bt||et.getState().getNodes()).filter(St=>{if(!kt&&(St.id===xt.id||!St.positionAbsolute))return!1;const Tt=nodeToRect(St),At=getOverlappingArea(Tt,vt);return yt&&At>0||At>=gt.width*gt.height}):[]},[]),mt=reactExports.useCallback((gt,yt,bt=!0)=>{const[vt]=dt(gt);if(!vt)return!1;const xt=getOverlappingArea(vt,yt);return bt&&xt>0||xt>=gt.width*gt.height},[]);return reactExports.useMemo(()=>({...tt,getNodes:nt,getNode:rt,getEdges:it,getEdge:ot,setNodes:at,setEdges:st,addNodes:lt,addEdges:ct,toObject:ut,deleteElements:ht,getIntersectingNodes:pt,isNodeIntersecting:mt}),[tt,nt,rt,it,ot,at,st,lt,ct,ut,ht,pt,mt])}const deleteKeyOptions={actInsideInputWithModifier:!1};var useGlobalKeyHandler=({deleteKeyCode:tt,multiSelectionKeyCode:et})=>{const nt=useStoreApi(),{deleteElements:rt}=useReactFlow(),it=useKeyPress(tt,deleteKeyOptions),ot=useKeyPress(et);reactExports.useEffect(()=>{if(it){const{edges:at,getNodes:st}=nt.getState(),lt=st().filter(ut=>ut.selected),ct=at.filter(ut=>ut.selected);rt({nodes:lt,edges:ct}),nt.setState({nodesSelectionActive:!1})}},[it]),reactExports.useEffect(()=>{nt.setState({multiSelectionActive:ot})},[ot])};function useResizeHandler(tt){const et=useStoreApi();reactExports.useEffect(()=>{let nt;const rt=()=>{var ot,at;if(!tt.current)return;const it=getDimensions(tt.current);(it.height===0||it.width===0)&&((at=(ot=et.getState()).onError)==null||at.call(ot,"004",errorMessages.error004())),et.setState({width:it.width||500,height:it.height||500})};return rt(),window.addEventListener("resize",rt),tt.current&&(nt=new ResizeObserver(()=>rt()),nt.observe(tt.current)),()=>{window.removeEventListener("resize",rt),nt&&tt.current&&nt.unobserve(tt.current)}},[])}const containerStyle={position:"absolute",width:"100%",height:"100%",top:0,left:0},viewChanged=(tt,et)=>tt.x!==et.x||tt.y!==et.y||tt.zoom!==et.k,eventToFlowTransform=tt=>({x:tt.x,y:tt.y,zoom:tt.k}),isWrappedWithClass=(tt,et)=>tt.target.closest(`.${et}`),isRightClickPan=(tt,et)=>et===2&&Array.isArray(tt)&&tt.includes(2),wheelDelta=tt=>{const et=tt.ctrlKey&&isMacOs()?10:1;return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*et},selector$a=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection,d3ZoomHandler:tt.d3ZoomHandler,userSelectionActive:tt.userSelectionActive}),ZoomPane=({onMove:tt,onMoveStart:et,onMoveEnd:nt,onPaneContextMenu:rt,zoomOnScroll:it=!0,zoomOnPinch:ot=!0,panOnScroll:at=!1,panOnScrollSpeed:st=.5,panOnScrollMode:lt=PanOnScrollMode.Free,zoomOnDoubleClick:ct=!0,elementsSelectable:ut,panOnDrag:ht=!0,defaultViewport:dt,translateExtent:pt,minZoom:mt,maxZoom:gt,zoomActivationKeyCode:yt,preventScrolling:bt=!0,children:vt,noWheelClassName:xt,noPanClassName:kt})=>{const St=reactExports.useRef(),Tt=useStoreApi(),At=reactExports.useRef(!1),Et=reactExports.useRef(!1),$t=reactExports.useRef(null),Dt=reactExports.useRef({x:0,y:0,zoom:0}),{d3Zoom:jt,d3Selection:Pt,d3ZoomHandler:Ct,userSelectionActive:wt}=useStore(selector$a,shallow$1),It=useKeyPress(yt),Ot=reactExports.useRef(0),Wt=reactExports.useRef(!1),zt=reactExports.useRef();return useResizeHandler($t),reactExports.useEffect(()=>{if($t.current){const Ft=$t.current.getBoundingClientRect(),Nt=zoom().scaleExtent([mt,gt]).translateExtent(pt),Ut=select($t.current).call(Nt),Mt=identity.translate(dt.x,dt.y).scale(clamp(dt.zoom,mt,gt)),Ht=[[0,0],[Ft.width,Ft.height]],en=Nt.constrain()(Mt,Ht,pt);Nt.transform(Ut,en),Nt.wheelDelta(wheelDelta),Tt.setState({d3Zoom:Nt,d3Selection:Ut,d3ZoomHandler:Ut.on("wheel.zoom"),transform:[en.x,en.y,en.k],domNode:$t.current.closest(".react-flow")})}},[]),reactExports.useEffect(()=>{Pt&&jt&&(at&&!It&&!wt?Pt.on("wheel.zoom",Ft=>{if(isWrappedWithClass(Ft,xt))return!1;Ft.preventDefault(),Ft.stopImmediatePropagation();const Nt=Pt.property("__zoom").k||1,Ut=isMacOs();if(Ft.ctrlKey&&ot&&Ut){const hn=pointer(Ft),vn=wheelDelta(Ft),an=Nt*Math.pow(2,vn);jt.scaleTo(Pt,an,hn,Ft);return}const Mt=Ft.deltaMode===1?20:1;let Ht=lt===PanOnScrollMode.Vertical?0:Ft.deltaX*Mt,en=lt===PanOnScrollMode.Horizontal?0:Ft.deltaY*Mt;!Ut&&Ft.shiftKey&<!==PanOnScrollMode.Vertical&&(Ht=Ft.deltaY*Mt,en=0),jt.translateBy(Pt,-(Ht/Nt)*st,-(en/Nt)*st,{internal:!0});const sn=eventToFlowTransform(Pt.property("__zoom")),{onViewportChangeStart:Kt,onViewportChange:rn,onViewportChangeEnd:nn}=Tt.getState();clearTimeout(zt.current),Wt.current||(Wt.current=!0,et==null||et(Ft,sn),Kt==null||Kt(sn)),Wt.current&&(tt==null||tt(Ft,sn),rn==null||rn(sn),zt.current=setTimeout(()=>{nt==null||nt(Ft,sn),nn==null||nn(sn),Wt.current=!1},150))},{passive:!1}):typeof Ct<"u"&&Pt.on("wheel.zoom",function(Ft,Nt){if(!bt||isWrappedWithClass(Ft,xt))return null;Ft.preventDefault(),Ct.call(this,Ft,Nt)},{passive:!1}))},[wt,at,lt,Pt,jt,Ct,It,ot,bt,xt,et,tt,nt]),reactExports.useEffect(()=>{jt&&jt.on("start",Ft=>{var Mt,Ht;if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;Ot.current=(Mt=Ft.sourceEvent)==null?void 0:Mt.button;const{onViewportChangeStart:Nt}=Tt.getState(),Ut=eventToFlowTransform(Ft.transform);At.current=!0,Dt.current=Ut,((Ht=Ft.sourceEvent)==null?void 0:Ht.type)==="mousedown"&&Tt.setState({paneDragging:!0}),Nt==null||Nt(Ut),et==null||et(Ft.sourceEvent,Ut)})},[jt,et]),reactExports.useEffect(()=>{jt&&(wt&&!At.current?jt.on("zoom",null):wt||jt.on("zoom",Ft=>{var Ut;const{onViewportChange:Nt}=Tt.getState();if(Tt.setState({transform:[Ft.transform.x,Ft.transform.y,Ft.transform.k]}),Et.current=!!(rt&&isRightClickPan(ht,Ot.current??0)),(tt||Nt)&&!((Ut=Ft.sourceEvent)!=null&&Ut.internal)){const Mt=eventToFlowTransform(Ft.transform);Nt==null||Nt(Mt),tt==null||tt(Ft.sourceEvent,Mt)}}))},[wt,jt,tt,ht,rt]),reactExports.useEffect(()=>{jt&&jt.on("end",Ft=>{if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;const{onViewportChangeEnd:Nt}=Tt.getState();if(At.current=!1,Tt.setState({paneDragging:!1}),rt&&isRightClickPan(ht,Ot.current??0)&&!Et.current&&rt(Ft.sourceEvent),Et.current=!1,(nt||Nt)&&viewChanged(Dt.current,Ft.transform)){const Ut=eventToFlowTransform(Ft.transform);Dt.current=Ut,clearTimeout(St.current),St.current=setTimeout(()=>{Nt==null||Nt(Ut),nt==null||nt(Ft.sourceEvent,Ut)},at?150:0)}})},[jt,at,ht,nt,rt]),reactExports.useEffect(()=>{jt&&jt.filter(Ft=>{const Nt=It||it,Ut=ot&&Ft.ctrlKey;if((ht===!0||Array.isArray(ht)&&ht.includes(1))&&Ft.button===1&&Ft.type==="mousedown"&&(isWrappedWithClass(Ft,"react-flow__node")||isWrappedWithClass(Ft,"react-flow__edge")))return!0;if(!ht&&!Nt&&!at&&!ct&&!ot||wt||!ct&&Ft.type==="dblclick"||isWrappedWithClass(Ft,xt)&&Ft.type==="wheel"||isWrappedWithClass(Ft,kt)&&(Ft.type!=="wheel"||at&&Ft.type==="wheel")||!ot&&Ft.ctrlKey&&Ft.type==="wheel"||!Nt&&!at&&!Ut&&Ft.type==="wheel"||!ht&&(Ft.type==="mousedown"||Ft.type==="touchstart")||Array.isArray(ht)&&!ht.includes(Ft.button)&&(Ft.type==="mousedown"||Ft.type==="touchstart"))return!1;const Mt=Array.isArray(ht)&&ht.includes(Ft.button)||!Ft.button||Ft.button<=1;return(!Ft.ctrlKey||Ft.type==="wheel")&&Mt})},[wt,jt,it,ot,at,ct,ht,ut,It]),React$1.createElement("div",{className:"react-flow__renderer",ref:$t,style:containerStyle},vt)},selector$9=tt=>({userSelectionActive:tt.userSelectionActive,userSelectionRect:tt.userSelectionRect});function UserSelection(){const{userSelectionActive:tt,userSelectionRect:et}=useStore(selector$9,shallow$1);return tt&&et?React$1.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:et.width,height:et.height,transform:`translate(${et.x}px, ${et.y}px)`}}):null}function handleParentExpand(tt,et){const nt=tt.find(rt=>rt.id===et.parentNode);if(nt){const rt=et.position.x+et.width-nt.width,it=et.position.y+et.height-nt.height;if(rt>0||it>0||et.position.x<0||et.position.y<0){if(nt.style={...nt.style},nt.style.width=nt.style.width??nt.width,nt.style.height=nt.style.height??nt.height,rt>0&&(nt.style.width+=rt),it>0&&(nt.style.height+=it),et.position.x<0){const ot=Math.abs(et.position.x);nt.position.x=nt.position.x-ot,nt.style.width+=ot,et.position.x=0}if(et.position.y<0){const ot=Math.abs(et.position.y);nt.position.y=nt.position.y-ot,nt.style.height+=ot,et.position.y=0}nt.width=nt.style.width,nt.height=nt.style.height}}}function applyChanges(tt,et){if(tt.some(rt=>rt.type==="reset"))return tt.filter(rt=>rt.type==="reset").map(rt=>rt.item);const nt=tt.filter(rt=>rt.type==="add").map(rt=>rt.item);return et.reduce((rt,it)=>{const ot=tt.filter(st=>st.id===it.id);if(ot.length===0)return rt.push(it),rt;const at={...it};for(const st of ot)if(st)switch(st.type){case"select":{at.selected=st.selected;break}case"position":{typeof st.position<"u"&&(at.position=st.position),typeof st.positionAbsolute<"u"&&(at.positionAbsolute=st.positionAbsolute),typeof st.dragging<"u"&&(at.dragging=st.dragging),at.expandParent&&handleParentExpand(rt,at);break}case"dimensions":{typeof st.dimensions<"u"&&(at.width=st.dimensions.width,at.height=st.dimensions.height),typeof st.updateStyle<"u"&&(at.style={...at.style||{},...st.dimensions}),typeof st.resizing=="boolean"&&(at.resizing=st.resizing),at.expandParent&&handleParentExpand(rt,at);break}case"remove":return rt}return rt.push(at),rt},nt)}function applyNodeChanges(tt,et){return applyChanges(tt,et)}const createSelectionChange=(tt,et)=>({id:tt,type:"select",selected:et});function getSelectionChanges(tt,et){return tt.reduce((nt,rt)=>{const it=et.includes(rt.id);return!rt.selected&&it?(rt.selected=!0,nt.push(createSelectionChange(rt.id,!0))):rt.selected&&!it&&(rt.selected=!1,nt.push(createSelectionChange(rt.id,!1))),nt},[])}const wrapHandler=(tt,et)=>nt=>{nt.target===et.current&&(tt==null||tt(nt))},selector$8=tt=>({userSelectionActive:tt.userSelectionActive,elementsSelectable:tt.elementsSelectable,dragging:tt.paneDragging}),Pane=reactExports.memo(({isSelecting:tt,selectionMode:et=SelectionMode.Full,panOnDrag:nt,onSelectionStart:rt,onSelectionEnd:it,onPaneClick:ot,onPaneContextMenu:at,onPaneScroll:st,onPaneMouseEnter:lt,onPaneMouseMove:ct,onPaneMouseLeave:ut,children:ht})=>{const dt=reactExports.useRef(null),pt=useStoreApi(),mt=reactExports.useRef(0),gt=reactExports.useRef(0),yt=reactExports.useRef(),{userSelectionActive:bt,elementsSelectable:vt,dragging:xt}=useStore(selector$8,shallow$1),kt=()=>{pt.setState({userSelectionActive:!1,userSelectionRect:null}),mt.current=0,gt.current=0},St=Ct=>{ot==null||ot(Ct),pt.getState().resetSelectedElements(),pt.setState({nodesSelectionActive:!1})},Tt=Ct=>{if(Array.isArray(nt)&&(nt!=null&&nt.includes(2))){Ct.preventDefault();return}at==null||at(Ct)},At=st?Ct=>st(Ct):void 0,Et=Ct=>{const{resetSelectedElements:wt,domNode:It}=pt.getState();if(yt.current=It==null?void 0:It.getBoundingClientRect(),!vt||!tt||Ct.button!==0||Ct.target!==dt.current||!yt.current)return;const{x:Ot,y:Wt}=getEventPosition(Ct,yt.current);wt(),pt.setState({userSelectionRect:{width:0,height:0,startX:Ot,startY:Wt,x:Ot,y:Wt}}),rt==null||rt(Ct)},$t=Ct=>{const{userSelectionRect:wt,nodeInternals:It,edges:Ot,transform:Wt,onNodesChange:zt,onEdgesChange:Ft,nodeOrigin:Nt,getNodes:Ut}=pt.getState();if(!tt||!yt.current||!wt)return;pt.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Mt=getEventPosition(Ct,yt.current),Ht=wt.startX??0,en=wt.startY??0,sn={...wt,x:Mt.xvn.id),hn=rn.map(vn=>vn.id);if(mt.current!==hn.length){mt.current=hn.length;const vn=getSelectionChanges(Kt,hn);vn.length&&(zt==null||zt(vn))}if(gt.current!==nn.length){gt.current=nn.length;const vn=getSelectionChanges(Ot,nn);vn.length&&(Ft==null||Ft(vn))}pt.setState({userSelectionRect:sn})},Dt=Ct=>{if(Ct.button!==0)return;const{userSelectionRect:wt}=pt.getState();!bt&&wt&&Ct.target===dt.current&&(St==null||St(Ct)),pt.setState({nodesSelectionActive:mt.current>0}),kt(),it==null||it(Ct)},jt=Ct=>{bt&&(pt.setState({nodesSelectionActive:mt.current>0}),it==null||it(Ct)),kt()},Pt=vt&&(tt||bt);return React$1.createElement("div",{className:cc(["react-flow__pane",{dragging:xt,selection:tt}]),onClick:Pt?void 0:wrapHandler(St,dt),onContextMenu:wrapHandler(Tt,dt),onWheel:wrapHandler(At,dt),onMouseEnter:Pt?void 0:lt,onMouseDown:Pt?Et:void 0,onMouseMove:Pt?$t:ct,onMouseUp:Pt?Dt:void 0,onMouseLeave:Pt?jt:ut,ref:dt,style:containerStyle},ht,React$1.createElement(UserSelection,null))});Pane.displayName="Pane";function isParentSelected(tt,et){if(!tt.parentNode)return!1;const nt=et.get(tt.parentNode);return nt?nt.selected?!0:isParentSelected(nt,et):!1}function hasSelector(tt,et,nt){let rt=tt;do{if(rt!=null&&rt.matches(et))return!0;if(rt===nt.current)return!1;rt=rt.parentElement}while(rt);return!1}function getDragItems(tt,et,nt,rt){return Array.from(tt.values()).filter(it=>(it.selected||it.id===rt)&&(!it.parentNode||!isParentSelected(it,tt))&&(it.draggable||et&&typeof it.draggable>"u")).map(it=>{var ot,at;return{id:it.id,position:it.position||{x:0,y:0},positionAbsolute:it.positionAbsolute||{x:0,y:0},distance:{x:nt.x-(((ot=it.positionAbsolute)==null?void 0:ot.x)??0),y:nt.y-(((at=it.positionAbsolute)==null?void 0:at.y)??0)},delta:{x:0,y:0},extent:it.extent,parentNode:it.parentNode,width:it.width,height:it.height,expandParent:it.expandParent}})}function clampNodeExtent(tt,et){return!et||et==="parent"?et:[et[0],[et[1][0]-(tt.width||0),et[1][1]-(tt.height||0)]]}function calcNextPosition(tt,et,nt,rt,it=[0,0],ot){const at=clampNodeExtent(tt,tt.extent||rt);let st=at;if(tt.extent==="parent"&&!tt.expandParent)if(tt.parentNode&&tt.width&&tt.height){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=ut&&isNumeric(ht)&&isNumeric(dt)&&isNumeric(ut.width)&&isNumeric(ut.height)?[[ht+tt.width*it[0],dt+tt.height*it[1]],[ht+ut.width-tt.width+tt.width*it[0],dt+ut.height-tt.height+tt.height*it[1]]]:st}else ot==null||ot("005",errorMessages.error005()),st=at;else if(tt.extent&&tt.parentNode&&tt.extent!=="parent"){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=[[tt.extent[0][0]+ht,tt.extent[0][1]+dt],[tt.extent[1][0]+ht,tt.extent[1][1]+dt]]}let lt={x:0,y:0};if(tt.parentNode){const ut=nt.get(tt.parentNode);lt=getNodePositionWithOrigin(ut,it).positionAbsolute}const ct=st&&st!=="parent"?clampPosition(et,st):et;return{position:{x:ct.x-lt.x,y:ct.y-lt.y},positionAbsolute:ct}}function getEventHandlerParams({nodeId:tt,dragItems:et,nodeInternals:nt}){const rt=et.map(it=>({...nt.get(it.id),position:it.position,positionAbsolute:it.positionAbsolute}));return[tt?rt.find(it=>it.id===tt):rt[0],rt]}const getHandleBounds=(tt,et,nt,rt)=>{const it=et.querySelectorAll(tt);if(!it||!it.length)return null;const ot=Array.from(it),at=et.getBoundingClientRect(),st={x:at.width*rt[0],y:at.height*rt[1]};return ot.map(lt=>{const ct=lt.getBoundingClientRect();return{id:lt.getAttribute("data-handleid"),position:lt.getAttribute("data-handlepos"),x:(ct.left-at.left-st.x)/nt,y:(ct.top-at.top-st.y)/nt,...getDimensions(lt)}})};function getMouseHandler(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().nodeInternals.get(tt);it&&nt(rt,{...it})}}function handleNodeClick({id:tt,store:et,unselect:nt=!1,nodeRef:rt}){const{addSelectedNodes:it,unselectNodesAndEdges:ot,multiSelectionActive:at,nodeInternals:st,onError:lt}=et.getState(),ct=st.get(tt);if(!ct){lt==null||lt("012",errorMessages.error012(tt));return}et.setState({nodesSelectionActive:!1}),ct.selected?(nt||ct.selected&&at)&&(ot({nodes:[ct],edges:[]}),requestAnimationFrame(()=>{var ut;return(ut=rt==null?void 0:rt.current)==null?void 0:ut.blur()})):it([tt])}function useGetPointerPosition(){const tt=useStoreApi();return reactExports.useCallback(({sourceEvent:nt})=>{const{transform:rt,snapGrid:it,snapToGrid:ot}=tt.getState(),at=nt.touches?nt.touches[0].clientX:nt.clientX,st=nt.touches?nt.touches[0].clientY:nt.clientY,lt={x:(at-rt[0])/rt[2],y:(st-rt[1])/rt[2]};return{xSnapped:ot?it[0]*Math.round(lt.x/it[0]):lt.x,ySnapped:ot?it[1]*Math.round(lt.y/it[1]):lt.y,...lt}},[])}function wrapSelectionDragFunc(tt){return(et,nt,rt)=>tt==null?void 0:tt(et,rt)}function useDrag({nodeRef:tt,disabled:et=!1,noDragClassName:nt,handleSelector:rt,nodeId:it,isSelectable:ot,selectNodesOnDrag:at}){const st=useStoreApi(),[lt,ct]=reactExports.useState(!1),ut=reactExports.useRef([]),ht=reactExports.useRef({x:null,y:null}),dt=reactExports.useRef(0),pt=reactExports.useRef(null),mt=reactExports.useRef({x:0,y:0}),gt=reactExports.useRef(null),yt=reactExports.useRef(!1),bt=reactExports.useRef(!1),vt=useGetPointerPosition();return reactExports.useEffect(()=>{if(tt!=null&&tt.current){const xt=select(tt.current),kt=({x:At,y:Et})=>{const{nodeInternals:$t,onNodeDrag:Dt,onSelectionDrag:jt,updateNodePositions:Pt,nodeExtent:Ct,snapGrid:wt,snapToGrid:It,nodeOrigin:Ot,onError:Wt}=st.getState();ht.current={x:At,y:Et};let zt=!1,Ft={x:0,y:0,x2:0,y2:0};if(ut.current.length>1&&Ct){const Ut=getRectOfNodes(ut.current,Ot);Ft=rectToBox(Ut)}if(ut.current=ut.current.map(Ut=>{const Mt={x:At-Ut.distance.x,y:Et-Ut.distance.y};It&&(Mt.x=wt[0]*Math.round(Mt.x/wt[0]),Mt.y=wt[1]*Math.round(Mt.y/wt[1]));const Ht=[[Ct[0][0],Ct[0][1]],[Ct[1][0],Ct[1][1]]];ut.current.length>1&&Ct&&!Ut.extent&&(Ht[0][0]=Ut.positionAbsolute.x-Ft.x+Ct[0][0],Ht[1][0]=Ut.positionAbsolute.x+(Ut.width??0)-Ft.x2+Ct[1][0],Ht[0][1]=Ut.positionAbsolute.y-Ft.y+Ct[0][1],Ht[1][1]=Ut.positionAbsolute.y+(Ut.height??0)-Ft.y2+Ct[1][1]);const en=calcNextPosition(Ut,Mt,$t,Ht,Ot,Wt);return zt=zt||Ut.position.x!==en.position.x||Ut.position.y!==en.position.y,Ut.position=en.position,Ut.positionAbsolute=en.positionAbsolute,Ut}),!zt)return;Pt(ut.current,!0,!0),ct(!0);const Nt=it?Dt:wrapSelectionDragFunc(jt);if(Nt&>.current){const[Ut,Mt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:$t});Nt(gt.current,Ut,Mt)}},St=()=>{if(!pt.current)return;const[At,Et]=calcAutoPan(mt.current,pt.current);if(At!==0||Et!==0){const{transform:$t,panBy:Dt}=st.getState();ht.current.x=(ht.current.x??0)-At/$t[2],ht.current.y=(ht.current.y??0)-Et/$t[2],Dt({x:At,y:Et})&&kt(ht.current)}dt.current=requestAnimationFrame(St)},Tt=At=>{var Ot;const{nodeInternals:Et,multiSelectionActive:$t,nodesDraggable:Dt,unselectNodesAndEdges:jt,onNodeDragStart:Pt,onSelectionDragStart:Ct}=st.getState();bt.current=!0;const wt=it?Pt:wrapSelectionDragFunc(Ct);(!at||!ot)&&!$t&&it&&((Ot=Et.get(it))!=null&&Ot.selected||jt()),it&&ot&&at&&handleNodeClick({id:it,store:st,nodeRef:tt});const It=vt(At);if(ht.current=It,ut.current=getDragItems(Et,Dt,It,it),wt&&ut.current){const[Wt,zt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Et});wt(At.sourceEvent,Wt,zt)}};if(et)xt.on(".drag",null);else{const At=drag().on("start",Et=>{const{domNode:$t,nodeDragThreshold:Dt}=st.getState();Dt===0&&Tt(Et);const jt=vt(Et);ht.current=jt,pt.current=($t==null?void 0:$t.getBoundingClientRect())||null,mt.current=getEventPosition(Et.sourceEvent,pt.current)}).on("drag",Et=>{var Pt,Ct;const $t=vt(Et),{autoPanOnNodeDrag:Dt,nodeDragThreshold:jt}=st.getState();if(!yt.current&&bt.current&&Dt&&(yt.current=!0,St()),!bt.current){const wt=$t.xSnapped-(((Pt=ht==null?void 0:ht.current)==null?void 0:Pt.x)??0),It=$t.ySnapped-(((Ct=ht==null?void 0:ht.current)==null?void 0:Ct.y)??0);Math.sqrt(wt*wt+It*It)>jt&&Tt(Et)}(ht.current.x!==$t.xSnapped||ht.current.y!==$t.ySnapped)&&ut.current&&bt.current&&(gt.current=Et.sourceEvent,mt.current=getEventPosition(Et.sourceEvent,pt.current),kt($t))}).on("end",Et=>{if(bt.current&&(ct(!1),yt.current=!1,bt.current=!1,cancelAnimationFrame(dt.current),ut.current)){const{updateNodePositions:$t,nodeInternals:Dt,onNodeDragStop:jt,onSelectionDragStop:Pt}=st.getState(),Ct=it?jt:wrapSelectionDragFunc(Pt);if($t(ut.current,!1,!1),Ct){const[wt,It]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Dt});Ct(Et.sourceEvent,wt,It)}}}).filter(Et=>{const $t=Et.target;return!Et.button&&(!nt||!hasSelector($t,`.${nt}`,tt))&&(!rt||hasSelector($t,rt,tt))});return xt.call(At),()=>{xt.on(".drag",null)}}}},[tt,et,nt,rt,ot,st,it,at,vt]),lt}function useUpdateNodePositions(){const tt=useStoreApi();return reactExports.useCallback(nt=>{const{nodeInternals:rt,nodeExtent:it,updateNodePositions:ot,getNodes:at,snapToGrid:st,snapGrid:lt,onError:ct,nodesDraggable:ut}=tt.getState(),ht=at().filter(vt=>vt.selected&&(vt.draggable||ut&&typeof vt.draggable>"u")),dt=st?lt[0]:5,pt=st?lt[1]:5,mt=nt.isShiftPressed?4:1,gt=nt.x*dt*mt,yt=nt.y*pt*mt,bt=ht.map(vt=>{if(vt.positionAbsolute){const xt={x:vt.positionAbsolute.x+gt,y:vt.positionAbsolute.y+yt};st&&(xt.x=lt[0]*Math.round(xt.x/lt[0]),xt.y=lt[1]*Math.round(xt.y/lt[1]));const{positionAbsolute:kt,position:St}=calcNextPosition(vt,xt,rt,it,void 0,ct);vt.position=St,vt.positionAbsolute=kt}return vt});ot(bt,!0,!1)},[])}const arrowKeyDiffs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var wrapNode=tt=>{const et=({id:nt,type:rt,data:it,xPos:ot,yPos:at,xPosOrigin:st,yPosOrigin:lt,selected:ct,onClick:ut,onMouseEnter:ht,onMouseMove:dt,onMouseLeave:pt,onContextMenu:mt,onDoubleClick:gt,style:yt,className:bt,isDraggable:vt,isSelectable:xt,isConnectable:kt,isFocusable:St,selectNodesOnDrag:Tt,sourcePosition:At,targetPosition:Et,hidden:$t,resizeObserver:Dt,dragHandle:jt,zIndex:Pt,isParent:Ct,noDragClassName:wt,noPanClassName:It,initialized:Ot,disableKeyboardA11y:Wt,ariaLabel:zt,rfId:Ft})=>{const Nt=useStoreApi(),Ut=reactExports.useRef(null),Mt=reactExports.useRef(At),Ht=reactExports.useRef(Et),en=reactExports.useRef(rt),sn=xt||vt||ut||ht||dt||pt,Kt=useUpdateNodePositions(),rn=getMouseHandler(nt,Nt.getState,ht),nn=getMouseHandler(nt,Nt.getState,dt),hn=getMouseHandler(nt,Nt.getState,pt),vn=getMouseHandler(nt,Nt.getState,mt),an=getMouseHandler(nt,Nt.getState,gt),Qt=$n=>{const{nodeDragThreshold:Nn}=Nt.getState();if(xt&&(!Tt||!vt||Nn>0)&&handleNodeClick({id:nt,store:Nt,nodeRef:Ut}),ut){const Tn=Nt.getState().nodeInternals.get(nt);Tn&&ut($n,{...Tn})}},_n=$n=>{if(!isInputDOMNode($n))if(elementSelectionKeys.includes($n.key)&&xt){const Nn=$n.key==="Escape";handleNodeClick({id:nt,store:Nt,unselect:Nn,nodeRef:Ut})}else!Wt&&vt&&ct&&Object.prototype.hasOwnProperty.call(arrowKeyDiffs,$n.key)&&(Nt.setState({ariaLiveMessage:`Moved selected node ${$n.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~ot}, y: ${~~at}`}),Kt({x:arrowKeyDiffs[$n.key].x,y:arrowKeyDiffs[$n.key].y,isShiftPressed:$n.shiftKey}))};reactExports.useEffect(()=>{if(Ut.current&&!$t){const $n=Ut.current;return Dt==null||Dt.observe($n),()=>Dt==null?void 0:Dt.unobserve($n)}},[$t]),reactExports.useEffect(()=>{const $n=en.current!==rt,Nn=Mt.current!==At,Tn=Ht.current!==Et;Ut.current&&($n||Nn||Tn)&&($n&&(en.current=rt),Nn&&(Mt.current=At),Tn&&(Ht.current=Et),Nt.getState().updateNodeDimensions([{id:nt,nodeElement:Ut.current,forceUpdate:!0}]))},[nt,rt,At,Et]);const Pn=useDrag({nodeRef:Ut,disabled:$t||!vt,noDragClassName:wt,handleSelector:jt,nodeId:nt,isSelectable:xt,selectNodesOnDrag:Tt});return $t?null:React$1.createElement("div",{className:cc(["react-flow__node",`react-flow__node-${rt}`,{[It]:vt},bt,{selected:ct,selectable:xt,parent:Ct,dragging:Pn}]),ref:Ut,style:{zIndex:Pt,transform:`translate(${st}px,${lt}px)`,pointerEvents:sn?"all":"none",visibility:Ot?"visible":"hidden",...yt},"data-id":nt,"data-testid":`rf__node-${nt}`,onMouseEnter:rn,onMouseMove:nn,onMouseLeave:hn,onContextMenu:vn,onClick:Qt,onDoubleClick:an,onKeyDown:St?_n:void 0,tabIndex:St?0:void 0,role:St?"button":void 0,"aria-describedby":Wt?void 0:`${ARIA_NODE_DESC_KEY}-${Ft}`,"aria-label":zt},React$1.createElement(Provider,{value:nt},React$1.createElement(tt,{id:nt,data:it,type:rt,xPos:ot,yPos:at,selected:ct,isConnectable:kt,sourcePosition:At,targetPosition:Et,dragging:Pn,dragHandle:jt,zIndex:Pt})))};return et.displayName="NodeWrapper",reactExports.memo(et)};const selector$7=tt=>{const et=tt.getNodes().filter(nt=>nt.selected);return{...getRectOfNodes(et,tt.nodeOrigin),transformString:`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`,userSelectionActive:tt.userSelectionActive}};function NodesSelection({onSelectionContextMenu:tt,noPanClassName:et,disableKeyboardA11y:nt}){const rt=useStoreApi(),{width:it,height:ot,x:at,y:st,transformString:lt,userSelectionActive:ct}=useStore(selector$7,shallow$1),ut=useUpdateNodePositions(),ht=reactExports.useRef(null);if(reactExports.useEffect(()=>{var mt;nt||(mt=ht.current)==null||mt.focus({preventScroll:!0})},[nt]),useDrag({nodeRef:ht}),ct||!it||!ot)return null;const dt=tt?mt=>{const gt=rt.getState().getNodes().filter(yt=>yt.selected);tt(mt,gt)}:void 0,pt=mt=>{Object.prototype.hasOwnProperty.call(arrowKeyDiffs,mt.key)&&ut({x:arrowKeyDiffs[mt.key].x,y:arrowKeyDiffs[mt.key].y,isShiftPressed:mt.shiftKey})};return React$1.createElement("div",{className:cc(["react-flow__nodesselection","react-flow__container",et]),style:{transform:lt}},React$1.createElement("div",{ref:ht,className:"react-flow__nodesselection-rect",onContextMenu:dt,tabIndex:nt?void 0:-1,onKeyDown:nt?void 0:pt,style:{width:it,height:ot,top:st,left:at}}))}var NodesSelection$1=reactExports.memo(NodesSelection);const selector$6=tt=>tt.nodesSelectionActive,FlowRenderer=({children:tt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,deleteKeyCode:st,onMove:lt,onMoveStart:ct,onMoveEnd:ut,selectionKeyCode:ht,selectionOnDrag:dt,selectionMode:pt,onSelectionStart:mt,onSelectionEnd:gt,multiSelectionKeyCode:yt,panActivationKeyCode:bt,zoomActivationKeyCode:vt,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:$t,panOnDrag:Dt,defaultViewport:jt,translateExtent:Pt,minZoom:Ct,maxZoom:wt,preventScrolling:It,onSelectionContextMenu:Ot,noWheelClassName:Wt,noPanClassName:zt,disableKeyboardA11y:Ft})=>{const Nt=useStore(selector$6),Ut=useKeyPress(ht),Ht=useKeyPress(bt)||Dt,en=Ut||dt&&Ht!==!0;return useGlobalKeyHandler({deleteKeyCode:st,multiSelectionKeyCode:yt}),React$1.createElement(ZoomPane,{onMove:lt,onMoveStart:ct,onMoveEnd:ut,onPaneContextMenu:ot,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:$t,panOnDrag:!Ut&&Ht,defaultViewport:jt,translateExtent:Pt,minZoom:Ct,maxZoom:wt,zoomActivationKeyCode:vt,preventScrolling:It,noWheelClassName:Wt,noPanClassName:zt},React$1.createElement(Pane,{onSelectionStart:mt,onSelectionEnd:gt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,panOnDrag:Ht,isSelecting:!!en,selectionMode:pt},tt,Nt&&React$1.createElement(NodesSelection$1,{onSelectionContextMenu:Ot,noPanClassName:zt,disableKeyboardA11y:Ft})))};FlowRenderer.displayName="FlowRenderer";var FlowRenderer$1=reactExports.memo(FlowRenderer);function useVisibleNodes(tt){return useStore(reactExports.useCallback(nt=>tt?getNodesInside(nt.nodeInternals,{x:0,y:0,width:nt.width,height:nt.height},nt.transform,!0):nt.getNodes(),[tt]))}function createNodeTypes(tt){const et={input:wrapNode(tt.input||InputNode$1),default:wrapNode(tt.default||DefaultNode$1),output:wrapNode(tt.output||OutputNode$1),group:wrapNode(tt.group||GroupNode)},nt={},rt=Object.keys(tt).filter(it=>!["input","default","output","group"].includes(it)).reduce((it,ot)=>(it[ot]=wrapNode(tt[ot]||DefaultNode$1),it),nt);return{...et,...rt}}const getPositionWithOrigin=({x:tt,y:et,width:nt,height:rt,origin:it})=>!nt||!rt?{x:tt,y:et}:it[0]<0||it[1]<0||it[0]>1||it[1]>1?{x:tt,y:et}:{x:tt-nt*it[0],y:et-rt*it[1]},selector$5=tt=>({nodesDraggable:tt.nodesDraggable,nodesConnectable:tt.nodesConnectable,nodesFocusable:tt.nodesFocusable,elementsSelectable:tt.elementsSelectable,updateNodeDimensions:tt.updateNodeDimensions,onError:tt.onError}),NodeRenderer=tt=>{const{nodesDraggable:et,nodesConnectable:nt,nodesFocusable:rt,elementsSelectable:it,updateNodeDimensions:ot,onError:at}=useStore(selector$5,shallow$1),st=useVisibleNodes(tt.onlyRenderVisibleElements),lt=reactExports.useRef(),ct=reactExports.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const ut=new ResizeObserver(ht=>{const dt=ht.map(pt=>({id:pt.target.getAttribute("data-id"),nodeElement:pt.target,forceUpdate:!0}));ot(dt)});return lt.current=ut,ut},[]);return reactExports.useEffect(()=>()=>{var ut;(ut=lt==null?void 0:lt.current)==null||ut.disconnect()},[]),React$1.createElement("div",{className:"react-flow__nodes",style:containerStyle},st.map(ut=>{var St,Tt;let ht=ut.type||"default";tt.nodeTypes[ht]||(at==null||at("003",errorMessages.error003(ht)),ht="default");const dt=tt.nodeTypes[ht]||tt.nodeTypes.default,pt=!!(ut.draggable||et&&typeof ut.draggable>"u"),mt=!!(ut.selectable||it&&typeof ut.selectable>"u"),gt=!!(ut.connectable||nt&&typeof ut.connectable>"u"),yt=!!(ut.focusable||rt&&typeof ut.focusable>"u"),bt=tt.nodeExtent?clampPosition(ut.positionAbsolute,tt.nodeExtent):ut.positionAbsolute,vt=(bt==null?void 0:bt.x)??0,xt=(bt==null?void 0:bt.y)??0,kt=getPositionWithOrigin({x:vt,y:xt,width:ut.width??0,height:ut.height??0,origin:tt.nodeOrigin});return React$1.createElement(dt,{key:ut.id,id:ut.id,className:ut.className,style:ut.style,type:ht,data:ut.data,sourcePosition:ut.sourcePosition||Position.Bottom,targetPosition:ut.targetPosition||Position.Top,hidden:ut.hidden,xPos:vt,yPos:xt,xPosOrigin:kt.x,yPosOrigin:kt.y,selectNodesOnDrag:tt.selectNodesOnDrag,onClick:tt.onNodeClick,onMouseEnter:tt.onNodeMouseEnter,onMouseMove:tt.onNodeMouseMove,onMouseLeave:tt.onNodeMouseLeave,onContextMenu:tt.onNodeContextMenu,onDoubleClick:tt.onNodeDoubleClick,selected:!!ut.selected,isDraggable:pt,isSelectable:mt,isConnectable:gt,isFocusable:yt,resizeObserver:ct,dragHandle:ut.dragHandle,zIndex:((St=ut[internalsSymbol])==null?void 0:St.z)??0,isParent:!!((Tt=ut[internalsSymbol])!=null&&Tt.isParent),noDragClassName:tt.noDragClassName,noPanClassName:tt.noPanClassName,initialized:!!ut.width&&!!ut.height,rfId:tt.rfId,disableKeyboardA11y:tt.disableKeyboardA11y,ariaLabel:ut.ariaLabel})}))};NodeRenderer.displayName="NodeRenderer";var NodeRenderer$1=reactExports.memo(NodeRenderer);const shiftX=(tt,et,nt)=>nt===Position.Left?tt-et:nt===Position.Right?tt+et:tt,shiftY=(tt,et,nt)=>nt===Position.Top?tt-et:nt===Position.Bottom?tt+et:tt,EdgeUpdaterClassName="react-flow__edgeupdater",EdgeAnchor=({position:tt,centerX:et,centerY:nt,radius:rt=10,onMouseDown:it,onMouseEnter:ot,onMouseOut:at,type:st})=>React$1.createElement("circle",{onMouseDown:it,onMouseEnter:ot,onMouseOut:at,className:cc([EdgeUpdaterClassName,`${EdgeUpdaterClassName}-${st}`]),cx:shiftX(et,rt,tt),cy:shiftY(nt,rt,tt),r:rt,stroke:"transparent",fill:"transparent"}),alwaysValidConnection=()=>!0;var wrapEdge=tt=>{const et=({id:nt,className:rt,type:it,data:ot,onClick:at,onEdgeDoubleClick:st,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,style:yt,source:bt,target:vt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,elementsSelectable:$t,hidden:Dt,sourceHandleId:jt,targetHandleId:Pt,onContextMenu:Ct,onMouseEnter:wt,onMouseMove:It,onMouseLeave:Ot,edgeUpdaterRadius:Wt,onEdgeUpdate:zt,onEdgeUpdateStart:Ft,onEdgeUpdateEnd:Nt,markerEnd:Ut,markerStart:Mt,rfId:Ht,ariaLabel:en,isFocusable:sn,isUpdatable:Kt,pathOptions:rn,interactionWidth:nn})=>{const hn=reactExports.useRef(null),[vn,an]=reactExports.useState(!1),[Qt,_n]=reactExports.useState(!1),Pn=useStoreApi(),$n=reactExports.useMemo(()=>`url(#${getMarkerId(Mt,Ht)})`,[Mt,Ht]),Nn=reactExports.useMemo(()=>`url(#${getMarkerId(Ut,Ht)})`,[Ut,Ht]);if(Dt)return null;const Tn=Sn=>{var qn;const{edges:Rn,addSelectedEdges:jn,unselectNodesAndEdges:On,multiSelectionActive:Zn}=Pn.getState(),Vn=Rn.find(zn=>zn.id===nt);Vn&&($t&&(Pn.setState({nodesSelectionActive:!1}),Vn.selected&&Zn?(On({nodes:[],edges:[Vn]}),(qn=hn.current)==null||qn.blur()):jn([nt])),at&&at(Sn,Vn))},cn=getMouseHandler$1(nt,Pn.getState,st),mn=getMouseHandler$1(nt,Pn.getState,Ct),In=getMouseHandler$1(nt,Pn.getState,wt),An=getMouseHandler$1(nt,Pn.getState,It),wn=getMouseHandler$1(nt,Pn.getState,Ot),fn=(Sn,Rn)=>{if(Sn.button!==0)return;const{edges:jn,isValidConnection:On}=Pn.getState(),Zn=Rn?vt:bt,Vn=(Rn?Pt:jt)||null,qn=Rn?"target":"source",zn=On||alwaysValidConnection,Jn=Rn,Hn=jn.find(xr=>xr.id===nt);_n(!0),Ft==null||Ft(Sn,Hn,qn);const pr=xr=>{_n(!1),Nt==null||Nt(xr,Hn,qn)};handlePointerDown({event:Sn,handleId:Vn,nodeId:Zn,onConnect:xr=>zt==null?void 0:zt(Hn,xr),isTarget:Jn,getState:Pn.getState,setState:Pn.setState,isValidConnection:zn,edgeUpdaterType:qn,onEdgeUpdateEnd:pr})},pn=Sn=>fn(Sn,!0),kn=Sn=>fn(Sn,!1),Dn=()=>an(!0),un=()=>an(!1),Zt=!$t&&!at,Xt=Sn=>{var Rn;if(elementSelectionKeys.includes(Sn.key)&&$t){const{unselectNodesAndEdges:jn,addSelectedEdges:On,edges:Zn}=Pn.getState();Sn.key==="Escape"?((Rn=hn.current)==null||Rn.blur(),jn({edges:[Zn.find(qn=>qn.id===nt)]})):On([nt])}};return React$1.createElement("g",{className:cc(["react-flow__edge",`react-flow__edge-${it}`,rt,{selected:lt,animated:ct,inactive:Zt,updating:vn}]),onClick:Tn,onDoubleClick:cn,onContextMenu:mn,onMouseEnter:In,onMouseMove:An,onMouseLeave:wn,onKeyDown:sn?Xt:void 0,tabIndex:sn?0:void 0,role:sn?"button":"img","data-testid":`rf__edge-${nt}`,"aria-label":en===null?void 0:en||`Edge from ${bt} to ${vt}`,"aria-describedby":sn?`${ARIA_EDGE_DESC_KEY}-${Ht}`:void 0,ref:hn},!Qt&&React$1.createElement(tt,{id:nt,source:bt,target:vt,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,data:ot,style:yt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,sourceHandleId:jt,targetHandleId:Pt,markerStart:$n,markerEnd:Nn,pathOptions:rn,interactionWidth:nn}),Kt&&React$1.createElement(React$1.Fragment,null,(Kt==="source"||Kt===!0)&&React$1.createElement(EdgeAnchor,{position:At,centerX:xt,centerY:kt,radius:Wt,onMouseDown:pn,onMouseEnter:Dn,onMouseOut:un,type:"source"}),(Kt==="target"||Kt===!0)&&React$1.createElement(EdgeAnchor,{position:Et,centerX:St,centerY:Tt,radius:Wt,onMouseDown:kn,onMouseEnter:Dn,onMouseOut:un,type:"target"})))};return et.displayName="EdgeWrapper",reactExports.memo(et)};function createEdgeTypes(tt){const et={default:wrapEdge(tt.default||BezierEdge),straight:wrapEdge(tt.bezier||StraightEdge),step:wrapEdge(tt.step||StepEdge),smoothstep:wrapEdge(tt.step||SmoothStepEdge),simplebezier:wrapEdge(tt.simplebezier||SimpleBezierEdge)},nt={},rt=Object.keys(tt).filter(it=>!["default","bezier"].includes(it)).reduce((it,ot)=>(it[ot]=wrapEdge(tt[ot]||BezierEdge),it),nt);return{...et,...rt}}function getHandlePosition(tt,et,nt=null){const rt=((nt==null?void 0:nt.x)||0)+et.x,it=((nt==null?void 0:nt.y)||0)+et.y,ot=(nt==null?void 0:nt.width)||et.width,at=(nt==null?void 0:nt.height)||et.height;switch(tt){case Position.Top:return{x:rt+ot/2,y:it};case Position.Right:return{x:rt+ot,y:it+at/2};case Position.Bottom:return{x:rt+ot/2,y:it+at};case Position.Left:return{x:rt,y:it+at/2}}}function getHandle(tt,et){return tt?tt.length===1||!et?tt[0]:et&&tt.find(nt=>nt.id===et)||null:null}const getEdgePositions=(tt,et,nt,rt,it,ot)=>{const at=getHandlePosition(nt,tt,et),st=getHandlePosition(ot,rt,it);return{sourceX:at.x,sourceY:at.y,targetX:st.x,targetY:st.y}};function isEdgeVisible({sourcePos:tt,targetPos:et,sourceWidth:nt,sourceHeight:rt,targetWidth:it,targetHeight:ot,width:at,height:st,transform:lt}){const ct={x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x+nt,et.x+it),y2:Math.max(tt.y+rt,et.y+ot)};ct.x===ct.x2&&(ct.x2+=1),ct.y===ct.y2&&(ct.y2+=1);const ut=rectToBox({x:(0-lt[0])/lt[2],y:(0-lt[1])/lt[2],width:at/lt[2],height:st/lt[2]}),ht=Math.max(0,Math.min(ut.x2,ct.x2)-Math.max(ut.x,ct.x)),dt=Math.max(0,Math.min(ut.y2,ct.y2)-Math.max(ut.y,ct.y));return Math.ceil(ht*dt)>0}function getNodeData(tt){var rt,it,ot,at,st;const et=((rt=tt==null?void 0:tt[internalsSymbol])==null?void 0:rt.handleBounds)||null,nt=et&&(tt==null?void 0:tt.width)&&(tt==null?void 0:tt.height)&&typeof((it=tt==null?void 0:tt.positionAbsolute)==null?void 0:it.x)<"u"&&typeof((ot=tt==null?void 0:tt.positionAbsolute)==null?void 0:ot.y)<"u";return[{x:((at=tt==null?void 0:tt.positionAbsolute)==null?void 0:at.x)||0,y:((st=tt==null?void 0:tt.positionAbsolute)==null?void 0:st.y)||0,width:(tt==null?void 0:tt.width)||0,height:(tt==null?void 0:tt.height)||0},et,!!nt]}const defaultEdgeTree=[{level:0,isMaxLevel:!0,edges:[]}];function groupEdgesByZLevel(tt,et,nt=!1){let rt=-1;const it=tt.reduce((at,st)=>{var ut,ht;const lt=isNumeric(st.zIndex);let ct=lt?st.zIndex:0;if(nt){const dt=et.get(st.target),pt=et.get(st.source),mt=st.selected||(dt==null?void 0:dt.selected)||(pt==null?void 0:pt.selected),gt=Math.max(((ut=pt==null?void 0:pt[internalsSymbol])==null?void 0:ut.z)||0,((ht=dt==null?void 0:dt[internalsSymbol])==null?void 0:ht.z)||0,1e3);ct=(lt?st.zIndex:0)+(mt?gt:0)}return at[ct]?at[ct].push(st):at[ct]=[st],rt=ct>rt?ct:rt,at},{}),ot=Object.entries(it).map(([at,st])=>{const lt=+at;return{edges:st,level:lt,isMaxLevel:lt===rt}});return ot.length===0?defaultEdgeTree:ot}function useVisibleEdges(tt,et,nt){const rt=useStore(reactExports.useCallback(it=>tt?it.edges.filter(ot=>{const at=et.get(ot.source),st=et.get(ot.target);return(at==null?void 0:at.width)&&(at==null?void 0:at.height)&&(st==null?void 0:st.width)&&(st==null?void 0:st.height)&&isEdgeVisible({sourcePos:at.positionAbsolute||{x:0,y:0},targetPos:st.positionAbsolute||{x:0,y:0},sourceWidth:at.width,sourceHeight:at.height,targetWidth:st.width,targetHeight:st.height,width:it.width,height:it.height,transform:it.transform})}):it.edges,[tt,et]));return groupEdgesByZLevel(rt,et,nt)}const ArrowSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ArrowClosedSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,fill:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),MarkerSymbols={[MarkerType.Arrow]:ArrowSymbol,[MarkerType.ArrowClosed]:ArrowClosedSymbol};function useMarkerSymbol(tt){const et=useStoreApi();return reactExports.useMemo(()=>{var it,ot;return Object.prototype.hasOwnProperty.call(MarkerSymbols,tt)?MarkerSymbols[tt]:((ot=(it=et.getState()).onError)==null||ot.call(it,"009",errorMessages.error009(tt)),null)},[tt])}const Marker=({id:tt,type:et,color:nt,width:rt=12.5,height:it=12.5,markerUnits:ot="strokeWidth",strokeWidth:at,orient:st="auto-start-reverse"})=>{const lt=useMarkerSymbol(et);return lt?React$1.createElement("marker",{className:"react-flow__arrowhead",id:tt,markerWidth:`${rt}`,markerHeight:`${it}`,viewBox:"-10 -10 20 20",markerUnits:ot,orient:st,refX:"0",refY:"0"},React$1.createElement(lt,{color:nt,strokeWidth:at})):null},markerSelector=({defaultColor:tt,rfId:et})=>nt=>{const rt=[];return nt.edges.reduce((it,ot)=>([ot.markerStart,ot.markerEnd].forEach(at=>{if(at&&typeof at=="object"){const st=getMarkerId(at,et);rt.includes(st)||(it.push({id:st,color:at.color||tt,...at}),rt.push(st))}}),it),[]).sort((it,ot)=>it.id.localeCompare(ot.id))},MarkerDefinitions=({defaultColor:tt,rfId:et})=>{const nt=useStore(reactExports.useCallback(markerSelector({defaultColor:tt,rfId:et}),[tt,et]),(rt,it)=>!(rt.length!==it.length||rt.some((ot,at)=>ot.id!==it[at].id)));return React$1.createElement("defs",null,nt.map(rt=>React$1.createElement(Marker,{id:rt.id,key:rt.id,type:rt.type,color:rt.color,width:rt.width,height:rt.height,markerUnits:rt.markerUnits,strokeWidth:rt.strokeWidth,orient:rt.orient})))};MarkerDefinitions.displayName="MarkerDefinitions";var MarkerDefinitions$1=reactExports.memo(MarkerDefinitions);const selector$4=tt=>({nodesConnectable:tt.nodesConnectable,edgesFocusable:tt.edgesFocusable,edgesUpdatable:tt.edgesUpdatable,elementsSelectable:tt.elementsSelectable,width:tt.width,height:tt.height,connectionMode:tt.connectionMode,nodeInternals:tt.nodeInternals,onError:tt.onError}),EdgeRenderer=({defaultMarkerColor:tt,onlyRenderVisibleElements:et,elevateEdgesOnSelect:nt,rfId:rt,edgeTypes:it,noPanClassName:ot,onEdgeUpdate:at,onEdgeContextMenu:st,onEdgeMouseEnter:lt,onEdgeMouseMove:ct,onEdgeMouseLeave:ut,onEdgeClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,children:yt})=>{const{edgesFocusable:bt,edgesUpdatable:vt,elementsSelectable:xt,width:kt,height:St,connectionMode:Tt,nodeInternals:At,onError:Et}=useStore(selector$4,shallow$1),$t=useVisibleEdges(et,At,nt);return kt?React$1.createElement(React$1.Fragment,null,$t.map(({level:Dt,edges:jt,isMaxLevel:Pt})=>React$1.createElement("svg",{key:Dt,style:{zIndex:Dt},width:kt,height:St,className:"react-flow__edges react-flow__container"},Pt&&React$1.createElement(MarkerDefinitions$1,{defaultColor:tt,rfId:rt}),React$1.createElement("g",null,jt.map(Ct=>{const[wt,It,Ot]=getNodeData(At.get(Ct.source)),[Wt,zt,Ft]=getNodeData(At.get(Ct.target));if(!Ot||!Ft)return null;let Nt=Ct.type||"default";it[Nt]||(Et==null||Et("011",errorMessages.error011(Nt)),Nt="default");const Ut=it[Nt]||it.default,Mt=Tt===ConnectionMode.Strict?zt.target:(zt.target??[]).concat(zt.source??[]),Ht=getHandle(It.source,Ct.sourceHandle),en=getHandle(Mt,Ct.targetHandle),sn=(Ht==null?void 0:Ht.position)||Position.Bottom,Kt=(en==null?void 0:en.position)||Position.Top,rn=!!(Ct.focusable||bt&&typeof Ct.focusable>"u"),nn=typeof at<"u"&&(Ct.updatable||vt&&typeof Ct.updatable>"u");if(!Ht||!en)return Et==null||Et("008",errorMessages.error008(Ht,Ct)),null;const{sourceX:hn,sourceY:vn,targetX:an,targetY:Qt}=getEdgePositions(wt,Ht,sn,Wt,en,Kt);return React$1.createElement(Ut,{key:Ct.id,id:Ct.id,className:cc([Ct.className,ot]),type:Nt,data:Ct.data,selected:!!Ct.selected,animated:!!Ct.animated,hidden:!!Ct.hidden,label:Ct.label,labelStyle:Ct.labelStyle,labelShowBg:Ct.labelShowBg,labelBgStyle:Ct.labelBgStyle,labelBgPadding:Ct.labelBgPadding,labelBgBorderRadius:Ct.labelBgBorderRadius,style:Ct.style,source:Ct.source,target:Ct.target,sourceHandleId:Ct.sourceHandle,targetHandleId:Ct.targetHandle,markerEnd:Ct.markerEnd,markerStart:Ct.markerStart,sourceX:hn,sourceY:vn,targetX:an,targetY:Qt,sourcePosition:sn,targetPosition:Kt,elementsSelectable:xt,onEdgeUpdate:at,onContextMenu:st,onMouseEnter:lt,onMouseMove:ct,onMouseLeave:ut,onClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,rfId:rt,ariaLabel:Ct.ariaLabel,isFocusable:rn,isUpdatable:nn,pathOptions:"pathOptions"in Ct?Ct.pathOptions:void 0,interactionWidth:Ct.interactionWidth})})))),yt):null};EdgeRenderer.displayName="EdgeRenderer";var EdgeRenderer$1=reactExports.memo(EdgeRenderer);const selector$3=tt=>`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`;function Viewport({children:tt}){const et=useStore(selector$3);return React$1.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:et}},tt)}function useOnInitHandler(tt){const et=useReactFlow(),nt=reactExports.useRef(!1);reactExports.useEffect(()=>{!nt.current&&et.viewportInitialized&&tt&&(setTimeout(()=>tt(et),1),nt.current=!0)},[tt,et.viewportInitialized])}const oppositePosition={[Position.Left]:Position.Right,[Position.Right]:Position.Left,[Position.Top]:Position.Bottom,[Position.Bottom]:Position.Top},ConnectionLine=({nodeId:tt,handleType:et,style:nt,type:rt=ConnectionLineType.Bezier,CustomComponent:it,connectionStatus:ot})=>{var Tt,At,Et;const{fromNode:at,handleId:st,toX:lt,toY:ct,connectionMode:ut}=useStore(reactExports.useCallback($t=>({fromNode:$t.nodeInternals.get(tt),handleId:$t.connectionHandleId,toX:($t.connectionPosition.x-$t.transform[0])/$t.transform[2],toY:($t.connectionPosition.y-$t.transform[1])/$t.transform[2],connectionMode:$t.connectionMode}),[tt]),shallow$1),ht=(Tt=at==null?void 0:at[internalsSymbol])==null?void 0:Tt.handleBounds;let dt=ht==null?void 0:ht[et];if(ut===ConnectionMode.Loose&&(dt=dt||(ht==null?void 0:ht[et==="source"?"target":"source"])),!at||!dt)return null;const pt=st?dt.find($t=>$t.id===st):dt[0],mt=pt?pt.x+pt.width/2:(at.width??0)/2,gt=pt?pt.y+pt.height/2:at.height??0,yt=(((At=at.positionAbsolute)==null?void 0:At.x)??0)+mt,bt=(((Et=at.positionAbsolute)==null?void 0:Et.y)??0)+gt,vt=pt==null?void 0:pt.position,xt=vt?oppositePosition[vt]:null;if(!vt||!xt)return null;if(it)return React$1.createElement(it,{connectionLineType:rt,connectionLineStyle:nt,fromNode:at,fromHandle:pt,fromX:yt,fromY:bt,toX:lt,toY:ct,fromPosition:vt,toPosition:xt,connectionStatus:ot});let kt="";const St={sourceX:yt,sourceY:bt,sourcePosition:vt,targetX:lt,targetY:ct,targetPosition:xt};return rt===ConnectionLineType.Bezier?[kt]=getBezierPath(St):rt===ConnectionLineType.Step?[kt]=getSmoothStepPath({...St,borderRadius:0}):rt===ConnectionLineType.SmoothStep?[kt]=getSmoothStepPath(St):rt===ConnectionLineType.SimpleBezier?[kt]=getSimpleBezierPath(St):kt=`M${yt},${bt} ${lt},${ct}`,React$1.createElement("path",{d:kt,fill:"none",className:"react-flow__connection-path",style:nt})};ConnectionLine.displayName="ConnectionLine";const selector$2=tt=>({nodeId:tt.connectionNodeId,handleType:tt.connectionHandleType,nodesConnectable:tt.nodesConnectable,connectionStatus:tt.connectionStatus,width:tt.width,height:tt.height});function ConnectionLineWrapper({containerStyle:tt,style:et,type:nt,component:rt}){const{nodeId:it,handleType:ot,nodesConnectable:at,width:st,height:lt,connectionStatus:ct}=useStore(selector$2,shallow$1);return!(it&&ot&&st&&at)?null:React$1.createElement("svg",{style:tt,width:st,height:lt,className:"react-flow__edges react-flow__connectionline react-flow__container"},React$1.createElement("g",{className:cc(["react-flow__connection",ct])},React$1.createElement(ConnectionLine,{nodeId:it,handleType:ot,style:et,type:nt,CustomComponent:rt,connectionStatus:ct})))}function useNodeOrEdgeTypes(tt,et){return reactExports.useRef(null),useStoreApi(),reactExports.useMemo(()=>et(tt),[tt])}const GraphView=({nodeTypes:tt,edgeTypes:et,onMove:nt,onMoveStart:rt,onMoveEnd:it,onInit:ot,onNodeClick:at,onEdgeClick:st,onNodeDoubleClick:lt,onEdgeDoubleClick:ct,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,onSelectionContextMenu:mt,onSelectionStart:gt,onSelectionEnd:yt,connectionLineType:bt,connectionLineStyle:vt,connectionLineComponent:xt,connectionLineContainerStyle:kt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,multiSelectionKeyCode:Et,panActivationKeyCode:$t,zoomActivationKeyCode:Dt,deleteKeyCode:jt,onlyRenderVisibleElements:Pt,elementsSelectable:Ct,selectNodesOnDrag:wt,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,preventScrolling:Ft,defaultMarkerColor:Nt,zoomOnScroll:Ut,zoomOnPinch:Mt,panOnScroll:Ht,panOnScrollSpeed:en,panOnScrollMode:sn,zoomOnDoubleClick:Kt,panOnDrag:rn,onPaneClick:nn,onPaneMouseEnter:hn,onPaneMouseMove:vn,onPaneMouseLeave:an,onPaneScroll:Qt,onPaneContextMenu:_n,onEdgeUpdate:Pn,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:Tn,onEdgeMouseLeave:cn,edgeUpdaterRadius:mn,onEdgeUpdateStart:In,onEdgeUpdateEnd:An,noDragClassName:wn,noWheelClassName:fn,noPanClassName:pn,elevateEdgesOnSelect:kn,disableKeyboardA11y:Dn,nodeOrigin:un,nodeExtent:Zt,rfId:Xt})=>{const Sn=useNodeOrEdgeTypes(tt,createNodeTypes),Rn=useNodeOrEdgeTypes(et,createEdgeTypes);return useOnInitHandler(ot),React$1.createElement(FlowRenderer$1,{onPaneClick:nn,onPaneMouseEnter:hn,onPaneMouseMove:vn,onPaneMouseLeave:an,onPaneContextMenu:_n,onPaneScroll:Qt,deleteKeyCode:jt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,onSelectionStart:gt,onSelectionEnd:yt,multiSelectionKeyCode:Et,panActivationKeyCode:$t,zoomActivationKeyCode:Dt,elementsSelectable:Ct,onMove:nt,onMoveStart:rt,onMoveEnd:it,zoomOnScroll:Ut,zoomOnPinch:Mt,zoomOnDoubleClick:Kt,panOnScroll:Ht,panOnScrollSpeed:en,panOnScrollMode:sn,panOnDrag:rn,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,onSelectionContextMenu:mt,preventScrolling:Ft,noDragClassName:wn,noWheelClassName:fn,noPanClassName:pn,disableKeyboardA11y:Dn},React$1.createElement(Viewport,null,React$1.createElement(EdgeRenderer$1,{edgeTypes:Rn,onEdgeClick:st,onEdgeDoubleClick:ct,onEdgeUpdate:Pn,onlyRenderVisibleElements:Pt,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:Tn,onEdgeMouseLeave:cn,onEdgeUpdateStart:In,onEdgeUpdateEnd:An,edgeUpdaterRadius:mn,defaultMarkerColor:Nt,noPanClassName:pn,elevateEdgesOnSelect:!!kn,disableKeyboardA11y:Dn,rfId:Xt},React$1.createElement(ConnectionLineWrapper,{style:vt,type:bt,component:xt,containerStyle:kt})),React$1.createElement("div",{className:"react-flow__edgelabel-renderer"}),React$1.createElement(NodeRenderer$1,{nodeTypes:Sn,onNodeClick:at,onNodeDoubleClick:lt,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,selectNodesOnDrag:wt,onlyRenderVisibleElements:Pt,noPanClassName:pn,noDragClassName:wn,disableKeyboardA11y:Dn,nodeOrigin:un,nodeExtent:Zt,rfId:Xt})))};GraphView.displayName="GraphView";var GraphView$1=reactExports.memo(GraphView);const infiniteExtent=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],initialState={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:infiniteExtent,nodeExtent:infiniteExtent,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ConnectionMode.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,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:devWarn,isValidConnection:void 0},createRFStore=()=>createWithEqualityFn((tt,et)=>({...initialState,setNodes:nt=>{const{nodeInternals:rt,nodeOrigin:it,elevateNodesOnSelect:ot}=et();tt({nodeInternals:createNodeInternals(nt,rt,it,ot)})},getNodes:()=>Array.from(et().nodeInternals.values()),setEdges:nt=>{const{defaultEdgeOptions:rt={}}=et();tt({edges:nt.map(it=>({...rt,...it}))})},setDefaultNodesAndEdges:(nt,rt)=>{const it=typeof nt<"u",ot=typeof rt<"u",at=it?createNodeInternals(nt,new Map,et().nodeOrigin,et().elevateNodesOnSelect):new Map;tt({nodeInternals:at,edges:ot?rt:[],hasDefaultNodes:it,hasDefaultEdges:ot})},updateNodeDimensions:nt=>{const{onNodesChange:rt,nodeInternals:it,fitViewOnInit:ot,fitViewOnInitDone:at,fitViewOnInitOptions:st,domNode:lt,nodeOrigin:ct}=et(),ut=lt==null?void 0:lt.querySelector(".react-flow__viewport");if(!ut)return;const ht=window.getComputedStyle(ut),{m22:dt}=new window.DOMMatrixReadOnly(ht.transform),pt=nt.reduce((gt,yt)=>{const bt=it.get(yt.id);if(bt){const vt=getDimensions(yt.nodeElement);!!(vt.width&&vt.height&&(bt.width!==vt.width||bt.height!==vt.height||yt.forceUpdate))&&(it.set(bt.id,{...bt,[internalsSymbol]:{...bt[internalsSymbol],handleBounds:{source:getHandleBounds(".source",yt.nodeElement,dt,ct),target:getHandleBounds(".target",yt.nodeElement,dt,ct)}},...vt}),gt.push({id:bt.id,type:"dimensions",dimensions:vt}))}return gt},[]);updateAbsoluteNodePositions(it,ct);const mt=at||ot&&!at&&fitView(et,{initial:!0,...st});tt({nodeInternals:new Map(it),fitViewOnInitDone:mt}),(pt==null?void 0:pt.length)>0&&(rt==null||rt(pt))},updateNodePositions:(nt,rt=!0,it=!1)=>{const{triggerNodeChanges:ot}=et(),at=nt.map(st=>{const lt={id:st.id,type:"position",dragging:it};return rt&&(lt.positionAbsolute=st.positionAbsolute,lt.position=st.position),lt});ot(at)},triggerNodeChanges:nt=>{const{onNodesChange:rt,nodeInternals:it,hasDefaultNodes:ot,nodeOrigin:at,getNodes:st,elevateNodesOnSelect:lt}=et();if(nt!=null&&nt.length){if(ot){const ct=applyNodeChanges(nt,st()),ut=createNodeInternals(ct,it,at,lt);tt({nodeInternals:ut})}rt==null||rt(nt)}},addSelectedNodes:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(ot(),nt),st=getSelectionChanges(it,[])),updateNodesAndEdgesSelections({changedNodes:at,changedEdges:st,get:et,set:tt})},addSelectedEdges:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(it,nt),st=getSelectionChanges(ot(),[])),updateNodesAndEdgesSelections({changedNodes:st,changedEdges:at,get:et,set:tt})},unselectNodesAndEdges:({nodes:nt,edges:rt}={})=>{const{edges:it,getNodes:ot}=et(),at=nt||ot(),st=rt||it,lt=at.map(ut=>(ut.selected=!1,createSelectionChange(ut.id,!1))),ct=st.map(ut=>createSelectionChange(ut.id,!1));updateNodesAndEdgesSelections({changedNodes:lt,changedEdges:ct,get:et,set:tt})},setMinZoom:nt=>{const{d3Zoom:rt,maxZoom:it}=et();rt==null||rt.scaleExtent([nt,it]),tt({minZoom:nt})},setMaxZoom:nt=>{const{d3Zoom:rt,minZoom:it}=et();rt==null||rt.scaleExtent([it,nt]),tt({maxZoom:nt})},setTranslateExtent:nt=>{var rt;(rt=et().d3Zoom)==null||rt.translateExtent(nt),tt({translateExtent:nt})},resetSelectedElements:()=>{const{edges:nt,getNodes:rt}=et(),ot=rt().filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1)),at=nt.filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1));updateNodesAndEdgesSelections({changedNodes:ot,changedEdges:at,get:et,set:tt})},setNodeExtent:nt=>{const{nodeInternals:rt}=et();rt.forEach(it=>{it.positionAbsolute=clampPosition(it.position,nt)}),tt({nodeExtent:nt,nodeInternals:new Map(rt)})},panBy:nt=>{const{transform:rt,width:it,height:ot,d3Zoom:at,d3Selection:st,translateExtent:lt}=et();if(!at||!st||!nt.x&&!nt.y)return!1;const ct=identity.translate(rt[0]+nt.x,rt[1]+nt.y).scale(rt[2]),ut=[[0,0],[it,ot]],ht=at==null?void 0:at.constrain()(ct,ut,lt);return at.transform(st,ht),rt[0]!==ht.x||rt[1]!==ht.y||rt[2]!==ht.k},cancelConnection:()=>tt({connectionNodeId:initialState.connectionNodeId,connectionHandleId:initialState.connectionHandleId,connectionHandleType:initialState.connectionHandleType,connectionStatus:initialState.connectionStatus,connectionStartHandle:initialState.connectionStartHandle,connectionEndHandle:initialState.connectionEndHandle}),reset:()=>tt({...initialState})}),Object.is),ReactFlowProvider=({children:tt})=>{const et=reactExports.useRef(null);return et.current||(et.current=createRFStore()),React$1.createElement(Provider$1,{value:et.current},tt)};ReactFlowProvider.displayName="ReactFlowProvider";const Wrapper$e=({children:tt})=>reactExports.useContext(StoreContext)?React$1.createElement(React$1.Fragment,null,tt):React$1.createElement(ReactFlowProvider,null,tt);Wrapper$e.displayName="ReactFlowWrapper";const defaultNodeTypes={input:InputNode$1,default:DefaultNode$1,output:OutputNode$1,group:GroupNode},defaultEdgeTypes={default:BezierEdge,straight:StraightEdge,step:StepEdge,smoothstep:SmoothStepEdge,simplebezier:SimpleBezierEdge},initNodeOrigin=[0,0],initSnapGrid=[15,15],initDefaultViewport={x:0,y:0,zoom:1},wrapperStyle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},ReactFlow=reactExports.forwardRef(({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,className:it,nodeTypes:ot=defaultNodeTypes,edgeTypes:at=defaultEdgeTypes,onNodeClick:st,onEdgeClick:lt,onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,onNodeMouseEnter:vt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:$t,onNodesDelete:Dt,onEdgesDelete:jt,onSelectionChange:Pt,onSelectionDragStart:Ct,onSelectionDrag:wt,onSelectionDragStop:It,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,connectionMode:Ft=ConnectionMode.Strict,connectionLineType:Nt=ConnectionLineType.Bezier,connectionLineStyle:Ut,connectionLineComponent:Mt,connectionLineContainerStyle:Ht,deleteKeyCode:en="Backspace",selectionKeyCode:sn="Shift",selectionOnDrag:Kt=!1,selectionMode:rn=SelectionMode.Full,panActivationKeyCode:nn="Space",multiSelectionKeyCode:hn=isMacOs()?"Meta":"Control",zoomActivationKeyCode:vn=isMacOs()?"Meta":"Control",snapToGrid:an=!1,snapGrid:Qt=initSnapGrid,onlyRenderVisibleElements:_n=!1,selectNodesOnDrag:Pn=!0,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:Tn,nodeOrigin:cn=initNodeOrigin,edgesFocusable:mn,edgesUpdatable:In,elementsSelectable:An,defaultViewport:wn=initDefaultViewport,minZoom:fn=.5,maxZoom:pn=2,translateExtent:kn=infiniteExtent,preventScrolling:Dn=!0,nodeExtent:un,defaultMarkerColor:Zt="#b1b1b7",zoomOnScroll:Xt=!0,zoomOnPinch:Sn=!0,panOnScroll:Rn=!1,panOnScrollSpeed:jn=.5,panOnScrollMode:On=PanOnScrollMode.Free,zoomOnDoubleClick:Zn=!0,panOnDrag:Vn=!0,onPaneClick:qn,onPaneMouseEnter:zn,onPaneMouseMove:Jn,onPaneMouseLeave:Hn,onPaneScroll:pr,onPaneContextMenu:fr,children:xr,onEdgeUpdate:io,onEdgeContextMenu:Tr,onEdgeDoubleClick:Ar,onEdgeMouseEnter:qr,onEdgeMouseMove:jr,onEdgeMouseLeave:Fr,onEdgeUpdateStart:ao,onEdgeUpdateEnd:Yr,edgeUpdaterRadius:Dr=10,onNodesChange:go,onEdgesChange:xn,noDragClassName:Mn="nodrag",noWheelClassName:dn="nowheel",noPanClassName:Jt="nopan",fitView:En=!1,fitViewOptions:Ln,connectOnClick:Un=!0,attributionPosition:Kn,proOptions:nr,defaultEdgeOptions:lr,elevateNodesOnSelect:cr=!0,elevateEdgesOnSelect:Hr=!1,disableKeyboardA11y:vr=!1,autoPanOnConnect:Nr=!0,autoPanOnNodeDrag:Gr=!0,connectionRadius:eo=20,isValidConnection:Zr,onError:Jr,style:wr,id:Mr,nodeDragThreshold:Ur,...Rr},Pr)=>{const Lr=Mr||"1";return React$1.createElement("div",{...Rr,style:{...wr,...wrapperStyle},ref:Pr,className:cc(["react-flow",it]),"data-testid":"rf__wrapper",id:Mr},React$1.createElement(Wrapper$e,null,React$1.createElement(GraphView$1,{onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onNodeClick:st,onEdgeClick:lt,onNodeMouseEnter:vt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,nodeTypes:ot,edgeTypes:at,connectionLineType:Nt,connectionLineStyle:Ut,connectionLineComponent:Mt,connectionLineContainerStyle:Ht,selectionKeyCode:sn,selectionOnDrag:Kt,selectionMode:rn,deleteKeyCode:en,multiSelectionKeyCode:hn,panActivationKeyCode:nn,zoomActivationKeyCode:vn,onlyRenderVisibleElements:_n,selectNodesOnDrag:Pn,defaultViewport:wn,translateExtent:kn,minZoom:fn,maxZoom:pn,preventScrolling:Dn,zoomOnScroll:Xt,zoomOnPinch:Sn,zoomOnDoubleClick:Zn,panOnScroll:Rn,panOnScrollSpeed:jn,panOnScrollMode:On,panOnDrag:Vn,onPaneClick:qn,onPaneMouseEnter:zn,onPaneMouseMove:Jn,onPaneMouseLeave:Hn,onPaneScroll:pr,onPaneContextMenu:fr,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,onEdgeUpdate:io,onEdgeContextMenu:Tr,onEdgeDoubleClick:Ar,onEdgeMouseEnter:qr,onEdgeMouseMove:jr,onEdgeMouseLeave:Fr,onEdgeUpdateStart:ao,onEdgeUpdateEnd:Yr,edgeUpdaterRadius:Dr,defaultMarkerColor:Zt,noDragClassName:Mn,noWheelClassName:dn,noPanClassName:Jt,elevateEdgesOnSelect:Hr,rfId:Lr,disableKeyboardA11y:vr,nodeOrigin:cn,nodeExtent:un}),React$1.createElement(StoreUpdater,{nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:Tn,edgesFocusable:mn,edgesUpdatable:In,elementsSelectable:An,elevateNodesOnSelect:cr,minZoom:fn,maxZoom:pn,nodeExtent:un,onNodesChange:go,onEdgesChange:xn,snapToGrid:an,snapGrid:Qt,connectionMode:Ft,translateExtent:kn,connectOnClick:Un,defaultEdgeOptions:lr,fitView:En,fitViewOptions:Ln,onNodesDelete:Dt,onEdgesDelete:jt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:$t,onSelectionDrag:wt,onSelectionDragStart:Ct,onSelectionDragStop:It,noPanClassName:Jt,nodeOrigin:cn,rfId:Lr,autoPanOnConnect:Nr,autoPanOnNodeDrag:Gr,onError:Jr,connectionRadius:eo,isValidConnection:Zr,nodeDragThreshold:Ur}),React$1.createElement(Wrapper$1$1,{onSelectionChange:Pt}),xr,React$1.createElement(Attribution,{proOptions:nr,position:Kn}),React$1.createElement(A11yDescriptions,{rfId:Lr,disableKeyboardA11y:vr})))});ReactFlow.displayName="ReactFlow";const style="",TeachMe=()=>{const[tt,et]=useDataStore(mt=>[mt.data,mt.setTeachMe]),[nt,rt]=useAppStore(mt=>[mt.currentSearch,mt.setSidebarOpen]),[it]=useUserStore(mt=>[mt.setBudget]),ot=reactExports.useRef(!1),at=useSocket(),[st,lt,ct,ut]=useTeachStore(mt=>[mt.setTeachMeAnswer,mt.setHasTeachingInProgress,mt.setInstagraphAnswer,mt.setHasInstagraphInProgress]),ht=reactExports.useCallback(mt=>{st(mt.tutorial),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Tutorial is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[st]),dt=reactExports.useCallback(mt=>{ct(mt),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Instagraph is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[ct]);reactExports.useEffect(()=>{ot.current||(ht&&at&&(at.on("teachmehook",ht),ot.current=!0),dt&&at&&(at.on("instagraphhook",dt),ot.current=!0))},[at,ht,dt]);const pt=async()=>{if(nt){lt(!0),ut(!0),rt(!0),et(!0);try{const mt=tt==null?void 0:tt.nodes.filter(bt=>bt.text),gt=mt==null?void 0:mt.slice(0,5),yt=(gt!=null&>.length?gt.map(bt=>bt.text).join(" "):"").substring(0,2500).replace(/[?&=+/#]/g,bt=>`\\${bt}`);await distExports$1.enable(),await postTeachMe({term:nt,transcripts:yt}),await updateBudget(it),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing tutorial for you"}),{type:"success"}),await postInstagraph({term:nt,transcripts:yt}),await updateBudget(it),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing an instagraph for you"}),{type:"success"})}catch{lt(!1),ut(!1)}}};return jsxRuntimeExports.jsx(ButtonStyled,{onClick:()=>pt(),children:"Teach me"})},TeachMeLoader=({text:tt})=>jsxRuntimeExports.jsxs(Flex,{align:"center",justify:"center",py:12,children:[jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(Text$3,{children:tt})})]}),TeachMeText=()=>{const[tt,et,nt,rt]=useTeachStore(ot=>[ot.teachMeAnswer,ot.hasTeachingInProgress,ot.instgraphAnswser,ot.hasInstagraphInProgress]),it=!rt&&!!(nt!=null&&nt.edges)&&!!(nt!=null&&nt.nodes);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[it?jsxRuntimeExports.jsx(ReactFlow,{edges:nt==null?void 0:nt.edges,nodes:nt==null?void 0:nt.nodes}):jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating instagraph"}),et?jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating tutorial"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TeachMeAnswerFlex,{children:jsxRuntimeExports.jsx(Text$3,{children:tt})}),jsxRuntimeExports.jsx(AskQuestion,{})]})]})},ButtonStyled=styled$4(Button$2)``,TeachMeAnswerFlex=styled$4(Flex)` padding-left: 10px; padding-right: 10px; `,MENU_WIDTH$2=400,ComponentsMapper$1={askQuestion:jsxRuntimeExports.jsx(AskQuestion,{}),teachMe:jsxRuntimeExports.jsx(TeachMe,{}),sentiment:jsxRuntimeExports.jsx(SentimentAnalysis,{})},heightMap={askQuestion:400,sentiment:600,teachMe:400,default:200},HelperContent=()=>{const{isShow:tt,setIsShow:et}=useHelper(),[nt,rt]=reactExports.useState(null);return jsxRuntimeExports.jsx(ContentWrapper$1,{children:jsxRuntimeExports.jsx(Fade$1,{in:tt,mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsxs(Stack$5,{bgcolor:colors.listBg,component:Paper$1,elevation:2,height:heightMap[nt??"default"],p:2,pb:4,pt:4,sx:{transition:({transitions:it})=>`${it.create(["height","opacity"])}!important`,overflowY:"auto",overflowX:"hidden"},width:{xs:"calc(100vw - 8px * 4)",sm:MENU_WIDTH$2},children:[jsxRuntimeExports.jsx(CloseButton$3,{onClick:()=>{rt(null),et(it=>!it)}}),jsxRuntimeExports.jsx(ActionsMenu,{active:nt,onChange:rt}),nt&&ComponentsMapper$1[nt]]})})})},ContentWrapper$1=styled$1("div")(()=>({position:"absolute",bottom:"1rem",right:"1rem"})),CloseButton$3=styled$1(tt=>jsxRuntimeExports.jsx(IconButton$2,{component:"button",size:"small",...tt,children:jsxRuntimeExports.jsx(MdClose,{})}))(()=>({position:"absolute",right:"0.5rem",top:"0.5rem"})),dpr=window.devicePixelRatio||1,pi=Math.PI,points=12,radius=200*dpr,h=600*dpr,w=600*dpr,center={x:w/2*dpr,y:h/2*dpr},rangeMin=3,rangeMax=25,createBtn=tt=>{var at;const et=(at=tt.current)==null?void 0:at.getContext("2d"),nt=tt.current;if(!et||!nt)return null;const rt=getGradients(et);et.scale(dpr,dpr),nt.width=w*dpr,nt.height=h*dpr;const it=getCircles(rt),ot=setInterval(()=>{swingCircle(et,it,rt)},16);return()=>clearInterval(ot)};function cycle(tt,et){return(tt%et+et)%et}function swingCircle(tt,et,nt){tt.clearRect(0,0,w*dpr,h*dpr),tt.globalAlpha=.9,tt.globalCompositeOperation="screen";for(let rt=0;rt{const nt=reactExports.useRef(null);return reactExports.useEffect(()=>{const rt=createBtn(nt);return()=>{rt==null||rt()}},[]),jsxRuntimeExports.jsxs(ButtonContainer,{...et,children:[tt&&jsxRuntimeExports.jsx("div",{className:"children",children:tt}),jsxRuntimeExports.jsx(Canvas,{ref:nt})]})},ButtonContainer=styled$1(ButtonBase$1)(()=>({width:48,height:48,"& .children":{zIndex:1}})),Canvas=styled$1("canvas")(()=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:70,height:70})),OpenHelperBtn=()=>{const{setIsShow:tt}=useHelper(),[et]=useAppStore(it=>[it.sidebarIsOpen]),nt=reactExports.useRef(null),rt=useAppStore(it=>it.currentSearch);return reactExports.useEffect(()=>{const it=createBtn(nt);return()=>{it==null||it()}},[]),rt?jsxRuntimeExports.jsx(FabContainer,{sidebarIsOpen:et,children:jsxRuntimeExports.jsx(SiriLikeButton,{id:"cy-siri-btn",onClick:()=>tt(it=>!it)})}):null},FabContainer=styled$1("div")(({sidebarIsOpen:tt,theme:et})=>({position:"absolute",bottom:"2rem",transition:et.transitions.create(["right"]),right:tt?"calc((100% - 400px) / 2)":"50%",transform:"translate(50%)"})),Helper=()=>{const[tt,et]=reactExports.useState(!1),nt=reactExports.useMemo(()=>({isShow:tt,setIsShow:et}),[tt]);return jsxRuntimeExports.jsxs(HelperContext.Provider,{value:nt,children:[jsxRuntimeExports.jsx(OpenHelperBtn,{}),jsxRuntimeExports.jsx(HelperContent,{})]})},AddContentIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_25",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_25)",children:jsxRuntimeExports.jsx("path",{d:"M11.25 12.75V16C11.25 16.2125 11.3219 16.3906 11.4657 16.5343C11.6095 16.6781 11.7877 16.75 12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5346 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V12.75H16C16.2125 12.75 16.3906 12.6781 16.5344 12.5343C16.6781 12.3904 16.75 12.2122 16.75 11.9997C16.75 11.7871 16.6781 11.609 16.5344 11.4654C16.3906 11.3218 16.2125 11.25 16 11.25H12.75V7.99998C12.75 7.78748 12.6781 7.60935 12.5343 7.4656C12.3905 7.32187 12.2123 7.25 11.9997 7.25C11.7871 7.25 11.609 7.32187 11.4654 7.4656C11.3218 7.60935 11.25 7.78748 11.25 7.99998V11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H11.25ZM12.0017 21.5C10.6877 21.5 9.45271 21.2506 8.29658 20.752C7.14043 20.2533 6.13475 19.5765 5.27953 18.7217C4.4243 17.8669 3.74724 16.8616 3.24836 15.706C2.74947 14.5504 2.50003 13.3156 2.50003 12.0017C2.50003 10.6877 2.74936 9.45268 3.24803 8.29655C3.7467 7.1404 4.42345 6.13472 5.27828 5.2795C6.13313 4.42427 7.13837 3.74721 8.29401 3.24833C9.44962 2.74944 10.6844 2.5 11.9983 2.5C13.3123 2.5 14.5473 2.74933 15.7034 3.248C16.8596 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.1331 20.2528 7.13834 20.7517 8.29398C21.2505 9.44959 21.5 10.6844 21.5 11.9983C21.5 13.3122 21.2506 14.5473 20.752 15.7034C20.2533 16.8596 19.5766 17.8652 18.7217 18.7205C17.8669 19.5757 16.8616 20.2527 15.706 20.7516C14.5504 21.2505 13.3156 21.5 12.0017 21.5ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76664 19.225 7.87498 17.675 6.32498C16.125 4.77498 14.2333 3.99998 12 3.99998C9.76667 3.99998 7.87501 4.77498 6.32501 6.32498C4.77501 7.87498 4.00001 9.76664 4.00001 12C4.00001 14.2333 4.77501 16.125 6.32501 17.675C7.87501 19.225 9.76667 20 12 20Z",fill:"currentColor"})})]}),AddSourceIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_27",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_27)",children:jsxRuntimeExports.jsx("path",{d:"M5.30773 20.5C4.81061 20.5 4.38506 20.3229 4.03106 19.9689C3.67704 19.6149 3.50003 19.1894 3.50003 18.6923V5.3077C3.50003 4.81058 3.67704 4.38503 4.03106 4.03103C4.38506 3.67701 4.81061 3.5 5.30773 3.5H18.6923C19.1894 3.5 19.615 3.67701 19.969 4.03103C20.323 4.38503 20.5 4.81058 20.5 5.3077V11.6327C20.2538 11.5275 20.0074 11.4384 19.7606 11.3654C19.5138 11.2923 19.2603 11.234 19 11.1904V5.3077C19 5.23077 18.968 5.16024 18.9039 5.09613C18.8397 5.03203 18.7692 4.99998 18.6923 4.99998H5.30773C5.2308 4.99998 5.16027 5.03203 5.09616 5.09613C5.03206 5.16024 5.00001 5.23077 5.00001 5.3077V18.6923C5.00001 18.7692 5.03206 18.8397 5.09616 18.9038C5.16027 18.9679 5.2308 19 5.30773 19H11.1654C11.2026 19.2769 11.2577 19.5387 11.3308 19.7855C11.4038 20.0323 11.4929 20.2705 11.5981 20.5H5.30773ZM5.00001 19V4.99998V11.1904V11.1154V19ZM7.25003 15.8849C7.25003 16.0975 7.32191 16.2756 7.46566 16.4192C7.60939 16.5628 7.78751 16.6346 8.00001 16.6346H11.2673C11.3109 16.3743 11.3757 16.1208 11.4616 15.874C11.5475 15.6272 11.641 15.3808 11.7423 15.1346H8.00001C7.78751 15.1346 7.60939 15.2065 7.46566 15.3503C7.32191 15.4941 7.25003 15.6723 7.25003 15.8849ZM7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H13.5904C14.0212 12.3846 14.4808 12.0785 14.9692 11.8317C15.4577 11.5849 15.9807 11.4096 16.5384 11.3058C16.4259 11.281 16.3009 11.2655 16.1634 11.2593C16.0259 11.2531 15.901 11.25 15.7885 11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003ZM7.25003 8.1157C7.25003 8.3283 7.32191 8.50639 7.46566 8.64998C7.60939 8.79356 7.78751 8.86535 8.00001 8.86535H16C16.2125 8.86535 16.3906 8.79344 16.5344 8.64963C16.6781 8.50583 16.75 8.32763 16.75 8.11503C16.75 7.90244 16.6781 7.72436 16.5344 7.58078C16.3906 7.43718 16.2125 7.36538 16 7.36538H8.00001C7.78751 7.36538 7.60939 7.43728 7.46566 7.5811C7.32191 7.72492 7.25003 7.90312 7.25003 8.1157ZM18 22.5576C16.7513 22.5576 15.6891 22.1198 14.8135 21.2442C13.9378 20.3685 13.5 19.3064 13.5 18.0577C13.5 16.809 13.9378 15.7468 14.8135 14.8712C15.6891 13.9955 16.7513 13.5577 18 13.5577C19.2487 13.5577 20.3109 13.9955 21.1865 14.8712C22.0622 15.7468 22.5 16.809 22.5 18.0577C22.5 19.3064 22.0622 20.3685 21.1865 21.2442C20.3109 22.1198 19.2487 22.5576 18 22.5576ZM17.5577 18.5V20.5577C17.5577 20.6756 17.6019 20.7788 17.6904 20.8673C17.7788 20.9557 17.8821 21 18 21C18.118 21 18.2212 20.9557 18.3096 20.8673C18.3981 20.7788 18.4423 20.6756 18.4423 20.5577V18.5H20.5C20.618 18.5 20.7212 18.4557 20.8096 18.3673C20.8981 18.2788 20.9423 18.1756 20.9423 18.0577C20.9423 17.9397 20.8981 17.8365 20.8096 17.748C20.7212 17.6596 20.618 17.6154 20.5 17.6154H18.4423V15.5577C18.4423 15.4397 18.3981 15.3365 18.3096 15.2481C18.2212 15.1596 18.118 15.1154 18 15.1154C17.8821 15.1154 17.7788 15.1596 17.6904 15.2481C17.6019 15.3365 17.5577 15.4397 17.5577 15.5577V17.6154H15.5C15.3821 17.6154 15.2788 17.6596 15.1904 17.748C15.1019 17.8365 15.0577 17.9397 15.0577 18.0577C15.0577 18.1756 15.1019 18.2788 15.1904 18.3673C15.2788 18.4557 15.3821 18.5 15.5 18.5H17.5577Z",fill:"currentColor"})})]}),SentimentDataIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_28",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_28)",children:jsxRuntimeExports.jsx("path",{d:"M3 20.75L2.91345 19.4327L4.74998 17.6058V20.75H3ZM7.25003 20.75V15.1058L8.74998 13.6058V20.75H7.25003ZM11.25 20.75V13.6058L12.75 15.1308V20.75H11.25ZM15.25 20.75V15.1308L16.75 13.6308V20.75H15.25ZM19.25 20.75V11.1058L20.75 9.60583V20.75H19.25ZM3.25003 15.2192V13.1058L10 6.35581L14 10.3558L20.75 3.60583V5.71924L14 12.4692L10 8.46921L3.25003 15.2192Z",fill:"currentColor"})})]}),SourcesTableIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_26",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_26)",children:jsxRuntimeExports.jsx("path",{d:"M10.0577 18.7499C9.84521 18.7499 9.66708 18.678 9.52333 18.5342C9.3796 18.3904 9.30773 18.2122 9.30773 17.9996C9.30773 17.787 9.3796 17.609 9.52333 17.4654C9.66708 17.3218 9.84521 17.25 10.0577 17.25H19.75C19.9625 17.25 20.1406 17.3219 20.2844 17.4657C20.4281 17.6095 20.5 17.7877 20.5 18.0003C20.5 18.2129 20.4281 18.391 20.2844 18.5346C20.1406 18.6782 19.9625 18.7499 19.75 18.7499H10.0577ZM10.0577 12.7499C9.84521 12.7499 9.66708 12.678 9.52333 12.5342C9.3796 12.3904 9.30773 12.2122 9.30773 11.9996C9.30773 11.787 9.3796 11.609 9.52333 11.4654C9.66708 11.3218 9.84521 11.25 10.0577 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2844 11.4657C20.4281 11.6095 20.5 11.7877 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2844 12.5346C20.1406 12.6782 19.9625 12.7499 19.75 12.7499H10.0577ZM10.0577 6.74995C9.84521 6.74995 9.66708 6.67805 9.52333 6.53425C9.3796 6.39043 9.30773 6.21223 9.30773 5.99965C9.30773 5.78705 9.3796 5.60896 9.52333 5.46537C9.66708 5.32179 9.84521 5.25 10.0577 5.25H19.75C19.9625 5.25 20.1406 5.3219 20.2844 5.4657C20.4281 5.60951 20.5 5.78771 20.5 6.0003C20.5 6.2129 20.4281 6.39099 20.2844 6.53457C20.1406 6.67816 19.9625 6.74995 19.75 6.74995H10.0577ZM5.16348 19.6634C4.70603 19.6634 4.31443 19.5005 3.98868 19.1748C3.66291 18.849 3.50003 18.4574 3.50003 18C3.50003 17.5425 3.66291 17.1509 3.98868 16.8252C4.31443 16.4994 4.70603 16.3365 5.16348 16.3365C5.62093 16.3365 6.01253 16.4994 6.33828 16.8252C6.66403 17.1509 6.82691 17.5425 6.82691 18C6.82691 18.4574 6.66403 18.849 6.33828 19.1748C6.01253 19.5005 5.62093 19.6634 5.16348 19.6634ZM5.16348 13.6634C4.70603 13.6634 4.31443 13.5005 3.98868 13.1748C3.66291 12.849 3.50003 12.4574 3.50003 12C3.50003 11.5425 3.66291 11.1509 3.98868 10.8252C4.31443 10.4994 4.70603 10.3365 5.16348 10.3365C5.62093 10.3365 6.01253 10.4994 6.33828 10.8252C6.66403 11.1509 6.82691 11.5425 6.82691 12C6.82691 12.4574 6.66403 12.849 6.33828 13.1748C6.01253 13.5005 5.62093 13.6634 5.16348 13.6634ZM5.16348 7.6634C4.70603 7.6634 4.31443 7.50052 3.98868 7.17477C3.66291 6.84902 3.50003 6.45742 3.50003 5.99997C3.50003 5.54252 3.66291 5.15092 3.98868 4.82517C4.31443 4.49942 4.70603 4.33655 5.16348 4.33655C5.62093 4.33655 6.01253 4.49942 6.33828 4.82517C6.66403 5.15092 6.82691 5.54252 6.82691 5.99997C6.82691 6.45742 6.66403 6.84902 6.33828 7.17477C6.01253 7.50052 5.62093 7.6634 5.16348 7.6634Z",fill:"currentColor"})})]}),MainToolbar=()=>{const[tt]=useAppStore(at=>[at.setSecondarySidebarActiveTab]),{open:et,setAddNodeModalData:nt}=useModal("addNode"),{open:rt}=useModal("sourcesTable"),it=at=>{tt(at)},ot=at=>{et(),nt(at)};return jsxRuntimeExports.jsxs(Wrapper$d,{children:[jsxRuntimeExports.jsx(LogoButton,{onClick:()=>it("about"),children:jsxRuntimeExports.jsx("img",{alt:"Second brain",src:"logo.svg"})}),jsxRuntimeExports.jsxs(ActionButton,{onClick:()=>ot("content"),children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddContentIcon,{})}),jsxRuntimeExports.jsx(Text$3,{children:"Add Content"})]}),jsxRuntimeExports.jsxs(ActionButton,{onClick:()=>ot("source"),children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddSourceIcon,{})}),jsxRuntimeExports.jsx(Text$3,{children:"Add Source"})]}),jsxRuntimeExports.jsxs(ActionButton,{id:"cy-open-soure-table",onClick:rt,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SourcesTableIcon,{})}),jsxRuntimeExports.jsx(Text$3,{children:"Source Table"})]}),jsxRuntimeExports.jsxs(ActionButton,{id:"cy-open-sentiment-data",onClick:()=>it("sentiment"),children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SentimentDataIcon,{})}),jsxRuntimeExports.jsx(Text$3,{children:"Sentiment Data"})]})]})},Wrapper$d=styled$4(Flex).attrs({align:"flex-start",direction:"column",justify:"flex-start"})` @@ -7517,7 +7558,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho ${Text$3} { margin-bottom: 0; } -`,Sentiment=()=>{const[tt,et]=reactExports.useState(void 0),[nt,rt]=reactExports.useState(!1),it=async()=>{rt(!0),await executeIfProd(()=>distExports$1.enable()),getSentimentData().then(ot=>{et(ot==null?void 0:ot.data.filter(at=>at.date).map(at=>({date:hooks.unix(Number(String(at.date).split(".")[0])).format("MM/DD/YY"),score:at.sentiment_score})))}).catch(console.error).finally(()=>{rt(!1)})};return jsxRuntimeExports.jsxs(ChartWrapper,{align:"flex-start",direction:"column",id:"cy-sentiment-chart-wrapper",justify:"flex-end",children:[jsxRuntimeExports.jsx(Text$3,{className:"title",children:"Sentiment chart"}),nt&&jsxRuntimeExports.jsx(Stack$5,{alignItems:"center",component:"div",flexGrow:1,p:4,spacing:2,width:"100%",children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),!(tt!=null&&tt.length)&&jsxRuntimeExports.jsx(StyledButton,{className:"button",id:"cy-get-sentiments-btn",onClick:it,children:"Get top 100 sentiments"}),jsxRuntimeExports.jsx(SentimentChart,{data:tt})]})},ChartWrapper=styled$4(Flex)` +`,Sentiment=()=>{const[tt,et]=reactExports.useState(void 0),[nt]=useUserStore(at=>[at.setBudget]),[rt,it]=reactExports.useState(!1),ot=async()=>{it(!0),await executeIfProd(()=>distExports$1.enable()),getSentimentData().then(async at=>{et(at==null?void 0:at.data.filter(st=>st.date).map(st=>({date:hooks.unix(Number(String(st.date).split(".")[0])).format("MM/DD/YY"),score:st.sentiment_score}))),await updateBudget(nt)}).catch(console.error).finally(()=>{it(!1)})};return jsxRuntimeExports.jsxs(ChartWrapper,{align:"flex-start",direction:"column",id:"cy-sentiment-chart-wrapper",justify:"flex-end",children:[jsxRuntimeExports.jsx(Text$3,{className:"title",children:"Sentiment chart"}),rt&&jsxRuntimeExports.jsx(Stack$5,{alignItems:"center",component:"div",flexGrow:1,p:4,spacing:2,width:"100%",children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),!(tt!=null&&tt.length)&&jsxRuntimeExports.jsx(StyledButton,{className:"button",id:"cy-get-sentiments-btn",onClick:ot,children:"Get top 100 sentiments"}),jsxRuntimeExports.jsx(SentimentChart,{data:tt})]})},ChartWrapper=styled$4(Flex)` border-radius: 8px; box-shadow: 0px 5px 6px rgb(0 0 0 / 50%); padding: 16px; @@ -7598,7 +7639,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho overflow-y: auto; overflow-x: hidden; background: ${colors.body}; -`,useIsMatchBreakpoint=(tt,et="down")=>{const nt=useTheme(),[rt,it]=reactExports.useState(!1),ot=nt.breakpoints[et](tt).split("@media")[1].trim();return reactExports.useEffect(()=>{const at=()=>{const{matches:st}=window.matchMedia(ot);it(st)};return at(),window.addEventListener("resize",at),()=>window.removeEventListener("resize",at)},[ot]),rt},BoostIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 9 9",style:{color:"#6B7A8D",paddingTop:"5px"},fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...tt,children:jsxRuntimeExports.jsx("path",{id:"Icon","fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.97172 5.26825L8.23268 0.525927C8.24606 0.301673 8.05202 0.110397 7.81782 0.116993L3.00677 0.374226C2.66551 0.394014 2.51161 0.796353 2.7525 1.0338L7.30259 5.51889C7.54348 5.75633 7.95165 5.60463 7.97172 5.26825ZM5.56945 5.5915L2.67881 2.74215L1.79555 3.61278L4.6862 6.46213L5.56945 5.5915ZM1.14615 6.44238L0.0353953 5.34749L0.918648 4.47686L3.80929 7.32621L2.92604 8.19685L1.81528 7.10196L0.918648 7.98578C0.731292 8.17046 0.436874 8.17046 0.249518 7.98578C0.0621611 7.8011 0.0621611 7.51089 0.249517 7.32621L1.14615 6.44238Z",fill:"currentColor"})}),BoostAmt=({amt:tt})=>jsxRuntimeExports.jsxs("div",{style:{alignSelf:"center"},children:[jsxRuntimeExports.jsx(BoostIcon,{}),jsxRuntimeExports.jsx(StyledText,{color:"white",children:tt})]}),StyledText=styled$4(Text$3)` +`,useIsMatchBreakpoint=(tt,et="down")=>{const nt=useTheme(),[rt,it]=reactExports.useState(!1),ot=nt.breakpoints[et](tt).split("@media")[1].trim();return reactExports.useEffect(()=>{const at=()=>{const{matches:st}=window.matchMedia(ot);it(st)};return at(),window.addEventListener("resize",at),()=>window.removeEventListener("resize",at)},[ot]),rt},BoostIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 9 9",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{id:"Icon","fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.97172 5.26825L8.23268 0.525927C8.24606 0.301673 8.05202 0.110397 7.81782 0.116993L3.00677 0.374226C2.66551 0.394014 2.51161 0.796353 2.7525 1.0338L7.30259 5.51889C7.54348 5.75633 7.95165 5.60463 7.97172 5.26825ZM5.56945 5.5915L2.67881 2.74215L1.79555 3.61278L4.6862 6.46213L5.56945 5.5915ZM1.14615 6.44238L0.0353953 5.34749L0.918648 4.47686L3.80929 7.32621L2.92604 8.19685L1.81528 7.10196L0.918648 7.98578C0.731292 8.17046 0.436874 8.17046 0.249518 7.98578C0.0621611 7.8011 0.0621611 7.51089 0.249517 7.32621L1.14615 6.44238Z",fill:"currentColor"})}),BoostAmt=({amt:tt})=>jsxRuntimeExports.jsxs("div",{style:{alignSelf:"center"},children:[jsxRuntimeExports.jsx(BoostIcon,{}),jsxRuntimeExports.jsx(StyledText,{color:"white",children:tt})]}),StyledText=styled$4(Text$3)` padding-left: 10px; `,TypePerson=({title:tt,imageUrl:et,name:nt})=>jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(PictureWrapper$1,{children:jsxRuntimeExports.jsx(Avatar$1,{rounded:!0,size:64,src:et||"",type:"person"})}),(tt||nt)&&jsxRuntimeExports.jsx(Name$1,{children:tt||nt})]}),PictureWrapper$1=styled$4(Flex)` img { @@ -7906,7 +7947,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho @keyframes `.concat(rt,` { `).concat(et,` } - `);return ot&&ot.insertRule(at,0),rt};animation.createAnimation=createAnimation;var __assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(tt){for(var et,nt=1,rt=arguments.length;nt{let et=await distExports$1.enable(!0);if(et||console.warn("Sphinx enable failed, means no pubkey and no budget (including budget of 0)"),et=await distExports$1.keysend(sphinxPubkey,tt),!(et!=null&&et.success)){if(et=await distExports$1.topup(),!(et!=null&&et.budget)||(et==null?void 0:et.budget){await boostAgainstBudget(et);const nt={amount:et,refid:tt};return api.post("/boost",JSON.stringify(nt))},notify=tt=>{toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:tt===BOOST_SUCCESS?"success":"error"})},Booster=({count:tt=0,updateCount:et,content:nt,readOnly:rt,refId:it})=>{const[ot,at]=reactExports.useState(!1),[st,lt]=reactExports.useState(!1);reactExports.useEffect(()=>{lt(!1),at(!1)},[it]);let{image_url:ct}=nt||{};ct&&(ct=ct.replace(".jpg","_l.jpg"));const ut=5;async function ht(){if(!(ot||!it)){at(!0);try{await boost(it,ut),lt(!0),notify(BOOST_SUCCESS),et&&et(tt+ut)}catch{notify(BOOST_ERROR_BUDGET)}at(!1)}}return rt?tt?jsxRuntimeExports.jsx(Pill,{className:"booster__pill",style:{padding:"1px 8px 1px 3px",width:"fit-content"},children:jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"center",children:[jsxRuntimeExports.jsx(MdBolt,{fontSize:12}),jsxRuntimeExports.jsx("div",{style:{fontSize:10},children:tt||0})]})}):null:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Pill,{disabled:ot,onClick:async()=>{st||ot||await ht()},style:{padding:"4px 8px",borderWidth:0,backgroundColor:"#303342",height:"25px",width:"fit-content"},children:ot?jsxRuntimeExports.jsx(_default,{color:"#fff",loading:!0,size:10}):jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"space-around",children:[jsxRuntimeExports.jsx(BoostIcon,{style:{color:colors.white}}),jsxRuntimeExports.jsx("div",{style:{marginLeft:8,marginRight:8},children:"Boost"})]})})})},FlagError=styled$4(Flex)` + `);return ot&&ot.insertRule(at,0),rt};animation.createAnimation=createAnimation;var __assign=commonjsGlobal&&commonjsGlobal.__assign||function(){return __assign=Object.assign||function(tt){for(var et,nt=1,rt=arguments.length;nt{let et=await distExports$1.enable(!0);if(et||console.warn("Sphinx enable failed, means no pubkey and no budget (including budget of 0)"),et=await distExports$1.keysend(sphinxPubkey,tt),!(et!=null&&et.success)){if(et=await distExports$1.topup(),!(et!=null&&et.budget)||(et==null?void 0:et.budget){const nt=await boostAgainstBudget(et),rt={amount:et,refid:tt};return await api.post("/boost",JSON.stringify(rt)),nt},notify=tt=>{toast(jsxRuntimeExports.jsx(ToastMessage,{message:tt}),{icon:!1,position:toast.POSITION.BOTTOM_CENTER,type:tt===BOOST_SUCCESS?"success":"error"})},Booster=({count:tt=0,updateCount:et,content:nt,readOnly:rt,refId:it})=>{const[ot,at]=reactExports.useState(!1),[st,lt]=reactExports.useState(!1),[ct]=useUserStore(pt=>[pt.setBudget]);reactExports.useEffect(()=>{lt(!1),at(!1)},[it]);let{image_url:ut}=nt||{};ut&&(ut=ut.replace(".jpg","_l.jpg"));const ht=5;async function dt(){if(!(ot||!it)){at(!0);try{const pt=await boost(it,ht);lt(!0),notify(BOOST_SUCCESS),et&&et(tt+ht),pt.budget&&ct(pt.budget)}catch{notify(BOOST_ERROR_BUDGET)}at(!1)}}return rt?tt?jsxRuntimeExports.jsx(Pill,{className:"booster__pill",style:{padding:"1px 8px 1px 3px",width:"fit-content"},children:jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"center",children:[jsxRuntimeExports.jsx(MdBolt,{fontSize:12}),jsxRuntimeExports.jsx("div",{style:{fontSize:10},children:tt||0})]})}):null:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Pill,{disabled:ot,onClick:async()=>{st||ot||await dt()},style:{padding:"4px 8px",borderWidth:0,backgroundColor:"#303342",height:"25px",width:"fit-content"},children:ot?jsxRuntimeExports.jsx(_default,{color:"#fff",loading:!0,size:10}):jsxRuntimeExports.jsxs(Flex,{align:"center",direction:"row",justify:"space-around",children:[jsxRuntimeExports.jsx(BoostIcon,{style:{color:colors.white}}),jsxRuntimeExports.jsx("div",{style:{marginLeft:8,marginRight:8},children:"Boost"})]})})})},FlagError=styled$4(Flex)` color: ${({flagErrorIsOpen:tt})=>tt?colors.lightBlue200:colors.white}; padding: 0 0 0 8px; &:hover { @@ -8197,4 +8238,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho color: ${colors.white}; font-size: 12px; opacity: 0.5; -`,App=()=>{const{open:tt}=useModal("budgetExplanation"),[et,nt,rt,it,ot,at]=[useAppStore(xt=>xt.setSidebarOpen),useAppStore(xt=>xt.currentSearch),useAppStore(xt=>xt.setCurrentSearch),useAppStore(xt=>xt.setRelevanceSelected),useAppStore(xt=>xt.setTranscriptOpen),useAppStore(xt=>xt.hasBudgetExplanationModalBeSeen)],st=useTeachStore(xt=>xt.setTeachMeAnswer),[lt,ct,ut,ht,dt,pt,mt]=[useDataStore(xt=>xt.data),useDataStore(xt=>xt.setData),useDataStore(xt=>xt.fetchData),useDataStore(xt=>xt.graphStyle),useDataStore(xt=>xt.setSphinxModalOpen),useDataStore(xt=>xt.setSelectedNode),useDataStore(xt=>xt.setCategoryFilter)],gt=useForm({mode:"onChange"}),yt=gt.handleSubmit(({search:xt})=>{ot(!1),pt(null),it(!1),rt(xt),st(""),mt(null)}),bt=reactExports.useCallback(async()=>{nt&&(dt(!0),isE2E||await distExports$1.enable(),dt(!1)),ut(nt),et(!0)},[ut,nt,dt,et]);reactExports.useEffect(()=>{if(nt&&!at){tt();return}bt()},[nt,bt,at]);const vt=()=>{if(lt){const xt=getGraphDataPositions(ht,lt.nodes);ct(xt)}};return reactExports.useEffect(()=>{vt()},[ht]),jsxRuntimeExports.jsxs(AppProviders,{children:[jsxRuntimeExports.jsx(GlobalStyle,{}),jsxRuntimeExports.jsx(Leva,{hidden:!isDevelopment}),jsxRuntimeExports.jsxs(Wrapper,{direction:"row",children:[jsxRuntimeExports.jsx(DataRetriever,{loader:jsxRuntimeExports.jsx(Preloader,{}),children:jsxRuntimeExports.jsxs(FormProvider,{...gt,children:[jsxRuntimeExports.jsx(MainToolbar,{}),jsxRuntimeExports.jsx(SideBar,{onSubmit:yt}),jsxRuntimeExports.jsx(Universe,{}),jsxRuntimeExports.jsx(SecondarySideBar,{}),jsxRuntimeExports.jsx(AppBar,{}),jsxRuntimeExports.jsxs(Version,{children:["v",version]}),jsxRuntimeExports.jsx(ActionsToolbar,{})]})}),jsxRuntimeExports.jsx(AddNodeModal,{}),jsxRuntimeExports.jsx(Toasts,{}),jsxRuntimeExports.jsx(BudgetExplanationModal,{}),jsxRuntimeExports.jsx(SourcesTableModal,{}),jsxRuntimeExports.jsx(Helper,{})]}),jsxRuntimeExports.jsx(E2ETests,{})]})},scriptRel="modulepreload",assetsURL=function(tt){return"/"+tt},seen={},__vitePreload=function tt(et,nt,rt){if(!nt||nt.length===0)return et();const it=document.getElementsByTagName("link");return Promise.all(nt.map(ot=>{if(ot=assetsURL(ot),ot in seen)return;seen[ot]=!0;const at=ot.endsWith(".css"),st=at?'[rel="stylesheet"]':"";if(!!rt)for(let ut=it.length-1;ut>=0;ut--){const ht=it[ut];if(ht.href===ot&&(!at||ht.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${ot}"]${st}`))return;const ct=document.createElement("link");if(ct.rel=at?"stylesheet":scriptRel,at||(ct.as="script",ct.crossOrigin=""),ct.href=ot,document.head.appendChild(ct),at)return new Promise((ut,ht)=>{ct.addEventListener("load",ut),ct.addEventListener("error",()=>ht(new Error(`Unable to preload CSS for ${ot}`)))})})).then(()=>et()).catch(ot=>{const at=new Event("vite:preloadError",{cancelable:!0});if(at.payload=ot,window.dispatchEvent(at),!at.defaultPrevented)throw ot})},reportWebVitals=tt=>{tt&&tt instanceof Function&&__vitePreload(()=>import("./web-vitals-60d3425a.js"),[]).then(({getCLS:et,getFID:nt,getFCP:rt,getLCP:it,getTTFB:ot})=>{et(tt),nt(tt),rt(tt),it(tt),ot(tt)})},index="",styles="",getElementsMemoized=()=>{const tt={};return()=>{if(tt.inner&&tt.body)return tt;const et=document.querySelector("body"),nt=document.createElement("div"),rt=document.createElement("div"),it=document.createElement("div"),ot=document.createElement("div"),at=()=>{nt.classList.toggle("hide")};return it.addEventListener("click",at),ot.addEventListener("click",at),nt.classList.add("loggerWrapper"),nt.classList.add("hide"),rt.classList.add("loggerInner"),it.classList.add("close"),ot.classList.add("open"),it.textContent="X",ot.textContent="OPEN LOG",et==null||et.appendChild(nt),et==null||et.appendChild(ot),nt.appendChild(it),nt.appendChild(rt),tt.body=et,tt.inner=rt,{body:et,inner:rt}}},getElements=getElementsMemoized(),variants=["log","info","warn","error"],logMessage=(tt,et)=>{const{inner:nt}=getElements(),rt=document.createElement("span");rt.textContent=tt,rt.classList.add("message"),rt.classList.add(et),nt.appendChild(rt)},overrideConsole=()=>{if(!window.location.hostname.includes("local"))return;const tt=function(et){const nt=variants.reduce((rt,it)=>({...rt,[it](...ot){et[it](...ot),logMessage(JSON.stringify(ot,null," "),it)}}),{});return{...et,...nt}}(window.console);window.console=tt},root=client$1.createRoot(document.getElementById("root"));root.render(isE2E?jsxRuntimeExports.jsx(App,{}):jsxRuntimeExports.jsx(React$1.StrictMode,{children:jsxRuntimeExports.jsx(App,{})}));reportWebVitals();overrideConsole()});export default s4(); +`,App=()=>{const{open:tt}=useModal("budgetExplanation"),[et]=useUserStore(kt=>[kt.setBudget]),[nt,rt,it,ot,at,st]=[useAppStore(kt=>kt.setSidebarOpen),useAppStore(kt=>kt.currentSearch),useAppStore(kt=>kt.setCurrentSearch),useAppStore(kt=>kt.setRelevanceSelected),useAppStore(kt=>kt.setTranscriptOpen),useAppStore(kt=>kt.hasBudgetExplanationModalBeSeen)],lt=useTeachStore(kt=>kt.setTeachMeAnswer),[ct,ut,ht,dt,pt,mt,gt]=[useDataStore(kt=>kt.data),useDataStore(kt=>kt.setData),useDataStore(kt=>kt.fetchData),useDataStore(kt=>kt.graphStyle),useDataStore(kt=>kt.setSphinxModalOpen),useDataStore(kt=>kt.setSelectedNode),useDataStore(kt=>kt.setCategoryFilter)],yt=useForm({mode:"onChange"}),bt=yt.handleSubmit(({search:kt})=>{at(!1),mt(null),ot(!1),it(kt),lt(""),gt(null)}),vt=reactExports.useCallback(async()=>{rt&&(pt(!0),isE2E||(await distExports$1.enable(),await updateBudget(et)),await distExports$1.enable(),await updateBudget(et),pt(!1)),await ht(rt),nt(!0),await updateBudget(et)},[ht,rt,pt,nt,et]);reactExports.useEffect(()=>{if(rt&&!st){tt();return}vt()},[rt,vt,st]);const xt=()=>{if(ct){const kt=getGraphDataPositions(dt,ct.nodes);ut(kt)}};return reactExports.useEffect(()=>{xt()},[dt]),jsxRuntimeExports.jsxs(AppProviders,{children:[jsxRuntimeExports.jsx(GlobalStyle,{}),jsxRuntimeExports.jsx(Leva,{hidden:!isDevelopment}),jsxRuntimeExports.jsxs(Wrapper,{direction:"row",children:[jsxRuntimeExports.jsx(DataRetriever,{loader:jsxRuntimeExports.jsx(Preloader,{}),children:jsxRuntimeExports.jsxs(FormProvider,{...yt,children:[jsxRuntimeExports.jsx(MainToolbar,{}),jsxRuntimeExports.jsx(SideBar,{onSubmit:bt}),jsxRuntimeExports.jsx(Universe,{}),jsxRuntimeExports.jsx(SecondarySideBar,{}),jsxRuntimeExports.jsx(AppBar,{}),jsxRuntimeExports.jsxs(Version,{children:["v",version]}),jsxRuntimeExports.jsx(ActionsToolbar,{})]})}),jsxRuntimeExports.jsx(AddNodeModal,{}),jsxRuntimeExports.jsx(Toasts,{}),jsxRuntimeExports.jsx(BudgetExplanationModal,{}),jsxRuntimeExports.jsx(SourcesTableModal,{}),jsxRuntimeExports.jsx(Helper,{})]}),jsxRuntimeExports.jsx(E2ETests,{})]})},scriptRel="modulepreload",assetsURL=function(tt){return"/"+tt},seen={},__vitePreload=function tt(et,nt,rt){if(!nt||nt.length===0)return et();const it=document.getElementsByTagName("link");return Promise.all(nt.map(ot=>{if(ot=assetsURL(ot),ot in seen)return;seen[ot]=!0;const at=ot.endsWith(".css"),st=at?'[rel="stylesheet"]':"";if(!!rt)for(let ut=it.length-1;ut>=0;ut--){const ht=it[ut];if(ht.href===ot&&(!at||ht.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${ot}"]${st}`))return;const ct=document.createElement("link");if(ct.rel=at?"stylesheet":scriptRel,at||(ct.as="script",ct.crossOrigin=""),ct.href=ot,document.head.appendChild(ct),at)return new Promise((ut,ht)=>{ct.addEventListener("load",ut),ct.addEventListener("error",()=>ht(new Error(`Unable to preload CSS for ${ot}`)))})})).then(()=>et()).catch(ot=>{const at=new Event("vite:preloadError",{cancelable:!0});if(at.payload=ot,window.dispatchEvent(at),!at.defaultPrevented)throw ot})},reportWebVitals=tt=>{tt&&tt instanceof Function&&__vitePreload(()=>import("./web-vitals-60d3425a.js"),[]).then(({getCLS:et,getFID:nt,getFCP:rt,getLCP:it,getTTFB:ot})=>{et(tt),nt(tt),rt(tt),it(tt),ot(tt)})},index="",styles="",getElementsMemoized=()=>{const tt={};return()=>{if(tt.inner&&tt.body)return tt;const et=document.querySelector("body"),nt=document.createElement("div"),rt=document.createElement("div"),it=document.createElement("div"),ot=document.createElement("div"),at=()=>{nt.classList.toggle("hide")};return it.addEventListener("click",at),ot.addEventListener("click",at),nt.classList.add("loggerWrapper"),nt.classList.add("hide"),rt.classList.add("loggerInner"),it.classList.add("close"),ot.classList.add("open"),it.textContent="X",ot.textContent="OPEN LOG",et==null||et.appendChild(nt),et==null||et.appendChild(ot),nt.appendChild(it),nt.appendChild(rt),tt.body=et,tt.inner=rt,{body:et,inner:rt}}},getElements=getElementsMemoized(),variants=["log","info","warn","error"],logMessage=(tt,et)=>{const{inner:nt}=getElements(),rt=document.createElement("span");rt.textContent=tt,rt.classList.add("message"),rt.classList.add(et),nt.appendChild(rt)},overrideConsole=()=>{if(!window.location.hostname.includes("local"))return;const tt=function(et){const nt=variants.reduce((rt,it)=>({...rt,[it](...ot){et[it](...ot),logMessage(JSON.stringify(ot,null," "),it)}}),{});return{...et,...nt}}(window.console);window.console=tt},root=client$1.createRoot(document.getElementById("root"));root.render(isE2E?jsxRuntimeExports.jsx(App,{}):jsxRuntimeExports.jsx(React$1.StrictMode,{children:jsxRuntimeExports.jsx(App,{})}));reportWebVitals();overrideConsole()});export default s4(); diff --git a/build/index.html b/build/index.html index cce7706f2..3457a5e05 100644 --- a/build/index.html +++ b/build/index.html @@ -22,14 +22,15 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Second Brain - - + +
- + +