From 0abda1c8a0fe0eb9caff233ff4e4526cfe4640fd Mon Sep 17 00:00:00 2001 From: Github Actions Date: Mon, 6 Nov 2023 22:09:33 +0000 Subject: [PATCH] ci: automatic build fixes --- build/assets/{index-947683ea.js => index-164fac3f.js} | 6 +++--- build/index.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename build/assets/{index-947683ea.js => index-164fac3f.js} (99%) diff --git a/build/assets/index-947683ea.js b/build/assets/index-164fac3f.js similarity index 99% rename from build/assets/index-947683ea.js rename to build/assets/index-164fac3f.js index eaeaa0f33..018e9feee 100644 --- a/build/assets/index-947683ea.js +++ b/build/assets/index-164fac3f.js @@ -4890,7 +4890,7 @@ outputColor=vec4(color,inputColor.a);}`,VignetteEffect=class extends Effect$1{co `,Fallback=()=>jsxRuntimeExports.jsx(Html$1,{children:jsxRuntimeExports.jsx(Loader$1,{})}),Content$1=()=>{const{universeColor:tt}=useControls("universe",{universeColor:colors.black}),et=useSelectedNode(),nt=reactExports.useMemo(()=>et!=null&&et.node_type?getNodeColorByType(et.node_type):outlineEffectColor,[et]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("color",{args:[tt],attach:"background"}),jsxRuntimeExports.jsx(Lights,{}),jsxRuntimeExports.jsx(Controls,{}),jsxRuntimeExports.jsxs(Selection$3,{children:[jsxRuntimeExports.jsxs(EffectComposer,{autoClear:!1,multisampling:8,children:[jsxRuntimeExports.jsx(Vignette,{darkness:.7,eskil:!1,offset:.05}),jsxRuntimeExports.jsx(Bloom,{luminanceThreshold:1,mipmapBlur:!0,resolutionX:Resolution.AUTO_SIZE,resolutionY:Resolution.AUTO_SIZE}),jsxRuntimeExports.jsx(Outline,{blendFunction:BlendFunction.SCREEN,blur:!0,edgeStrength:4,hiddenEdgeColor:nt,visibleEdgeColor:nt})]}),jsxRuntimeExports.jsx(Graph,{})]})]})};let wheelEventTimeout=null;const cameraProps={aspect:window.innerWidth/window.innerHeight,far:3e4,near:1,position:[initialCameraPosition.x,initialCameraPosition.y,initialCameraPosition.z]},_Universe=()=>{const[tt,et,nt]=[useControlStore(at=>at.setIsUserScrollingOnHtmlPanel),useControlStore(at=>at.setIsUserScrolling),useControlStore(at=>at.setUserMovedCamera)],rt=useDataStore(at=>at.isFetching),it=reactExports.useCallback(at=>{var ct;const{target:st}=at,{offsetParent:lt}=st;wheelEventTimeout&&clearTimeout(wheelEventTimeout),(ct=lt==null?void 0:lt.classList)!=null&&ct.contains("html-panel")&<.clientHeight{et(!1),tt(!1)},200)},[et,tt,nt]),ot=reactExports.useCallback(at=>addToGlobalForE2e(at,"threeState"),[]);return jsxRuntimeExports.jsxs(Wrapper$o,{children:[jsxRuntimeExports.jsx(Overlay,{}),jsxRuntimeExports.jsx(reactExports.Suspense,{fallback:null,children:jsxRuntimeExports.jsxs(Canvas$1,{camera:cameraProps,id:"universe-canvas",onCreated:ot,onWheel:it,children:[isDevelopment&&jsxRuntimeExports.jsx(Perf,{position:"top-right"}),jsxRuntimeExports.jsxs(reactExports.Suspense,{fallback:jsxRuntimeExports.jsx(Fallback,{}),children:[jsxRuntimeExports.jsx(Preload,{}),jsxRuntimeExports.jsx(AdaptiveDpr,{}),jsxRuntimeExports.jsx(AdaptiveEvents,{}),jsxRuntimeExports.jsx(Content$1,{})]})]})}),rt&&jsxRuntimeExports.jsx(Preloader,{fullSize:!1})]})},Wrapper$o=styled$4(Flex)` flex: 1 1 100%; position: relative; -`,Universe=reactExports.memo(_Universe),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(tt=>{PACKET_TYPES_REVERSE[PACKET_TYPES[tt]]=tt});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=tt=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt&&tt.buffer instanceof ArrayBuffer,encodePacket=({type:tt,data:et},nt,rt)=>withNativeBlob$1&&et instanceof Blob?nt?rt(et):encodeBlobAsBase64(et,rt):withNativeArrayBuffer$2&&(et instanceof ArrayBuffer||isView$1(et))?nt?rt(et):encodeBlobAsBase64(new Blob([et]),rt):rt(PACKET_TYPES[tt]+(et||"")),encodeBlobAsBase64=(tt,et)=>{const nt=new FileReader;return nt.onload=function(){const rt=nt.result.split(",")[1];et("b"+(rt||""))},nt.readAsDataURL(tt)};function toArray$1(tt){return tt instanceof Uint8Array?tt:tt instanceof ArrayBuffer?new Uint8Array(tt):new Uint8Array(tt.buffer,tt.byteOffset,tt.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(tt,et){if(withNativeBlob$1&&tt.data instanceof Blob)return tt.data.arrayBuffer().then(toArray$1).then(et);if(withNativeArrayBuffer$2&&(tt.data instanceof ArrayBuffer||isView$1(tt.data)))return et(toArray$1(tt.data));encodePacket(tt,!1,nt=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),et(TEXT_ENCODER.encode(nt))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let tt=0;tt{let et=tt.length*.75,nt=tt.length,rt,it=0,ot,at,st,lt;tt[tt.length-1]==="="&&(et--,tt[tt.length-2]==="="&&et--);const ct=new ArrayBuffer(et),ut=new Uint8Array(ct);for(rt=0;rt>4,ut[it++]=(at&15)<<4|st>>2,ut[it++]=(st&3)<<6|lt&63;return ct},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(tt,et)=>{if(typeof tt!="string")return{type:"message",data:mapBinary(tt,et)};const nt=tt.charAt(0);return nt==="b"?{type:"message",data:decodeBase64Packet(tt.substring(1),et)}:PACKET_TYPES_REVERSE[nt]?tt.length>1?{type:PACKET_TYPES_REVERSE[nt],data:tt.substring(1)}:{type:PACKET_TYPES_REVERSE[nt]}:ERROR_PACKET},decodeBase64Packet=(tt,et)=>{if(withNativeArrayBuffer$1){const nt=decode$1(tt);return mapBinary(nt,et)}else return{base64:!0,data:tt}},mapBinary=(tt,et)=>{switch(et){case"blob":return tt instanceof Blob?tt:new Blob([tt]);case"arraybuffer":default:return tt instanceof ArrayBuffer?tt:tt.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(tt,et)=>{const nt=tt.length,rt=new Array(nt);let it=0;tt.forEach((ot,at)=>{encodePacket(ot,!1,st=>{rt[at]=st,++it===nt&&et(rt.join(SEPARATOR))})})},decodePayload=(tt,et)=>{const nt=tt.split(SEPARATOR),rt=[];for(let it=0;it{const rt=nt.length;let it;if(rt<126)it=new Uint8Array(1),new DataView(it.buffer).setUint8(0,rt);else if(rt<65536){it=new Uint8Array(3);const ot=new DataView(it.buffer);ot.setUint8(0,126),ot.setUint16(1,rt)}else{it=new Uint8Array(9);const ot=new DataView(it.buffer);ot.setUint8(0,127),ot.setBigUint64(1,BigInt(rt))}tt.data&&typeof tt.data!="string"&&(it[0]|=128),et.enqueue(it),et.enqueue(nt)})}})}let TEXT_DECODER;function totalLength(tt){return tt.reduce((et,nt)=>et+nt.length,0)}function concatChunks(tt,et){if(tt[0].length===et)return tt.shift();const nt=new Uint8Array(et);let rt=0;for(let it=0;itMath.pow(2,53-32)-1){st.enqueue(ERROR_PACKET);break}it=ut*Math.pow(2,32)+ct.getUint32(4),rt=3}else{if(totalLength(nt)tt){st.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(tt){if(tt)return mixin(tt)}function mixin(tt){for(var et in Emitter.prototype)tt[et]=Emitter.prototype[et];return tt}Emitter.prototype.on=Emitter.prototype.addEventListener=function(tt,et){return this._callbacks=this._callbacks||{},(this._callbacks["$"+tt]=this._callbacks["$"+tt]||[]).push(et),this};Emitter.prototype.once=function(tt,et){function nt(){this.off(tt,nt),et.apply(this,arguments)}return nt.fn=et,this.on(tt,nt),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(tt,et){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var nt=this._callbacks["$"+tt];if(!nt)return this;if(arguments.length==1)return delete this._callbacks["$"+tt],this;for(var rt,it=0;ittypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(tt,...et){return et.reduce((nt,rt)=>(tt.hasOwnProperty(rt)&&(nt[rt]=tt[rt]),nt),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(tt,et){et.useNativeTimers?(tt.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),tt.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(tt.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),tt.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(tt){return typeof tt=="string"?utf8Length(tt):Math.ceil((tt.byteLength||tt.size)*BASE64_OVERHEAD)}function utf8Length(tt){let et=0,nt=0;for(let rt=0,it=tt.length;rt=57344?nt+=3:(rt++,nt+=4);return nt}function encode$1(tt){let et="";for(let nt in tt)tt.hasOwnProperty(nt)&&(et.length&&(et+="&"),et+=encodeURIComponent(nt)+"="+encodeURIComponent(tt[nt]));return et}function decode(tt){let et={},nt=tt.split("&");for(let rt=0,it=nt.length;rt0);return et}function yeast(){const tt=encode(+new Date);return tt!==prev$1?(seed=0,prev$1=tt):tt+"."+encode(seed++)}for(;i$1{this.readyState="paused",et()};if(this.polling||!this.writable){let rt=0;this.polling&&(rt++,this.once("pollComplete",function(){--rt||nt()})),this.writable||(rt++,this.once("drain",function(){--rt||nt()}))}else nt()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(et){const nt=rt=>{if(this.readyState==="opening"&&rt.type==="open"&&this.onOpen(),rt.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(rt)};decodePayload(et,this.socket.binaryType).forEach(nt),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const et=()=>{this.write([{type:"close"}])};this.readyState==="open"?et():this.once("open",et)}write(et){this.writable=!1,encodePayload(et,nt=>{this.doWrite(nt,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const et=this.opts.secure?"https":"http",nt=this.query||{};return this.opts.timestampRequests!==!1&&(nt[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!nt.sid&&(nt.b64=1),this.createUri(et,nt)}request(et={}){return Object.assign(et,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),et)}doWrite(et,nt){const rt=this.request({method:"POST",data:et});rt.on("success",nt),rt.on("error",(it,ot)=>{this.onError("xhr post error",it,ot)})}doPoll(){const et=this.request();et.on("data",this.onData.bind(this)),et.on("error",(nt,rt)=>{this.onError("xhr poll error",nt,rt)}),this.pollXhr=et}}let Request$1=class O0 extends Emitter{constructor(et,nt){super(),installTimerFunctions(this,nt),this.opts=nt,this.method=nt.method||"GET",this.uri=et,this.data=nt.data!==void 0?nt.data:null,this.create()}create(){var et;const nt=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");nt.xdomain=!!this.opts.xd;const rt=this.xhr=new XHR(nt);try{rt.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){rt.setDisableHeaderCheck&&rt.setDisableHeaderCheck(!0);for(let it in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(it)&&rt.setRequestHeader(it,this.opts.extraHeaders[it])}}catch{}if(this.method==="POST")try{rt.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{rt.setRequestHeader("Accept","*/*")}catch{}(et=this.opts.cookieJar)===null||et===void 0||et.addCookies(rt),"withCredentials"in rt&&(rt.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(rt.timeout=this.opts.requestTimeout),rt.onreadystatechange=()=>{var it;rt.readyState===3&&((it=this.opts.cookieJar)===null||it===void 0||it.parseCookies(rt)),rt.readyState===4&&(rt.status===200||rt.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof rt.status=="number"?rt.status:0)},0))},rt.send(this.data)}catch(it){this.setTimeoutFn(()=>{this.onError(it)},0);return}typeof document<"u"&&(this.index=O0.requestsCount++,O0.requests[this.index]=this)}onError(et){this.emitReserved("error",et,this.xhr),this.cleanup(!0)}cleanup(et){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,et)try{this.xhr.abort()}catch{}typeof document<"u"&&delete O0.requests[this.index],this.xhr=null}}onLoad(){const et=this.xhr.responseText;et!==null&&(this.emitReserved("data",et),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const tt="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(tt,unloadHandler,!1)}}function unloadHandler(){for(let tt in Request$1.requests)Request$1.requests.hasOwnProperty(tt)&&Request$1.requests[tt].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?et=>Promise.resolve().then(et):(et,nt)=>nt(et,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(et){super(et),this.supportsBinary=!et.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const et=this.uri(),nt=this.opts.protocols,rt=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(rt.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?nt?new WebSocket(et,nt):new WebSocket(et):new WebSocket(et,nt,rt)}catch(it){return this.emitReserved("error",it)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=et=>this.onClose({description:"websocket connection closed",context:et}),this.ws.onmessage=et=>this.onData(et.data),this.ws.onerror=et=>this.onError("websocket error",et)}write(et){this.writable=!1;for(let nt=0;nt{const at={};try{usingBrowserWebSocket&&this.ws.send(ot)}catch{}it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const et=this.opts.secure?"wss":"ws",nt=this.query||{};return this.opts.timestampRequests&&(nt[this.opts.timestampParam]=yeast()),this.supportsBinary||(nt.b64=1),this.createUri(et,nt)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(et=>{this.onError("webtransport error",et)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(et=>{const nt=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),rt=et.readable.pipeThrough(nt).getReader(),it=createPacketEncoderStream();it.readable.pipeTo(et.writable),this.writer=it.writable.getWriter();const ot=()=>{rt.read().then(({done:st,value:lt})=>{st||(this.onPacket(lt),ot())}).catch(st=>{})};ot();const at={type:"open"};this.query.sid&&(at.data=`{"sid":"${this.query.sid}"}`),this.writer.write(at).then(()=>this.onOpen())})}))}write(et){this.writable=!1;for(let nt=0;nt{it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var et;(et=this.transport)===null||et===void 0||et.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$1(tt){const et=tt,nt=tt.indexOf("["),rt=tt.indexOf("]");nt!=-1&&rt!=-1&&(tt=tt.substring(0,nt)+tt.substring(nt,rt).replace(/:/g,";")+tt.substring(rt,tt.length));let it=re$1.exec(tt||""),ot={},at=14;for(;at--;)ot[parts[at]]=it[at]||"";return nt!=-1&&rt!=-1&&(ot.source=et,ot.host=ot.host.substring(1,ot.host.length-1).replace(/;/g,":"),ot.authority=ot.authority.replace("[","").replace("]","").replace(/;/g,":"),ot.ipv6uri=!0),ot.pathNames=pathNames(ot,ot.path),ot.queryKey=queryKey(ot,ot.query),ot}function pathNames(tt,et){const nt=/\/{2,9}/g,rt=et.replace(nt,"/").split("/");return(et.slice(0,1)=="/"||et.length===0)&&rt.splice(0,1),et.slice(-1)=="/"&&rt.splice(rt.length-1,1),rt}function queryKey(tt,et){const nt={};return et.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(rt,it,ot){it&&(nt[it]=ot)}),nt}let Socket$1=class Hm extends Emitter{constructor(et,nt={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],et&&typeof et=="object"&&(nt=et,et=null),et?(et=parse$1(et),nt.hostname=et.host,nt.secure=et.protocol==="https"||et.protocol==="wss",nt.port=et.port,et.query&&(nt.query=et.query)):nt.host&&(nt.hostname=parse$1(nt.host).host),installTimerFunctions(this,nt),this.secure=nt.secure!=null?nt.secure:typeof location<"u"&&location.protocol==="https:",nt.hostname&&!nt.port&&(nt.port=this.secure?"443":"80"),this.hostname=nt.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=nt.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=nt.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},nt),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(et){const nt=Object.assign({},this.opts.query);nt.EIO=protocol$1,nt.transport=et,this.id&&(nt.sid=this.id);const rt=Object.assign({},this.opts,{query:nt,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[et]);return new transports[et](rt)}open(){let et;if(this.opts.rememberUpgrade&&Hm.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)et="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else et=this.transports[0];this.readyState="opening";try{et=this.createTransport(et)}catch{this.transports.shift(),this.open();return}et.open(),this.setTransport(et)}setTransport(et){this.transport&&this.transport.removeAllListeners(),this.transport=et,et.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",nt=>this.onClose("transport close",nt))}probe(et){let nt=this.createTransport(et),rt=!1;Hm.priorWebsocketSuccess=!1;const it=()=>{rt||(nt.send([{type:"ping",data:"probe"}]),nt.once("packet",ht=>{if(!rt)if(ht.type==="pong"&&ht.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",nt),!nt)return;Hm.priorWebsocketSuccess=nt.name==="websocket",this.transport.pause(()=>{rt||this.readyState!=="closed"&&(ut(),this.setTransport(nt),nt.send([{type:"upgrade"}]),this.emitReserved("upgrade",nt),nt=null,this.upgrading=!1,this.flush())})}else{const dt=new Error("probe error");dt.transport=nt.name,this.emitReserved("upgradeError",dt)}}))};function ot(){rt||(rt=!0,ut(),nt.close(),nt=null)}const at=ht=>{const dt=new Error("probe error: "+ht);dt.transport=nt.name,ot(),this.emitReserved("upgradeError",dt)};function st(){at("transport closed")}function lt(){at("socket closed")}function ct(ht){nt&&ht.name!==nt.name&&ot()}const ut=()=>{nt.removeListener("open",it),nt.removeListener("error",at),nt.removeListener("close",st),this.off("close",lt),this.off("upgrading",ct)};nt.once("open",it),nt.once("error",at),nt.once("close",st),this.once("close",lt),this.once("upgrading",ct),this.upgrades.indexOf("webtransport")!==-1&&et!=="webtransport"?this.setTimeoutFn(()=>{rt||nt.open()},200):nt.open()}onOpen(){if(this.readyState="open",Hm.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let et=0;const nt=this.upgrades.length;for(;et{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const et=this.getWritablePackets();this.transport.send(et),this.prevBufferLen=et.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let nt=1;for(let rt=0;rt0&&nt>this.maxPayload)return this.writeBuffer.slice(0,rt);nt+=2}return this.writeBuffer}write(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}send(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}sendPacket(et,nt,rt,it){if(typeof nt=="function"&&(it=nt,nt=void 0),typeof rt=="function"&&(it=rt,rt=null),this.readyState==="closing"||this.readyState==="closed")return;rt=rt||{},rt.compress=rt.compress!==!1;const ot={type:et,data:nt,options:rt};this.emitReserved("packetCreate",ot),this.writeBuffer.push(ot),it&&this.once("flush",it),this.flush()}close(){const et=()=>{this.onClose("forced close"),this.transport.close()},nt=()=>{this.off("upgrade",nt),this.off("upgradeError",nt),et()},rt=()=>{this.once("upgrade",nt),this.once("upgradeError",nt)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?rt():et()}):this.upgrading?rt():et()),this}onError(et){Hm.priorWebsocketSuccess=!1,this.emitReserved("error",et),this.onClose("transport error",et)}onClose(et,nt){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",et,nt),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(et){const nt=[];let rt=0;const it=et.length;for(;rttypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt.buffer instanceof ArrayBuffer,toString$4=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$4.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$4.call(File)==="[object FileConstructor]";function isBinary(tt){return withNativeArrayBuffer&&(tt instanceof ArrayBuffer||isView(tt))||withNativeBlob&&tt instanceof Blob||withNativeFile&&tt instanceof File}function hasBinary(tt,et){if(!tt||typeof tt!="object")return!1;if(Array.isArray(tt)){for(let nt=0,rt=tt.length;nt=0&&tt.num{delete this.acks[et];for(let at=0;at{this.io.clearTimeoutFn(ot),nt.apply(this,[null,...at])}}emitWithAck(et,...nt){const rt=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((it,ot)=>{nt.push((at,st)=>rt?at?ot(at):it(st):it(at)),this.emit(et,...nt)})}_addToQueue(et){let nt;typeof et[et.length-1]=="function"&&(nt=et.pop());const rt={id:this._queueSeq++,tryCount:0,pending:!1,args:et,flags:Object.assign({fromQueue:!0},this.flags)};et.push((it,...ot)=>rt!==this._queue[0]?void 0:(it!==null?rt.tryCount>this._opts.retries&&(this._queue.shift(),nt&&nt(it)):(this._queue.shift(),nt&&nt(null,...ot)),rt.pending=!1,this._drainQueue())),this._queue.push(rt),this._drainQueue()}_drainQueue(et=!1){if(!this.connected||this._queue.length===0)return;const nt=this._queue[0];nt.pending&&!et||(nt.pending=!0,nt.tryCount++,this.flags=nt.flags,this.emit.apply(this,nt.args))}packet(et){et.nsp=this.nsp,this.io._packet(et)}onopen(){typeof this.auth=="function"?this.auth(et=>{this._sendConnectPacket(et)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(et){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},et):et})}onerror(et){this.connected||this.emitReserved("connect_error",et)}onclose(et,nt){this.connected=!1,delete this.id,this.emitReserved("disconnect",et,nt)}onpacket(et){if(et.nsp===this.nsp)switch(et.type){case PacketType.CONNECT:et.data&&et.data.sid?this.onconnect(et.data.sid,et.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(et);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(et);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const rt=new Error(et.data.message);rt.data=et.data.data,this.emitReserved("connect_error",rt);break}}onevent(et){const nt=et.data||[];et.id!=null&&nt.push(this.ack(et.id)),this.connected?this.emitEvent(nt):this.receiveBuffer.push(Object.freeze(nt))}emitEvent(et){if(this._anyListeners&&this._anyListeners.length){const nt=this._anyListeners.slice();for(const rt of nt)rt.apply(this,et)}super.emit.apply(this,et),this._pid&&et.length&&typeof et[et.length-1]=="string"&&(this._lastOffset=et[et.length-1])}ack(et){const nt=this;let rt=!1;return function(...it){rt||(rt=!0,nt.packet({type:PacketType.ACK,id:et,data:it}))}}onack(et){const nt=this.acks[et.id];typeof nt=="function"&&(nt.apply(this,et.data),delete this.acks[et.id])}onconnect(et,nt){this.id=et,this.recovered=nt&&this._pid===nt,this._pid=nt,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(et=>this.emitEvent(et)),this.receiveBuffer=[],this.sendBuffer.forEach(et=>{this.notifyOutgoingListeners(et),this.packet(et)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(et=>et()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(et){return this.flags.compress=et,this}get volatile(){return this.flags.volatile=!0,this}timeout(et){return this.flags.timeout=et,this}onAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(et),this}prependAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(et),this}offAny(et){if(!this._anyListeners)return this;if(et){const nt=this._anyListeners;for(let rt=0;rt0&&tt.jitter<=1?tt.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var tt=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var et=Math.random(),nt=Math.floor(et*this.jitter*tt);tt=Math.floor(et*10)&1?tt+nt:tt-nt}return Math.min(tt,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(tt){this.ms=tt};Backoff.prototype.setMax=function(tt){this.max=tt};Backoff.prototype.setJitter=function(tt){this.jitter=tt};class Manager extends Emitter{constructor(et,nt){var rt;super(),this.nsps={},this.subs=[],et&&typeof et=="object"&&(nt=et,et=void 0),nt=nt||{},nt.path=nt.path||"/socket.io",this.opts=nt,installTimerFunctions(this,nt),this.reconnection(nt.reconnection!==!1),this.reconnectionAttempts(nt.reconnectionAttempts||1/0),this.reconnectionDelay(nt.reconnectionDelay||1e3),this.reconnectionDelayMax(nt.reconnectionDelayMax||5e3),this.randomizationFactor((rt=nt.randomizationFactor)!==null&&rt!==void 0?rt:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(nt.timeout==null?2e4:nt.timeout),this._readyState="closed",this.uri=et;const it=nt.parser||parser;this.encoder=new it.Encoder,this.decoder=new it.Decoder,this._autoConnect=nt.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(et){return arguments.length?(this._reconnection=!!et,this):this._reconnection}reconnectionAttempts(et){return et===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=et,this)}reconnectionDelay(et){var nt;return et===void 0?this._reconnectionDelay:(this._reconnectionDelay=et,(nt=this.backoff)===null||nt===void 0||nt.setMin(et),this)}randomizationFactor(et){var nt;return et===void 0?this._randomizationFactor:(this._randomizationFactor=et,(nt=this.backoff)===null||nt===void 0||nt.setJitter(et),this)}reconnectionDelayMax(et){var nt;return et===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=et,(nt=this.backoff)===null||nt===void 0||nt.setMax(et),this)}timeout(et){return arguments.length?(this._timeout=et,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(et){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const nt=this.engine,rt=this;this._readyState="opening",this.skipReconnect=!1;const it=on(nt,"open",function(){rt.onopen(),et&&et()}),ot=st=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",st),et?et(st):this.maybeReconnectOnOpen()},at=on(nt,"error",ot);if(this._timeout!==!1){const st=this._timeout,lt=this.setTimeoutFn(()=>{it(),ot(new Error("timeout")),nt.close()},st);this.opts.autoUnref&<.unref(),this.subs.push(()=>{this.clearTimeoutFn(lt)})}return this.subs.push(it),this.subs.push(at),this}connect(et){return this.open(et)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const et=this.engine;this.subs.push(on(et,"ping",this.onping.bind(this)),on(et,"data",this.ondata.bind(this)),on(et,"error",this.onerror.bind(this)),on(et,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(et){try{this.decoder.add(et)}catch(nt){this.onclose("parse error",nt)}}ondecoded(et){nextTick(()=>{this.emitReserved("packet",et)},this.setTimeoutFn)}onerror(et){this.emitReserved("error",et)}socket(et,nt){let rt=this.nsps[et];return rt?this._autoConnect&&!rt.active&&rt.connect():(rt=new Socket(this,et,nt),this.nsps[et]=rt),rt}_destroy(et){const nt=Object.keys(this.nsps);for(const rt of nt)if(this.nsps[rt].active)return;this._close()}_packet(et){const nt=this.encoder.encode(et);for(let rt=0;rtet()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(et,nt){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",et,nt),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const et=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const nt=this.backoff.duration();this._reconnecting=!0;const rt=this.setTimeoutFn(()=>{et.skipReconnect||(this.emitReserved("reconnect_attempt",et.backoff.attempts),!et.skipReconnect&&et.open(it=>{it?(et._reconnecting=!1,et.reconnect(),this.emitReserved("reconnect_error",it)):et.onreconnect()}))},nt);this.opts.autoUnref&&rt.unref(),this.subs.push(()=>{this.clearTimeoutFn(rt)})}}onreconnect(){const et=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",et)}}const cache$1={};function lookup(tt,et){typeof tt=="object"&&(et=tt,tt=void 0),et=et||{};const nt=url(tt,et.path||"/socket.io"),rt=nt.source,it=nt.id,ot=nt.path,at=cache$1[it]&&ot in cache$1[it].nsps,st=et.forceNew||et["force new connection"]||et.multiplex===!1||at;let lt;return st?lt=new Manager(rt,et):(cache$1[it]||(cache$1[it]=new Manager(rt,et)),lt=cache$1[it]),nt.query&&!et.query&&(et.query=nt.queryKey),lt.socket(nt.path,et)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const useSocket=()=>{const[tt,et]=reactExports.useState(null);return reactExports.useEffect(()=>{const nt=lookup(API_URL);return et(nt),()=>{nt.disconnect()}},[]),tt},defaultData$5={askedQuestions:null,askedQuestionsAnswers:null,hasQuestionInProgress:!1,hasTeachingInProgress:!1,hasInstagraphInProgress:!1,teachMeAnswer:null,instgraphAnswser:null},useTeachStore=react(tt=>({...defaultData$5,setAskedQuestion:et=>tt(nt=>({askedQuestions:[...nt.askedQuestions||[],et],hasQuestionInProgress:!0})),setAskedQuestionAnswer:et=>tt(nt=>({askedQuestionsAnswers:[...nt.askedQuestionsAnswers||[],et],hasQuestionInProgress:!1})),setHasQuestionInProgress:et=>tt({hasQuestionInProgress:et}),setHasTeachingInProgress:et=>tt({hasTeachingInProgress:et}),setHasInstagraphInProgress:et=>tt({hasInstagraphInProgress:et}),setTeachMeAnswer:et=>tt({hasTeachingInProgress:!1,teachMeAnswer:et}),setInstagraphAnswer:et=>{var nt,rt,it,ot;(nt=et==null?void 0:et.instagraph)!=null&&nt.edges&&((rt=et==null?void 0:et.instagraph)!=null&&rt.nodes)&&tt({hasInstagraphInProgress:!1,instgraphAnswser:{edges:(it=et==null?void 0:et.instagraph)==null?void 0:it.edges,nodes:(ot=et==null?void 0:et.instagraph)==null?void 0:ot.nodes}})}}));async function updateBudget(tt){const et=await distExports$1.getBudget();(et==null?void 0:et.msg)==="Invalid Action"?tt(null):et!=null&&et.budget&&tt(et.budget)}const version="0.1.104";function _extends$s(){return _extends$s=Object.assign||function(tt){for(var et=1;et=0)&&(nt[it]=tt[it]);return nt}function isNum(tt){return typeof tt=="number"&&!isNaN(tt)}function isBool(tt){return typeof tt=="boolean"}function isStr(tt){return typeof tt=="string"}function isFn(tt){return typeof tt=="function"}function parseClassName(tt){return isStr(tt)||isFn(tt)?tt:null}function isToastIdValid(tt){return tt===0||tt}function getAutoCloseDelay(tt,et){return tt===!1||isNum(tt)&&tt>0?tt:et}var canUseDom=!!(typeof window<"u"&&window.document&&window.document.createElement);function canBeRendered(tt){return reactExports.isValidElement(tt)||isStr(tt)||isFn(tt)||isNum(tt)}var POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function collapseToast(tt,et,nt){nt===void 0&&(nt=300);var rt=tt.scrollHeight,it=tt.style;requestAnimationFrame(function(){it.minHeight="initial",it.height=rt+"px",it.transition="all "+nt+"ms",requestAnimationFrame(function(){it.height="0",it.padding="0",it.margin="0",setTimeout(et,nt)})})}function cssTransition(tt){var et=tt.enter,nt=tt.exit,rt=tt.appendPosition,it=rt===void 0?!1:rt,ot=tt.collapse,at=ot===void 0?!0:ot,st=tt.collapseDuration,lt=st===void 0?300:st;return function(ut){var ht=ut.children,dt=ut.position,pt=ut.preventExitTransition,mt=ut.done,gt=ut.nodeRef,yt=ut.isIn,bt=it?et+"--"+dt:et,wt=it?nt+"--"+dt:nt,xt=reactExports.useRef(),kt=reactExports.useRef(0);reactExports.useLayoutEffect(function(){St()},[]),reactExports.useEffect(function(){yt||(pt?Et():At())},[yt]);function St(){var Ct=gt.current;xt.current=Ct.className,Ct.className+=" "+bt,Ct.addEventListener("animationend",Tt),Ct.addEventListener("animationcancel",Tt)}function Tt(Ct){if(Ct.target===gt.current){var Lt=gt.current;Lt.dispatchEvent(new Event("d")),Lt.removeEventListener("animationend",Tt),Lt.removeEventListener("animationcancel",Tt),kt.current===0&&(Lt.className=xt.current)}}function At(){kt.current=1;var Ct=gt.current;Ct.className+=" "+wt,Ct.addEventListener("animationend",Et)}function Et(){var Ct=gt.current;Ct.removeEventListener("animationend",Et),at?collapseToast(Ct,mt,lt):mt()}return React$1.createElement(React$1.Fragment,null,ht)}}var eventManager={list:new Map,emitQueue:new Map,on:function(et,nt){return this.list.has(et)||this.list.set(et,[]),this.list.get(et).push(nt),this},off:function(et,nt){if(nt){var rt=this.list.get(et).filter(function(it){return it!==nt});return this.list.set(et,rt),this}return this.list.delete(et),this},cancelEmit:function(et){var nt=this.emitQueue.get(et);return nt&&(nt.forEach(clearTimeout),this.emitQueue.delete(et)),this},emit:function(et){for(var nt=this,rt=arguments.length,it=new Array(rt>1?rt-1:0),ot=1;ot0){var Ot=isToastIdValid(Tt)?1:ct.props.limit;if(It===1||Ot===1)ct.displayedToast++,dt();else{var Wt=Ot>It?It:Ot;ct.displayedToast=Wt;for(var zt=0;zt0&&ct.count>Ct.limit&&jt?ct.queue.push({toastContent:$t,toastProps:Rt,staleId:kt}):isNum(xt)&&xt>0?setTimeout(function(){gt($t,Rt,kt)},xt):gt($t,Rt,kt)}}function gt(bt,wt,xt){var kt=wt.toastId;xt&&st.delete(xt),st.set(kt,{content:bt,props:wt}),ot(function(St){return[].concat(St,[kt]).filter(function(Tt){return Tt!==xt})})}function yt(bt){var wt=new Map,xt=Array.from(st.values());return tt.newestOnTop&&xt.reverse(),xt.forEach(function(kt){var St=kt.props.position;wt.has(St)||wt.set(St,[]),wt.get(St).push(kt)}),Array.from(wt,function(kt){return bt(kt[0],kt[1])})}return{getToastToRender:yt,containerRef:at,isToastActive:lt}}function getX$1(tt){return tt.targetTouches&&tt.targetTouches.length>=1?tt.targetTouches[0].clientX:tt.clientX}function getY$1(tt){return tt.targetTouches&&tt.targetTouches.length>=1?tt.targetTouches[0].clientY:tt.clientY}function useToast(tt){var et=reactExports.useState(!1),nt=et[0],rt=et[1],it=reactExports.useState(!1),ot=it[0],at=it[1],st=reactExports.useRef(null),lt=reactExports.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,ct=reactExports.useRef(tt),ut=tt.autoClose,ht=tt.pauseOnHover,dt=tt.closeToast,pt=tt.onClick,mt=tt.closeOnClick;reactExports.useEffect(function(){ct.current=tt}),reactExports.useEffect(function(){return st.current&&st.current.addEventListener("d",bt,{once:!0}),isFn(tt.onOpen)&&tt.onOpen(reactExports.isValidElement(tt.children)&&tt.children.props),function(){var Lt=ct.current;isFn(Lt.onClose)&&Lt.onClose(reactExports.isValidElement(Lt.children)&&Lt.children.props)}},[]),reactExports.useEffect(function(){return tt.pauseOnFocusLoss&&xt(),function(){tt.pauseOnFocusLoss&&kt()}},[tt.pauseOnFocusLoss]);function gt(Lt){if(tt.draggable){St();var jt=st.current;lt.canCloseOnClick=!0,lt.canDrag=!0,lt.boundingRect=jt.getBoundingClientRect(),jt.style.transition="",lt.x=getX$1(Lt.nativeEvent),lt.y=getY$1(Lt.nativeEvent),tt.draggableDirection==="x"?(lt.start=lt.x,lt.removalDistance=jt.offsetWidth*(tt.draggablePercent/100)):(lt.start=lt.y,lt.removalDistance=jt.offsetHeight*(tt.draggablePercent===80?tt.draggablePercent*1.5:tt.draggablePercent/100))}}function yt(){if(lt.boundingRect){var Lt=lt.boundingRect,jt=Lt.top,Rt=Lt.bottom,$t=Lt.left,vt=Lt.right;tt.pauseOnHover&<.x>=$t&<.x<=vt&<.y>=jt&<.y<=Rt?wt():bt()}}function bt(){rt(!0)}function wt(){rt(!1)}function xt(){document.hasFocus()||wt(),window.addEventListener("focus",bt),window.addEventListener("blur",wt)}function kt(){window.removeEventListener("focus",bt),window.removeEventListener("blur",wt)}function St(){lt.didMove=!1,document.addEventListener("mousemove",At),document.addEventListener("mouseup",Et),document.addEventListener("touchmove",At),document.addEventListener("touchend",Et)}function Tt(){document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",Et),document.removeEventListener("touchmove",At),document.removeEventListener("touchend",Et)}function At(Lt){var jt=st.current;lt.canDrag&&jt&&(lt.didMove=!0,nt&&wt(),lt.x=getX$1(Lt),lt.y=getY$1(Lt),tt.draggableDirection==="x"?lt.delta=lt.x-lt.start:lt.delta=lt.y-lt.start,lt.start!==lt.x&&(lt.canCloseOnClick=!1),jt.style.transform="translate"+tt.draggableDirection+"("+lt.delta+"px)",jt.style.opacity=""+(1-Math.abs(lt.delta/lt.removalDistance)))}function Et(){Tt();var Lt=st.current;if(lt.canDrag&<.didMove&&Lt){if(lt.canDrag=!1,Math.abs(lt.delta)>lt.removalDistance){at(!0),tt.closeToast();return}Lt.style.transition="transform 0.2s, opacity 0.2s",Lt.style.transform="translate"+tt.draggableDirection+"(0)",Lt.style.opacity="1"}}var Ct={onMouseDown:gt,onTouchStart:gt,onMouseUp:yt,onTouchEnd:yt};return ut&&ht&&(Ct.onMouseEnter=wt,Ct.onMouseLeave=bt),mt&&(Ct.onClick=function(Lt){pt&&pt(Lt),lt.canCloseOnClick&&dt()}),{playToast:bt,pauseToast:wt,isRunning:nt,preventExitTransition:ot,toastRef:st,eventHandlers:Ct}}function CloseButton$5(tt){var et=tt.closeToast,nt=tt.theme,rt=tt.ariaLabel,it=rt===void 0?"close":rt;return reactExports.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+nt,type:"button",onClick:function(at){at.stopPropagation(),et(at)},"aria-label":it},reactExports.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},reactExports.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function ProgressBar(tt){var et,nt,rt=tt.delay,it=tt.isRunning,ot=tt.closeToast,at=tt.type,st=tt.hide,lt=tt.className,ct=tt.style,ut=tt.controlledProgress,ht=tt.progress,dt=tt.rtl,pt=tt.isIn,mt=tt.theme,gt=_extends$s({},ct,{animationDuration:rt+"ms",animationPlayState:it?"running":"paused",opacity:st?0:1});ut&&(gt.transform="scaleX("+ht+")");var yt=clsx$4("Toastify__progress-bar",ut?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+mt,"Toastify__progress-bar--"+at,(et={},et["Toastify__progress-bar--rtl"]=dt,et)),bt=isFn(lt)?lt({rtl:dt,type:at,defaultClassName:yt}):clsx$4(yt,lt),wt=(nt={},nt[ut&&ht>=1?"onTransitionEnd":"onAnimationEnd"]=ut&&ht<1?null:function(){pt&&ot()},nt);return reactExports.createElement("div",Object.assign({role:"progressbar","aria-hidden":st?"true":"false","aria-label":"notification timer",className:bt,style:gt},wt))}ProgressBar.defaultProps={type:TYPE.DEFAULT,hide:!1};var _excluded$1$1=["theme","type"],Svg=function(et){var nt=et.theme,rt=et.type,it=_objectWithoutPropertiesLoose$k(et,_excluded$1$1);return reactExports.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:nt==="colored"?"currentColor":"var(--toastify-icon-color-"+rt+")"},it))};function Warning(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function Info(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function Success(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function Error$1(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function Spinner(){return reactExports.createElement("div",{className:"Toastify__spinner"})}var Icons={info:Info,warning:Warning,success:Success,error:Error$1,spinner:Spinner},Toast=function(et){var nt,rt,it=useToast(et),ot=it.isRunning,at=it.preventExitTransition,st=it.toastRef,lt=it.eventHandlers,ct=et.closeButton,ut=et.children,ht=et.autoClose,dt=et.onClick,pt=et.type,mt=et.hideProgressBar,gt=et.closeToast,yt=et.transition,bt=et.position,wt=et.className,xt=et.style,kt=et.bodyClassName,St=et.bodyStyle,Tt=et.progressClassName,At=et.progressStyle,Et=et.updateId,Ct=et.role,Lt=et.progress,jt=et.rtl,Rt=et.toastId,$t=et.deleteToast,vt=et.isIn,It=et.isLoading,Ot=et.icon,Wt=et.theme,zt=clsx$4("Toastify__toast","Toastify__toast-theme--"+Wt,"Toastify__toast--"+pt,(nt={},nt["Toastify__toast--rtl"]=jt,nt)),Ft=isFn(wt)?wt({rtl:jt,position:bt,type:pt,defaultClassName:zt}):clsx$4(zt,wt),Nt=!!Lt,Ut=Icons[pt],Pt={theme:Wt,type:pt},Ht=Ut&&Ut(Pt);Ot===!1?Ht=void 0:isFn(Ot)?Ht=Ot(Pt):reactExports.isValidElement(Ot)?Ht=reactExports.cloneElement(Ot,Pt):isStr(Ot)?Ht=Ot:It&&(Ht=Icons.spinner());function Qt(an){if(an){var Yt={closeToast:gt,type:pt,theme:Wt};if(isFn(an))return an(Yt);if(reactExports.isValidElement(an))return reactExports.cloneElement(an,Yt)}}return reactExports.createElement(yt,{isIn:vt,done:$t,position:bt,preventExitTransition:at,nodeRef:st},reactExports.createElement("div",Object.assign({id:Rt,onClick:dt,className:Ft},lt,{style:xt,ref:st}),reactExports.createElement("div",Object.assign({},vt&&{role:Ct},{className:isFn(kt)?kt({type:pt}):clsx$4("Toastify__toast-body",kt),style:St}),Ht&&reactExports.createElement("div",{className:clsx$4("Toastify__toast-icon",(rt={},rt["Toastify--animate-icon Toastify__zoom-enter"]=!It,rt))},Ht),reactExports.createElement("div",null,ut)),Qt(ct),(ht||Nt)&&reactExports.createElement(ProgressBar,Object.assign({},Et&&!Nt?{key:"pb-"+Et}:{},{rtl:jt,theme:Wt,delay:ht,isRunning:ot,isIn:vt,closeToast:gt,hide:mt,type:pt,style:At,className:Tt,controlledProgress:Nt,progress:Lt}))))},Bounce=cssTransition({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),ToastContainer=function(et){var nt=useToastContainer(et),rt=nt.getToastToRender,it=nt.containerRef,ot=nt.isToastActive,at=et.className,st=et.style,lt=et.rtl,ct=et.containerId;function ut(ht){var dt,pt=clsx$4("Toastify__toast-container","Toastify__toast-container--"+ht,(dt={},dt["Toastify__toast-container--rtl"]=lt,dt));return isFn(at)?at({position:ht,rtl:lt,defaultClassName:pt}):clsx$4(pt,parseClassName(at))}return reactExports.createElement("div",{ref:it,className:"Toastify",id:ct},rt(function(ht,dt){var pt=dt.length?_extends$s({},st):_extends$s({},st,{pointerEvents:"none"});return reactExports.createElement("div",{className:ut(ht),style:pt,key:"container-"+ht},dt.map(function(mt){var gt=mt.content,yt=mt.props;return reactExports.createElement(Toast,Object.assign({},yt,{isIn:ot(yt.toastId),key:"toast-"+yt.key,closeButton:yt.closeButton===!0?CloseButton$5:yt.closeButton}),gt)}))}))};ToastContainer.defaultProps={position:POSITION.TOP_RIGHT,transition:Bounce,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:CloseButton$5,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var containers=new Map,latestInstance,containerDomNode,containerConfig,queue=[],lazy=!1;function getToast(tt,et){var nt=et.containerId,rt=containers.get(nt||latestInstance);return rt?rt.getToast(tt):null}function generateToastId(){return Math.random().toString(36).substring(2,9)}function getToastId(tt){return tt&&(isStr(tt.toastId)||isNum(tt.toastId))?tt.toastId:generateToastId()}function dispatchToast(tt,et){return containers.size>0?eventManager.emit(0,tt,et):(queue.push({content:tt,options:et}),lazy&&canUseDom&&(lazy=!1,containerDomNode=document.createElement("div"),document.body.appendChild(containerDomNode),reactDomExports.render(reactExports.createElement(ToastContainer,Object.assign({},containerConfig)),containerDomNode))),et.toastId}function mergeOptions(tt,et){return _extends$s({},et,{type:et&&et.type||tt,toastId:getToastId(et)})}function createToastByType(tt){return function(et,nt){return dispatchToast(et,mergeOptions(tt,nt))}}function toast(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,et))}toast.loading=function(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,_extends$s({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},et)))};function handlePromise(tt,et,nt){var rt=et.pending,it=et.error,ot=et.success,at;rt&&(at=isStr(rt)?toast.loading(rt,nt):toast.loading(rt.render,_extends$s({},nt,rt)));var st={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},lt=function(ht,dt,pt){if(dt==null){toast.dismiss(at);return}var mt=_extends$s({type:ht},st,nt,{data:pt}),gt=isStr(dt)?{render:dt}:dt;return at?toast.update(at,_extends$s({},mt,gt)):toast(gt.render,_extends$s({},mt,gt)),pt},ct=isFn(tt)?tt():tt;return ct.then(function(ut){return lt("success",ot,ut)}).catch(function(ut){return lt("error",it,ut)}),ct}toast.promise=handlePromise;toast.success=createToastByType(TYPE.SUCCESS);toast.info=createToastByType(TYPE.INFO);toast.error=createToastByType(TYPE.ERROR);toast.warning=createToastByType(TYPE.WARNING);toast.warn=toast.warning;toast.dark=function(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,_extends$s({theme:"dark"},et)))};toast.dismiss=function(tt){return eventManager.emit(1,tt)};toast.clearWaitingQueue=function(tt){return tt===void 0&&(tt={}),eventManager.emit(5,tt)};toast.isActive=function(tt){var et=!1;return containers.forEach(function(nt){nt.isToastActive&&nt.isToastActive(tt)&&(et=!0)}),et};toast.update=function(tt,et){et===void 0&&(et={}),setTimeout(function(){var nt=getToast(tt,et);if(nt){var rt=nt.props,it=nt.content,ot=_extends$s({},rt,et,{toastId:et.toastId||tt,updateId:generateToastId()});ot.toastId!==tt&&(ot.staleId=tt);var at=ot.render||it;delete ot.render,dispatchToast(at,ot)}},0)};toast.done=function(tt){toast.update(tt,{progress:1})};toast.onChange=function(tt){return isFn(tt)&&eventManager.on(4,tt),function(){isFn(tt)&&eventManager.off(4,tt)}};toast.configure=function(tt){tt===void 0&&(tt={}),lazy=!0,containerConfig=tt};toast.POSITION=POSITION;toast.TYPE=TYPE;eventManager.on(2,function(tt){latestInstance=tt.containerId||tt,containers.set(latestInstance,tt),queue.forEach(function(et){eventManager.emit(0,et.content,et.options)}),queue=[]}).on(3,function(tt){containers.delete(tt.containerId||tt),containers.size===0&&eventManager.off(0).off(1).off(5),canUseDom&&containerDomNode&&document.body.removeChild(containerDomNode)});const defaultData$4={addNodeModalData:null,currentModals:{budgetExplanation:!1,sourcesTable:!1,addContent:!1,editTopic:!1,addSource:!1}},useModalStore=create$3(tt=>({...defaultData$4,close:et=>{tt(nt=>({addNodeModalData:null,currentModals:{...nt.currentModals,[et]:!1}}))},open:et=>{tt(nt=>({currentModals:{...nt.currentModals,[et]:!0}}))}})),useModal$1=tt=>{const{open:et,close:nt,currentModals:rt}=useModalStore();return{close:()=>nt(tt),open:()=>et(tt),visible:rt[tt]}},ClearIcon$1=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("g",{id:"Property 1=press",children:jsxRuntimeExports.jsx("path",{id:"close",d:"M16 17.2833L11.5083 21.775C11.3403 21.943 11.1264 22.0271 10.8667 22.0271C10.6069 22.0271 10.393 21.943 10.225 21.775C10.0569 21.6069 9.9729 21.393 9.9729 21.1333C9.9729 20.8736 10.0569 20.6597 10.225 20.4917L14.7167 16L10.225 11.5083C10.0569 11.3403 9.9729 11.1264 9.9729 10.8667C9.9729 10.6069 10.0569 10.393 10.225 10.225C10.393 10.0569 10.6069 9.9729 10.8667 9.9729C11.1264 9.9729 11.3403 10.0569 11.5083 10.225L16 14.7167L20.4917 10.225C20.6597 10.0569 20.8736 9.9729 21.1333 9.9729C21.393 9.9729 21.6069 10.0569 21.775 10.225C21.943 10.393 22.0271 10.6069 22.0271 10.8667C22.0271 11.1264 21.943 11.3403 21.775 11.5083L17.2833 16L21.775 20.4917C21.943 20.6597 22.0271 20.8736 22.0271 21.1333C22.0271 21.393 21.943 21.6069 21.775 21.775C21.6069 21.943 21.393 22.0271 21.1333 22.0271C20.8736 22.0271 20.6597 21.943 20.4917 21.775L16 17.2833Z",fill:"currentColor"})})}),scaleAnimation=We` +`,Universe=reactExports.memo(_Universe),PACKET_TYPES=Object.create(null);PACKET_TYPES.open="0";PACKET_TYPES.close="1";PACKET_TYPES.ping="2";PACKET_TYPES.pong="3";PACKET_TYPES.message="4";PACKET_TYPES.upgrade="5";PACKET_TYPES.noop="6";const PACKET_TYPES_REVERSE=Object.create(null);Object.keys(PACKET_TYPES).forEach(tt=>{PACKET_TYPES_REVERSE[PACKET_TYPES[tt]]=tt});const ERROR_PACKET={type:"error",data:"parser error"},withNativeBlob$1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",withNativeArrayBuffer$2=typeof ArrayBuffer=="function",isView$1=tt=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt&&tt.buffer instanceof ArrayBuffer,encodePacket=({type:tt,data:et},nt,rt)=>withNativeBlob$1&&et instanceof Blob?nt?rt(et):encodeBlobAsBase64(et,rt):withNativeArrayBuffer$2&&(et instanceof ArrayBuffer||isView$1(et))?nt?rt(et):encodeBlobAsBase64(new Blob([et]),rt):rt(PACKET_TYPES[tt]+(et||"")),encodeBlobAsBase64=(tt,et)=>{const nt=new FileReader;return nt.onload=function(){const rt=nt.result.split(",")[1];et("b"+(rt||""))},nt.readAsDataURL(tt)};function toArray$1(tt){return tt instanceof Uint8Array?tt:tt instanceof ArrayBuffer?new Uint8Array(tt):new Uint8Array(tt.buffer,tt.byteOffset,tt.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(tt,et){if(withNativeBlob$1&&tt.data instanceof Blob)return tt.data.arrayBuffer().then(toArray$1).then(et);if(withNativeArrayBuffer$2&&(tt.data instanceof ArrayBuffer||isView$1(tt.data)))return et(toArray$1(tt.data));encodePacket(tt,!1,nt=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),et(TEXT_ENCODER.encode(nt))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let tt=0;tt{let et=tt.length*.75,nt=tt.length,rt,it=0,ot,at,st,lt;tt[tt.length-1]==="="&&(et--,tt[tt.length-2]==="="&&et--);const ct=new ArrayBuffer(et),ut=new Uint8Array(ct);for(rt=0;rt>4,ut[it++]=(at&15)<<4|st>>2,ut[it++]=(st&3)<<6|lt&63;return ct},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(tt,et)=>{if(typeof tt!="string")return{type:"message",data:mapBinary(tt,et)};const nt=tt.charAt(0);return nt==="b"?{type:"message",data:decodeBase64Packet(tt.substring(1),et)}:PACKET_TYPES_REVERSE[nt]?tt.length>1?{type:PACKET_TYPES_REVERSE[nt],data:tt.substring(1)}:{type:PACKET_TYPES_REVERSE[nt]}:ERROR_PACKET},decodeBase64Packet=(tt,et)=>{if(withNativeArrayBuffer$1){const nt=decode$1(tt);return mapBinary(nt,et)}else return{base64:!0,data:tt}},mapBinary=(tt,et)=>{switch(et){case"blob":return tt instanceof Blob?tt:new Blob([tt]);case"arraybuffer":default:return tt instanceof ArrayBuffer?tt:tt.buffer}},SEPARATOR=String.fromCharCode(30),encodePayload=(tt,et)=>{const nt=tt.length,rt=new Array(nt);let it=0;tt.forEach((ot,at)=>{encodePacket(ot,!1,st=>{rt[at]=st,++it===nt&&et(rt.join(SEPARATOR))})})},decodePayload=(tt,et)=>{const nt=tt.split(SEPARATOR),rt=[];for(let it=0;it{const rt=nt.length;let it;if(rt<126)it=new Uint8Array(1),new DataView(it.buffer).setUint8(0,rt);else if(rt<65536){it=new Uint8Array(3);const ot=new DataView(it.buffer);ot.setUint8(0,126),ot.setUint16(1,rt)}else{it=new Uint8Array(9);const ot=new DataView(it.buffer);ot.setUint8(0,127),ot.setBigUint64(1,BigInt(rt))}tt.data&&typeof tt.data!="string"&&(it[0]|=128),et.enqueue(it),et.enqueue(nt)})}})}let TEXT_DECODER;function totalLength(tt){return tt.reduce((et,nt)=>et+nt.length,0)}function concatChunks(tt,et){if(tt[0].length===et)return tt.shift();const nt=new Uint8Array(et);let rt=0;for(let it=0;itMath.pow(2,53-32)-1){st.enqueue(ERROR_PACKET);break}it=ut*Math.pow(2,32)+ct.getUint32(4),rt=3}else{if(totalLength(nt)tt){st.enqueue(ERROR_PACKET);break}}}})}const protocol$1=4;function Emitter(tt){if(tt)return mixin(tt)}function mixin(tt){for(var et in Emitter.prototype)tt[et]=Emitter.prototype[et];return tt}Emitter.prototype.on=Emitter.prototype.addEventListener=function(tt,et){return this._callbacks=this._callbacks||{},(this._callbacks["$"+tt]=this._callbacks["$"+tt]||[]).push(et),this};Emitter.prototype.once=function(tt,et){function nt(){this.off(tt,nt),et.apply(this,arguments)}return nt.fn=et,this.on(tt,nt),this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(tt,et){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var nt=this._callbacks["$"+tt];if(!nt)return this;if(arguments.length==1)return delete this._callbacks["$"+tt],this;for(var rt,it=0;ittypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function pick(tt,...et){return et.reduce((nt,rt)=>(tt.hasOwnProperty(rt)&&(nt[rt]=tt[rt]),nt),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(tt,et){et.useNativeTimers?(tt.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),tt.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(tt.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),tt.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(tt){return typeof tt=="string"?utf8Length(tt):Math.ceil((tt.byteLength||tt.size)*BASE64_OVERHEAD)}function utf8Length(tt){let et=0,nt=0;for(let rt=0,it=tt.length;rt=57344?nt+=3:(rt++,nt+=4);return nt}function encode$1(tt){let et="";for(let nt in tt)tt.hasOwnProperty(nt)&&(et.length&&(et+="&"),et+=encodeURIComponent(nt)+"="+encodeURIComponent(tt[nt]));return et}function decode(tt){let et={},nt=tt.split("&");for(let rt=0,it=nt.length;rt0);return et}function yeast(){const tt=encode(+new Date);return tt!==prev$1?(seed=0,prev$1=tt):tt+"."+encode(seed++)}for(;i$1{this.readyState="paused",et()};if(this.polling||!this.writable){let rt=0;this.polling&&(rt++,this.once("pollComplete",function(){--rt||nt()})),this.writable||(rt++,this.once("drain",function(){--rt||nt()}))}else nt()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(et){const nt=rt=>{if(this.readyState==="opening"&&rt.type==="open"&&this.onOpen(),rt.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(rt)};decodePayload(et,this.socket.binaryType).forEach(nt),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const et=()=>{this.write([{type:"close"}])};this.readyState==="open"?et():this.once("open",et)}write(et){this.writable=!1,encodePayload(et,nt=>{this.doWrite(nt,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const et=this.opts.secure?"https":"http",nt=this.query||{};return this.opts.timestampRequests!==!1&&(nt[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!nt.sid&&(nt.b64=1),this.createUri(et,nt)}request(et={}){return Object.assign(et,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),et)}doWrite(et,nt){const rt=this.request({method:"POST",data:et});rt.on("success",nt),rt.on("error",(it,ot)=>{this.onError("xhr post error",it,ot)})}doPoll(){const et=this.request();et.on("data",this.onData.bind(this)),et.on("error",(nt,rt)=>{this.onError("xhr poll error",nt,rt)}),this.pollXhr=et}}let Request$1=class O0 extends Emitter{constructor(et,nt){super(),installTimerFunctions(this,nt),this.opts=nt,this.method=nt.method||"GET",this.uri=et,this.data=nt.data!==void 0?nt.data:null,this.create()}create(){var et;const nt=pick(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");nt.xdomain=!!this.opts.xd;const rt=this.xhr=new XHR(nt);try{rt.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){rt.setDisableHeaderCheck&&rt.setDisableHeaderCheck(!0);for(let it in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(it)&&rt.setRequestHeader(it,this.opts.extraHeaders[it])}}catch{}if(this.method==="POST")try{rt.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{rt.setRequestHeader("Accept","*/*")}catch{}(et=this.opts.cookieJar)===null||et===void 0||et.addCookies(rt),"withCredentials"in rt&&(rt.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(rt.timeout=this.opts.requestTimeout),rt.onreadystatechange=()=>{var it;rt.readyState===3&&((it=this.opts.cookieJar)===null||it===void 0||it.parseCookies(rt)),rt.readyState===4&&(rt.status===200||rt.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof rt.status=="number"?rt.status:0)},0))},rt.send(this.data)}catch(it){this.setTimeoutFn(()=>{this.onError(it)},0);return}typeof document<"u"&&(this.index=O0.requestsCount++,O0.requests[this.index]=this)}onError(et){this.emitReserved("error",et,this.xhr),this.cleanup(!0)}cleanup(et){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty$1,et)try{this.xhr.abort()}catch{}typeof document<"u"&&delete O0.requests[this.index],this.xhr=null}}onLoad(){const et=this.xhr.responseText;et!==null&&(this.emitReserved("data",et),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Request$1.requestsCount=0;Request$1.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",unloadHandler);else if(typeof addEventListener=="function"){const tt="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(tt,unloadHandler,!1)}}function unloadHandler(){for(let tt in Request$1.requests)Request$1.requests.hasOwnProperty(tt)&&Request$1.requests[tt].abort()}const nextTick=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?et=>Promise.resolve().then(et):(et,nt)=>nt(et,0))(),WebSocket=globalThisShim.WebSocket||globalThisShim.MozWebSocket,usingBrowserWebSocket=!0,defaultBinaryType="arraybuffer",isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class WS extends Transport{constructor(et){super(et),this.supportsBinary=!et.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const et=this.uri(),nt=this.opts.protocols,rt=isReactNative?{}:pick(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(rt.headers=this.opts.extraHeaders);try{this.ws=usingBrowserWebSocket&&!isReactNative?nt?new WebSocket(et,nt):new WebSocket(et):new WebSocket(et,nt,rt)}catch(it){return this.emitReserved("error",it)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=et=>this.onClose({description:"websocket connection closed",context:et}),this.ws.onmessage=et=>this.onData(et.data),this.ws.onerror=et=>this.onError("websocket error",et)}write(et){this.writable=!1;for(let nt=0;nt{const at={};try{usingBrowserWebSocket&&this.ws.send(ot)}catch{}it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const et=this.opts.secure?"wss":"ws",nt=this.query||{};return this.opts.timestampRequests&&(nt[this.opts.timestampParam]=yeast()),this.supportsBinary||(nt.b64=1),this.createUri(et,nt)}check(){return!!WebSocket}}class WT extends Transport{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(et=>{this.onError("webtransport error",et)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(et=>{const nt=createPacketDecoderStream(Number.MAX_SAFE_INTEGER,this.socket.binaryType),rt=et.readable.pipeThrough(nt).getReader(),it=createPacketEncoderStream();it.readable.pipeTo(et.writable),this.writer=it.writable.getWriter();const ot=()=>{rt.read().then(({done:st,value:lt})=>{st||(this.onPacket(lt),ot())}).catch(st=>{})};ot();const at={type:"open"};this.query.sid&&(at.data=`{"sid":"${this.query.sid}"}`),this.writer.write(at).then(()=>this.onOpen())})}))}write(et){this.writable=!1;for(let nt=0;nt{it&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var et;(et=this.transport)===null||et===void 0||et.close()}}const transports={websocket:WS,webtransport:WT,polling:Polling},re$1=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function parse$1(tt){const et=tt,nt=tt.indexOf("["),rt=tt.indexOf("]");nt!=-1&&rt!=-1&&(tt=tt.substring(0,nt)+tt.substring(nt,rt).replace(/:/g,";")+tt.substring(rt,tt.length));let it=re$1.exec(tt||""),ot={},at=14;for(;at--;)ot[parts[at]]=it[at]||"";return nt!=-1&&rt!=-1&&(ot.source=et,ot.host=ot.host.substring(1,ot.host.length-1).replace(/;/g,":"),ot.authority=ot.authority.replace("[","").replace("]","").replace(/;/g,":"),ot.ipv6uri=!0),ot.pathNames=pathNames(ot,ot.path),ot.queryKey=queryKey(ot,ot.query),ot}function pathNames(tt,et){const nt=/\/{2,9}/g,rt=et.replace(nt,"/").split("/");return(et.slice(0,1)=="/"||et.length===0)&&rt.splice(0,1),et.slice(-1)=="/"&&rt.splice(rt.length-1,1),rt}function queryKey(tt,et){const nt={};return et.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(rt,it,ot){it&&(nt[it]=ot)}),nt}let Socket$1=class Hm extends Emitter{constructor(et,nt={}){super(),this.binaryType=defaultBinaryType,this.writeBuffer=[],et&&typeof et=="object"&&(nt=et,et=null),et?(et=parse$1(et),nt.hostname=et.host,nt.secure=et.protocol==="https"||et.protocol==="wss",nt.port=et.port,et.query&&(nt.query=et.query)):nt.host&&(nt.hostname=parse$1(nt.host).host),installTimerFunctions(this,nt),this.secure=nt.secure!=null?nt.secure:typeof location<"u"&&location.protocol==="https:",nt.hostname&&!nt.port&&(nt.port=this.secure?"443":"80"),this.hostname=nt.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=nt.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=nt.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},nt),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=decode(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(et){const nt=Object.assign({},this.opts.query);nt.EIO=protocol$1,nt.transport=et,this.id&&(nt.sid=this.id);const rt=Object.assign({},this.opts,{query:nt,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[et]);return new transports[et](rt)}open(){let et;if(this.opts.rememberUpgrade&&Hm.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)et="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else et=this.transports[0];this.readyState="opening";try{et=this.createTransport(et)}catch{this.transports.shift(),this.open();return}et.open(),this.setTransport(et)}setTransport(et){this.transport&&this.transport.removeAllListeners(),this.transport=et,et.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",nt=>this.onClose("transport close",nt))}probe(et){let nt=this.createTransport(et),rt=!1;Hm.priorWebsocketSuccess=!1;const it=()=>{rt||(nt.send([{type:"ping",data:"probe"}]),nt.once("packet",ht=>{if(!rt)if(ht.type==="pong"&&ht.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",nt),!nt)return;Hm.priorWebsocketSuccess=nt.name==="websocket",this.transport.pause(()=>{rt||this.readyState!=="closed"&&(ut(),this.setTransport(nt),nt.send([{type:"upgrade"}]),this.emitReserved("upgrade",nt),nt=null,this.upgrading=!1,this.flush())})}else{const dt=new Error("probe error");dt.transport=nt.name,this.emitReserved("upgradeError",dt)}}))};function ot(){rt||(rt=!0,ut(),nt.close(),nt=null)}const at=ht=>{const dt=new Error("probe error: "+ht);dt.transport=nt.name,ot(),this.emitReserved("upgradeError",dt)};function st(){at("transport closed")}function lt(){at("socket closed")}function ct(ht){nt&&ht.name!==nt.name&&ot()}const ut=()=>{nt.removeListener("open",it),nt.removeListener("error",at),nt.removeListener("close",st),this.off("close",lt),this.off("upgrading",ct)};nt.once("open",it),nt.once("error",at),nt.once("close",st),this.once("close",lt),this.once("upgrading",ct),this.upgrades.indexOf("webtransport")!==-1&&et!=="webtransport"?this.setTimeoutFn(()=>{rt||nt.open()},200):nt.open()}onOpen(){if(this.readyState="open",Hm.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let et=0;const nt=this.upgrades.length;for(;et{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const et=this.getWritablePackets();this.transport.send(et),this.prevBufferLen=et.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let nt=1;for(let rt=0;rt0&&nt>this.maxPayload)return this.writeBuffer.slice(0,rt);nt+=2}return this.writeBuffer}write(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}send(et,nt,rt){return this.sendPacket("message",et,nt,rt),this}sendPacket(et,nt,rt,it){if(typeof nt=="function"&&(it=nt,nt=void 0),typeof rt=="function"&&(it=rt,rt=null),this.readyState==="closing"||this.readyState==="closed")return;rt=rt||{},rt.compress=rt.compress!==!1;const ot={type:et,data:nt,options:rt};this.emitReserved("packetCreate",ot),this.writeBuffer.push(ot),it&&this.once("flush",it),this.flush()}close(){const et=()=>{this.onClose("forced close"),this.transport.close()},nt=()=>{this.off("upgrade",nt),this.off("upgradeError",nt),et()},rt=()=>{this.once("upgrade",nt),this.once("upgradeError",nt)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?rt():et()}):this.upgrading?rt():et()),this}onError(et){Hm.priorWebsocketSuccess=!1,this.emitReserved("error",et),this.onClose("transport error",et)}onClose(et,nt){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",et,nt),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(et){const nt=[];let rt=0;const it=et.length;for(;rttypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(tt):tt.buffer instanceof ArrayBuffer,toString$4=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$4.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$4.call(File)==="[object FileConstructor]";function isBinary(tt){return withNativeArrayBuffer&&(tt instanceof ArrayBuffer||isView(tt))||withNativeBlob&&tt instanceof Blob||withNativeFile&&tt instanceof File}function hasBinary(tt,et){if(!tt||typeof tt!="object")return!1;if(Array.isArray(tt)){for(let nt=0,rt=tt.length;nt=0&&tt.num{delete this.acks[et];for(let at=0;at{this.io.clearTimeoutFn(ot),nt.apply(this,[null,...at])}}emitWithAck(et,...nt){const rt=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((it,ot)=>{nt.push((at,st)=>rt?at?ot(at):it(st):it(at)),this.emit(et,...nt)})}_addToQueue(et){let nt;typeof et[et.length-1]=="function"&&(nt=et.pop());const rt={id:this._queueSeq++,tryCount:0,pending:!1,args:et,flags:Object.assign({fromQueue:!0},this.flags)};et.push((it,...ot)=>rt!==this._queue[0]?void 0:(it!==null?rt.tryCount>this._opts.retries&&(this._queue.shift(),nt&&nt(it)):(this._queue.shift(),nt&&nt(null,...ot)),rt.pending=!1,this._drainQueue())),this._queue.push(rt),this._drainQueue()}_drainQueue(et=!1){if(!this.connected||this._queue.length===0)return;const nt=this._queue[0];nt.pending&&!et||(nt.pending=!0,nt.tryCount++,this.flags=nt.flags,this.emit.apply(this,nt.args))}packet(et){et.nsp=this.nsp,this.io._packet(et)}onopen(){typeof this.auth=="function"?this.auth(et=>{this._sendConnectPacket(et)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(et){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},et):et})}onerror(et){this.connected||this.emitReserved("connect_error",et)}onclose(et,nt){this.connected=!1,delete this.id,this.emitReserved("disconnect",et,nt)}onpacket(et){if(et.nsp===this.nsp)switch(et.type){case PacketType.CONNECT:et.data&&et.data.sid?this.onconnect(et.data.sid,et.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case PacketType.EVENT:case PacketType.BINARY_EVENT:this.onevent(et);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(et);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const rt=new Error(et.data.message);rt.data=et.data.data,this.emitReserved("connect_error",rt);break}}onevent(et){const nt=et.data||[];et.id!=null&&nt.push(this.ack(et.id)),this.connected?this.emitEvent(nt):this.receiveBuffer.push(Object.freeze(nt))}emitEvent(et){if(this._anyListeners&&this._anyListeners.length){const nt=this._anyListeners.slice();for(const rt of nt)rt.apply(this,et)}super.emit.apply(this,et),this._pid&&et.length&&typeof et[et.length-1]=="string"&&(this._lastOffset=et[et.length-1])}ack(et){const nt=this;let rt=!1;return function(...it){rt||(rt=!0,nt.packet({type:PacketType.ACK,id:et,data:it}))}}onack(et){const nt=this.acks[et.id];typeof nt=="function"&&(nt.apply(this,et.data),delete this.acks[et.id])}onconnect(et,nt){this.id=et,this.recovered=nt&&this._pid===nt,this._pid=nt,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(et=>this.emitEvent(et)),this.receiveBuffer=[],this.sendBuffer.forEach(et=>{this.notifyOutgoingListeners(et),this.packet(et)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(et=>et()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:PacketType.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(et){return this.flags.compress=et,this}get volatile(){return this.flags.volatile=!0,this}timeout(et){return this.flags.timeout=et,this}onAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(et),this}prependAny(et){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(et),this}offAny(et){if(!this._anyListeners)return this;if(et){const nt=this._anyListeners;for(let rt=0;rt0&&tt.jitter<=1?tt.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var tt=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var et=Math.random(),nt=Math.floor(et*this.jitter*tt);tt=Math.floor(et*10)&1?tt+nt:tt-nt}return Math.min(tt,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(tt){this.ms=tt};Backoff.prototype.setMax=function(tt){this.max=tt};Backoff.prototype.setJitter=function(tt){this.jitter=tt};class Manager extends Emitter{constructor(et,nt){var rt;super(),this.nsps={},this.subs=[],et&&typeof et=="object"&&(nt=et,et=void 0),nt=nt||{},nt.path=nt.path||"/socket.io",this.opts=nt,installTimerFunctions(this,nt),this.reconnection(nt.reconnection!==!1),this.reconnectionAttempts(nt.reconnectionAttempts||1/0),this.reconnectionDelay(nt.reconnectionDelay||1e3),this.reconnectionDelayMax(nt.reconnectionDelayMax||5e3),this.randomizationFactor((rt=nt.randomizationFactor)!==null&&rt!==void 0?rt:.5),this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(nt.timeout==null?2e4:nt.timeout),this._readyState="closed",this.uri=et;const it=nt.parser||parser;this.encoder=new it.Encoder,this.decoder=new it.Decoder,this._autoConnect=nt.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(et){return arguments.length?(this._reconnection=!!et,this):this._reconnection}reconnectionAttempts(et){return et===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=et,this)}reconnectionDelay(et){var nt;return et===void 0?this._reconnectionDelay:(this._reconnectionDelay=et,(nt=this.backoff)===null||nt===void 0||nt.setMin(et),this)}randomizationFactor(et){var nt;return et===void 0?this._randomizationFactor:(this._randomizationFactor=et,(nt=this.backoff)===null||nt===void 0||nt.setJitter(et),this)}reconnectionDelayMax(et){var nt;return et===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=et,(nt=this.backoff)===null||nt===void 0||nt.setMax(et),this)}timeout(et){return arguments.length?(this._timeout=et,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(et){if(~this._readyState.indexOf("open"))return this;this.engine=new Socket$1(this.uri,this.opts);const nt=this.engine,rt=this;this._readyState="opening",this.skipReconnect=!1;const it=on(nt,"open",function(){rt.onopen(),et&&et()}),ot=st=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",st),et?et(st):this.maybeReconnectOnOpen()},at=on(nt,"error",ot);if(this._timeout!==!1){const st=this._timeout,lt=this.setTimeoutFn(()=>{it(),ot(new Error("timeout")),nt.close()},st);this.opts.autoUnref&<.unref(),this.subs.push(()=>{this.clearTimeoutFn(lt)})}return this.subs.push(it),this.subs.push(at),this}connect(et){return this.open(et)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const et=this.engine;this.subs.push(on(et,"ping",this.onping.bind(this)),on(et,"data",this.ondata.bind(this)),on(et,"error",this.onerror.bind(this)),on(et,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(et){try{this.decoder.add(et)}catch(nt){this.onclose("parse error",nt)}}ondecoded(et){nextTick(()=>{this.emitReserved("packet",et)},this.setTimeoutFn)}onerror(et){this.emitReserved("error",et)}socket(et,nt){let rt=this.nsps[et];return rt?this._autoConnect&&!rt.active&&rt.connect():(rt=new Socket(this,et,nt),this.nsps[et]=rt),rt}_destroy(et){const nt=Object.keys(this.nsps);for(const rt of nt)if(this.nsps[rt].active)return;this._close()}_packet(et){const nt=this.encoder.encode(et);for(let rt=0;rtet()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(et,nt){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",et,nt),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const et=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const nt=this.backoff.duration();this._reconnecting=!0;const rt=this.setTimeoutFn(()=>{et.skipReconnect||(this.emitReserved("reconnect_attempt",et.backoff.attempts),!et.skipReconnect&&et.open(it=>{it?(et._reconnecting=!1,et.reconnect(),this.emitReserved("reconnect_error",it)):et.onreconnect()}))},nt);this.opts.autoUnref&&rt.unref(),this.subs.push(()=>{this.clearTimeoutFn(rt)})}}onreconnect(){const et=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",et)}}const cache$1={};function lookup(tt,et){typeof tt=="object"&&(et=tt,tt=void 0),et=et||{};const nt=url(tt,et.path||"/socket.io"),rt=nt.source,it=nt.id,ot=nt.path,at=cache$1[it]&&ot in cache$1[it].nsps,st=et.forceNew||et["force new connection"]||et.multiplex===!1||at;let lt;return st?lt=new Manager(rt,et):(cache$1[it]||(cache$1[it]=new Manager(rt,et)),lt=cache$1[it]),nt.query&&!et.query&&(et.query=nt.queryKey),lt.socket(nt.path,et)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});const useSocket=()=>{const[tt,et]=reactExports.useState(null);return reactExports.useEffect(()=>{const nt=lookup(API_URL);return et(nt),()=>{nt.disconnect()}},[]),tt},defaultData$5={askedQuestions:null,askedQuestionsAnswers:null,hasQuestionInProgress:!1,hasTeachingInProgress:!1,hasInstagraphInProgress:!1,teachMeAnswer:null,instgraphAnswser:null},useTeachStore=react(tt=>({...defaultData$5,setAskedQuestion:et=>tt(nt=>({askedQuestions:[...nt.askedQuestions||[],et],hasQuestionInProgress:!0})),setAskedQuestionAnswer:et=>tt(nt=>({askedQuestionsAnswers:[...nt.askedQuestionsAnswers||[],et],hasQuestionInProgress:!1})),setHasQuestionInProgress:et=>tt({hasQuestionInProgress:et}),setHasTeachingInProgress:et=>tt({hasTeachingInProgress:et}),setHasInstagraphInProgress:et=>tt({hasInstagraphInProgress:et}),setTeachMeAnswer:et=>tt({hasTeachingInProgress:!1,teachMeAnswer:et}),setInstagraphAnswer:et=>{var nt,rt,it,ot;(nt=et==null?void 0:et.instagraph)!=null&&nt.edges&&((rt=et==null?void 0:et.instagraph)!=null&&rt.nodes)&&tt({hasInstagraphInProgress:!1,instgraphAnswser:{edges:(it=et==null?void 0:et.instagraph)==null?void 0:it.edges,nodes:(ot=et==null?void 0:et.instagraph)==null?void 0:ot.nodes}})}}));async function updateBudget(tt){const et=await distExports$1.getBudget();(et==null?void 0:et.msg)==="Invalid Action"?tt(null):et!=null&&et.budget&&tt(et.budget)}const version="0.1.105";function _extends$s(){return _extends$s=Object.assign||function(tt){for(var et=1;et=0)&&(nt[it]=tt[it]);return nt}function isNum(tt){return typeof tt=="number"&&!isNaN(tt)}function isBool(tt){return typeof tt=="boolean"}function isStr(tt){return typeof tt=="string"}function isFn(tt){return typeof tt=="function"}function parseClassName(tt){return isStr(tt)||isFn(tt)?tt:null}function isToastIdValid(tt){return tt===0||tt}function getAutoCloseDelay(tt,et){return tt===!1||isNum(tt)&&tt>0?tt:et}var canUseDom=!!(typeof window<"u"&&window.document&&window.document.createElement);function canBeRendered(tt){return reactExports.isValidElement(tt)||isStr(tt)||isFn(tt)||isNum(tt)}var POSITION={TOP_LEFT:"top-left",TOP_RIGHT:"top-right",TOP_CENTER:"top-center",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",BOTTOM_CENTER:"bottom-center"},TYPE={INFO:"info",SUCCESS:"success",WARNING:"warning",ERROR:"error",DEFAULT:"default"};function collapseToast(tt,et,nt){nt===void 0&&(nt=300);var rt=tt.scrollHeight,it=tt.style;requestAnimationFrame(function(){it.minHeight="initial",it.height=rt+"px",it.transition="all "+nt+"ms",requestAnimationFrame(function(){it.height="0",it.padding="0",it.margin="0",setTimeout(et,nt)})})}function cssTransition(tt){var et=tt.enter,nt=tt.exit,rt=tt.appendPosition,it=rt===void 0?!1:rt,ot=tt.collapse,at=ot===void 0?!0:ot,st=tt.collapseDuration,lt=st===void 0?300:st;return function(ut){var ht=ut.children,dt=ut.position,pt=ut.preventExitTransition,mt=ut.done,gt=ut.nodeRef,yt=ut.isIn,bt=it?et+"--"+dt:et,wt=it?nt+"--"+dt:nt,xt=reactExports.useRef(),kt=reactExports.useRef(0);reactExports.useLayoutEffect(function(){St()},[]),reactExports.useEffect(function(){yt||(pt?Et():At())},[yt]);function St(){var Ct=gt.current;xt.current=Ct.className,Ct.className+=" "+bt,Ct.addEventListener("animationend",Tt),Ct.addEventListener("animationcancel",Tt)}function Tt(Ct){if(Ct.target===gt.current){var Lt=gt.current;Lt.dispatchEvent(new Event("d")),Lt.removeEventListener("animationend",Tt),Lt.removeEventListener("animationcancel",Tt),kt.current===0&&(Lt.className=xt.current)}}function At(){kt.current=1;var Ct=gt.current;Ct.className+=" "+wt,Ct.addEventListener("animationend",Et)}function Et(){var Ct=gt.current;Ct.removeEventListener("animationend",Et),at?collapseToast(Ct,mt,lt):mt()}return React$1.createElement(React$1.Fragment,null,ht)}}var eventManager={list:new Map,emitQueue:new Map,on:function(et,nt){return this.list.has(et)||this.list.set(et,[]),this.list.get(et).push(nt),this},off:function(et,nt){if(nt){var rt=this.list.get(et).filter(function(it){return it!==nt});return this.list.set(et,rt),this}return this.list.delete(et),this},cancelEmit:function(et){var nt=this.emitQueue.get(et);return nt&&(nt.forEach(clearTimeout),this.emitQueue.delete(et)),this},emit:function(et){for(var nt=this,rt=arguments.length,it=new Array(rt>1?rt-1:0),ot=1;ot0){var Ot=isToastIdValid(Tt)?1:ct.props.limit;if(It===1||Ot===1)ct.displayedToast++,dt();else{var Wt=Ot>It?It:Ot;ct.displayedToast=Wt;for(var zt=0;zt0&&ct.count>Ct.limit&&jt?ct.queue.push({toastContent:$t,toastProps:Rt,staleId:kt}):isNum(xt)&&xt>0?setTimeout(function(){gt($t,Rt,kt)},xt):gt($t,Rt,kt)}}function gt(bt,wt,xt){var kt=wt.toastId;xt&&st.delete(xt),st.set(kt,{content:bt,props:wt}),ot(function(St){return[].concat(St,[kt]).filter(function(Tt){return Tt!==xt})})}function yt(bt){var wt=new Map,xt=Array.from(st.values());return tt.newestOnTop&&xt.reverse(),xt.forEach(function(kt){var St=kt.props.position;wt.has(St)||wt.set(St,[]),wt.get(St).push(kt)}),Array.from(wt,function(kt){return bt(kt[0],kt[1])})}return{getToastToRender:yt,containerRef:at,isToastActive:lt}}function getX$1(tt){return tt.targetTouches&&tt.targetTouches.length>=1?tt.targetTouches[0].clientX:tt.clientX}function getY$1(tt){return tt.targetTouches&&tt.targetTouches.length>=1?tt.targetTouches[0].clientY:tt.clientY}function useToast(tt){var et=reactExports.useState(!1),nt=et[0],rt=et[1],it=reactExports.useState(!1),ot=it[0],at=it[1],st=reactExports.useRef(null),lt=reactExports.useRef({start:0,x:0,y:0,delta:0,removalDistance:0,canCloseOnClick:!0,canDrag:!1,boundingRect:null,didMove:!1}).current,ct=reactExports.useRef(tt),ut=tt.autoClose,ht=tt.pauseOnHover,dt=tt.closeToast,pt=tt.onClick,mt=tt.closeOnClick;reactExports.useEffect(function(){ct.current=tt}),reactExports.useEffect(function(){return st.current&&st.current.addEventListener("d",bt,{once:!0}),isFn(tt.onOpen)&&tt.onOpen(reactExports.isValidElement(tt.children)&&tt.children.props),function(){var Lt=ct.current;isFn(Lt.onClose)&&Lt.onClose(reactExports.isValidElement(Lt.children)&&Lt.children.props)}},[]),reactExports.useEffect(function(){return tt.pauseOnFocusLoss&&xt(),function(){tt.pauseOnFocusLoss&&kt()}},[tt.pauseOnFocusLoss]);function gt(Lt){if(tt.draggable){St();var jt=st.current;lt.canCloseOnClick=!0,lt.canDrag=!0,lt.boundingRect=jt.getBoundingClientRect(),jt.style.transition="",lt.x=getX$1(Lt.nativeEvent),lt.y=getY$1(Lt.nativeEvent),tt.draggableDirection==="x"?(lt.start=lt.x,lt.removalDistance=jt.offsetWidth*(tt.draggablePercent/100)):(lt.start=lt.y,lt.removalDistance=jt.offsetHeight*(tt.draggablePercent===80?tt.draggablePercent*1.5:tt.draggablePercent/100))}}function yt(){if(lt.boundingRect){var Lt=lt.boundingRect,jt=Lt.top,Rt=Lt.bottom,$t=Lt.left,vt=Lt.right;tt.pauseOnHover&<.x>=$t&<.x<=vt&<.y>=jt&<.y<=Rt?wt():bt()}}function bt(){rt(!0)}function wt(){rt(!1)}function xt(){document.hasFocus()||wt(),window.addEventListener("focus",bt),window.addEventListener("blur",wt)}function kt(){window.removeEventListener("focus",bt),window.removeEventListener("blur",wt)}function St(){lt.didMove=!1,document.addEventListener("mousemove",At),document.addEventListener("mouseup",Et),document.addEventListener("touchmove",At),document.addEventListener("touchend",Et)}function Tt(){document.removeEventListener("mousemove",At),document.removeEventListener("mouseup",Et),document.removeEventListener("touchmove",At),document.removeEventListener("touchend",Et)}function At(Lt){var jt=st.current;lt.canDrag&&jt&&(lt.didMove=!0,nt&&wt(),lt.x=getX$1(Lt),lt.y=getY$1(Lt),tt.draggableDirection==="x"?lt.delta=lt.x-lt.start:lt.delta=lt.y-lt.start,lt.start!==lt.x&&(lt.canCloseOnClick=!1),jt.style.transform="translate"+tt.draggableDirection+"("+lt.delta+"px)",jt.style.opacity=""+(1-Math.abs(lt.delta/lt.removalDistance)))}function Et(){Tt();var Lt=st.current;if(lt.canDrag&<.didMove&&Lt){if(lt.canDrag=!1,Math.abs(lt.delta)>lt.removalDistance){at(!0),tt.closeToast();return}Lt.style.transition="transform 0.2s, opacity 0.2s",Lt.style.transform="translate"+tt.draggableDirection+"(0)",Lt.style.opacity="1"}}var Ct={onMouseDown:gt,onTouchStart:gt,onMouseUp:yt,onTouchEnd:yt};return ut&&ht&&(Ct.onMouseEnter=wt,Ct.onMouseLeave=bt),mt&&(Ct.onClick=function(Lt){pt&&pt(Lt),lt.canCloseOnClick&&dt()}),{playToast:bt,pauseToast:wt,isRunning:nt,preventExitTransition:ot,toastRef:st,eventHandlers:Ct}}function CloseButton$5(tt){var et=tt.closeToast,nt=tt.theme,rt=tt.ariaLabel,it=rt===void 0?"close":rt;return reactExports.createElement("button",{className:"Toastify__close-button Toastify__close-button--"+nt,type:"button",onClick:function(at){at.stopPropagation(),et(at)},"aria-label":it},reactExports.createElement("svg",{"aria-hidden":"true",viewBox:"0 0 14 16"},reactExports.createElement("path",{fillRule:"evenodd",d:"M7.71 8.23l3.75 3.75-1.48 1.48-3.75-3.75-3.75 3.75L1 11.98l3.75-3.75L1 4.48 2.48 3l3.75 3.75L9.98 3l1.48 1.48-3.75 3.75z"})))}function ProgressBar(tt){var et,nt,rt=tt.delay,it=tt.isRunning,ot=tt.closeToast,at=tt.type,st=tt.hide,lt=tt.className,ct=tt.style,ut=tt.controlledProgress,ht=tt.progress,dt=tt.rtl,pt=tt.isIn,mt=tt.theme,gt=_extends$s({},ct,{animationDuration:rt+"ms",animationPlayState:it?"running":"paused",opacity:st?0:1});ut&&(gt.transform="scaleX("+ht+")");var yt=clsx$4("Toastify__progress-bar",ut?"Toastify__progress-bar--controlled":"Toastify__progress-bar--animated","Toastify__progress-bar-theme--"+mt,"Toastify__progress-bar--"+at,(et={},et["Toastify__progress-bar--rtl"]=dt,et)),bt=isFn(lt)?lt({rtl:dt,type:at,defaultClassName:yt}):clsx$4(yt,lt),wt=(nt={},nt[ut&&ht>=1?"onTransitionEnd":"onAnimationEnd"]=ut&&ht<1?null:function(){pt&&ot()},nt);return reactExports.createElement("div",Object.assign({role:"progressbar","aria-hidden":st?"true":"false","aria-label":"notification timer",className:bt,style:gt},wt))}ProgressBar.defaultProps={type:TYPE.DEFAULT,hide:!1};var _excluded$1$1=["theme","type"],Svg=function(et){var nt=et.theme,rt=et.type,it=_objectWithoutPropertiesLoose$k(et,_excluded$1$1);return reactExports.createElement("svg",Object.assign({viewBox:"0 0 24 24",width:"100%",height:"100%",fill:nt==="colored"?"currentColor":"var(--toastify-icon-color-"+rt+")"},it))};function Warning(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.251-1.746-.68-2.44zm-9.622 1.46c0 1.033-.724 1.823-1.698 1.823s-1.698-.79-1.698-1.822v-.043c0-1.028.724-1.822 1.698-1.822s1.698.79 1.698 1.822v.043zm.039-12.285l-.84 8.06c-.057.581-.408.943-.897.943-.49 0-.84-.367-.896-.942l-.84-8.065c-.057-.624.25-1.095.779-1.095h1.91c.528.005.84.476.784 1.1z"}))}function Info(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 11-1.5 1.5 1.5 1.5 0 011.5-1.5zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"}))}function Success(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"}))}function Error$1(tt){return reactExports.createElement(Svg,Object.assign({},tt),reactExports.createElement("path",{d:"M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"}))}function Spinner(){return reactExports.createElement("div",{className:"Toastify__spinner"})}var Icons={info:Info,warning:Warning,success:Success,error:Error$1,spinner:Spinner},Toast=function(et){var nt,rt,it=useToast(et),ot=it.isRunning,at=it.preventExitTransition,st=it.toastRef,lt=it.eventHandlers,ct=et.closeButton,ut=et.children,ht=et.autoClose,dt=et.onClick,pt=et.type,mt=et.hideProgressBar,gt=et.closeToast,yt=et.transition,bt=et.position,wt=et.className,xt=et.style,kt=et.bodyClassName,St=et.bodyStyle,Tt=et.progressClassName,At=et.progressStyle,Et=et.updateId,Ct=et.role,Lt=et.progress,jt=et.rtl,Rt=et.toastId,$t=et.deleteToast,vt=et.isIn,It=et.isLoading,Ot=et.icon,Wt=et.theme,zt=clsx$4("Toastify__toast","Toastify__toast-theme--"+Wt,"Toastify__toast--"+pt,(nt={},nt["Toastify__toast--rtl"]=jt,nt)),Ft=isFn(wt)?wt({rtl:jt,position:bt,type:pt,defaultClassName:zt}):clsx$4(zt,wt),Nt=!!Lt,Ut=Icons[pt],Pt={theme:Wt,type:pt},Ht=Ut&&Ut(Pt);Ot===!1?Ht=void 0:isFn(Ot)?Ht=Ot(Pt):reactExports.isValidElement(Ot)?Ht=reactExports.cloneElement(Ot,Pt):isStr(Ot)?Ht=Ot:It&&(Ht=Icons.spinner());function Qt(an){if(an){var Yt={closeToast:gt,type:pt,theme:Wt};if(isFn(an))return an(Yt);if(reactExports.isValidElement(an))return reactExports.cloneElement(an,Yt)}}return reactExports.createElement(yt,{isIn:vt,done:$t,position:bt,preventExitTransition:at,nodeRef:st},reactExports.createElement("div",Object.assign({id:Rt,onClick:dt,className:Ft},lt,{style:xt,ref:st}),reactExports.createElement("div",Object.assign({},vt&&{role:Ct},{className:isFn(kt)?kt({type:pt}):clsx$4("Toastify__toast-body",kt),style:St}),Ht&&reactExports.createElement("div",{className:clsx$4("Toastify__toast-icon",(rt={},rt["Toastify--animate-icon Toastify__zoom-enter"]=!It,rt))},Ht),reactExports.createElement("div",null,ut)),Qt(ct),(ht||Nt)&&reactExports.createElement(ProgressBar,Object.assign({},Et&&!Nt?{key:"pb-"+Et}:{},{rtl:jt,theme:Wt,delay:ht,isRunning:ot,isIn:vt,closeToast:gt,hide:mt,type:pt,style:At,className:Tt,controlledProgress:Nt,progress:Lt}))))},Bounce=cssTransition({enter:"Toastify--animate Toastify__bounce-enter",exit:"Toastify--animate Toastify__bounce-exit",appendPosition:!0}),ToastContainer=function(et){var nt=useToastContainer(et),rt=nt.getToastToRender,it=nt.containerRef,ot=nt.isToastActive,at=et.className,st=et.style,lt=et.rtl,ct=et.containerId;function ut(ht){var dt,pt=clsx$4("Toastify__toast-container","Toastify__toast-container--"+ht,(dt={},dt["Toastify__toast-container--rtl"]=lt,dt));return isFn(at)?at({position:ht,rtl:lt,defaultClassName:pt}):clsx$4(pt,parseClassName(at))}return reactExports.createElement("div",{ref:it,className:"Toastify",id:ct},rt(function(ht,dt){var pt=dt.length?_extends$s({},st):_extends$s({},st,{pointerEvents:"none"});return reactExports.createElement("div",{className:ut(ht),style:pt,key:"container-"+ht},dt.map(function(mt){var gt=mt.content,yt=mt.props;return reactExports.createElement(Toast,Object.assign({},yt,{isIn:ot(yt.toastId),key:"toast-"+yt.key,closeButton:yt.closeButton===!0?CloseButton$5:yt.closeButton}),gt)}))}))};ToastContainer.defaultProps={position:POSITION.TOP_RIGHT,transition:Bounce,rtl:!1,autoClose:5e3,hideProgressBar:!1,closeButton:CloseButton$5,pauseOnHover:!0,pauseOnFocusLoss:!0,closeOnClick:!0,newestOnTop:!1,draggable:!0,draggablePercent:80,draggableDirection:"x",role:"alert",theme:"light"};var containers=new Map,latestInstance,containerDomNode,containerConfig,queue=[],lazy=!1;function getToast(tt,et){var nt=et.containerId,rt=containers.get(nt||latestInstance);return rt?rt.getToast(tt):null}function generateToastId(){return Math.random().toString(36).substring(2,9)}function getToastId(tt){return tt&&(isStr(tt.toastId)||isNum(tt.toastId))?tt.toastId:generateToastId()}function dispatchToast(tt,et){return containers.size>0?eventManager.emit(0,tt,et):(queue.push({content:tt,options:et}),lazy&&canUseDom&&(lazy=!1,containerDomNode=document.createElement("div"),document.body.appendChild(containerDomNode),reactDomExports.render(reactExports.createElement(ToastContainer,Object.assign({},containerConfig)),containerDomNode))),et.toastId}function mergeOptions(tt,et){return _extends$s({},et,{type:et&&et.type||tt,toastId:getToastId(et)})}function createToastByType(tt){return function(et,nt){return dispatchToast(et,mergeOptions(tt,nt))}}function toast(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,et))}toast.loading=function(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,_extends$s({isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1},et)))};function handlePromise(tt,et,nt){var rt=et.pending,it=et.error,ot=et.success,at;rt&&(at=isStr(rt)?toast.loading(rt,nt):toast.loading(rt.render,_extends$s({},nt,rt)));var st={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},lt=function(ht,dt,pt){if(dt==null){toast.dismiss(at);return}var mt=_extends$s({type:ht},st,nt,{data:pt}),gt=isStr(dt)?{render:dt}:dt;return at?toast.update(at,_extends$s({},mt,gt)):toast(gt.render,_extends$s({},mt,gt)),pt},ct=isFn(tt)?tt():tt;return ct.then(function(ut){return lt("success",ot,ut)}).catch(function(ut){return lt("error",it,ut)}),ct}toast.promise=handlePromise;toast.success=createToastByType(TYPE.SUCCESS);toast.info=createToastByType(TYPE.INFO);toast.error=createToastByType(TYPE.ERROR);toast.warning=createToastByType(TYPE.WARNING);toast.warn=toast.warning;toast.dark=function(tt,et){return dispatchToast(tt,mergeOptions(TYPE.DEFAULT,_extends$s({theme:"dark"},et)))};toast.dismiss=function(tt){return eventManager.emit(1,tt)};toast.clearWaitingQueue=function(tt){return tt===void 0&&(tt={}),eventManager.emit(5,tt)};toast.isActive=function(tt){var et=!1;return containers.forEach(function(nt){nt.isToastActive&&nt.isToastActive(tt)&&(et=!0)}),et};toast.update=function(tt,et){et===void 0&&(et={}),setTimeout(function(){var nt=getToast(tt,et);if(nt){var rt=nt.props,it=nt.content,ot=_extends$s({},rt,et,{toastId:et.toastId||tt,updateId:generateToastId()});ot.toastId!==tt&&(ot.staleId=tt);var at=ot.render||it;delete ot.render,dispatchToast(at,ot)}},0)};toast.done=function(tt){toast.update(tt,{progress:1})};toast.onChange=function(tt){return isFn(tt)&&eventManager.on(4,tt),function(){isFn(tt)&&eventManager.off(4,tt)}};toast.configure=function(tt){tt===void 0&&(tt={}),lazy=!0,containerConfig=tt};toast.POSITION=POSITION;toast.TYPE=TYPE;eventManager.on(2,function(tt){latestInstance=tt.containerId||tt,containers.set(latestInstance,tt),queue.forEach(function(et){eventManager.emit(0,et.content,et.options)}),queue=[]}).on(3,function(tt){containers.delete(tt.containerId||tt),containers.size===0&&eventManager.off(0).off(1).off(5),canUseDom&&containerDomNode&&document.body.removeChild(containerDomNode)});const defaultData$4={addNodeModalData:null,currentModals:{budgetExplanation:!1,sourcesTable:!1,addContent:!1,editTopic:!1,addSource:!1}},useModalStore=create$3(tt=>({...defaultData$4,close:et=>{tt(nt=>({addNodeModalData:null,currentModals:{...nt.currentModals,[et]:!1}}))},open:et=>{tt(nt=>({currentModals:{...nt.currentModals,[et]:!0}}))}})),useModal$1=tt=>{const{open:et,close:nt,currentModals:rt}=useModalStore();return{close:()=>nt(tt),open:()=>et(tt),visible:rt[tt]}},ClearIcon$1=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 32 32",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("g",{id:"Property 1=press",children:jsxRuntimeExports.jsx("path",{id:"close",d:"M16 17.2833L11.5083 21.775C11.3403 21.943 11.1264 22.0271 10.8667 22.0271C10.6069 22.0271 10.393 21.943 10.225 21.775C10.0569 21.6069 9.9729 21.393 9.9729 21.1333C9.9729 20.8736 10.0569 20.6597 10.225 20.4917L14.7167 16L10.225 11.5083C10.0569 11.3403 9.9729 11.1264 9.9729 10.8667C9.9729 10.6069 10.0569 10.393 10.225 10.225C10.393 10.0569 10.6069 9.9729 10.8667 9.9729C11.1264 9.9729 11.3403 10.0569 11.5083 10.225L16 14.7167L20.4917 10.225C20.6597 10.0569 20.8736 9.9729 21.1333 9.9729C21.393 9.9729 21.6069 10.0569 21.775 10.225C21.943 10.393 22.0271 10.6069 22.0271 10.8667C22.0271 11.1264 21.943 11.3403 21.775 11.5083L17.2833 16L21.775 20.4917C21.943 20.6597 22.0271 20.8736 22.0271 21.1333C22.0271 21.393 21.943 21.6069 21.775 21.775C21.6069 21.943 21.393 22.0271 21.1333 22.0271C20.8736 22.0271 20.6597 21.943 20.4917 21.775L16 17.2833Z",fill:"currentColor"})})}),scaleAnimation=We` 0% { transform: scale(0.8); } @@ -5899,7 +5899,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `,emptyValue={},HelperContext=reactExports.createContext(emptyValue),useHelper=()=>reactExports.useContext(HelperContext);function cc(tt){if(typeof tt=="string"||typeof tt=="number")return""+tt;let et="";if(Array.isArray(tt))for(let nt=0,rt;nt{const nt=createStore$3(tt),rt=(it,ot=et)=>useStoreWithEqualityFn(nt,it,ot);return Object.assign(rt,nt),rt},createWithEqualityFn=(tt,et)=>tt?createWithEqualityFnImpl(tt,et):createWithEqualityFnImpl;function shallow$1(tt,et){if(Object.is(tt,et))return!0;if(typeof tt!="object"||tt===null||typeof et!="object"||et===null)return!1;if(tt instanceof Map&&et instanceof Map){if(tt.size!==et.size)return!1;for(const[rt,it]of tt)if(!Object.is(it,et.get(rt)))return!1;return!0}if(tt instanceof Set&&et instanceof Set){if(tt.size!==et.size)return!1;for(const rt of tt)if(!et.has(rt))return!1;return!0}const nt=Object.keys(tt);if(nt.length!==Object.keys(et).length)return!1;for(let rt=0;rt=0&&(et=tt.slice(0,nt))!=="xmlns"&&(tt=tt.slice(nt+1)),namespaces.hasOwnProperty(et)?{space:namespaces[et],local:tt}:tt}function creatorInherit(tt){return function(){var et=this.ownerDocument,nt=this.namespaceURI;return nt===xhtml&&et.documentElement.namespaceURI===xhtml?et.createElement(tt):et.createElementNS(nt,tt)}}function creatorFixed(tt){return function(){return this.ownerDocument.createElementNS(tt.space,tt.local)}}function creator(tt){var et=namespace(tt);return(et.local?creatorFixed:creatorInherit)(et)}function none(){}function selector(tt){return tt==null?none:function(){return this.querySelector(tt)}}function selection_select(tt){typeof tt!="function"&&(tt=selector(tt));for(var et=this._groups,nt=et.length,rt=new Array(nt),it=0;it=xt&&(xt=wt+1);!(St=yt[xt])&&++xt=0;)(at=rt[it])&&(ot&&at.compareDocumentPosition(ot)^4&&ot.parentNode.insertBefore(at,ot),ot=at);return this}function selection_sort(tt){tt||(tt=ascending);function et(ht,dt){return ht&&dt?tt(ht.__data__,dt.__data__):!ht-!dt}for(var nt=this._groups,rt=nt.length,it=new Array(rt),ot=0;otet?1:tt>=et?0:NaN}function selection_call(){var tt=arguments[0];return arguments[0]=this,tt.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var tt=this._groups,et=0,nt=tt.length;et1?this.each((et==null?styleRemove$1:typeof et=="function"?styleFunction$1:styleConstant$1)(tt,et,nt??"")):styleValue(this.node(),tt)}function styleValue(tt,et){return tt.style.getPropertyValue(et)||defaultView(tt).getComputedStyle(tt,null).getPropertyValue(et)}function propertyRemove(tt){return function(){delete this[tt]}}function propertyConstant(tt,et){return function(){this[tt]=et}}function propertyFunction(tt,et){return function(){var nt=et.apply(this,arguments);nt==null?delete this[tt]:this[tt]=nt}}function selection_property(tt,et){return arguments.length>1?this.each((et==null?propertyRemove:typeof et=="function"?propertyFunction:propertyConstant)(tt,et)):this.node()[tt]}function classArray(tt){return tt.trim().split(/^|\s+/)}function classList(tt){return tt.classList||new ClassList(tt)}function ClassList(tt){this._node=tt,this._names=classArray(tt.getAttribute("class")||"")}ClassList.prototype={add:function(tt){var et=this._names.indexOf(tt);et<0&&(this._names.push(tt),this._node.setAttribute("class",this._names.join(" ")))},remove:function(tt){var et=this._names.indexOf(tt);et>=0&&(this._names.splice(et,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(tt){return this._names.indexOf(tt)>=0}};function classedAdd(tt,et){for(var nt=classList(tt),rt=-1,it=et.length;++rt=0&&(nt=et.slice(rt+1),et=et.slice(0,rt)),{type:et,name:nt}})}function onRemove(tt){return function(){var et=this.__on;if(et){for(var nt=0,rt=-1,it=et.length,ot;nt()=>tt;function DragEvent(tt,{sourceEvent:et,subject:nt,target:rt,identifier:it,active:ot,x:at,y:st,dx:lt,dy:ct,dispatch:ut}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},subject:{value:nt,enumerable:!0,configurable:!0},target:{value:rt,enumerable:!0,configurable:!0},identifier:{value:it,enumerable:!0,configurable:!0},active:{value:ot,enumerable:!0,configurable:!0},x:{value:at,enumerable:!0,configurable:!0},y:{value:st,enumerable:!0,configurable:!0},dx:{value:lt,enumerable:!0,configurable:!0},dy:{value:ct,enumerable:!0,configurable:!0},_:{value:ut}})}DragEvent.prototype.on=function(){var tt=this._.on.apply(this._,arguments);return tt===this._?this:tt};function defaultFilter$1(tt){return!tt.ctrlKey&&!tt.button}function defaultContainer(){return this.parentNode}function defaultSubject(tt,et){return et??{x:tt.x,y:tt.y}}function defaultTouchable$1(){return navigator.maxTouchPoints||"ontouchstart"in this}function drag(){var tt=defaultFilter$1,et=defaultContainer,nt=defaultSubject,rt=defaultTouchable$1,it={},ot=dispatch("start","drag","end"),at=0,st,lt,ct,ut,ht=0;function dt(kt){kt.on("mousedown.drag",pt).filter(rt).on("touchstart.drag",yt).on("touchmove.drag",bt,nonpassive).on("touchend.drag touchcancel.drag",wt).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function pt(kt,St){if(!(ut||!tt.call(this,kt,St))){var Tt=xt(this,et.call(this,kt,St),kt,St,"mouse");Tt&&(select(kt.view).on("mousemove.drag",mt,nonpassivecapture).on("mouseup.drag",gt,nonpassivecapture),dragDisable(kt.view),nopropagation$1(kt),ct=!1,st=kt.clientX,lt=kt.clientY,Tt("start",kt))}}function mt(kt){if(noevent$1(kt),!ct){var St=kt.clientX-st,Tt=kt.clientY-lt;ct=St*St+Tt*Tt>ht}it.mouse("drag",kt)}function gt(kt){select(kt.view).on("mousemove.drag mouseup.drag",null),yesdrag(kt.view,ct),noevent$1(kt),it.mouse("end",kt)}function yt(kt,St){if(tt.call(this,kt,St)){var Tt=kt.changedTouches,At=et.call(this,kt,St),Et=Tt.length,Ct,Lt;for(Ct=0;CtCREATED)throw new Error("too late; already scheduled");return nt}function set(tt,et){var nt=get(tt,et);if(nt.state>STARTED)throw new Error("too late; already running");return nt}function get(tt,et){var nt=tt.__transition;if(!nt||!(nt=nt[et]))throw new Error("transition not found");return nt}function create(tt,et,nt){var rt=tt.__transition,it;rt[et]=nt,nt.timer=timer$1(ot,0,nt.time);function ot(ct){nt.state=SCHEDULED,nt.timer.restart(at,nt.delay,nt.time),nt.delay<=ct&&at(ct-nt.delay)}function at(ct){var ut,ht,dt,pt;if(nt.state!==SCHEDULED)return lt();for(ut in rt)if(pt=rt[ut],pt.name===nt.name){if(pt.state===STARTED)return timeout(at);pt.state===RUNNING?(pt.state=ENDED,pt.timer.stop(),pt.on.call("interrupt",tt,tt.__data__,pt.index,pt.group),delete rt[ut]):+utSTARTING&&rt.state=0&&(et=et.slice(0,nt)),!et||et==="start"})}function onFunction(tt,et,nt){var rt,it,ot=start(et)?init:set;return function(){var at=ot(this,tt),st=at.on;st!==rt&&(it=(rt=st).copy()).on(et,nt),at.on=it}}function transition_on(tt,et){var nt=this._id;return arguments.length<2?get(this.node(),nt).on.on(tt):this.each(onFunction(nt,tt,et))}function removeFunction(tt){return function(){var et=this.parentNode;for(var nt in this.__transition)if(+nt!==tt)return;et&&et.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(tt){var et=this._name,nt=this._id;typeof tt!="function"&&(tt=selector(tt));for(var rt=this._groups,it=rt.length,ot=new Array(it),at=0;at()=>tt;function ZoomEvent(tt,{sourceEvent:et,target:nt,transform:rt,dispatch:it}){Object.defineProperties(this,{type:{value:tt,enumerable:!0,configurable:!0},sourceEvent:{value:et,enumerable:!0,configurable:!0},target:{value:nt,enumerable:!0,configurable:!0},transform:{value:rt,enumerable:!0,configurable:!0},_:{value:it}})}function Transform(tt,et,nt){this.k=tt,this.x=et,this.y=nt}Transform.prototype={constructor:Transform,scale:function(tt){return tt===1?this:new Transform(this.k*tt,this.x,this.y)},translate:function(tt,et){return tt===0&et===0?this:new Transform(this.k,this.x+this.k*tt,this.y+this.k*et)},apply:function(tt){return[tt[0]*this.k+this.x,tt[1]*this.k+this.y]},applyX:function(tt){return tt*this.k+this.x},applyY:function(tt){return tt*this.k+this.y},invert:function(tt){return[(tt[0]-this.x)/this.k,(tt[1]-this.y)/this.k]},invertX:function(tt){return(tt-this.x)/this.k},invertY:function(tt){return(tt-this.y)/this.k},rescaleX:function(tt){return tt.copy().domain(tt.range().map(this.invertX,this).map(tt.invert,tt))},rescaleY:function(tt){return tt.copy().domain(tt.range().map(this.invertY,this).map(tt.invert,tt))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity=new Transform(1,0,0);Transform.prototype;function nopropagation(tt){tt.stopImmediatePropagation()}function noevent(tt){tt.preventDefault(),tt.stopImmediatePropagation()}function defaultFilter(tt){return(!tt.ctrlKey||tt.type==="wheel")&&!tt.button}function defaultExtent(){var tt=this;return tt instanceof SVGElement?(tt=tt.ownerSVGElement||tt,tt.hasAttribute("viewBox")?(tt=tt.viewBox.baseVal,[[tt.x,tt.y],[tt.x+tt.width,tt.y+tt.height]]):[[0,0],[tt.width.baseVal.value,tt.height.baseVal.value]]):[[0,0],[tt.clientWidth,tt.clientHeight]]}function defaultTransform(){return this.__zoom||identity}function defaultWheelDelta(tt){return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*(tt.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(tt,et,nt){var rt=tt.invertX(et[0][0])-nt[0][0],it=tt.invertX(et[1][0])-nt[1][0],ot=tt.invertY(et[0][1])-nt[0][1],at=tt.invertY(et[1][1])-nt[1][1];return tt.translate(it>rt?(rt+it)/2:Math.min(0,rt)||Math.max(0,it),at>ot?(ot+at)/2:Math.min(0,ot)||Math.max(0,at))}function zoom(){var tt=defaultFilter,et=defaultExtent,nt=defaultConstrain,rt=defaultWheelDelta,it=defaultTouchable,ot=[0,1/0],at=[[-1/0,-1/0],[1/0,1/0]],st=250,lt=interpolateZoom,ct=dispatch("start","zoom","end"),ut,ht,dt,pt=500,mt=150,gt=0,yt=10;function bt(vt){vt.property("__zoom",defaultTransform).on("wheel.zoom",Et,{passive:!1}).on("mousedown.zoom",Ct).on("dblclick.zoom",Lt).filter(it).on("touchstart.zoom",jt).on("touchmove.zoom",Rt).on("touchend.zoom touchcancel.zoom",$t).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}bt.transform=function(vt,It,Ot,Wt){var zt=vt.selection?vt.selection():vt;zt.property("__zoom",defaultTransform),vt!==zt?St(vt,It,Ot,Wt):zt.interrupt().each(function(){Tt(this,arguments).event(Wt).start().zoom(null,typeof It=="function"?It.apply(this,arguments):It).end()})},bt.scaleBy=function(vt,It,Ot,Wt){bt.scaleTo(vt,function(){var zt=this.__zoom.k,Ft=typeof It=="function"?It.apply(this,arguments):It;return zt*Ft},Ot,Wt)},bt.scaleTo=function(vt,It,Ot,Wt){bt.transform(vt,function(){var zt=et.apply(this,arguments),Ft=this.__zoom,Nt=Ot==null?kt(zt):typeof Ot=="function"?Ot.apply(this,arguments):Ot,Ut=Ft.invert(Nt),Pt=typeof It=="function"?It.apply(this,arguments):It;return nt(xt(wt(Ft,Pt),Nt,Ut),zt,at)},Ot,Wt)},bt.translateBy=function(vt,It,Ot,Wt){bt.transform(vt,function(){return nt(this.__zoom.translate(typeof It=="function"?It.apply(this,arguments):It,typeof Ot=="function"?Ot.apply(this,arguments):Ot),et.apply(this,arguments),at)},null,Wt)},bt.translateTo=function(vt,It,Ot,Wt,zt){bt.transform(vt,function(){var Ft=et.apply(this,arguments),Nt=this.__zoom,Ut=Wt==null?kt(Ft):typeof Wt=="function"?Wt.apply(this,arguments):Wt;return nt(identity.translate(Ut[0],Ut[1]).scale(Nt.k).translate(typeof It=="function"?-It.apply(this,arguments):-It,typeof Ot=="function"?-Ot.apply(this,arguments):-Ot),Ft,at)},Wt,zt)};function wt(vt,It){return It=Math.max(ot[0],Math.min(ot[1],It)),It===vt.k?vt:new Transform(It,vt.x,vt.y)}function xt(vt,It,Ot){var Wt=It[0]-Ot[0]*vt.k,zt=It[1]-Ot[1]*vt.k;return Wt===vt.x&&zt===vt.y?vt:new Transform(vt.k,Wt,zt)}function kt(vt){return[(+vt[0][0]+ +vt[1][0])/2,(+vt[0][1]+ +vt[1][1])/2]}function St(vt,It,Ot,Wt){vt.on("start.zoom",function(){Tt(this,arguments).event(Wt).start()}).on("interrupt.zoom end.zoom",function(){Tt(this,arguments).event(Wt).end()}).tween("zoom",function(){var zt=this,Ft=arguments,Nt=Tt(zt,Ft).event(Wt),Ut=et.apply(zt,Ft),Pt=Ot==null?kt(Ut):typeof Ot=="function"?Ot.apply(zt,Ft):Ot,Ht=Math.max(Ut[1][0]-Ut[0][0],Ut[1][1]-Ut[0][1]),Qt=zt.__zoom,an=typeof It=="function"?It.apply(zt,Ft):It,Yt=lt(Qt.invert(Pt).concat(Ht/Qt.k),an.invert(Pt).concat(Ht/an.k));return function(nn){if(nn===1)nn=an;else{var tn=Yt(nn),dn=Ht/tn[2];nn=new Transform(dn,Pt[0]-tn[0]*dn,Pt[1]-tn[1]*dn)}Nt.zoom(null,nn)}})}function Tt(vt,It,Ot){return!Ot&&vt.__zooming||new At(vt,It)}function At(vt,It){this.that=vt,this.args=It,this.active=0,this.sourceEvent=null,this.extent=et.apply(vt,It),this.taps=0}At.prototype={event:function(vt){return vt&&(this.sourceEvent=vt),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(vt,It){return this.mouse&&vt!=="mouse"&&(this.mouse[1]=It.invert(this.mouse[0])),this.touch0&&vt!=="touch"&&(this.touch0[1]=It.invert(this.touch0[0])),this.touch1&&vt!=="touch"&&(this.touch1[1]=It.invert(this.touch1[0])),this.that.__zoom=It,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(vt){var It=select(this.that).datum();ct.call(vt,this.that,new ZoomEvent(vt,{sourceEvent:this.sourceEvent,target:bt,type:vt,transform:this.that.__zoom,dispatch:ct}),It)}};function Et(vt,...It){if(!tt.apply(this,arguments))return;var Ot=Tt(this,It).event(vt),Wt=this.__zoom,zt=Math.max(ot[0],Math.min(ot[1],Wt.k*Math.pow(2,rt.apply(this,arguments)))),Ft=pointer(vt);if(Ot.wheel)(Ot.mouse[0][0]!==Ft[0]||Ot.mouse[0][1]!==Ft[1])&&(Ot.mouse[1]=Wt.invert(Ot.mouse[0]=Ft)),clearTimeout(Ot.wheel);else{if(Wt.k===zt)return;Ot.mouse=[Ft,Wt.invert(Ft)],interrupt(this),Ot.start()}noevent(vt),Ot.wheel=setTimeout(Nt,mt),Ot.zoom("mouse",nt(xt(wt(Wt,zt),Ot.mouse[0],Ot.mouse[1]),Ot.extent,at));function Nt(){Ot.wheel=null,Ot.end()}}function Ct(vt,...It){if(dt||!tt.apply(this,arguments))return;var Ot=vt.currentTarget,Wt=Tt(this,It,!0).event(vt),zt=select(vt.view).on("mousemove.zoom",Pt,!0).on("mouseup.zoom",Ht,!0),Ft=pointer(vt,Ot),Nt=vt.clientX,Ut=vt.clientY;dragDisable(vt.view),nopropagation(vt),Wt.mouse=[Ft,this.__zoom.invert(Ft)],interrupt(this),Wt.start();function Pt(Qt){if(noevent(Qt),!Wt.moved){var an=Qt.clientX-Nt,Yt=Qt.clientY-Ut;Wt.moved=an*an+Yt*Yt>gt}Wt.event(Qt).zoom("mouse",nt(xt(Wt.that.__zoom,Wt.mouse[0]=pointer(Qt,Ot),Wt.mouse[1]),Wt.extent,at))}function Ht(Qt){zt.on("mousemove.zoom mouseup.zoom",null),yesdrag(Qt.view,Wt.moved),noevent(Qt),Wt.event(Qt).end()}}function Lt(vt,...It){if(tt.apply(this,arguments)){var Ot=this.__zoom,Wt=pointer(vt.changedTouches?vt.changedTouches[0]:vt,this),zt=Ot.invert(Wt),Ft=Ot.k*(vt.shiftKey?.5:2),Nt=nt(xt(wt(Ot,Ft),Wt,zt),et.apply(this,It),at);noevent(vt),st>0?select(this).transition().duration(st).call(St,Nt,Wt,vt):select(this).call(bt.transform,Nt,Wt,vt)}}function jt(vt,...It){if(tt.apply(this,arguments)){var Ot=vt.touches,Wt=Ot.length,zt=Tt(this,It,vt.changedTouches.length===Wt).event(vt),Ft,Nt,Ut,Pt;for(nopropagation(vt),Nt=0;Nt"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:tt=>`Node type "${tt}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:tt=>`The old edge with id=${tt} does not exist.`,error009:tt=>`Marker type "${tt}" doesn't exist.`,error008:(tt,et)=>`Couldn't create edge for ${tt?"target":"source"} handle id: "${tt?et.targetHandle:et.sourceHandle}", edge id: ${et.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:tt=>`Edge type "${tt}" not found. Using fallback type "default".`,error012:tt=>`Node with id "${tt}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},zustandErrorMessage=errorMessages.error001();function useStore(tt,et){const nt=reactExports.useContext(StoreContext);if(nt===null)throw new Error(zustandErrorMessage);return useStoreWithEqualityFn(nt,tt,et)}const useStoreApi=()=>{const tt=reactExports.useContext(StoreContext);if(tt===null)throw new Error(zustandErrorMessage);return reactExports.useMemo(()=>({getState:tt.getState,setState:tt.setState,subscribe:tt.subscribe,destroy:tt.destroy}),[tt])},selector$g=tt=>tt.userSelectionActive?"none":"all";function Panel({position:tt,children:et,className:nt,style:rt,...it}){const ot=useStore(selector$g),at=`${tt}`.split("-");return React$1.createElement("div",{className:cc(["react-flow__panel",nt,...at]),style:{...rt,pointerEvents:ot},...it},et)}function Attribution({proOptions:tt,position:et="bottom-right"}){return tt!=null&&tt.hideAttribution?null:React$1.createElement(Panel,{position:et,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev"},React$1.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const EdgeText=({x:tt,y:et,label:nt,labelStyle:rt={},labelShowBg:it=!0,labelBgStyle:ot={},labelBgPadding:at=[2,4],labelBgBorderRadius:st=2,children:lt,className:ct,...ut})=>{const ht=reactExports.useRef(null),[dt,pt]=reactExports.useState({x:0,y:0,width:0,height:0}),mt=cc(["react-flow__edge-textwrapper",ct]);return reactExports.useEffect(()=>{if(ht.current){const gt=ht.current.getBBox();pt({x:gt.x,y:gt.y,width:gt.width,height:gt.height})}},[nt]),typeof nt>"u"||!nt?null:React$1.createElement("g",{transform:`translate(${tt-dt.width/2} ${et-dt.height/2})`,className:mt,visibility:dt.width?"visible":"hidden",...ut},it&&React$1.createElement("rect",{width:dt.width+2*at[0],x:-at[0],y:-at[1],height:dt.height+2*at[1],className:"react-flow__edge-textbg",style:ot,rx:st,ry:st}),React$1.createElement("text",{className:"react-flow__edge-text",y:dt.height/2,dy:"0.3em",ref:ht,style:rt},nt),lt)};var EdgeText$1=reactExports.memo(EdgeText);const getDimensions=tt=>({width:tt.offsetWidth,height:tt.offsetHeight}),clamp=(tt,et=0,nt=1)=>Math.min(Math.max(tt,et),nt),clampPosition=(tt={x:0,y:0},et)=>({x:clamp(tt.x,et[0][0],et[1][0]),y:clamp(tt.y,et[0][1],et[1][1])}),calcAutoPanVelocity=(tt,et,nt)=>ttnt?-clamp(Math.abs(tt-nt),1,50)/50:0,calcAutoPan=(tt,et)=>{const nt=calcAutoPanVelocity(tt.x,35,et.width-35)*20,rt=calcAutoPanVelocity(tt.y,35,et.height-35)*20;return[nt,rt]},getHostForElement=tt=>{var et;return((et=tt.getRootNode)==null?void 0:et.call(tt))||(window==null?void 0:window.document)},getBoundsOfBoxes=(tt,et)=>({x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x2,et.x2),y2:Math.max(tt.y2,et.y2)}),rectToBox=({x:tt,y:et,width:nt,height:rt})=>({x:tt,y:et,x2:tt+nt,y2:et+rt}),boxToRect=({x:tt,y:et,x2:nt,y2:rt})=>({x:tt,y:et,width:nt-tt,height:rt-et}),nodeToRect=tt=>({...tt.positionAbsolute||{x:0,y:0},width:tt.width||0,height:tt.height||0}),getOverlappingArea=(tt,et)=>{const nt=Math.max(0,Math.min(tt.x+tt.width,et.x+et.width)-Math.max(tt.x,et.x)),rt=Math.max(0,Math.min(tt.y+tt.height,et.y+et.height)-Math.max(tt.y,et.y));return Math.ceil(nt*rt)},isRectObject=tt=>isNumeric(tt.width)&&isNumeric(tt.height)&&isNumeric(tt.x)&&isNumeric(tt.y),isNumeric=tt=>!isNaN(tt)&&isFinite(tt),internalsSymbol=Symbol.for("internals"),elementSelectionKeys=["Enter"," ","Escape"],devWarn=(tt,et)=>{},isReactKeyboardEvent=tt=>"nativeEvent"in tt;function isInputDOMNode(tt){var it,ot;const et=isReactKeyboardEvent(tt)?tt.nativeEvent:tt,nt=((ot=(it=et.composedPath)==null?void 0:it.call(et))==null?void 0:ot[0])||tt.target;return["INPUT","SELECT","TEXTAREA"].includes(nt==null?void 0:nt.nodeName)||(nt==null?void 0:nt.hasAttribute("contenteditable"))||!!(nt!=null&&nt.closest(".nokey"))}const isMouseEvent=tt=>"clientX"in tt,getEventPosition=(tt,et)=>{var ot,at;const nt=isMouseEvent(tt),rt=nt?tt.clientX:(ot=tt.touches)==null?void 0:ot[0].clientX,it=nt?tt.clientY:(at=tt.touches)==null?void 0:at[0].clientY;return{x:rt-((et==null?void 0:et.left)??0),y:it-((et==null?void 0:et.top)??0)}},isMacOs=()=>{var tt;return typeof navigator<"u"&&((tt=navigator==null?void 0:navigator.userAgent)==null?void 0:tt.indexOf("Mac"))>=0},BaseEdge=({id:tt,path:et,labelX:nt,labelY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt=20})=>React$1.createElement(React$1.Fragment,null,React$1.createElement("path",{id:tt,style:ut,d:et,fill:"none",className:"react-flow__edge-path",markerEnd:ht,markerStart:dt}),pt&&React$1.createElement("path",{d:et,fill:"none",strokeOpacity:0,strokeWidth:pt,className:"react-flow__edge-interaction"}),it&&isNumeric(nt)&&isNumeric(rt)?React$1.createElement(EdgeText$1,{x:nt,y:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct}):null);BaseEdge.displayName="BaseEdge";function getMouseHandler$1(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().edges.find(ot=>ot.id===tt);it&&nt(rt,{...it})}}function getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const it=Math.abs(nt-tt)/2,ot=nt{const[yt,bt,wt]=getSimpleBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot});return React$1.createElement(BaseEdge,{path:yt,labelX:bt,labelY:wt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:gt})});SimpleBezierEdge.displayName="SimpleBezierEdge";const handleDirections={[Position.Left]:{x:-1,y:0},[Position.Right]:{x:1,y:0},[Position.Top]:{x:0,y:-1},[Position.Bottom]:{x:0,y:1}},getDirection=({source:tt,sourcePosition:et=Position.Bottom,target:nt})=>et===Position.Left||et===Position.Right?tt.xMath.sqrt(Math.pow(et.x-tt.x,2)+Math.pow(et.y-tt.y,2));function getPoints({source:tt,sourcePosition:et=Position.Bottom,target:nt,targetPosition:rt=Position.Top,center:it,offset:ot}){const at=handleDirections[et],st=handleDirections[rt],lt={x:tt.x+at.x*ot,y:tt.y+at.y*ot},ct={x:nt.x+st.x*ot,y:nt.y+st.y*ot},ut=getDirection({source:lt,sourcePosition:et,target:ct}),ht=ut.x!==0?"x":"y",dt=ut[ht];let pt=[],mt,gt;const yt={x:0,y:0},bt={x:0,y:0},[wt,xt,kt,St]=getEdgeCenter({sourceX:tt.x,sourceY:tt.y,targetX:nt.x,targetY:nt.y});if(at[ht]*st[ht]===-1){mt=it.x||wt,gt=it.y||xt;const At=[{x:mt,y:lt.y},{x:mt,y:ct.y}],Et=[{x:lt.x,y:gt},{x:ct.x,y:gt}];at[ht]===dt?pt=ht==="x"?At:Et:pt=ht==="x"?Et:At}else{const At=[{x:lt.x,y:ct.y}],Et=[{x:ct.x,y:lt.y}];if(ht==="x"?pt=at.x===dt?Et:At:pt=at.y===dt?At:Et,et===rt){const $t=Math.abs(tt[ht]-nt[ht]);if($t<=ot){const vt=Math.min(ot-1,ot-$t);at[ht]===dt?yt[ht]=(lt[ht]>tt[ht]?-1:1)*vt:bt[ht]=(ct[ht]>nt[ht]?-1:1)*vt}}if(et!==rt){const $t=ht==="x"?"y":"x",vt=at[ht]===st[$t],It=lt[$t]>ct[$t],Ot=lt[$t]=Rt?(mt=(Ct.x+Lt.x)/2,gt=pt[0].y):(mt=pt[0].x,gt=(Ct.y+Lt.y)/2)}return[[tt,{x:lt.x+yt.x,y:lt.y+yt.y},...pt,{x:ct.x+bt.x,y:ct.y+bt.y},nt],mt,gt,kt,St]}function getBend(tt,et,nt,rt){const it=Math.min(distance(tt,et)/2,distance(et,nt)/2,rt),{x:ot,y:at}=et;if(tt.x===ot&&ot===nt.x||tt.y===at&&at===nt.y)return`L${ot} ${at}`;if(tt.y===at){const ct=tt.x{let xt="";return wt>0&&wt{const[bt,wt,xt]=getSmoothStepPath({sourceX:tt,sourceY:et,sourcePosition:ht,targetX:nt,targetY:rt,targetPosition:dt,borderRadius:gt==null?void 0:gt.borderRadius,offset:gt==null?void 0:gt.offset});return React$1.createElement(BaseEdge,{path:bt,labelX:wt,labelY:xt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:pt,markerStart:mt,interactionWidth:yt})});SmoothStepEdge.displayName="SmoothStepEdge";const StepEdge=reactExports.memo(tt=>{var et;return React$1.createElement(SmoothStepEdge,{...tt,pathOptions:reactExports.useMemo(()=>{var nt;return{borderRadius:0,offset:(nt=tt.pathOptions)==null?void 0:nt.offset}},[(et=tt.pathOptions)==null?void 0:et.offset])})});StepEdge.displayName="StepEdge";function getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt}){const[it,ot,at,st]=getEdgeCenter({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return[`M ${tt},${et}L ${nt},${rt}`,it,ot,at,st]}const StraightEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})=>{const[mt,gt,yt]=getStraightPath({sourceX:tt,sourceY:et,targetX:nt,targetY:rt});return React$1.createElement(BaseEdge,{path:mt,labelX:gt,labelY:yt,label:it,labelStyle:ot,labelShowBg:at,labelBgStyle:st,labelBgPadding:lt,labelBgBorderRadius:ct,style:ut,markerEnd:ht,markerStart:dt,interactionWidth:pt})});StraightEdge.displayName="StraightEdge";function calculateControlOffset(tt,et){return tt>=0?.5*tt:et*25*Math.sqrt(-tt)}function getControlWithCurvature({pos:tt,x1:et,y1:nt,x2:rt,y2:it,c:ot}){switch(tt){case Position.Left:return[et-calculateControlOffset(et-rt,ot),nt];case Position.Right:return[et+calculateControlOffset(rt-et,ot),nt];case Position.Top:return[et,nt-calculateControlOffset(nt-it,ot)];case Position.Bottom:return[et,nt+calculateControlOffset(it-nt,ot)]}}function getBezierPath({sourceX:tt,sourceY:et,sourcePosition:nt=Position.Bottom,targetX:rt,targetY:it,targetPosition:ot=Position.Top,curvature:at=.25}){const[st,lt]=getControlWithCurvature({pos:nt,x1:tt,y1:et,x2:rt,y2:it,c:at}),[ct,ut]=getControlWithCurvature({pos:ot,x1:rt,y1:it,x2:tt,y2:et,c:at}),[ht,dt,pt,mt]=getBezierEdgeCenter({sourceX:tt,sourceY:et,targetX:rt,targetY:it,sourceControlX:st,sourceControlY:lt,targetControlX:ct,targetControlY:ut});return[`M${tt},${et} C${st},${lt} ${ct},${ut} ${rt},${it}`,ht,dt,pt,mt]}const BezierEdge=reactExports.memo(({sourceX:tt,sourceY:et,targetX:nt,targetY:rt,sourcePosition:it=Position.Bottom,targetPosition:ot=Position.Top,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,pathOptions:gt,interactionWidth:yt})=>{const[bt,wt,xt]=getBezierPath({sourceX:tt,sourceY:et,sourcePosition:it,targetX:nt,targetY:rt,targetPosition:ot,curvature:gt==null?void 0:gt.curvature});return React$1.createElement(BaseEdge,{path:bt,labelX:wt,labelY:xt,label:at,labelStyle:st,labelShowBg:lt,labelBgStyle:ct,labelBgPadding:ut,labelBgBorderRadius:ht,style:dt,markerEnd:pt,markerStart:mt,interactionWidth:yt})});BezierEdge.displayName="BezierEdge";const NodeIdContext=reactExports.createContext(null),Provider=NodeIdContext.Provider;NodeIdContext.Consumer;const useNodeId=()=>reactExports.useContext(NodeIdContext),isEdge=tt=>"id"in tt&&"source"in tt&&"target"in tt,getEdgeId=({source:tt,sourceHandle:et,target:nt,targetHandle:rt})=>`reactflow__edge-${tt}${et||""}-${nt}${rt||""}`,getMarkerId=(tt,et)=>typeof tt>"u"?"":typeof tt=="string"?tt:`${et?`${et}__`:""}${Object.keys(tt).sort().map(rt=>`${rt}=${tt[rt]}`).join("&")}`,connectionExists=(tt,et)=>et.some(nt=>nt.source===tt.source&&nt.target===tt.target&&(nt.sourceHandle===tt.sourceHandle||!nt.sourceHandle&&!tt.sourceHandle)&&(nt.targetHandle===tt.targetHandle||!nt.targetHandle&&!tt.targetHandle)),addEdge=(tt,et)=>{if(!tt.source||!tt.target)return et;let nt;return isEdge(tt)?nt={...tt}:nt={...tt,id:getEdgeId(tt)},connectionExists(nt,et)?et:et.concat(nt)},pointToRendererPoint=({x:tt,y:et},[nt,rt,it],ot,[at,st])=>{const lt={x:(tt-nt)/it,y:(et-rt)/it};return ot?{x:at*Math.round(lt.x/at),y:st*Math.round(lt.y/st)}:lt},rendererPointToPoint=({x:tt,y:et},[nt,rt,it])=>({x:tt*it+nt,y:et*it+rt}),getNodePositionWithOrigin=(tt,et=[0,0])=>{if(!tt)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const nt=(tt.width??0)*et[0],rt=(tt.height??0)*et[1],it={x:tt.position.x-nt,y:tt.position.y-rt};return{...it,positionAbsolute:tt.positionAbsolute?{x:tt.positionAbsolute.x-nt,y:tt.positionAbsolute.y-rt}:it}},getRectOfNodes=(tt,et=[0,0])=>{if(tt.length===0)return{x:0,y:0,width:0,height:0};const nt=tt.reduce((rt,it)=>{const{x:ot,y:at}=getNodePositionWithOrigin(it,et).positionAbsolute;return getBoundsOfBoxes(rt,rectToBox({x:ot,y:at,width:it.width||0,height:it.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return boxToRect(nt)},getNodesInside=(tt,et,[nt,rt,it]=[0,0,1],ot=!1,at=!1,st=[0,0])=>{const lt={x:(et.x-nt)/it,y:(et.y-rt)/it,width:et.width/it,height:et.height/it},ct=[];return tt.forEach(ut=>{const{width:ht,height:dt,selectable:pt=!0,hidden:mt=!1}=ut;if(at&&!pt||mt)return!1;const{positionAbsolute:gt}=getNodePositionWithOrigin(ut,st),yt={x:gt.x,y:gt.y,width:ht||0,height:dt||0},bt=getOverlappingArea(lt,yt),wt=typeof ht>"u"||typeof dt>"u"||ht===null||dt===null,xt=ot&&bt>0,kt=(ht||0)*(dt||0);(wt||xt||bt>=kt||ut.dragging)&&ct.push(ut)}),ct},getConnectedEdges=(tt,et)=>{const nt=tt.map(rt=>rt.id);return et.filter(rt=>nt.includes(rt.source)||nt.includes(rt.target))},getTransformForBounds=(tt,et,nt,rt,it,ot=.1)=>{const at=et/(tt.width*(1+ot)),st=nt/(tt.height*(1+ot)),lt=Math.min(at,st),ct=clamp(lt,rt,it),ut=tt.x+tt.width/2,ht=tt.y+tt.height/2,dt=et/2-ut*ct,pt=nt/2-ht*ct;return[dt,pt,ct]},getD3Transition=(tt,et=0)=>tt.transition().duration(et);function getHandles(tt,et,nt,rt){return(et[nt]||[]).reduce((it,ot)=>{var at,st;return`${tt.id}-${ot.id}-${nt}`!==rt&&it.push({id:ot.id||null,type:nt,nodeId:tt.id,x:(((at=tt.positionAbsolute)==null?void 0:at.x)??0)+ot.x+ot.width/2,y:(((st=tt.positionAbsolute)==null?void 0:st.y)??0)+ot.y+ot.height/2}),it},[])}function getClosestHandle(tt,et,nt,rt,it,ot){const{x:at,y:st}=getEventPosition(tt),ct=et.elementsFromPoint(at,st).find(mt=>mt.classList.contains("react-flow__handle"));if(ct){const mt=ct.getAttribute("data-nodeid");if(mt){const gt=getHandleType(void 0,ct),yt=ct.getAttribute("data-handleid"),bt=ot({nodeId:mt,id:yt,type:gt});if(bt)return{handle:{id:yt,type:gt,nodeId:mt,x:nt.x,y:nt.y},validHandleResult:bt}}}let ut=[],ht=1/0;if(it.forEach(mt=>{const gt=Math.sqrt((mt.x-nt.x)**2+(mt.y-nt.y)**2);if(gt<=rt){const yt=ot(mt);gt<=ht&&(gtmt.isValid),pt=ut.some(({handle:mt})=>mt.type==="target");return ut.find(({handle:mt,validHandleResult:gt})=>pt?mt.type==="target":dt?gt.isValid:!0)||ut[0]}const nullConnection={source:null,target:null,sourceHandle:null,targetHandle:null},defaultResult=()=>({handleDomNode:null,isValid:!1,connection:nullConnection,endHandle:null});function isValidHandle(tt,et,nt,rt,it,ot,at){const st=it==="target",lt=at.querySelector(`.react-flow__handle[data-id="${tt==null?void 0:tt.nodeId}-${tt==null?void 0:tt.id}-${tt==null?void 0:tt.type}"]`),ct={...defaultResult(),handleDomNode:lt};if(lt){const ut=getHandleType(void 0,lt),ht=lt.getAttribute("data-nodeid"),dt=lt.getAttribute("data-handleid"),pt=lt.classList.contains("connectable"),mt=lt.classList.contains("connectableend"),gt={source:st?ht:nt,sourceHandle:st?dt:rt,target:st?nt:ht,targetHandle:st?rt:dt};ct.connection=gt,pt&&mt&&(et===ConnectionMode.Strict?st&&ut==="source"||!st&&ut==="target":ht!==nt||dt!==rt)&&(ct.endHandle={nodeId:ht,handleId:dt,type:ut},ct.isValid=ot(gt))}return ct}function getHandleLookup({nodes:tt,nodeId:et,handleId:nt,handleType:rt}){return tt.reduce((it,ot)=>{if(ot[internalsSymbol]){const{handleBounds:at}=ot[internalsSymbol];let st=[],lt=[];at&&(st=getHandles(ot,at,"source",`${et}-${nt}-${rt}`),lt=getHandles(ot,at,"target",`${et}-${nt}-${rt}`)),it.push(...st,...lt)}return it},[])}function getHandleType(tt,et){return tt||(et!=null&&et.classList.contains("target")?"target":et!=null&&et.classList.contains("source")?"source":null)}function resetRecentHandle(tt){tt==null||tt.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function getConnectionStatus(tt,et){let nt=null;return et?nt="valid":tt&&!et&&(nt="invalid"),nt}function handlePointerDown({event:tt,handleId:et,nodeId:nt,onConnect:rt,isTarget:it,getState:ot,setState:at,isValidConnection:st,edgeUpdaterType:lt,onEdgeUpdateEnd:ct}){const ut=getHostForElement(tt.target),{connectionMode:ht,domNode:dt,autoPanOnConnect:pt,connectionRadius:mt,onConnectStart:gt,panBy:yt,getNodes:bt,cancelConnection:wt}=ot();let xt=0,kt;const{x:St,y:Tt}=getEventPosition(tt),At=ut==null?void 0:ut.elementFromPoint(St,Tt),Et=getHandleType(lt,At),Ct=dt==null?void 0:dt.getBoundingClientRect();if(!Ct||!Et)return;let Lt,jt=getEventPosition(tt,Ct),Rt=!1,$t=null,vt=!1,It=null;const Ot=getHandleLookup({nodes:bt(),nodeId:nt,handleId:et,handleType:Et}),Wt=()=>{if(!pt)return;const[Nt,Ut]=calcAutoPan(jt,Ct);yt({x:Nt,y:Ut}),xt=requestAnimationFrame(Wt)};at({connectionPosition:jt,connectionStatus:null,connectionNodeId:nt,connectionHandleId:et,connectionHandleType:Et,connectionStartHandle:{nodeId:nt,handleId:et,type:Et},connectionEndHandle:null}),gt==null||gt(tt,{nodeId:nt,handleId:et,handleType:Et});function zt(Nt){const{transform:Ut}=ot();jt=getEventPosition(Nt,Ct);const{handle:Pt,validHandleResult:Ht}=getClosestHandle(Nt,ut,pointToRendererPoint(jt,Ut,!1,[1,1]),mt,Ot,Qt=>isValidHandle(Qt,ht,nt,et,it?"target":"source",st,ut));if(kt=Pt,Rt||(Wt(),Rt=!0),It=Ht.handleDomNode,$t=Ht.connection,vt=Ht.isValid,at({connectionPosition:kt&&vt?rendererPointToPoint({x:kt.x,y:kt.y},Ut):jt,connectionStatus:getConnectionStatus(!!kt,vt),connectionEndHandle:Ht.endHandle}),!kt&&!vt&&!It)return resetRecentHandle(Lt);$t.source!==$t.target&&It&&(resetRecentHandle(Lt),Lt=It,It.classList.add("connecting","react-flow__handle-connecting"),It.classList.toggle("valid",vt),It.classList.toggle("react-flow__handle-valid",vt))}function Ft(Nt){var Ut,Pt;(kt||It)&&$t&&vt&&(rt==null||rt($t)),(Pt=(Ut=ot()).onConnectEnd)==null||Pt.call(Ut,Nt),lt&&(ct==null||ct(Nt)),resetRecentHandle(Lt),wt(),cancelAnimationFrame(xt),Rt=!1,vt=!1,$t=null,It=null,ut.removeEventListener("mousemove",zt),ut.removeEventListener("mouseup",Ft),ut.removeEventListener("touchmove",zt),ut.removeEventListener("touchend",Ft)}ut.addEventListener("mousemove",zt),ut.addEventListener("mouseup",Ft),ut.addEventListener("touchmove",zt),ut.addEventListener("touchend",Ft)}const alwaysValid=()=>!0,selector$f=tt=>({connectionStartHandle:tt.connectionStartHandle,connectOnClick:tt.connectOnClick,noPanClassName:tt.noPanClassName}),connectingSelector=(tt,et,nt)=>rt=>{const{connectionStartHandle:it,connectionEndHandle:ot,connectionClickStartHandle:at}=rt;return{connecting:(it==null?void 0:it.nodeId)===tt&&(it==null?void 0:it.handleId)===et&&(it==null?void 0:it.type)===nt||(ot==null?void 0:ot.nodeId)===tt&&(ot==null?void 0:ot.handleId)===et&&(ot==null?void 0:ot.type)===nt,clickConnecting:(at==null?void 0:at.nodeId)===tt&&(at==null?void 0:at.handleId)===et&&(at==null?void 0:at.type)===nt}},Handle=reactExports.forwardRef(({type:tt="source",position:et=Position.Top,isValidConnection:nt,isConnectable:rt=!0,isConnectableStart:it=!0,isConnectableEnd:ot=!0,id:at,onConnect:st,children:lt,className:ct,onMouseDown:ut,onTouchStart:ht,...dt},pt)=>{var Ct,Lt;const mt=at||null,gt=tt==="target",yt=useStoreApi(),bt=useNodeId(),{connectOnClick:wt,noPanClassName:xt}=useStore(selector$f,shallow$1),{connecting:kt,clickConnecting:St}=useStore(connectingSelector(bt,mt,tt),shallow$1);bt||(Lt=(Ct=yt.getState()).onError)==null||Lt.call(Ct,"010",errorMessages.error010());const Tt=jt=>{const{defaultEdgeOptions:Rt,onConnect:$t,hasDefaultEdges:vt}=yt.getState(),It={...Rt,...jt};if(vt){const{edges:Ot,setEdges:Wt}=yt.getState();Wt(addEdge(It,Ot))}$t==null||$t(It),st==null||st(It)},At=jt=>{if(!bt)return;const Rt=isMouseEvent(jt);it&&(Rt&&jt.button===0||!Rt)&&handlePointerDown({event:jt,handleId:mt,nodeId:bt,onConnect:Tt,isTarget:gt,getState:yt.getState,setState:yt.setState,isValidConnection:nt||yt.getState().isValidConnection||alwaysValid}),Rt?ut==null||ut(jt):ht==null||ht(jt)},Et=jt=>{const{onClickConnectStart:Rt,onClickConnectEnd:$t,connectionClickStartHandle:vt,connectionMode:It,isValidConnection:Ot}=yt.getState();if(!bt||!vt&&!it)return;if(!vt){Rt==null||Rt(jt,{nodeId:bt,handleId:mt,handleType:tt}),yt.setState({connectionClickStartHandle:{nodeId:bt,type:tt,handleId:mt}});return}const Wt=getHostForElement(jt.target),zt=nt||Ot||alwaysValid,{connection:Ft,isValid:Nt}=isValidHandle({nodeId:bt,id:mt,type:tt},It,vt.nodeId,vt.handleId||null,vt.type,zt,Wt);Nt&&Tt(Ft),$t==null||$t(jt),yt.setState({connectionClickStartHandle:null})};return React$1.createElement("div",{"data-handleid":mt,"data-nodeid":bt,"data-handlepos":et,"data-id":`${bt}-${mt}-${tt}`,className:cc(["react-flow__handle",`react-flow__handle-${et}`,"nodrag",xt,ct,{source:!gt,target:gt,connectable:rt,connectablestart:it,connectableend:ot,connecting:St,connectionindicator:rt&&(it&&!kt||ot&&kt)}]),onMouseDown:At,onTouchStart:At,onClick:wt?Et:void 0,ref:pt,...dt},lt)});Handle.displayName="Handle";var Handle$1=reactExports.memo(Handle);const DefaultNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top,sourcePosition:rt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:rt,isConnectable:et}));DefaultNode.displayName="DefaultNode";var DefaultNode$1=reactExports.memo(DefaultNode);const InputNode=({data:tt,isConnectable:et,sourcePosition:nt=Position.Bottom})=>React$1.createElement(React$1.Fragment,null,tt==null?void 0:tt.label,React$1.createElement(Handle$1,{type:"source",position:nt,isConnectable:et}));InputNode.displayName="InputNode";var InputNode$1=reactExports.memo(InputNode);const OutputNode=({data:tt,isConnectable:et,targetPosition:nt=Position.Top})=>React$1.createElement(React$1.Fragment,null,React$1.createElement(Handle$1,{type:"target",position:nt,isConnectable:et}),tt==null?void 0:tt.label);OutputNode.displayName="OutputNode";var OutputNode$1=reactExports.memo(OutputNode);const GroupNode=()=>null;GroupNode.displayName="GroupNode";const selector$e=tt=>({selectedNodes:tt.getNodes().filter(et=>et.selected),selectedEdges:tt.edges.filter(et=>et.selected)}),selectId=tt=>tt.id;function areEqual(tt,et){return shallow$1(tt.selectedNodes.map(selectId),et.selectedNodes.map(selectId))&&shallow$1(tt.selectedEdges.map(selectId),et.selectedEdges.map(selectId))}const SelectionListener=reactExports.memo(({onSelectionChange:tt})=>{const et=useStoreApi(),{selectedNodes:nt,selectedEdges:rt}=useStore(selector$e,areEqual);return reactExports.useEffect(()=>{var ot,at;const it={nodes:nt,edges:rt};tt==null||tt(it),(at=(ot=et.getState()).onSelectionChange)==null||at.call(ot,it)},[nt,rt,tt]),null});SelectionListener.displayName="SelectionListener";const changeSelector=tt=>!!tt.onSelectionChange;function Wrapper$1$1({onSelectionChange:tt}){const et=useStore(changeSelector);return tt||et?React$1.createElement(SelectionListener,{onSelectionChange:tt}):null}const selector$d=tt=>({setNodes:tt.setNodes,setEdges:tt.setEdges,setDefaultNodesAndEdges:tt.setDefaultNodesAndEdges,setMinZoom:tt.setMinZoom,setMaxZoom:tt.setMaxZoom,setTranslateExtent:tt.setTranslateExtent,setNodeExtent:tt.setNodeExtent,reset:tt.reset});function useStoreUpdater(tt,et){reactExports.useEffect(()=>{typeof tt<"u"&&et(tt)},[tt])}function useDirectStoreUpdater(tt,et,nt){reactExports.useEffect(()=>{typeof et<"u"&&nt({[tt]:et})},[et])}const StoreUpdater=({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:it,onConnectStart:ot,onConnectEnd:at,onClickConnectStart:st,onClickConnectEnd:lt,nodesDraggable:ct,nodesConnectable:ut,nodesFocusable:ht,edgesFocusable:dt,edgesUpdatable:pt,elevateNodesOnSelect:mt,minZoom:gt,maxZoom:yt,nodeExtent:bt,onNodesChange:wt,onEdgesChange:xt,elementsSelectable:kt,connectionMode:St,snapGrid:Tt,snapToGrid:At,translateExtent:Et,connectOnClick:Ct,defaultEdgeOptions:Lt,fitView:jt,fitViewOptions:Rt,onNodesDelete:$t,onEdgesDelete:vt,onNodeDrag:It,onNodeDragStart:Ot,onNodeDragStop:Wt,onSelectionDrag:zt,onSelectionDragStart:Ft,onSelectionDragStop:Nt,noPanClassName:Ut,nodeOrigin:Pt,rfId:Ht,autoPanOnConnect:Qt,autoPanOnNodeDrag:an,onError:Yt,connectionRadius:nn,isValidConnection:tn,nodeDragThreshold:dn})=>{const{setNodes:wn,setEdges:rn,setDefaultNodesAndEdges:Jt,setMinZoom:vn,setMaxZoom:Cn,setTranslateExtent:$n,setNodeExtent:Nn,reset:En}=useStore(selector$d,shallow$1),sn=useStoreApi();return reactExports.useEffect(()=>{const pn=rt==null?void 0:rt.map(Tn=>({...Tn,...Lt}));return Jt(nt,pn),()=>{En()}},[]),useDirectStoreUpdater("defaultEdgeOptions",Lt,sn.setState),useDirectStoreUpdater("connectionMode",St,sn.setState),useDirectStoreUpdater("onConnect",it,sn.setState),useDirectStoreUpdater("onConnectStart",ot,sn.setState),useDirectStoreUpdater("onConnectEnd",at,sn.setState),useDirectStoreUpdater("onClickConnectStart",st,sn.setState),useDirectStoreUpdater("onClickConnectEnd",lt,sn.setState),useDirectStoreUpdater("nodesDraggable",ct,sn.setState),useDirectStoreUpdater("nodesConnectable",ut,sn.setState),useDirectStoreUpdater("nodesFocusable",ht,sn.setState),useDirectStoreUpdater("edgesFocusable",dt,sn.setState),useDirectStoreUpdater("edgesUpdatable",pt,sn.setState),useDirectStoreUpdater("elementsSelectable",kt,sn.setState),useDirectStoreUpdater("elevateNodesOnSelect",mt,sn.setState),useDirectStoreUpdater("snapToGrid",At,sn.setState),useDirectStoreUpdater("snapGrid",Tt,sn.setState),useDirectStoreUpdater("onNodesChange",wt,sn.setState),useDirectStoreUpdater("onEdgesChange",xt,sn.setState),useDirectStoreUpdater("connectOnClick",Ct,sn.setState),useDirectStoreUpdater("fitViewOnInit",jt,sn.setState),useDirectStoreUpdater("fitViewOnInitOptions",Rt,sn.setState),useDirectStoreUpdater("onNodesDelete",$t,sn.setState),useDirectStoreUpdater("onEdgesDelete",vt,sn.setState),useDirectStoreUpdater("onNodeDrag",It,sn.setState),useDirectStoreUpdater("onNodeDragStart",Ot,sn.setState),useDirectStoreUpdater("onNodeDragStop",Wt,sn.setState),useDirectStoreUpdater("onSelectionDrag",zt,sn.setState),useDirectStoreUpdater("onSelectionDragStart",Ft,sn.setState),useDirectStoreUpdater("onSelectionDragStop",Nt,sn.setState),useDirectStoreUpdater("noPanClassName",Ut,sn.setState),useDirectStoreUpdater("nodeOrigin",Pt,sn.setState),useDirectStoreUpdater("rfId",Ht,sn.setState),useDirectStoreUpdater("autoPanOnConnect",Qt,sn.setState),useDirectStoreUpdater("autoPanOnNodeDrag",an,sn.setState),useDirectStoreUpdater("onError",Yt,sn.setState),useDirectStoreUpdater("connectionRadius",nn,sn.setState),useDirectStoreUpdater("isValidConnection",tn,sn.setState),useDirectStoreUpdater("nodeDragThreshold",dn,sn.setState),useStoreUpdater(tt,wn),useStoreUpdater(et,rn),useStoreUpdater(gt,vn),useStoreUpdater(yt,Cn),useStoreUpdater(Et,$n),useStoreUpdater(bt,Nn),null},style$1={display:"none"},ariaLiveStyle={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ARIA_NODE_DESC_KEY="react-flow__node-desc",ARIA_EDGE_DESC_KEY="react-flow__edge-desc",ARIA_LIVE_MESSAGE="react-flow__aria-live",selector$c=tt=>tt.ariaLiveMessage;function AriaLiveMessage({rfId:tt}){const et=useStore(selector$c);return React$1.createElement("div",{id:`${ARIA_LIVE_MESSAGE}-${tt}`,"aria-live":"assertive","aria-atomic":"true",style:ariaLiveStyle},et)}function A11yDescriptions({rfId:tt,disableKeyboardA11y:et}){return React$1.createElement(React$1.Fragment,null,React$1.createElement("div",{id:`${ARIA_NODE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select a node.",!et&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),React$1.createElement("div",{id:`${ARIA_EDGE_DESC_KEY}-${tt}`,style:style$1},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!et&&React$1.createElement(AriaLiveMessage,{rfId:tt}))}var useKeyPress=(tt=null,et={actInsideInputWithModifier:!0})=>{const[nt,rt]=reactExports.useState(!1),it=reactExports.useRef(!1),ot=reactExports.useRef(new Set([])),[at,st]=reactExports.useMemo(()=>{if(tt!==null){const ct=(Array.isArray(tt)?tt:[tt]).filter(ht=>typeof ht=="string").map(ht=>ht.split("+")),ut=ct.reduce((ht,dt)=>ht.concat(...dt),[]);return[ct,ut]}return[[],[]]},[tt]);return reactExports.useEffect(()=>{const lt=typeof document<"u"?document:null,ct=(et==null?void 0:et.target)||lt;if(tt!==null){const ut=pt=>{if(it.current=pt.ctrlKey||pt.metaKey||pt.shiftKey,(!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);ot.current.add(pt[gt]),isMatchingKey(at,ot.current,!1)&&(pt.preventDefault(),rt(!0))},ht=pt=>{if((!it.current||it.current&&!et.actInsideInputWithModifier)&&isInputDOMNode(pt))return!1;const gt=useKeyOrCode(pt.code,st);isMatchingKey(at,ot.current,!0)?(rt(!1),ot.current.clear()):ot.current.delete(pt[gt]),pt.key==="Meta"&&ot.current.clear(),it.current=!1},dt=()=>{ot.current.clear(),rt(!1)};return ct==null||ct.addEventListener("keydown",ut),ct==null||ct.addEventListener("keyup",ht),window.addEventListener("blur",dt),()=>{ct==null||ct.removeEventListener("keydown",ut),ct==null||ct.removeEventListener("keyup",ht),window.removeEventListener("blur",dt)}}},[tt,rt]),nt};function isMatchingKey(tt,et,nt){return tt.filter(rt=>nt||rt.length===et.size).some(rt=>rt.every(it=>et.has(it)))}function useKeyOrCode(tt,et){return et.includes(tt)?"code":"key"}function calculateXYZPosition(tt,et,nt,rt){var at,st;if(!tt.parentNode)return nt;const it=et.get(tt.parentNode),ot=getNodePositionWithOrigin(it,rt);return calculateXYZPosition(it,et,{x:(nt.x??0)+ot.x,y:(nt.y??0)+ot.y,z:(((at=it[internalsSymbol])==null?void 0:at.z)??0)>(nt.z??0)?((st=it[internalsSymbol])==null?void 0:st.z)??0:nt.z??0},rt)}function updateAbsoluteNodePositions(tt,et,nt){tt.forEach(rt=>{var it;if(rt.parentNode&&!tt.has(rt.parentNode))throw new Error(`Parent node ${rt.parentNode} not found`);if(rt.parentNode||nt!=null&&nt[rt.id]){const{x:ot,y:at,z:st}=calculateXYZPosition(rt,tt,{...rt.position,z:((it=rt[internalsSymbol])==null?void 0:it.z)??0},et);rt.positionAbsolute={x:ot,y:at},rt[internalsSymbol].z=st,nt!=null&&nt[rt.id]&&(rt[internalsSymbol].isParent=!0)}})}function createNodeInternals(tt,et,nt,rt){const it=new Map,ot={},at=rt?1e3:0;return tt.forEach(st=>{var ht;const lt=(isNumeric(st.zIndex)?st.zIndex:0)+(st.selected?at:0),ct=et.get(st.id),ut={width:ct==null?void 0:ct.width,height:ct==null?void 0:ct.height,...st,positionAbsolute:{x:st.position.x,y:st.position.y}};st.parentNode&&(ut.parentNode=st.parentNode,ot[st.parentNode]=!0),Object.defineProperty(ut,internalsSymbol,{enumerable:!1,value:{handleBounds:(ht=ct==null?void 0:ct[internalsSymbol])==null?void 0:ht.handleBounds,z:lt}}),it.set(st.id,ut)}),updateAbsoluteNodePositions(it,nt,ot),it}function fitView(tt,et={}){const{getNodes:nt,width:rt,height:it,minZoom:ot,maxZoom:at,d3Zoom:st,d3Selection:lt,fitViewOnInitDone:ct,fitViewOnInit:ut,nodeOrigin:ht}=tt(),dt=et.initial&&!ct&&ut;if(st&<&&(dt||!et.initial)){const mt=nt().filter(yt=>{var wt;const bt=et.includeHiddenNodes?yt.width&&yt.height:!yt.hidden;return(wt=et.nodes)!=null&&wt.length?bt&&et.nodes.some(xt=>xt.id===yt.id):bt}),gt=mt.every(yt=>yt.width&&yt.height);if(mt.length>0&>){const yt=getRectOfNodes(mt,ht),[bt,wt,xt]=getTransformForBounds(yt,rt,it,et.minZoom??ot,et.maxZoom??at,et.padding??.1),kt=identity.translate(bt,wt).scale(xt);return typeof et.duration=="number"&&et.duration>0?st.transform(getD3Transition(lt,et.duration),kt):st.transform(lt,kt),!0}}return!1}function handleControlledNodeSelectionChange(tt,et){return tt.forEach(nt=>{const rt=et.get(nt.id);rt&&et.set(rt.id,{...rt,[internalsSymbol]:rt[internalsSymbol],selected:nt.selected})}),new Map(et)}function handleControlledEdgeSelectionChange(tt,et){return et.map(nt=>{const rt=tt.find(it=>it.id===nt.id);return rt&&(nt.selected=rt.selected),nt})}function updateNodesAndEdgesSelections({changedNodes:tt,changedEdges:et,get:nt,set:rt}){const{nodeInternals:it,edges:ot,onNodesChange:at,onEdgesChange:st,hasDefaultNodes:lt,hasDefaultEdges:ct}=nt();tt!=null&&tt.length&&(lt&&rt({nodeInternals:handleControlledNodeSelectionChange(tt,it)}),at==null||at(tt)),et!=null&&et.length&&(ct&&rt({edges:handleControlledEdgeSelectionChange(et,ot)}),st==null||st(et))}const noop$1=()=>{},initialViewportHelper={zoomIn:noop$1,zoomOut:noop$1,zoomTo:noop$1,getZoom:()=>1,setViewport:noop$1,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:noop$1,fitBounds:noop$1,project:tt=>tt,viewportInitialized:!1},selector$b=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection}),useViewportHelper=()=>{const tt=useStoreApi(),{d3Zoom:et,d3Selection:nt}=useStore(selector$b,shallow$1);return reactExports.useMemo(()=>nt&&et?{zoomIn:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1.2),zoomOut:it=>et.scaleBy(getD3Transition(nt,it==null?void 0:it.duration),1/1.2),zoomTo:(it,ot)=>et.scaleTo(getD3Transition(nt,ot==null?void 0:ot.duration),it),getZoom:()=>tt.getState().transform[2],setViewport:(it,ot)=>{const[at,st,lt]=tt.getState().transform,ct=identity.translate(it.x??at,it.y??st).scale(it.zoom??lt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),ct)},getViewport:()=>{const[it,ot,at]=tt.getState().transform;return{x:it,y:ot,zoom:at}},fitView:it=>fitView(tt.getState,it),setCenter:(it,ot,at)=>{const{width:st,height:lt,maxZoom:ct}=tt.getState(),ut=typeof(at==null?void 0:at.zoom)<"u"?at.zoom:ct,ht=st/2-it*ut,dt=lt/2-ot*ut,pt=identity.translate(ht,dt).scale(ut);et.transform(getD3Transition(nt,at==null?void 0:at.duration),pt)},fitBounds:(it,ot)=>{const{width:at,height:st,minZoom:lt,maxZoom:ct}=tt.getState(),[ut,ht,dt]=getTransformForBounds(it,at,st,lt,ct,(ot==null?void 0:ot.padding)??.1),pt=identity.translate(ut,ht).scale(dt);et.transform(getD3Transition(nt,ot==null?void 0:ot.duration),pt)},project:it=>{const{transform:ot,snapToGrid:at,snapGrid:st}=tt.getState();return pointToRendererPoint(it,ot,at,st)},viewportInitialized:!0}:initialViewportHelper,[et,nt])};function useReactFlow(){const tt=useViewportHelper(),et=useStoreApi(),nt=reactExports.useCallback(()=>et.getState().getNodes().map(gt=>({...gt})),[]),rt=reactExports.useCallback(gt=>et.getState().nodeInternals.get(gt),[]),it=reactExports.useCallback(()=>{const{edges:gt=[]}=et.getState();return gt.map(yt=>({...yt}))},[]),ot=reactExports.useCallback(gt=>{const{edges:yt=[]}=et.getState();return yt.find(bt=>bt.id===gt)},[]),at=reactExports.useCallback(gt=>{const{getNodes:yt,setNodes:bt,hasDefaultNodes:wt,onNodesChange:xt}=et.getState(),kt=yt(),St=typeof gt=="function"?gt(kt):gt;if(wt)bt(St);else if(xt){const Tt=St.length===0?kt.map(At=>({type:"remove",id:At.id})):St.map(At=>({item:At,type:"reset"}));xt(Tt)}},[]),st=reactExports.useCallback(gt=>{const{edges:yt=[],setEdges:bt,hasDefaultEdges:wt,onEdgesChange:xt}=et.getState(),kt=typeof gt=="function"?gt(yt):gt;if(wt)bt(kt);else if(xt){const St=kt.length===0?yt.map(Tt=>({type:"remove",id:Tt.id})):kt.map(Tt=>({item:Tt,type:"reset"}));xt(St)}},[]),lt=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{getNodes:bt,setNodes:wt,hasDefaultNodes:xt,onNodesChange:kt}=et.getState();if(xt){const Tt=[...bt(),...yt];wt(Tt)}else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ct=reactExports.useCallback(gt=>{const yt=Array.isArray(gt)?gt:[gt],{edges:bt=[],setEdges:wt,hasDefaultEdges:xt,onEdgesChange:kt}=et.getState();if(xt)wt([...bt,...yt]);else if(kt){const St=yt.map(Tt=>({item:Tt,type:"add"}));kt(St)}},[]),ut=reactExports.useCallback(()=>{const{getNodes:gt,edges:yt=[],transform:bt}=et.getState(),[wt,xt,kt]=bt;return{nodes:gt().map(St=>({...St})),edges:yt.map(St=>({...St})),viewport:{x:wt,y:xt,zoom:kt}}},[]),ht=reactExports.useCallback(({nodes:gt,edges:yt})=>{const{nodeInternals:bt,getNodes:wt,edges:xt,hasDefaultNodes:kt,hasDefaultEdges:St,onNodesDelete:Tt,onEdgesDelete:At,onNodesChange:Et,onEdgesChange:Ct}=et.getState(),Lt=(gt||[]).map(It=>It.id),jt=(yt||[]).map(It=>It.id),Rt=wt().reduce((It,Ot)=>{const Wt=!Lt.includes(Ot.id)&&Ot.parentNode&&It.find(Ft=>Ft.id===Ot.parentNode);return(typeof Ot.deletable=="boolean"?Ot.deletable:!0)&&(Lt.includes(Ot.id)||Wt)&&It.push(Ot),It},[]),$t=xt.filter(It=>typeof It.deletable=="boolean"?It.deletable:!0),vt=$t.filter(It=>jt.includes(It.id));if(Rt||vt){const It=getConnectedEdges(Rt,$t),Ot=[...vt,...It],Wt=Ot.reduce((zt,Ft)=>(zt.includes(Ft.id)||zt.push(Ft.id),zt),[]);if((St||kt)&&(St&&et.setState({edges:xt.filter(zt=>!Wt.includes(zt.id))}),kt&&(Rt.forEach(zt=>{bt.delete(zt.id)}),et.setState({nodeInternals:new Map(bt)}))),Wt.length>0&&(At==null||At(Ot),Ct&&Ct(Wt.map(zt=>({id:zt,type:"remove"})))),Rt.length>0&&(Tt==null||Tt(Rt),Et)){const zt=Rt.map(Ft=>({id:Ft.id,type:"remove"}));Et(zt)}}},[]),dt=reactExports.useCallback(gt=>{const yt=isRectObject(gt),bt=yt?null:et.getState().nodeInternals.get(gt.id);return[yt?gt:nodeToRect(bt),bt,yt]},[]),pt=reactExports.useCallback((gt,yt=!0,bt)=>{const[wt,xt,kt]=dt(gt);return wt?(bt||et.getState().getNodes()).filter(St=>{if(!kt&&(St.id===xt.id||!St.positionAbsolute))return!1;const Tt=nodeToRect(St),At=getOverlappingArea(Tt,wt);return yt&&At>0||At>=gt.width*gt.height}):[]},[]),mt=reactExports.useCallback((gt,yt,bt=!0)=>{const[wt]=dt(gt);if(!wt)return!1;const xt=getOverlappingArea(wt,yt);return bt&&xt>0||xt>=gt.width*gt.height},[]);return reactExports.useMemo(()=>({...tt,getNodes:nt,getNode:rt,getEdges:it,getEdge:ot,setNodes:at,setEdges:st,addNodes:lt,addEdges:ct,toObject:ut,deleteElements:ht,getIntersectingNodes:pt,isNodeIntersecting:mt}),[tt,nt,rt,it,ot,at,st,lt,ct,ut,ht,pt,mt])}const deleteKeyOptions={actInsideInputWithModifier:!1};var useGlobalKeyHandler=({deleteKeyCode:tt,multiSelectionKeyCode:et})=>{const nt=useStoreApi(),{deleteElements:rt}=useReactFlow(),it=useKeyPress(tt,deleteKeyOptions),ot=useKeyPress(et);reactExports.useEffect(()=>{if(it){const{edges:at,getNodes:st}=nt.getState(),lt=st().filter(ut=>ut.selected),ct=at.filter(ut=>ut.selected);rt({nodes:lt,edges:ct}),nt.setState({nodesSelectionActive:!1})}},[it]),reactExports.useEffect(()=>{nt.setState({multiSelectionActive:ot})},[ot])};function useResizeHandler(tt){const et=useStoreApi();reactExports.useEffect(()=>{let nt;const rt=()=>{var ot,at;if(!tt.current)return;const it=getDimensions(tt.current);(it.height===0||it.width===0)&&((at=(ot=et.getState()).onError)==null||at.call(ot,"004",errorMessages.error004())),et.setState({width:it.width||500,height:it.height||500})};return rt(),window.addEventListener("resize",rt),tt.current&&(nt=new ResizeObserver(()=>rt()),nt.observe(tt.current)),()=>{window.removeEventListener("resize",rt),nt&&tt.current&&nt.unobserve(tt.current)}},[])}const containerStyle={position:"absolute",width:"100%",height:"100%",top:0,left:0},viewChanged=(tt,et)=>tt.x!==et.x||tt.y!==et.y||tt.zoom!==et.k,eventToFlowTransform=tt=>({x:tt.x,y:tt.y,zoom:tt.k}),isWrappedWithClass=(tt,et)=>tt.target.closest(`.${et}`),isRightClickPan=(tt,et)=>et===2&&Array.isArray(tt)&&tt.includes(2),wheelDelta=tt=>{const et=tt.ctrlKey&&isMacOs()?10:1;return-tt.deltaY*(tt.deltaMode===1?.05:tt.deltaMode?1:.002)*et},selector$a=tt=>({d3Zoom:tt.d3Zoom,d3Selection:tt.d3Selection,d3ZoomHandler:tt.d3ZoomHandler,userSelectionActive:tt.userSelectionActive}),ZoomPane=({onMove:tt,onMoveStart:et,onMoveEnd:nt,onPaneContextMenu:rt,zoomOnScroll:it=!0,zoomOnPinch:ot=!0,panOnScroll:at=!1,panOnScrollSpeed:st=.5,panOnScrollMode:lt=PanOnScrollMode.Free,zoomOnDoubleClick:ct=!0,elementsSelectable:ut,panOnDrag:ht=!0,defaultViewport:dt,translateExtent:pt,minZoom:mt,maxZoom:gt,zoomActivationKeyCode:yt,preventScrolling:bt=!0,children:wt,noWheelClassName:xt,noPanClassName:kt})=>{const St=reactExports.useRef(),Tt=useStoreApi(),At=reactExports.useRef(!1),Et=reactExports.useRef(!1),Ct=reactExports.useRef(null),Lt=reactExports.useRef({x:0,y:0,zoom:0}),{d3Zoom:jt,d3Selection:Rt,d3ZoomHandler:$t,userSelectionActive:vt}=useStore(selector$a,shallow$1),It=useKeyPress(yt),Ot=reactExports.useRef(0),Wt=reactExports.useRef(!1),zt=reactExports.useRef();return useResizeHandler(Ct),reactExports.useEffect(()=>{if(Ct.current){const Ft=Ct.current.getBoundingClientRect(),Nt=zoom().scaleExtent([mt,gt]).translateExtent(pt),Ut=select(Ct.current).call(Nt),Pt=identity.translate(dt.x,dt.y).scale(clamp(dt.zoom,mt,gt)),Ht=[[0,0],[Ft.width,Ft.height]],Qt=Nt.constrain()(Pt,Ht,pt);Nt.transform(Ut,Qt),Nt.wheelDelta(wheelDelta),Tt.setState({d3Zoom:Nt,d3Selection:Ut,d3ZoomHandler:Ut.on("wheel.zoom"),transform:[Qt.x,Qt.y,Qt.k],domNode:Ct.current.closest(".react-flow")})}},[]),reactExports.useEffect(()=>{Rt&&jt&&(at&&!It&&!vt?Rt.on("wheel.zoom",Ft=>{if(isWrappedWithClass(Ft,xt))return!1;Ft.preventDefault(),Ft.stopImmediatePropagation();const Nt=Rt.property("__zoom").k||1,Ut=isMacOs();if(Ft.ctrlKey&&ot&&Ut){const dn=pointer(Ft),wn=wheelDelta(Ft),rn=Nt*Math.pow(2,wn);jt.scaleTo(Rt,rn,dn,Ft);return}const Pt=Ft.deltaMode===1?20:1;let Ht=lt===PanOnScrollMode.Vertical?0:Ft.deltaX*Pt,Qt=lt===PanOnScrollMode.Horizontal?0:Ft.deltaY*Pt;!Ut&&Ft.shiftKey&<!==PanOnScrollMode.Vertical&&(Ht=Ft.deltaY*Pt,Qt=0),jt.translateBy(Rt,-(Ht/Nt)*st,-(Qt/Nt)*st,{internal:!0});const an=eventToFlowTransform(Rt.property("__zoom")),{onViewportChangeStart:Yt,onViewportChange:nn,onViewportChangeEnd:tn}=Tt.getState();clearTimeout(zt.current),Wt.current||(Wt.current=!0,et==null||et(Ft,an),Yt==null||Yt(an)),Wt.current&&(tt==null||tt(Ft,an),nn==null||nn(an),zt.current=setTimeout(()=>{nt==null||nt(Ft,an),tn==null||tn(an),Wt.current=!1},150))},{passive:!1}):typeof $t<"u"&&Rt.on("wheel.zoom",function(Ft,Nt){if(!bt||isWrappedWithClass(Ft,xt))return null;Ft.preventDefault(),$t.call(this,Ft,Nt)},{passive:!1}))},[vt,at,lt,Rt,jt,$t,It,ot,bt,xt,et,tt,nt]),reactExports.useEffect(()=>{jt&&jt.on("start",Ft=>{var Pt,Ht;if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;Ot.current=(Pt=Ft.sourceEvent)==null?void 0:Pt.button;const{onViewportChangeStart:Nt}=Tt.getState(),Ut=eventToFlowTransform(Ft.transform);At.current=!0,Lt.current=Ut,((Ht=Ft.sourceEvent)==null?void 0:Ht.type)==="mousedown"&&Tt.setState({paneDragging:!0}),Nt==null||Nt(Ut),et==null||et(Ft.sourceEvent,Ut)})},[jt,et]),reactExports.useEffect(()=>{jt&&(vt&&!At.current?jt.on("zoom",null):vt||jt.on("zoom",Ft=>{var Ut;const{onViewportChange:Nt}=Tt.getState();if(Tt.setState({transform:[Ft.transform.x,Ft.transform.y,Ft.transform.k]}),Et.current=!!(rt&&isRightClickPan(ht,Ot.current??0)),(tt||Nt)&&!((Ut=Ft.sourceEvent)!=null&&Ut.internal)){const Pt=eventToFlowTransform(Ft.transform);Nt==null||Nt(Pt),tt==null||tt(Ft.sourceEvent,Pt)}}))},[vt,jt,tt,ht,rt]),reactExports.useEffect(()=>{jt&&jt.on("end",Ft=>{if(!Ft.sourceEvent||Ft.sourceEvent.internal)return null;const{onViewportChangeEnd:Nt}=Tt.getState();if(At.current=!1,Tt.setState({paneDragging:!1}),rt&&isRightClickPan(ht,Ot.current??0)&&!Et.current&&rt(Ft.sourceEvent),Et.current=!1,(nt||Nt)&&viewChanged(Lt.current,Ft.transform)){const Ut=eventToFlowTransform(Ft.transform);Lt.current=Ut,clearTimeout(St.current),St.current=setTimeout(()=>{Nt==null||Nt(Ut),nt==null||nt(Ft.sourceEvent,Ut)},at?150:0)}})},[jt,at,ht,nt,rt]),reactExports.useEffect(()=>{jt&&jt.filter(Ft=>{const Nt=It||it,Ut=ot&&Ft.ctrlKey;if((ht===!0||Array.isArray(ht)&&ht.includes(1))&&Ft.button===1&&Ft.type==="mousedown"&&(isWrappedWithClass(Ft,"react-flow__node")||isWrappedWithClass(Ft,"react-flow__edge")))return!0;if(!ht&&!Nt&&!at&&!ct&&!ot||vt||!ct&&Ft.type==="dblclick"||isWrappedWithClass(Ft,xt)&&Ft.type==="wheel"||isWrappedWithClass(Ft,kt)&&(Ft.type!=="wheel"||at&&Ft.type==="wheel")||!ot&&Ft.ctrlKey&&Ft.type==="wheel"||!Nt&&!at&&!Ut&&Ft.type==="wheel"||!ht&&(Ft.type==="mousedown"||Ft.type==="touchstart")||Array.isArray(ht)&&!ht.includes(Ft.button)&&(Ft.type==="mousedown"||Ft.type==="touchstart"))return!1;const Pt=Array.isArray(ht)&&ht.includes(Ft.button)||!Ft.button||Ft.button<=1;return(!Ft.ctrlKey||Ft.type==="wheel")&&Pt})},[vt,jt,it,ot,at,ct,ht,ut,It]),React$1.createElement("div",{className:"react-flow__renderer",ref:Ct,style:containerStyle},wt)},selector$9=tt=>({userSelectionActive:tt.userSelectionActive,userSelectionRect:tt.userSelectionRect});function UserSelection(){const{userSelectionActive:tt,userSelectionRect:et}=useStore(selector$9,shallow$1);return tt&&et?React$1.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:et.width,height:et.height,transform:`translate(${et.x}px, ${et.y}px)`}}):null}function handleParentExpand(tt,et){const nt=tt.find(rt=>rt.id===et.parentNode);if(nt){const rt=et.position.x+et.width-nt.width,it=et.position.y+et.height-nt.height;if(rt>0||it>0||et.position.x<0||et.position.y<0){if(nt.style={...nt.style},nt.style.width=nt.style.width??nt.width,nt.style.height=nt.style.height??nt.height,rt>0&&(nt.style.width+=rt),it>0&&(nt.style.height+=it),et.position.x<0){const ot=Math.abs(et.position.x);nt.position.x=nt.position.x-ot,nt.style.width+=ot,et.position.x=0}if(et.position.y<0){const ot=Math.abs(et.position.y);nt.position.y=nt.position.y-ot,nt.style.height+=ot,et.position.y=0}nt.width=nt.style.width,nt.height=nt.style.height}}}function applyChanges(tt,et){if(tt.some(rt=>rt.type==="reset"))return tt.filter(rt=>rt.type==="reset").map(rt=>rt.item);const nt=tt.filter(rt=>rt.type==="add").map(rt=>rt.item);return et.reduce((rt,it)=>{const ot=tt.filter(st=>st.id===it.id);if(ot.length===0)return rt.push(it),rt;const at={...it};for(const st of ot)if(st)switch(st.type){case"select":{at.selected=st.selected;break}case"position":{typeof st.position<"u"&&(at.position=st.position),typeof st.positionAbsolute<"u"&&(at.positionAbsolute=st.positionAbsolute),typeof st.dragging<"u"&&(at.dragging=st.dragging),at.expandParent&&handleParentExpand(rt,at);break}case"dimensions":{typeof st.dimensions<"u"&&(at.width=st.dimensions.width,at.height=st.dimensions.height),typeof st.updateStyle<"u"&&(at.style={...at.style||{},...st.dimensions}),typeof st.resizing=="boolean"&&(at.resizing=st.resizing),at.expandParent&&handleParentExpand(rt,at);break}case"remove":return rt}return rt.push(at),rt},nt)}function applyNodeChanges(tt,et){return applyChanges(tt,et)}const createSelectionChange=(tt,et)=>({id:tt,type:"select",selected:et});function getSelectionChanges(tt,et){return tt.reduce((nt,rt)=>{const it=et.includes(rt.id);return!rt.selected&&it?(rt.selected=!0,nt.push(createSelectionChange(rt.id,!0))):rt.selected&&!it&&(rt.selected=!1,nt.push(createSelectionChange(rt.id,!1))),nt},[])}const wrapHandler=(tt,et)=>nt=>{nt.target===et.current&&(tt==null||tt(nt))},selector$8=tt=>({userSelectionActive:tt.userSelectionActive,elementsSelectable:tt.elementsSelectable,dragging:tt.paneDragging}),Pane=reactExports.memo(({isSelecting:tt,selectionMode:et=SelectionMode.Full,panOnDrag:nt,onSelectionStart:rt,onSelectionEnd:it,onPaneClick:ot,onPaneContextMenu:at,onPaneScroll:st,onPaneMouseEnter:lt,onPaneMouseMove:ct,onPaneMouseLeave:ut,children:ht})=>{const dt=reactExports.useRef(null),pt=useStoreApi(),mt=reactExports.useRef(0),gt=reactExports.useRef(0),yt=reactExports.useRef(),{userSelectionActive:bt,elementsSelectable:wt,dragging:xt}=useStore(selector$8,shallow$1),kt=()=>{pt.setState({userSelectionActive:!1,userSelectionRect:null}),mt.current=0,gt.current=0},St=$t=>{ot==null||ot($t),pt.getState().resetSelectedElements(),pt.setState({nodesSelectionActive:!1})},Tt=$t=>{if(Array.isArray(nt)&&(nt!=null&&nt.includes(2))){$t.preventDefault();return}at==null||at($t)},At=st?$t=>st($t):void 0,Et=$t=>{const{resetSelectedElements:vt,domNode:It}=pt.getState();if(yt.current=It==null?void 0:It.getBoundingClientRect(),!wt||!tt||$t.button!==0||$t.target!==dt.current||!yt.current)return;const{x:Ot,y:Wt}=getEventPosition($t,yt.current);vt(),pt.setState({userSelectionRect:{width:0,height:0,startX:Ot,startY:Wt,x:Ot,y:Wt}}),rt==null||rt($t)},Ct=$t=>{const{userSelectionRect:vt,nodeInternals:It,edges:Ot,transform:Wt,onNodesChange:zt,onEdgesChange:Ft,nodeOrigin:Nt,getNodes:Ut}=pt.getState();if(!tt||!yt.current||!vt)return;pt.setState({userSelectionActive:!0,nodesSelectionActive:!1});const Pt=getEventPosition($t,yt.current),Ht=vt.startX??0,Qt=vt.startY??0,an={...vt,x:Pt.xwn.id),dn=nn.map(wn=>wn.id);if(mt.current!==dn.length){mt.current=dn.length;const wn=getSelectionChanges(Yt,dn);wn.length&&(zt==null||zt(wn))}if(gt.current!==tn.length){gt.current=tn.length;const wn=getSelectionChanges(Ot,tn);wn.length&&(Ft==null||Ft(wn))}pt.setState({userSelectionRect:an})},Lt=$t=>{if($t.button!==0)return;const{userSelectionRect:vt}=pt.getState();!bt&&vt&&$t.target===dt.current&&(St==null||St($t)),pt.setState({nodesSelectionActive:mt.current>0}),kt(),it==null||it($t)},jt=$t=>{bt&&(pt.setState({nodesSelectionActive:mt.current>0}),it==null||it($t)),kt()},Rt=wt&&(tt||bt);return React$1.createElement("div",{className:cc(["react-flow__pane",{dragging:xt,selection:tt}]),onClick:Rt?void 0:wrapHandler(St,dt),onContextMenu:wrapHandler(Tt,dt),onWheel:wrapHandler(At,dt),onMouseEnter:Rt?void 0:lt,onMouseDown:Rt?Et:void 0,onMouseMove:Rt?Ct:ct,onMouseUp:Rt?Lt:void 0,onMouseLeave:Rt?jt:ut,ref:dt,style:containerStyle},ht,React$1.createElement(UserSelection,null))});Pane.displayName="Pane";function isParentSelected(tt,et){if(!tt.parentNode)return!1;const nt=et.get(tt.parentNode);return nt?nt.selected?!0:isParentSelected(nt,et):!1}function hasSelector(tt,et,nt){let rt=tt;do{if(rt!=null&&rt.matches(et))return!0;if(rt===nt.current)return!1;rt=rt.parentElement}while(rt);return!1}function getDragItems(tt,et,nt,rt){return Array.from(tt.values()).filter(it=>(it.selected||it.id===rt)&&(!it.parentNode||!isParentSelected(it,tt))&&(it.draggable||et&&typeof it.draggable>"u")).map(it=>{var ot,at;return{id:it.id,position:it.position||{x:0,y:0},positionAbsolute:it.positionAbsolute||{x:0,y:0},distance:{x:nt.x-(((ot=it.positionAbsolute)==null?void 0:ot.x)??0),y:nt.y-(((at=it.positionAbsolute)==null?void 0:at.y)??0)},delta:{x:0,y:0},extent:it.extent,parentNode:it.parentNode,width:it.width,height:it.height,expandParent:it.expandParent}})}function clampNodeExtent(tt,et){return!et||et==="parent"?et:[et[0],[et[1][0]-(tt.width||0),et[1][1]-(tt.height||0)]]}function calcNextPosition(tt,et,nt,rt,it=[0,0],ot){const at=clampNodeExtent(tt,tt.extent||rt);let st=at;if(tt.extent==="parent"&&!tt.expandParent)if(tt.parentNode&&tt.width&&tt.height){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=ut&&isNumeric(ht)&&isNumeric(dt)&&isNumeric(ut.width)&&isNumeric(ut.height)?[[ht+tt.width*it[0],dt+tt.height*it[1]],[ht+ut.width-tt.width+tt.width*it[0],dt+ut.height-tt.height+tt.height*it[1]]]:st}else ot==null||ot("005",errorMessages.error005()),st=at;else if(tt.extent&&tt.parentNode&&tt.extent!=="parent"){const ut=nt.get(tt.parentNode),{x:ht,y:dt}=getNodePositionWithOrigin(ut,it).positionAbsolute;st=[[tt.extent[0][0]+ht,tt.extent[0][1]+dt],[tt.extent[1][0]+ht,tt.extent[1][1]+dt]]}let lt={x:0,y:0};if(tt.parentNode){const ut=nt.get(tt.parentNode);lt=getNodePositionWithOrigin(ut,it).positionAbsolute}const ct=st&&st!=="parent"?clampPosition(et,st):et;return{position:{x:ct.x-lt.x,y:ct.y-lt.y},positionAbsolute:ct}}function getEventHandlerParams({nodeId:tt,dragItems:et,nodeInternals:nt}){const rt=et.map(it=>({...nt.get(it.id),position:it.position,positionAbsolute:it.positionAbsolute}));return[tt?rt.find(it=>it.id===tt):rt[0],rt]}const getHandleBounds=(tt,et,nt,rt)=>{const it=et.querySelectorAll(tt);if(!it||!it.length)return null;const ot=Array.from(it),at=et.getBoundingClientRect(),st={x:at.width*rt[0],y:at.height*rt[1]};return ot.map(lt=>{const ct=lt.getBoundingClientRect();return{id:lt.getAttribute("data-handleid"),position:lt.getAttribute("data-handlepos"),x:(ct.left-at.left-st.x)/nt,y:(ct.top-at.top-st.y)/nt,...getDimensions(lt)}})};function getMouseHandler(tt,et,nt){return nt===void 0?nt:rt=>{const it=et().nodeInternals.get(tt);it&&nt(rt,{...it})}}function handleNodeClick({id:tt,store:et,unselect:nt=!1,nodeRef:rt}){const{addSelectedNodes:it,unselectNodesAndEdges:ot,multiSelectionActive:at,nodeInternals:st,onError:lt}=et.getState(),ct=st.get(tt);if(!ct){lt==null||lt("012",errorMessages.error012(tt));return}et.setState({nodesSelectionActive:!1}),ct.selected?(nt||ct.selected&&at)&&(ot({nodes:[ct],edges:[]}),requestAnimationFrame(()=>{var ut;return(ut=rt==null?void 0:rt.current)==null?void 0:ut.blur()})):it([tt])}function useGetPointerPosition(){const tt=useStoreApi();return reactExports.useCallback(({sourceEvent:nt})=>{const{transform:rt,snapGrid:it,snapToGrid:ot}=tt.getState(),at=nt.touches?nt.touches[0].clientX:nt.clientX,st=nt.touches?nt.touches[0].clientY:nt.clientY,lt={x:(at-rt[0])/rt[2],y:(st-rt[1])/rt[2]};return{xSnapped:ot?it[0]*Math.round(lt.x/it[0]):lt.x,ySnapped:ot?it[1]*Math.round(lt.y/it[1]):lt.y,...lt}},[])}function wrapSelectionDragFunc(tt){return(et,nt,rt)=>tt==null?void 0:tt(et,rt)}function useDrag({nodeRef:tt,disabled:et=!1,noDragClassName:nt,handleSelector:rt,nodeId:it,isSelectable:ot,selectNodesOnDrag:at}){const st=useStoreApi(),[lt,ct]=reactExports.useState(!1),ut=reactExports.useRef([]),ht=reactExports.useRef({x:null,y:null}),dt=reactExports.useRef(0),pt=reactExports.useRef(null),mt=reactExports.useRef({x:0,y:0}),gt=reactExports.useRef(null),yt=reactExports.useRef(!1),bt=reactExports.useRef(!1),wt=useGetPointerPosition();return reactExports.useEffect(()=>{if(tt!=null&&tt.current){const xt=select(tt.current),kt=({x:At,y:Et})=>{const{nodeInternals:Ct,onNodeDrag:Lt,onSelectionDrag:jt,updateNodePositions:Rt,nodeExtent:$t,snapGrid:vt,snapToGrid:It,nodeOrigin:Ot,onError:Wt}=st.getState();ht.current={x:At,y:Et};let zt=!1,Ft={x:0,y:0,x2:0,y2:0};if(ut.current.length>1&&$t){const Ut=getRectOfNodes(ut.current,Ot);Ft=rectToBox(Ut)}if(ut.current=ut.current.map(Ut=>{const Pt={x:At-Ut.distance.x,y:Et-Ut.distance.y};It&&(Pt.x=vt[0]*Math.round(Pt.x/vt[0]),Pt.y=vt[1]*Math.round(Pt.y/vt[1]));const Ht=[[$t[0][0],$t[0][1]],[$t[1][0],$t[1][1]]];ut.current.length>1&&$t&&!Ut.extent&&(Ht[0][0]=Ut.positionAbsolute.x-Ft.x+$t[0][0],Ht[1][0]=Ut.positionAbsolute.x+(Ut.width??0)-Ft.x2+$t[1][0],Ht[0][1]=Ut.positionAbsolute.y-Ft.y+$t[0][1],Ht[1][1]=Ut.positionAbsolute.y+(Ut.height??0)-Ft.y2+$t[1][1]);const Qt=calcNextPosition(Ut,Pt,Ct,Ht,Ot,Wt);return zt=zt||Ut.position.x!==Qt.position.x||Ut.position.y!==Qt.position.y,Ut.position=Qt.position,Ut.positionAbsolute=Qt.positionAbsolute,Ut}),!zt)return;Rt(ut.current,!0,!0),ct(!0);const Nt=it?Lt:wrapSelectionDragFunc(jt);if(Nt&>.current){const[Ut,Pt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Ct});Nt(gt.current,Ut,Pt)}},St=()=>{if(!pt.current)return;const[At,Et]=calcAutoPan(mt.current,pt.current);if(At!==0||Et!==0){const{transform:Ct,panBy:Lt}=st.getState();ht.current.x=(ht.current.x??0)-At/Ct[2],ht.current.y=(ht.current.y??0)-Et/Ct[2],Lt({x:At,y:Et})&&kt(ht.current)}dt.current=requestAnimationFrame(St)},Tt=At=>{var Ot;const{nodeInternals:Et,multiSelectionActive:Ct,nodesDraggable:Lt,unselectNodesAndEdges:jt,onNodeDragStart:Rt,onSelectionDragStart:$t}=st.getState();bt.current=!0;const vt=it?Rt:wrapSelectionDragFunc($t);(!at||!ot)&&!Ct&&it&&((Ot=Et.get(it))!=null&&Ot.selected||jt()),it&&ot&&at&&handleNodeClick({id:it,store:st,nodeRef:tt});const It=wt(At);if(ht.current=It,ut.current=getDragItems(Et,Lt,It,it),vt&&ut.current){const[Wt,zt]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Et});vt(At.sourceEvent,Wt,zt)}};if(et)xt.on(".drag",null);else{const At=drag().on("start",Et=>{const{domNode:Ct,nodeDragThreshold:Lt}=st.getState();Lt===0&&Tt(Et);const jt=wt(Et);ht.current=jt,pt.current=(Ct==null?void 0:Ct.getBoundingClientRect())||null,mt.current=getEventPosition(Et.sourceEvent,pt.current)}).on("drag",Et=>{var Rt,$t;const Ct=wt(Et),{autoPanOnNodeDrag:Lt,nodeDragThreshold:jt}=st.getState();if(!yt.current&&bt.current&&Lt&&(yt.current=!0,St()),!bt.current){const vt=Ct.xSnapped-(((Rt=ht==null?void 0:ht.current)==null?void 0:Rt.x)??0),It=Ct.ySnapped-((($t=ht==null?void 0:ht.current)==null?void 0:$t.y)??0);Math.sqrt(vt*vt+It*It)>jt&&Tt(Et)}(ht.current.x!==Ct.xSnapped||ht.current.y!==Ct.ySnapped)&&ut.current&&bt.current&&(gt.current=Et.sourceEvent,mt.current=getEventPosition(Et.sourceEvent,pt.current),kt(Ct))}).on("end",Et=>{if(bt.current&&(ct(!1),yt.current=!1,bt.current=!1,cancelAnimationFrame(dt.current),ut.current)){const{updateNodePositions:Ct,nodeInternals:Lt,onNodeDragStop:jt,onSelectionDragStop:Rt}=st.getState(),$t=it?jt:wrapSelectionDragFunc(Rt);if(Ct(ut.current,!1,!1),$t){const[vt,It]=getEventHandlerParams({nodeId:it,dragItems:ut.current,nodeInternals:Lt});$t(Et.sourceEvent,vt,It)}}}).filter(Et=>{const Ct=Et.target;return!Et.button&&(!nt||!hasSelector(Ct,`.${nt}`,tt))&&(!rt||hasSelector(Ct,rt,tt))});return xt.call(At),()=>{xt.on(".drag",null)}}}},[tt,et,nt,rt,ot,st,it,at,wt]),lt}function useUpdateNodePositions(){const tt=useStoreApi();return reactExports.useCallback(nt=>{const{nodeInternals:rt,nodeExtent:it,updateNodePositions:ot,getNodes:at,snapToGrid:st,snapGrid:lt,onError:ct,nodesDraggable:ut}=tt.getState(),ht=at().filter(wt=>wt.selected&&(wt.draggable||ut&&typeof wt.draggable>"u")),dt=st?lt[0]:5,pt=st?lt[1]:5,mt=nt.isShiftPressed?4:1,gt=nt.x*dt*mt,yt=nt.y*pt*mt,bt=ht.map(wt=>{if(wt.positionAbsolute){const xt={x:wt.positionAbsolute.x+gt,y:wt.positionAbsolute.y+yt};st&&(xt.x=lt[0]*Math.round(xt.x/lt[0]),xt.y=lt[1]*Math.round(xt.y/lt[1]));const{positionAbsolute:kt,position:St}=calcNextPosition(wt,xt,rt,it,void 0,ct);wt.position=St,wt.positionAbsolute=kt}return wt});ot(bt,!0,!1)},[])}const arrowKeyDiffs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var wrapNode=tt=>{const et=({id:nt,type:rt,data:it,xPos:ot,yPos:at,xPosOrigin:st,yPosOrigin:lt,selected:ct,onClick:ut,onMouseEnter:ht,onMouseMove:dt,onMouseLeave:pt,onContextMenu:mt,onDoubleClick:gt,style:yt,className:bt,isDraggable:wt,isSelectable:xt,isConnectable:kt,isFocusable:St,selectNodesOnDrag:Tt,sourcePosition:At,targetPosition:Et,hidden:Ct,resizeObserver:Lt,dragHandle:jt,zIndex:Rt,isParent:$t,noDragClassName:vt,noPanClassName:It,initialized:Ot,disableKeyboardA11y:Wt,ariaLabel:zt,rfId:Ft})=>{const Nt=useStoreApi(),Ut=reactExports.useRef(null),Pt=reactExports.useRef(At),Ht=reactExports.useRef(Et),Qt=reactExports.useRef(rt),an=xt||wt||ut||ht||dt||pt,Yt=useUpdateNodePositions(),nn=getMouseHandler(nt,Nt.getState,ht),tn=getMouseHandler(nt,Nt.getState,dt),dn=getMouseHandler(nt,Nt.getState,pt),wn=getMouseHandler(nt,Nt.getState,mt),rn=getMouseHandler(nt,Nt.getState,gt),Jt=$n=>{const{nodeDragThreshold:Nn}=Nt.getState();if(xt&&(!Tt||!wt||Nn>0)&&handleNodeClick({id:nt,store:Nt,nodeRef:Ut}),ut){const En=Nt.getState().nodeInternals.get(nt);En&&ut($n,{...En})}},vn=$n=>{if(!isInputDOMNode($n))if(elementSelectionKeys.includes($n.key)&&xt){const Nn=$n.key==="Escape";handleNodeClick({id:nt,store:Nt,unselect:Nn,nodeRef:Ut})}else!Wt&&wt&&ct&&Object.prototype.hasOwnProperty.call(arrowKeyDiffs,$n.key)&&(Nt.setState({ariaLiveMessage:`Moved selected node ${$n.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~ot}, y: ${~~at}`}),Yt({x:arrowKeyDiffs[$n.key].x,y:arrowKeyDiffs[$n.key].y,isShiftPressed:$n.shiftKey}))};reactExports.useEffect(()=>{if(Ut.current&&!Ct){const $n=Ut.current;return Lt==null||Lt.observe($n),()=>Lt==null?void 0:Lt.unobserve($n)}},[Ct]),reactExports.useEffect(()=>{const $n=Qt.current!==rt,Nn=Pt.current!==At,En=Ht.current!==Et;Ut.current&&($n||Nn||En)&&($n&&(Qt.current=rt),Nn&&(Pt.current=At),En&&(Ht.current=Et),Nt.getState().updateNodeDimensions([{id:nt,nodeElement:Ut.current,forceUpdate:!0}]))},[nt,rt,At,Et]);const Cn=useDrag({nodeRef:Ut,disabled:Ct||!wt,noDragClassName:vt,handleSelector:jt,nodeId:nt,isSelectable:xt,selectNodesOnDrag:Tt});return Ct?null:React$1.createElement("div",{className:cc(["react-flow__node",`react-flow__node-${rt}`,{[It]:wt},bt,{selected:ct,selectable:xt,parent:$t,dragging:Cn}]),ref:Ut,style:{zIndex:Rt,transform:`translate(${st}px,${lt}px)`,pointerEvents:an?"all":"none",visibility:Ot?"visible":"hidden",...yt},"data-id":nt,"data-testid":`rf__node-${nt}`,onMouseEnter:nn,onMouseMove:tn,onMouseLeave:dn,onContextMenu:wn,onClick:Jt,onDoubleClick:rn,onKeyDown:St?vn:void 0,tabIndex:St?0:void 0,role:St?"button":void 0,"aria-describedby":Wt?void 0:`${ARIA_NODE_DESC_KEY}-${Ft}`,"aria-label":zt},React$1.createElement(Provider,{value:nt},React$1.createElement(tt,{id:nt,data:it,type:rt,xPos:ot,yPos:at,selected:ct,isConnectable:kt,sourcePosition:At,targetPosition:Et,dragging:Cn,dragHandle:jt,zIndex:Rt})))};return et.displayName="NodeWrapper",reactExports.memo(et)};const selector$7=tt=>{const et=tt.getNodes().filter(nt=>nt.selected);return{...getRectOfNodes(et,tt.nodeOrigin),transformString:`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`,userSelectionActive:tt.userSelectionActive}};function NodesSelection({onSelectionContextMenu:tt,noPanClassName:et,disableKeyboardA11y:nt}){const rt=useStoreApi(),{width:it,height:ot,x:at,y:st,transformString:lt,userSelectionActive:ct}=useStore(selector$7,shallow$1),ut=useUpdateNodePositions(),ht=reactExports.useRef(null);if(reactExports.useEffect(()=>{var mt;nt||(mt=ht.current)==null||mt.focus({preventScroll:!0})},[nt]),useDrag({nodeRef:ht}),ct||!it||!ot)return null;const dt=tt?mt=>{const gt=rt.getState().getNodes().filter(yt=>yt.selected);tt(mt,gt)}:void 0,pt=mt=>{Object.prototype.hasOwnProperty.call(arrowKeyDiffs,mt.key)&&ut({x:arrowKeyDiffs[mt.key].x,y:arrowKeyDiffs[mt.key].y,isShiftPressed:mt.shiftKey})};return React$1.createElement("div",{className:cc(["react-flow__nodesselection","react-flow__container",et]),style:{transform:lt}},React$1.createElement("div",{ref:ht,className:"react-flow__nodesselection-rect",onContextMenu:dt,tabIndex:nt?void 0:-1,onKeyDown:nt?void 0:pt,style:{width:it,height:ot,top:st,left:at}}))}var NodesSelection$1=reactExports.memo(NodesSelection);const selector$6=tt=>tt.nodesSelectionActive,FlowRenderer=({children:tt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,deleteKeyCode:st,onMove:lt,onMoveStart:ct,onMoveEnd:ut,selectionKeyCode:ht,selectionOnDrag:dt,selectionMode:pt,onSelectionStart:mt,onSelectionEnd:gt,multiSelectionKeyCode:yt,panActivationKeyCode:bt,zoomActivationKeyCode:wt,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:Ct,panOnDrag:Lt,defaultViewport:jt,translateExtent:Rt,minZoom:$t,maxZoom:vt,preventScrolling:It,onSelectionContextMenu:Ot,noWheelClassName:Wt,noPanClassName:zt,disableKeyboardA11y:Ft})=>{const Nt=useStore(selector$6),Ut=useKeyPress(ht),Ht=useKeyPress(bt)||Lt,Qt=Ut||dt&&Ht!==!0;return useGlobalKeyHandler({deleteKeyCode:st,multiSelectionKeyCode:yt}),React$1.createElement(ZoomPane,{onMove:lt,onMoveStart:ct,onMoveEnd:ut,onPaneContextMenu:ot,elementsSelectable:xt,zoomOnScroll:kt,zoomOnPinch:St,panOnScroll:Tt,panOnScrollSpeed:At,panOnScrollMode:Et,zoomOnDoubleClick:Ct,panOnDrag:!Ut&&Ht,defaultViewport:jt,translateExtent:Rt,minZoom:$t,maxZoom:vt,zoomActivationKeyCode:wt,preventScrolling:It,noWheelClassName:Wt,noPanClassName:zt},React$1.createElement(Pane,{onSelectionStart:mt,onSelectionEnd:gt,onPaneClick:et,onPaneMouseEnter:nt,onPaneMouseMove:rt,onPaneMouseLeave:it,onPaneContextMenu:ot,onPaneScroll:at,panOnDrag:Ht,isSelecting:!!Qt,selectionMode:pt},tt,Nt&&React$1.createElement(NodesSelection$1,{onSelectionContextMenu:Ot,noPanClassName:zt,disableKeyboardA11y:Ft})))};FlowRenderer.displayName="FlowRenderer";var FlowRenderer$1=reactExports.memo(FlowRenderer);function useVisibleNodes(tt){return useStore(reactExports.useCallback(nt=>tt?getNodesInside(nt.nodeInternals,{x:0,y:0,width:nt.width,height:nt.height},nt.transform,!0):nt.getNodes(),[tt]))}function createNodeTypes(tt){const et={input:wrapNode(tt.input||InputNode$1),default:wrapNode(tt.default||DefaultNode$1),output:wrapNode(tt.output||OutputNode$1),group:wrapNode(tt.group||GroupNode)},nt={},rt=Object.keys(tt).filter(it=>!["input","default","output","group"].includes(it)).reduce((it,ot)=>(it[ot]=wrapNode(tt[ot]||DefaultNode$1),it),nt);return{...et,...rt}}const getPositionWithOrigin=({x:tt,y:et,width:nt,height:rt,origin:it})=>!nt||!rt?{x:tt,y:et}:it[0]<0||it[1]<0||it[0]>1||it[1]>1?{x:tt,y:et}:{x:tt-nt*it[0],y:et-rt*it[1]},selector$5=tt=>({nodesDraggable:tt.nodesDraggable,nodesConnectable:tt.nodesConnectable,nodesFocusable:tt.nodesFocusable,elementsSelectable:tt.elementsSelectable,updateNodeDimensions:tt.updateNodeDimensions,onError:tt.onError}),NodeRenderer=tt=>{const{nodesDraggable:et,nodesConnectable:nt,nodesFocusable:rt,elementsSelectable:it,updateNodeDimensions:ot,onError:at}=useStore(selector$5,shallow$1),st=useVisibleNodes(tt.onlyRenderVisibleElements),lt=reactExports.useRef(),ct=reactExports.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const ut=new ResizeObserver(ht=>{const dt=ht.map(pt=>({id:pt.target.getAttribute("data-id"),nodeElement:pt.target,forceUpdate:!0}));ot(dt)});return lt.current=ut,ut},[]);return reactExports.useEffect(()=>()=>{var ut;(ut=lt==null?void 0:lt.current)==null||ut.disconnect()},[]),React$1.createElement("div",{className:"react-flow__nodes",style:containerStyle},st.map(ut=>{var St,Tt;let ht=ut.type||"default";tt.nodeTypes[ht]||(at==null||at("003",errorMessages.error003(ht)),ht="default");const dt=tt.nodeTypes[ht]||tt.nodeTypes.default,pt=!!(ut.draggable||et&&typeof ut.draggable>"u"),mt=!!(ut.selectable||it&&typeof ut.selectable>"u"),gt=!!(ut.connectable||nt&&typeof ut.connectable>"u"),yt=!!(ut.focusable||rt&&typeof ut.focusable>"u"),bt=tt.nodeExtent?clampPosition(ut.positionAbsolute,tt.nodeExtent):ut.positionAbsolute,wt=(bt==null?void 0:bt.x)??0,xt=(bt==null?void 0:bt.y)??0,kt=getPositionWithOrigin({x:wt,y:xt,width:ut.width??0,height:ut.height??0,origin:tt.nodeOrigin});return React$1.createElement(dt,{key:ut.id,id:ut.id,className:ut.className,style:ut.style,type:ht,data:ut.data,sourcePosition:ut.sourcePosition||Position.Bottom,targetPosition:ut.targetPosition||Position.Top,hidden:ut.hidden,xPos:wt,yPos:xt,xPosOrigin:kt.x,yPosOrigin:kt.y,selectNodesOnDrag:tt.selectNodesOnDrag,onClick:tt.onNodeClick,onMouseEnter:tt.onNodeMouseEnter,onMouseMove:tt.onNodeMouseMove,onMouseLeave:tt.onNodeMouseLeave,onContextMenu:tt.onNodeContextMenu,onDoubleClick:tt.onNodeDoubleClick,selected:!!ut.selected,isDraggable:pt,isSelectable:mt,isConnectable:gt,isFocusable:yt,resizeObserver:ct,dragHandle:ut.dragHandle,zIndex:((St=ut[internalsSymbol])==null?void 0:St.z)??0,isParent:!!((Tt=ut[internalsSymbol])!=null&&Tt.isParent),noDragClassName:tt.noDragClassName,noPanClassName:tt.noPanClassName,initialized:!!ut.width&&!!ut.height,rfId:tt.rfId,disableKeyboardA11y:tt.disableKeyboardA11y,ariaLabel:ut.ariaLabel})}))};NodeRenderer.displayName="NodeRenderer";var NodeRenderer$1=reactExports.memo(NodeRenderer);const shiftX=(tt,et,nt)=>nt===Position.Left?tt-et:nt===Position.Right?tt+et:tt,shiftY=(tt,et,nt)=>nt===Position.Top?tt-et:nt===Position.Bottom?tt+et:tt,EdgeUpdaterClassName="react-flow__edgeupdater",EdgeAnchor=({position:tt,centerX:et,centerY:nt,radius:rt=10,onMouseDown:it,onMouseEnter:ot,onMouseOut:at,type:st})=>React$1.createElement("circle",{onMouseDown:it,onMouseEnter:ot,onMouseOut:at,className:cc([EdgeUpdaterClassName,`${EdgeUpdaterClassName}-${st}`]),cx:shiftX(et,rt,tt),cy:shiftY(nt,rt,tt),r:rt,stroke:"transparent",fill:"transparent"}),alwaysValidConnection=()=>!0;var wrapEdge=tt=>{const et=({id:nt,className:rt,type:it,data:ot,onClick:at,onEdgeDoubleClick:st,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,style:yt,source:bt,target:wt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,elementsSelectable:Ct,hidden:Lt,sourceHandleId:jt,targetHandleId:Rt,onContextMenu:$t,onMouseEnter:vt,onMouseMove:It,onMouseLeave:Ot,edgeUpdaterRadius:Wt,onEdgeUpdate:zt,onEdgeUpdateStart:Ft,onEdgeUpdateEnd:Nt,markerEnd:Ut,markerStart:Pt,rfId:Ht,ariaLabel:Qt,isFocusable:an,isUpdatable:Yt,pathOptions:nn,interactionWidth:tn})=>{const dn=reactExports.useRef(null),[wn,rn]=reactExports.useState(!1),[Jt,vn]=reactExports.useState(!1),Cn=useStoreApi(),$n=reactExports.useMemo(()=>`url(#${getMarkerId(Pt,Ht)})`,[Pt,Ht]),Nn=reactExports.useMemo(()=>`url(#${getMarkerId(Ut,Ht)})`,[Ut,Ht]);if(Lt)return null;const En=kn=>{var Gn;const{edges:Mn,addSelectedEdges:On,unselectNodesAndEdges:Bn,multiSelectionActive:Xn}=Cn.getState(),Vn=Mn.find(zn=>zn.id===nt);Vn&&(Ct&&(Cn.setState({nodesSelectionActive:!1}),Vn.selected&&Xn?(Bn({nodes:[],edges:[Vn]}),(Gn=dn.current)==null||Gn.blur()):On([nt])),at&&at(kn,Vn))},sn=getMouseHandler$1(nt,Cn.getState,st),pn=getMouseHandler$1(nt,Cn.getState,$t),Tn=getMouseHandler$1(nt,Cn.getState,vt),In=getMouseHandler$1(nt,Cn.getState,It),yn=getMouseHandler$1(nt,Cn.getState,Ot),hn=(kn,Mn)=>{if(kn.button!==0)return;const{edges:On,isValidConnection:Bn}=Cn.getState(),Xn=Mn?wt:bt,Vn=(Mn?Rt:jt)||null,Gn=Mn?"target":"source",zn=Bn||alwaysValidConnection,Zn=Mn,Wn=On.find(wr=>wr.id===nt);vn(!0),Ft==null||Ft(kn,Wn,Gn);const fr=wr=>{vn(!1),Nt==null||Nt(wr,Wn,Gn)};handlePointerDown({event:kn,handleId:Vn,nodeId:Xn,onConnect:wr=>zt==null?void 0:zt(Wn,wr),isTarget:Zn,getState:Cn.getState,setState:Cn.setState,isValidConnection:zn,edgeUpdaterType:Gn,onEdgeUpdateEnd:fr})},fn=kn=>hn(kn,!0),xn=kn=>hn(kn,!1),jn=()=>rn(!0),cn=()=>rn(!1),Xt=!Ct&&!at,Kt=kn=>{var Mn;if(elementSelectionKeys.includes(kn.key)&&Ct){const{unselectNodesAndEdges:On,addSelectedEdges:Bn,edges:Xn}=Cn.getState();kn.key==="Escape"?((Mn=dn.current)==null||Mn.blur(),On({edges:[Xn.find(Gn=>Gn.id===nt)]})):Bn([nt])}};return React$1.createElement("g",{className:cc(["react-flow__edge",`react-flow__edge-${it}`,rt,{selected:lt,animated:ct,inactive:Xt,updating:wn}]),onClick:En,onDoubleClick:sn,onContextMenu:pn,onMouseEnter:Tn,onMouseMove:In,onMouseLeave:yn,onKeyDown:an?Kt:void 0,tabIndex:an?0:void 0,role:an?"button":"img","data-testid":`rf__edge-${nt}`,"aria-label":Qt===null?void 0:Qt||`Edge from ${bt} to ${wt}`,"aria-describedby":an?`${ARIA_EDGE_DESC_KEY}-${Ht}`:void 0,ref:dn},!Jt&&React$1.createElement(tt,{id:nt,source:bt,target:wt,selected:lt,animated:ct,label:ut,labelStyle:ht,labelShowBg:dt,labelBgStyle:pt,labelBgPadding:mt,labelBgBorderRadius:gt,data:ot,style:yt,sourceX:xt,sourceY:kt,targetX:St,targetY:Tt,sourcePosition:At,targetPosition:Et,sourceHandleId:jt,targetHandleId:Rt,markerStart:$n,markerEnd:Nn,pathOptions:nn,interactionWidth:tn}),Yt&&React$1.createElement(React$1.Fragment,null,(Yt==="source"||Yt===!0)&&React$1.createElement(EdgeAnchor,{position:At,centerX:xt,centerY:kt,radius:Wt,onMouseDown:fn,onMouseEnter:jn,onMouseOut:cn,type:"source"}),(Yt==="target"||Yt===!0)&&React$1.createElement(EdgeAnchor,{position:Et,centerX:St,centerY:Tt,radius:Wt,onMouseDown:xn,onMouseEnter:jn,onMouseOut:cn,type:"target"})))};return et.displayName="EdgeWrapper",reactExports.memo(et)};function createEdgeTypes(tt){const et={default:wrapEdge(tt.default||BezierEdge),straight:wrapEdge(tt.bezier||StraightEdge),step:wrapEdge(tt.step||StepEdge),smoothstep:wrapEdge(tt.step||SmoothStepEdge),simplebezier:wrapEdge(tt.simplebezier||SimpleBezierEdge)},nt={},rt=Object.keys(tt).filter(it=>!["default","bezier"].includes(it)).reduce((it,ot)=>(it[ot]=wrapEdge(tt[ot]||BezierEdge),it),nt);return{...et,...rt}}function getHandlePosition(tt,et,nt=null){const rt=((nt==null?void 0:nt.x)||0)+et.x,it=((nt==null?void 0:nt.y)||0)+et.y,ot=(nt==null?void 0:nt.width)||et.width,at=(nt==null?void 0:nt.height)||et.height;switch(tt){case Position.Top:return{x:rt+ot/2,y:it};case Position.Right:return{x:rt+ot,y:it+at/2};case Position.Bottom:return{x:rt+ot/2,y:it+at};case Position.Left:return{x:rt,y:it+at/2}}}function getHandle(tt,et){return tt?tt.length===1||!et?tt[0]:et&&tt.find(nt=>nt.id===et)||null:null}const getEdgePositions=(tt,et,nt,rt,it,ot)=>{const at=getHandlePosition(nt,tt,et),st=getHandlePosition(ot,rt,it);return{sourceX:at.x,sourceY:at.y,targetX:st.x,targetY:st.y}};function isEdgeVisible({sourcePos:tt,targetPos:et,sourceWidth:nt,sourceHeight:rt,targetWidth:it,targetHeight:ot,width:at,height:st,transform:lt}){const ct={x:Math.min(tt.x,et.x),y:Math.min(tt.y,et.y),x2:Math.max(tt.x+nt,et.x+it),y2:Math.max(tt.y+rt,et.y+ot)};ct.x===ct.x2&&(ct.x2+=1),ct.y===ct.y2&&(ct.y2+=1);const ut=rectToBox({x:(0-lt[0])/lt[2],y:(0-lt[1])/lt[2],width:at/lt[2],height:st/lt[2]}),ht=Math.max(0,Math.min(ut.x2,ct.x2)-Math.max(ut.x,ct.x)),dt=Math.max(0,Math.min(ut.y2,ct.y2)-Math.max(ut.y,ct.y));return Math.ceil(ht*dt)>0}function getNodeData(tt){var rt,it,ot,at,st;const et=((rt=tt==null?void 0:tt[internalsSymbol])==null?void 0:rt.handleBounds)||null,nt=et&&(tt==null?void 0:tt.width)&&(tt==null?void 0:tt.height)&&typeof((it=tt==null?void 0:tt.positionAbsolute)==null?void 0:it.x)<"u"&&typeof((ot=tt==null?void 0:tt.positionAbsolute)==null?void 0:ot.y)<"u";return[{x:((at=tt==null?void 0:tt.positionAbsolute)==null?void 0:at.x)||0,y:((st=tt==null?void 0:tt.positionAbsolute)==null?void 0:st.y)||0,width:(tt==null?void 0:tt.width)||0,height:(tt==null?void 0:tt.height)||0},et,!!nt]}const defaultEdgeTree=[{level:0,isMaxLevel:!0,edges:[]}];function groupEdgesByZLevel(tt,et,nt=!1){let rt=-1;const it=tt.reduce((at,st)=>{var ut,ht;const lt=isNumeric(st.zIndex);let ct=lt?st.zIndex:0;if(nt){const dt=et.get(st.target),pt=et.get(st.source),mt=st.selected||(dt==null?void 0:dt.selected)||(pt==null?void 0:pt.selected),gt=Math.max(((ut=pt==null?void 0:pt[internalsSymbol])==null?void 0:ut.z)||0,((ht=dt==null?void 0:dt[internalsSymbol])==null?void 0:ht.z)||0,1e3);ct=(lt?st.zIndex:0)+(mt?gt:0)}return at[ct]?at[ct].push(st):at[ct]=[st],rt=ct>rt?ct:rt,at},{}),ot=Object.entries(it).map(([at,st])=>{const lt=+at;return{edges:st,level:lt,isMaxLevel:lt===rt}});return ot.length===0?defaultEdgeTree:ot}function useVisibleEdges(tt,et,nt){const rt=useStore(reactExports.useCallback(it=>tt?it.edges.filter(ot=>{const at=et.get(ot.source),st=et.get(ot.target);return(at==null?void 0:at.width)&&(at==null?void 0:at.height)&&(st==null?void 0:st.width)&&(st==null?void 0:st.height)&&isEdgeVisible({sourcePos:at.positionAbsolute||{x:0,y:0},targetPos:st.positionAbsolute||{x:0,y:0},sourceWidth:at.width,sourceHeight:at.height,targetWidth:st.width,targetHeight:st.height,width:it.width,height:it.height,transform:it.transform})}):it.edges,[tt,et]));return groupEdgesByZLevel(rt,et,nt)}const ArrowSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ArrowClosedSymbol=({color:tt="none",strokeWidth:et=1})=>React$1.createElement("polyline",{style:{stroke:tt,fill:tt,strokeWidth:et},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),MarkerSymbols={[MarkerType.Arrow]:ArrowSymbol,[MarkerType.ArrowClosed]:ArrowClosedSymbol};function useMarkerSymbol(tt){const et=useStoreApi();return reactExports.useMemo(()=>{var it,ot;return Object.prototype.hasOwnProperty.call(MarkerSymbols,tt)?MarkerSymbols[tt]:((ot=(it=et.getState()).onError)==null||ot.call(it,"009",errorMessages.error009(tt)),null)},[tt])}const Marker=({id:tt,type:et,color:nt,width:rt=12.5,height:it=12.5,markerUnits:ot="strokeWidth",strokeWidth:at,orient:st="auto-start-reverse"})=>{const lt=useMarkerSymbol(et);return lt?React$1.createElement("marker",{className:"react-flow__arrowhead",id:tt,markerWidth:`${rt}`,markerHeight:`${it}`,viewBox:"-10 -10 20 20",markerUnits:ot,orient:st,refX:"0",refY:"0"},React$1.createElement(lt,{color:nt,strokeWidth:at})):null},markerSelector=({defaultColor:tt,rfId:et})=>nt=>{const rt=[];return nt.edges.reduce((it,ot)=>([ot.markerStart,ot.markerEnd].forEach(at=>{if(at&&typeof at=="object"){const st=getMarkerId(at,et);rt.includes(st)||(it.push({id:st,color:at.color||tt,...at}),rt.push(st))}}),it),[]).sort((it,ot)=>it.id.localeCompare(ot.id))},MarkerDefinitions=({defaultColor:tt,rfId:et})=>{const nt=useStore(reactExports.useCallback(markerSelector({defaultColor:tt,rfId:et}),[tt,et]),(rt,it)=>!(rt.length!==it.length||rt.some((ot,at)=>ot.id!==it[at].id)));return React$1.createElement("defs",null,nt.map(rt=>React$1.createElement(Marker,{id:rt.id,key:rt.id,type:rt.type,color:rt.color,width:rt.width,height:rt.height,markerUnits:rt.markerUnits,strokeWidth:rt.strokeWidth,orient:rt.orient})))};MarkerDefinitions.displayName="MarkerDefinitions";var MarkerDefinitions$1=reactExports.memo(MarkerDefinitions);const selector$4=tt=>({nodesConnectable:tt.nodesConnectable,edgesFocusable:tt.edgesFocusable,edgesUpdatable:tt.edgesUpdatable,elementsSelectable:tt.elementsSelectable,width:tt.width,height:tt.height,connectionMode:tt.connectionMode,nodeInternals:tt.nodeInternals,onError:tt.onError}),EdgeRenderer=({defaultMarkerColor:tt,onlyRenderVisibleElements:et,elevateEdgesOnSelect:nt,rfId:rt,edgeTypes:it,noPanClassName:ot,onEdgeUpdate:at,onEdgeContextMenu:st,onEdgeMouseEnter:lt,onEdgeMouseMove:ct,onEdgeMouseLeave:ut,onEdgeClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,children:yt})=>{const{edgesFocusable:bt,edgesUpdatable:wt,elementsSelectable:xt,width:kt,height:St,connectionMode:Tt,nodeInternals:At,onError:Et}=useStore(selector$4,shallow$1),Ct=useVisibleEdges(et,At,nt);return kt?React$1.createElement(React$1.Fragment,null,Ct.map(({level:Lt,edges:jt,isMaxLevel:Rt})=>React$1.createElement("svg",{key:Lt,style:{zIndex:Lt},width:kt,height:St,className:"react-flow__edges react-flow__container"},Rt&&React$1.createElement(MarkerDefinitions$1,{defaultColor:tt,rfId:rt}),React$1.createElement("g",null,jt.map($t=>{const[vt,It,Ot]=getNodeData(At.get($t.source)),[Wt,zt,Ft]=getNodeData(At.get($t.target));if(!Ot||!Ft)return null;let Nt=$t.type||"default";it[Nt]||(Et==null||Et("011",errorMessages.error011(Nt)),Nt="default");const Ut=it[Nt]||it.default,Pt=Tt===ConnectionMode.Strict?zt.target:(zt.target??[]).concat(zt.source??[]),Ht=getHandle(It.source,$t.sourceHandle),Qt=getHandle(Pt,$t.targetHandle),an=(Ht==null?void 0:Ht.position)||Position.Bottom,Yt=(Qt==null?void 0:Qt.position)||Position.Top,nn=!!($t.focusable||bt&&typeof $t.focusable>"u"),tn=typeof at<"u"&&($t.updatable||wt&&typeof $t.updatable>"u");if(!Ht||!Qt)return Et==null||Et("008",errorMessages.error008(Ht,$t)),null;const{sourceX:dn,sourceY:wn,targetX:rn,targetY:Jt}=getEdgePositions(vt,Ht,an,Wt,Qt,Yt);return React$1.createElement(Ut,{key:$t.id,id:$t.id,className:cc([$t.className,ot]),type:Nt,data:$t.data,selected:!!$t.selected,animated:!!$t.animated,hidden:!!$t.hidden,label:$t.label,labelStyle:$t.labelStyle,labelShowBg:$t.labelShowBg,labelBgStyle:$t.labelBgStyle,labelBgPadding:$t.labelBgPadding,labelBgBorderRadius:$t.labelBgBorderRadius,style:$t.style,source:$t.source,target:$t.target,sourceHandleId:$t.sourceHandle,targetHandleId:$t.targetHandle,markerEnd:$t.markerEnd,markerStart:$t.markerStart,sourceX:dn,sourceY:wn,targetX:rn,targetY:Jt,sourcePosition:an,targetPosition:Yt,elementsSelectable:xt,onEdgeUpdate:at,onContextMenu:st,onMouseEnter:lt,onMouseMove:ct,onMouseLeave:ut,onClick:ht,edgeUpdaterRadius:dt,onEdgeDoubleClick:pt,onEdgeUpdateStart:mt,onEdgeUpdateEnd:gt,rfId:rt,ariaLabel:$t.ariaLabel,isFocusable:nn,isUpdatable:tn,pathOptions:"pathOptions"in $t?$t.pathOptions:void 0,interactionWidth:$t.interactionWidth})})))),yt):null};EdgeRenderer.displayName="EdgeRenderer";var EdgeRenderer$1=reactExports.memo(EdgeRenderer);const selector$3=tt=>`translate(${tt.transform[0]}px,${tt.transform[1]}px) scale(${tt.transform[2]})`;function Viewport({children:tt}){const et=useStore(selector$3);return React$1.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:et}},tt)}function useOnInitHandler(tt){const et=useReactFlow(),nt=reactExports.useRef(!1);reactExports.useEffect(()=>{!nt.current&&et.viewportInitialized&&tt&&(setTimeout(()=>tt(et),1),nt.current=!0)},[tt,et.viewportInitialized])}const oppositePosition={[Position.Left]:Position.Right,[Position.Right]:Position.Left,[Position.Top]:Position.Bottom,[Position.Bottom]:Position.Top},ConnectionLine=({nodeId:tt,handleType:et,style:nt,type:rt=ConnectionLineType.Bezier,CustomComponent:it,connectionStatus:ot})=>{var Tt,At,Et;const{fromNode:at,handleId:st,toX:lt,toY:ct,connectionMode:ut}=useStore(reactExports.useCallback(Ct=>({fromNode:Ct.nodeInternals.get(tt),handleId:Ct.connectionHandleId,toX:(Ct.connectionPosition.x-Ct.transform[0])/Ct.transform[2],toY:(Ct.connectionPosition.y-Ct.transform[1])/Ct.transform[2],connectionMode:Ct.connectionMode}),[tt]),shallow$1),ht=(Tt=at==null?void 0:at[internalsSymbol])==null?void 0:Tt.handleBounds;let dt=ht==null?void 0:ht[et];if(ut===ConnectionMode.Loose&&(dt=dt||(ht==null?void 0:ht[et==="source"?"target":"source"])),!at||!dt)return null;const pt=st?dt.find(Ct=>Ct.id===st):dt[0],mt=pt?pt.x+pt.width/2:(at.width??0)/2,gt=pt?pt.y+pt.height/2:at.height??0,yt=(((At=at.positionAbsolute)==null?void 0:At.x)??0)+mt,bt=(((Et=at.positionAbsolute)==null?void 0:Et.y)??0)+gt,wt=pt==null?void 0:pt.position,xt=wt?oppositePosition[wt]:null;if(!wt||!xt)return null;if(it)return React$1.createElement(it,{connectionLineType:rt,connectionLineStyle:nt,fromNode:at,fromHandle:pt,fromX:yt,fromY:bt,toX:lt,toY:ct,fromPosition:wt,toPosition:xt,connectionStatus:ot});let kt="";const St={sourceX:yt,sourceY:bt,sourcePosition:wt,targetX:lt,targetY:ct,targetPosition:xt};return rt===ConnectionLineType.Bezier?[kt]=getBezierPath(St):rt===ConnectionLineType.Step?[kt]=getSmoothStepPath({...St,borderRadius:0}):rt===ConnectionLineType.SmoothStep?[kt]=getSmoothStepPath(St):rt===ConnectionLineType.SimpleBezier?[kt]=getSimpleBezierPath(St):kt=`M${yt},${bt} ${lt},${ct}`,React$1.createElement("path",{d:kt,fill:"none",className:"react-flow__connection-path",style:nt})};ConnectionLine.displayName="ConnectionLine";const selector$2=tt=>({nodeId:tt.connectionNodeId,handleType:tt.connectionHandleType,nodesConnectable:tt.nodesConnectable,connectionStatus:tt.connectionStatus,width:tt.width,height:tt.height});function ConnectionLineWrapper({containerStyle:tt,style:et,type:nt,component:rt}){const{nodeId:it,handleType:ot,nodesConnectable:at,width:st,height:lt,connectionStatus:ct}=useStore(selector$2,shallow$1);return!(it&&ot&&st&&at)?null:React$1.createElement("svg",{style:tt,width:st,height:lt,className:"react-flow__edges react-flow__connectionline react-flow__container"},React$1.createElement("g",{className:cc(["react-flow__connection",ct])},React$1.createElement(ConnectionLine,{nodeId:it,handleType:ot,style:et,type:nt,CustomComponent:rt,connectionStatus:ct})))}function useNodeOrEdgeTypes(tt,et){return reactExports.useRef(null),useStoreApi(),reactExports.useMemo(()=>et(tt),[tt])}const GraphView=({nodeTypes:tt,edgeTypes:et,onMove:nt,onMoveStart:rt,onMoveEnd:it,onInit:ot,onNodeClick:at,onEdgeClick:st,onNodeDoubleClick:lt,onEdgeDoubleClick:ct,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,onSelectionContextMenu:mt,onSelectionStart:gt,onSelectionEnd:yt,connectionLineType:bt,connectionLineStyle:wt,connectionLineComponent:xt,connectionLineContainerStyle:kt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,multiSelectionKeyCode:Et,panActivationKeyCode:Ct,zoomActivationKeyCode:Lt,deleteKeyCode:jt,onlyRenderVisibleElements:Rt,elementsSelectable:$t,selectNodesOnDrag:vt,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,preventScrolling:Ft,defaultMarkerColor:Nt,zoomOnScroll:Ut,zoomOnPinch:Pt,panOnScroll:Ht,panOnScrollSpeed:Qt,panOnScrollMode:an,zoomOnDoubleClick:Yt,panOnDrag:nn,onPaneClick:tn,onPaneMouseEnter:dn,onPaneMouseMove:wn,onPaneMouseLeave:rn,onPaneScroll:Jt,onPaneContextMenu:vn,onEdgeUpdate:Cn,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:En,onEdgeMouseLeave:sn,edgeUpdaterRadius:pn,onEdgeUpdateStart:Tn,onEdgeUpdateEnd:In,noDragClassName:yn,noWheelClassName:hn,noPanClassName:fn,elevateEdgesOnSelect:xn,disableKeyboardA11y:jn,nodeOrigin:cn,nodeExtent:Xt,rfId:Kt})=>{const kn=useNodeOrEdgeTypes(tt,createNodeTypes),Mn=useNodeOrEdgeTypes(et,createEdgeTypes);return useOnInitHandler(ot),React$1.createElement(FlowRenderer$1,{onPaneClick:tn,onPaneMouseEnter:dn,onPaneMouseMove:wn,onPaneMouseLeave:rn,onPaneContextMenu:vn,onPaneScroll:Jt,deleteKeyCode:jt,selectionKeyCode:St,selectionOnDrag:Tt,selectionMode:At,onSelectionStart:gt,onSelectionEnd:yt,multiSelectionKeyCode:Et,panActivationKeyCode:Ct,zoomActivationKeyCode:Lt,elementsSelectable:$t,onMove:nt,onMoveStart:rt,onMoveEnd:it,zoomOnScroll:Ut,zoomOnPinch:Pt,zoomOnDoubleClick:Yt,panOnScroll:Ht,panOnScrollSpeed:Qt,panOnScrollMode:an,panOnDrag:nn,defaultViewport:It,translateExtent:Ot,minZoom:Wt,maxZoom:zt,onSelectionContextMenu:mt,preventScrolling:Ft,noDragClassName:yn,noWheelClassName:hn,noPanClassName:fn,disableKeyboardA11y:jn},React$1.createElement(Viewport,null,React$1.createElement(EdgeRenderer$1,{edgeTypes:Mn,onEdgeClick:st,onEdgeDoubleClick:ct,onEdgeUpdate:Cn,onlyRenderVisibleElements:Rt,onEdgeContextMenu:$n,onEdgeMouseEnter:Nn,onEdgeMouseMove:En,onEdgeMouseLeave:sn,onEdgeUpdateStart:Tn,onEdgeUpdateEnd:In,edgeUpdaterRadius:pn,defaultMarkerColor:Nt,noPanClassName:fn,elevateEdgesOnSelect:!!xn,disableKeyboardA11y:jn,rfId:Kt},React$1.createElement(ConnectionLineWrapper,{style:wt,type:bt,component:xt,containerStyle:kt})),React$1.createElement("div",{className:"react-flow__edgelabel-renderer"}),React$1.createElement(NodeRenderer$1,{nodeTypes:kn,onNodeClick:at,onNodeDoubleClick:lt,onNodeMouseEnter:ut,onNodeMouseMove:ht,onNodeMouseLeave:dt,onNodeContextMenu:pt,selectNodesOnDrag:vt,onlyRenderVisibleElements:Rt,noPanClassName:fn,noDragClassName:yn,disableKeyboardA11y:jn,nodeOrigin:cn,nodeExtent:Xt,rfId:Kt})))};GraphView.displayName="GraphView";var GraphView$1=reactExports.memo(GraphView);const infiniteExtent=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],initialState={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:infiniteExtent,nodeExtent:infiniteExtent,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:devWarn,isValidConnection:void 0},createRFStore=()=>createWithEqualityFn((tt,et)=>({...initialState,setNodes:nt=>{const{nodeInternals:rt,nodeOrigin:it,elevateNodesOnSelect:ot}=et();tt({nodeInternals:createNodeInternals(nt,rt,it,ot)})},getNodes:()=>Array.from(et().nodeInternals.values()),setEdges:nt=>{const{defaultEdgeOptions:rt={}}=et();tt({edges:nt.map(it=>({...rt,...it}))})},setDefaultNodesAndEdges:(nt,rt)=>{const it=typeof nt<"u",ot=typeof rt<"u",at=it?createNodeInternals(nt,new Map,et().nodeOrigin,et().elevateNodesOnSelect):new Map;tt({nodeInternals:at,edges:ot?rt:[],hasDefaultNodes:it,hasDefaultEdges:ot})},updateNodeDimensions:nt=>{const{onNodesChange:rt,nodeInternals:it,fitViewOnInit:ot,fitViewOnInitDone:at,fitViewOnInitOptions:st,domNode:lt,nodeOrigin:ct}=et(),ut=lt==null?void 0:lt.querySelector(".react-flow__viewport");if(!ut)return;const ht=window.getComputedStyle(ut),{m22:dt}=new window.DOMMatrixReadOnly(ht.transform),pt=nt.reduce((gt,yt)=>{const bt=it.get(yt.id);if(bt){const wt=getDimensions(yt.nodeElement);!!(wt.width&&wt.height&&(bt.width!==wt.width||bt.height!==wt.height||yt.forceUpdate))&&(it.set(bt.id,{...bt,[internalsSymbol]:{...bt[internalsSymbol],handleBounds:{source:getHandleBounds(".source",yt.nodeElement,dt,ct),target:getHandleBounds(".target",yt.nodeElement,dt,ct)}},...wt}),gt.push({id:bt.id,type:"dimensions",dimensions:wt}))}return gt},[]);updateAbsoluteNodePositions(it,ct);const mt=at||ot&&!at&&fitView(et,{initial:!0,...st});tt({nodeInternals:new Map(it),fitViewOnInitDone:mt}),(pt==null?void 0:pt.length)>0&&(rt==null||rt(pt))},updateNodePositions:(nt,rt=!0,it=!1)=>{const{triggerNodeChanges:ot}=et(),at=nt.map(st=>{const lt={id:st.id,type:"position",dragging:it};return rt&&(lt.positionAbsolute=st.positionAbsolute,lt.position=st.position),lt});ot(at)},triggerNodeChanges:nt=>{const{onNodesChange:rt,nodeInternals:it,hasDefaultNodes:ot,nodeOrigin:at,getNodes:st,elevateNodesOnSelect:lt}=et();if(nt!=null&&nt.length){if(ot){const ct=applyNodeChanges(nt,st()),ut=createNodeInternals(ct,it,at,lt);tt({nodeInternals:ut})}rt==null||rt(nt)}},addSelectedNodes:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(ot(),nt),st=getSelectionChanges(it,[])),updateNodesAndEdgesSelections({changedNodes:at,changedEdges:st,get:et,set:tt})},addSelectedEdges:nt=>{const{multiSelectionActive:rt,edges:it,getNodes:ot}=et();let at,st=null;rt?at=nt.map(lt=>createSelectionChange(lt,!0)):(at=getSelectionChanges(it,nt),st=getSelectionChanges(ot(),[])),updateNodesAndEdgesSelections({changedNodes:st,changedEdges:at,get:et,set:tt})},unselectNodesAndEdges:({nodes:nt,edges:rt}={})=>{const{edges:it,getNodes:ot}=et(),at=nt||ot(),st=rt||it,lt=at.map(ut=>(ut.selected=!1,createSelectionChange(ut.id,!1))),ct=st.map(ut=>createSelectionChange(ut.id,!1));updateNodesAndEdgesSelections({changedNodes:lt,changedEdges:ct,get:et,set:tt})},setMinZoom:nt=>{const{d3Zoom:rt,maxZoom:it}=et();rt==null||rt.scaleExtent([nt,it]),tt({minZoom:nt})},setMaxZoom:nt=>{const{d3Zoom:rt,minZoom:it}=et();rt==null||rt.scaleExtent([it,nt]),tt({maxZoom:nt})},setTranslateExtent:nt=>{var rt;(rt=et().d3Zoom)==null||rt.translateExtent(nt),tt({translateExtent:nt})},resetSelectedElements:()=>{const{edges:nt,getNodes:rt}=et(),ot=rt().filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1)),at=nt.filter(st=>st.selected).map(st=>createSelectionChange(st.id,!1));updateNodesAndEdgesSelections({changedNodes:ot,changedEdges:at,get:et,set:tt})},setNodeExtent:nt=>{const{nodeInternals:rt}=et();rt.forEach(it=>{it.positionAbsolute=clampPosition(it.position,nt)}),tt({nodeExtent:nt,nodeInternals:new Map(rt)})},panBy:nt=>{const{transform:rt,width:it,height:ot,d3Zoom:at,d3Selection:st,translateExtent:lt}=et();if(!at||!st||!nt.x&&!nt.y)return!1;const ct=identity.translate(rt[0]+nt.x,rt[1]+nt.y).scale(rt[2]),ut=[[0,0],[it,ot]],ht=at==null?void 0:at.constrain()(ct,ut,lt);return at.transform(st,ht),rt[0]!==ht.x||rt[1]!==ht.y||rt[2]!==ht.k},cancelConnection:()=>tt({connectionNodeId:initialState.connectionNodeId,connectionHandleId:initialState.connectionHandleId,connectionHandleType:initialState.connectionHandleType,connectionStatus:initialState.connectionStatus,connectionStartHandle:initialState.connectionStartHandle,connectionEndHandle:initialState.connectionEndHandle}),reset:()=>tt({...initialState})}),Object.is),ReactFlowProvider=({children:tt})=>{const et=reactExports.useRef(null);return et.current||(et.current=createRFStore()),React$1.createElement(Provider$1,{value:et.current},tt)};ReactFlowProvider.displayName="ReactFlowProvider";const Wrapper$f=({children:tt})=>reactExports.useContext(StoreContext)?React$1.createElement(React$1.Fragment,null,tt):React$1.createElement(ReactFlowProvider,null,tt);Wrapper$f.displayName="ReactFlowWrapper";const defaultNodeTypes={input:InputNode$1,default:DefaultNode$1,output:OutputNode$1,group:GroupNode},defaultEdgeTypes={default:BezierEdge,straight:StraightEdge,step:StepEdge,smoothstep:SmoothStepEdge,simplebezier:SimpleBezierEdge},initNodeOrigin=[0,0],initSnapGrid=[15,15],initDefaultViewport={x:0,y:0,zoom:1},wrapperStyle={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},ReactFlow=reactExports.forwardRef(({nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,className:it,nodeTypes:ot=defaultNodeTypes,edgeTypes:at=defaultEdgeTypes,onNodeClick:st,onEdgeClick:lt,onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,onNodeMouseEnter:wt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:Ct,onNodesDelete:Lt,onEdgesDelete:jt,onSelectionChange:Rt,onSelectionDragStart:$t,onSelectionDrag:vt,onSelectionDragStop:It,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,connectionMode:Ft=ConnectionMode.Strict,connectionLineType:Nt=ConnectionLineType.Bezier,connectionLineStyle:Ut,connectionLineComponent:Pt,connectionLineContainerStyle:Ht,deleteKeyCode:Qt="Backspace",selectionKeyCode:an="Shift",selectionOnDrag:Yt=!1,selectionMode:nn=SelectionMode.Full,panActivationKeyCode:tn="Space",multiSelectionKeyCode:dn=isMacOs()?"Meta":"Control",zoomActivationKeyCode:wn=isMacOs()?"Meta":"Control",snapToGrid:rn=!1,snapGrid:Jt=initSnapGrid,onlyRenderVisibleElements:vn=!1,selectNodesOnDrag:Cn=!0,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:En,nodeOrigin:sn=initNodeOrigin,edgesFocusable:pn,edgesUpdatable:Tn,elementsSelectable:In,defaultViewport:yn=initDefaultViewport,minZoom:hn=.5,maxZoom:fn=2,translateExtent:xn=infiniteExtent,preventScrolling:jn=!0,nodeExtent:cn,defaultMarkerColor:Xt="#b1b1b7",zoomOnScroll:Kt=!0,zoomOnPinch:kn=!0,panOnScroll:Mn=!1,panOnScrollSpeed:On=.5,panOnScrollMode:Bn=PanOnScrollMode.Free,zoomOnDoubleClick:Xn=!0,panOnDrag:Vn=!0,onPaneClick:Gn,onPaneMouseEnter:zn,onPaneMouseMove:Zn,onPaneMouseLeave:Wn,onPaneScroll:fr,onPaneContextMenu:ur,children:wr,onEdgeUpdate:Xr,onEdgeContextMenu:Er,onEdgeDoubleClick:Ir,onEdgeMouseEnter:Gr,onEdgeMouseMove:Or,onEdgeMouseLeave:Lr,onEdgeUpdateStart:oo,onEdgeUpdateEnd:qr,edgeUpdaterRadius:jr=10,onNodesChange:mo,onEdgesChange:_n,noDragClassName:Pn="nodrag",noWheelClassName:un="nowheel",noPanClassName:Zt="nopan",fitView:Sn=!1,fitViewOptions:Dn,connectOnClick:Fn=!0,attributionPosition:Yn,proOptions:tr,defaultEdgeOptions:ar,elevateNodesOnSelect:lr=!0,elevateEdgesOnSelect:Vr=!1,disableKeyboardA11y:vr=!1,autoPanOnConnect:Nr=!0,autoPanOnNodeDrag:Hr=!0,connectionRadius:eo=20,isValidConnection:Zr,onError:Jr,style:br,id:Pr,nodeDragThreshold:Fr,...Mr},Cr)=>{const Dr=Pr||"1";return React$1.createElement("div",{...Mr,style:{...br,...wrapperStyle},ref:Cr,className:cc(["react-flow",it]),"data-testid":"rf__wrapper",id:Pr},React$1.createElement(Wrapper$f,null,React$1.createElement(GraphView$1,{onInit:ct,onMove:ut,onMoveStart:ht,onMoveEnd:dt,onNodeClick:st,onEdgeClick:lt,onNodeMouseEnter:wt,onNodeMouseMove:xt,onNodeMouseLeave:kt,onNodeContextMenu:St,onNodeDoubleClick:Tt,nodeTypes:ot,edgeTypes:at,connectionLineType:Nt,connectionLineStyle:Ut,connectionLineComponent:Pt,connectionLineContainerStyle:Ht,selectionKeyCode:an,selectionOnDrag:Yt,selectionMode:nn,deleteKeyCode:Qt,multiSelectionKeyCode:dn,panActivationKeyCode:tn,zoomActivationKeyCode:wn,onlyRenderVisibleElements:vn,selectNodesOnDrag:Cn,defaultViewport:yn,translateExtent:xn,minZoom:hn,maxZoom:fn,preventScrolling:jn,zoomOnScroll:Kt,zoomOnPinch:kn,zoomOnDoubleClick:Xn,panOnScroll:Mn,panOnScrollSpeed:On,panOnScrollMode:Bn,panOnDrag:Vn,onPaneClick:Gn,onPaneMouseEnter:zn,onPaneMouseMove:Zn,onPaneMouseLeave:Wn,onPaneScroll:fr,onPaneContextMenu:ur,onSelectionContextMenu:Ot,onSelectionStart:Wt,onSelectionEnd:zt,onEdgeUpdate:Xr,onEdgeContextMenu:Er,onEdgeDoubleClick:Ir,onEdgeMouseEnter:Gr,onEdgeMouseMove:Or,onEdgeMouseLeave:Lr,onEdgeUpdateStart:oo,onEdgeUpdateEnd:qr,edgeUpdaterRadius:jr,defaultMarkerColor:Xt,noDragClassName:Pn,noWheelClassName:un,noPanClassName:Zt,elevateEdgesOnSelect:Vr,rfId:Dr,disableKeyboardA11y:vr,nodeOrigin:sn,nodeExtent:cn}),React$1.createElement(StoreUpdater,{nodes:tt,edges:et,defaultNodes:nt,defaultEdges:rt,onConnect:pt,onConnectStart:mt,onConnectEnd:gt,onClickConnectStart:yt,onClickConnectEnd:bt,nodesDraggable:$n,nodesConnectable:Nn,nodesFocusable:En,edgesFocusable:pn,edgesUpdatable:Tn,elementsSelectable:In,elevateNodesOnSelect:lr,minZoom:hn,maxZoom:fn,nodeExtent:cn,onNodesChange:mo,onEdgesChange:_n,snapToGrid:rn,snapGrid:Jt,connectionMode:Ft,translateExtent:xn,connectOnClick:Fn,defaultEdgeOptions:ar,fitView:Sn,fitViewOptions:Dn,onNodesDelete:Lt,onEdgesDelete:jt,onNodeDragStart:At,onNodeDrag:Et,onNodeDragStop:Ct,onSelectionDrag:vt,onSelectionDragStart:$t,onSelectionDragStop:It,noPanClassName:Zt,nodeOrigin:sn,rfId:Dr,autoPanOnConnect:Nr,autoPanOnNodeDrag:Hr,onError:Jr,connectionRadius:eo,isValidConnection:Zr,nodeDragThreshold:Fr}),React$1.createElement(Wrapper$1$1,{onSelectionChange:Rt}),wr,React$1.createElement(Attribution,{proOptions:tr,position:Yn}),React$1.createElement(A11yDescriptions,{rfId:Dr,disableKeyboardA11y:vr})))});ReactFlow.displayName="ReactFlow";const style="",TeachMe=()=>{const[tt,et]=useDataStore(mt=>[mt.data,mt.setTeachMe]),[nt,rt]=useAppStore(mt=>[mt.currentSearch,mt.setSidebarOpen]),[it]=useUserStore(mt=>[mt.setBudget]),ot=reactExports.useRef(!1),at=useSocket(),[st,lt,ct,ut]=useTeachStore(mt=>[mt.setTeachMeAnswer,mt.setHasTeachingInProgress,mt.setInstagraphAnswer,mt.setHasInstagraphInProgress]),ht=reactExports.useCallback(mt=>{st(mt.tutorial),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Tutorial is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[st]),dt=reactExports.useCallback(mt=>{ct(mt),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"Instagraph is ready"}),{position:toast.POSITION.BOTTOM_CENTER,type:"success"})},[ct]);reactExports.useEffect(()=>{ot.current||(ht&&at&&(at.on("teachmehook",ht),ot.current=!0),dt&&at&&(at.on("instagraphhook",dt),ot.current=!0))},[at,ht,dt]);const pt=async()=>{if(nt){lt(!0),ut(!0),rt(!0),et(!0);try{const mt=tt==null?void 0:tt.nodes.filter(bt=>bt.text),gt=mt==null?void 0:mt.slice(0,5),yt=(gt!=null&>.length?gt.map(bt=>bt.text).join(" "):"").substring(0,2500).replace(/[?&=+/#]/g,bt=>`\\${bt}`);await distExports$1.enable(),await postTeachMe({term:nt,transcripts:yt}),await updateBudget(it),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing tutorial for you"}),{type:"success"}),await postInstagraph({term:nt,transcripts:yt}),await updateBudget(it),toast(jsxRuntimeExports.jsx(ToastMessage,{message:"We started preparing an instagraph for you"}),{type:"success"})}catch{lt(!1),ut(!1)}}};return jsxRuntimeExports.jsx(ButtonStyled$1,{onClick:()=>pt(),children:"Teach me"})},TeachMeLoader=({text:tt})=>jsxRuntimeExports.jsxs(Flex,{align:"center",justify:"center",py:12,children:[jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(PropagateLoader,{color:colors.white})}),jsxRuntimeExports.jsx(Flex,{align:"center",py:12,children:jsxRuntimeExports.jsx(Text$1,{children:tt})})]}),TeachMeText=()=>{const[tt,et,nt,rt]=useTeachStore(ot=>[ot.teachMeAnswer,ot.hasTeachingInProgress,ot.instgraphAnswser,ot.hasInstagraphInProgress]),it=!rt&&!!(nt!=null&&nt.edges)&&!!(nt!=null&&nt.nodes);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[it?jsxRuntimeExports.jsx(ReactFlow,{edges:nt==null?void 0:nt.edges,nodes:nt==null?void 0:nt.nodes}):jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating instagraph"}),et?jsxRuntimeExports.jsx(TeachMeLoader,{text:"Generating tutorial"}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TeachMeAnswerFlex,{children:jsxRuntimeExports.jsx(Text$1,{children:tt})}),jsxRuntimeExports.jsx(AskQuestion,{})]})]})},ButtonStyled$1=styled$4(Button$1)``,TeachMeAnswerFlex=styled$4(Flex)` padding-left: 10px; padding-right: 10px; -`,MENU_WIDTH$2=400,ComponentsMapper$1={askQuestion:jsxRuntimeExports.jsx(AskQuestion,{}),teachMe:jsxRuntimeExports.jsx(TeachMe,{}),sentiment:jsxRuntimeExports.jsx(SentimentAnalysis,{})},heightMap={askQuestion:400,sentiment:600,teachMe:400,default:200},HelperContent=()=>{const{isShow:tt,setIsShow:et}=useHelper(),[nt,rt]=reactExports.useState(null);return jsxRuntimeExports.jsx(ContentWrapper$1,{children:jsxRuntimeExports.jsx(Fade$1,{in:tt,mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsxs(Stack$3,{bgcolor:colors.listBg,component:Paper$1,elevation:2,height:heightMap[nt??"default"],p:2,pb:4,pt:4,sx:{transition:({transitions:it})=>`${it.create(["height","opacity"])}!important`,overflowY:"auto",overflowX:"hidden"},width:{xs:"calc(100vw - 8px * 4)",sm:MENU_WIDTH$2},children:[jsxRuntimeExports.jsx(CloseButton$3,{onClick:()=>{rt(null),et(it=>!it)}}),jsxRuntimeExports.jsx(ActionsMenu,{active:nt,onChange:rt}),nt&&ComponentsMapper$1[nt]]})})})},ContentWrapper$1=styled$1("div")(()=>({position:"absolute",bottom:"1rem",right:"1rem"})),CloseButton$3=styled$1(tt=>jsxRuntimeExports.jsx(IconButton$1,{component:"button",size:"small",...tt,children:jsxRuntimeExports.jsx(MdClose,{})}))(()=>({position:"absolute",right:"0.5rem",top:"0.5rem"})),dpr=window.devicePixelRatio||1,pi=Math.PI,points=12,radius=200*dpr,h=600*dpr,w=600*dpr,center={x:w/2*dpr,y:h/2*dpr},rangeMin=3,rangeMax=25,createBtn=tt=>{var at;const et=(at=tt.current)==null?void 0:at.getContext("2d"),nt=tt.current;if(!et||!nt)return null;const rt=getGradients(et);et.scale(dpr,dpr),nt.width=w*dpr,nt.height=h*dpr;const it=getCircles(rt),ot=setInterval(()=>{swingCircle(et,it,rt)},16);return()=>clearInterval(ot)};function cycle(tt,et){return(tt%et+et)%et}function swingCircle(tt,et,nt){tt.clearRect(0,0,w*dpr,h*dpr),tt.globalAlpha=.9,tt.globalCompositeOperation="screen";for(let rt=0;rt{const nt=reactExports.useRef(null);return reactExports.useEffect(()=>{const rt=createBtn(nt);return()=>{rt==null||rt()}},[]),jsxRuntimeExports.jsxs(ButtonContainer,{...et,children:[tt&&jsxRuntimeExports.jsx("div",{className:"children",children:tt}),jsxRuntimeExports.jsx(Canvas,{ref:nt})]})},ButtonContainer=styled$1(ButtonBase$1)(()=>({width:48,height:48,"& .children":{zIndex:1}})),Canvas=styled$1("canvas")(()=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:70,height:70})),OpenHelperBtn=()=>{const{setIsShow:tt}=useHelper(),[et]=useAppStore(it=>[it.sidebarIsOpen]),nt=reactExports.useRef(null),rt=useAppStore(it=>it.currentSearch);return reactExports.useEffect(()=>{const it=createBtn(nt);return()=>{it==null||it()}},[]),rt?jsxRuntimeExports.jsx(FabContainer,{sidebarIsOpen:et,children:jsxRuntimeExports.jsx(SiriLikeButton,{id:"cy-siri-btn",onClick:()=>tt(it=>!it)})}):null},FabContainer=styled$1("div")(({sidebarIsOpen:tt,theme:et})=>({position:"absolute",bottom:"2rem",transition:et.transitions.create(["right"]),right:tt?"calc((100% - 400px) / 2)":"50%",transform:"translate(50%)"})),Helper=()=>{const[tt,et]=reactExports.useState(!1),nt=reactExports.useMemo(()=>({isShow:tt,setIsShow:et}),[tt]);return jsxRuntimeExports.jsxs(HelperContext.Provider,{value:nt,children:[jsxRuntimeExports.jsx(OpenHelperBtn,{}),jsxRuntimeExports.jsx(HelperContent,{})]})},AddContentIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_25",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_25)",children:jsxRuntimeExports.jsx("path",{d:"M11.25 12.75V16C11.25 16.2125 11.3219 16.3906 11.4657 16.5343C11.6095 16.6781 11.7877 16.75 12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5346 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V12.75H16C16.2125 12.75 16.3906 12.6781 16.5344 12.5343C16.6781 12.3904 16.75 12.2122 16.75 11.9997C16.75 11.7871 16.6781 11.609 16.5344 11.4654C16.3906 11.3218 16.2125 11.25 16 11.25H12.75V7.99998C12.75 7.78748 12.6781 7.60935 12.5343 7.4656C12.3905 7.32187 12.2123 7.25 11.9997 7.25C11.7871 7.25 11.609 7.32187 11.4654 7.4656C11.3218 7.60935 11.25 7.78748 11.25 7.99998V11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H11.25ZM12.0017 21.5C10.6877 21.5 9.45271 21.2506 8.29658 20.752C7.14043 20.2533 6.13475 19.5765 5.27953 18.7217C4.4243 17.8669 3.74724 16.8616 3.24836 15.706C2.74947 14.5504 2.50003 13.3156 2.50003 12.0017C2.50003 10.6877 2.74936 9.45268 3.24803 8.29655C3.7467 7.1404 4.42345 6.13472 5.27828 5.2795C6.13313 4.42427 7.13837 3.74721 8.29401 3.24833C9.44962 2.74944 10.6844 2.5 11.9983 2.5C13.3123 2.5 14.5473 2.74933 15.7034 3.248C16.8596 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.1331 20.2528 7.13834 20.7517 8.29398C21.2505 9.44959 21.5 10.6844 21.5 11.9983C21.5 13.3122 21.2506 14.5473 20.752 15.7034C20.2533 16.8596 19.5766 17.8652 18.7217 18.7205C17.8669 19.5757 16.8616 20.2527 15.706 20.7516C14.5504 21.2505 13.3156 21.5 12.0017 21.5ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76664 19.225 7.87498 17.675 6.32498C16.125 4.77498 14.2333 3.99998 12 3.99998C9.76667 3.99998 7.87501 4.77498 6.32501 6.32498C4.77501 7.87498 4.00001 9.76664 4.00001 12C4.00001 14.2333 4.77501 16.125 6.32501 17.675C7.87501 19.225 9.76667 20 12 20Z",fill:"currentColor"})})]}),AddSourceIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_27",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_27)",children:jsxRuntimeExports.jsx("path",{d:"M5.30773 20.5C4.81061 20.5 4.38506 20.3229 4.03106 19.9689C3.67704 19.6149 3.50003 19.1894 3.50003 18.6923V5.3077C3.50003 4.81058 3.67704 4.38503 4.03106 4.03103C4.38506 3.67701 4.81061 3.5 5.30773 3.5H18.6923C19.1894 3.5 19.615 3.67701 19.969 4.03103C20.323 4.38503 20.5 4.81058 20.5 5.3077V11.6327C20.2538 11.5275 20.0074 11.4384 19.7606 11.3654C19.5138 11.2923 19.2603 11.234 19 11.1904V5.3077C19 5.23077 18.968 5.16024 18.9039 5.09613C18.8397 5.03203 18.7692 4.99998 18.6923 4.99998H5.30773C5.2308 4.99998 5.16027 5.03203 5.09616 5.09613C5.03206 5.16024 5.00001 5.23077 5.00001 5.3077V18.6923C5.00001 18.7692 5.03206 18.8397 5.09616 18.9038C5.16027 18.9679 5.2308 19 5.30773 19H11.1654C11.2026 19.2769 11.2577 19.5387 11.3308 19.7855C11.4038 20.0323 11.4929 20.2705 11.5981 20.5H5.30773ZM5.00001 19V4.99998V11.1904V11.1154V19ZM7.25003 15.8849C7.25003 16.0975 7.32191 16.2756 7.46566 16.4192C7.60939 16.5628 7.78751 16.6346 8.00001 16.6346H11.2673C11.3109 16.3743 11.3757 16.1208 11.4616 15.874C11.5475 15.6272 11.641 15.3808 11.7423 15.1346H8.00001C7.78751 15.1346 7.60939 15.2065 7.46566 15.3503C7.32191 15.4941 7.25003 15.6723 7.25003 15.8849ZM7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H13.5904C14.0212 12.3846 14.4808 12.0785 14.9692 11.8317C15.4577 11.5849 15.9807 11.4096 16.5384 11.3058C16.4259 11.281 16.3009 11.2655 16.1634 11.2593C16.0259 11.2531 15.901 11.25 15.7885 11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003ZM7.25003 8.1157C7.25003 8.3283 7.32191 8.50639 7.46566 8.64998C7.60939 8.79356 7.78751 8.86535 8.00001 8.86535H16C16.2125 8.86535 16.3906 8.79344 16.5344 8.64963C16.6781 8.50583 16.75 8.32763 16.75 8.11503C16.75 7.90244 16.6781 7.72436 16.5344 7.58078C16.3906 7.43718 16.2125 7.36538 16 7.36538H8.00001C7.78751 7.36538 7.60939 7.43728 7.46566 7.5811C7.32191 7.72492 7.25003 7.90312 7.25003 8.1157ZM18 22.5576C16.7513 22.5576 15.6891 22.1198 14.8135 21.2442C13.9378 20.3685 13.5 19.3064 13.5 18.0577C13.5 16.809 13.9378 15.7468 14.8135 14.8712C15.6891 13.9955 16.7513 13.5577 18 13.5577C19.2487 13.5577 20.3109 13.9955 21.1865 14.8712C22.0622 15.7468 22.5 16.809 22.5 18.0577C22.5 19.3064 22.0622 20.3685 21.1865 21.2442C20.3109 22.1198 19.2487 22.5576 18 22.5576ZM17.5577 18.5V20.5577C17.5577 20.6756 17.6019 20.7788 17.6904 20.8673C17.7788 20.9557 17.8821 21 18 21C18.118 21 18.2212 20.9557 18.3096 20.8673C18.3981 20.7788 18.4423 20.6756 18.4423 20.5577V18.5H20.5C20.618 18.5 20.7212 18.4557 20.8096 18.3673C20.8981 18.2788 20.9423 18.1756 20.9423 18.0577C20.9423 17.9397 20.8981 17.8365 20.8096 17.748C20.7212 17.6596 20.618 17.6154 20.5 17.6154H18.4423V15.5577C18.4423 15.4397 18.3981 15.3365 18.3096 15.2481C18.2212 15.1596 18.118 15.1154 18 15.1154C17.8821 15.1154 17.7788 15.1596 17.6904 15.2481C17.6019 15.3365 17.5577 15.4397 17.5577 15.5577V17.6154H15.5C15.3821 17.6154 15.2788 17.6596 15.1904 17.748C15.1019 17.8365 15.0577 17.9397 15.0577 18.0577C15.0577 18.1756 15.1019 18.2788 15.1904 18.3673C15.2788 18.4557 15.3821 18.5 15.5 18.5H17.5577Z",fill:"currentColor"})})]}),SentimentDataIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_28",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_28)",children:jsxRuntimeExports.jsx("path",{d:"M3 20.75L2.91345 19.4327L4.74998 17.6058V20.75H3ZM7.25003 20.75V15.1058L8.74998 13.6058V20.75H7.25003ZM11.25 20.75V13.6058L12.75 15.1308V20.75H11.25ZM15.25 20.75V15.1308L16.75 13.6308V20.75H15.25ZM19.25 20.75V11.1058L20.75 9.60583V20.75H19.25ZM3.25003 15.2192V13.1058L10 6.35581L14 10.3558L20.75 3.60583V5.71924L14 12.4692L10 8.46921L3.25003 15.2192Z",fill:"currentColor"})})]}),SourcesTableIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_26",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_26)",children:jsxRuntimeExports.jsx("path",{d:"M10.0577 18.7499C9.84521 18.7499 9.66708 18.678 9.52333 18.5342C9.3796 18.3904 9.30773 18.2122 9.30773 17.9996C9.30773 17.787 9.3796 17.609 9.52333 17.4654C9.66708 17.3218 9.84521 17.25 10.0577 17.25H19.75C19.9625 17.25 20.1406 17.3219 20.2844 17.4657C20.4281 17.6095 20.5 17.7877 20.5 18.0003C20.5 18.2129 20.4281 18.391 20.2844 18.5346C20.1406 18.6782 19.9625 18.7499 19.75 18.7499H10.0577ZM10.0577 12.7499C9.84521 12.7499 9.66708 12.678 9.52333 12.5342C9.3796 12.3904 9.30773 12.2122 9.30773 11.9996C9.30773 11.787 9.3796 11.609 9.52333 11.4654C9.66708 11.3218 9.84521 11.25 10.0577 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2844 11.4657C20.4281 11.6095 20.5 11.7877 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2844 12.5346C20.1406 12.6782 19.9625 12.7499 19.75 12.7499H10.0577ZM10.0577 6.74995C9.84521 6.74995 9.66708 6.67805 9.52333 6.53425C9.3796 6.39043 9.30773 6.21223 9.30773 5.99965C9.30773 5.78705 9.3796 5.60896 9.52333 5.46537C9.66708 5.32179 9.84521 5.25 10.0577 5.25H19.75C19.9625 5.25 20.1406 5.3219 20.2844 5.4657C20.4281 5.60951 20.5 5.78771 20.5 6.0003C20.5 6.2129 20.4281 6.39099 20.2844 6.53457C20.1406 6.67816 19.9625 6.74995 19.75 6.74995H10.0577ZM5.16348 19.6634C4.70603 19.6634 4.31443 19.5005 3.98868 19.1748C3.66291 18.849 3.50003 18.4574 3.50003 18C3.50003 17.5425 3.66291 17.1509 3.98868 16.8252C4.31443 16.4994 4.70603 16.3365 5.16348 16.3365C5.62093 16.3365 6.01253 16.4994 6.33828 16.8252C6.66403 17.1509 6.82691 17.5425 6.82691 18C6.82691 18.4574 6.66403 18.849 6.33828 19.1748C6.01253 19.5005 5.62093 19.6634 5.16348 19.6634ZM5.16348 13.6634C4.70603 13.6634 4.31443 13.5005 3.98868 13.1748C3.66291 12.849 3.50003 12.4574 3.50003 12C3.50003 11.5425 3.66291 11.1509 3.98868 10.8252C4.31443 10.4994 4.70603 10.3365 5.16348 10.3365C5.62093 10.3365 6.01253 10.4994 6.33828 10.8252C6.66403 11.1509 6.82691 11.5425 6.82691 12C6.82691 12.4574 6.66403 12.849 6.33828 13.1748C6.01253 13.5005 5.62093 13.6634 5.16348 13.6634ZM5.16348 7.6634C4.70603 7.6634 4.31443 7.50052 3.98868 7.17477C3.66291 6.84902 3.50003 6.45742 3.50003 5.99997C3.50003 5.54252 3.66291 5.15092 3.98868 4.82517C4.31443 4.49942 4.70603 4.33655 5.16348 4.33655C5.62093 4.33655 6.01253 4.49942 6.33828 4.82517C6.66403 5.15092 6.82691 5.54252 6.82691 5.99997C6.82691 6.45742 6.66403 6.84902 6.33828 7.17477C6.01253 7.50052 5.62093 7.6634 5.16348 7.6634Z",fill:"currentColor"})})]}),MainToolbar=()=>{const[tt]=useAppStore(ot=>[ot.setSecondarySidebarActiveTab]),{open:et}=useModal$1("sourcesTable"),{open:nt}=useModal$1("addContent"),{open:rt}=useModal$1("addSource"),it=ot=>{tt(ot)};return jsxRuntimeExports.jsxs(Wrapper$e,{children:[jsxRuntimeExports.jsx(LogoButton,{onClick:()=>it("about"),children:jsxRuntimeExports.jsx("img",{alt:"Second brain",src:"logo.svg"})}),jsxRuntimeExports.jsxs(ActionButton,{onClick:nt,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddContentIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Add Content"})]}),jsxRuntimeExports.jsxs(ActionButton,{onClick:rt,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddSourceIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Add Source"})]}),jsxRuntimeExports.jsxs(ActionButton,{id:"cy-open-soure-table",onClick:et,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SourcesTableIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Source Table"})]}),jsxRuntimeExports.jsxs(ActionButton,{id:"cy-open-sentiment-data",onClick:()=>it("sentiment"),children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SentimentDataIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Sentiment Data"})]}),jsxRuntimeExports.jsxs(ActionButton,{children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SettingsIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Change Display"})]})]})},Wrapper$e=styled$4(Flex).attrs({align:"flex-start",direction:"column",justify:"flex-start"})` +`,MENU_WIDTH$2=400,ComponentsMapper$1={askQuestion:jsxRuntimeExports.jsx(AskQuestion,{}),teachMe:jsxRuntimeExports.jsx(TeachMe,{}),sentiment:jsxRuntimeExports.jsx(SentimentAnalysis,{})},heightMap={askQuestion:400,sentiment:600,teachMe:400,default:200},HelperContent=()=>{const{isShow:tt,setIsShow:et}=useHelper(),[nt,rt]=reactExports.useState(null);return jsxRuntimeExports.jsx(ContentWrapper$1,{children:jsxRuntimeExports.jsx(Fade$1,{in:tt,mountOnEnter:!0,unmountOnExit:!0,children:jsxRuntimeExports.jsxs(Stack$3,{bgcolor:colors.listBg,component:Paper$1,elevation:2,height:heightMap[nt??"default"],p:2,pb:4,pt:4,sx:{transition:({transitions:it})=>`${it.create(["height","opacity"])}!important`,overflowY:"auto",overflowX:"hidden"},width:{xs:"calc(100vw - 8px * 4)",sm:MENU_WIDTH$2},children:[jsxRuntimeExports.jsx(CloseButton$3,{onClick:()=>{rt(null),et(it=>!it)}}),jsxRuntimeExports.jsx(ActionsMenu,{active:nt,onChange:rt}),nt&&ComponentsMapper$1[nt]]})})})},ContentWrapper$1=styled$1("div")(()=>({position:"absolute",bottom:"1rem",right:"1rem"})),CloseButton$3=styled$1(tt=>jsxRuntimeExports.jsx(IconButton$1,{component:"button",size:"small",...tt,children:jsxRuntimeExports.jsx(MdClose,{})}))(()=>({position:"absolute",right:"0.5rem",top:"0.5rem"})),dpr=window.devicePixelRatio||1,pi=Math.PI,points=12,radius=200*dpr,h=600*dpr,w=600*dpr,center={x:w/2*dpr,y:h/2*dpr},rangeMin=3,rangeMax=25,createBtn=tt=>{var at;const et=(at=tt.current)==null?void 0:at.getContext("2d"),nt=tt.current;if(!et||!nt)return null;const rt=getGradients(et);et.scale(dpr,dpr),nt.width=w*dpr,nt.height=h*dpr;const it=getCircles(rt),ot=setInterval(()=>{swingCircle(et,it,rt)},16);return()=>clearInterval(ot)};function cycle(tt,et){return(tt%et+et)%et}function swingCircle(tt,et,nt){tt.clearRect(0,0,w*dpr,h*dpr),tt.globalAlpha=.9,tt.globalCompositeOperation="screen";for(let rt=0;rt{const nt=reactExports.useRef(null);return reactExports.useEffect(()=>{const rt=createBtn(nt);return()=>{rt==null||rt()}},[]),jsxRuntimeExports.jsxs(ButtonContainer,{...et,children:[tt&&jsxRuntimeExports.jsx("div",{className:"children",children:tt}),jsxRuntimeExports.jsx(Canvas,{ref:nt})]})},ButtonContainer=styled$1(ButtonBase$1)(()=>({width:48,height:48,"& .children":{zIndex:1}})),Canvas=styled$1("canvas")(()=>({position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:70,height:70})),OpenHelperBtn=()=>{const{setIsShow:tt}=useHelper(),[et]=useAppStore(it=>[it.sidebarIsOpen]),nt=reactExports.useRef(null),rt=useAppStore(it=>it.currentSearch);return reactExports.useEffect(()=>{const it=createBtn(nt);return()=>{it==null||it()}},[]),rt?jsxRuntimeExports.jsx(FabContainer,{sidebarIsOpen:et,children:jsxRuntimeExports.jsx(SiriLikeButton,{id:"cy-siri-btn",onClick:()=>tt(it=>!it)})}):null},FabContainer=styled$1("div")(({sidebarIsOpen:tt,theme:et})=>({position:"absolute",bottom:"2rem",transition:et.transitions.create(["right"]),right:tt?"calc((100% - 400px) / 2)":"50%",transform:"translate(50%)"})),Helper=()=>{const[tt,et]=reactExports.useState(!1),nt=reactExports.useMemo(()=>({isShow:tt,setIsShow:et}),[tt]);return jsxRuntimeExports.jsxs(HelperContext.Provider,{value:nt,children:[jsxRuntimeExports.jsx(OpenHelperBtn,{}),jsxRuntimeExports.jsx(HelperContent,{})]})},AddContentIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_25",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_25)",children:jsxRuntimeExports.jsx("path",{d:"M11.25 12.75V16C11.25 16.2125 11.3219 16.3906 11.4657 16.5343C11.6095 16.6781 11.7877 16.75 12.0003 16.75C12.2129 16.75 12.391 16.6781 12.5346 16.5343C12.6782 16.3906 12.75 16.2125 12.75 16V12.75H16C16.2125 12.75 16.3906 12.6781 16.5344 12.5343C16.6781 12.3904 16.75 12.2122 16.75 11.9997C16.75 11.7871 16.6781 11.609 16.5344 11.4654C16.3906 11.3218 16.2125 11.25 16 11.25H12.75V7.99998C12.75 7.78748 12.6781 7.60935 12.5343 7.4656C12.3905 7.32187 12.2123 7.25 11.9997 7.25C11.7871 7.25 11.609 7.32187 11.4654 7.4656C11.3218 7.60935 11.25 7.78748 11.25 7.99998V11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H11.25ZM12.0017 21.5C10.6877 21.5 9.45271 21.2506 8.29658 20.752C7.14043 20.2533 6.13475 19.5765 5.27953 18.7217C4.4243 17.8669 3.74724 16.8616 3.24836 15.706C2.74947 14.5504 2.50003 13.3156 2.50003 12.0017C2.50003 10.6877 2.74936 9.45268 3.24803 8.29655C3.7467 7.1404 4.42345 6.13472 5.27828 5.2795C6.13313 4.42427 7.13837 3.74721 8.29401 3.24833C9.44962 2.74944 10.6844 2.5 11.9983 2.5C13.3123 2.5 14.5473 2.74933 15.7034 3.248C16.8596 3.74667 17.8653 4.42342 18.7205 5.27825C19.5757 6.1331 20.2528 7.13834 20.7517 8.29398C21.2505 9.44959 21.5 10.6844 21.5 11.9983C21.5 13.3122 21.2506 14.5473 20.752 15.7034C20.2533 16.8596 19.5766 17.8652 18.7217 18.7205C17.8669 19.5757 16.8616 20.2527 15.706 20.7516C14.5504 21.2505 13.3156 21.5 12.0017 21.5ZM12 20C14.2333 20 16.125 19.225 17.675 17.675C19.225 16.125 20 14.2333 20 12C20 9.76664 19.225 7.87498 17.675 6.32498C16.125 4.77498 14.2333 3.99998 12 3.99998C9.76667 3.99998 7.87501 4.77498 6.32501 6.32498C4.77501 7.87498 4.00001 9.76664 4.00001 12C4.00001 14.2333 4.77501 16.125 6.32501 17.675C7.87501 19.225 9.76667 20 12 20Z",fill:"currentColor"})})]}),AddSourceIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_27",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_27)",children:jsxRuntimeExports.jsx("path",{d:"M5.30773 20.5C4.81061 20.5 4.38506 20.3229 4.03106 19.9689C3.67704 19.6149 3.50003 19.1894 3.50003 18.6923V5.3077C3.50003 4.81058 3.67704 4.38503 4.03106 4.03103C4.38506 3.67701 4.81061 3.5 5.30773 3.5H18.6923C19.1894 3.5 19.615 3.67701 19.969 4.03103C20.323 4.38503 20.5 4.81058 20.5 5.3077V11.6327C20.2538 11.5275 20.0074 11.4384 19.7606 11.3654C19.5138 11.2923 19.2603 11.234 19 11.1904V5.3077C19 5.23077 18.968 5.16024 18.9039 5.09613C18.8397 5.03203 18.7692 4.99998 18.6923 4.99998H5.30773C5.2308 4.99998 5.16027 5.03203 5.09616 5.09613C5.03206 5.16024 5.00001 5.23077 5.00001 5.3077V18.6923C5.00001 18.7692 5.03206 18.8397 5.09616 18.9038C5.16027 18.9679 5.2308 19 5.30773 19H11.1654C11.2026 19.2769 11.2577 19.5387 11.3308 19.7855C11.4038 20.0323 11.4929 20.2705 11.5981 20.5H5.30773ZM5.00001 19V4.99998V11.1904V11.1154V19ZM7.25003 15.8849C7.25003 16.0975 7.32191 16.2756 7.46566 16.4192C7.60939 16.5628 7.78751 16.6346 8.00001 16.6346H11.2673C11.3109 16.3743 11.3757 16.1208 11.4616 15.874C11.5475 15.6272 11.641 15.3808 11.7423 15.1346H8.00001C7.78751 15.1346 7.60939 15.2065 7.46566 15.3503C7.32191 15.4941 7.25003 15.6723 7.25003 15.8849ZM7.25003 12.0003C7.25003 12.2129 7.32191 12.391 7.46566 12.5346C7.60939 12.6782 7.78751 12.75 8.00001 12.75H13.5904C14.0212 12.3846 14.4808 12.0785 14.9692 11.8317C15.4577 11.5849 15.9807 11.4096 16.5384 11.3058C16.4259 11.281 16.3009 11.2655 16.1634 11.2593C16.0259 11.2531 15.901 11.25 15.7885 11.25H8.00001C7.78751 11.25 7.60939 11.3219 7.46566 11.4657C7.32191 11.6095 7.25003 11.7877 7.25003 12.0003ZM7.25003 8.1157C7.25003 8.3283 7.32191 8.50639 7.46566 8.64998C7.60939 8.79356 7.78751 8.86535 8.00001 8.86535H16C16.2125 8.86535 16.3906 8.79344 16.5344 8.64963C16.6781 8.50583 16.75 8.32763 16.75 8.11503C16.75 7.90244 16.6781 7.72436 16.5344 7.58078C16.3906 7.43718 16.2125 7.36538 16 7.36538H8.00001C7.78751 7.36538 7.60939 7.43728 7.46566 7.5811C7.32191 7.72492 7.25003 7.90312 7.25003 8.1157ZM18 22.5576C16.7513 22.5576 15.6891 22.1198 14.8135 21.2442C13.9378 20.3685 13.5 19.3064 13.5 18.0577C13.5 16.809 13.9378 15.7468 14.8135 14.8712C15.6891 13.9955 16.7513 13.5577 18 13.5577C19.2487 13.5577 20.3109 13.9955 21.1865 14.8712C22.0622 15.7468 22.5 16.809 22.5 18.0577C22.5 19.3064 22.0622 20.3685 21.1865 21.2442C20.3109 22.1198 19.2487 22.5576 18 22.5576ZM17.5577 18.5V20.5577C17.5577 20.6756 17.6019 20.7788 17.6904 20.8673C17.7788 20.9557 17.8821 21 18 21C18.118 21 18.2212 20.9557 18.3096 20.8673C18.3981 20.7788 18.4423 20.6756 18.4423 20.5577V18.5H20.5C20.618 18.5 20.7212 18.4557 20.8096 18.3673C20.8981 18.2788 20.9423 18.1756 20.9423 18.0577C20.9423 17.9397 20.8981 17.8365 20.8096 17.748C20.7212 17.6596 20.618 17.6154 20.5 17.6154H18.4423V15.5577C18.4423 15.4397 18.3981 15.3365 18.3096 15.2481C18.2212 15.1596 18.118 15.1154 18 15.1154C17.8821 15.1154 17.7788 15.1596 17.6904 15.2481C17.6019 15.3365 17.5577 15.4397 17.5577 15.5577V17.6154H15.5C15.3821 17.6154 15.2788 17.6596 15.1904 17.748C15.1019 17.8365 15.0577 17.9397 15.0577 18.0577C15.0577 18.1756 15.1019 18.2788 15.1904 18.3673C15.2788 18.4557 15.3821 18.5 15.5 18.5H17.5577Z",fill:"currentColor"})})]}),SourcesTableIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_26",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_26)",children:jsxRuntimeExports.jsx("path",{d:"M10.0577 18.7499C9.84521 18.7499 9.66708 18.678 9.52333 18.5342C9.3796 18.3904 9.30773 18.2122 9.30773 17.9996C9.30773 17.787 9.3796 17.609 9.52333 17.4654C9.66708 17.3218 9.84521 17.25 10.0577 17.25H19.75C19.9625 17.25 20.1406 17.3219 20.2844 17.4657C20.4281 17.6095 20.5 17.7877 20.5 18.0003C20.5 18.2129 20.4281 18.391 20.2844 18.5346C20.1406 18.6782 19.9625 18.7499 19.75 18.7499H10.0577ZM10.0577 12.7499C9.84521 12.7499 9.66708 12.678 9.52333 12.5342C9.3796 12.3904 9.30773 12.2122 9.30773 11.9996C9.30773 11.787 9.3796 11.609 9.52333 11.4654C9.66708 11.3218 9.84521 11.25 10.0577 11.25H19.75C19.9625 11.25 20.1406 11.3219 20.2844 11.4657C20.4281 11.6095 20.5 11.7877 20.5 12.0003C20.5 12.2129 20.4281 12.391 20.2844 12.5346C20.1406 12.6782 19.9625 12.7499 19.75 12.7499H10.0577ZM10.0577 6.74995C9.84521 6.74995 9.66708 6.67805 9.52333 6.53425C9.3796 6.39043 9.30773 6.21223 9.30773 5.99965C9.30773 5.78705 9.3796 5.60896 9.52333 5.46537C9.66708 5.32179 9.84521 5.25 10.0577 5.25H19.75C19.9625 5.25 20.1406 5.3219 20.2844 5.4657C20.4281 5.60951 20.5 5.78771 20.5 6.0003C20.5 6.2129 20.4281 6.39099 20.2844 6.53457C20.1406 6.67816 19.9625 6.74995 19.75 6.74995H10.0577ZM5.16348 19.6634C4.70603 19.6634 4.31443 19.5005 3.98868 19.1748C3.66291 18.849 3.50003 18.4574 3.50003 18C3.50003 17.5425 3.66291 17.1509 3.98868 16.8252C4.31443 16.4994 4.70603 16.3365 5.16348 16.3365C5.62093 16.3365 6.01253 16.4994 6.33828 16.8252C6.66403 17.1509 6.82691 17.5425 6.82691 18C6.82691 18.4574 6.66403 18.849 6.33828 19.1748C6.01253 19.5005 5.62093 19.6634 5.16348 19.6634ZM5.16348 13.6634C4.70603 13.6634 4.31443 13.5005 3.98868 13.1748C3.66291 12.849 3.50003 12.4574 3.50003 12C3.50003 11.5425 3.66291 11.1509 3.98868 10.8252C4.31443 10.4994 4.70603 10.3365 5.16348 10.3365C5.62093 10.3365 6.01253 10.4994 6.33828 10.8252C6.66403 11.1509 6.82691 11.5425 6.82691 12C6.82691 12.4574 6.66403 12.849 6.33828 13.1748C6.01253 13.5005 5.62093 13.6634 5.16348 13.6634ZM5.16348 7.6634C4.70603 7.6634 4.31443 7.50052 3.98868 7.17477C3.66291 6.84902 3.50003 6.45742 3.50003 5.99997C3.50003 5.54252 3.66291 5.15092 3.98868 4.82517C4.31443 4.49942 4.70603 4.33655 5.16348 4.33655C5.62093 4.33655 6.01253 4.49942 6.33828 4.82517C6.66403 5.15092 6.82691 5.54252 6.82691 5.99997C6.82691 6.45742 6.66403 6.84902 6.33828 7.17477C6.01253 7.50052 5.62093 7.6634 5.16348 7.6634Z",fill:"currentColor"})})]}),MainToolbar=()=>{const[tt]=useAppStore(ot=>[ot.setSecondarySidebarActiveTab]),{open:et}=useModal$1("sourcesTable"),{open:nt}=useModal$1("addContent"),{open:rt}=useModal$1("addSource"),it=ot=>{tt(ot)};return jsxRuntimeExports.jsxs(Wrapper$e,{children:[jsxRuntimeExports.jsx(LogoButton,{onClick:()=>it("about"),children:jsxRuntimeExports.jsx("img",{alt:"Second brain",src:"logo.svg"})}),jsxRuntimeExports.jsxs(ActionButton,{onClick:nt,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddContentIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Add Content"})]}),jsxRuntimeExports.jsxs(ActionButton,{onClick:rt,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(AddSourceIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Add Source"})]}),jsxRuntimeExports.jsxs(ActionButton,{id:"cy-open-soure-table",onClick:et,children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SourcesTableIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Source Table"})]}),jsxRuntimeExports.jsxs(ActionButton,{children:[jsxRuntimeExports.jsx(IconWrapper,{children:jsxRuntimeExports.jsx(SettingsIcon,{})}),jsxRuntimeExports.jsx(Text$1,{children:"Settings"})]})]})},Wrapper$e=styled$4(Flex).attrs({align:"flex-start",direction:"column",justify:"flex-start"})` flex: 0 0 64px; z-index: 31; transition: opacity 1s; @@ -6744,7 +6744,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho &:active { } -`,ScrollWrapper$1=styled$4(Flex)(()=>({height:"100%",width:"100%"})),CollapseButton$1=styled$4(Flex).attrs({align:"center",justify:"center",p:8})(({theme:tt})=>({backgroundColor:colors.BG1_NORMAL,cursor:"pointer",transitionDuration:"0.2s",position:"absolute",right:"0px",top:"50%",zIndex:1,width:"24px",height:"48px",transform:"translateY(-50%)",borderRadius:"0px 6px 6px 0px",boxShadow:"2px 0px 6px 0px rgba(0, 0, 0, 0.25) inset",color:colors.white,[tt.breakpoints.up("sm")]:{left:"100%"},"&:hover":{backgroundColor:colors.BG1_HOVER},"&:active":{backgroundColor:colors.BG1_PRESS,color:colors.GRAY6}})),ChevronRightIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 18 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"chevron_right",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1247_21809",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"18",height:"18",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1247_21809)",children:jsxRuntimeExports.jsx("path",{id:"chevron_right_2",d:"M9.44998 8.99998L6.52498 6.07498C6.38748 5.93748 6.31873 5.76248 6.31873 5.54998C6.31873 5.33748 6.38748 5.16248 6.52498 5.02498C6.66248 4.88748 6.83748 4.81873 7.04998 4.81873C7.26248 4.81873 7.43748 4.88748 7.57498 5.02498L11.025 8.47498C11.1 8.54997 11.1531 8.63123 11.1844 8.71873C11.2156 8.80623 11.2312 8.89998 11.2312 8.99998C11.2312 9.09998 11.2156 9.19373 11.1844 9.28123C11.1531 9.36873 11.1 9.44998 11.025 9.52497L7.57498 12.975C7.43748 13.1125 7.26248 13.1812 7.04998 13.1812C6.83748 13.1812 6.66248 13.1125 6.52498 12.975C6.38748 12.8375 6.31873 12.6625 6.31873 12.45C6.31873 12.2375 6.38748 12.0625 6.52498 11.925L9.44998 8.99998Z",fill:"currentColor"})})]})}),Tab=()=>{const tt=useAppStore(et=>et.setSidebarOpen);return jsxRuntimeExports.jsx(ExpandButton,{onClick:()=>{tt(!0)},children:jsxRuntimeExports.jsx(ChevronRightIcon,{})})},ExpandButton=styled$4(Flex).attrs({align:"center",justify:"center",p:8})(({theme:tt})=>({backgroundColor:colors.BG1_NORMAL,cursor:"pointer",transitionDuration:"0.2s",position:"absolute",top:"50%",zIndex:1,width:"24px",height:"48px",transform:"translateY(-50%)",borderRadius:"0px 6px 6px 0px",boxShadow:"2px 0px 6px 0px rgba(0, 0, 0, 0.25) inset",color:colors.white,[tt.breakpoints.up("sm")]:{left:"64px"},"&:hover":{backgroundColor:colors.BG1_HOVER},"&:active":{backgroundColor:colors.BG1_PRESS,color:colors.GRAY6}})),TRENDING_TOPICS=["Drivechain","Ordinals","L402","Nostr","AI"],Trending=({onSubmit:tt})=>{const[et,nt]=reactExports.useState(!1),[rt,it]=useDataStore(st=>[st.trendingTopics,st.setTrendingTopics]),{setValue:ot}=useFormContext();reactExports.useEffect(()=>{const st=async()=>{nt(!0);try{const lt=await getTrends();lt.length&&it(lt.map(ct=>ct.topic))}catch{it(TRENDING_TOPICS)}finally{nt(!1)}};rt.length||st()},[rt,it]);const at=st=>{ot("search",st),tt==null||tt()};return jsxRuntimeExports.jsxs(Wrapper$2,{children:[jsxRuntimeExports.jsxs("div",{className:"heading",children:[jsxRuntimeExports.jsx("span",{className:"heading__title",children:"Trending Topics"}),jsxRuntimeExports.jsx("span",{className:"heading__icon",children:et?jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.PRIMARY_BLUE,size:16}):jsxRuntimeExports.jsx(SentimentDataIcon,{})})]}),jsxRuntimeExports.jsx("ul",{className:"list",children:et?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:rt.map(st=>jsxRuntimeExports.jsxs(Flex,{className:"list-item",onClick:()=>at(st),children:["#",st]},st))})})]})},Wrapper$2=styled$4(Flex)` +`,ScrollWrapper$1=styled$4(Flex)(()=>({height:"100%",width:"100%"})),CollapseButton$1=styled$4(Flex).attrs({align:"center",justify:"center",p:8})(({theme:tt})=>({backgroundColor:colors.BG1_NORMAL,cursor:"pointer",transitionDuration:"0.2s",position:"absolute",right:"0px",top:"50%",zIndex:1,width:"24px",height:"48px",transform:"translateY(-50%)",borderRadius:"0px 6px 6px 0px",boxShadow:"2px 0px 6px 0px rgba(0, 0, 0, 0.25) inset",color:colors.white,[tt.breakpoints.up("sm")]:{left:"100%"},"&:hover":{backgroundColor:colors.BG1_HOVER},"&:active":{backgroundColor:colors.BG1_PRESS,color:colors.GRAY6}})),ChevronRightIcon=tt=>jsxRuntimeExports.jsx("svg",{width:"1em",height:"1em",viewBox:"0 0 18 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsxs("g",{id:"chevron_right",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1247_21809",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"18",height:"18",children:jsxRuntimeExports.jsx("rect",{id:"Bounding box",width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1247_21809)",children:jsxRuntimeExports.jsx("path",{id:"chevron_right_2",d:"M9.44998 8.99998L6.52498 6.07498C6.38748 5.93748 6.31873 5.76248 6.31873 5.54998C6.31873 5.33748 6.38748 5.16248 6.52498 5.02498C6.66248 4.88748 6.83748 4.81873 7.04998 4.81873C7.26248 4.81873 7.43748 4.88748 7.57498 5.02498L11.025 8.47498C11.1 8.54997 11.1531 8.63123 11.1844 8.71873C11.2156 8.80623 11.2312 8.89998 11.2312 8.99998C11.2312 9.09998 11.2156 9.19373 11.1844 9.28123C11.1531 9.36873 11.1 9.44998 11.025 9.52497L7.57498 12.975C7.43748 13.1125 7.26248 13.1812 7.04998 13.1812C6.83748 13.1812 6.66248 13.1125 6.52498 12.975C6.38748 12.8375 6.31873 12.6625 6.31873 12.45C6.31873 12.2375 6.38748 12.0625 6.52498 11.925L9.44998 8.99998Z",fill:"currentColor"})})]})}),Tab=()=>{const tt=useAppStore(et=>et.setSidebarOpen);return jsxRuntimeExports.jsx(ExpandButton,{onClick:()=>{tt(!0)},children:jsxRuntimeExports.jsx(ChevronRightIcon,{})})},ExpandButton=styled$4(Flex).attrs({align:"center",justify:"center",p:8})(({theme:tt})=>({backgroundColor:colors.BG1_NORMAL,cursor:"pointer",transitionDuration:"0.2s",position:"absolute",top:"50%",zIndex:1,width:"24px",height:"48px",transform:"translateY(-50%)",borderRadius:"0px 6px 6px 0px",boxShadow:"2px 0px 6px 0px rgba(0, 0, 0, 0.25) inset",color:colors.white,[tt.breakpoints.up("sm")]:{left:"64px"},"&:hover":{backgroundColor:colors.BG1_HOVER},"&:active":{backgroundColor:colors.BG1_PRESS,color:colors.GRAY6}})),SentimentDataIcon=tt=>jsxRuntimeExports.jsxs("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("mask",{id:"mask0_1259_28",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:jsxRuntimeExports.jsx("rect",{width:"1em",height:"1em",fill:"currentColor"})}),jsxRuntimeExports.jsx("g",{mask:"url(#mask0_1259_28)",children:jsxRuntimeExports.jsx("path",{d:"M3 20.75L2.91345 19.4327L4.74998 17.6058V20.75H3ZM7.25003 20.75V15.1058L8.74998 13.6058V20.75H7.25003ZM11.25 20.75V13.6058L12.75 15.1308V20.75H11.25ZM15.25 20.75V15.1308L16.75 13.6308V20.75H15.25ZM19.25 20.75V11.1058L20.75 9.60583V20.75H19.25ZM3.25003 15.2192V13.1058L10 6.35581L14 10.3558L20.75 3.60583V5.71924L14 12.4692L10 8.46921L3.25003 15.2192Z",fill:"currentColor"})})]}),TRENDING_TOPICS=["Drivechain","Ordinals","L402","Nostr","AI"],Trending=({onSubmit:tt})=>{const[et,nt]=reactExports.useState(!1),[rt,it]=useDataStore(st=>[st.trendingTopics,st.setTrendingTopics]),{setValue:ot}=useFormContext();reactExports.useEffect(()=>{const st=async()=>{nt(!0);try{const lt=await getTrends();lt.length&&it(lt.map(ct=>ct.topic))}catch{it(TRENDING_TOPICS)}finally{nt(!1)}};rt.length||st()},[rt,it]);const at=st=>{ot("search",st),tt==null||tt()};return jsxRuntimeExports.jsxs(Wrapper$2,{children:[jsxRuntimeExports.jsxs("div",{className:"heading",children:[jsxRuntimeExports.jsx("span",{className:"heading__title",children:"Trending Topics"}),jsxRuntimeExports.jsx("span",{className:"heading__icon",children:et?jsxRuntimeExports.jsx(ClipLoader$2,{color:colors.PRIMARY_BLUE,size:16}):jsxRuntimeExports.jsx(SentimentDataIcon,{})})]}),jsxRuntimeExports.jsx("ul",{className:"list",children:et?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382}),jsxRuntimeExports.jsx(StyledSkeleton,{animation:"wave",height:47,variant:"rectangular",width:382})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:rt.map(st=>jsxRuntimeExports.jsxs(Flex,{className:"list-item",onClick:()=>at(st),children:["#",st]},st))})})]})},Wrapper$2=styled$4(Flex)` .heading { color: ${colors.GRAY6}; padding: 0 24px 9px 24px; diff --git a/build/index.html b/build/index.html index 1a590933f..6fb46e9bb 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 - +