From 5ccb71bf5dc805b2e1b78dc57d219a4ae0051a16 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Wed, 20 Dec 2023 20:35:12 +0000 Subject: [PATCH] ci: automatic build fixes --- build/assets/{index-beba3cf9.js => index-2fc286f3.js} | 2 +- build/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename build/assets/{index-beba3cf9.js => index-2fc286f3.js} (99%) diff --git a/build/assets/index-beba3cf9.js b/build/assets/index-2fc286f3.js similarity index 99% rename from build/assets/index-beba3cf9.js rename to build/assets/index-2fc286f3.js index dce1c3bb3..d227c85ee 100644 --- a/build/assets/index-beba3cf9.js +++ b/build/assets/index-2fc286f3.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$5=extendShallow,isPlainObject$6=isPlainObject$8,isObject$m=isExtendable,setValue=function(tt,et,nt){if(!isObject$m(tt)||(Array.isArray(et)&&(et=[].concat.apply([],et).join(".")),typeof et!="string"))return tt;for(var it=split(et,{sep:".",brackets:!0}).filter(isValidKey),rt=it.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:it,disabled:rt,key:ot}])=>(nt[ot]=rt?void 0:it,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),it=reactExports.useRef(!0);return reactExports.useLayoutEffect(()=>{tt||(et.current.style.height="0px",et.current.style.overflow="hidden")},[]),reactExports.useEffect(()=>{if(it.current){it.current=!1;return}let rt;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",rt=window.setTimeout(()=>ot.style.height="0px",50)),()=>{ot.removeEventListener("transitionend",at),clearTimeout(rt)}},[tt]),{wrapperRef:et,contentRef:nt}}const useVisiblePaths=tt=>{const[et,nt]=reactExports.useState(tt.getVisiblePaths());return reactExports.useEffect(()=>{nt(tt.getVisiblePaths());const it=tt.useStore.subscribe(tt.getVisiblePaths,nt,{equalityFn:shallow$2});return()=>it()},[tt]),et};function useValuesForPath(tt,et,nt){return tt.useStore(rt=>{const ot=_objectSpread2$1(_objectSpread2$1({},nt),rt.data);return getValuesForPaths(ot,et)},shallow$2)}function usePopin(tt=3){const et=reactExports.useRef(null),nt=reactExports.useRef(null),[it,rt]=reactExports.useState(!1),ot=reactExports.useCallback(()=>rt(!0),[]),at=reactExports.useCallback(()=>rt(!1),[]);return reactExports.useLayoutEffect(()=>{if(it){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,it]),{popinRef:et,wrapperRef:nt,shown:it,show:ot,hide:at}}k$9([namesPlugin]);const convertMap={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};v8n.extend({color:()=>tt=>w$6(tt).isValid()});const schema$2=tt=>v8n().color().test(tt);function convert$6(tt,{format:et,hasAlpha:nt,isString:it}){const rt=convertMap[et]+(it&&et!=="hex"?"String":""),ot=tt[rt]();return typeof ot=="object"&&!nt?omit$1(ot,["a"]):ot}const sanitize$2=(tt,et)=>{const nt=w$6(tt);if(!nt.isValid())throw Error("Invalid color");return convert$6(nt,et)},format$1$1=(tt,et)=>convert$6(w$6(tt),_objectSpread2$1(_objectSpread2$1({},et),{},{isString:!0,format:"hex"})),normalize$3$1=({value:tt})=>{const et=I$2(tt),nt=et==="name"?"hex":et,it=typeof tt=="object"?"a"in tt:et==="hex"&&tt.length===8||/^(rgba)|(hsla)|(hsva)/.test(tt),rt={format:nt,hasAlpha:it,isString:typeof tt=="string"};return{value:sanitize$2(tt,rt),settings:rt}};var props$2=Object.freeze({__proto__:null,schema:schema$2,sanitize:sanitize$2,format:format$1$1,normalize:normalize$3$1});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$6(tt).toRgb():tt}function Color$2({value:tt,displayValue:et,settings:nt,onUpdate:it}){const{emitOnEditStart:rt,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)),bt=st?Ce:Ne$1,yt=()=>{gt(convertToRgb(tt,at)),ht(),rt()},wt=()=>{dt(),ot(),window.clearTimeout(pt.current)},vt=()=>{pt.current=window.setTimeout(wt,500)};return reactExports.useEffect(()=>()=>window.clearTimeout(pt.current),[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(ColorPreview,{ref:lt,active:ut,onClick:()=>yt(),style:{color:et}}),ut&&React$1.createElement(Portal$1,null,React$1.createElement(Overlay$1,{onPointerUp:wt}),React$1.createElement(PickerWrapper,{ref:ct,onMouseEnter:()=>window.clearTimeout(pt.current),onMouseLeave:xt=>xt.buttons===0&&vt()},React$1.createElement(bt,{color:mt,onChange:it}))))}function ColorComponent(){const{value:tt,displayValue:et,label:nt,onChange:it,onUpdate:rt,settings:ot}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,nt),React$1.createElement(PickerContainer,null,React$1.createElement(Color$2,{value:tt,displayValue:et,onChange:it,onUpdate:rt,settings:ot}),React$1.createElement(ValueInput,{value:et,onChange:it,onUpdate:rt})))}var color$4=_objectSpread2$1({component:ColorComponent},props$2);function Vector3dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:it}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Vector,{value:et,settings:it,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 it=reactExports.useRef(),rt=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:Bt,left:Pt,width:kt,height:At}=pt.current.getBoundingClientRect();mt.current.style.left=Pt+kt/2+"px",mt.current.style.top=Bt+At/2+"px"}},[st]);const{keys:[gt,bt],joystick:yt}=et,wt=yt==="invertY"?1:-1,{[gt]:{step:vt},[bt]:{step:xt}}=et,St=useTh("sizes","joystickWidth"),Et=useTh("sizes","joystickHeight"),It=parseFloat(St)*.8/2,Tt=parseFloat(Et)*.8/2,$t=reactExports.useCallback(()=>{it.current||(ut(!0),rt.current&&dt({x:rt.current*It}),ot.current&&dt({y:ot.current*-Tt}),it.current=window.setInterval(()=>{nt(Bt=>{const Pt=vt*rt.current*at.current,kt=wt*xt*ot.current*at.current;return Array.isArray(Bt)?{[gt]:Bt[0]+Pt,[bt]:Bt[1]+kt}:{[gt]:Bt[gt]+Pt,[bt]:Bt[bt]+kt}})},16))},[It,Tt,nt,dt,vt,xt,gt,bt,wt]),Ut=reactExports.useCallback(()=>{window.clearTimeout(it.current),it.current=void 0,ut(!1)},[]);reactExports.useEffect(()=>{function Bt(Pt){at.current=multiplyStep(Pt)}return window.addEventListener("keydown",Bt),window.addEventListener("keyup",Bt),()=>{window.clearTimeout(it.current),window.removeEventListener("keydown",Bt),window.removeEventListener("keyup",Bt)}},[]);const Lt=useDrag$1(({first:Bt,active:Pt,delta:[kt,At],movement:[Rt,Wt]})=>{Bt&<(!0);const jt=clamp$7(Rt,-It,It),Ot=clamp$7(Wt,-Tt,Tt);rt.current=Math.abs(Rt)>Math.abs(jt)?Math.sign(Rt-jt):0,ot.current=Math.abs(Wt)>Math.abs(Ot)?Math.sign(Ot-Wt):0;let Ct=tt[gt],Dt=tt[bt];Pt?(rt.current||(Ct+=kt*vt*at.current,dt({x:jt})),ot.current||(Dt-=wt*At*xt*at.current,dt({y:Ot})),rt.current||ot.current?$t():Ut(),nt({[gt]:Ct,[bt]:Dt})):(lt(!1),rt.current=0,ot.current=0,dt({x:0,y:0}),Ut())});return React$1.createElement(JoystickTrigger,_extends$t({ref:pt},Lt()),st&&React$1.createElement(Portal$1,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:it}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Container$1,{withJoystick:!!it.joystick},it.joystick&&React$1.createElement(Joystick,{value:et,settings:it,onUpdate:nt}),React$1.createElement(Vector,{value:et,settings:it,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:it,settings:rt}=plugin.normalize(nt);return{value:it,settings:_objectSpread2$1(_objectSpread2$1({},rt),{},{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:it}=useInputContext(),{popinRef:rt,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:it});return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(ImageContainer,null,React$1.createElement(ImagePreview,{ref:rt,hasImage:!!et,onPointerDown:()=>!!et&&st(),onPointerUp:lt,style:{backgroundImage:et?`url(${et})`:"none"}}),at&&!!et&&React$1.createElement(Portal$1,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$1=_objectSpread2$1({component:ImageComponent},props$1);const number$6=v8n().number(),schema=(tt,et)=>v8n().array().length(2).every.number().test(tt)&&v8n().schema({min:number$6,max:number$6}).test(et),format$2=tt=>({min:tt[0],max:tt[1]}),sanitize=(tt,{bounds:[et,nt]},it)=>{const rt=Array.isArray(tt)?format$2(tt):tt,ot={min:it[0],max:it[1]},{min:at,max:st}=_objectSpread2$1(_objectSpread2$1({},ot),rt);return[clamp$7(Number(at),et,Math.max(et,st)),clamp$7(Number(st),Math.min(nt,at),nt)]},normalize$5=({value:tt,min:et,max:nt})=>{const it={min:et,max:nt},rt=normalizeKeyedNumberSettings(format$2(tt),{min:it,max:it}),ot=[et,nt],at=_objectSpread2$1(_objectSpread2$1({},rt),{},{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$5});const _excluded$6$1=["value","bounds","onDrag"],_excluded2$1$1=["bounds"],Container$2=styled$5("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function IntervalSlider(tt){let{value:et,bounds:[nt,it],onDrag:rt}=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:[bt],movement:[yt],memo:wt={}})=>{if(gt){const{width:xt,left:St}=at.current.getBoundingClientRect();ct.current=xt-parseFloat(ut);const Et=(mt==null?void 0:mt.target)===st.current||(mt==null?void 0:mt.target)===lt.current;wt.pos=invertedRange((bt-St)/xt,nt,it);const It=Math.abs(wt.pos-et.min)-Math.abs(wt.pos-et.max);wt.key=It<0||It===0&&wt.pos<=et.min?"min":"max",Et&&(wt.pos=et[wt.key])}const vt=wt.pos+invertedRange(yt/ct.current,0,it-nt);return rt({[wt.key]:sanitizeStep(vt,ot[wt.key])}),wt}),dt=`calc(${range$9(et.min,nt,it)} * (100% - ${ut} - 8px) + 4px)`,pt=`calc(${1-range$9(et.max,nt,it)} * (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:it}=useInputContext(),rt=_objectWithoutProperties$l(it,_excluded2$1$1);return React$1.createElement(React$1.Fragment,null,React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Container$2,null,React$1.createElement(IntervalSlider,_extends$t({value:et},it,{onDrag:nt})),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt,innerLabelTrim:0}))))}var interval$1=_objectSpread2$1({component:IntervalComponent},props$3);const createEventEmitter=()=>{const tt=new Map;return{on:(et,nt)=>{let it=tt.get(et);it===void 0&&(it=new Set,tt.set(et,it)),it.add(nt)},off:(et,nt)=>{const it=tt.get(et);it!==void 0&&(it.delete(nt),it.size===0&&tt.delete(et))},emit:(et,...nt)=>{const it=tt.get(et);if(it!==void 0)for(const rt of it)rt(...nt)}}},_excluded$5$1=["type","value"],_excluded2$a=["onChange","transient","onEditStart","onEditEnd"],Store=function(){const et=create$8(subscribeWithSelector(()=>({data:{}}))),nt=createEventEmitter();this.storeId=getUid(),this.useStore=et;const it={},rt=new Set;this.getVisiblePaths=()=>{const at=this.getData(),st=Object.keys(at),lt=[];Object.entries(it).forEach(([ut,ht])=>{ht.render&&st.some(dt=>dt.indexOf(ut)===0)&&!ht.render(this.get)&<.push(ut+".")});const ct=[];return rt.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=>rt.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=>it[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$1(st,ut);if(ht.type===SpecialInputs.FOLDER){const pt=ot(ht.schema,dt,lt);Object.assign(ct,pt),dt in it||(it[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:bt}=pt,{onChange:yt,transient:wt,onEditStart:vt,onEditEnd:xt}=gt,St=_objectWithoutProperties$l(gt,_excluded2$a);ct[dt]=_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({type:mt},St),bt),{},{fromPanel:!0}),lt[ut]={path:dt,onChange:yt,transient:wt,onEditStart:vt,onEditEnd:xt}}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={},it=et?et.toLowerCase():null;return tt.forEach(rt=>{const[ot,at]=getKeyPath(rt);(!it||ot.toLowerCase().indexOf(it)>-1)&&merge$3(nt,at,{[ot]:{__levaInput:!0,path:rt}})}),nt},_excluded$4$1=["type","label","path","valueKey","value","settings","setValue","disabled"];function ControlInput(tt){let{type:et,label:nt,path:it,valueKey:rt,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:rt,path:it,id:""+it,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,it),null)}const StyledButton$8=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 it=useStoreContext();return React$1.createElement(Row,null,React$1.createElement(StyledButton$8,{disabled:et.disabled,onClick:()=>tt(it.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,it=et;return typeof et.opts=="object"&&(it.label!==void 0&&(nt=et.label),it=et.opts),{label:nt,opts:it}};function ButtonGroup(tt){const{label:et,opts:nt}=getOpts(tt),it=useStoreContext();return React$1.createElement(Row,{input:!!et},et&&React$1.createElement(Label$2,null,et),React$1.createElement(StyledButtonGroup,null,Object.entries(nt).map(([rt,ot])=>React$1.createElement(StyledButtonGroupButton,{key:rt,onClick:()=>ot(it.get)},rt))))}const Canvas$1=styled$5("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),POINTS=100;function push$1(tt,et){tt.push(et),tt.length>POINTS&&tt.shift()}const MonitorCanvas=reactExports.forwardRef(function({initialValue:tt},et){const nt=useTh("colors","highlight3"),it=useTh("colors","elevation2"),rt=useTh("colors","highlight1"),[ot,at]=reactExports.useMemo(()=>[w$6(rt).alpha(.4).toRgbString(),w$6(rt).alpha(.1).toRgbString()],[rt]),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:bt,height:yt}=mt,wt=new Path2D,vt=bt/POINTS,xt=yt*.05;for(let It=0;It({frame:mt=>{(lt.current===void 0||mtct.current)&&(ct.current=mt),push$1(st.current,mt),ut.current=requestAnimationFrame(()=>ht(dt.current,pt.current))}}),[dt,pt,ht]),reactExports.useEffect(()=>()=>cancelAnimationFrame(ut.current),[]),React$1.createElement(Canvas$1,{ref:dt})}),parse$4=tt=>Number.isFinite(tt)?tt.toPrecision(2):tt.toString(),MonitorLog=reactExports.forwardRef(function({initialValue:tt},et){const[nt,it]=reactExports.useState(parse$4(tt));return reactExports.useImperativeHandle(et,()=>({frame:rt=>it(parse$4(rt))}),[]),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 it=reactExports.useRef(),rt=reactExports.useRef(getValue$4(et));return reactExports.useEffect(()=>{const ot=window.setInterval(()=>{var at;document.hidden||(at=it.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$2,{align:"top"},tt),nt.graph?React$1.createElement(MonitorCanvas,{ref:it,initialValue:rt.current}):React$1.createElement(MonitorLog,{ref:it,initialValue:rt.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:it,disable:rt,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:it,disable:rt,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 it=useStoreContext(),rt=join$1(et,tt),{collapsed:ot,color:at}=it.getFolderSettings(rt),[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:rt,tree:nt,toggled:st}))},TreeWrapper=React$1.memo(({isRoot:tt=!1,fill:et=!1,flat:nt=!1,parent:it,tree:rt,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$1(it,ht)).order)||0},ut=Object.entries(rt).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:it,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[it,rt]=reactExports.useState(""),ot=reactExports.useMemo(()=>debounce$5(tt,250),[tt]),at=()=>{tt(""),rt("")},st=lt=>{const ct=lt.currentTarget.value;et(!0),rt(ct)};return reactExports.useEffect(()=>{ot(it)},[it,ot]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledFilterInput,{ref:nt,value:it,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:lt=>lt.stopPropagation(),onChange:st}),React$1.createElement(Icon,{onClick:()=>at(),style:{visibility:it?"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:it,toggle:rt,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:bt,last:yt})=>{et({x:mt,y:gt}),bt&&nt({x:mt,y:gt}),yt&&it({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(bt=>!bt)};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:()=>rt()},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:rt})))}const _excluded$2$1=["store","hidden","theme","collapsed"];function LevaRoot(tt){let{store:et,hidden:nt=!1,theme:it,collapsed:rt=!1}=tt,ot=_objectWithoutProperties$l(tt,_excluded$2$1);const at=useDeepMemo(()=>mergeTheme(it),[it]),[st,lt]=reactExports.useState(!rt),ct=typeof rt=="object"?!rt.collapsed:st,ut=reactExports.useMemo(()=>typeof rt=="object"?ht=>{typeof ht=="function"?rt.onChange(!ht(!rt.collapsed)):rt.onChange(!ht)}:lt,[rt]);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:it=!1,neverHide:rt=!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]),[bt,yt]=useTransform(),wt=rt||dt.length>0,vt=typeof at=="object"&&at.title||void 0,xt=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,Et=typeof at=="object"&&at.position||void 0,It=typeof at=="object"&&at.onDrag||void 0,Tt=typeof at=="object"&&at.onDragStart||void 0,$t=typeof at=="object"&&at.onDragEnd||void 0;return React$1.useEffect(()=>{yt({x:Et==null?void 0:Et.x,y:Et==null?void 0:Et.y})},[Et,yt]),globalStyles(),React$1.createElement(PanelSettingsContext.Provider,{value:{hideCopyButton:st}},React$1.createElement(StyledRoot,{ref:bt,className:et,fill:nt,flat:it,oneLineLabels:ot,hideTitleBar:!at,style:{display:wt?"block":"none"}},at&&React$1.createElement(TitleWithFilter,{onDrag:Ut=>{yt(Ut),It==null||It(Ut)},onDragStart:Ut=>Tt==null?void 0:Tt(Ut),onDragEnd:Ut=>$t==null?void 0:$t(Ut),setFilter:mt,toggle:Ut=>ct(Lt=>Ut??!Lt),toggled:lt,title:vt,drag:xt,filterEnabled:St,from:Et}),wt&&React$1.createElement(StoreContext$1.Provider,{value:tt},React$1.createElement(TreeWrapper,{isRoot:!0,fill:nt,flat:it,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,it,rt){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=it):(st=nt,Array.isArray(it)?ct=it:(lt=it,ct=rt)))):(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,it,rt){const{folderName:ot,schema:at,folderSettings:st,hookSettings:lt,deps:ct}=parseArgs(tt,et,nt,it,rt),ut=typeof at=="function",ht=reactExports.useRef(!1),dt=reactExports.useRef(!0),pt=useDeepMemo(()=>{ht.current=!0;const Lt=typeof at=="function"?at():at;return ot?{[ot]:folder(Lt,st)}:Lt},ct),mt=!(lt!=null&<.store);useRenderRoot(mt);const[gt]=reactExports.useState(()=>(lt==null?void 0:lt.store)||levaStore),[bt,yt]=reactExports.useMemo(()=>gt.getDataFromSchema(pt),[gt,pt]),[wt,vt,xt,St,Et]=reactExports.useMemo(()=>{const Lt=[],Bt=[],Pt={},kt={},At={};return Object.values(yt).forEach(({path:Rt,onChange:Wt,onEditStart:jt,onEditEnd:Ot,transient:Ct})=>{Lt.push(Rt),Wt?(Pt[Rt]=Wt,Ct||Bt.push(Rt)):Bt.push(Rt),jt&&(kt[Rt]=jt),Ot&&(At[Rt]=Ot)}),[Lt,Bt,Pt,kt,At]},[yt]),It=reactExports.useMemo(()=>gt.orderPaths(wt),[wt,gt]),Tt=useValuesForPath(gt,vt,bt),$t=reactExports.useCallback(Lt=>{const Bt=Object.entries(Lt).reduce((Pt,[kt,At])=>Object.assign(Pt,{[yt[kt].path]:At}),{});gt.set(Bt,!1)},[gt,yt]),Ut=reactExports.useCallback(Lt=>gt.get(yt[Lt].path),[gt,yt]);return reactExports.useEffect(()=>{const Lt=!dt.current&&ht.current;return gt.addData(bt,Lt),dt.current=!1,ht.current=!1,()=>gt.disposePaths(It)},[gt,It,bt]),reactExports.useEffect(()=>{const Lt=[];return Object.entries(xt).forEach(([Bt,Pt])=>{Pt(gt.get(Bt),Bt,_objectSpread2$1({initial:!0,get:gt.get},gt.getInput(Bt)));const kt=gt.useStore.subscribe(At=>{const Rt=At.data[Bt];return[Rt.disabled?void 0:Rt.value,Rt]},([At,Rt])=>Pt(At,Bt,_objectSpread2$1({initial:!1,get:gt.get},Rt)),{equalityFn:shallow$2});Lt.push(kt)}),()=>Lt.forEach(Bt=>Bt())},[gt,xt]),reactExports.useEffect(()=>{const Lt=[];return Object.entries(St).forEach(([Bt,Pt])=>Lt.push(gt.subscribeToEditStart(Bt,Pt))),Object.entries(Et).forEach(([Bt,Pt])=>Lt.push(gt.subscribeToEditEnd(Bt,Pt))),()=>Lt.forEach(Bt=>Bt())},[St,Et,gt]),ut?[Tt,$t,Ut]:Tt}register(LevaInputs.SELECT,select$1);register(LevaInputs.IMAGE,image$1);register(LevaInputs.NUMBER,number$7);register(LevaInputs.COLOR,color$4);register(LevaInputs.STRING,string$3);register(LevaInputs.BOOLEAN,boolean$1);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$k=tt=>!isNullOrUndefined(tt)&&!Array.isArray(tt)&&isObjectType(tt)&&!isDateObject(tt),getEventValue=tt=>isObject$k(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$5=tt=>{const et=tt.constructor&&tt.constructor.prototype;return isObject$k(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$k(tt)))if(et=nt?[]:{},!nt&&!isPlainObject$5(tt))et=tt;else for(const it in tt)tt.hasOwnProperty(it)&&(et[it]=cloneObject(tt[it]));else return tt;return et}var compact=tt=>Array.isArray(tt)?tt.filter(Boolean):[],isUndefined$1=tt=>tt===void 0,get$6=(tt,et,nt)=>{if(!et||!isObject$k(tt))return nt;const it=compact(et.split(/[,[\].]+?/)).reduce((rt,ot)=>isNullOrUndefined(rt)?rt:rt[ot],tt);return isUndefined$1(it)||it===tt?isUndefined$1(tt[et])?nt:tt[et]:it},isBoolean$3=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,it=!0)=>{const rt={defaultValues:et._defaultValues};for(const ot in tt)Object.defineProperty(rt,ot,{get:()=>{const at=ot;return et._proxyFormState[at]!==VALIDATION_MODE.all&&(et._proxyFormState[at]=!it||VALIDATION_MODE.all),nt&&(nt[at]=!0),tt[at]}});return rt},isEmptyObject=tt=>isObject$k(tt)&&!Object.keys(tt).length,shouldRenderFormState=(tt,et,nt,it)=>{nt(tt);const{name:rt,...ot}=tt;return isEmptyObject(ot)||Object.keys(ot).length>=Object.keys(et).length||Object.keys(ot).find(at=>et[at]===(!it||VALIDATION_MODE.all))},convertToArrayPayload=tt=>Array.isArray(tt)?tt:[tt],shouldSubscribeByName=(tt,et,nt)=>!tt||!et||tt===et||convertToArrayPayload(tt).some(it=>it&&(nt?it===et:it.startsWith(et)||et.startsWith(it)));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:it,name:rt,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(rt);return ut.current=rt,useSubscribe({disabled:it,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$4=tt=>typeof tt=="string",generateWatchOutput=(tt,et,nt,it,rt)=>isString$4(tt)?(it&&et.watch.add(tt),get$6(nt,tt,rt)):Array.isArray(tt)?tt.map(ot=>(it&&et.watch.add(ot),get$6(nt,ot))):(it&&(et.watchAll=!0),nt);function useWatch(tt){const et=useFormContext(),{control:nt=et.control,name:it,defaultValue:rt,disabled:ot,exact:at}=tt||{},st=React$1.useRef(it);st.current=it,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,rt)))}});const[lt,ct]=React$1.useState(nt._getWatch(it,rt));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 it=-1;const rt=isKey$4(et)?[et]:stringToPath$3(et),ot=rt.length,at=ot-1;for(;++it{const ut=rt._options.shouldUnregister||ot,ht=(dt,pt)=>{const mt=get$6(rt._fields,dt);mt&&(mt._f.mount=pt)};if(ht(nt,!0),ut){const dt=cloneObject(get$6(rt._options.defaultValues,nt));set$3(rt._defaultValues,nt,dt),isUndefined$1(get$6(rt._formValues,nt))&&set$3(rt._formValues,nt,dt)}return()=>{(at?ut&&!rt._state.action:ut)?rt.unregister(nt):ht(nt,!1)}},[nt,rt,at,ot]),React$1.useEffect(()=>{get$6(rt._fields,nt)&&rt._updateDisabledField({disabled:it,fields:rt._fields,name:nt,value:get$6(rt._fields,nt)._f.value})},[it,nt,rt]),{field:{name:nt,value:st,...isBoolean$3(it)||isBoolean$3(lt.disabled)?{disabled:lt.disabled||it}:{},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$6(rt._formValues,nt),name:nt},type:EVENTS.BLUR}),[nt,rt]),ref:ut=>{const ht=get$6(rt._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$6(lt.errors,nt)},isDirty:{enumerable:!0,get:()=>!!get$6(lt.dirtyFields,nt)},isTouched:{enumerable:!0,get:()=>!!get$6(lt.touchedFields,nt)},error:{enumerable:!0,get:()=>get$6(lt.errors,nt)}})}}const Controller=tt=>tt.render(useController(tt));var appendErrors=(tt,et,nt,it,rt)=>et?{...nt[tt],types:{...nt[tt]&&nt[tt].types?nt[tt].types:{},[it]:rt||!0}}:{},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(it=>tt.startsWith(it)&&/^\.\w+/.test(tt.slice(it.length))));const iterateFieldsByAction=(tt,et,nt,it)=>{for(const rt of nt||Object.keys(tt)){const ot=get$6(tt,rt);if(ot){const{_f:at,...st}=ot;if(at){if(at.refs&&at.refs[0]&&et(at.refs[0],rt)&&!it)break;if(at.ref&&et(at.ref,at.name)&&!it)break}else isObject$k(st)&&iterateFieldsByAction(st,et)}}};var updateFieldArrayRootError=(tt,et,nt)=>{const it=compact(get$6(tt,nt));return set$3(it,"root",et[nt]),set$3(tt,nt,it),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$4(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$3(tt)&&!tt)return{type:nt,message:isMessage(tt)?tt:"",ref:et}}var getValueAndMessage=tt=>isObject$k(tt)&&!isRegex(tt)?tt:{value:tt,message:""},validateField=async(tt,et,nt,it,rt)=>{const{ref:ot,refs:at,required:st,maxLength:lt,minLength:ct,min:ut,max:ht,pattern:dt,validate:pt,name:mt,valueAsNumber:gt,mount:bt,disabled:yt}=tt._f,wt=get$6(et,mt);if(!bt||yt)return{};const vt=at?at[0]:ot,xt=Bt=>{it&&vt.reportValidity&&(vt.setCustomValidity(isBoolean$3(Bt)?"":Bt||""),vt.reportValidity())},St={},Et=isRadioInput(ot),It=isCheckBoxInput(ot),Tt=Et||It,$t=(gt||isFileInput(ot))&&isUndefined$1(ot.value)&&isUndefined$1(wt)||isHTMLElement$2(ot)&&ot.value===""||wt===""||Array.isArray(wt)&&!wt.length,Ut=appendErrors.bind(null,mt,nt,St),Lt=(Bt,Pt,kt,At=INPUT_VALIDATION_RULES.maxLength,Rt=INPUT_VALIDATION_RULES.minLength)=>{const Wt=Bt?Pt:kt;St[mt]={type:Bt?At:Rt,message:Wt,ref:ot,...Ut(Bt?At:Rt,Wt)}};if(rt?!Array.isArray(wt)||!wt.length:st&&(!Tt&&($t||isNullOrUndefined(wt))||isBoolean$3(wt)&&!wt||It&&!getCheckboxValue(at).isValid||Et&&!getRadioValue(at).isValid)){const{value:Bt,message:Pt}=isMessage(st)?{value:!!st,message:st}:getValueAndMessage(st);if(Bt&&(St[mt]={type:INPUT_VALIDATION_RULES.required,message:Pt,ref:vt,...Ut(INPUT_VALIDATION_RULES.required,Pt)},!nt))return xt(Pt),St}if(!$t&&(!isNullOrUndefined(ut)||!isNullOrUndefined(ht))){let Bt,Pt;const kt=getValueAndMessage(ht),At=getValueAndMessage(ut);if(!isNullOrUndefined(wt)&&!isNaN(wt)){const Rt=ot.valueAsNumber||wt&&+wt;isNullOrUndefined(kt.value)||(Bt=Rt>kt.value),isNullOrUndefined(At.value)||(Pt=Rtnew Date(new Date().toDateString()+" "+Ct),jt=ot.type=="time",Ot=ot.type=="week";isString$4(kt.value)&&wt&&(Bt=jt?Wt(wt)>Wt(kt.value):Ot?wt>kt.value:Rt>new Date(kt.value)),isString$4(At.value)&&wt&&(Pt=jt?Wt(wt)+Bt.value,At=!isNullOrUndefined(Pt.value)&&wt.length<+Pt.value;if((kt||At)&&(Lt(kt,Bt.message,Pt.message),!nt))return xt(St[mt].message),St}if(dt&&!$t&&isString$4(wt)){const{value:Bt,message:Pt}=getValueAndMessage(dt);if(isRegex(Bt)&&!wt.match(Bt)&&(St[mt]={type:INPUT_VALIDATION_RULES.pattern,message:Pt,ref:ot,...Ut(INPUT_VALIDATION_RULES.pattern,Pt)},!nt))return xt(Pt),St}if(pt){if(isFunction$6(pt)){const Bt=await pt(wt,et),Pt=getValidateError(Bt,vt);if(Pt&&(St[mt]={...Pt,...Ut(INPUT_VALIDATION_RULES.validate,Pt.message)},!nt))return xt(Pt.message),St}else if(isObject$k(pt)){let Bt={};for(const Pt in pt){if(!isEmptyObject(Bt)&&!nt)break;const kt=getValidateError(await pt[Pt](wt,et),vt,Pt);kt&&(Bt={...kt,...Ut(Pt,kt.message)},xt(kt.message),nt&&(St[mt]=Bt))}if(!isEmptyObject(Bt)&&(St[mt]={ref:vt,...Bt},!nt))return St}}return xt(!0),St};function baseGet$4(tt,et){const nt=et.slice(0,-1).length;let it=0;for(;it{for(const ot of tt)ot.next&&ot.next(rt)},subscribe:rt=>(tt.push(rt),{unsubscribe:()=>{tt=tt.filter(ot=>ot!==rt)}}),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),it=Object.keys(et);if(nt.length!==it.length)return!1;for(const rt of nt){const ot=tt[rt];if(!it.includes(rt))return!1;if(rt!=="ref"){const at=et[rt];if(isDateObject(ot)&&isDateObject(at)||isObject$k(ot)&&isObject$k(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$k(tt)||nt)for(const it in tt)Array.isArray(tt[it])||isObject$k(tt[it])&&!objectHasFunction(tt[it])?(et[it]=Array.isArray(tt[it])?[]:{},markFieldsDirty(tt[it],et[it])):isNullOrUndefined(tt[it])||(et[it]=!0);return et}function getDirtyFieldsFromDefaultValues(tt,et,nt){const it=Array.isArray(tt);if(isObject$k(tt)||it)for(const rt in tt)Array.isArray(tt[rt])||isObject$k(tt[rt])&&!objectHasFunction(tt[rt])?isUndefined$1(et)||isPrimitive(nt[rt])?nt[rt]=Array.isArray(tt[rt])?markFieldsDirty(tt[rt],[]):{...markFieldsDirty(tt[rt])}:getDirtyFieldsFromDefaultValues(tt[rt],isNullOrUndefined(et)?{}:et[rt],nt[rt]):nt[rt]=!deepEqual$2(tt[rt],et[rt]);return nt}var getDirtyFields=(tt,et)=>getDirtyFieldsFromDefaultValues(tt,et,markFieldsDirty(et)),getFieldValueAs=(tt,{valueAsNumber:et,valueAsDate:nt,setValueAs:it})=>isUndefined$1(tt)?tt:et?tt===""?NaN:tt&&+tt:nt&&isString$4(tt)?new Date(tt):it?it(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,it)=>{const rt={};for(const ot of tt){const at=get$6(et,ot);at&&set$3(rt,ot,at._f)}return{criteriaMode:nt,names:[...tt],fields:rt,shouldUseNativeValidation:it}},getRuleValue=tt=>isUndefined$1(tt)?tt:isRegex(tt)?tt.source:isObject$k(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 it=get$6(tt,nt);if(it||isKey$4(nt))return{error:it,name:nt};const rt=nt.split(".");for(;rt.length;){const ot=rt.join("."),at=get$6(et,ot),st=get$6(tt,ot);if(at&&!Array.isArray(at)&&nt!==ot)return{name:nt};if(st&&st.type)return{name:ot,error:st};rt.pop()}return{name:nt}}var skipValidation=(tt,et,nt,it,rt)=>rt.isOnAll?!1:!nt&&rt.isOnTouch?!(et||tt):(nt?it.isOnBlur:rt.isOnBlur)?!tt:(nt?it.isOnChange:rt.isOnChange)?tt:!0,unsetEmptyArray=(tt,et)=>!compact(get$6(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},it={submitCount:0,isDirty:!1,isLoading:isFunction$6(nt.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},rt={},ot=isObject$k(nt.defaultValues)||isObject$k(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),bt=nt.criteriaMode===VALIDATION_MODE.all,yt=un=>En=>{clearTimeout(ut),ut=setTimeout(un,En)},wt=async un=>{if(ht.isValid||un){const En=nt.resolver?isEmptyObject((await $t()).errors):await Lt(rt,!0);En!==it.isValid&&dt.state.next({isValid:En})}},vt=un=>ht.isValidating&&dt.state.next({isValidating:un}),xt=(un,En=[],In,xn,dn=!0,cn=!0)=>{if(xn&&In){if(st.action=!0,cn&&Array.isArray(get$6(rt,un))){const hn=In(get$6(rt,un),xn.argA,xn.argB);dn&&set$3(rt,un,hn)}if(cn&&Array.isArray(get$6(it.errors,un))){const hn=In(get$6(it.errors,un),xn.argA,xn.argB);dn&&set$3(it.errors,un,hn),unsetEmptyArray(it.errors,un)}if(ht.touchedFields&&cn&&Array.isArray(get$6(it.touchedFields,un))){const hn=In(get$6(it.touchedFields,un),xn.argA,xn.argB);dn&&set$3(it.touchedFields,un,hn)}ht.dirtyFields&&(it.dirtyFields=getDirtyFields(ot,at)),dt.state.next({name:un,isDirty:Pt(un,En),dirtyFields:it.dirtyFields,errors:it.errors,isValid:it.isValid})}else set$3(at,un,En)},St=(un,En)=>{set$3(it.errors,un,En),dt.state.next({errors:it.errors})},Et=(un,En,In,xn)=>{const dn=get$6(rt,un);if(dn){const cn=get$6(at,un,isUndefined$1(In)?get$6(ot,un):In);isUndefined$1(cn)||xn&&xn.defaultChecked||En?set$3(at,un,En?cn:getFieldValue(dn._f)):Rt(un,cn),st.mount&&wt()}},It=(un,En,In,xn,dn)=>{let cn=!1,hn=!1;const $n={name:un};if(!In||xn){ht.isDirty&&(hn=it.isDirty,it.isDirty=$n.isDirty=Pt(),cn=hn!==$n.isDirty);const nn=deepEqual$2(get$6(ot,un),En);hn=get$6(it.dirtyFields,un),nn?unset(it.dirtyFields,un):set$3(it.dirtyFields,un,!0),$n.dirtyFields=it.dirtyFields,cn=cn||ht.dirtyFields&&hn!==!nn}if(In){const nn=get$6(it.touchedFields,un);nn||(set$3(it.touchedFields,un,In),$n.touchedFields=it.touchedFields,cn=cn||ht.touchedFields&&nn!==In)}return cn&&dn&&dt.state.next($n),cn?$n:{}},Tt=(un,En,In,xn)=>{const dn=get$6(it.errors,un),cn=ht.isValid&&isBoolean$3(En)&&it.isValid!==En;if(tt.delayError&&In?(ct=yt(()=>St(un,In)),ct(tt.delayError)):(clearTimeout(ut),ct=null,In?set$3(it.errors,un,In):unset(it.errors,un)),(In?!deepEqual$2(dn,In):dn)||!isEmptyObject(xn)||cn){const hn={...xn,...cn&&isBoolean$3(En)?{isValid:En}:{},errors:it.errors,name:un};it={...it,...hn},dt.state.next(hn)}vt(!1)},$t=async un=>nt.resolver(at,nt.context,getResolverOptions(un||lt.mount,rt,nt.criteriaMode,nt.shouldUseNativeValidation)),Ut=async un=>{const{errors:En}=await $t(un);if(un)for(const In of un){const xn=get$6(En,In);xn?set$3(it.errors,In,xn):unset(it.errors,In)}else it.errors=En;return En},Lt=async(un,En,In={valid:!0})=>{for(const xn in un){const dn=un[xn];if(dn){const{_f:cn,...hn}=dn;if(cn){const $n=lt.array.has(cn.name),nn=await validateField(dn,at,bt,nt.shouldUseNativeValidation&&!En,$n);if(nn[cn.name]&&(In.valid=!1,En))break;!En&&(get$6(nn,cn.name)?$n?updateFieldArrayRootError(it.errors,nn,cn.name):set$3(it.errors,cn.name,nn[cn.name]):unset(it.errors,cn.name))}hn&&await Lt(hn,En,In)}}return In.valid},Bt=()=>{for(const un of lt.unMount){const En=get$6(rt,un);En&&(En._f.refs?En._f.refs.every(In=>!live(In)):!live(En._f.ref))&&an(un)}lt.unMount=new Set},Pt=(un,En)=>(un&&En&&set$3(at,un,En),!deepEqual$2(Mt(),ot)),kt=(un,En,In)=>generateWatchOutput(un,lt,{...st.mount?at:isUndefined$1(En)?ot:isString$4(un)?{[un]:En}:En},In,En),At=un=>compact(get$6(st.mount?at:ot,un,tt.shouldUnregister?get$6(ot,un,[]):[])),Rt=(un,En,In={})=>{const xn=get$6(rt,un);let dn=En;if(xn){const cn=xn._f;cn&&(!cn.disabled&&set$3(at,un,getFieldValueAs(En,cn)),dn=isHTMLElement$2(cn.ref)&&isNullOrUndefined(En)?"":En,isMultipleSelect(cn.ref)?[...cn.ref.options].forEach(hn=>hn.selected=dn.includes(hn.value)):cn.refs?isCheckBoxInput(cn.ref)?cn.refs.length>1?cn.refs.forEach(hn=>(!hn.defaultChecked||!hn.disabled)&&(hn.checked=Array.isArray(dn)?!!dn.find($n=>$n===hn.value):dn===hn.value)):cn.refs[0]&&(cn.refs[0].checked=!!dn):cn.refs.forEach(hn=>hn.checked=hn.value===dn):isFileInput(cn.ref)?cn.ref.value="":(cn.ref.value=dn,cn.ref.type||dt.values.next({name:un,values:{...at}})))}(In.shouldDirty||In.shouldTouch)&&It(un,dn,In.shouldTouch,In.shouldDirty,!0),In.shouldValidate&&Dt(un)},Wt=(un,En,In)=>{for(const xn in En){const dn=En[xn],cn=`${un}.${xn}`,hn=get$6(rt,cn);(lt.array.has(un)||!isPrimitive(dn)||hn&&!hn._f)&&!isDateObject(dn)?Wt(cn,dn,In):Rt(cn,dn,In)}},jt=(un,En,In={})=>{const xn=get$6(rt,un),dn=lt.array.has(un),cn=cloneObject(En);set$3(at,un,cn),dn?(dt.array.next({name:un,values:{...at}}),(ht.isDirty||ht.dirtyFields)&&In.shouldDirty&&dt.state.next({name:un,dirtyFields:getDirtyFields(ot,at),isDirty:Pt(un,cn)})):xn&&!xn._f&&!isNullOrUndefined(cn)?Wt(un,cn,In):Rt(un,cn,In),isWatched(un,lt)&&dt.state.next({...it}),dt.values.next({name:un,values:{...at}}),!st.mount&&et()},Ot=async un=>{const En=un.target;let In=En.name,xn=!0;const dn=get$6(rt,In),cn=()=>En.type?getFieldValue(dn._f):getEventValue(un),hn=$n=>{xn=Number.isNaN($n)||$n===get$6(at,In,$n)};if(dn){let $n,nn;const Kt=cn(),Yt=un.type===EVENTS.BLUR||un.type===EVENTS.FOCUS_OUT,_n=!hasValidation(dn._f)&&!nt.resolver&&!get$6(it.errors,In)&&!dn._f.deps||skipValidation(Yt,get$6(it.touchedFields,In),it.isSubmitted,gt,mt),Mn=isWatched(In,lt,Yt);set$3(at,In,Kt),Yt?(dn._f.onBlur&&dn._f.onBlur(un),ct&&ct(0)):dn._f.onChange&&dn._f.onChange(un);const Bn=It(In,Kt,Yt,!1),Nn=!isEmptyObject(Bn)||Mn;if(!Yt&&dt.values.next({name:In,type:un.type,values:{...at}}),_n)return ht.isValid&&wt(),Nn&&dt.state.next({name:In,...Mn?{}:Bn});if(!Yt&&Mn&&dt.state.next({...it}),vt(!0),nt.resolver){const{errors:qn}=await $t([In]);if(hn(Kt),xn){const Wn=schemaErrorLookup(it.errors,rt,In),Vn=schemaErrorLookup(qn,rt,Wn.name||In);$n=Vn.error,In=Vn.name,nn=isEmptyObject(qn)}}else $n=(await validateField(dn,at,bt,nt.shouldUseNativeValidation))[In],hn(Kt),xn&&($n?nn=!1:ht.isValid&&(nn=await Lt(rt,!0)));xn&&(dn._f.deps&&Dt(dn._f.deps),Tt(In,nn,$n,Bn))}},Ct=(un,En)=>{if(get$6(it.errors,En)&&un.focus)return un.focus(),1},Dt=async(un,En={})=>{let In,xn;const dn=convertToArrayPayload(un);if(vt(!0),nt.resolver){const cn=await Ut(isUndefined$1(un)?un:dn);In=isEmptyObject(cn),xn=un?!dn.some(hn=>get$6(cn,hn)):In}else un?(xn=(await Promise.all(dn.map(async cn=>{const hn=get$6(rt,cn);return await Lt(hn&&hn._f?{[cn]:hn}:hn)}))).every(Boolean),!(!xn&&!it.isValid)&&wt()):xn=In=await Lt(rt);return dt.state.next({...!isString$4(un)||ht.isValid&&In!==it.isValid?{}:{name:un},...nt.resolver||!un?{isValid:In}:{},errors:it.errors,isValidating:!1}),En.shouldFocus&&!xn&&iterateFieldsByAction(rt,Ct,un?dn:lt.mount),xn},Mt=un=>{const En={...ot,...st.mount?at:{}};return isUndefined$1(un)?En:isString$4(un)?get$6(En,un):un.map(In=>get$6(En,In))},Vt=(un,En)=>({invalid:!!get$6((En||it).errors,un),isDirty:!!get$6((En||it).dirtyFields,un),isTouched:!!get$6((En||it).touchedFields,un),error:get$6((En||it).errors,un)}),Qt=un=>{un&&convertToArrayPayload(un).forEach(En=>unset(it.errors,En)),dt.state.next({errors:un?it.errors:{}})},rn=(un,En,In)=>{const xn=(get$6(rt,un,{_f:{}})._f||{}).ref;set$3(it.errors,un,{...En,ref:xn}),dt.state.next({name:un,errors:it.errors,isValid:!1}),In&&In.shouldFocus&&xn&&xn.focus&&xn.focus()},Xt=(un,En)=>isFunction$6(un)?dt.values.subscribe({next:In=>un(kt(void 0,En),In)}):kt(un,En,!0),an=(un,En={})=>{for(const In of un?convertToArrayPayload(un):lt.mount)lt.mount.delete(In),lt.array.delete(In),En.keepValue||(unset(rt,In),unset(at,In)),!En.keepError&&unset(it.errors,In),!En.keepDirty&&unset(it.dirtyFields,In),!En.keepTouched&&unset(it.touchedFields,In),!nt.shouldUnregister&&!En.keepDefaultValue&&unset(ot,In);dt.values.next({values:{...at}}),dt.state.next({...it,...En.keepDirty?{isDirty:Pt()}:{}}),!En.keepIsValid&&wt()},tn=({disabled:un,name:En,field:In,fields:xn,value:dn})=>{if(isBoolean$3(un)){const cn=un?void 0:isUndefined$1(dn)?getFieldValue(In?In._f:get$6(xn,En)._f):dn;set$3(at,En,cn),It(En,cn,!1,!1,!0)}},pn=(un,En={})=>{let In=get$6(rt,un);const xn=isBoolean$3(En.disabled);return set$3(rt,un,{...In||{},_f:{...In&&In._f?In._f:{ref:{name:un}},name:un,mount:!0,...En}}),lt.mount.add(un),In?tn({field:In,disabled:En.disabled,name:un}):Et(un,!0,En.value),{...xn?{disabled:En.disabled}:{},...nt.progressive?{required:!!En.required,min:getRuleValue(En.min),max:getRuleValue(En.max),minLength:getRuleValue(En.minLength),maxLength:getRuleValue(En.maxLength),pattern:getRuleValue(En.pattern)}:{},name:un,onChange:Ot,onBlur:Ot,ref:dn=>{if(dn){pn(un,En),In=get$6(rt,un);const cn=isUndefined$1(dn.value)&&dn.querySelectorAll&&dn.querySelectorAll("input,select,textarea")[0]||dn,hn=isRadioOrCheckbox(cn),$n=In._f.refs||[];if(hn?$n.find(nn=>nn===cn):cn===In._f.ref)return;set$3(rt,un,{_f:{...In._f,...hn?{refs:[...$n.filter(live),cn,...Array.isArray(get$6(ot,un))?[{}]:[]],ref:{type:cn.type,name:un}}:{ref:cn}}}),Et(un,!1,void 0,cn)}else In=get$6(rt,un,{}),In._f&&(In._f.mount=!1),(nt.shouldUnregister||En.shouldUnregister)&&!(isNameInFieldArray(lt.array,un)&&st.action)&<.unMount.add(un)}}},vn=()=>nt.shouldFocusError&&iterateFieldsByAction(rt,Ct,lt.mount),sn=un=>{isBoolean$3(un)&&(dt.state.next({disabled:un}),iterateFieldsByAction(rt,En=>{En.disabled=un},0,!1))},Zt=(un,En)=>async In=>{In&&(In.preventDefault&&In.preventDefault(),In.persist&&In.persist());let xn=cloneObject(at);if(dt.state.next({isSubmitting:!0}),nt.resolver){const{errors:dn,values:cn}=await $t();it.errors=dn,xn=cn}else await Lt(rt);unset(it.errors,"root"),isEmptyObject(it.errors)?(dt.state.next({errors:{}}),await un(xn,In)):(En&&await En({...it.errors},In),vn(),setTimeout(vn)),dt.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject(it.errors),submitCount:it.submitCount+1,errors:it.errors})},Sn=(un,En={})=>{get$6(rt,un)&&(isUndefined$1(En.defaultValue)?jt(un,get$6(ot,un)):(jt(un,En.defaultValue),set$3(ot,un,En.defaultValue)),En.keepTouched||unset(it.touchedFields,un),En.keepDirty||(unset(it.dirtyFields,un),it.isDirty=En.defaultValue?Pt(un,get$6(ot,un)):Pt()),En.keepError||(unset(it.errors,un),ht.isValid&&wt()),dt.state.next({...it}))},Tn=(un,En={})=>{const In=un?cloneObject(un):ot,xn=cloneObject(In),dn=un&&!isEmptyObject(un)?xn:ot;if(En.keepDefaultValues||(ot=In),!En.keepValues){if(En.keepDirtyValues||pt)for(const cn of lt.mount)get$6(it.dirtyFields,cn)?set$3(dn,cn,get$6(at,cn)):jt(cn,get$6(dn,cn));else{if(isWeb&&isUndefined$1(un))for(const cn of lt.mount){const hn=get$6(rt,cn);if(hn&&hn._f){const $n=Array.isArray(hn._f.refs)?hn._f.refs[0]:hn._f.ref;if(isHTMLElement$2($n)){const nn=$n.closest("form");if(nn){nn.reset();break}}}}rt={}}at=tt.shouldUnregister?En.keepDefaultValues?cloneObject(ot):{}:cloneObject(dn),dt.array.next({values:{...dn}}),dt.values.next({values:{...dn}})}lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!st.mount&&et(),st.mount=!ht.isValid||!!En.keepIsValid,st.watch=!!tt.shouldUnregister,dt.state.next({submitCount:En.keepSubmitCount?it.submitCount:0,isDirty:En.keepDirty?it.isDirty:!!(En.keepDefaultValues&&!deepEqual$2(un,ot)),isSubmitted:En.keepIsSubmitted?it.isSubmitted:!1,dirtyFields:En.keepDirtyValues?it.dirtyFields:En.keepDefaultValues&&un?getDirtyFields(ot,un):{},touchedFields:En.keepTouched?it.touchedFields:{},errors:En.keepErrors?it.errors:{},isSubmitSuccessful:En.keepIsSubmitSuccessful?it.isSubmitSuccessful:!1,isSubmitting:!1})},Cn=(un,En)=>Tn(isFunction$6(un)?un(at):un,En);return{control:{register:pn,unregister:an,getFieldState:Vt,handleSubmit:Zt,setError:rn,_executeSchema:$t,_getWatch:kt,_getDirty:Pt,_updateValid:wt,_removeUnmounted:Bt,_updateFieldArray:xt,_updateDisabledField:tn,_getFieldArray:At,_reset:Tn,_resetDefaultValues:()=>isFunction$6(nt.defaultValues)&&nt.defaultValues().then(un=>{Cn(un,nt.resetOptions),dt.state.next({isLoading:!1})}),_updateFormState:un=>{it={...it,...un}},_disableForm:sn,_subjects:dt,_proxyFormState:ht,get _fields(){return rt},get _formValues(){return at},get _state(){return st},set _state(un){st=un},get _defaultValues(){return ot},get _names(){return lt},set _names(un){lt=un},get _formState(){return it},set _formState(un){it=un},get _options(){return nt},set _options(un){nt={...nt,...un}}},trigger:Dt,register:pn,handleSubmit:Zt,watch:Xt,setValue:jt,getValues:Mt,reset:Cn,resetField:Sn,clearErrors:Qt,unregister:an,setError:rn,setFocus:(un,En={})=>{const In=get$6(rt,un),xn=In&&In._f;if(xn){const dn=xn.refs?xn.refs[0]:xn.ref;dn.focus&&(dn.focus(),En.shouldSelect&&dn.select())}},getFieldState:Vt}}function useForm(tt={}){const et=React$1.useRef(),nt=React$1.useRef(),[it,rt]=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:{},disabled:!1,defaultValues:isFunction$6(tt.defaultValues)?void 0:tt.defaultValues});et.current||(et.current={...createFormControl(tt,()=>rt(at=>({...at}))),formState:it});const ot=et.current.control;return ot._options=tt,useSubscribe({subject:ot._subjects.state,next:at=>{shouldRenderFormState(at,ot._proxyFormState,ot._updateFormState,!0)&&rt({...ot._formState})}}),React$1.useEffect(()=>ot._disableForm(tt.disabled),[ot,tt.disabled]),React$1.useEffect(()=>{if(ot._proxyFormState.isDirty){const at=ot._getDirty();at!==it.isDirty&&ot._subjects.state.next({isDirty:at})}},[ot,it.isDirty]),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(it,ot),et.current}const ReactToastify="";var dist$4={exports:{}},lib$3={},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 it={};try{it=JSON.parse(nt.data)}catch{}tt({data:it})}):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.sphinxMessage=function(nt){var it={};try{it=JSON.parse(nt)}catch{}tt({data:it})}:et.Android?et.sphinxMessage=function(nt){var it={};try{it=JSON.parse(nt)}catch{}tt({data:it})}: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])&&(yt[0]===6||yt[0]===2)){ut=0;continue}if(yt[0]===3&&(!pt||yt[1]>pt[0]&&yt[1] ENABLE!"),this.isEnabled)return[2,{budget:this.budget,pubkey:this.pubkey,application:at}];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ut=dt.sent(),ut.pubkey?(this.isEnabled=!0,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[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 it(this,function(bt){switch(bt.label){case 0:ht&&(this.logging=!0),this.logging&&console.log("=> AUTHORIZE!"),bt.label=1;case 1:return bt.trys.push([1,3,,4]),dt=ut||!1,[4,this.postMsg(ot.AUTHORIZE,{challenge:ct,noBudget:dt})];case 2:return pt=bt.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=bt.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 it(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.SETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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,ht;return it(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> GETBUDGET"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.GETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.setBudget=function(){return nt(this,void 0,void 0,function(){var ct,ut,ht;return it(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SETBUDGET"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.postMsg=function(ct,ut){var ht=this;ht.active&&Promise.reject(new Error("User is busy")),ht.active=ct;var dt=window;return dt.kmpJsBridge.callNative?new Promise(function(pt,mt){dt.kmpJsBridge.callNative("sphinx-bridge",JSON.stringify(et({application:at,type:ct},ut||{})),function(gt){var bt={};try{bt=JSON.parse(gt)}catch{}bt||bt.application!==at||(ht.active=null,bt.error?mt(bt.error):pt(bt))})}):new Promise(function(pt,mt){rt.postMessage(et({application:at,type:ct},ut||{}));function gt(bt){!bt.data||bt.data.application!==at||(bt.data.error?(ht.active=null,mt(bt.data.error)):(ht.active=null,pt(bt.data)),rt.removeEventer(gt))}rt.addEventer(gt)})},lt}();tt.default=st})(lib$3);var dist$3=dist$4.exports;Object.defineProperty(dist$3,"__esModule",{value:!0});var lib_1=lib$3,sphinx=new lib_1.default;dist$4.exports=sphinx;var distExports$1=dist$4.exports,reactIs$3={exports:{}},reactIs_production_min$2={};/** + */var split=splitString,extend$5=extendShallow,isPlainObject$6=isPlainObject$8,isObject$m=isExtendable,setValue=function(tt,et,nt){if(!isObject$m(tt)||(Array.isArray(et)&&(et=[].concat.apply([],et).join(".")),typeof et!="string"))return tt;for(var it=split(et,{sep:".",brackets:!0}).filter(isValidKey),rt=it.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:it,disabled:rt,key:ot}])=>(nt[ot]=rt?void 0:it,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),it=reactExports.useRef(!0);return reactExports.useLayoutEffect(()=>{tt||(et.current.style.height="0px",et.current.style.overflow="hidden")},[]),reactExports.useEffect(()=>{if(it.current){it.current=!1;return}let rt;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",rt=window.setTimeout(()=>ot.style.height="0px",50)),()=>{ot.removeEventListener("transitionend",at),clearTimeout(rt)}},[tt]),{wrapperRef:et,contentRef:nt}}const useVisiblePaths=tt=>{const[et,nt]=reactExports.useState(tt.getVisiblePaths());return reactExports.useEffect(()=>{nt(tt.getVisiblePaths());const it=tt.useStore.subscribe(tt.getVisiblePaths,nt,{equalityFn:shallow$2});return()=>it()},[tt]),et};function useValuesForPath(tt,et,nt){return tt.useStore(rt=>{const ot=_objectSpread2$1(_objectSpread2$1({},nt),rt.data);return getValuesForPaths(ot,et)},shallow$2)}function usePopin(tt=3){const et=reactExports.useRef(null),nt=reactExports.useRef(null),[it,rt]=reactExports.useState(!1),ot=reactExports.useCallback(()=>rt(!0),[]),at=reactExports.useCallback(()=>rt(!1),[]);return reactExports.useLayoutEffect(()=>{if(it){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,it]),{popinRef:et,wrapperRef:nt,shown:it,show:ot,hide:at}}k$9([namesPlugin]);const convertMap={rgb:"toRgb",hsl:"toHsl",hsv:"toHsv",hex:"toHex"};v8n.extend({color:()=>tt=>w$6(tt).isValid()});const schema$2=tt=>v8n().color().test(tt);function convert$6(tt,{format:et,hasAlpha:nt,isString:it}){const rt=convertMap[et]+(it&&et!=="hex"?"String":""),ot=tt[rt]();return typeof ot=="object"&&!nt?omit$1(ot,["a"]):ot}const sanitize$2=(tt,et)=>{const nt=w$6(tt);if(!nt.isValid())throw Error("Invalid color");return convert$6(nt,et)},format$1$1=(tt,et)=>convert$6(w$6(tt),_objectSpread2$1(_objectSpread2$1({},et),{},{isString:!0,format:"hex"})),normalize$3$1=({value:tt})=>{const et=I$2(tt),nt=et==="name"?"hex":et,it=typeof tt=="object"?"a"in tt:et==="hex"&&tt.length===8||/^(rgba)|(hsla)|(hsva)/.test(tt),rt={format:nt,hasAlpha:it,isString:typeof tt=="string"};return{value:sanitize$2(tt,rt),settings:rt}};var props$2=Object.freeze({__proto__:null,schema:schema$2,sanitize:sanitize$2,format:format$1$1,normalize:normalize$3$1});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$6(tt).toRgb():tt}function Color$2({value:tt,displayValue:et,settings:nt,onUpdate:it}){const{emitOnEditStart:rt,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)),bt=st?Ce:Ne$1,yt=()=>{gt(convertToRgb(tt,at)),ht(),rt()},wt=()=>{dt(),ot(),window.clearTimeout(pt.current)},vt=()=>{pt.current=window.setTimeout(wt,500)};return reactExports.useEffect(()=>()=>window.clearTimeout(pt.current),[]),React$1.createElement(React$1.Fragment,null,React$1.createElement(ColorPreview,{ref:lt,active:ut,onClick:()=>yt(),style:{color:et}}),ut&&React$1.createElement(Portal$1,null,React$1.createElement(Overlay$1,{onPointerUp:wt}),React$1.createElement(PickerWrapper,{ref:ct,onMouseEnter:()=>window.clearTimeout(pt.current),onMouseLeave:xt=>xt.buttons===0&&vt()},React$1.createElement(bt,{color:mt,onChange:it}))))}function ColorComponent(){const{value:tt,displayValue:et,label:nt,onChange:it,onUpdate:rt,settings:ot}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,nt),React$1.createElement(PickerContainer,null,React$1.createElement(Color$2,{value:tt,displayValue:et,onChange:it,onUpdate:rt,settings:ot}),React$1.createElement(ValueInput,{value:et,onChange:it,onUpdate:rt})))}var color$4=_objectSpread2$1({component:ColorComponent},props$2);function Vector3dComponent(){const{label:tt,displayValue:et,onUpdate:nt,settings:it}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Vector,{value:et,settings:it,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 it=reactExports.useRef(),rt=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:Bt,left:Pt,width:kt,height:At}=pt.current.getBoundingClientRect();mt.current.style.left=Pt+kt/2+"px",mt.current.style.top=Bt+At/2+"px"}},[st]);const{keys:[gt,bt],joystick:yt}=et,wt=yt==="invertY"?1:-1,{[gt]:{step:vt},[bt]:{step:xt}}=et,St=useTh("sizes","joystickWidth"),Et=useTh("sizes","joystickHeight"),It=parseFloat(St)*.8/2,Tt=parseFloat(Et)*.8/2,$t=reactExports.useCallback(()=>{it.current||(ut(!0),rt.current&&dt({x:rt.current*It}),ot.current&&dt({y:ot.current*-Tt}),it.current=window.setInterval(()=>{nt(Bt=>{const Pt=vt*rt.current*at.current,kt=wt*xt*ot.current*at.current;return Array.isArray(Bt)?{[gt]:Bt[0]+Pt,[bt]:Bt[1]+kt}:{[gt]:Bt[gt]+Pt,[bt]:Bt[bt]+kt}})},16))},[It,Tt,nt,dt,vt,xt,gt,bt,wt]),Ut=reactExports.useCallback(()=>{window.clearTimeout(it.current),it.current=void 0,ut(!1)},[]);reactExports.useEffect(()=>{function Bt(Pt){at.current=multiplyStep(Pt)}return window.addEventListener("keydown",Bt),window.addEventListener("keyup",Bt),()=>{window.clearTimeout(it.current),window.removeEventListener("keydown",Bt),window.removeEventListener("keyup",Bt)}},[]);const Lt=useDrag$1(({first:Bt,active:Pt,delta:[kt,At],movement:[Rt,Wt]})=>{Bt&<(!0);const jt=clamp$7(Rt,-It,It),Ot=clamp$7(Wt,-Tt,Tt);rt.current=Math.abs(Rt)>Math.abs(jt)?Math.sign(Rt-jt):0,ot.current=Math.abs(Wt)>Math.abs(Ot)?Math.sign(Ot-Wt):0;let Ct=tt[gt],Dt=tt[bt];Pt?(rt.current||(Ct+=kt*vt*at.current,dt({x:jt})),ot.current||(Dt-=wt*At*xt*at.current,dt({y:Ot})),rt.current||ot.current?$t():Ut(),nt({[gt]:Ct,[bt]:Dt})):(lt(!1),rt.current=0,ot.current=0,dt({x:0,y:0}),Ut())});return React$1.createElement(JoystickTrigger,_extends$t({ref:pt},Lt()),st&&React$1.createElement(Portal$1,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:it}=useInputContext();return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Container$1,{withJoystick:!!it.joystick},it.joystick&&React$1.createElement(Joystick,{value:et,settings:it,onUpdate:nt}),React$1.createElement(Vector,{value:et,settings:it,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:it,settings:rt}=plugin.normalize(nt);return{value:it,settings:_objectSpread2$1(_objectSpread2$1({},rt),{},{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:it}=useInputContext(),{popinRef:rt,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:it});return React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(ImageContainer,null,React$1.createElement(ImagePreview,{ref:rt,hasImage:!!et,onPointerDown:()=>!!et&&st(),onPointerUp:lt,style:{backgroundImage:et?`url(${et})`:"none"}}),at&&!!et&&React$1.createElement(Portal$1,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$1=_objectSpread2$1({component:ImageComponent},props$1);const number$6=v8n().number(),schema=(tt,et)=>v8n().array().length(2).every.number().test(tt)&&v8n().schema({min:number$6,max:number$6}).test(et),format$2=tt=>({min:tt[0],max:tt[1]}),sanitize=(tt,{bounds:[et,nt]},it)=>{const rt=Array.isArray(tt)?format$2(tt):tt,ot={min:it[0],max:it[1]},{min:at,max:st}=_objectSpread2$1(_objectSpread2$1({},ot),rt);return[clamp$7(Number(at),et,Math.max(et,st)),clamp$7(Number(st),Math.min(nt,at),nt)]},normalize$5=({value:tt,min:et,max:nt})=>{const it={min:et,max:nt},rt=normalizeKeyedNumberSettings(format$2(tt),{min:it,max:it}),ot=[et,nt],at=_objectSpread2$1(_objectSpread2$1({},rt),{},{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$5});const _excluded$6$1=["value","bounds","onDrag"],_excluded2$1$1=["bounds"],Container$2=styled$5("div",{display:"grid",columnGap:"$colGap",gridTemplateColumns:"auto calc($sizes$numberInputMinWidth * 2 + $space$rowGap)"});function IntervalSlider(tt){let{value:et,bounds:[nt,it],onDrag:rt}=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:[bt],movement:[yt],memo:wt={}})=>{if(gt){const{width:xt,left:St}=at.current.getBoundingClientRect();ct.current=xt-parseFloat(ut);const Et=(mt==null?void 0:mt.target)===st.current||(mt==null?void 0:mt.target)===lt.current;wt.pos=invertedRange((bt-St)/xt,nt,it);const It=Math.abs(wt.pos-et.min)-Math.abs(wt.pos-et.max);wt.key=It<0||It===0&&wt.pos<=et.min?"min":"max",Et&&(wt.pos=et[wt.key])}const vt=wt.pos+invertedRange(yt/ct.current,0,it-nt);return rt({[wt.key]:sanitizeStep(vt,ot[wt.key])}),wt}),dt=`calc(${range$9(et.min,nt,it)} * (100% - ${ut} - 8px) + 4px)`,pt=`calc(${1-range$9(et.max,nt,it)} * (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:it}=useInputContext(),rt=_objectWithoutProperties$l(it,_excluded2$1$1);return React$1.createElement(React$1.Fragment,null,React$1.createElement(Row,{input:!0},React$1.createElement(Label$2,null,tt),React$1.createElement(Container$2,null,React$1.createElement(IntervalSlider,_extends$t({value:et},it,{onDrag:nt})),React$1.createElement(Vector,{value:et,settings:rt,onUpdate:nt,innerLabelTrim:0}))))}var interval$1=_objectSpread2$1({component:IntervalComponent},props$3);const createEventEmitter=()=>{const tt=new Map;return{on:(et,nt)=>{let it=tt.get(et);it===void 0&&(it=new Set,tt.set(et,it)),it.add(nt)},off:(et,nt)=>{const it=tt.get(et);it!==void 0&&(it.delete(nt),it.size===0&&tt.delete(et))},emit:(et,...nt)=>{const it=tt.get(et);if(it!==void 0)for(const rt of it)rt(...nt)}}},_excluded$5$1=["type","value"],_excluded2$a=["onChange","transient","onEditStart","onEditEnd"],Store=function(){const et=create$8(subscribeWithSelector(()=>({data:{}}))),nt=createEventEmitter();this.storeId=getUid(),this.useStore=et;const it={},rt=new Set;this.getVisiblePaths=()=>{const at=this.getData(),st=Object.keys(at),lt=[];Object.entries(it).forEach(([ut,ht])=>{ht.render&&st.some(dt=>dt.indexOf(ut)===0)&&!ht.render(this.get)&<.push(ut+".")});const ct=[];return rt.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=>rt.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=>it[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$1(st,ut);if(ht.type===SpecialInputs.FOLDER){const pt=ot(ht.schema,dt,lt);Object.assign(ct,pt),dt in it||(it[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:bt}=pt,{onChange:yt,transient:wt,onEditStart:vt,onEditEnd:xt}=gt,St=_objectWithoutProperties$l(gt,_excluded2$a);ct[dt]=_objectSpread2$1(_objectSpread2$1(_objectSpread2$1({type:mt},St),bt),{},{fromPanel:!0}),lt[ut]={path:dt,onChange:yt,transient:wt,onEditStart:vt,onEditEnd:xt}}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={},it=et?et.toLowerCase():null;return tt.forEach(rt=>{const[ot,at]=getKeyPath(rt);(!it||ot.toLowerCase().indexOf(it)>-1)&&merge$3(nt,at,{[ot]:{__levaInput:!0,path:rt}})}),nt},_excluded$4$1=["type","label","path","valueKey","value","settings","setValue","disabled"];function ControlInput(tt){let{type:et,label:nt,path:it,valueKey:rt,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:rt,path:it,id:""+it,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,it),null)}const StyledButton$8=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 it=useStoreContext();return React$1.createElement(Row,null,React$1.createElement(StyledButton$8,{disabled:et.disabled,onClick:()=>tt(it.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,it=et;return typeof et.opts=="object"&&(it.label!==void 0&&(nt=et.label),it=et.opts),{label:nt,opts:it}};function ButtonGroup(tt){const{label:et,opts:nt}=getOpts(tt),it=useStoreContext();return React$1.createElement(Row,{input:!!et},et&&React$1.createElement(Label$2,null,et),React$1.createElement(StyledButtonGroup,null,Object.entries(nt).map(([rt,ot])=>React$1.createElement(StyledButtonGroupButton,{key:rt,onClick:()=>ot(it.get)},rt))))}const Canvas$1=styled$5("canvas",{height:"$monitorHeight",width:"100%",display:"block",borderRadius:"$sm"}),POINTS=100;function push$1(tt,et){tt.push(et),tt.length>POINTS&&tt.shift()}const MonitorCanvas=reactExports.forwardRef(function({initialValue:tt},et){const nt=useTh("colors","highlight3"),it=useTh("colors","elevation2"),rt=useTh("colors","highlight1"),[ot,at]=reactExports.useMemo(()=>[w$6(rt).alpha(.4).toRgbString(),w$6(rt).alpha(.1).toRgbString()],[rt]),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:bt,height:yt}=mt,wt=new Path2D,vt=bt/POINTS,xt=yt*.05;for(let It=0;It({frame:mt=>{(lt.current===void 0||mtct.current)&&(ct.current=mt),push$1(st.current,mt),ut.current=requestAnimationFrame(()=>ht(dt.current,pt.current))}}),[dt,pt,ht]),reactExports.useEffect(()=>()=>cancelAnimationFrame(ut.current),[]),React$1.createElement(Canvas$1,{ref:dt})}),parse$4=tt=>Number.isFinite(tt)?tt.toPrecision(2):tt.toString(),MonitorLog=reactExports.forwardRef(function({initialValue:tt},et){const[nt,it]=reactExports.useState(parse$4(tt));return reactExports.useImperativeHandle(et,()=>({frame:rt=>it(parse$4(rt))}),[]),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 it=reactExports.useRef(),rt=reactExports.useRef(getValue$4(et));return reactExports.useEffect(()=>{const ot=window.setInterval(()=>{var at;document.hidden||(at=it.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$2,{align:"top"},tt),nt.graph?React$1.createElement(MonitorCanvas,{ref:it,initialValue:rt.current}):React$1.createElement(MonitorLog,{ref:it,initialValue:rt.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:it,disable:rt,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:it,disable:rt,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 it=useStoreContext(),rt=join$1(et,tt),{collapsed:ot,color:at}=it.getFolderSettings(rt),[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:rt,tree:nt,toggled:st}))},TreeWrapper=React$1.memo(({isRoot:tt=!1,fill:et=!1,flat:nt=!1,parent:it,tree:rt,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$1(it,ht)).order)||0},ut=Object.entries(rt).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:it,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[it,rt]=reactExports.useState(""),ot=reactExports.useMemo(()=>debounce$5(tt,250),[tt]),at=()=>{tt(""),rt("")},st=lt=>{const ct=lt.currentTarget.value;et(!0),rt(ct)};return reactExports.useEffect(()=>{ot(it)},[it,ot]),React$1.createElement(React$1.Fragment,null,React$1.createElement(StyledFilterInput,{ref:nt,value:it,placeholder:"[Open filter with CMD+SHIFT+L]",onPointerDown:lt=>lt.stopPropagation(),onChange:st}),React$1.createElement(Icon,{onClick:()=>at(),style:{visibility:it?"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:it,toggle:rt,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:bt,last:yt})=>{et({x:mt,y:gt}),bt&&nt({x:mt,y:gt}),yt&&it({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(bt=>!bt)};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:()=>rt()},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:rt})))}const _excluded$2$1=["store","hidden","theme","collapsed"];function LevaRoot(tt){let{store:et,hidden:nt=!1,theme:it,collapsed:rt=!1}=tt,ot=_objectWithoutProperties$l(tt,_excluded$2$1);const at=useDeepMemo(()=>mergeTheme(it),[it]),[st,lt]=reactExports.useState(!rt),ct=typeof rt=="object"?!rt.collapsed:st,ut=reactExports.useMemo(()=>typeof rt=="object"?ht=>{typeof ht=="function"?rt.onChange(!ht(!rt.collapsed)):rt.onChange(!ht)}:lt,[rt]);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:it=!1,neverHide:rt=!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]),[bt,yt]=useTransform(),wt=rt||dt.length>0,vt=typeof at=="object"&&at.title||void 0,xt=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,Et=typeof at=="object"&&at.position||void 0,It=typeof at=="object"&&at.onDrag||void 0,Tt=typeof at=="object"&&at.onDragStart||void 0,$t=typeof at=="object"&&at.onDragEnd||void 0;return React$1.useEffect(()=>{yt({x:Et==null?void 0:Et.x,y:Et==null?void 0:Et.y})},[Et,yt]),globalStyles(),React$1.createElement(PanelSettingsContext.Provider,{value:{hideCopyButton:st}},React$1.createElement(StyledRoot,{ref:bt,className:et,fill:nt,flat:it,oneLineLabels:ot,hideTitleBar:!at,style:{display:wt?"block":"none"}},at&&React$1.createElement(TitleWithFilter,{onDrag:Ut=>{yt(Ut),It==null||It(Ut)},onDragStart:Ut=>Tt==null?void 0:Tt(Ut),onDragEnd:Ut=>$t==null?void 0:$t(Ut),setFilter:mt,toggle:Ut=>ct(Lt=>Ut??!Lt),toggled:lt,title:vt,drag:xt,filterEnabled:St,from:Et}),wt&&React$1.createElement(StoreContext$1.Provider,{value:tt},React$1.createElement(TreeWrapper,{isRoot:!0,fill:nt,flat:it,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,it,rt){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=it):(st=nt,Array.isArray(it)?ct=it:(lt=it,ct=rt)))):(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,it,rt){const{folderName:ot,schema:at,folderSettings:st,hookSettings:lt,deps:ct}=parseArgs(tt,et,nt,it,rt),ut=typeof at=="function",ht=reactExports.useRef(!1),dt=reactExports.useRef(!0),pt=useDeepMemo(()=>{ht.current=!0;const Lt=typeof at=="function"?at():at;return ot?{[ot]:folder(Lt,st)}:Lt},ct),mt=!(lt!=null&<.store);useRenderRoot(mt);const[gt]=reactExports.useState(()=>(lt==null?void 0:lt.store)||levaStore),[bt,yt]=reactExports.useMemo(()=>gt.getDataFromSchema(pt),[gt,pt]),[wt,vt,xt,St,Et]=reactExports.useMemo(()=>{const Lt=[],Bt=[],Pt={},kt={},At={};return Object.values(yt).forEach(({path:Rt,onChange:Wt,onEditStart:jt,onEditEnd:Ot,transient:Ct})=>{Lt.push(Rt),Wt?(Pt[Rt]=Wt,Ct||Bt.push(Rt)):Bt.push(Rt),jt&&(kt[Rt]=jt),Ot&&(At[Rt]=Ot)}),[Lt,Bt,Pt,kt,At]},[yt]),It=reactExports.useMemo(()=>gt.orderPaths(wt),[wt,gt]),Tt=useValuesForPath(gt,vt,bt),$t=reactExports.useCallback(Lt=>{const Bt=Object.entries(Lt).reduce((Pt,[kt,At])=>Object.assign(Pt,{[yt[kt].path]:At}),{});gt.set(Bt,!1)},[gt,yt]),Ut=reactExports.useCallback(Lt=>gt.get(yt[Lt].path),[gt,yt]);return reactExports.useEffect(()=>{const Lt=!dt.current&&ht.current;return gt.addData(bt,Lt),dt.current=!1,ht.current=!1,()=>gt.disposePaths(It)},[gt,It,bt]),reactExports.useEffect(()=>{const Lt=[];return Object.entries(xt).forEach(([Bt,Pt])=>{Pt(gt.get(Bt),Bt,_objectSpread2$1({initial:!0,get:gt.get},gt.getInput(Bt)));const kt=gt.useStore.subscribe(At=>{const Rt=At.data[Bt];return[Rt.disabled?void 0:Rt.value,Rt]},([At,Rt])=>Pt(At,Bt,_objectSpread2$1({initial:!1,get:gt.get},Rt)),{equalityFn:shallow$2});Lt.push(kt)}),()=>Lt.forEach(Bt=>Bt())},[gt,xt]),reactExports.useEffect(()=>{const Lt=[];return Object.entries(St).forEach(([Bt,Pt])=>Lt.push(gt.subscribeToEditStart(Bt,Pt))),Object.entries(Et).forEach(([Bt,Pt])=>Lt.push(gt.subscribeToEditEnd(Bt,Pt))),()=>Lt.forEach(Bt=>Bt())},[St,Et,gt]),ut?[Tt,$t,Ut]:Tt}register(LevaInputs.SELECT,select$1);register(LevaInputs.IMAGE,image$1);register(LevaInputs.NUMBER,number$7);register(LevaInputs.COLOR,color$4);register(LevaInputs.STRING,string$3);register(LevaInputs.BOOLEAN,boolean$1);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$k=tt=>!isNullOrUndefined(tt)&&!Array.isArray(tt)&&isObjectType(tt)&&!isDateObject(tt),getEventValue=tt=>isObject$k(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$5=tt=>{const et=tt.constructor&&tt.constructor.prototype;return isObject$k(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$k(tt)))if(et=nt?[]:{},!nt&&!isPlainObject$5(tt))et=tt;else for(const it in tt)tt.hasOwnProperty(it)&&(et[it]=cloneObject(tt[it]));else return tt;return et}var compact=tt=>Array.isArray(tt)?tt.filter(Boolean):[],isUndefined$1=tt=>tt===void 0,get$6=(tt,et,nt)=>{if(!et||!isObject$k(tt))return nt;const it=compact(et.split(/[,[\].]+?/)).reduce((rt,ot)=>isNullOrUndefined(rt)?rt:rt[ot],tt);return isUndefined$1(it)||it===tt?isUndefined$1(tt[et])?nt:tt[et]:it},isBoolean$3=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,it=!0)=>{const rt={defaultValues:et._defaultValues};for(const ot in tt)Object.defineProperty(rt,ot,{get:()=>{const at=ot;return et._proxyFormState[at]!==VALIDATION_MODE.all&&(et._proxyFormState[at]=!it||VALIDATION_MODE.all),nt&&(nt[at]=!0),tt[at]}});return rt},isEmptyObject=tt=>isObject$k(tt)&&!Object.keys(tt).length,shouldRenderFormState=(tt,et,nt,it)=>{nt(tt);const{name:rt,...ot}=tt;return isEmptyObject(ot)||Object.keys(ot).length>=Object.keys(et).length||Object.keys(ot).find(at=>et[at]===(!it||VALIDATION_MODE.all))},convertToArrayPayload=tt=>Array.isArray(tt)?tt:[tt],shouldSubscribeByName=(tt,et,nt)=>!tt||!et||tt===et||convertToArrayPayload(tt).some(it=>it&&(nt?it===et:it.startsWith(et)||et.startsWith(it)));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:it,name:rt,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(rt);return ut.current=rt,useSubscribe({disabled:it,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$4=tt=>typeof tt=="string",generateWatchOutput=(tt,et,nt,it,rt)=>isString$4(tt)?(it&&et.watch.add(tt),get$6(nt,tt,rt)):Array.isArray(tt)?tt.map(ot=>(it&&et.watch.add(ot),get$6(nt,ot))):(it&&(et.watchAll=!0),nt);function useWatch(tt){const et=useFormContext(),{control:nt=et.control,name:it,defaultValue:rt,disabled:ot,exact:at}=tt||{},st=React$1.useRef(it);st.current=it,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,rt)))}});const[lt,ct]=React$1.useState(nt._getWatch(it,rt));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 it=-1;const rt=isKey$4(et)?[et]:stringToPath$3(et),ot=rt.length,at=ot-1;for(;++it{const ut=rt._options.shouldUnregister||ot,ht=(dt,pt)=>{const mt=get$6(rt._fields,dt);mt&&(mt._f.mount=pt)};if(ht(nt,!0),ut){const dt=cloneObject(get$6(rt._options.defaultValues,nt));set$3(rt._defaultValues,nt,dt),isUndefined$1(get$6(rt._formValues,nt))&&set$3(rt._formValues,nt,dt)}return()=>{(at?ut&&!rt._state.action:ut)?rt.unregister(nt):ht(nt,!1)}},[nt,rt,at,ot]),React$1.useEffect(()=>{get$6(rt._fields,nt)&&rt._updateDisabledField({disabled:it,fields:rt._fields,name:nt,value:get$6(rt._fields,nt)._f.value})},[it,nt,rt]),{field:{name:nt,value:st,...isBoolean$3(it)||isBoolean$3(lt.disabled)?{disabled:lt.disabled||it}:{},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$6(rt._formValues,nt),name:nt},type:EVENTS.BLUR}),[nt,rt]),ref:ut=>{const ht=get$6(rt._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$6(lt.errors,nt)},isDirty:{enumerable:!0,get:()=>!!get$6(lt.dirtyFields,nt)},isTouched:{enumerable:!0,get:()=>!!get$6(lt.touchedFields,nt)},error:{enumerable:!0,get:()=>get$6(lt.errors,nt)}})}}const Controller=tt=>tt.render(useController(tt));var appendErrors=(tt,et,nt,it,rt)=>et?{...nt[tt],types:{...nt[tt]&&nt[tt].types?nt[tt].types:{},[it]:rt||!0}}:{},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(it=>tt.startsWith(it)&&/^\.\w+/.test(tt.slice(it.length))));const iterateFieldsByAction=(tt,et,nt,it)=>{for(const rt of nt||Object.keys(tt)){const ot=get$6(tt,rt);if(ot){const{_f:at,...st}=ot;if(at){if(at.refs&&at.refs[0]&&et(at.refs[0],rt)&&!it)break;if(at.ref&&et(at.ref,at.name)&&!it)break}else isObject$k(st)&&iterateFieldsByAction(st,et)}}};var updateFieldArrayRootError=(tt,et,nt)=>{const it=compact(get$6(tt,nt));return set$3(it,"root",et[nt]),set$3(tt,nt,it),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$4(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$3(tt)&&!tt)return{type:nt,message:isMessage(tt)?tt:"",ref:et}}var getValueAndMessage=tt=>isObject$k(tt)&&!isRegex(tt)?tt:{value:tt,message:""},validateField=async(tt,et,nt,it,rt)=>{const{ref:ot,refs:at,required:st,maxLength:lt,minLength:ct,min:ut,max:ht,pattern:dt,validate:pt,name:mt,valueAsNumber:gt,mount:bt,disabled:yt}=tt._f,wt=get$6(et,mt);if(!bt||yt)return{};const vt=at?at[0]:ot,xt=Bt=>{it&&vt.reportValidity&&(vt.setCustomValidity(isBoolean$3(Bt)?"":Bt||""),vt.reportValidity())},St={},Et=isRadioInput(ot),It=isCheckBoxInput(ot),Tt=Et||It,$t=(gt||isFileInput(ot))&&isUndefined$1(ot.value)&&isUndefined$1(wt)||isHTMLElement$2(ot)&&ot.value===""||wt===""||Array.isArray(wt)&&!wt.length,Ut=appendErrors.bind(null,mt,nt,St),Lt=(Bt,Pt,kt,At=INPUT_VALIDATION_RULES.maxLength,Rt=INPUT_VALIDATION_RULES.minLength)=>{const Wt=Bt?Pt:kt;St[mt]={type:Bt?At:Rt,message:Wt,ref:ot,...Ut(Bt?At:Rt,Wt)}};if(rt?!Array.isArray(wt)||!wt.length:st&&(!Tt&&($t||isNullOrUndefined(wt))||isBoolean$3(wt)&&!wt||It&&!getCheckboxValue(at).isValid||Et&&!getRadioValue(at).isValid)){const{value:Bt,message:Pt}=isMessage(st)?{value:!!st,message:st}:getValueAndMessage(st);if(Bt&&(St[mt]={type:INPUT_VALIDATION_RULES.required,message:Pt,ref:vt,...Ut(INPUT_VALIDATION_RULES.required,Pt)},!nt))return xt(Pt),St}if(!$t&&(!isNullOrUndefined(ut)||!isNullOrUndefined(ht))){let Bt,Pt;const kt=getValueAndMessage(ht),At=getValueAndMessage(ut);if(!isNullOrUndefined(wt)&&!isNaN(wt)){const Rt=ot.valueAsNumber||wt&&+wt;isNullOrUndefined(kt.value)||(Bt=Rt>kt.value),isNullOrUndefined(At.value)||(Pt=Rtnew Date(new Date().toDateString()+" "+Ct),jt=ot.type=="time",Ot=ot.type=="week";isString$4(kt.value)&&wt&&(Bt=jt?Wt(wt)>Wt(kt.value):Ot?wt>kt.value:Rt>new Date(kt.value)),isString$4(At.value)&&wt&&(Pt=jt?Wt(wt)+Bt.value,At=!isNullOrUndefined(Pt.value)&&wt.length<+Pt.value;if((kt||At)&&(Lt(kt,Bt.message,Pt.message),!nt))return xt(St[mt].message),St}if(dt&&!$t&&isString$4(wt)){const{value:Bt,message:Pt}=getValueAndMessage(dt);if(isRegex(Bt)&&!wt.match(Bt)&&(St[mt]={type:INPUT_VALIDATION_RULES.pattern,message:Pt,ref:ot,...Ut(INPUT_VALIDATION_RULES.pattern,Pt)},!nt))return xt(Pt),St}if(pt){if(isFunction$6(pt)){const Bt=await pt(wt,et),Pt=getValidateError(Bt,vt);if(Pt&&(St[mt]={...Pt,...Ut(INPUT_VALIDATION_RULES.validate,Pt.message)},!nt))return xt(Pt.message),St}else if(isObject$k(pt)){let Bt={};for(const Pt in pt){if(!isEmptyObject(Bt)&&!nt)break;const kt=getValidateError(await pt[Pt](wt,et),vt,Pt);kt&&(Bt={...kt,...Ut(Pt,kt.message)},xt(kt.message),nt&&(St[mt]=Bt))}if(!isEmptyObject(Bt)&&(St[mt]={ref:vt,...Bt},!nt))return St}}return xt(!0),St};function baseGet$4(tt,et){const nt=et.slice(0,-1).length;let it=0;for(;it{for(const ot of tt)ot.next&&ot.next(rt)},subscribe:rt=>(tt.push(rt),{unsubscribe:()=>{tt=tt.filter(ot=>ot!==rt)}}),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),it=Object.keys(et);if(nt.length!==it.length)return!1;for(const rt of nt){const ot=tt[rt];if(!it.includes(rt))return!1;if(rt!=="ref"){const at=et[rt];if(isDateObject(ot)&&isDateObject(at)||isObject$k(ot)&&isObject$k(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$k(tt)||nt)for(const it in tt)Array.isArray(tt[it])||isObject$k(tt[it])&&!objectHasFunction(tt[it])?(et[it]=Array.isArray(tt[it])?[]:{},markFieldsDirty(tt[it],et[it])):isNullOrUndefined(tt[it])||(et[it]=!0);return et}function getDirtyFieldsFromDefaultValues(tt,et,nt){const it=Array.isArray(tt);if(isObject$k(tt)||it)for(const rt in tt)Array.isArray(tt[rt])||isObject$k(tt[rt])&&!objectHasFunction(tt[rt])?isUndefined$1(et)||isPrimitive(nt[rt])?nt[rt]=Array.isArray(tt[rt])?markFieldsDirty(tt[rt],[]):{...markFieldsDirty(tt[rt])}:getDirtyFieldsFromDefaultValues(tt[rt],isNullOrUndefined(et)?{}:et[rt],nt[rt]):nt[rt]=!deepEqual$2(tt[rt],et[rt]);return nt}var getDirtyFields=(tt,et)=>getDirtyFieldsFromDefaultValues(tt,et,markFieldsDirty(et)),getFieldValueAs=(tt,{valueAsNumber:et,valueAsDate:nt,setValueAs:it})=>isUndefined$1(tt)?tt:et?tt===""?NaN:tt&&+tt:nt&&isString$4(tt)?new Date(tt):it?it(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,it)=>{const rt={};for(const ot of tt){const at=get$6(et,ot);at&&set$3(rt,ot,at._f)}return{criteriaMode:nt,names:[...tt],fields:rt,shouldUseNativeValidation:it}},getRuleValue=tt=>isUndefined$1(tt)?tt:isRegex(tt)?tt.source:isObject$k(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 it=get$6(tt,nt);if(it||isKey$4(nt))return{error:it,name:nt};const rt=nt.split(".");for(;rt.length;){const ot=rt.join("."),at=get$6(et,ot),st=get$6(tt,ot);if(at&&!Array.isArray(at)&&nt!==ot)return{name:nt};if(st&&st.type)return{name:ot,error:st};rt.pop()}return{name:nt}}var skipValidation=(tt,et,nt,it,rt)=>rt.isOnAll?!1:!nt&&rt.isOnTouch?!(et||tt):(nt?it.isOnBlur:rt.isOnBlur)?!tt:(nt?it.isOnChange:rt.isOnChange)?tt:!0,unsetEmptyArray=(tt,et)=>!compact(get$6(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},it={submitCount:0,isDirty:!1,isLoading:isFunction$6(nt.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{},disabled:!1},rt={},ot=isObject$k(nt.defaultValues)||isObject$k(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),bt=nt.criteriaMode===VALIDATION_MODE.all,yt=un=>En=>{clearTimeout(ut),ut=setTimeout(un,En)},wt=async un=>{if(ht.isValid||un){const En=nt.resolver?isEmptyObject((await $t()).errors):await Lt(rt,!0);En!==it.isValid&&dt.state.next({isValid:En})}},vt=un=>ht.isValidating&&dt.state.next({isValidating:un}),xt=(un,En=[],In,xn,dn=!0,cn=!0)=>{if(xn&&In){if(st.action=!0,cn&&Array.isArray(get$6(rt,un))){const hn=In(get$6(rt,un),xn.argA,xn.argB);dn&&set$3(rt,un,hn)}if(cn&&Array.isArray(get$6(it.errors,un))){const hn=In(get$6(it.errors,un),xn.argA,xn.argB);dn&&set$3(it.errors,un,hn),unsetEmptyArray(it.errors,un)}if(ht.touchedFields&&cn&&Array.isArray(get$6(it.touchedFields,un))){const hn=In(get$6(it.touchedFields,un),xn.argA,xn.argB);dn&&set$3(it.touchedFields,un,hn)}ht.dirtyFields&&(it.dirtyFields=getDirtyFields(ot,at)),dt.state.next({name:un,isDirty:Pt(un,En),dirtyFields:it.dirtyFields,errors:it.errors,isValid:it.isValid})}else set$3(at,un,En)},St=(un,En)=>{set$3(it.errors,un,En),dt.state.next({errors:it.errors})},Et=(un,En,In,xn)=>{const dn=get$6(rt,un);if(dn){const cn=get$6(at,un,isUndefined$1(In)?get$6(ot,un):In);isUndefined$1(cn)||xn&&xn.defaultChecked||En?set$3(at,un,En?cn:getFieldValue(dn._f)):Rt(un,cn),st.mount&&wt()}},It=(un,En,In,xn,dn)=>{let cn=!1,hn=!1;const $n={name:un};if(!In||xn){ht.isDirty&&(hn=it.isDirty,it.isDirty=$n.isDirty=Pt(),cn=hn!==$n.isDirty);const nn=deepEqual$2(get$6(ot,un),En);hn=get$6(it.dirtyFields,un),nn?unset(it.dirtyFields,un):set$3(it.dirtyFields,un,!0),$n.dirtyFields=it.dirtyFields,cn=cn||ht.dirtyFields&&hn!==!nn}if(In){const nn=get$6(it.touchedFields,un);nn||(set$3(it.touchedFields,un,In),$n.touchedFields=it.touchedFields,cn=cn||ht.touchedFields&&nn!==In)}return cn&&dn&&dt.state.next($n),cn?$n:{}},Tt=(un,En,In,xn)=>{const dn=get$6(it.errors,un),cn=ht.isValid&&isBoolean$3(En)&&it.isValid!==En;if(tt.delayError&&In?(ct=yt(()=>St(un,In)),ct(tt.delayError)):(clearTimeout(ut),ct=null,In?set$3(it.errors,un,In):unset(it.errors,un)),(In?!deepEqual$2(dn,In):dn)||!isEmptyObject(xn)||cn){const hn={...xn,...cn&&isBoolean$3(En)?{isValid:En}:{},errors:it.errors,name:un};it={...it,...hn},dt.state.next(hn)}vt(!1)},$t=async un=>nt.resolver(at,nt.context,getResolverOptions(un||lt.mount,rt,nt.criteriaMode,nt.shouldUseNativeValidation)),Ut=async un=>{const{errors:En}=await $t(un);if(un)for(const In of un){const xn=get$6(En,In);xn?set$3(it.errors,In,xn):unset(it.errors,In)}else it.errors=En;return En},Lt=async(un,En,In={valid:!0})=>{for(const xn in un){const dn=un[xn];if(dn){const{_f:cn,...hn}=dn;if(cn){const $n=lt.array.has(cn.name),nn=await validateField(dn,at,bt,nt.shouldUseNativeValidation&&!En,$n);if(nn[cn.name]&&(In.valid=!1,En))break;!En&&(get$6(nn,cn.name)?$n?updateFieldArrayRootError(it.errors,nn,cn.name):set$3(it.errors,cn.name,nn[cn.name]):unset(it.errors,cn.name))}hn&&await Lt(hn,En,In)}}return In.valid},Bt=()=>{for(const un of lt.unMount){const En=get$6(rt,un);En&&(En._f.refs?En._f.refs.every(In=>!live(In)):!live(En._f.ref))&&an(un)}lt.unMount=new Set},Pt=(un,En)=>(un&&En&&set$3(at,un,En),!deepEqual$2(Mt(),ot)),kt=(un,En,In)=>generateWatchOutput(un,lt,{...st.mount?at:isUndefined$1(En)?ot:isString$4(un)?{[un]:En}:En},In,En),At=un=>compact(get$6(st.mount?at:ot,un,tt.shouldUnregister?get$6(ot,un,[]):[])),Rt=(un,En,In={})=>{const xn=get$6(rt,un);let dn=En;if(xn){const cn=xn._f;cn&&(!cn.disabled&&set$3(at,un,getFieldValueAs(En,cn)),dn=isHTMLElement$2(cn.ref)&&isNullOrUndefined(En)?"":En,isMultipleSelect(cn.ref)?[...cn.ref.options].forEach(hn=>hn.selected=dn.includes(hn.value)):cn.refs?isCheckBoxInput(cn.ref)?cn.refs.length>1?cn.refs.forEach(hn=>(!hn.defaultChecked||!hn.disabled)&&(hn.checked=Array.isArray(dn)?!!dn.find($n=>$n===hn.value):dn===hn.value)):cn.refs[0]&&(cn.refs[0].checked=!!dn):cn.refs.forEach(hn=>hn.checked=hn.value===dn):isFileInput(cn.ref)?cn.ref.value="":(cn.ref.value=dn,cn.ref.type||dt.values.next({name:un,values:{...at}})))}(In.shouldDirty||In.shouldTouch)&&It(un,dn,In.shouldTouch,In.shouldDirty,!0),In.shouldValidate&&Dt(un)},Wt=(un,En,In)=>{for(const xn in En){const dn=En[xn],cn=`${un}.${xn}`,hn=get$6(rt,cn);(lt.array.has(un)||!isPrimitive(dn)||hn&&!hn._f)&&!isDateObject(dn)?Wt(cn,dn,In):Rt(cn,dn,In)}},jt=(un,En,In={})=>{const xn=get$6(rt,un),dn=lt.array.has(un),cn=cloneObject(En);set$3(at,un,cn),dn?(dt.array.next({name:un,values:{...at}}),(ht.isDirty||ht.dirtyFields)&&In.shouldDirty&&dt.state.next({name:un,dirtyFields:getDirtyFields(ot,at),isDirty:Pt(un,cn)})):xn&&!xn._f&&!isNullOrUndefined(cn)?Wt(un,cn,In):Rt(un,cn,In),isWatched(un,lt)&&dt.state.next({...it}),dt.values.next({name:un,values:{...at}}),!st.mount&&et()},Ot=async un=>{const En=un.target;let In=En.name,xn=!0;const dn=get$6(rt,In),cn=()=>En.type?getFieldValue(dn._f):getEventValue(un),hn=$n=>{xn=Number.isNaN($n)||$n===get$6(at,In,$n)};if(dn){let $n,nn;const Kt=cn(),Yt=un.type===EVENTS.BLUR||un.type===EVENTS.FOCUS_OUT,_n=!hasValidation(dn._f)&&!nt.resolver&&!get$6(it.errors,In)&&!dn._f.deps||skipValidation(Yt,get$6(it.touchedFields,In),it.isSubmitted,gt,mt),Mn=isWatched(In,lt,Yt);set$3(at,In,Kt),Yt?(dn._f.onBlur&&dn._f.onBlur(un),ct&&ct(0)):dn._f.onChange&&dn._f.onChange(un);const Bn=It(In,Kt,Yt,!1),Nn=!isEmptyObject(Bn)||Mn;if(!Yt&&dt.values.next({name:In,type:un.type,values:{...at}}),_n)return ht.isValid&&wt(),Nn&&dt.state.next({name:In,...Mn?{}:Bn});if(!Yt&&Mn&&dt.state.next({...it}),vt(!0),nt.resolver){const{errors:qn}=await $t([In]);if(hn(Kt),xn){const Wn=schemaErrorLookup(it.errors,rt,In),Vn=schemaErrorLookup(qn,rt,Wn.name||In);$n=Vn.error,In=Vn.name,nn=isEmptyObject(qn)}}else $n=(await validateField(dn,at,bt,nt.shouldUseNativeValidation))[In],hn(Kt),xn&&($n?nn=!1:ht.isValid&&(nn=await Lt(rt,!0)));xn&&(dn._f.deps&&Dt(dn._f.deps),Tt(In,nn,$n,Bn))}},Ct=(un,En)=>{if(get$6(it.errors,En)&&un.focus)return un.focus(),1},Dt=async(un,En={})=>{let In,xn;const dn=convertToArrayPayload(un);if(vt(!0),nt.resolver){const cn=await Ut(isUndefined$1(un)?un:dn);In=isEmptyObject(cn),xn=un?!dn.some(hn=>get$6(cn,hn)):In}else un?(xn=(await Promise.all(dn.map(async cn=>{const hn=get$6(rt,cn);return await Lt(hn&&hn._f?{[cn]:hn}:hn)}))).every(Boolean),!(!xn&&!it.isValid)&&wt()):xn=In=await Lt(rt);return dt.state.next({...!isString$4(un)||ht.isValid&&In!==it.isValid?{}:{name:un},...nt.resolver||!un?{isValid:In}:{},errors:it.errors,isValidating:!1}),En.shouldFocus&&!xn&&iterateFieldsByAction(rt,Ct,un?dn:lt.mount),xn},Mt=un=>{const En={...ot,...st.mount?at:{}};return isUndefined$1(un)?En:isString$4(un)?get$6(En,un):un.map(In=>get$6(En,In))},Vt=(un,En)=>({invalid:!!get$6((En||it).errors,un),isDirty:!!get$6((En||it).dirtyFields,un),isTouched:!!get$6((En||it).touchedFields,un),error:get$6((En||it).errors,un)}),Qt=un=>{un&&convertToArrayPayload(un).forEach(En=>unset(it.errors,En)),dt.state.next({errors:un?it.errors:{}})},rn=(un,En,In)=>{const xn=(get$6(rt,un,{_f:{}})._f||{}).ref;set$3(it.errors,un,{...En,ref:xn}),dt.state.next({name:un,errors:it.errors,isValid:!1}),In&&In.shouldFocus&&xn&&xn.focus&&xn.focus()},Xt=(un,En)=>isFunction$6(un)?dt.values.subscribe({next:In=>un(kt(void 0,En),In)}):kt(un,En,!0),an=(un,En={})=>{for(const In of un?convertToArrayPayload(un):lt.mount)lt.mount.delete(In),lt.array.delete(In),En.keepValue||(unset(rt,In),unset(at,In)),!En.keepError&&unset(it.errors,In),!En.keepDirty&&unset(it.dirtyFields,In),!En.keepTouched&&unset(it.touchedFields,In),!nt.shouldUnregister&&!En.keepDefaultValue&&unset(ot,In);dt.values.next({values:{...at}}),dt.state.next({...it,...En.keepDirty?{isDirty:Pt()}:{}}),!En.keepIsValid&&wt()},tn=({disabled:un,name:En,field:In,fields:xn,value:dn})=>{if(isBoolean$3(un)){const cn=un?void 0:isUndefined$1(dn)?getFieldValue(In?In._f:get$6(xn,En)._f):dn;set$3(at,En,cn),It(En,cn,!1,!1,!0)}},pn=(un,En={})=>{let In=get$6(rt,un);const xn=isBoolean$3(En.disabled);return set$3(rt,un,{...In||{},_f:{...In&&In._f?In._f:{ref:{name:un}},name:un,mount:!0,...En}}),lt.mount.add(un),In?tn({field:In,disabled:En.disabled,name:un}):Et(un,!0,En.value),{...xn?{disabled:En.disabled}:{},...nt.progressive?{required:!!En.required,min:getRuleValue(En.min),max:getRuleValue(En.max),minLength:getRuleValue(En.minLength),maxLength:getRuleValue(En.maxLength),pattern:getRuleValue(En.pattern)}:{},name:un,onChange:Ot,onBlur:Ot,ref:dn=>{if(dn){pn(un,En),In=get$6(rt,un);const cn=isUndefined$1(dn.value)&&dn.querySelectorAll&&dn.querySelectorAll("input,select,textarea")[0]||dn,hn=isRadioOrCheckbox(cn),$n=In._f.refs||[];if(hn?$n.find(nn=>nn===cn):cn===In._f.ref)return;set$3(rt,un,{_f:{...In._f,...hn?{refs:[...$n.filter(live),cn,...Array.isArray(get$6(ot,un))?[{}]:[]],ref:{type:cn.type,name:un}}:{ref:cn}}}),Et(un,!1,void 0,cn)}else In=get$6(rt,un,{}),In._f&&(In._f.mount=!1),(nt.shouldUnregister||En.shouldUnregister)&&!(isNameInFieldArray(lt.array,un)&&st.action)&<.unMount.add(un)}}},vn=()=>nt.shouldFocusError&&iterateFieldsByAction(rt,Ct,lt.mount),sn=un=>{isBoolean$3(un)&&(dt.state.next({disabled:un}),iterateFieldsByAction(rt,En=>{En.disabled=un},0,!1))},Zt=(un,En)=>async In=>{In&&(In.preventDefault&&In.preventDefault(),In.persist&&In.persist());let xn=cloneObject(at);if(dt.state.next({isSubmitting:!0}),nt.resolver){const{errors:dn,values:cn}=await $t();it.errors=dn,xn=cn}else await Lt(rt);unset(it.errors,"root"),isEmptyObject(it.errors)?(dt.state.next({errors:{}}),await un(xn,In)):(En&&await En({...it.errors},In),vn(),setTimeout(vn)),dt.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject(it.errors),submitCount:it.submitCount+1,errors:it.errors})},Sn=(un,En={})=>{get$6(rt,un)&&(isUndefined$1(En.defaultValue)?jt(un,get$6(ot,un)):(jt(un,En.defaultValue),set$3(ot,un,En.defaultValue)),En.keepTouched||unset(it.touchedFields,un),En.keepDirty||(unset(it.dirtyFields,un),it.isDirty=En.defaultValue?Pt(un,get$6(ot,un)):Pt()),En.keepError||(unset(it.errors,un),ht.isValid&&wt()),dt.state.next({...it}))},Tn=(un,En={})=>{const In=un?cloneObject(un):ot,xn=cloneObject(In),dn=un&&!isEmptyObject(un)?xn:ot;if(En.keepDefaultValues||(ot=In),!En.keepValues){if(En.keepDirtyValues||pt)for(const cn of lt.mount)get$6(it.dirtyFields,cn)?set$3(dn,cn,get$6(at,cn)):jt(cn,get$6(dn,cn));else{if(isWeb&&isUndefined$1(un))for(const cn of lt.mount){const hn=get$6(rt,cn);if(hn&&hn._f){const $n=Array.isArray(hn._f.refs)?hn._f.refs[0]:hn._f.ref;if(isHTMLElement$2($n)){const nn=$n.closest("form");if(nn){nn.reset();break}}}}rt={}}at=tt.shouldUnregister?En.keepDefaultValues?cloneObject(ot):{}:cloneObject(dn),dt.array.next({values:{...dn}}),dt.values.next({values:{...dn}})}lt={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!st.mount&&et(),st.mount=!ht.isValid||!!En.keepIsValid,st.watch=!!tt.shouldUnregister,dt.state.next({submitCount:En.keepSubmitCount?it.submitCount:0,isDirty:En.keepDirty?it.isDirty:!!(En.keepDefaultValues&&!deepEqual$2(un,ot)),isSubmitted:En.keepIsSubmitted?it.isSubmitted:!1,dirtyFields:En.keepDirtyValues?it.dirtyFields:En.keepDefaultValues&&un?getDirtyFields(ot,un):{},touchedFields:En.keepTouched?it.touchedFields:{},errors:En.keepErrors?it.errors:{},isSubmitSuccessful:En.keepIsSubmitSuccessful?it.isSubmitSuccessful:!1,isSubmitting:!1})},Cn=(un,En)=>Tn(isFunction$6(un)?un(at):un,En);return{control:{register:pn,unregister:an,getFieldState:Vt,handleSubmit:Zt,setError:rn,_executeSchema:$t,_getWatch:kt,_getDirty:Pt,_updateValid:wt,_removeUnmounted:Bt,_updateFieldArray:xt,_updateDisabledField:tn,_getFieldArray:At,_reset:Tn,_resetDefaultValues:()=>isFunction$6(nt.defaultValues)&&nt.defaultValues().then(un=>{Cn(un,nt.resetOptions),dt.state.next({isLoading:!1})}),_updateFormState:un=>{it={...it,...un}},_disableForm:sn,_subjects:dt,_proxyFormState:ht,get _fields(){return rt},get _formValues(){return at},get _state(){return st},set _state(un){st=un},get _defaultValues(){return ot},get _names(){return lt},set _names(un){lt=un},get _formState(){return it},set _formState(un){it=un},get _options(){return nt},set _options(un){nt={...nt,...un}}},trigger:Dt,register:pn,handleSubmit:Zt,watch:Xt,setValue:jt,getValues:Mt,reset:Cn,resetField:Sn,clearErrors:Qt,unregister:an,setError:rn,setFocus:(un,En={})=>{const In=get$6(rt,un),xn=In&&In._f;if(xn){const dn=xn.refs?xn.refs[0]:xn.ref;dn.focus&&(dn.focus(),En.shouldSelect&&dn.select())}},getFieldState:Vt}}function useForm(tt={}){const et=React$1.useRef(),nt=React$1.useRef(),[it,rt]=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:{},disabled:!1,defaultValues:isFunction$6(tt.defaultValues)?void 0:tt.defaultValues});et.current||(et.current={...createFormControl(tt,()=>rt(at=>({...at}))),formState:it});const ot=et.current.control;return ot._options=tt,useSubscribe({subject:ot._subjects.state,next:at=>{shouldRenderFormState(at,ot._proxyFormState,ot._updateFormState,!0)&&rt({...ot._formState})}}),React$1.useEffect(()=>ot._disableForm(tt.disabled),[ot,tt.disabled]),React$1.useEffect(()=>{if(ot._proxyFormState.isDirty){const at=ot._getDirty();at!==it.isDirty&&ot._subjects.state.next({isDirty:at})}},[ot,it.isDirty]),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(it,ot),et.current}const ReactToastify="";var dist$4={exports:{}},lib$3={},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 it={};try{it=JSON.parse(nt.data)}catch{}tt({data:it})}):et.webkit&&et.webkit.messageHandlers&&et.webkit.messageHandlers.sphinx&&et.webkit.messageHandlers.sphinx?et.sphinxMessage=function(nt){var it={};try{it=JSON.parse(nt)}catch{}tt({data:it})}:et.Android?et.sphinxMessage=function(nt){var it={};try{it=JSON.parse(nt)}catch{}tt({data:it})}: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])&&(yt[0]===6||yt[0]===2)){ut=0;continue}if(yt[0]===3&&(!pt||yt[1]>pt[0]&&yt[1] ENABLE!"),this.isEnabled)return[2,{budget:this.budget,pubkey:this.pubkey,application:at}];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.AUTHORIZE)];case 2:return ut=dt.sent(),ut.pubkey?(this.isEnabled=!0,this.pubkey=ut.pubkey,[2,ut]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[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 it(this,function(bt){switch(bt.label){case 0:ht&&(this.logging=!0),this.logging&&console.log("=> AUTHORIZE!"),bt.label=1;case 1:return bt.trys.push([1,3,,4]),dt=ut||!1,[4,this.postMsg(ot.AUTHORIZE,{challenge:ct,noBudget:dt})];case 2:return pt=bt.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=bt.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 it(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.SETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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 it(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,ht;return it(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> GETBUDGET"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.GETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.setBudget=function(){return nt(this,void 0,void 0,function(){var ct,ut,ht;return it(this,function(dt){switch(dt.label){case 0:if(this.logging&&console.log("=> SETBUDGET"),!this.isEnabled)return[2,null];dt.label=1;case 1:return dt.trys.push([1,3,,4]),[4,this.postMsg(ot.SETBUDGET)];case 2:return ct=dt.sent(),ut=ct.budget||ct.budget===0,ut?(this.budget=ct.budget,[2,ct]):[3,4];case 3:return ht=dt.sent(),this.logging&&console.log(ht),[2,null];case 4:return[2]}})})},lt.prototype.postMsg=function(ct,ut){var ht,dt=this;dt.active&&Promise.reject(new Error("User is busy")),dt.active=ct;var pt=window;return!((ht=pt.kmpJsBridge)===null||ht===void 0)&&ht.callNative?new Promise(function(mt,gt){pt.kmpJsBridge.callNative("sphinx-bridge",JSON.stringify(et({application:at,type:ct},ut||{})),function(bt){var yt={};try{yt=JSON.parse(bt)}catch{}yt||yt.application!==at||(dt.active=null,yt.error?gt(yt.error):mt(yt))})}):new Promise(function(mt,gt){rt.postMessage(et({application:at,type:ct},ut||{}));function bt(yt){!yt.data||yt.data.application!==at||(yt.data.error?(dt.active=null,gt(yt.data.error)):(dt.active=null,mt(yt.data)),rt.removeEventer(bt))}rt.addEventer(bt)})},lt}();tt.default=st})(lib$3);var dist$3=dist$4.exports;Object.defineProperty(dist$3,"__esModule",{value:!0});var lib_1=lib$3,sphinx=new lib_1.default;dist$4.exports=sphinx;var distExports$1=dist$4.exports,reactIs$3={exports:{}},reactIs_production_min$2={};/** * @license React * react-is.production.min.js * diff --git a/build/index.html b/build/index.html index a334e0bcf..ae46355d0 100644 --- a/build/index.html +++ b/build/index.html @@ -22,7 +22,7 @@ Learn how to configure a non-root public URL by running `npm run build`. --> Second Brain - +