(function(za,gt){typeof exports=="object"&&typeof module<"u"?gt(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],gt):(za=typeof globalThis<"u"?globalThis:za||self,gt(za.xshape={},za.React))})(this,function(za,gt){"use strict";const GE=o=>o&&typeof o=="object"&&"default"in o?o:{default:o};function BE(o){if(o&&o.__esModule)return o;const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:()=>o[r]})}}return e.default=o,Object.freeze(e)}const lr=GE(gt),Ua=BE(gt);function jE(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ny={exports:{}},rp={},gd={exports:{}},ip={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Ay;function IE(){if(Ay)return ip;Ay=1;var o=lr.default;function e(R,T){return R===T&&(R!==0||1/R===1/T)||R!==R&&T!==T}var r=typeof Object.is=="function"?Object.is:e,s=o.useState,u=o.useEffect,f=o.useLayoutEffect,h=o.useDebugValue;function y(R,T){var O=T(),w=s({inst:{value:O,getSnapshot:T}}),A=w[0].inst,M=w[1];return f(function(){A.value=O,A.getSnapshot=T,g(A)&&M({inst:A})},[R,O,T]),u(function(){return g(A)&&M({inst:A}),R(function(){g(A)&&M({inst:A})})},[R]),h(O),O}function g(R){var T=R.getSnapshot;R=R.value;try{var O=T();return!r(R,O)}catch{return!0}}function p(R,T){return T()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:y;return ip.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,ip}var ap={};/** * @license React * use-sync-external-store-shim.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var My;function VE(){return My||(My=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var o=lr.default,e=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(H){{for(var q=arguments.length,re=new Array(q>1?q-1:0),j=1;j=o.length&&(o=void 0),{value:o&&o[s++],done:!o}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(o,e){var r=typeof Symbol=="function"&&o[Symbol.iterator];if(!r)return o;var s=r.call(o),u,f=[],h;try{for(;(e===void 0||e-- >0)&&!(u=s.next()).done;)f.push(u.value)}catch(y){h={error:y}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(h)throw h.error}}return f}function en(o,e,r){if(r||arguments.length===2)for(var s=0,u=e.length,f;s"u"||typeof s=="string"||Qo(s)?{target:s,event:o}:xe(xe({},s),{event:o})});return r}function ox(o){if(!(o===void 0||o===JE))return oa(o)}function lx(o,e,r){if(!Tn){var s=o.stack?" Stacktrace was '".concat(o.stack,"'"):"";if(o===e)console.error("Missing onError handler for invocation '".concat(r,"', error was '").concat(o,"'.").concat(s));else{var u=e.stack?" Stacktrace was '".concat(e.stack,"'"):"";console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '".concat(r,"'. ")+"Original error: '".concat(o,"'. ").concat(s," Current error is '").concat(e,"'.").concat(u))}}}function Qy(o,e,r,s,u){var f=o.options.guards,h={state:u,cond:e,_event:s};if(e.type===fp)return((f==null?void 0:f[e.name])||e.predicate)(r,s.data,h);var y=f==null?void 0:f[e.type];if(!y)throw new Error("Guard '".concat(e.type,"' is not implemented on machine '").concat(o.id,"'."));return y(r,s.data,h)}function Xy(o){return typeof o=="string"?{type:o}:o}function Dd(o,e,r){var s=function(){},u=typeof o=="object",f=u?o:null;return{next:((u?o.next:o)||s).bind(f),error:((u?o.error:e)||s).bind(f),complete:((u?o.complete:r)||s).bind(f)}}function Od(o,e){return"".concat(o,":invocation[").concat(e,"]")}var Xo=Sr({type:Uy});function Nd(o,e){return e&&e[o]||void 0}function Gl(o,e){var r;if(Pt(o)||typeof o=="number"){var s=Nd(o,e);Yt(s)?r={type:o,exec:s}:s?r=s:r={type:o,exec:void 0}}else if(Yt(o))r={type:o.name||o.toString(),exec:o};else{var s=Nd(o.type,e);if(Yt(s))r=xe(xe({},o),{exec:s});else if(s){var u=s.type||o.type;r=xe(xe(xe({},s),o),{type:u})}else r=o}return r}var hs=function(o,e){if(!o)return[];var r=Hl(o)?o:[o];return r.map(function(s){return Gl(s,e)})};function Ad(o){var e=Gl(o);return xe(xe({id:Pt(o)?o:e.id},e),{type:e.type})}function Ky(o){return Pt(o)?{type:qo,event:o}:Js(o,{to:ka.Internal})}function Jy(o){return{type:qo,_event:Sr(o.event)}}function Js(o,e){return{to:e?e.to:void 0,type:Wo,event:Yt(o)?o:vp(o),delay:e?e.delay:void 0,id:e&&e.id!==void 0?e.id:Yt(o)?o.name:By(o)}}function Zy(o,e,r,s){var u={_event:r},f=Sr(Yt(o.event)?o.event(e,r.data,u):o.event),h;if(Pt(o.delay)){var y=s&&s[o.delay];h=Yt(y)?y(e,r.data,u):y}else h=Yt(o.delay)?o.delay(e,r.data,u):o.delay;var g=Yt(o.to)?o.to(e,r.data,u):o.to;return xe(xe({},o),{to:g,_event:f,event:f.data,delay:h})}function Md(o,e){return Js(o,xe(xe({},e),{to:ka.Parent}))}function ux(o,e,r){return Js(e,xe(xe({},r),{to:o}))}function cx(){return Md(Cd)}function fx(o,e){return Js(o,xe(xe({},e),{to:function(r,s,u){var f=u._event;return f.origin}}))}var dx=function(o,e){return{context:o,event:e}};function hx(o,e){return o===void 0&&(o=dx),{type:Ed,label:e,expr:o}}var $y=function(o,e,r){return xe(xe({},o),{value:Pt(o.expr)?o.expr:o.expr(e,r.data,{_event:r})})},eS=function(o){return{type:lp,sendId:o}};function tS(o){var e=Ad(o);return{type:Ht.Start,activity:e,exec:void 0}}function nS(o){var e=Yt(o)?o:Ad(o);return{type:Ht.Stop,activity:e,exec:void 0}}function rS(o,e,r){var s=Yt(o.activity)?o.activity(e,r.data):o.activity,u=typeof s=="string"?{id:s}:s,f={type:Ht.Stop,activity:u};return f}var iS=function(o){return{type:_d,assignment:o}};function vx(o){return typeof o=="object"&&"type"in o}function aS(o,e){var r=e?"#".concat(e):"";return"".concat(Ht.After,"(").concat(o,")").concat(r)}function Sc(o,e){var r="".concat(Ht.DoneState,".").concat(o),s={type:r,data:e};return s.toString=function(){return r},s}function _c(o,e){var r="".concat(Ht.DoneInvoke,".").concat(o),s={type:r,data:e};return s.toString=function(){return r},s}function Bl(o,e){var r="".concat(Ht.ErrorPlatform,".").concat(o),s={type:r,data:e};return s.toString=function(){return r},s}function px(o){return{type:Ht.Pure,get:o}}function mx(o,e){if(!Tn&&(!o||typeof o=="function")){var r=o;o=function(){for(var s=[],u=0;u0;){var p=u.shift();r=o.transition(r,p,g),s.forEach(function(x){return x.next(r)})}f=!1}},y=Cx({id:e.id,send:function(p){u.push(p),h()},getSnapshot:function(){return r},subscribe:function(p,x,R){var T=Dd(p,x,R);return s.add(T),T.next(r),{unsubscribe:function(){s.delete(T)}}}}),g={parent:e.parent,self:y,id:e.id||"anonymous",observers:s};return r=o.start?o.start(g):r,y}var Px={sync:!1,autoForward:!1},An;(function(o){o[o.NotStarted=0]="NotStarted",o[o.Running=1]="Running",o[o.Stopped=2]="Stopped"})(An||(An={}));var zx=function(){function o(e,r){r===void 0&&(r=o.defaultOptions);var s=this;this.machine=e,this.delayedEventsMap={},this.listeners=new Set,this.contextListeners=new Set,this.stopListeners=new Set,this.doneListeners=new Set,this.eventListeners=new Set,this.sendListeners=new Set,this.initialized=!1,this.status=An.NotStarted,this.children=new Map,this.forwardTo=new Set,this._outgoingQueue=[],this.init=this.start,this.send=function(x,R){if(Hl(x))return s.batch(x),s.state;var T=Sr(vp(x,R));if(s.status===An.Stopped)return Tn||yr(!1,'Event "'.concat(T.name,'" was sent to stopped service "').concat(s.machine.id,`". This service has already reached its final state, and will not transition. Event: `).concat(JSON.stringify(T.data))),s.state;if(s.status!==An.Running&&!s.options.deferEvents)throw new Error('Event "'.concat(T.name,'" was sent to uninitialized service "').concat(s.machine.id,`". Make sure .start() is called for this service, or set { deferEvents: true } in the service options. Event: `).concat(JSON.stringify(T.data)));return s.scheduler.schedule(function(){s.forward(T);var O=s._nextState(T);s.update(O,T)}),s._state},this.sendTo=function(x,R,T){var O=s.parent&&(R===ka.Parent||s.parent.id===R),w=O?s.parent:Pt(R)?s.children.get(R)||zd.get(R):sx(R)?R:void 0;if(!w){if(!O)throw new Error("Unable to send event to child '".concat(R,"' from service '").concat(s.id,"'."));Tn||yr(!1,"Service '".concat(s.id,"' has no parent: unable to send event ").concat(x.type));return}if("machine"in w){if(s.status!==An.Stopped||s.parent!==w||s.state.done){var A=xe(xe({},x),{name:x.name===cp?"".concat(Bl(s.id)):x.name,origin:s.sessionId});!T&&s.machine.config.predictableActionArguments?s._outgoingQueue.push([w,A]):w.send(A)}}else!T&&s.machine.config.predictableActionArguments?s._outgoingQueue.push([w,x.data]):w.send(x.data)},this._exec=function(x,R,T,O){O===void 0&&(O=s.machine.options.actions);var w=x.exec||Nd(x.type,O),A=Yt(w)?w:w?w.exec:x.exec;if(A)try{return A(R,T.data,s.machine.config.predictableActionArguments?{action:x,_event:T}:{action:x,state:s.state,_event:T})}catch(pe){throw s.parent&&s.parent.send({type:"xstate.error",data:pe}),pe}switch(x.type){case Wo:var M=x;if(typeof M.delay=="number"){s.defer(M);return}else M.to?s.sendTo(M._event,M.to,T===Xo):s.send(M._event);break;case lp:s.cancel(x.sendId);break;case yd:{if(s.status!==An.Running)return;var B=x.activity;if(!s.machine.config.predictableActionArguments&&!s.state.activities[B.id||B.type])break;if(B.type===Ht.Invoke){var k=Xy(B.src),H=s.machine.options.services?s.machine.options.services[k.type]:void 0,q=B.id,re=B.data;Tn||yr(!("forward"in B),"`forward` property is deprecated (found in invocation of '".concat(B.src,"' in in machine '").concat(s.machine.id,"'). ")+"Please use `autoForward` instead.");var j="autoForward"in B?B.autoForward:!!B.forward;if(!H){Tn||yr(!1,"No service found for invocation '".concat(B.src,"' in machine '").concat(s.machine.id,"'."));return}var I=re?wd(re,R,T):void 0;if(typeof H=="string")return;var ne=Yt(H)?H(R,T.data,{data:I,src:k,meta:B.meta}):H;if(!ne)return;var J=void 0;Qo(ne)&&(ne=I?ne.withContext(I):ne,J={autoForward:j}),s.spawn(ne,q,J)}else s.spawnActivity(B);break}case Sd:{s.stopChild(x.activity.id);break}case Ed:var W=x.label,X=x.value;W?s.logger(W,X):s.logger(X);break;default:Tn||yr(!1,"No implementation found for action type '".concat(x.type,"'"));break}};var u=xe(xe({},o.defaultOptions),r),f=u.clock,h=u.logger,y=u.parent,g=u.id,p=g!==void 0?g:e.id;this.id=p,this.logger=h,this.clock=f,this.parent=y,this.options=u,this.scheduler=new vS({deferEvents:this.options.deferEvents}),this.sessionId=zd.bookId()}return Object.defineProperty(o.prototype,"initialState",{get:function(){var e=this;return this._initialState?this._initialState:jl(this,function(){return e._initialState=e.machine.initialState,e._initialState})},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"state",{get:function(){return Tn||yr(this.status!==An.NotStarted,"Attempted to read state from uninitialized service '".concat(this.id,"'. Make sure the service is started first.")),this._state},enumerable:!1,configurable:!0}),o.prototype.execute=function(e,r){var s,u;try{for(var f=bt(e.actions),h=f.next();!h.done;h=f.next()){var y=h.value;this.exec(y,e,r)}}catch(g){s={error:g}}finally{try{h&&!h.done&&(u=f.return)&&u.call(f)}finally{if(s)throw s.error}}},o.prototype.update=function(e,r){var s,u,f,h,y,g,p,x,R=this;if(e._sessionid=this.sessionId,this._state=e,(!this.machine.config.predictableActionArguments||r===Xo)&&this.options.execute)this.execute(this.state);else for(var T=void 0;T=this._outgoingQueue.shift();)T[0].send(T[1]);if(this.children.forEach(function(J){R.state.children[J.id]=J}),this.devTools&&this.devTools.send(r.data,e),e.event)try{for(var O=bt(this.eventListeners),w=O.next();!w.done;w=O.next()){var A=w.value;A(e.event)}}catch(J){s={error:J}}finally{try{w&&!w.done&&(u=O.return)&&u.call(O)}finally{if(s)throw s.error}}try{for(var M=bt(this.listeners),B=M.next();!B.done;B=M.next()){var A=B.value;A(e,e.event)}}catch(J){f={error:J}}finally{try{B&&!B.done&&(h=M.return)&&h.call(M)}finally{if(f)throw f.error}}try{for(var k=bt(this.contextListeners),H=k.next();!H.done;H=k.next()){var q=H.value;q(this.state.context,this.state.history?this.state.history.context:void 0)}}catch(J){y={error:J}}finally{try{H&&!H.done&&(g=k.return)&&g.call(k)}finally{if(y)throw y.error}}if(this.state.done){var re=e.configuration.find(function(J){return J.type==="final"&&J.parent===R.machine}),j=re&&re.doneData?wd(re.doneData,e.context,r):void 0;try{for(var I=bt(this.doneListeners),ne=I.next();!ne.done;ne=I.next()){var A=ne.value;A(_c(this.id,j))}}catch(J){p={error:J}}finally{try{ne&&!ne.done&&(x=I.return)&&x.call(I)}finally{if(p)throw p.error}}this._stop(),this._stopChildren()}},o.prototype.onTransition=function(e){return this.listeners.add(e),this.status===An.Running&&e(this.state,this.state.event),this},o.prototype.subscribe=function(e,r,s){var u=this,f=Dd(e,r,s);this.listeners.add(f.next),this.status!==An.NotStarted&&f.next(this.state);var h=function(){u.doneListeners.delete(h),u.stopListeners.delete(h),f.complete()};return this.status===An.Stopped?f.complete():(this.onDone(h),this.onStop(h)),{unsubscribe:function(){u.listeners.delete(f.next),u.doneListeners.delete(h),u.stopListeners.delete(h)}}},o.prototype.onEvent=function(e){return this.eventListeners.add(e),this},o.prototype.onSend=function(e){return this.sendListeners.add(e),this},o.prototype.onChange=function(e){return this.contextListeners.add(e),this},o.prototype.onStop=function(e){return this.stopListeners.add(e),this},o.prototype.onDone=function(e){return this.doneListeners.add(e),this},o.prototype.off=function(e){return this.listeners.delete(e),this.eventListeners.delete(e),this.sendListeners.delete(e),this.stopListeners.delete(e),this.doneListeners.delete(e),this.contextListeners.delete(e),this},o.prototype.start=function(e){var r=this;if(this.status===An.Running)return this;this.machine._init(),zd.register(this.sessionId,this),this.initialized=!0,this.status=An.Running;var s=e===void 0?this.initialState:jl(this,function(){return wx(e)?r.machine.resolveState(e):r.machine.resolveState(Ii.from(e,r.machine.context))});return this.options.devTools&&this.attachDev(),this.scheduler.initialize(function(){r.update(s,Xo)}),this},o.prototype._stopChildren=function(){this.children.forEach(function(e){Yt(e.stop)&&e.stop()}),this.children.clear()},o.prototype._stop=function(){var e,r,s,u,f,h,y,g,p,x;try{for(var R=bt(this.listeners),T=R.next();!T.done;T=R.next()){var O=T.value;this.listeners.delete(O)}}catch(I){e={error:I}}finally{try{T&&!T.done&&(r=R.return)&&r.call(R)}finally{if(e)throw e.error}}try{for(var w=bt(this.stopListeners),A=w.next();!A.done;A=w.next()){var O=A.value;O(),this.stopListeners.delete(O)}}catch(I){s={error:I}}finally{try{A&&!A.done&&(u=w.return)&&u.call(w)}finally{if(s)throw s.error}}try{for(var M=bt(this.contextListeners),B=M.next();!B.done;B=M.next()){var O=B.value;this.contextListeners.delete(O)}}catch(I){f={error:I}}finally{try{B&&!B.done&&(h=M.return)&&h.call(M)}finally{if(f)throw f.error}}try{for(var k=bt(this.doneListeners),H=k.next();!H.done;H=k.next()){var O=H.value;this.doneListeners.delete(O)}}catch(I){y={error:I}}finally{try{H&&!H.done&&(g=k.return)&&g.call(k)}finally{if(y)throw y.error}}if(!this.initialized)return this;this.initialized=!1,this.status=An.Stopped,this._initialState=void 0;try{for(var q=bt(Object.keys(this.delayedEventsMap)),re=q.next();!re.done;re=q.next()){var j=re.value;this.clock.clearTimeout(this.delayedEventsMap[j])}}catch(I){p={error:I}}finally{try{re&&!re.done&&(x=q.return)&&x.call(q)}finally{if(p)throw p.error}}this.scheduler.clear(),this.scheduler=new vS({deferEvents:this.options.deferEvents})},o.prototype.stop=function(){var e=this,r=this.scheduler;return this._stop(),r.schedule(function(){var s=Sr({type:"xstate.stop"}),u=jl(e,function(){var f=hn(en([],wt(e.state.configuration),!1).sort(function(x,R){return R.order-x.order}).map(function(x){return hs(x.onExit,e.machine.options.actions)})),h=wt(Ec(e.machine,e.state,e.state.context,s,[f],e.machine.config.predictableActionArguments?e._exec:void 0,e.machine.config.predictableActionArguments||e.machine.config.preserveActionOrder),2),y=h[0],g=h[1],p=new Ii({value:e.state.value,context:g,_event:s,_sessionid:e.sessionId,historyValue:void 0,history:e.state,actions:y.filter(function(x){return x.type!==qo&&(x.type!==Wo||!!x.to&&x.to!==ka.Internal)}),activities:{},events:[],configuration:[],transitions:[],children:{},done:e.state.done,tags:e.state.tags,machine:e.machine});return p.changed=!0,p});e.update(u,s),e._stopChildren(),zd.free(e.sessionId)}),this},o.prototype.batch=function(e){var r=this;if(this.status===An.NotStarted&&this.options.deferEvents)Tn||yr(!1,"".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,`" and are deferred. Make sure .start() is called for this service. Event: `).concat(JSON.stringify(event)));else if(this.status!==An.Running)throw new Error("".concat(e.length,' event(s) were sent to uninitialized service "').concat(this.machine.id,'". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.'));if(!!e.length){var s=!!this.machine.config.predictableActionArguments&&this._exec;this.scheduler.schedule(function(){var u,f,h=r.state,y=!1,g=[],p=function(O){var w=Sr(O);r.forward(w),h=jl(r,function(){return r.machine.transition(h,w,void 0,s||void 0)}),g.push.apply(g,en([],wt(r.machine.config.predictableActionArguments?h.actions:h.actions.map(function(A){return Dx(A,h)})),!1)),y=y||!!h.changed};try{for(var x=bt(e),R=x.next();!R.done;R=x.next()){var T=R.value;p(T)}}catch(O){u={error:O}}finally{try{R&&!R.done&&(f=x.return)&&f.call(x)}finally{if(u)throw u.error}}h.changed=y,h.actions=g,r.update(h,Sr(e[e.length-1]))})}},o.prototype.sender=function(e){return this.send.bind(this,e)},o.prototype._nextState=function(e,r){var s=this;r===void 0&&(r=!!this.machine.config.predictableActionArguments&&this._exec);var u=Sr(e);if(u.name.indexOf(up)===0&&!this.state.nextEvents.some(function(h){return h.indexOf(up)===0}))throw u.data.data;var f=jl(this,function(){return s.machine.transition(s.state,u,void 0,r||void 0)});return f},o.prototype.nextState=function(e){return this._nextState(e,!1)},o.prototype.forward=function(e){var r,s;try{for(var u=bt(this.forwardTo),f=u.next();!f.done;f=u.next()){var h=f.value,y=this.children.get(h);if(!y)throw new Error("Unable to forward event '".concat(e,"' from interpreter '").concat(this.id,"' to nonexistant child '").concat(h,"'."));y.send(e)}}catch(g){r={error:g}}finally{try{f&&!f.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}},o.prototype.defer=function(e){var r=this;this.delayedEventsMap[e.id]=this.clock.setTimeout(function(){e.to?r.sendTo(e._event,e.to,!0):r.send(e._event)},e.delay)},o.prototype.cancel=function(e){this.clock.clearTimeout(this.delayedEventsMap[e]),delete this.delayedEventsMap[e]},o.prototype.exec=function(e,r,s){s===void 0&&(s=this.machine.options.actions),this._exec(e,r.context,r._event,s)},o.prototype.removeChild=function(e){var r;this.children.delete(e),this.forwardTo.delete(e),(r=this.state)===null||r===void 0||delete r.children[e]},o.prototype.stopChild=function(e){var r=this.children.get(e);!r||(this.removeChild(e),Yt(r.stop)&&r.stop())},o.prototype.spawn=function(e,r,s){if(this.status!==An.Running)return lS(e,r);if(Vy(e))return this.spawnPromise(Promise.resolve(e),r);if(Yt(e))return this.spawnCallback(e,r);if(xx(e))return this.spawnActor(e,r);if(ax(e))return this.spawnObservable(e,r);if(Qo(e))return this.spawnMachine(e,xe(xe({},s),{id:r}));if(nx(e))return this.spawnBehavior(e,r);throw new Error('Unable to spawn entity "'.concat(r,'" of type "').concat(typeof e,'".'))},o.prototype.spawnMachine=function(e,r){var s=this;r===void 0&&(r={});var u=new o(e,xe(xe({},this.options),{parent:this,id:r.id||e.id})),f=xe(xe({},Px),r);f.sync&&u.onTransition(function(y){s.send(Cd,{state:y,id:u.id})});var h=u;return this.children.set(u.id,h),f.autoForward&&this.forwardTo.add(u.id),u.onDone(function(y){s.removeChild(u.id),s.send(Sr(y,{origin:u.id}))}).start(),h},o.prototype.spawnBehavior=function(e,r){var s=Lx(e,{id:r,parent:this});return this.children.set(r,s),s},o.prototype.spawnPromise=function(e,r){var s,u=this,f=!1,h;e.then(function(g){f||(h=g,u.removeChild(r),u.send(Sr(_c(r,g),{origin:r})))},function(g){if(!f){u.removeChild(r);var p=Bl(r,g);try{u.send(Sr(p,{origin:r}))}catch(x){lx(g,x,r),u.devTools&&u.devTools.send(p,u.state),u.machine.strict&&u.stop()}}});var y=(s={id:r,send:function(){},subscribe:function(g,p,x){var R=Dd(g,p,x),T=!1;return e.then(function(O){T||(R.next(O),!T&&R.complete())},function(O){T||R.error(O)}),{unsubscribe:function(){return T=!0}}},stop:function(){f=!0},toJSON:function(){return{id:r}},getSnapshot:function(){return h}},s[Ks]=function(){return this},s);return this.children.set(r,y),y},o.prototype.spawnCallback=function(e,r){var s,u=this,f=!1,h=new Set,y=new Set,g,p=function(T){g=T,y.forEach(function(O){return O(T)}),!f&&u.send(Sr(T,{origin:r}))},x;try{x=e(p,function(T){h.add(T)})}catch(T){this.send(Bl(r,T))}if(Vy(x))return this.spawnPromise(x,r);var R=(s={id:r,send:function(T){return h.forEach(function(O){return O(T)})},subscribe:function(T){var O=Dd(T);return y.add(O.next),{unsubscribe:function(){y.delete(O.next)}}},stop:function(){f=!0,Yt(x)&&x()},toJSON:function(){return{id:r}},getSnapshot:function(){return g}},s[Ks]=function(){return this},s);return this.children.set(r,R),R},o.prototype.spawnObservable=function(e,r){var s,u=this,f,h=e.subscribe(function(g){f=g,u.send(Sr(g,{origin:r}))},function(g){u.removeChild(r),u.send(Sr(Bl(r,g),{origin:r}))},function(){u.removeChild(r),u.send(Sr(_c(r),{origin:r}))}),y=(s={id:r,send:function(){},subscribe:function(g,p,x){return e.subscribe(g,p,x)},stop:function(){return h.unsubscribe()},getSnapshot:function(){return f},toJSON:function(){return{id:r}}},s[Ks]=function(){return this},s);return this.children.set(r,y),y},o.prototype.spawnActor=function(e,r){return this.children.set(r,e),e},o.prototype.spawnActivity=function(e){var r=this.machine.options&&this.machine.options.activities?this.machine.options.activities[e.type]:void 0;if(!r){Tn||yr(!1,"No implementation found for activity '".concat(e.type,"'"));return}var s=r(this.state.context,e);this.spawnEffect(e.id,s)},o.prototype.spawnEffect=function(e,r){var s;this.children.set(e,(s={id:e,send:function(){},subscribe:function(){return{unsubscribe:function(){}}},stop:r||void 0,getSnapshot:function(){},toJSON:function(){return{id:e}}},s[Ks]=function(){return this},s))},o.prototype.attachDev=function(){var e=gp();if(this.options.devTools&&e){if(e.__REDUX_DEVTOOLS_EXTENSION__){var r=typeof this.options.devTools=="object"?this.options.devTools:void 0;this.devTools=e.__REDUX_DEVTOOLS_EXTENSION__.connect(xe(xe({name:this.id,autoPause:!0,stateSanitizer:function(s){return{value:s.value,context:s.context,actions:s.actions}}},r),{features:xe({jump:!1,skip:!1},r?r.features:void 0)}),this.machine),this.devTools.init(this.state)}Mx(this)}},o.prototype.toJSON=function(){return{id:this.id}},o.prototype[Ks]=function(){return this},o.prototype.getSnapshot=function(){return this.status===An.NotStarted?this.initialState:this._state},o.defaultOptions={execute:!0,deferEvents:!0,clock:{setTimeout:function(e,r){return setTimeout(e,r)},clearTimeout:function(e){return clearTimeout(e)}},logger:console.log.bind(console),devTools:!1},o.interpret=pS,o}();function pS(o,e){var r=new zx(o,e);return r}function Ux(o){if(typeof o=="string"){var e={type:o};return e.toString=function(){return o},e}return o}function Ud(o){return xe(xe({type:xd},o),{toJSON:function(){o.onDone,o.onError;var e=op(o,["onDone","onError"]);return xe(xe({},e),{type:xd,src:Ux(o.src)})}})}var Vl="",yp="#",Tc="*",Yl={},ql=function(o){return o[0]===yp},kx=function(){return{actions:{},guards:{},services:{},activities:{},delays:{}}},Hx=function(o,e,r){var s=r.slice(0,-1).some(function(f){return!("cond"in f)&&!("in"in f)&&(Pt(f.target)||Qo(f.target))}),u=e===Vl?"the transient event":"event '".concat(e,"'");yr(!s,"One or more transitions for ".concat(u," on state '").concat(o.id,"' are unreachable. ")+"Make sure that the default transition is the last one defined.")},Fx=function(){function o(e,r,s,u){s===void 0&&(s="context"in e?e.context:void 0);var f=this,h;this.config=e,this._context=s,this.order=-1,this.__xstatenode=!0,this.__cache={events:void 0,relativeValue:new Map,initialStateValue:void 0,initialState:void 0,on:void 0,transitions:void 0,candidates:{},delayedTransitions:void 0},this.idMap={},this.tags=[],this.options=Object.assign(kx(),r),this.parent=u==null?void 0:u.parent,this.key=this.config.key||(u==null?void 0:u.key)||this.config.id||"(machine)",this.machine=this.parent?this.parent.machine:this,this.path=this.parent?this.parent.path.concat(this.key):[],this.delimiter=this.config.delimiter||(this.parent?this.parent.delimiter:Fy),this.id=this.config.id||en([this.machine.key],wt(this.path),!1).join(this.delimiter),this.version=this.parent?this.parent.version:this.config.version,this.type=this.config.type||(this.config.parallel?"parallel":this.config.states&&Object.keys(this.config.states).length?"compound":this.config.history?"history":"atomic"),this.schema=this.parent?this.machine.schema:(h=this.config.schema)!==null&&h!==void 0?h:{},this.description=this.config.description,Tn||yr(!("parallel"in this.config),'The "parallel" property is deprecated and will be removed in version 4.1. '.concat(this.config.parallel?"Replace with `type: 'parallel'`":"Use `type: '".concat(this.type,"'`")," in the config for state node '").concat(this.id,"' instead.")),this.initial=this.config.initial,this.states=this.config.states?yc(this.config.states,function(p,x){var R,T=new o(p,{},void 0,{parent:f,key:x});return Object.assign(f.idMap,xe((R={},R[T.id]=T,R),T.idMap)),T}):Yl;var y=0;function g(p){var x,R;p.order=y++;try{for(var T=bt(uS(p)),O=T.next();!O.done;O=T.next()){var w=O.value;g(w)}}catch(A){x={error:A}}finally{try{O&&!O.done&&(R=T.return)&&R.call(T)}finally{if(x)throw x.error}}}g(this),this.history=this.config.history===!0?"shallow":this.config.history||!1,this._transient=!!this.config.always||(this.config.on?Array.isArray(this.config.on)?this.config.on.some(function(p){var x=p.event;return x===Vl}):Vl in this.config.on:!1),this.strict=!!this.config.strict,this.onEntry=oa(this.config.entry||this.config.onEntry).map(function(p){return Gl(p)}),this.onExit=oa(this.config.exit||this.config.onExit).map(function(p){return Gl(p)}),this.meta=this.config.meta,this.doneData=this.type==="final"?this.config.data:void 0,this.invoke=oa(this.config.invoke).map(function(p,x){var R,T;if(Qo(p)){var O=Od(f.id,x);return f.machine.options.services=xe((R={},R[O]=p,R),f.machine.options.services),Ud({src:O,id:O})}else if(Pt(p.src)){var O=p.id||Od(f.id,x);return Ud(xe(xe({},p),{id:O,src:p.src}))}else if(Qo(p.src)||Yt(p.src)){var O=p.id||Od(f.id,x);return f.machine.options.services=xe((T={},T[O]=p.src,T),f.machine.options.services),Ud(xe(xe({id:O},p),{src:O}))}else{var w=p.src;return Ud(xe(xe({id:Od(f.id,x)},p),{src:w}))}}),this.activities=oa(this.config.activities).concat(this.invoke).map(function(p){return Ad(p)}),this.transition=this.transition.bind(this),this.tags=oa(this.config.tags)}return o.prototype._init=function(){this.__cache.transitions||cS(this).forEach(function(e){return e.on})},o.prototype.withConfig=function(e,r){var s=this.options,u=s.actions,f=s.activities,h=s.guards,y=s.services,g=s.delays;return new o(this.config,{actions:xe(xe({},u),e.actions),activities:xe(xe({},f),e.activities),guards:xe(xe({},h),e.guards),services:xe(xe({},y),e.services),delays:xe(xe({},g),e.delays)},r!=null?r:this.context)},o.prototype.withContext=function(e){return new o(this.config,this.options,e)},Object.defineProperty(o.prototype,"context",{get:function(){return Yt(this._context)?this._context():this._context},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"definition",{get:function(){return{id:this.id,key:this.key,version:this.version,context:this.context,type:this.type,initial:this.initial,history:this.history,states:yc(this.states,function(e){return e.definition}),on:this.on,transitions:this.transitions,entry:this.onEntry,exit:this.onExit,activities:this.activities||[],meta:this.meta,order:this.order||-1,data:this.doneData,invoke:this.invoke,description:this.description,tags:this.tags}},enumerable:!1,configurable:!0}),o.prototype.toJSON=function(){return this.definition},Object.defineProperty(o.prototype,"on",{get:function(){if(this.__cache.on)return this.__cache.on;var e=this.transitions;return this.__cache.on=e.reduce(function(r,s){return r[s.eventType]=r[s.eventType]||[],r[s.eventType].push(s),r},{})},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"after",{get:function(){return this.__cache.delayedTransitions||(this.__cache.delayedTransitions=this.getDelayedTransitions(),this.__cache.delayedTransitions)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"transitions",{get:function(){return this.__cache.transitions||(this.__cache.transitions=this.formatTransitions(),this.__cache.transitions)},enumerable:!1,configurable:!0}),o.prototype.getCandidates=function(e){if(this.__cache.candidates[e])return this.__cache.candidates[e];var r=e===Vl,s=this.transitions.filter(function(u){var f=u.eventType===e;return r?f:f||u.eventType===Tc});return this.__cache.candidates[e]=s,s},o.prototype.getDelayedTransitions=function(){var e=this,r=this.config.after;if(!r)return[];var s=function(f,h){var y=Yt(f)?"".concat(e.id,":delay[").concat(h,"]"):f,g=aS(y,e.id);return e.onEntry.push(Js(g,{delay:f})),e.onExit.push(eS(g)),g},u=Hl(r)?r.map(function(f,h){var y=s(f.delay,h);return xe(xe({},f),{event:y})}):hn(Object.keys(r).map(function(f,h){var y=r[f],g=Pt(y)?{target:y}:y,p=isNaN(+f)?f:+f,x=s(p,h);return oa(g).map(function(R){return xe(xe({},R),{event:x,delay:p})})}));return u.map(function(f){var h=f.delay;return xe(xe({},e.formatTransition(f)),{delay:h})})},o.prototype.getStateNodes=function(e){var r,s=this;if(!e)return[];var u=e instanceof Ii?e.value:gc(e,this.delimiter);if(Pt(u)){var f=this.getStateNode(u).initial;return f!==void 0?this.getStateNodes((r={},r[u]=f,r)):[this,this.states[u]]}var h=Object.keys(u),y=[this];return y.push.apply(y,en([],wt(hn(h.map(function(g){return s.getStateNode(g).getStateNodes(u[g])}))),!1)),y},o.prototype.handles=function(e){var r=By(e);return this.events.includes(r)},o.prototype.resolveState=function(e){var r=e instanceof Ii?e:Ii.create(e),s=Array.from(Cc([],this.getStateNodes(r.value)));return new Ii(xe(xe({},r),{value:this.resolve(r.value),configuration:s,done:Pd(s,this),tags:dS(s),machine:this.machine}))},o.prototype.transitionLeafNode=function(e,r,s){var u=this.getStateNode(e),f=u.next(r,s);return!f||!f.transitions.length?this.next(r,s):f},o.prototype.transitionCompoundNode=function(e,r,s){var u=Object.keys(e),f=this.getStateNode(u[0]),h=f._transition(e[u[0]],r,s);return!h||!h.transitions.length?this.next(r,s):h},o.prototype.transitionParallelNode=function(e,r,s){var u,f,h={};try{for(var y=bt(Object.keys(e)),g=y.next();!g.done;g=y.next()){var p=g.value,x=e[p];if(!!x){var R=this.getStateNode(p),T=R._transition(x,r,s);T&&(h[p]=T)}}}catch(k){u={error:k}}finally{try{g&&!g.done&&(f=y.return)&&f.call(y)}finally{if(u)throw u.error}}var O=Object.keys(h).map(function(k){return h[k]}),w=hn(O.map(function(k){return k.transitions})),A=O.some(function(k){return k.transitions.length>0});if(!A)return this.next(r,s);var M=hn(O.map(function(k){return k.entrySet})),B=hn(Object.keys(h).map(function(k){return h[k].configuration}));return{transitions:w,entrySet:M,exitSet:hn(O.map(function(k){return k.exitSet})),configuration:B,source:r,actions:hn(Object.keys(h).map(function(k){return h[k].actions}))}},o.prototype._transition=function(e,r,s){return Pt(e)?this.transitionLeafNode(e,r,s):Object.keys(e).length===1?this.transitionCompoundNode(e,r,s):this.transitionParallelNode(e,r,s)},o.prototype.getTransitionData=function(e,r){return this._transition(e.value,e,Sr(r))},o.prototype.next=function(e,r){var s,u,f=this,h=r.name,y=[],g=[],p;try{for(var x=bt(this.getCandidates(h)),R=x.next();!R.done;R=x.next()){var T=R.value,O=T.cond,w=T.in,A=e.context,M=w?Pt(w)&&ql(w)?e.matches(gc(this.getStateNodeById(w).path,this.delimiter)):dp(gc(w,this.delimiter),$E(this.path.slice(0,-2))(e.value)):!0,B=!1;try{B=!O||Qy(this.machine,O,A,r,e)}catch(re){throw new Error("Unable to evaluate guard '".concat(O.name||O.type,"' in transition for event '").concat(h,"' in state node '").concat(this.id,`': `).concat(re.message))}if(B&&M){T.target!==void 0&&(g=T.target),y.push.apply(y,en([],wt(T.actions),!1)),p=T;break}}}catch(re){s={error:re}}finally{try{R&&!R.done&&(u=x.return)&&u.call(x)}finally{if(s)throw s.error}}if(!!p){if(!g.length)return{transitions:[p],entrySet:[],exitSet:[],configuration:e.value?[this]:[],source:e,actions:y};var k=hn(g.map(function(re){return f.getRelativeStateNodes(re,e.historyValue)})),H=!!p.internal,q=[];return H||g.forEach(function(re){q.push.apply(q,en([],wt(f.getExternalReentryNodes(re)),!1))}),{transitions:[p],entrySet:q,exitSet:H?[]:[this],configuration:k,source:e,actions:y}}},o.prototype.getExternalReentryNodes=function(e){for(var r=[],s=wt(e.order>this.order?[e,this]:[this,e],2),u=s[0],f=s[1];u&&u!==f;)r.push(u),u=u.parent;return u!==f?[]:(r.push(f),r)},o.prototype.getActions=function(e,r,s,u,f,h,y){var g,p,x,R,T=this,O=Cc([],h?this.getStateNodes(h.value):[this]);try{for(var w=bt(e),A=w.next();!A.done;A=w.next()){var M=A.value;(!Il(O,M)||Il(s.entrySet,M.parent)&&!Il(s.entrySet,M))&&s.entrySet.push(M)}}catch(W){g={error:W}}finally{try{A&&!A.done&&(p=w.return)&&p.call(w)}finally{if(g)throw g.error}}try{for(var B=bt(O),k=B.next();!k.done;k=B.next()){var M=k.value;(!Il(e,M)||Il(s.exitSet,M.parent))&&s.exitSet.push(M)}}catch(W){x={error:W}}finally{try{k&&!k.done&&(R=B.return)&&R.call(B)}finally{if(x)throw x.error}}var H=hn(s.entrySet.map(function(W){var X=[];if(W.type!=="final")return X;var pe=W.parent;if(!pe.parent)return X;X.push(Sc(W.id,W.doneData),Sc(pe.id,W.doneData?wd(W.doneData,u,f):void 0));var ue=pe.parent;return ue.type==="parallel"&&xc(ue).every(function(we){return Pd(s.configuration,we)})&&X.push(Sc(ue.id)),X}));s.exitSet.sort(function(W,X){return X.order-W.order}),s.entrySet.sort(function(W,X){return W.order-X.order});var q=new Set(s.entrySet),re=new Set(s.exitSet),j=Array.from(q).map(function(W){var X=W.onEntry,pe=W.activities.map(function(ue){return tS(ue)});return hs(y?en(en([],wt(X),!1),wt(pe),!1):en(en([],wt(pe),!1),wt(X),!1),T.machine.options.actions)}).concat([H.map(Ky)]),I=Array.from(re).map(function(W){return hs(en(en([],wt(W.onExit),!1),wt(W.activities.map(function(X){return nS(X)})),!1),T.machine.options.actions)}),ne=I.concat([hs(s.actions,this.machine.options.actions)]).concat(j);if(r){var J=hs(hn(en([],wt(e),!1).sort(function(W,X){return X.order-W.order}).map(function(W){return W.onExit})),this.machine.options.actions).filter(function(W){return W.type!==qo&&(W.type!==Wo||!!W.to&&W.to!==ka.Internal)});return ne.concat([J])}return ne},o.prototype.transition=function(e,r,s,u){e===void 0&&(e=this.initialState);var f=Sr(r),h;if(e instanceof Ii)h=s===void 0?e:this.resolveState(Ii.from(e,s));else{var y=Pt(e)?this.resolve(Rd(this.getResolvedPath(e))):this.resolve(e),g=s!=null?s:this.machine.context;h=this.resolveState(Ii.from(y,g))}if(!Tn&&f.name===Tc)throw new Error("An event cannot have the wildcard type ('".concat(Tc,"')"));if(this.strict&&!this.events.includes(f.name)&&!tx(f.name))throw new Error("Machine '".concat(this.id,"' does not accept event '").concat(f.name,"'"));var p=this._transition(h.value,h,f)||{transitions:[],configuration:[],entrySet:[],exitSet:[],source:h,actions:[]},x=Cc([],this.getStateNodes(h.value)),R=p.configuration.length?Cc(x,p.configuration):x;return p.configuration=en([],wt(R),!1),this.resolveTransition(p,h,h.context,u,f)},o.prototype.resolveRaisedTransition=function(e,r,s,u){var f,h=e.actions;return e=this.transition(e,r,void 0,u),e._event=s,e.event=s.data,(f=e.actions).unshift.apply(f,en([],wt(h),!1)),e},o.prototype.resolveTransition=function(e,r,s,u,f){var h,y,g,p,x=this;f===void 0&&(f=Xo);var R=e.configuration,T=!r||e.transitions.length>0,O=T?e.configuration:r?r.configuration:[],w=Pd(O,this),A=T?Tx(this.machine,R):void 0,M=r?r.historyValue?r.historyValue:e.source?this.machine.historyValue(r.value):void 0:void 0,B=this.getActions(new Set(O),w,e,s,f,r,u),k=r?xe({},r.activities):{};try{for(var H=bt(B),q=H.next();!q.done;q=H.next()){var re=q.value;try{for(var j=(g=void 0,bt(re)),I=j.next();!I.done;I=j.next()){var ne=I.value;ne.type===yd?k[ne.activity.id||ne.activity.type]=ne:ne.type===Sd&&(k[ne.activity.id||ne.activity.type]=!1)}}catch(it){g={error:it}}finally{try{I&&!I.done&&(p=j.return)&&p.call(j)}finally{if(g)throw g.error}}}}catch(it){h={error:it}}finally{try{q&&!q.done&&(y=H.return)&&y.call(H)}finally{if(h)throw h.error}}var J=wt(Ec(this,r,s,f,B,u,this.machine.config.predictableActionArguments||this.machine.config.preserveActionOrder),2),W=J[0],X=J[1],pe=wt(rx(W,function(it){return it.type===qo||it.type===Wo&&it.to===ka.Internal}),2),ue=pe[0],we=pe[1],Ae=W.filter(function(it){var Dt;return it.type===yd&&((Dt=it.activity)===null||Dt===void 0?void 0:Dt.type)===xd}),De=Ae.reduce(function(it,Dt){return it[Dt.activity.id]=_x(Dt.activity,x.machine,X,f),it},r?xe({},r.children):{}),Ce=new Ii({value:A||r.value,context:X,_event:f,_sessionid:r?r._sessionid:null,historyValue:A?M?ix(M,A):void 0:r?r.historyValue:void 0,history:!A||e.source?r:void 0,actions:A?we:[],activities:A?k:r?r.activities:{},events:[],configuration:O,transitions:e.transitions,children:De,done:w,tags:dS(O),machine:this}),oe=s!==X;Ce.changed=f.name===Cd||oe;var de=Ce.history;de&&delete de.history;var he=!w&&(this._transient||R.some(function(it){return it._transient}));if(!T&&(!he||f.name===Vl))return Ce;var me=Ce;if(!w)for(he&&(me=this.resolveRaisedTransition(me,{type:zy},f,u));ue.length;){var Ve=ue.shift();me=this.resolveRaisedTransition(me,Ve._event,f,u)}var Et=me.changed||(de?!!me.actions.length||oe||typeof de.value!=typeof me.value||!hS(me.value,de.value):void 0);return me.changed=Et,me.history=de,me},o.prototype.getStateNode=function(e){if(ql(e))return this.machine.getStateNodeById(e);if(!this.states)throw new Error("Unable to retrieve child state '".concat(e,"' from '").concat(this.id,"'; no child states exist."));var r=this.states[e];if(!r)throw new Error("Child state '".concat(e,"' does not exist on '").concat(this.id,"'"));return r},o.prototype.getStateNodeById=function(e){var r=ql(e)?e.slice(yp.length):e;if(r===this.id)return this;var s=this.machine.idMap[r];if(!s)throw new Error("Child state node '#".concat(r,"' does not exist on machine '").concat(this.id,"'"));return s},o.prototype.getStateNodeByPath=function(e){if(typeof e=="string"&&ql(e))try{return this.getStateNodeById(e.slice(1))}catch{}for(var r=hp(e,this.delimiter).slice(),s=this;r.length;){var u=r.shift();if(!u.length)break;s=s.getStateNode(u)}return s},o.prototype.resolve=function(e){var r,s=this;if(!e)return this.initialStateValue||Yl;switch(this.type){case"parallel":return yc(this.initialStateValue,function(f,h){return f?s.getStateNode(h).resolve(e[h]||f):Yl});case"compound":if(Pt(e)){var u=this.getStateNode(e);return u.type==="parallel"||u.type==="compound"?(r={},r[e]=u.initialStateValue,r):e}return Object.keys(e).length?yc(e,function(f,h){return f?s.getStateNode(h).resolve(f):Yl}):this.initialStateValue||{};default:return e||Yl}},o.prototype.getResolvedPath=function(e){if(ql(e)){var r=this.machine.idMap[e.slice(yp.length)];if(!r)throw new Error("Unable to find state node '".concat(e,"'"));return r.path}return hp(e,this.delimiter)},Object.defineProperty(o.prototype,"initialStateValue",{get:function(){var e;if(this.__cache.initialStateValue)return this.__cache.initialStateValue;var r;if(this.type==="parallel")r=jy(this.states,function(s){return s.initialStateValue||Yl},function(s){return s.type!=="history"});else if(this.initial!==void 0){if(!this.states[this.initial])throw new Error("Initial state '".concat(this.initial,"' not found on '").concat(this.key,"'"));r=Ld(this.states[this.initial])?this.initial:(e={},e[this.initial]=this.states[this.initial].initialStateValue,e)}else r={};return this.__cache.initialStateValue=r,this.__cache.initialStateValue},enumerable:!1,configurable:!0}),o.prototype.getInitialState=function(e,r){this._init();var s=this.getStateNodes(e);return this.resolveTransition({configuration:s,entrySet:s,exitSet:[],transitions:[],source:void 0,actions:[]},void 0,r!=null?r:this.machine.context,void 0)},Object.defineProperty(o.prototype,"initialState",{get:function(){var e=this.initialStateValue;if(!e)throw new Error("Cannot retrieve initial state from simple state '".concat(this.id,"'."));return this.getInitialState(e)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"target",{get:function(){var e;if(this.type==="history"){var r=this.config;Pt(r.target)?e=ql(r.target)?Rd(this.machine.getStateNodeById(r.target).path.slice(this.path.length-1)):r.target:e=r.target}return e},enumerable:!1,configurable:!0}),o.prototype.getRelativeStateNodes=function(e,r,s){return s===void 0&&(s=!0),s?e.type==="history"?e.resolveHistory(r):e.initialStateNodes:[e]},Object.defineProperty(o.prototype,"initialStateNodes",{get:function(){var e=this;if(Ld(this))return[this];if(this.type==="compound"&&!this.initial)return Tn||yr(!1,"Compound state node '".concat(this.id,"' has no initial state.")),[this];var r=bd(this.initialStateValue);return hn(r.map(function(s){return e.getFromRelativePath(s)}))},enumerable:!1,configurable:!0}),o.prototype.getFromRelativePath=function(e){if(!e.length)return[this];var r=wt(e),s=r[0],u=r.slice(1);if(!this.states)throw new Error("Cannot retrieve subPath '".concat(s,"' from node with no states"));var f=this.getStateNode(s);if(f.type==="history")return f.resolveHistory();if(!this.states[s])throw new Error("Child state '".concat(s,"' does not exist on '").concat(this.id,"'"));return this.states[s].getFromRelativePath(u)},o.prototype.historyValue=function(e){if(!!Object.keys(this.states).length)return{current:e||this.initialStateValue,states:jy(this.states,function(r,s){if(!e)return r.historyValue();var u=Pt(e)?void 0:e[s];return r.historyValue(u||r.initialStateValue)},function(r){return!r.history})}},o.prototype.resolveHistory=function(e){var r=this;if(this.type!=="history")return[this];var s=this.parent;if(!e){var u=this.target;return u?hn(bd(u).map(function(h){return s.getFromRelativePath(h)})):s.initialStateNodes}var f=ex(s.path,"states")(e).current;return Pt(f)?[s.getStateNode(f)]:hn(bd(f).map(function(h){return r.history==="deep"?s.getFromRelativePath(h):[s.states[h[0]]]}))},Object.defineProperty(o.prototype,"stateIds",{get:function(){var e=this,r=hn(Object.keys(this.states).map(function(s){return e.states[s].stateIds}));return[this.id].concat(r)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"events",{get:function(){var e,r,s,u;if(this.__cache.events)return this.__cache.events;var f=this.states,h=new Set(this.ownEvents);if(f)try{for(var y=bt(Object.keys(f)),g=y.next();!g.done;g=y.next()){var p=g.value,x=f[p];if(x.states)try{for(var R=(s=void 0,bt(x.events)),T=R.next();!T.done;T=R.next()){var O=T.value;h.add("".concat(O))}}catch(w){s={error:w}}finally{try{T&&!T.done&&(u=R.return)&&u.call(R)}finally{if(s)throw s.error}}}}catch(w){e={error:w}}finally{try{g&&!g.done&&(r=y.return)&&r.call(y)}finally{if(e)throw e.error}}return this.__cache.events=Array.from(h)},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"ownEvents",{get:function(){var e=new Set(this.transitions.filter(function(r){return!(!r.target&&!r.actions.length&&r.internal)}).map(function(r){return r.eventType}));return Array.from(e)},enumerable:!1,configurable:!0}),o.prototype.resolveTarget=function(e){var r=this;if(e!==void 0)return e.map(function(s){if(!Pt(s))return s;var u=s[0]===r.delimiter;if(u&&!r.parent)return r.getStateNodeByPath(s.slice(1));var f=u?r.key+s:s;if(r.parent)try{var h=r.parent.getStateNodeByPath(f);return h}catch(y){throw new Error("Invalid transition definition for state node '".concat(r.id,`': `).concat(y.message))}else return r.getStateNodeByPath(f)})},o.prototype.formatTransition=function(e){var r=this,s=ox(e.target),u="internal"in e?e.internal:s?s.some(function(g){return Pt(g)&&g[0]===r.delimiter}):!0,f=this.machine.options.guards,h=this.resolveTarget(s),y=xe(xe({},e),{actions:hs(oa(e.actions)),cond:Wy(e.cond,f),target:h,source:this,internal:u,eventType:e.event,toJSON:function(){return xe(xe({},y),{target:y.target?y.target.map(function(g){return"#".concat(g.id)}):void 0,source:"#".concat(r.id)})}});return y},o.prototype.formatTransitions=function(){var e,r,s=this,u;if(!this.config.on)u=[];else if(Array.isArray(this.config.on))u=this.config.on;else{var f=this.config.on,h=Tc,y=f[h],g=y===void 0?[]:y,p=op(f,[typeof h=="symbol"?h:h+""]);u=hn(Object.keys(p).map(function(k){!Tn&&k===Vl&&yr(!1,"Empty string transition configs (e.g., `{ on: { '': ... }}`) for transient transitions are deprecated. Specify the transition in the `{ always: ... }` property instead. "+'Please check the `on` configuration for "#'.concat(s.id,'".'));var H=Fl(k,p[k]);return Tn||Hx(s,k,H),H}).concat(Fl(Tc,g)))}var x=this.config.always?Fl("",this.config.always):[],R=this.config.onDone?Fl(String(Sc(this.id)),this.config.onDone):[];Tn||yr(!(this.config.onDone&&!this.parent),'Root nodes cannot have an ".onDone" transition. Please check the config of "'.concat(this.id,'".'));var T=hn(this.invoke.map(function(k){var H=[];return k.onDone&&H.push.apply(H,en([],wt(Fl(String(_c(k.id)),k.onDone)),!1)),k.onError&&H.push.apply(H,en([],wt(Fl(String(Bl(k.id)),k.onError)),!1)),H})),O=this.after,w=hn(en(en(en(en([],wt(R),!1),wt(T),!1),wt(u),!1),wt(x),!1).map(function(k){return oa(k).map(function(H){return s.formatTransition(H)})}));try{for(var A=bt(O),M=A.next();!M.done;M=A.next()){var B=M.value;w.push(B)}}catch(k){e={error:k}}finally{try{M&&!M.done&&(r=A.return)&&r.call(A)}finally{if(e)throw e.error}}return w},o}(),mS=!1;function gS(o,e){return!Tn&&!o.predictableActionArguments&&!mS&&(mS=!0,console.warn("It is highly recommended to set `predictableActionArguments` to `true` when using `createMachine`. https://xstate.js.org/docs/guides/actions.html")),new Fx(o,e)}var Ar=iS,Sp=Js,Gx=Md,yS=gt.useLayoutEffect;function _p(o){var e=Ua.useRef();return e.current||(e.current={v:o()}),e.current.v}var kd=globalThis&&globalThis.__assign||function(){return kd=Object.assign||function(o){for(var e,r=1,s=arguments.length;r0)&&!(u=s.next()).done;)f.push(u.value)}catch(y){h={error:y}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(h)throw h.error}}return f};function Ix(o,e){var r=_p(function(){return typeof o=="function"?o():o});if(process.env.NODE_ENV!=="production"&&typeof o!="function"){var s=jx(gt.useState(r),1),u=s[0];o!==u&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var f=e.context,h=e.guards,y=e.actions,g=e.activities,p=e.services,x=e.delays;e.state;var R=Bx(e,["context","guards","actions","activities","services","delays","state"]),T=_p(function(){var O={context:f,guards:h,actions:y,activities:g,services:p,delays:x},w=r.withConfig(O,function(){return kd(kd({},r.context),f)});return pS(w,R)});return yS(function(){Object.assign(T.machine.options.actions,y),Object.assign(T.machine.options.guards,h),Object.assign(T.machine.options.activities,g),Object.assign(T.machine.options.services,p),Object.assign(T.machine.options.delays,x)},[y,h,g,p,x]),T}var Vx=globalThis&&globalThis.__read||function(o,e){var r=typeof Symbol=="function"&&o[Symbol.iterator];if(!r)return o;var s=r.call(o),u,f=[],h;try{for(;(e===void 0||e-- >0)&&!(u=s.next()).done;)f.push(u.value)}catch(y){h={error:y}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(h)throw h.error}}return f};function Yx(o){return o}function qx(o){for(var e=[],r=1;r0||typeof R.changed=="boolean");return!(T.changed||O)},[h]),p=gt.useCallback(function(R){var T=h.subscribe(R).unsubscribe;return T},[h]),x=Ny.exports.useSyncExternalStoreWithSelector(p,y,y,Yx,g);return gt.useEffect(function(){var R=f.state;return h.start(R?Ii.create(R):void 0),function(){h.stop(),h.status=An.NotStarted}},[]),[x,h.send,h]}function Wx(o){return"state"in o}function Qx(o){return"deferred"in o}function Xx(o){return"getSnapshot"in o?o.getSnapshot():Wx(o)?o.state:void 0}function Kx(o,e){e===void 0&&(e=Xx);var r=gt.useRef(o),s=gt.useRef([]),u=gt.useCallback(function(g){var p=o.subscribe(g).unsubscribe;return p},[o]),f=gt.useCallback(function(){return e(o)},[o,e]),h=gd.exports.useSyncExternalStore(u,f,f),y=_p(function(){return function(){for(var g=[],p=0;p1&&console.warn("Unexpected payload: ".concat(JSON.stringify(g[1]),". Only a single event object can be sent to actor send() functions."));var R=r.current;Qx(R)&&R.deferred?s.current.push(x):R.send(x)}});return yS(function(){for(r.current=o;s.current.length>0;){var g=s.current.shift();o.send(g)}},[o]),[h,y]}var Jx=Math.PI/180;function Zx(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Wl=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},Fe={_global:Wl,version:"8.3.13",isBrowser:Zx(),isUnminified:/param/.test(function(o){}.toString()),dblClickWindow:400,getAngle(o){return Fe.angleDeg?o*Jx:o},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return Fe.DD.isDragging},isDragReady(){return!!Fe.DD.node},document:Wl.document,_injectGlobal(o){Wl.Konva=o}},vn=o=>{Fe[o.prototype.getClassName()]=o};Fe._injectGlobal(Fe);class Ci{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Ci(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){var r=this.m;return{x:r[0]*e.x+r[2]*e.y+r[4],y:r[1]*e.x+r[3]*e.y+r[5]}}translate(e,r){return this.m[4]+=this.m[0]*e+this.m[2]*r,this.m[5]+=this.m[1]*e+this.m[3]*r,this}scale(e,r){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=r,this.m[3]*=r,this}rotate(e){var r=Math.cos(e),s=Math.sin(e),u=this.m[0]*r+this.m[2]*s,f=this.m[1]*r+this.m[3]*s,h=this.m[0]*-s+this.m[2]*r,y=this.m[1]*-s+this.m[3]*r;return this.m[0]=u,this.m[1]=f,this.m[2]=h,this.m[3]=y,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,r){var s=this.m[0]+this.m[2]*r,u=this.m[1]+this.m[3]*r,f=this.m[2]+this.m[0]*e,h=this.m[3]+this.m[1]*e;return this.m[0]=s,this.m[1]=u,this.m[2]=f,this.m[3]=h,this}multiply(e){var r=this.m[0]*e.m[0]+this.m[2]*e.m[1],s=this.m[1]*e.m[0]+this.m[3]*e.m[1],u=this.m[0]*e.m[2]+this.m[2]*e.m[3],f=this.m[1]*e.m[2]+this.m[3]*e.m[3],h=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],y=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=r,this.m[1]=s,this.m[2]=u,this.m[3]=f,this.m[4]=h,this.m[5]=y,this}invert(){var e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),r=this.m[3]*e,s=-this.m[1]*e,u=-this.m[2]*e,f=this.m[0]*e,h=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),y=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=r,this.m[1]=s,this.m[2]=u,this.m[3]=f,this.m[4]=h,this.m[5]=y,this}getMatrix(){return this.m}decompose(){var e=this.m[0],r=this.m[1],s=this.m[2],u=this.m[3],f=this.m[4],h=this.m[5],y=e*u-r*s;let g={x:f,y:h,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||r!=0){var p=Math.sqrt(e*e+r*r);g.rotation=r>0?Math.acos(e/p):-Math.acos(e/p),g.scaleX=p,g.scaleY=y/p,g.skewX=(e*s+r*u)/y,g.skewY=0}else if(s!=0||u!=0){var x=Math.sqrt(s*s+u*u);g.rotation=Math.PI/2-(u>0?Math.acos(-s/x):-Math.acos(s/x)),g.scaleX=y/x,g.scaleY=x,g.skewX=0,g.skewY=(e*s+r*u)/y}return g.rotation=Y._getRotation(g.rotation),g}}var $x="[object Array]",e2="[object Number]",t2="[object String]",n2="[object Boolean]",r2=Math.PI/180,i2=180/Math.PI,Ep="#",a2="",s2="0",o2="Konva warning: ",SS="Konva error: ",l2="rgb(",xp={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},u2=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Hd=[];const c2=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(o){setTimeout(o,60)},Y={_isElement(o){return!!(o&&o.nodeType==1)},_isFunction(o){return!!(o&&o.constructor&&o.call&&o.apply)},_isPlainObject(o){return!!o&&o.constructor===Object},_isArray(o){return Object.prototype.toString.call(o)===$x},_isNumber(o){return Object.prototype.toString.call(o)===e2&&!isNaN(o)&&isFinite(o)},_isString(o){return Object.prototype.toString.call(o)===t2},_isBoolean(o){return Object.prototype.toString.call(o)===n2},isObject(o){return o instanceof Object},isValidSelector(o){if(typeof o!="string")return!1;var e=o[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(o){return o===0||o>0?1:-1},requestAnimFrame(o){Hd.push(o),Hd.length===1&&c2(function(){const e=Hd;Hd=[],e.forEach(function(r){r()})})},createCanvasElement(){var o=document.createElement("canvas");try{o.style=o.style||{}}catch{}return o},createImageElement(){return document.createElement("img")},_isInDocument(o){for(;o=o.parentNode;)if(o==document)return!0;return!1},_urlToImage(o,e){var r=Y.createImageElement();r.onload=function(){e(r)},r.src=o},_rgbToHex(o,e,r){return((1<<24)+(o<<16)+(e<<8)+r).toString(16).slice(1)},_hexToRgb(o){o=o.replace(Ep,a2);var e=parseInt(o,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){for(var o=(Math.random()*16777215<<0).toString(16);o.length<6;)o=s2+o;return Ep+o},getRGB(o){var e;return o in xp?(e=xp[o],{r:e[0],g:e[1],b:e[2]}):o[0]===Ep?this._hexToRgb(o.substring(1)):o.substr(0,4)===l2?(e=u2.exec(o.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(o){return o=o||"black",Y._namedColorToRBA(o)||Y._hex3ColorToRGBA(o)||Y._hex6ColorToRGBA(o)||Y._rgbColorToRGBA(o)||Y._rgbaColorToRGBA(o)||Y._hslColorToRGBA(o)},_namedColorToRBA(o){var e=xp[o.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(o){if(o.indexOf("rgb(")===0){o=o.match(/rgb\(([^)]+)\)/)[1];var e=o.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(o){if(o.indexOf("rgba(")===0){o=o.match(/rgba\(([^)]+)\)/)[1];var e=o.split(/ *, */).map((r,s)=>r.slice(-1)==="%"?s===3?parseInt(r)/100:parseInt(r)/100*255:Number(r));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex6ColorToRGBA(o){if(o[0]==="#"&&o.length===7)return{r:parseInt(o.slice(1,3),16),g:parseInt(o.slice(3,5),16),b:parseInt(o.slice(5,7),16),a:1}},_hex3ColorToRGBA(o){if(o[0]==="#"&&o.length===4)return{r:parseInt(o[1]+o[1],16),g:parseInt(o[2]+o[2],16),b:parseInt(o[3]+o[3],16),a:1}},_hslColorToRGBA(o){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(o)){const[e,...r]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(o),s=Number(r[0])/360,u=Number(r[1])/100,f=Number(r[2])/100;let h,y,g;if(u===0)return g=f*255,{r:Math.round(g),g:Math.round(g),b:Math.round(g),a:1};f<.5?h=f*(1+u):h=f+u-f*u;const p=2*f-h,x=[0,0,0];for(let R=0;R<3;R++)y=s+1/3*-(R-1),y<0&&y++,y>1&&y--,6*y<1?g=p+(h-p)*6*y:2*y<1?g=h:3*y<2?g=p+(h-p)*(2/3-y)*6:g=p,x[R]=g*255;return{r:Math.round(x[0]),g:Math.round(x[1]),b:Math.round(x[2]),a:1}}},haveIntersection(o,e){return!(e.x>o.x+o.width||e.x+e.widtho.y+o.height||e.y+e.height1?(h=r,y=s,g=(r-u)*(r-u)+(s-f)*(s-f)):(h=o+x*(r-o),y=e+x*(s-e),g=(h-u)*(h-u)+(y-f)*(y-f))}return[h,y,g]},_getProjectionToLine(o,e,r){var s=Y.cloneObject(o),u=Number.MAX_VALUE;return e.forEach(function(f,h){if(!(!r&&h===e.length-1)){var y=e[(h+1)%e.length],g=Y._getProjectionToSegment(f.x,f.y,y.x,y.y,o.x,o.y),p=g[0],x=g[1],R=g[2];Re.length){var h=e;e=o,o=h}for(s=0;s255?255:o<0?0:Math.round(o)}function _e(){if(Fe.isUnminified)return function(o,e){return Y._isNumber(o)||Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),o}}function ES(o){if(Fe.isUnminified)return function(e,r){let s=Y._isNumber(e),u=Y._isArray(e)&&e.length==o;return!s&&!u&&Y.warn(Zs(e)+' is a not valid value for "'+r+'" attribute. The value should be a number or Array('+o+")"),e}}function Cp(){if(Fe.isUnminified)return function(o,e){var r=Y._isNumber(o),s=o==="auto";return r||s||Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),o}}function Ql(){if(Fe.isUnminified)return function(o,e){return Y._isString(o)||Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),o}}function xS(){if(Fe.isUnminified)return function(o,e){const r=Y._isString(o),s=Object.prototype.toString.call(o)==="[object CanvasGradient]"||o&&o.addColorStop;return r||s||Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),o}}function f2(){if(Fe.isUnminified)return function(o,e){const r=Int8Array?Object.getPrototypeOf(Int8Array):null;return r&&o instanceof r||(Y._isArray(o)?o.forEach(function(s){Y._isNumber(s)||Y.warn('"'+e+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")}):Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),o}}function la(){if(Fe.isUnminified)return function(o,e){var r=o===!0||o===!1;return r||Y.warn(Zs(o)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),o}}function d2(o){if(Fe.isUnminified)return function(e,r){return e==null||Y.isObject(e)||Y.warn(Zs(e)+' is a not valid value for "'+r+'" attribute. The value should be an object with properties '+o),e}}var Rc="get",bc="set";const P={addGetterSetter(o,e,r,s,u){P.addGetter(o,e,r),P.addSetter(o,e,s,u),P.addOverloadedGetterSetter(o,e)},addGetter(o,e,r){var s=Rc+Y._capitalize(e);o.prototype[s]=o.prototype[s]||function(){var u=this.attrs[e];return u===void 0?r:u}},addSetter(o,e,r,s){var u=bc+Y._capitalize(e);o.prototype[u]||P.overWriteSetter(o,e,r,s)},overWriteSetter(o,e,r,s){var u=bc+Y._capitalize(e);o.prototype[u]=function(f){return r&&f!==void 0&&f!==null&&(f=r.call(this,f,e)),this._setAttr(e,f),s&&s.call(this),this}},addComponentsGetterSetter(o,e,r,s,u){var f=r.length,h=Y._capitalize,y=Rc+h(e),g=bc+h(e),p,x;o.prototype[y]=function(){var T={};for(p=0;p{this._setAttr(e+h(A),void 0)}),this._fireChangeEvent(e,O,T),u&&u.call(this),this},P.addOverloadedGetterSetter(o,e)},addOverloadedGetterSetter(o,e){var r=Y._capitalize(e),s=bc+r,u=Rc+r;o.prototype[e]=function(){return arguments.length?(this[s](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,e,r,s){Y.error("Adding deprecated "+e);var u=Rc+Y._capitalize(e),f=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){Y.error(f);var h=this.attrs[e];return h===void 0?r:h},P.addSetter(o,e,s,function(){Y.error(f)}),P.addOverloadedGetterSetter(o,e)},backCompat(o,e){Y.each(e,function(r,s){var u=o.prototype[s],f=Rc+Y._capitalize(r),h=bc+Y._capitalize(r);function y(){u.apply(this,arguments),Y.error('"'+r+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}o.prototype[r]=y,o.prototype[f]=y,o.prototype[h]=y})},afterSetFilter(){this._filterUpToDate=!1}};function h2(o){var e=[],r=o.length,s=Y,u,f;for(u=0;utypeof x=="number"?Math.floor(x):x)),f+=v2+p.join(CS)+p2)):(f+=y.property,e||(f+=_2+y.val)),f+=y2;return f}clearTrace(){this.traceArr=[]}_trace(e){var r=this.traceArr,s;r.push(e),s=r.length,s>=x2&&r.shift()}reset(){var e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){var r=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,r.getWidth()/r.pixelRatio,r.getHeight()/r.pixelRatio)}_applyLineCap(e){var r=e.getLineCap();r&&this.setAttr("lineCap",r)}_applyOpacity(e){var r=e.getAbsoluteOpacity();r!==1&&this.setAttr("globalAlpha",r)}_applyLineJoin(e){var r=e.attrs.lineJoin;r&&this.setAttr("lineJoin",r)}setAttr(e,r){this._context[e]=r}arc(e,r,s,u,f,h){this._context.arc(e,r,s,u,f,h)}arcTo(e,r,s,u,f){this._context.arcTo(e,r,s,u,f)}beginPath(){this._context.beginPath()}bezierCurveTo(e,r,s,u,f,h){this._context.bezierCurveTo(e,r,s,u,f,h)}clearRect(e,r,s,u){this._context.clearRect(e,r,s,u)}clip(){this._context.clip()}closePath(){this._context.closePath()}createImageData(e,r){var s=arguments;if(s.length===2)return this._context.createImageData(e,r);if(s.length===1)return this._context.createImageData(e)}createLinearGradient(e,r,s,u){return this._context.createLinearGradient(e,r,s,u)}createPattern(e,r){return this._context.createPattern(e,r)}createRadialGradient(e,r,s,u,f,h){return this._context.createRadialGradient(e,r,s,u,f,h)}drawImage(e,r,s,u,f,h,y,g,p){var x=arguments,R=this._context;x.length===3?R.drawImage(e,r,s):x.length===5?R.drawImage(e,r,s,u,f):x.length===9&&R.drawImage(e,r,s,u,f,h,y,g,p)}ellipse(e,r,s,u,f,h,y,g){this._context.ellipse(e,r,s,u,f,h,y,g)}isPointInPath(e,r){return this._context.isPointInPath(e,r)}fill(e){e?this._context.fill(e):this._context.fill()}fillRect(e,r,s,u){this._context.fillRect(e,r,s,u)}strokeRect(e,r,s,u){this._context.strokeRect(e,r,s,u)}fillText(e,r,s,u){u?this._context.fillText(e,r,s,u):this._context.fillText(e,r,s)}measureText(e){return this._context.measureText(e)}getImageData(e,r,s,u){return this._context.getImageData(e,r,s,u)}lineTo(e,r){this._context.lineTo(e,r)}moveTo(e,r){this._context.moveTo(e,r)}rect(e,r,s,u){this._context.rect(e,r,s,u)}putImageData(e,r,s){this._context.putImageData(e,r,s)}quadraticCurveTo(e,r,s,u){this._context.quadraticCurveTo(e,r,s,u)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,r){this._context.scale(e,r)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,r,s,u,f,h){this._context.setTransform(e,r,s,u,f,h)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,r,s,u){this._context.strokeText(e,r,s,u)}transform(e,r,s,u,f,h){this._context.transform(e,r,s,u,f,h)}translate(e,r){this._context.translate(e,r)}_enableTrace(){var e=this,r=TS.length,s=this.setAttr,u,f,h=function(y){var g=e[y],p;e[y]=function(){return f=h2(Array.prototype.slice.call(arguments,0)),p=g.apply(e,arguments),e._trace({method:y,args:f}),p}};for(u=0;u{e.dragStatus==="dragging"&&(o=!0)}),o},justDragged:!1,get node(){var o;return zt._dragElements.forEach(e=>{o=e.node}),o},_dragElements:new Map,_drag(o){const e=[];zt._dragElements.forEach((r,s)=>{const{node:u}=r,f=u.getStage();f.setPointersPositions(o),r.pointerId===void 0&&(r.pointerId=Y._getFirstPointerId(o));const h=f._changedPointerPositions.find(p=>p.id===r.pointerId);if(!!h){if(r.dragStatus!=="dragging"){var y=u.dragDistance(),g=Math.max(Math.abs(h.x-r.startPointerPos.x),Math.abs(h.y-r.startPointerPos.y));if(g{r.fire("dragmove",{type:"dragmove",target:r,evt:o},!0)})},_endDragBefore(o){const e=[];zt._dragElements.forEach(r=>{const{node:s}=r,u=s.getStage();if(o&&u.setPointersPositions(o),!u._changedPointerPositions.find(y=>y.id===r.pointerId))return;(r.dragStatus==="dragging"||r.dragStatus==="stopped")&&(zt.justDragged=!0,Fe._mouseListenClick=!1,Fe._touchListenClick=!1,Fe._pointerListenClick=!1,r.dragStatus="stopped");const h=r.node.getLayer()||r.node instanceof Fe.Stage&&r.node;h&&e.indexOf(h)===-1&&e.push(h)}),e.forEach(r=>{r.draw()})},_endDragAfter(o){zt._dragElements.forEach((e,r)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:o},!0),e.dragStatus!=="dragging"&&zt._dragElements.delete(r)})}};Fe.isBrowser&&(window.addEventListener("mouseup",zt._endDragBefore,!0),window.addEventListener("touchend",zt._endDragBefore,!0),window.addEventListener("mousemove",zt._drag),window.addEventListener("touchmove",zt._drag),window.addEventListener("mouseup",zt._endDragAfter,!1),window.addEventListener("touchend",zt._endDragAfter,!1));var jd="absoluteOpacity",Id="allEventListeners",vs="absoluteTransform",RS="absoluteScale",wc="canvas",b2="Change",w2="children",D2="konva",Rp="listening",bS="mouseenter",wS="mouseleave",DS="set",OS="Shape",Vd=" ",NS="stage",$s="transform",O2="Stage",bp="visible",N2=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Vd);let A2=1;class Ee{constructor(e){this._id=A2++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===$s||e===vs)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,r){var s=this._cache.get(e),u=e===$s||e===vs,f=s===void 0||u&&s.dirty===!0;return f&&(s=r.call(this),this._cache.set(e,s)),s}_calculate(e,r,s){if(!this._attachedDepsListeners.get(e)){const u=r.map(f=>f+"Change.konva").join(Vd);this.on(u,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,s)}_getCanvasCache(){return this._cache.get(wc)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===vs&&this.fire("absoluteTransformChange")}clearCache(){return this._cache.delete(wc),this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){var r=e||{},s={};(r.x===void 0||r.y===void 0||r.width===void 0||r.height===void 0)&&(s=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var u=Math.ceil(r.width||s.width),f=Math.ceil(r.height||s.height),h=r.pixelRatio,y=r.x===void 0?Math.floor(s.x):r.x,g=r.y===void 0?Math.floor(s.y):r.y,p=r.offset||0,x=r.drawBorder||!1,R=r.hitCanvasPixelRatio||1;if(!u||!f){Y.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}u+=p*2+1,f+=p*2+1,y-=p,g-=p;var T=new Xl({pixelRatio:h,width:u,height:f}),O=new Xl({pixelRatio:h,width:0,height:0}),w=new Tp({pixelRatio:R,width:u,height:f}),A=T.getContext(),M=w.getContext();return w.isCache=!0,T.isCache=!0,this._cache.delete(wc),this._filterUpToDate=!1,r.imageSmoothingEnabled===!1&&(T.getContext()._context.imageSmoothingEnabled=!1,O.getContext()._context.imageSmoothingEnabled=!1),A.save(),M.save(),A.translate(-y,-g),M.translate(-y,-g),this._isUnderCache=!0,this._clearSelfAndDescendantCache(jd),this._clearSelfAndDescendantCache(RS),this.drawScene(T,this),this.drawHit(w,this),this._isUnderCache=!1,A.restore(),M.restore(),x&&(A.save(),A.beginPath(),A.rect(0,0,u,f),A.closePath(),A.setAttr("strokeStyle","red"),A.setAttr("lineWidth",5),A.stroke(),A.restore()),this._cache.set(wc,{scene:T,filter:O,hit:w,x:y,y:g}),this._requestDraw(),this}isCached(){return this._cache.has(wc)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,r){var s=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}],u,f,h,y,g=this.getAbsoluteTransform(r);return s.forEach(function(p){var x=g.point(p);u===void 0&&(u=h=x.x,f=y=x.y),u=Math.min(u,x.x),f=Math.min(f,x.y),h=Math.max(h,x.x),y=Math.max(y,x.y)}),{x:u,y:f,width:h-u,height:y-f}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const r=this._getCanvasCache();e.translate(r.x,r.y);var s=this._getCachedSceneCanvas(),u=s.pixelRatio;e.drawImage(s._canvas,0,0,s.width/u,s.height/u),e.restore()}_drawCachedHitCanvas(e){var r=this._getCanvasCache(),s=r.hit;e.save(),e.translate(r.x,r.y),e.drawImage(s._canvas,0,0,s.width/s.pixelRatio,s.height/s.pixelRatio),e.restore()}_getCachedSceneCanvas(){var e=this.filters(),r=this._getCanvasCache(),s=r.scene,u=r.filter,f=u.getContext(),h,y,g,p;if(e){if(!this._filterUpToDate){var x=s.pixelRatio;u.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio);try{for(h=e.length,f.clear(),f.drawImage(s._canvas,0,0,s.getWidth()/x,s.getHeight()/x),y=f.getImageData(0,0,u.getWidth(),u.getHeight()),g=0;g{var r,s;if(!e)return this;for(r in e)r!==w2&&(s=DS+Y._capitalize(r),Y._isFunction(this[s])?this[s](e[r]):this._setAttr(r,e[r]))}),this}isListening(){return this._getCache(Rp,this._isListening)}_isListening(e){if(!this.listening())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isListening(e):!0}isVisible(){return this._getCache(bp,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isVisible(e):!0}shouldDrawHit(e,r=!1){if(e)return this._isVisible(e)&&this._isListening(e);var s=this.getLayer(),u=!1;zt._dragElements.forEach(h=>{h.dragStatus==="dragging"&&(h.node.nodeType==="Stage"||h.node.getLayer()===s)&&(u=!0)});var f=!r&&!Fe.hitOnDragEnabled&&u;return this.isListening()&&this.isVisible()&&!f}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var e=this.getDepth(),r=this,s=0,u,f,h,y;function g(p){for(u=[],f=p.length,h=0;h0&&u[0].getDepth()<=e&&g(u)}return r.nodeType!==O2&&g(r.getStage().getChildren()),s}getDepth(){for(var e=0,r=this.parent;r;)e++,r=r.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache($s),this._clearSelfAndDescendantCache(vs)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var e=this.getStage().getPointerPosition();if(!e)return null;var r=this.getAbsoluteTransform().copy();return r.invert(),r.point(e)}getAbsolutePosition(e){let r=!1,s=this.parent;for(;s;){if(s.isCached()){r=!0;break}s=s.parent}r&&!e&&(e=!0);var u=this.getAbsoluteTransform(e).getMatrix(),f=new Ci,h=this.offset();return f.m=u.slice(),f.translate(h.x,h.y),f.getTranslation()}setAbsolutePosition(e){var r=this._clearTransform();this.attrs.x=r.x,this.attrs.y=r.y,delete r.x,delete r.y,this._clearCache($s);var s=this._getAbsoluteTransform().copy();return s.invert(),s.translate(e.x,e.y),e={x:this.attrs.x+s.getTranslation().x,y:this.attrs.y+s.getTranslation().y},this._setTransform(r),this.setPosition({x:e.x,y:e.y}),this._clearCache($s),this._clearSelfAndDescendantCache(vs),this}_setTransform(e){var r;for(r in e)this.attrs[r]=e[r]}_clearTransform(){var e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){var r=e.x,s=e.y,u=this.x(),f=this.y();return r!==void 0&&(u+=r),s!==void 0&&(f+=s),this.setPosition({x:u,y:f}),this}_eachAncestorReverse(e,r){var s=[],u=this.getParent(),f,h;if(!(r&&r._id===this._id)){for(s.unshift(this);u&&(!r||u._id!==r._id);)s.unshift(u),u=u.parent;for(f=s.length,h=0;h0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Y.warn("Node has no parent. moveToBottom function is ignored."),!1;var e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return Y.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&Y.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var r=this.index;return this.parent.children.splice(r,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(jd,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var e=this.opacity(),r=this.getParent();return r&&!r._isUnderCache&&(e*=r.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){var e={},r=this.getAttrs(),s,u,f,h,y;e.attrs={};for(s in r)u=r[s],y=Y.isObject(u)&&!Y._isPlainObject(u)&&!Y._isArray(u),!y&&(f=typeof this[s]=="function"&&this[s],delete r[s],h=f?f.call(this):null,r[s]=u,h!==u&&(e.attrs[s]=u));return e.className=this.getClassName(),Y._prepareToStringify(e)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,r,s){var u=[];r&&this._isMatch(e)&&u.push(this);for(var f=this.parent;f;){if(f===s)return u;f._isMatch(e)&&u.push(f),f=f.parent}return u}isAncestorOf(e){return!1}findAncestor(e,r,s){return this.findAncestors(e,r,s)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);var r=e.replace(/ /g,"").split(","),s=r.length,u,f;for(u=0;u{try{const u=e==null?void 0:e.callback;u&&delete e.callback,Y._urlToImage(this.toDataURL(e),function(f){r(f),u==null||u(f)})}catch(u){s(u)}})}toBlob(e){return new Promise((r,s)=>{try{const u=e==null?void 0:e.callback;u&&delete e.callback,this.toCanvas(e).toBlob(f=>{r(f),u==null||u(f)})}catch(u){s(u)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Fe.dragDistance}_off(e,r,s){var u=this.eventListeners[e],f,h,y;for(f=0;f=0;if(!!s&&!this.isDragging()){var u=!1;zt._dragElements.forEach(f=>{this.isAncestorOf(f.node)&&(u=!0)}),u||this._createDragElement(e)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var e=this.getStage();if(!e)return;const r=zt._dragElements.get(this._id),s=r&&r.dragStatus==="dragging",u=r&&r.dragStatus==="ready";s?this.stopDrag():u&&zt._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const r=this.getStage();if(!r)return!1;const s={x:-e.x,y:-e.y,width:r.width()+2*e.x,height:r.height()+2*e.y};return Y.haveIntersection(s,this.getClientRect())}static create(e,r){return Y._isString(e)&&(e=JSON.parse(e)),this._createNode(e,r)}static _createNode(e,r){var s=Ee.prototype.getClassName.call(e),u=e.children,f,h,y;r&&(e.attrs.container=r),Fe[s]||(Y.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape");const g=Fe[s];if(f=new g(e.attrs),u)for(h=u.length,y=0;y0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(arguments.length>1){for(var r=0;r0?r[0]:void 0}_generalFind(e,r){var s=[];return this._descendants(u=>{const f=u._isMatch(e);return f&&s.push(u),!!(f&&r)}),s}_descendants(e){let r=!1;const s=this.getChildren();for(const u of s){if(r=e(u),r)return!0;if(!!u.hasChildren()&&(r=u._descendants(e),r))return!0}return!1}toObject(){var e=Ee.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(r=>{e.children.push(r.toObject())}),e}isAncestorOf(e){for(var r=e.getParent();r;){if(r._id===this._id)return!0;r=r.getParent()}return!1}clone(e){var r=Ee.prototype.clone.call(this,e);return this.getChildren().forEach(function(s){r.add(s.clone())}),r}getAllIntersections(e){var r=[];return this.find("Shape").forEach(function(s){s.isVisible()&&s.intersects(e)&&r.push(s)}),r}_clearSelfAndDescendantCache(e){var r;super._clearSelfAndDescendantCache(e),!this.isCached()&&((r=this.children)===null||r===void 0||r.forEach(function(s){s._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(r,s){r.index=s}),this._requestDraw()}drawScene(e,r){var s=this.getLayer(),u=e||s&&s.getCanvas(),f=u&&u.getContext(),h=this._getCanvasCache(),y=h&&h.scene,g=u&&u.isCache;if(!this.isVisible()&&!g)return this;if(y){f.save();var p=this.getAbsoluteTransform(r).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedSceneCanvas(f),f.restore()}else this._drawChildren("drawScene",u,r);return this}drawHit(e,r){if(!this.shouldDrawHit(r))return this;var s=this.getLayer(),u=e||s&&s.hitCanvas,f=u&&u.getContext(),h=this._getCanvasCache(),y=h&&h.hit;if(y){f.save();var g=this.getAbsoluteTransform(r).getMatrix();f.transform(g[0],g[1],g[2],g[3],g[4],g[5]),this._drawCachedHitCanvas(f),f.restore()}else this._drawChildren("drawHit",u,r);return this}_drawChildren(e,r,s){var u,f=r&&r.getContext(),h=this.clipWidth(),y=this.clipHeight(),g=this.clipFunc(),p=h&&y||g;const x=s===this;if(p){f.save();var R=this.getAbsoluteTransform(s),T=R.getMatrix();if(f.transform(T[0],T[1],T[2],T[3],T[4],T[5]),f.beginPath(),g)g.call(this,f,this);else{var O=this.clipX(),w=this.clipY();f.rect(O,w,h,y)}f.clip(),T=R.copy().invert().getMatrix(),f.transform(T[0],T[1],T[2],T[3],T[4],T[5])}var A=!x&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";A&&(f.save(),f._applyGlobalCompositeOperation(this)),(u=this.children)===null||u===void 0||u.forEach(function(M){M[e](r,s)}),A&&f.restore(),p&&f.restore()}getClientRect(e){var r;e=e||{};var s=e.skipTransform,u=e.relativeTo,f,h,y,g,p={x:1/0,y:1/0,width:0,height:0},x=this;(r=this.children)===null||r===void 0||r.forEach(function(A){if(!!A.visible()){var M=A.getClientRect({relativeTo:x,skipShadow:e.skipShadow,skipStroke:e.skipStroke});M.width===0&&M.height===0||(f===void 0?(f=M.x,h=M.y,y=M.x+M.width,g=M.y+M.height):(f=Math.min(f,M.x),h=Math.min(h,M.y),y=Math.max(y,M.x+M.width),g=Math.max(g,M.y+M.height)))}});for(var R=this.find("Shape"),T=!1,O=0;Oo.indexOf("pointer")>=0?"pointer":o.indexOf("touch")>=0?"touch":"mouse",Jl=o=>{const e=Lc(o);if(e==="pointer")return Fe.pointerEventsEnabled&&Ap.pointer;if(e==="touch")return Ap.touch;if(e==="mouse")return Ap.mouse};function YS(o={}){return(o.clipFunc||o.clipWidth||o.clipHeight)&&Y.warn("Stage does not support clipping. Please use clip for Layers or Groups."),o}const H2="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",Xd=[];class Kd extends Ti{constructor(e){super(YS(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Xd.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{YS(this.attrs)}),this._checkVisibility()}_validateAdd(e){const r=e.getType()==="Layer",s=e.getType()==="FastLayer";r||s||Y.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===L2){if(e.charAt(0)==="."){var r=e.slice(1);e=document.getElementsByClassName(r)[0]}else{var s;e.charAt(0)!=="#"?s=e:s=e.slice(1),e=document.getElementById(s)}if(!e)throw"Can not find container in document with id "+s}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var e=this.children,r=e.length,s;for(s=0;s-1&&Xd.splice(r,1),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Y.warn(H2),null)}_getPointerById(e){return this._pointerPositions.find(r=>r.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e=e||{},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();var r=new Xl({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),s=r.getContext()._context,u=this.children;return(e.x||e.y)&&s.translate(-1*e.x,-1*e.y),u.forEach(function(f){if(!!f.isVisible()){var h=f._toKonvaCanvas(e);s.drawImage(h._canvas,e.x,e.y,h.getWidth()/h.getPixelRatio(),h.getHeight()/h.getPixelRatio())}}),r}getIntersection(e){if(!e)return null;var r=this.children,s=r.length,u=s-1,f;for(f=u;f>=0;f--){const h=r[f].getIntersection(e);if(h)return h}return null}_resizeDOM(){var e=this.width(),r=this.height();this.content&&(this.content.style.width=e+PS,this.content.style.height=r+PS),this.bufferCanvas.setSize(e,r),this.bufferHitCanvas.setSize(e,r),this.children.forEach(s=>{s.setSize({width:e,height:r}),s.draw()})}add(e,...r){if(arguments.length>1){for(var s=0;sU2&&Y.warn("The stage has "+u+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Fe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return MS(e,this)}setPointerCapture(e){LS(e,this)}releaseCapture(e){Oc(e)}getLayers(){return this.children}_bindContentEvents(){!Fe.isBrowser||k2.forEach(([e,r])=>{this.content.addEventListener(e,s=>{this[r](s)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const r=Jl(e.type);this._fire(r.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const r=Jl(e.type);this._fire(r.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let r=this[e+"targetShape"];return r&&!r.getStage()&&(r=null),r}_pointerleave(e){const r=Jl(e.type),s=Lc(e.type);if(!!r){this.setPointersPositions(e);var u=this._getTargetShape(s),f=!zt.isDragging||Fe.hitOnDragEnabled;u&&f?(u._fireAndBubble(r.pointerout,{evt:e}),u._fireAndBubble(r.pointerleave,{evt:e}),this._fire(r.pointerleave,{evt:e,target:this,currentTarget:this}),this[s+"targetShape"]=null):f&&(this._fire(r.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(r.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(e){const r=Jl(e.type),s=Lc(e.type);if(!!r){this.setPointersPositions(e);var u=!1;this._changedPointerPositions.forEach(f=>{var h=this.getIntersection(f);if(zt.justDragged=!1,Fe["_"+s+"ListenClick"]=!0,!(h&&h.isListening()))return;Fe.capturePointerEventsEnabled&&h.setPointerCapture(f.id),this[s+"ClickStartShape"]=h,h._fireAndBubble(r.pointerdown,{evt:e,pointerId:f.id}),u=!0;const g=e.type.indexOf("touch")>=0;h.preventDefault()&&e.cancelable&&g&&e.preventDefault()}),u||this._fire(r.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(e){const r=Jl(e.type),s=Lc(e.type);if(!r)return;zt.isDragging&&zt.node.preventDefault()&&e.cancelable&&e.preventDefault(),this.setPointersPositions(e);var u=!zt.isDragging||Fe.hitOnDragEnabled;if(!u)return;var f={};let h=!1;var y=this._getTargetShape(s);this._changedPointerPositions.forEach(g=>{const p=wp(g.id)||this.getIntersection(g),x=g.id,R={evt:e,pointerId:x};var T=y!==p;if(T&&y&&(y._fireAndBubble(r.pointerout,Object.assign({},R),p),y._fireAndBubble(r.pointerleave,Object.assign({},R),p)),p){if(f[p._id])return;f[p._id]=!0}p&&p.isListening()?(h=!0,T&&(p._fireAndBubble(r.pointerover,Object.assign({},R),y),p._fireAndBubble(r.pointerenter,Object.assign({},R),y),this[s+"targetShape"]=p),p._fireAndBubble(r.pointermove,Object.assign({},R))):y&&(this._fire(r.pointerover,{evt:e,target:this,currentTarget:this,pointerId:x}),this[s+"targetShape"]=null)}),h||this._fire(r.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const r=Jl(e.type),s=Lc(e.type);if(!r)return;this.setPointersPositions(e);const u=this[s+"ClickStartShape"],f=this[s+"ClickEndShape"];var h={};let y=!1;this._changedPointerPositions.forEach(g=>{const p=wp(g.id)||this.getIntersection(g);if(p){if(p.releaseCapture(g.id),h[p._id])return;h[p._id]=!0}const x=g.id,R={evt:e,pointerId:x};let T=!1;Fe["_"+s+"InDblClickWindow"]?(T=!0,clearTimeout(this[s+"DblTimeout"])):zt.justDragged||(Fe["_"+s+"InDblClickWindow"]=!0,clearTimeout(this[s+"DblTimeout"])),this[s+"DblTimeout"]=setTimeout(function(){Fe["_"+s+"InDblClickWindow"]=!1},Fe.dblClickWindow),p&&p.isListening()?(y=!0,this[s+"ClickEndShape"]=p,p._fireAndBubble(r.pointerup,Object.assign({},R)),Fe["_"+s+"ListenClick"]&&u&&u===p&&(p._fireAndBubble(r.pointerclick,Object.assign({},R)),T&&f&&f===p&&p._fireAndBubble(r.pointerdblclick,Object.assign({},R)))):(this[s+"ClickEndShape"]=null,Fe["_"+s+"ListenClick"]&&this._fire(r.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:x}),T&&this._fire(r.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:x}))}),y||this._fire(r.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Fe["_"+s+"ListenClick"]=!1,e.cancelable&&s!=="touch"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);var r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?r._fireAndBubble(Op,{evt:e}):this._fire(Op,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);var r=this.getIntersection(this.getPointerPosition());r&&r.isListening()?r._fireAndBubble(Np,{evt:e}):this._fire(Np,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const r=wp(e.pointerId)||this.getIntersection(this.getPointerPosition());r&&r._fireAndBubble(Kl,Dp(e)),Oc(e.pointerId)}_lostpointercapture(e){Oc(e.pointerId)}setPointersPositions(e){var r=this._getContentPosition(),s=null,u=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,f=>{this._pointerPositions.push({id:f.identifier,x:(f.clientX-r.left)/r.scaleX,y:(f.clientY-r.top)/r.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,f=>{this._changedPointerPositions.push({id:f.identifier,x:(f.clientX-r.left)/r.scaleX,y:(f.clientY-r.top)/r.scaleY})})):(s=(e.clientX-r.left)/r.scaleX,u=(e.clientY-r.top)/r.scaleY,this.pointerPos={x:s,y:u},this._pointerPositions=[{x:s,y:u,id:Y._getFirstPointerId(e)}],this._changedPointerPositions=[{x:s,y:u,id:Y._getFirstPointerId(e)}])}_setPointerPosition(e){Y.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Xl({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Tp({pixelRatio:1,width:this.width(),height:this.height()}),!!Fe.isBrowser){var e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}}cache(){return Y.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}}Kd.prototype.nodeType=M2,vn(Kd),P.addGetterSetter(Kd,"container");var qS="hasShadow",WS="shadowRGBA",QS="patternImage",XS="linearGradient",KS="radialGradient";let Jd;function Mp(){return Jd||(Jd=Y.createCanvasElement().getContext("2d"),Jd)}const Pc={};function F2(o){o.fill()}function G2(o){o.stroke()}function B2(o){o.fill()}function j2(o){o.stroke()}function I2(){this._clearCache(qS)}function V2(){this._clearCache(WS)}function Y2(){this._clearCache(QS)}function q2(){this._clearCache(XS)}function W2(){this._clearCache(KS)}class ge extends Ee{constructor(e){super(e);let r;for(;r=Y.getRandomColor(),!(r&&!(r in Pc)););this.colorKey=r,Pc[r]=this}getContext(){return Y.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Y.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(qS,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(QS,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var e=Mp();const r=e.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(r&&r.setTransform){const s=new Ci;s.translate(this.fillPatternX(),this.fillPatternY()),s.rotate(Fe.getAngle(this.fillPatternRotation())),s.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),s.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const u=s.getMatrix(),f=typeof DOMMatrix>"u"?{a:u[0],b:u[1],c:u[2],d:u[3],e:u[4],f:u[5]}:new DOMMatrix(u);r.setTransform(f)}return r}}_getLinearGradient(){return this._getCache(XS,this.__getLinearGradient)}__getLinearGradient(){var e=this.fillLinearGradientColorStops();if(e){for(var r=Mp(),s=this.fillLinearGradientStartPoint(),u=this.fillLinearGradientEndPoint(),f=r.createLinearGradient(s.x,s.y,u.x,u.y),h=0;hthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){var r=this.getStage(),s=r.bufferHitCanvas,u;return s.getContext().clear(),this.drawHit(s,null,!0),u=s.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data,u[3]>0}destroy(){return Ee.prototype.destroy.call(this),delete Pc[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var r;if(!this.getStage()||!((r=this.attrs.perfectDrawEnabled)!==null&&r!==void 0?r:!0))return!1;const u=e||this.hasFill(),f=this.hasStroke(),h=this.getAbsoluteOpacity()!==1;if(u&&f&&h)return!0;const y=this.hasShadow(),g=this.shadowForStrokeEnabled();return!!(u&&f&&y&&g)}setStrokeHitEnabled(e){Y.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){const r=e.skipTransform,s=e.relativeTo,u=this.getSelfRect(),h=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,y=u.width+h,g=u.height+h,p=!e.skipShadow&&this.hasShadow(),x=p?this.shadowOffsetX():0,R=p?this.shadowOffsetY():0,T=y+Math.abs(x),O=g+Math.abs(R),w=p&&this.shadowBlur()||0,A=T+w*2,M=O+w*2,B={width:A,height:M,x:-(h/2+w)+Math.min(x,0)+u.x,y:-(h/2+w)+Math.min(R,0)+u.y};return r?B:this._transformedRect(B,s)}drawScene(e,r){var s=this.getLayer(),u=e||s.getCanvas(),f=u.getContext(),h=this._getCanvasCache(),y=this.getSceneFunc(),g=this.hasShadow(),p,x,R,T=u.isCache,O=r===this;if(!this.isVisible()&&!O)return this;if(h){f.save();var w=this.getAbsoluteTransform(r).getMatrix();return f.transform(w[0],w[1],w[2],w[3],w[4],w[5]),this._drawCachedSceneCanvas(f),f.restore(),this}if(!y)return this;if(f.save(),this._useBufferCanvas()&&!T){p=this.getStage(),x=p.bufferCanvas,R=x.getContext(),R.clear(),R.save(),R._applyLineJoin(this);var A=this.getAbsoluteTransform(r).getMatrix();R.transform(A[0],A[1],A[2],A[3],A[4],A[5]),y.call(this,R,this),R.restore();var M=x.pixelRatio;g&&f._applyShadow(this),f._applyOpacity(this),f._applyGlobalCompositeOperation(this),f.drawImage(x._canvas,0,0,x.width/M,x.height/M)}else{if(f._applyLineJoin(this),!O){var A=this.getAbsoluteTransform(r).getMatrix();f.transform(A[0],A[1],A[2],A[3],A[4],A[5]),f._applyOpacity(this),f._applyGlobalCompositeOperation(this)}g&&f._applyShadow(this),y.call(this,f,this)}return f.restore(),this}drawHit(e,r,s=!1){if(!this.shouldDrawHit(r,s))return this;var u=this.getLayer(),f=e||u.hitCanvas,h=f&&f.getContext(),y=this.hitFunc()||this.sceneFunc(),g=this._getCanvasCache(),p=g&&g.hit;if(this.colorKey||Y.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),p){h.save();var x=this.getAbsoluteTransform(r).getMatrix();return h.transform(x[0],x[1],x[2],x[3],x[4],x[5]),this._drawCachedHitCanvas(h),h.restore(),this}if(!y)return this;if(h.save(),h._applyLineJoin(this),!(this===r)){var T=this.getAbsoluteTransform(r).getMatrix();h.transform(T[0],T[1],T[2],T[3],T[4],T[5])}return y.call(this,h,this),h.restore(),this}drawHitFromCache(e=0){var r=this._getCanvasCache(),s=this._getCachedSceneCanvas(),u=r.hit,f=u.getContext(),h=u.getWidth(),y=u.getHeight(),g,p,x,R,T,O;f.clear(),f.drawImage(s._canvas,0,0,h,y);try{for(g=f.getImageData(0,0,h,y),p=g.data,x=p.length,R=Y._hexToRgb(this.colorKey),T=0;Te?(p[T]=R.r,p[T+1]=R.g,p[T+2]=R.b,p[T+3]=255):p[T+3]=0;f.putImageData(g,0,0)}catch(w){Y.error("Unable to draw hit graph from cached scene canvas. "+w.message)}return this}hasPointerCapture(e){return MS(e,this)}setPointerCapture(e){LS(e,this)}releaseCapture(e){Oc(e)}}ge.prototype._fillFunc=F2,ge.prototype._strokeFunc=G2,ge.prototype._fillFuncHit=B2,ge.prototype._strokeFuncHit=j2,ge.prototype._centroid=!1,ge.prototype.nodeType="Shape",vn(ge),ge.prototype.eventListeners={},ge.prototype.on.call(ge.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",I2),ge.prototype.on.call(ge.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",V2),ge.prototype.on.call(ge.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",Y2),ge.prototype.on.call(ge.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",q2),ge.prototype.on.call(ge.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",W2),P.addGetterSetter(ge,"stroke",void 0,xS()),P.addGetterSetter(ge,"strokeWidth",2,_e()),P.addGetterSetter(ge,"fillAfterStrokeEnabled",!1),P.addGetterSetter(ge,"hitStrokeWidth","auto",Cp()),P.addGetterSetter(ge,"strokeHitEnabled",!0,la()),P.addGetterSetter(ge,"perfectDrawEnabled",!0,la()),P.addGetterSetter(ge,"shadowForStrokeEnabled",!0,la()),P.addGetterSetter(ge,"lineJoin"),P.addGetterSetter(ge,"lineCap"),P.addGetterSetter(ge,"sceneFunc"),P.addGetterSetter(ge,"hitFunc"),P.addGetterSetter(ge,"dash"),P.addGetterSetter(ge,"dashOffset",0,_e()),P.addGetterSetter(ge,"shadowColor",void 0,Ql()),P.addGetterSetter(ge,"shadowBlur",0,_e()),P.addGetterSetter(ge,"shadowOpacity",1,_e()),P.addComponentsGetterSetter(ge,"shadowOffset",["x","y"]),P.addGetterSetter(ge,"shadowOffsetX",0,_e()),P.addGetterSetter(ge,"shadowOffsetY",0,_e()),P.addGetterSetter(ge,"fillPatternImage"),P.addGetterSetter(ge,"fill",void 0,xS()),P.addGetterSetter(ge,"fillPatternX",0,_e()),P.addGetterSetter(ge,"fillPatternY",0,_e()),P.addGetterSetter(ge,"fillLinearGradientColorStops"),P.addGetterSetter(ge,"strokeLinearGradientColorStops"),P.addGetterSetter(ge,"fillRadialGradientStartRadius",0),P.addGetterSetter(ge,"fillRadialGradientEndRadius",0),P.addGetterSetter(ge,"fillRadialGradientColorStops"),P.addGetterSetter(ge,"fillPatternRepeat","repeat"),P.addGetterSetter(ge,"fillEnabled",!0),P.addGetterSetter(ge,"strokeEnabled",!0),P.addGetterSetter(ge,"shadowEnabled",!0),P.addGetterSetter(ge,"dashEnabled",!0),P.addGetterSetter(ge,"strokeScaleEnabled",!0),P.addGetterSetter(ge,"fillPriority","color"),P.addComponentsGetterSetter(ge,"fillPatternOffset",["x","y"]),P.addGetterSetter(ge,"fillPatternOffsetX",0,_e()),P.addGetterSetter(ge,"fillPatternOffsetY",0,_e()),P.addComponentsGetterSetter(ge,"fillPatternScale",["x","y"]),P.addGetterSetter(ge,"fillPatternScaleX",1,_e()),P.addGetterSetter(ge,"fillPatternScaleY",1,_e()),P.addComponentsGetterSetter(ge,"fillLinearGradientStartPoint",["x","y"]),P.addComponentsGetterSetter(ge,"strokeLinearGradientStartPoint",["x","y"]),P.addGetterSetter(ge,"fillLinearGradientStartPointX",0),P.addGetterSetter(ge,"strokeLinearGradientStartPointX",0),P.addGetterSetter(ge,"fillLinearGradientStartPointY",0),P.addGetterSetter(ge,"strokeLinearGradientStartPointY",0),P.addComponentsGetterSetter(ge,"fillLinearGradientEndPoint",["x","y"]),P.addComponentsGetterSetter(ge,"strokeLinearGradientEndPoint",["x","y"]),P.addGetterSetter(ge,"fillLinearGradientEndPointX",0),P.addGetterSetter(ge,"strokeLinearGradientEndPointX",0),P.addGetterSetter(ge,"fillLinearGradientEndPointY",0),P.addGetterSetter(ge,"strokeLinearGradientEndPointY",0),P.addComponentsGetterSetter(ge,"fillRadialGradientStartPoint",["x","y"]),P.addGetterSetter(ge,"fillRadialGradientStartPointX",0),P.addGetterSetter(ge,"fillRadialGradientStartPointY",0),P.addComponentsGetterSetter(ge,"fillRadialGradientEndPoint",["x","y"]),P.addGetterSetter(ge,"fillRadialGradientEndPointX",0),P.addGetterSetter(ge,"fillRadialGradientEndPointY",0),P.addGetterSetter(ge,"fillPatternRotation",0),P.backCompat(ge,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var Q2="#",X2="beforeDraw",K2="draw",JS=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],J2=JS.length;class Ko extends Ti{constructor(e){super(e),this.canvas=new Xl,this.hitCanvas=new Tp({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);var r=this.getStage();return r&&r.content&&(r.content.removeChild(this.getNativeCanvasElement()),e{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;for(var r=1,s=!1;;){for(let u=0;u0)return{antialiased:!0};return{}}drawScene(e,r){var s=this.getLayer(),u=e||s&&s.getCanvas();return this._fire(X2,{node:this}),this.clearBeforeDraw()&&u.getContext().clear(),Ti.prototype.drawScene.call(this,u,r),this._fire(K2,{node:this}),this}drawHit(e,r){var s=this.getLayer(),u=e||s&&s.hitCanvas;return s&&s.clearBeforeDraw()&&s.getHitCanvas().getContext().clear(),Ti.prototype.drawHit.call(this,u,r),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Y.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Y.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var e=this.parent,r=!!this.hitCanvas._canvas.parentNode;r?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}}}Ko.prototype.nodeType="Layer",vn(Ko),P.addGetterSetter(Ko,"imageSmoothingEnabled",!0),P.addGetterSetter(Ko,"clearBeforeDraw",!0),P.addGetterSetter(Ko,"hitGraphEnabled",!0,la());class Lp extends Ko{constructor(e){super(e),this.listening(!1),Y.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Lp.prototype.nodeType="FastLayer",vn(Lp);class Zl extends Ti{_validateAdd(e){var r=e.getType();r!=="Group"&&r!=="Shape"&&Y.throw("You may only add groups and shapes to groups.")}}Zl.prototype.nodeType="Group",vn(Zl);var Pp=function(){return Wl.performance&&Wl.performance.now?function(){return Wl.performance.now()}:function(){return new Date().getTime()}}();class Vi{constructor(e,r){this.id=Vi.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Pp(),frameRate:0},this.func=e,this.setLayers(r)}setLayers(e){var r=[];return e?e.length>0?r=e:r=[e]:r=[],this.layers=r,this}getLayers(){return this.layers}addLayer(e){var r=this.layers,s=r.length,u;for(u=0;uthis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=ZS,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=$S,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var e=this.getTimer()-this._startTime;this.state===ZS?this.setTime(e):this.state===$S&&this.setTime(this.duration-e)}pause(){this.state=$2,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Mn{constructor(e){var r=this,s=e.node,u=s._id,f,h=e.easing||zc.Linear,y=!!e.yoyo,g;typeof e.duration>"u"?f=.3:e.duration===0?f=.001:f=e.duration,this.node=s,this._id=eC++;var p=s.getLayer()||(s instanceof Fe.Stage?s.getLayers():null);p||Y.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Vi(function(){r.tween.onEnterFrame()},p),this.tween=new tC(g,function(x){r._tweenFunc(x)},h,0,1,f*1e3,y),this._addListeners(),Mn.attrs[u]||(Mn.attrs[u]={}),Mn.attrs[u][this._id]||(Mn.attrs[u][this._id]={}),Mn.tweens[u]||(Mn.tweens[u]={});for(g in e)Z2[g]===void 0&&this._addAttr(g,e[g]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,r){var s=this.node,u=s._id,f,h,y,g,p,x,R,T;if(y=Mn.tweens[u][e],y&&delete Mn.attrs[u][y][e],f=s.getAttr(e),Y._isArray(r))if(h=[],p=Math.max(r.length,f.length),e==="points"&&r.length!==f.length&&(r.length>f.length?(R=f,f=Y._prepareArrayForTween(f,r,s.closed())):(x=r,r=Y._prepareArrayForTween(r,f,s.closed()))),e.indexOf("fill")===0)for(g=0;g{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var e=this.node,r=Mn.attrs[e._id][this._id];r.points&&r.points.trueEnd&&e.setAttr("points",r.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var e=this.node,r=Mn.attrs[e._id][this._id];r.points&&r.points.trueStart&&e.points(r.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var e=this.node._id,r=this._id,s=Mn.tweens[e],u;this.pause();for(u in s)delete Mn.tweens[e][u];delete Mn.attrs[e][r]}}Mn.attrs={},Mn.tweens={},Ee.prototype.to=function(o){var e=o.onFinish;o.node=this,o.onFinish=function(){this.destroy(),e&&e()};var r=new Mn(o);r.play()};const zc={BackEaseIn(o,e,r,s){var u=1.70158;return r*(o/=s)*o*((u+1)*o-u)+e},BackEaseOut(o,e,r,s){var u=1.70158;return r*((o=o/s-1)*o*((u+1)*o+u)+1)+e},BackEaseInOut(o,e,r,s){var u=1.70158;return(o/=s/2)<1?r/2*(o*o*(((u*=1.525)+1)*o-u))+e:r/2*((o-=2)*o*(((u*=1.525)+1)*o+u)+2)+e},ElasticEaseIn(o,e,r,s,u,f){var h=0;return o===0?e:(o/=s)===1?e+r:(f||(f=s*.3),!u||u0?e:r),x=h*r,R=y*(y>0?e:r),T=g*(g>0?r:e);return{x:p,y:s?-1*T:R,width:x-p,height:T-R}}}ps.prototype._centroid=!0,ps.prototype.className="Arc",ps.prototype._attrsAffectingSize=["innerRadius","outerRadius"],vn(ps),P.addGetterSetter(ps,"innerRadius",0,_e()),P.addGetterSetter(ps,"outerRadius",0,_e()),P.addGetterSetter(ps,"angle",0,_e()),P.addGetterSetter(ps,"clockwise",!1,la());function zp(o,e,r,s,u,f,h){var y=Math.sqrt(Math.pow(r-o,2)+Math.pow(s-e,2)),g=Math.sqrt(Math.pow(u-r,2)+Math.pow(f-s,2)),p=h*y/(y+g),x=h*g/(y+g),R=r-p*(u-o),T=s-p*(f-e),O=r+x*(u-o),w=s+x*(f-e);return[R,T,O,w]}function t0(o,e){var r=o.length,s=[],u,f;for(u=2;u4){for(y=this.getTensionPoints(),g=y.length,p=f?0:4,f||e.quadraticCurveTo(y[0],y[1],y[2],y[3]);px?p:x,M=p>x?1:p/x,B=p>x?x/p:1;e.translate(y,g),e.rotate(O),e.scale(M,B),e.arc(0,0,A,R,R+T,1-w),e.scale(1/M,1/B),e.rotate(-O),e.translate(-y,-g);break;case"z":s=!0,e.closePath();break}}!s&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){var e=[];this.dataArray.forEach(function(p){if(p.command==="A"){var x=p.points[4],R=p.points[5],T=p.points[4]+R,O=Math.PI/180;if(Math.abs(x-T)T;w-=O){const A=Jt.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],w,0);e.push(A.x,A.y)}else for(let w=x+O;wthis.dataArray[s].pathLength;)e-=this.dataArray[s].pathLength,++s;if(s===u)return r=this.dataArray[s-1].points.slice(-2),{x:r[0],y:r[1]};if(e<.01)return r=this.dataArray[s].points.slice(0,2),{x:r[0],y:r[1]};var f=this.dataArray[s],h=f.points;switch(f.command){case"L":return Jt.getPointOnLine(e,f.start.x,f.start.y,h[0],h[1]);case"C":return Jt.getPointOnCubicBezier(e/f.pathLength,f.start.x,f.start.y,h[0],h[1],h[2],h[3],h[4],h[5]);case"Q":return Jt.getPointOnQuadraticBezier(e/f.pathLength,f.start.x,f.start.y,h[0],h[1],h[2],h[3]);case"A":var y=h[0],g=h[1],p=h[2],x=h[3],R=h[4],T=h[5],O=h[6];return R+=T*e/f.pathLength,Jt.getPointOnEllipticalArc(y,g,p,x,R,O)}return null}static getLineLength(e,r,s,u){return Math.sqrt((s-e)*(s-e)+(u-r)*(u-r))}static getPointOnLine(e,r,s,u,f,h,y){h===void 0&&(h=r),y===void 0&&(y=s);var g=(f-s)/(u-r+1e-8),p=Math.sqrt(e*e/(1+g*g));u0&&!isNaN(w[0]);){var k=null,H=[],q=g,re=p,j,I,ne,J,W,X,pe,ue,we,Ae;switch(O){case"l":g+=w.shift(),p+=w.shift(),k="L",H.push(g,p);break;case"L":g=w.shift(),p=w.shift(),H.push(g,p);break;case"m":var De=w.shift(),Ce=w.shift();if(g+=De,p+=Ce,k="M",h.length>2&&h[h.length-1].command==="z"){for(var oe=h.length-2;oe>=0;oe--)if(h[oe].command==="M"){g=h[oe].points[0]+De,p=h[oe].points[1]+Ce;break}}H.push(g,p),O="l";break;case"M":g=w.shift(),p=w.shift(),k="M",H.push(g,p),O="L";break;case"h":g+=w.shift(),k="L",H.push(g,p);break;case"H":g=w.shift(),k="L",H.push(g,p);break;case"v":p+=w.shift(),k="L",H.push(g,p);break;case"V":p=w.shift(),k="L",H.push(g,p);break;case"C":H.push(w.shift(),w.shift(),w.shift(),w.shift()),g=w.shift(),p=w.shift(),H.push(g,p);break;case"c":H.push(g+w.shift(),p+w.shift(),g+w.shift(),p+w.shift()),g+=w.shift(),p+=w.shift(),k="C",H.push(g,p);break;case"S":I=g,ne=p,j=h[h.length-1],j.command==="C"&&(I=g+(g-j.points[2]),ne=p+(p-j.points[3])),H.push(I,ne,w.shift(),w.shift()),g=w.shift(),p=w.shift(),k="C",H.push(g,p);break;case"s":I=g,ne=p,j=h[h.length-1],j.command==="C"&&(I=g+(g-j.points[2]),ne=p+(p-j.points[3])),H.push(I,ne,g+w.shift(),p+w.shift()),g+=w.shift(),p+=w.shift(),k="C",H.push(g,p);break;case"Q":H.push(w.shift(),w.shift()),g=w.shift(),p=w.shift(),H.push(g,p);break;case"q":H.push(g+w.shift(),p+w.shift()),g+=w.shift(),p+=w.shift(),k="Q",H.push(g,p);break;case"T":I=g,ne=p,j=h[h.length-1],j.command==="Q"&&(I=g+(g-j.points[0]),ne=p+(p-j.points[1])),g=w.shift(),p=w.shift(),k="Q",H.push(I,ne,g,p);break;case"t":I=g,ne=p,j=h[h.length-1],j.command==="Q"&&(I=g+(g-j.points[0]),ne=p+(p-j.points[1])),g+=w.shift(),p+=w.shift(),k="Q",H.push(I,ne,g,p);break;case"A":J=w.shift(),W=w.shift(),X=w.shift(),pe=w.shift(),ue=w.shift(),we=g,Ae=p,g=w.shift(),p=w.shift(),k="A",H=this.convertEndpointToCenterParameterization(we,Ae,g,p,pe,ue,J,W,X);break;case"a":J=w.shift(),W=w.shift(),X=w.shift(),pe=w.shift(),ue=w.shift(),we=g,Ae=p,g+=w.shift(),p+=w.shift(),k="A",H=this.convertEndpointToCenterParameterization(we,Ae,g,p,pe,ue,J,W,X);break}h.push({command:k||O,points:H,start:{x:q,y:re},pathLength:this.calcLength(q,re,k||O,H)})}(O==="z"||O==="Z")&&h.push({command:"z",points:[],start:void 0,pathLength:0})}return h}static calcLength(e,r,s,u){var f,h,y,g,p=Jt;switch(s){case"L":return p.getLineLength(e,r,u[0],u[1]);case"C":for(f=0,h=p.getPointOnCubicBezier(0,e,r,u[0],u[1],u[2],u[3],u[4],u[5]),g=.01;g<=1;g+=.01)y=p.getPointOnCubicBezier(g,e,r,u[0],u[1],u[2],u[3],u[4],u[5]),f+=p.getLineLength(h.x,h.y,y.x,y.y),h=y;return f;case"Q":for(f=0,h=p.getPointOnQuadraticBezier(0,e,r,u[0],u[1],u[2],u[3]),g=.01;g<=1;g+=.01)y=p.getPointOnQuadraticBezier(g,e,r,u[0],u[1],u[2],u[3]),f+=p.getLineLength(h.x,h.y,y.x,y.y),h=y;return f;case"A":f=0;var x=u[4],R=u[5],T=u[4]+R,O=Math.PI/180;if(Math.abs(x-T)T;g-=O)y=p.getPointOnEllipticalArc(u[0],u[1],u[2],u[3],g,0),f+=p.getLineLength(h.x,h.y,y.x,y.y),h=y;else for(g=x+O;g1&&(y*=Math.sqrt(O),g*=Math.sqrt(O));var w=Math.sqrt((y*y*(g*g)-y*y*(T*T)-g*g*(R*R))/(y*y*(T*T)+g*g*(R*R)));f===h&&(w*=-1),isNaN(w)&&(w=0);var A=w*y*T/g,M=w*-g*R/y,B=(e+s)/2+Math.cos(x)*A-Math.sin(x)*M,k=(r+u)/2+Math.sin(x)*A+Math.cos(x)*M,H=function(W){return Math.sqrt(W[0]*W[0]+W[1]*W[1])},q=function(W,X){return(W[0]*X[0]+W[1]*X[1])/(H(W)*H(X))},re=function(W,X){return(W[0]*X[1]=1&&(J=0),h===0&&J>0&&(J=J-2*Math.PI),h===1&&J<0&&(J=J+2*Math.PI),[B,k,y,g,j,J,x,h]}}Jt.prototype.className="Path",Jt.prototype._attrsAffectingSize=["data"],vn(Jt),P.addGetterSetter(Jt,"data");class Zo extends ms{_sceneFunc(e){super._sceneFunc(e);var r=Math.PI*2,s=this.points(),u=s,f=this.tension()!==0&&s.length>4;f&&(u=this.getTensionPoints());var h=this.pointerLength(),y=s.length,g,p;if(f){const T=[u[u.length-4],u[u.length-3],u[u.length-2],u[u.length-1],s[y-2],s[y-1]],O=Jt.calcLength(u[u.length-4],u[u.length-3],"C",T),w=Jt.getPointOnQuadraticBezier(Math.min(1,1-h/O),T[0],T[1],T[2],T[3],T[4],T[5]);g=s[y-2]-w.x,p=s[y-1]-w.y}else g=s[y-2]-s[y-4],p=s[y-1]-s[y-3];var x=(Math.atan2(p,g)+r)%r,R=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(s[y-2],s[y-1]),e.rotate(x),e.moveTo(0,0),e.lineTo(-h,R/2),e.lineTo(-h,-R/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(s[0],s[1]),f?(g=(u[0]+u[2])/2-s[0],p=(u[1]+u[3])/2-s[1]):(g=s[2]-s[0],p=s[3]-s[1]),e.rotate((Math.atan2(-p,-g)+r)%r),e.moveTo(0,0),e.lineTo(-h,R/2),e.lineTo(-h,-R/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){var r=this.dashEnabled();r&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),r&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),r=this.pointerWidth()/2;return{x:e.x-r,y:e.y-r,width:e.width+r*2,height:e.height+r*2}}}Zo.prototype.className="Arrow",vn(Zo),P.addGetterSetter(Zo,"pointerLength",10,_e()),P.addGetterSetter(Zo,"pointerWidth",10,_e()),P.addGetterSetter(Zo,"pointerAtBeginning",!1),P.addGetterSetter(Zo,"pointerAtEnding",!0);class $l extends ge{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}$l.prototype._centroid=!0,$l.prototype.className="Circle",$l.prototype._attrsAffectingSize=["radius"],vn($l),P.addGetterSetter($l,"radius",0,_e());class eo extends ge{_sceneFunc(e){var r=this.radiusX(),s=this.radiusY();e.beginPath(),e.save(),r!==s&&e.scale(1,s/r),e.arc(0,0,r,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}}eo.prototype.className="Ellipse",eo.prototype._centroid=!0,eo.prototype._attrsAffectingSize=["radiusX","radiusY"],vn(eo),P.addComponentsGetterSetter(eo,"radius",["x","y"]),P.addGetterSetter(eo,"radiusX",0,_e()),P.addGetterSetter(eo,"radiusY",0,_e());class ua extends ge{constructor(e){super(e),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(e){const r=this.getWidth(),s=this.getHeight(),u=this.attrs.image;let f;if(u){const h=this.attrs.cropWidth,y=this.attrs.cropHeight;h&&y?f=[u,this.cropX(),this.cropY(),h,y,0,0,r,s]:f=[u,0,0,r,s]}(this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)),u&&e.drawImage.apply(e,f)}_hitFunc(e){var r=this.width(),s=this.height();e.beginPath(),e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,r;return(e=this.attrs.width)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.width}getHeight(){var e,r;return(e=this.attrs.height)!==null&&e!==void 0?e:(r=this.image())===null||r===void 0?void 0:r.height}static fromURL(e,r,s=null){var u=Y.createImageElement();u.onload=function(){var f=new ua({image:u});r(f)},u.onerror=s,u.crossOrigin="Anonymous",u.src=e}}ua.prototype.className="Image",vn(ua),P.addGetterSetter(ua,"image"),P.addComponentsGetterSetter(ua,"crop",["x","y","width","height"]),P.addGetterSetter(ua,"cropX",0,_e()),P.addGetterSetter(ua,"cropY",0,_e()),P.addGetterSetter(ua,"cropWidth",0,_e()),P.addGetterSetter(ua,"cropHeight",0,_e());var n0=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],nC="Change.konva",rC="none",Up="up",kp="right",Hp="down",Fp="left",iC=n0.length;class Gp extends Zl{constructor(e){super(e),this.on("add.konva",function(r){this._addListeners(r.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){var r=this,s,u=function(){r._sync()};for(s=0;s{r=Math.min(r,h.x),s=Math.max(s,h.x),u=Math.min(u,h.y),f=Math.max(f,h.y)}),{x:r,y:u,width:s-r,height:f-u}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}el.prototype.className="RegularPolygon",el.prototype._centroid=!0,el.prototype._attrsAffectingSize=["radius"],vn(el),P.addGetterSetter(el,"radius",0,_e()),P.addGetterSetter(el,"sides",0,_e());var r0=Math.PI*2;class tl extends ge{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,r0,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),r0,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}tl.prototype.className="Ring",tl.prototype._centroid=!0,tl.prototype._attrsAffectingSize=["innerRadius","outerRadius"],vn(tl),P.addGetterSetter(tl,"innerRadius",0,_e()),P.addGetterSetter(tl,"outerRadius",0,_e());class Ha extends ge{constructor(e){super(e),this._updated=!0,this.anim=new Vi(()=>{var r=this._updated;return this._updated=!1,r}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){!this.anim.isRunning()||(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){var r=this.animation(),s=this.frameIndex(),u=s*4,f=this.animations()[r],h=this.frameOffsets(),y=f[u+0],g=f[u+1],p=f[u+2],x=f[u+3],R=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,p,x),e.closePath(),e.fillStrokeShape(this)),R)if(h){var T=h[r],O=s*2;e.drawImage(R,y,g,p,x,T[O+0],T[O+1],p,x)}else e.drawImage(R,y,g,p,x,0,0,p,x)}_hitFunc(e){var r=this.animation(),s=this.frameIndex(),u=s*4,f=this.animations()[r],h=this.frameOffsets(),y=f[u+2],g=f[u+3];if(e.beginPath(),h){var p=h[r],x=s*2;e.rect(p[x+0],p[x+1],y,g)}else e.rect(0,0,y,g);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var e=this.frameIndex(),r=this.animation(),s=this.animations(),u=s[r],f=u.length/4;e{e=e.trim();const r=e.indexOf(" ")>=0,s=e.indexOf('"')>=0||e.indexOf("'")>=0;return r&&!s&&(e=`"${e}"`),e}).join(", ")}var $d;function jp(){return $d||($d=Y.createCanvasElement().getContext(oC),$d)}function yC(o){o.fillText(this._partialText,this._partialTextX,this._partialTextY)}function SC(o){o.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function _C(o){return o=o||{},!o.fillLinearGradientColorStops&&!o.fillRadialGradientColorStops&&!o.fillPatternImage&&(o.fill=o.fill||"black"),o}class pn extends ge{constructor(e){super(_C(e)),this._partialTextX=0,this._partialTextY=0;for(var r=0;r1&&(B+=h)}}}_hitFunc(e){var r=this.getWidth(),s=this.getHeight();e.beginPath(),e.rect(0,0,r,s),e.closePath(),e.fillStrokeShape(this)}setText(e){var r=Y._isString(e)?e:e==null?"":e+"";return this._setAttr(lC,r),this}getWidth(){var e=this.attrs.width===eu||this.attrs.width===void 0;return e?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var e=this.attrs.height===eu||this.attrs.height===void 0;return e?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Y.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var r=jp(),s=this.fontSize(),u;return r.save(),r.font=this._getContextFont(),u=r.measureText(e),r.restore(),{width:u.width,height:s}}_getContextFont(){return this.fontStyle()+Zd+this.fontVariant()+Zd+(this.fontSize()+dC)+gC(this.fontFamily())}_addTextLine(e){this.align()===kc&&(e=e.trim());var r=this._getTextWidth(e);return this.textArr.push({text:e,width:r,lastInParagraph:!1})}_getTextWidth(e){var r=this.letterSpacing(),s=e.length;return jp().measureText(e).width+(s?r*(s-1):0)}_setTextData(){var e=this.text().split(` `),r=+this.fontSize(),s=0,u=this.lineHeight()*r,f=this.attrs.width,h=this.attrs.height,y=f!==eu&&f!==void 0,g=h!==eu&&h!==void 0,p=this.padding(),x=f-p*2,R=h-p*2,T=0,O=this.wrap(),w=O!==u0,A=O!==pC&&w,M=this.ellipsis();this.textArr=[],jp().font=this._getContextFont();for(var B=M?this._getTextWidth(Bp):0,k=0,H=e.length;kx)for(;q.length>0;){for(var j=0,I=q.length,ne="",J=0;j>>1,X=q.slice(0,W+1),pe=this._getTextWidth(X)+B;pe<=x?(j=W+1,ne=X,J=pe):I=W}if(ne){if(A){var ue,we=q[ne.length],Ae=we===Zd||we===a0;Ae&&J<=x?ue=ne.length:ue=Math.max(ne.lastIndexOf(Zd),ne.lastIndexOf(a0))+1,ue>0&&(j=ue,ne=ne.slice(0,j),J=this._getTextWidth(ne))}ne=ne.trimRight(),this._addTextLine(ne),s=Math.max(s,J),T+=u;var De=this._shouldHandleEllipsis(T);if(De){this._tryToAddEllipsisToLastLine();break}if(q=q.slice(j),q=q.trimLeft(),q.length>0&&(re=this._getTextWidth(q),re<=x)){this._addTextLine(q),T+=u,s=Math.max(s,re);break}}else break}else this._addTextLine(q),T+=u,s=Math.max(s,re),this._shouldHandleEllipsis(T)&&kR)break;this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0)}this.textHeight=r,this.textWidth=s}_shouldHandleEllipsis(e){var r=+this.fontSize(),s=this.lineHeight()*r,u=this.attrs.height,f=u!==eu&&u!==void 0,h=this.padding(),y=u-h*2,g=this.wrap(),p=g!==u0;return!p||f&&e+s>y}_tryToAddEllipsisToLastLine(){var e=this.attrs.width,r=e!==eu&&e!==void 0,s=this.padding(),u=e-s*2,f=this.ellipsis(),h=this.textArr[this.textArr.length-1];if(!(!h||!f)){if(r){var y=this._getTextWidth(h.text+Bp)=1){var s=r[0].p0;e.moveTo(s.x,s.y)}for(var u=0;u0&&(y+=e.dataArray[g].pathLength);var p=0;u==="center"&&(p=Math.max(0,y/2-h/2)),u==="right"&&(p=Math.max(0,y-h));for(var x=i0(this.text()),R=this.text().split(" ").length-1,T,O,w,A=-1,M=0,B=function(){M=0;for(var pe=e.dataArray,ue=A+1;ue0)return A=ue,pe[ue];pe[ue].command==="M"&&(T={x:pe[ue].points[0],y:pe[ue].points[1]})}return{}},k=function(pe){var ue=e._getTextSize(pe).width+s;pe===" "&&u==="justify"&&(ue+=(y-h)/R);var we=0,Ae=0;for(O=void 0;Math.abs(ue-we)/ue>.01&&Ae<20;){Ae++;for(var De=we;w===void 0;)w=B(),w&&De+w.pathLengthue?O=Jt.getPointOnLine(ue,T.x,T.y,w.points[0],w.points[1],T.x,T.y):w=void 0;break;case"A":var oe=w.points[4],de=w.points[5],he=w.points[4]+de;M===0?M=oe+1e-8:ue>we?M+=Math.PI/180*de/Math.abs(de):M-=Math.PI/360*de/Math.abs(de),(de<0&&M=0&&M>he)&&(M=he,Ce=!0),O=Jt.getPointOnEllipticalArc(w.points[0],w.points[1],w.points[2],w.points[3],M,w.points[6]);break;case"C":M===0?ue>w.pathLength?M=1e-8:M=ue/w.pathLength:ue>we?M+=(ue-we)/w.pathLength/2:M=Math.max(M-(we-ue)/w.pathLength/2,0),M>1&&(M=1,Ce=!0),O=Jt.getPointOnCubicBezier(M,w.start.x,w.start.y,w.points[0],w.points[1],w.points[2],w.points[3],w.points[4],w.points[5]);break;case"Q":M===0?M=ue/w.pathLength:ue>we?M+=(ue-we)/w.pathLength:M-=(we-ue)/w.pathLength,M>1&&(M=1,Ce=!0),O=Jt.getPointOnQuadraticBezier(M,w.start.x,w.start.y,w.points[0],w.points[1],w.points[2],w.points[3]);break}O!==void 0&&(we=Jt.getLineLength(T.x,T.y,O.x,O.y)),Ce&&(Ce=!1,w=void 0)}},H="C",q=e._getTextSize(H).width+s,re=p/q-1,j=0;jo+`.${v0}`).join(" "),p0="nodesRect",CC=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],TC={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const RC="ontouchstart"in Fe._global;function bC(o,e){if(o==="rotater")return"crosshair";e+=Y.degToRad(TC[o]||0);var r=(Y.radToDeg(e)%360+360)%360;return Y._inRange(r,315+22.5,360)||Y._inRange(r,0,22.5)?"ns-resize":Y._inRange(r,45-22.5,45+22.5)?"nesw-resize":Y._inRange(r,90-22.5,90+22.5)?"ew-resize":Y._inRange(r,135-22.5,135+22.5)?"nwse-resize":Y._inRange(r,180-22.5,180+22.5)?"ns-resize":Y._inRange(r,225-22.5,225+22.5)?"nesw-resize":Y._inRange(r,270-22.5,270+22.5)?"ew-resize":Y._inRange(r,315-22.5,315+22.5)?"nwse-resize":(Y.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var eh=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],m0=1e8;function wC(o){return{x:o.x+o.width/2*Math.cos(o.rotation)+o.height/2*Math.sin(-o.rotation),y:o.y+o.height/2*Math.cos(o.rotation)+o.width/2*Math.sin(o.rotation)}}function g0(o,e,r){const s=r.x+(o.x-r.x)*Math.cos(e)-(o.y-r.y)*Math.sin(e),u=r.y+(o.x-r.x)*Math.sin(e)+(o.y-r.y)*Math.cos(e);return Object.assign(Object.assign({},o),{rotation:o.rotation+e,x:s,y:u})}function DC(o,e){const r=wC(o);return g0(o,e,r)}function OC(o,e,r){let s=e;for(let u=0;u{const u=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},f=s._attrsAffectingSize.map(h=>h+"Change."+this._getEventNamespace()).join(" ");s.on(f,u),s.on(CC.map(h=>h+`.${this._getEventNamespace()}`).join(" "),u),s.on(`absoluteTransformChange.${this._getEventNamespace()}`,u),this._proxyDrag(s)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(e){let r;e.on(`dragstart.${this._getEventNamespace()}`,s=>{r=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(s,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,s=>{if(!r)return;const u=e.getAbsolutePosition(),f=u.x-r.x,h=u.y-r.y;this.nodes().forEach(y=>{if(y===e||y.isDragging())return;const g=y.getAbsolutePosition();y.setAbsolutePosition({x:g.x+f,y:g.y+h}),y.startDrag(s)}),r=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(p0),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(p0,this.__getNodeRect)}__getNodeShape(e,r=this.rotation(),s){var u=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),f=e.getAbsoluteScale(s),h=e.getAbsolutePosition(s),y=u.x*f.x-e.offsetX()*f.x,g=u.y*f.y-e.offsetY()*f.y;const p=(Fe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),x={x:h.x+y*Math.cos(p)+g*Math.sin(-p),y:h.y+g*Math.cos(p)+y*Math.sin(p),width:u.width*f.x,height:u.height*f.y,rotation:p};return g0(x,-Fe.getAngle(r),{x:0,y:0})}__getNodeRect(){var e=this.getNode();if(!e)return{x:-m0,y:-m0,width:0,height:0,rotation:0};const r=[];this.nodes().map(p=>{const x=p.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var R=[{x:x.x,y:x.y},{x:x.x+x.width,y:x.y},{x:x.x+x.width,y:x.y+x.height},{x:x.x,y:x.y+x.height}],T=p.getAbsoluteTransform();R.forEach(function(O){var w=T.point(O);r.push(w)})});const s=new Ci;s.rotate(-Fe.getAngle(this.rotation()));var u,f,h,y;r.forEach(function(p){var x=s.point(p);u===void 0&&(u=h=x.x,f=y=x.y),u=Math.min(u,x.x),f=Math.min(f,x.y),h=Math.max(h,x.x),y=Math.max(y,x.y)}),s.invert();const g=s.point({x:u,y:f});return{x:g.x,y:g.y,width:h-u,height:y-f,rotation:Fe.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),eh.forEach(function(e){this._createAnchor(e)}.bind(this)),this._createAnchor("rotater")}_createAnchor(e){var r=new Uc({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:RC?10:"auto"}),s=this;r.on("mousedown touchstart",function(u){s._handleMouseDown(u)}),r.on("dragstart",u=>{r.stopDrag(),u.cancelBubble=!0}),r.on("dragend",u=>{u.cancelBubble=!0}),r.on("mouseenter",()=>{var u=Fe.getAngle(this.rotation()),f=bC(e,u);r.getStage().content&&(r.getStage().content.style.cursor=f),this._cursorChange=!0}),r.on("mouseout",()=>{r.getStage().content&&(r.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(r)}_createBack(){var e=new ge({name:"back",width:0,height:0,draggable:!0,sceneFunc(r){var s=this.getParent(),u=s.padding();r.beginPath(),r.rect(-u,-u,this.width()+u*2,this.height()+u*2),r.moveTo(this.width()/2,-u),s.rotateEnabled()&&r.lineTo(this.width()/2,-s.rotateAnchorOffset()*Y._sign(this.height())-u),r.fillStrokeShape(this)},hitFunc:(r,s)=>{if(!!this.shouldOverdrawWholeArea()){var u=this.padding();r.beginPath(),r.rect(-u,-u,s.width()+u*2,s.height()+u*2),r.fillStrokeShape(s)}}});this.add(e),this._proxyDrag(e),e.on("dragstart",r=>{r.cancelBubble=!0}),e.on("dragmove",r=>{r.cancelBubble=!0}),e.on("dragend",r=>{r.cancelBubble=!0}),this.on("dragmove",r=>{this.update()})}_handleMouseDown(e){this._movingAnchorName=e.target.name().split(" ")[0];var r=this._getNodeRect(),s=r.width,u=r.height,f=Math.sqrt(Math.pow(s,2)+Math.pow(u,2));this.sin=Math.abs(u/f),this.cos=Math.abs(s/f),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var h=e.target.getAbsolutePosition(),y=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:y.x-h.x,y:y.y-h.y},this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(g=>{g._fire("transformstart",{evt:e.evt,target:g})})}_handleMouseMove(e){var r,s,u,f=this.findOne("."+this._movingAnchorName),h=f.getStage();h.setPointersPositions(e);const y=h.getPointerPosition();let g={x:y.x-this._anchorDragOffset.x,y:y.y-this._anchorDragOffset.y};const p=f.getAbsolutePosition();this.anchorDragBoundFunc()&&(g=this.anchorDragBoundFunc()(p,g,e)),f.setAbsolutePosition(g);const x=f.getAbsolutePosition();if(!(p.x===x.x&&p.y===x.y)){if(this._movingAnchorName==="rotater"){var R=this._getNodeRect();r=f.x()-R.width/2,s=-f.y()+R.height/2;let pe=Math.atan2(-s,r)+Math.PI/2;R.height<0&&(pe-=Math.PI);var T=Fe.getAngle(this.rotation());const ue=T+pe,we=Fe.getAngle(this.rotationSnapTolerance()),De=OC(this.rotationSnaps(),ue,we)-R.rotation,Ce=DC(R,De);this._fitNodesInto(Ce,e);return}var O=this.keepRatio()||e.shiftKey,k=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(O){var w=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};u=Math.sqrt(Math.pow(w.x-f.x(),2)+Math.pow(w.y-f.y(),2));var A=this.findOne(".top-left").x()>w.x?-1:1,M=this.findOne(".top-left").y()>w.y?-1:1;r=u*this.cos*A,s=u*this.sin*M,this.findOne(".top-left").x(w.x-r),this.findOne(".top-left").y(w.y-s)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(f.y());else if(this._movingAnchorName==="top-right"){if(O){var w=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};u=Math.sqrt(Math.pow(f.x()-w.x,2)+Math.pow(w.y-f.y(),2));var A=this.findOne(".top-right").x()w.y?-1:1;r=u*this.cos*A,s=u*this.sin*M,this.findOne(".top-right").x(w.x+r),this.findOne(".top-right").y(w.y-s)}var B=f.position();this.findOne(".top-left").y(B.y),this.findOne(".bottom-right").x(B.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(f.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(f.x());else if(this._movingAnchorName==="bottom-left"){if(O){var w=k?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};u=Math.sqrt(Math.pow(w.x-f.x(),2)+Math.pow(f.y()-w.y,2));var A=w.x{s._fire("transformend",{evt:e,target:s})}),this._movingAnchorName=null}}_fitNodesInto(e,r){var s=this._getNodeRect();const u=1;if(Y._inRange(e.width,-this.padding()*2-u,u)){this.update();return}if(Y._inRange(e.height,-this.padding()*2-u,u)){this.update();return}const f=this.flipEnabled();var h=new Ci;if(h.rotate(Fe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const R=h.point({x:-this.padding()*2,y:0});if(e.x+=R.x,e.y+=R.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=R.x,this._anchorDragOffset.y-=R.y,!f){this.update();return}}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const R=h.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=R.x,this._anchorDragOffset.y-=R.y,e.width+=this.padding()*2,!f){this.update();return}}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const R=h.point({x:0,y:-this.padding()*2});if(e.x+=R.x,e.y+=R.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=R.x,this._anchorDragOffset.y-=R.y,e.height+=this.padding()*2,!f){this.update();return}}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const R=h.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=R.x,this._anchorDragOffset.y-=R.y,e.height+=this.padding()*2,!f){this.update();return}}if(this.boundBoxFunc()){const R=this.boundBoxFunc()(s,e);R?e=R:Y.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const y=1e7,g=new Ci;g.translate(s.x,s.y),g.rotate(s.rotation),g.scale(s.width/y,s.height/y);const p=new Ci;p.translate(e.x,e.y),p.rotate(e.rotation),p.scale(e.width/y,e.height/y);const x=p.multiply(g.invert());this._nodes.forEach(R=>{var T;const O=R.getParent().getAbsoluteTransform(),w=R.getTransform().copy();w.translate(R.offsetX(),R.offsetY());const A=new Ci;A.multiply(O.copy().invert()).multiply(x).multiply(O).multiply(w);const M=A.decompose();R.setAttrs(M),this._fire("transform",{evt:r,target:R}),R._fire("transform",{evt:r,target:R}),(T=R.getLayer())===null||T===void 0||T.batchDraw()}),this.rotation(Y._getRotation(e.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,r){this.findOne(e).setAttrs(r)}update(){var e,r=this._getNodeRect();this.rotation(Y._getRotation(r.rotation));var s=r.width,u=r.height,f=this.enabledAnchors(),h=this.resizeEnabled(),y=this.padding(),g=this.anchorSize();this.find("._anchor").forEach(p=>{p.setAttrs({width:g,height:g,offsetX:g/2,offsetY:g/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:g/2+y,offsetY:g/2+y,visible:h&&f.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:s/2,y:0,offsetY:g/2+y,visible:h&&f.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:s,y:0,offsetX:g/2-y,offsetY:g/2+y,visible:h&&f.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:u/2,offsetX:g/2+y,visible:h&&f.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:s,y:u/2,offsetX:g/2-y,visible:h&&f.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:u,offsetX:g/2+y,offsetY:g/2-y,visible:h&&f.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:s/2,y:u,offsetY:g/2-y,visible:h&&f.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:s,y:u,offsetX:g/2-y,offsetY:g/2-y,visible:h&&f.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:s/2,y:-this.rotateAnchorOffset()*Y._sign(u)-y,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:s,height:u,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Zl.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Ee.prototype.toObject.call(this)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}function NC(o){return o instanceof Array||Y.warn("enabledAnchors value should be an array"),o instanceof Array&&o.forEach(function(e){eh.indexOf(e)===-1&&Y.warn("Unknown anchor name: "+e+". Available names are: "+eh.join(", "))}),o||[]}Ft.prototype.className="Transformer",vn(Ft),P.addGetterSetter(Ft,"enabledAnchors",eh,NC),P.addGetterSetter(Ft,"flipEnabled",!0,la()),P.addGetterSetter(Ft,"resizeEnabled",!0),P.addGetterSetter(Ft,"anchorSize",10,_e()),P.addGetterSetter(Ft,"rotateEnabled",!0),P.addGetterSetter(Ft,"rotationSnaps",[]),P.addGetterSetter(Ft,"rotateAnchorOffset",50,_e()),P.addGetterSetter(Ft,"rotationSnapTolerance",5,_e()),P.addGetterSetter(Ft,"borderEnabled",!0),P.addGetterSetter(Ft,"anchorStroke","rgb(0, 161, 255)"),P.addGetterSetter(Ft,"anchorStrokeWidth",1,_e()),P.addGetterSetter(Ft,"anchorFill","white"),P.addGetterSetter(Ft,"anchorCornerRadius",0,_e()),P.addGetterSetter(Ft,"borderStroke","rgb(0, 161, 255)"),P.addGetterSetter(Ft,"borderStrokeWidth",1,_e()),P.addGetterSetter(Ft,"borderDash"),P.addGetterSetter(Ft,"keepRatio",!0),P.addGetterSetter(Ft,"centeredScaling",!1),P.addGetterSetter(Ft,"ignoreStroke",!1),P.addGetterSetter(Ft,"padding",0,_e()),P.addGetterSetter(Ft,"node"),P.addGetterSetter(Ft,"nodes"),P.addGetterSetter(Ft,"boundBoxFunc"),P.addGetterSetter(Ft,"anchorDragBoundFunc"),P.addGetterSetter(Ft,"shouldOverdrawWholeArea",!1),P.addGetterSetter(Ft,"useSingleNodeRotation",!0),P.backCompat(Ft,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class gs extends ge{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Fe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}gs.prototype.className="Wedge",gs.prototype._centroid=!0,gs.prototype._attrsAffectingSize=["radius"],vn(gs),P.addGetterSetter(gs,"radius",0,_e()),P.addGetterSetter(gs,"angle",0,_e()),P.addGetterSetter(gs,"clockwise",!1),P.backCompat(gs,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function y0(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var AC=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],MC=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function LC(o,e){var r=o.data,s=o.width,u=o.height,f,h,y,g,p,x,R,T,O,w,A,M,B,k,H,q,re,j,I,ne,J,W,X,pe,ue=e+e+1,we=s-1,Ae=u-1,De=e+1,Ce=De*(De+1)/2,oe=new y0,de=null,he=oe,me=null,Ve=null,Et=AC[e],it=MC[e];for(y=1;y>it,X!==0?(X=255/X,r[x]=(T*Et>>it)*X,r[x+1]=(O*Et>>it)*X,r[x+2]=(w*Et>>it)*X):r[x]=r[x+1]=r[x+2]=0,T-=M,O-=B,w-=k,A-=H,M-=me.r,B-=me.g,k-=me.b,H-=me.a,g=R+((g=f+e+1)>it,X>0?(X=255/X,r[g]=(T*Et>>it)*X,r[g+1]=(O*Et>>it)*X,r[g+2]=(w*Et>>it)*X):r[g]=r[g+1]=r[g+2]=0,T-=M,O-=B,w-=k,A-=H,M-=me.r,B-=me.g,k-=me.b,H-=me.a,g=f+((g=h+De)0&&LC(e,r)};P.addGetterSetter(Ee,"blurRadius",0,_e(),P.afterSetFilter);const zC=function(o){var e=this.brightness()*255,r=o.data,s=r.length,u;for(u=0;u255?255:u,f=f<0?0:f>255?255:f,h=h<0?0:h>255?255:h,r[y]=u,r[y+1]=f,r[y+2]=h};P.addGetterSetter(Ee,"contrast",0,_e(),P.afterSetFilter);const kC=function(o){var e=this.embossStrength()*10,r=this.embossWhiteLevel()*255,s=this.embossDirection(),u=this.embossBlend(),f=0,h=0,y=o.data,g=o.width,p=o.height,x=g*4,R=p;switch(s){case"top-left":f=-1,h=-1;break;case"top":f=-1,h=0;break;case"top-right":f=-1,h=1;break;case"right":f=0,h=1;break;case"bottom-right":f=1,h=1;break;case"bottom":f=1,h=0;break;case"bottom-left":f=1,h=-1;break;case"left":f=0,h=-1;break;default:Y.error("Unknown emboss direction: "+s)}do{var T=(R-1)*x,O=f;R+O<1&&(O=0),R+O>p&&(O=0);var w=(R-1+O)*g*4,A=g;do{var M=T+(A-1)*4,B=h;A+B<1&&(B=0),A+B>g&&(B=0);var k=w+(A-1+B)*4,H=y[M]-y[k],q=y[M+1]-y[k+1],re=y[M+2]-y[k+2],j=H,I=j>0?j:-j,ne=q>0?q:-q,J=re>0?re:-re;if(ne>I&&(j=q),J>I&&(j=re),j*=e,u){var W=y[M]+j,X=y[M+1]+j,pe=y[M+2]+j;y[M]=W>255?255:W<0?0:W,y[M+1]=X>255?255:X<0?0:X,y[M+2]=pe>255?255:pe<0?0:pe}else{var ue=r-j;ue<0?ue=0:ue>255&&(ue=255),y[M]=y[M+1]=y[M+2]=ue}}while(--A)}while(--R)};P.addGetterSetter(Ee,"embossStrength",.5,_e(),P.afterSetFilter),P.addGetterSetter(Ee,"embossWhiteLevel",.5,_e(),P.afterSetFilter),P.addGetterSetter(Ee,"embossDirection","top-left",null,P.afterSetFilter),P.addGetterSetter(Ee,"embossBlend",!1,null,P.afterSetFilter);function Ip(o,e,r,s,u){var f=r-e,h=u-s,y;return f===0?s+h/2:h===0?s:(y=(o-e)/f,y=h*y+s,y)}const HC=function(o){var e=o.data,r=e.length,s=e[0],u=s,f,h=e[1],y=h,g,p=e[2],x=p,R,T,O=this.enhance();if(O!==0){for(T=0;Tu&&(u=f),g=e[T+1],gy&&(y=g),R=e[T+2],Rx&&(x=R);u===s&&(u=255,s=0),y===h&&(y=255,h=0),x===p&&(x=255,p=0);var w,A,M,B,k,H,q,re,j;for(O>0?(A=u+O*(255-u),M=s-O*(s-0),k=y+O*(255-y),H=h-O*(h-0),re=x+O*(255-x),j=p-O*(p-0)):(w=(u+s)*.5,A=u+O*(u-w),M=s+O*(s-w),B=(y+h)*.5,k=y+O*(y-B),H=h+O*(h-B),q=(x+p)*.5,re=x+O*(x-q),j=p+O*(p-q)),T=0;TB?M:B;var k=h,H=f,q,re,j=360/H*Math.PI/180,I,ne;for(re=0;reH?k:H;var q=h,re=f,j,I,ne=r.polarRotation||0,J,W;for(x=0;xe&&(q=H,re=0,j=-1),u=0;u=0&&O=0&&w=0&&O=0&&w=255*4?255:0}return h}function JC(o,e,r){for(var s=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],u=Math.round(Math.sqrt(s.length)),f=Math.floor(u/2),h=[],y=0;y=0&&O=0&&w=r))for(f=A;f=s||(h=(r*f+u)*4,y+=q[h+0],g+=q[h+1],p+=q[h+2],x+=q[h+3],H+=1);for(y=y/H,g=g/H,p=p/H,x=x/H,u=O;u=r))for(f=A;f=s||(h=(r*f+u)*4,q[h+0]=y,q[h+1]=g,q[h+2]=p,q[h+3]=x)}};P.addGetterSetter(Ee,"pixelSize",8,_e(),P.afterSetFilter);const tT=function(o){var e=Math.round(this.levels()*254)+1,r=o.data,s=r.length,u=255/e,f;for(f=0;f255?255:o<0?0:Math.round(o)}),P.addGetterSetter(Ee,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)}),P.addGetterSetter(Ee,"blue",0,_S,P.afterSetFilter);const rT=function(o){var e=o.data,r=e.length,s=this.red(),u=this.green(),f=this.blue(),h=this.alpha(),y,g;for(y=0;y255?255:o<0?0:Math.round(o)}),P.addGetterSetter(Ee,"green",0,function(o){return this._filterUpToDate=!1,o>255?255:o<0?0:Math.round(o)}),P.addGetterSetter(Ee,"blue",0,_S,P.afterSetFilter),P.addGetterSetter(Ee,"alpha",1,function(o){return this._filterUpToDate=!1,o>1?1:o<0?0:o});const iT=function(o){var e=o.data,r=e.length,s,u,f,h;for(s=0;s127&&(p=255-p),x>127&&(x=255-x),R>127&&(R=255-R),e[g]=p,e[g+1]=x,e[g+2]=R}while(--y)}while(--f)},sT=function(o){var e=this.threshold()*255,r=o.data,s=r.length,u;for(u=0;u>>1,Ve=oe[me];if(0>>1;meu(Dt,he))onu(Mt,Dt)?(oe[me]=Mt,oe[on]=he,me=on):(oe[me]=Dt,oe[it]=he,me=it);else if(onu(Mt,he))oe[me]=Mt,oe[on]=he,me=on;else break e}}return de}function u(oe,de){var he=oe.sortIndex-de.sortIndex;return he!==0?he:oe.id-de.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;o.unstable_now=function(){return f.now()}}else{var h=Date,y=h.now();o.unstable_now=function(){return h.now()-y}}var g=[],p=[],x=1,R=null,T=3,O=!1,w=!1,A=!1,M=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function H(oe){for(var de=r(p);de!==null;){if(de.callback===null)s(p);else if(de.startTime<=oe)s(p),de.sortIndex=de.expirationTime,e(g,de);else break;de=r(p)}}function q(oe){if(A=!1,H(oe),!w)if(r(g)!==null)w=!0,De(re);else{var de=r(p);de!==null&&Ce(q,de.startTime-oe)}}function re(oe,de){w=!1,A&&(A=!1,B(ne),ne=-1),O=!0;var he=T;try{for(H(de),R=r(g);R!==null&&(!(R.expirationTime>de)||oe&&!X());){var me=R.callback;if(typeof me=="function"){R.callback=null,T=R.priorityLevel;var Ve=me(R.expirationTime<=de);de=o.unstable_now(),typeof Ve=="function"?R.callback=Ve:R===r(g)&&s(g),H(de)}else s(g);R=r(g)}if(R!==null)var Et=!0;else{var it=r(p);it!==null&&Ce(q,it.startTime-de),Et=!1}return Et}finally{R=null,T=he,O=!1}}var j=!1,I=null,ne=-1,J=5,W=-1;function X(){return!(o.unstable_now()-Woe||125me?(oe.sortIndex=he,e(p,oe),r(g)===null&&oe===r(p)&&(A?(B(ne),ne=-1):A=!0,Ce(q,he-me))):(oe.sortIndex=Ve,e(g,oe),w||O||(w=!0,De(re))),oe},o.unstable_shouldYield=X,o.unstable_wrapCallback=function(oe){var de=T;return function(){var he=T;T=de;try{return oe.apply(this,arguments)}finally{T=he}}}}(Yp)),Yp}var qp={};/** * @license React * scheduler.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var E0;function lT(){return E0||(E0=1,function(o){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=!1,r=!1,s=5;function u(Te,Je){var lt=Te.length;Te.push(Je),y(Te,Je,lt)}function f(Te){return Te.length===0?null:Te[0]}function h(Te){if(Te.length===0)return null;var Je=Te[0],lt=Te.pop();return lt!==Je&&(Te[0]=lt,g(Te,lt,0)),Je}function y(Te,Je,lt){for(var Qe=lt;Qe>0;){var cn=Qe-1>>>1,fr=Te[cn];if(p(fr,Je)>0)Te[cn]=Je,Te[Qe]=fr,Qe=cn;else return}}function g(Te,Je,lt){for(var Qe=lt,cn=Te.length,fr=cn>>>1;Qelt&&(!Te||li()));){var Qe=ue.callback;if(typeof Qe=="function"){ue.callback=null,we=ue.priorityLevel;var cn=ue.expirationTime<=lt,fr=Qe(cn);lt=o.unstable_now(),typeof fr=="function"?ue.callback=fr:ue===f(W)&&h(W),me(lt)}else h(W);ue=f(W)}if(ue!==null)return!0;var Be=f(X);return Be!==null&&Ri(Ve,Be.startTime-lt),!1}function Dt(Te,Je){switch(Te){case x:case R:case T:case O:case w:break;default:Te=T}var lt=we;we=Te;try{return Je()}finally{we=lt}}function on(Te){var Je;switch(we){case x:case R:case T:Je=T;break;default:Je=we;break}var lt=we;we=Je;try{return Te()}finally{we=lt}}function Mt(Te){var Je=we;return function(){var lt=we;we=Je;try{return Te.apply(this,arguments)}finally{we=lt}}}function cr(Te,Je,lt){var Qe=o.unstable_now(),cn;if(typeof lt=="object"&<!==null){var fr=lt.delay;typeof fr=="number"&&fr>0?cn=Qe+fr:cn=Qe}else cn=Qe;var Be;switch(Te){case x:Be=re;break;case R:Be=j;break;case w:Be=J;break;case O:Be=ne;break;case T:default:Be=I;break}var ke=cn+Be,nn={id:pe++,callback:Je,priorityLevel:Te,startTime:cn,expirationTime:ke,sortIndex:-1};return cn>Qe?(nn.sortIndex=cn,u(X,nn),f(W)===null&&nn===f(X)&&(Ce?ao():Ce=!0,Ri(Ve,cn-Qe))):(nn.sortIndex=ke,u(W,nn),!De&&!Ae&&(De=!0,Fa(Et))),nn}function Mr(){}function Yr(){!De&&!Ae&&(De=!0,Fa(Et))}function mn(){return f(W)}function _r(Te){Te.callback=null}function gn(){return we}var Yi=!1,qr=null,si=-1,qi=s,oi=-1;function li(){var Te=o.unstable_now()-oi;return!(Te125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Te>0?qi=Math.floor(1e3/Te):qi=s}var un=function(){if(qr!==null){var Te=o.unstable_now();oi=Te;var Je=!0,lt=!0;try{lt=qr(Je,Te)}finally{lt?fa():(Yi=!1,qr=null)}}else Yi=!1},fa;if(typeof he=="function")fa=function(){he(un)};else if(typeof MessageChannel<"u"){var Wi=new MessageChannel,ys=Wi.port2;Wi.port1.onmessage=un,fa=function(){ys.postMessage(null)}}else fa=function(){oe(un,0)};function Fa(Te){qr=Te,Yi||(Yi=!0,fa())}function Ri(Te,Je){si=oe(function(){Te(o.unstable_now())},Je)}function ao(){de(si),si=-1}var Ss=ui,so=null;o.unstable_IdlePriority=w,o.unstable_ImmediatePriority=x,o.unstable_LowPriority=O,o.unstable_NormalPriority=T,o.unstable_Profiling=so,o.unstable_UserBlockingPriority=R,o.unstable_cancelCallback=_r,o.unstable_continueExecution=Yr,o.unstable_forceFrameRate=ca,o.unstable_getCurrentPriorityLevel=gn,o.unstable_getFirstCallbackNode=mn,o.unstable_next=on,o.unstable_pauseExecution=Mr,o.unstable_requestPaint=Ss,o.unstable_runWithPriority=Dt,o.unstable_scheduleCallback=cr,o.unstable_shouldYield=li,o.unstable_wrapCallback=Mt,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(qp)),qp}var x0;function Wp(){return x0||(x0=1,function(o){process.env.NODE_ENV==="production"?o.exports=oT():o.exports=lT()}(Vp)),Vp.exports}/** * @license React * react-reconciler.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Qp,C0;function uT(){return C0||(C0=1,Qp=function(e){var r={},s=lr.default,u=Wp(),f=Object.assign;function h(i){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;dF||_[N]!==E[F]){var ee=` `+_[N].replace(" at new "," at ");return i.displayName&&ee.includes("")&&(ee=ee.replace("",i.displayName)),ee}while(1<=N&&0<=F);break}}}finally{nu=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?oo(i):""}var ih=Object.prototype.hasOwnProperty,Yc=[],Ts=-1;function Ba(i){return{current:i}}function vt(i){0>Ts||(i.current=Yc[Ts],Yc[Ts]=null,Ts--)}function Bt(i,a){Ts++,Yc[Ts]=i.current,i.current=a}var ja={},dr=Ba(ja),Lr=Ba(!1),Rs=ja;function lo(i,a){var d=i.type.contextTypes;if(!d)return ja;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===a)return m.__reactInternalMemoizedMaskedChildContext;var _={},E;for(E in d)_[E]=a[E];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=a,i.__reactInternalMemoizedMaskedChildContext=_),_}function hr(i){return i=i.childContextTypes,i!=null}function al(){vt(Lr),vt(dr)}function qc(i,a,d){if(dr.current!==ja)throw Error(h(168));Bt(dr,a),Bt(Lr,d)}function ru(i,a,d){var m=i.stateNode;if(a=a.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var _ in m)if(!(_ in a))throw Error(h(108,ne(i)||"Unknown",_));return f({},d,m)}function sl(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||ja,Rs=dr.current,Bt(dr,i),Bt(Lr,Lr.current),!0}function Wc(i,a,d){var m=i.stateNode;if(!m)throw Error(h(169));d?(i=ru(i,a,Rs),m.__reactInternalMemoizedMergedChildContext=i,vt(Lr),vt(dr),Bt(dr,i)):vt(Lr),Bt(Lr,d)}var Oi=Math.clz32?Math.clz32:rm,Qc=Math.log,iu=Math.LN2;function rm(i){return i>>>=0,i===0?32:31-(Qc(i)/iu|0)|0}var vr=64,bs=4194304;function pr(i){switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function au(i,a){var d=i.pendingLanes;if(d===0)return 0;var m=0,_=i.suspendedLanes,E=i.pingedLanes,N=d&268435455;if(N!==0){var F=N&~_;F!==0?m=pr(F):(E&=N,E!==0&&(m=pr(E)))}else N=d&~_,N!==0?m=pr(N):E!==0&&(m=pr(E));if(m===0)return 0;if(a!==0&&a!==m&&(a&_)===0&&(_=m&-m,E=a&-a,_>=E||_===16&&(E&4194240)!==0))return a;if((m&4)!==0&&(m|=d&16),a=i.entangledLanes,a!==0)for(i=i.entanglements,a&=m;0d;d++)a.push(i);return a}function Qi(i,a,d){i.pendingLanes|=a,a!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,a=31-Oi(a),i[a]=d}function sm(i,a){var d=i.pendingLanes&~a;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=a,i.mutableReadLanes&=a,i.entangledLanes&=a,a=i.entanglements;var m=i.eventTimes;for(i=i.expirationTimes;0>=N,_-=N,pa=1<<32-Oi(a)+_|d<<_|m,Ki=E+i}else pa=1<St?(dn=tt,tt=null):dn=tt.sibling;var _t=Ne(Z,tt,te[St],Me);if(_t===null){tt===null&&(tt=dn);break}i&&tt&&_t.alternate===null&&a(Z,tt),G=E(_t,G,St),st===null?je=_t:st.sibling=_t,st=_t,tt=dn}if(St===te.length)return d(Z,tt),ln&&ma(Z,St),je;if(tt===null){for(;StSt?(dn=tt,tt=null):dn=tt.sibling;var Si=Ne(Z,tt,_t.value,Me);if(Si===null){tt===null&&(tt=dn);break}i&&tt&&Si.alternate===null&&a(Z,tt),G=E(Si,G,St),st===null?je=Si:st.sibling=Si,st=Si,tt=dn}if(_t.done)return d(Z,tt),ln&&ma(Z,St),je;if(tt===null){for(;!_t.done;St++,_t=te.next())_t=Ye(Z,_t.value,Me),_t!==null&&(G=E(_t,G,St),st===null?je=_t:st.sibling=_t,st=_t);return ln&&ma(Z,St),je}for(tt=m(Z,tt);!_t.done;St++,_t=te.next())_t=an(tt,Z,St,_t.value,Me),_t!==null&&(i&&_t.alternate!==null&&tt.delete(_t.key===null?St:_t.key),G=E(_t,G,St),st===null?je=_t:st.sibling=_t,st=_t);return i&&tt.forEach(function(Vs){return a(Z,Vs)}),ln&&ma(Z,St),je}function kt(Z,G,te,Me){if(typeof te=="object"&&te!==null&&te.type===x&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case g:e:{for(var je=te.key,st=G;st!==null;){if(st.key===je){if(je=te.type,je===x){if(st.tag===7){d(Z,st.sibling),G=_(st,te.props.children),G.return=Z,Z=G;break e}}else if(st.elementType===je||typeof je=="object"&&je!==null&&je.$$typeof===H&&vf(je)===st.type){d(Z,st.sibling),G=_(st,te.props),G.ref=Os(Z,st,te),G.return=Z,Z=G;break e}d(Z,st);break}else a(Z,st);st=st.sibling}te.type===x?(G=ts(te.props.children,Z.mode,Me,te.key),G.return=Z,Z=G):(Me=bl(te.type,te.key,te.props,null,Z.mode,Me),Me.ref=Os(Z,G,te),Me.return=Z,Z=Me)}return N(Z);case p:e:{for(st=te.key;G!==null;){if(G.key===st)if(G.tag===4&&G.stateNode.containerInfo===te.containerInfo&&G.stateNode.implementation===te.implementation){d(Z,G.sibling),G=_(G,te.children||[]),G.return=Z,Z=G;break e}else{d(Z,G);break}else a(Z,G);G=G.sibling}G=Dl(te,Z.mode,Me),G.return=Z,Z=G}return N(Z);case H:return st=te._init,kt(Z,G,st(te._payload),Me)}if(Ae(te))return Xt(Z,G,te,Me);if(j(te))return jt(Z,G,te,Me);ul(Z,te)}return typeof te=="string"&&te!==""||typeof te=="number"?(te=""+te,G!==null&&G.tag===6?(d(Z,G.sibling),G=_(G,te),G.return=Z,Z=G):(d(Z,G),G=wl(te,Z.mode,Me),G.return=Z,Z=G),N(Z)):d(Z,G)}return kt}var Sa=pf(!0),pi=pf(!1),Ns={},xr=Ba(Ns),Xr=Ba(Ns),Kr=Ba(Ns);function rn(i){if(i===Ns)throw Error(h(174));return i}function Ln(i,a){Bt(Kr,a),Bt(Xr,i),Bt(xr,Ns),i=Ce(a),vt(xr),Bt(xr,i)}function Ya(){vt(xr),vt(Xr),vt(Kr)}function Pr(i){var a=rn(Kr.current),d=rn(xr.current);a=oe(d,i.type,a),d!==a&&(Bt(Xr,i),Bt(xr,a))}function zi(i){Xr.current===i&&(vt(xr),vt(Xr))}var Nt=Ba(0);function So(i){for(var a=i;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||tu(d)||rl(d)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===i)break;for(;a.sibling===null;){if(a.return===null||a.return===i)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var qa=[];function _u(){for(var i=0;id?d:4,i(!0);var m=_o.transition;_o.transition={};try{i(!1),a()}finally{Ot=d,_o.transition=m}}function Au(){return Lt().memoizedState}function yf(i,a,d){var m=tr(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Mu(i))Lu(a,d);else if(d=ff(i,a,d,m),d!==null){var _=er();$r(d,i,m,_),hl(d,a,m)}}function Sf(i,a,d){var m=tr(i),_={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Mu(i))Lu(a,_);else{var E=i.alternate;if(i.lanes===0&&(E===null||E.lanes===0)&&(E=a.lastRenderedReducer,E!==null))try{var N=a.lastRenderedState,F=E(N,d);if(_.hasEagerState=!0,_.eagerState=F,Ni(F,N)){var ee=a.interleaved;ee===null?(_.next=_,du(a)):(_.next=ee.next,ee.next=_),a.interleaved=_;return}}catch{}finally{}d=ff(i,a,_,m),d!==null&&(_=er(),$r(d,i,m,_),hl(d,a,m))}}function Mu(i){var a=i.alternate;return i===Zt||a!==null&&a===Zt}function Lu(i,a){Wa=cl=!0;var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}function hl(i,a,d){if((d&4194240)!==0){var m=a.lanes;m&=i.pendingLanes,d|=m,a.lanes=d,Jc(i,d)}}var xa={readContext:mr,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},_f={readContext:mr,useCallback:function(i,a){return ct().memoizedState=[i,a===void 0?null:a],i},useContext:mr,useEffect:xo,useImperativeHandle:function(i,a,d){return d=d!=null?d.concat([i]):null,Qa(4194308,4,bu.bind(null,a,i),d)},useLayoutEffect:function(i,a){return Qa(4194308,4,i,a)},useInsertionEffect:function(i,a){return Qa(4,2,i,a)},useMemo:function(i,a){var d=ct();return a=a===void 0?null:a,i=i(),d.memoizedState=[i,a],i},useReducer:function(i,a,d){var m=ct();return a=d!==void 0?d(a):a,m.memoizedState=m.baseState=a,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:a},m.queue=i,i=i.dispatch=yf.bind(null,Zt,i),[m.memoizedState,i]},useRef:function(i){var a=ct();return i={current:i},a.memoizedState=i},useState:Zi,useDebugValue:dl,useDeferredValue:function(i){return ct().memoizedState=i},useTransition:function(){var i=Zi(!1),a=i[0];return i=gf.bind(null,i[1]),ct().memoizedState=i,[a,i]},useMutableSource:function(){},useSyncExternalStore:function(i,a,d){var m=Zt,_=ct();if(ln){if(d===void 0)throw Error(h(407));d=d()}else{if(d=a(),jn===null)throw Error(h(349));(gr&30)!==0||Cu(m,a,d)}_.memoizedState=d;var E={value:d,getSnapshot:a};return _.queue=E,xo(zn.bind(null,m,E,i),[i]),m.flags|=2048,Ui(9,ce.bind(null,m,E,d,a),void 0,null),d},useId:function(){var i=ct(),a=jn.identifierPrefix;if(ln){var d=Ki,m=pa;d=(m&~(1<<32-Oi(m)-1)).toString(32)+d,a=":"+a+"R"+d,d=Eo++,0Yu&&(a.flags|=128,m=!0,Sl(_,!1),a.lanes=4194304)}else{if(!m)if(i=So(E),i!==null){if(a.flags|=128,m=!0,i=i.updateQueue,i!==null&&(a.updateQueue=i,a.flags|=4),Sl(_,!0),_.tail===null&&_.tailMode==="hidden"&&!E.alternate&&!ln)return Kn(a),null}else 2*Gn()-_.renderingStartTime>Yu&&d!==1073741824&&(a.flags|=128,m=!0,Sl(_,!1),a.lanes=4194304);_.isBackwards?(E.sibling=a.child,a.child=E):(i=_.last,i!==null?i.sibling=E:a.child=E,_.last=E)}return _.tail!==null?(a=_.tail,_.rendering=a,_.tail=a.sibling,_.renderingStartTime=Gn(),a.sibling=null,i=Nt.current,Bt(Nt,m?i&1|2:i&1),a):(Kn(a),null);case 22:case 23:return Fi(),d=a.memoizedState!==null,i!==null&&i.memoizedState!==null!==d&&(a.flags|=8192),d&&(a.mode&1)!==0?(Zr&1073741824)!==0&&(Kn(a),mn&&a.subtreeFlags&6&&(a.flags|=8192)):Kn(a),null;case 24:return null;case 25:return null}throw Error(h(156,a.tag))}function Rf(i,a){switch(ho(a),a.tag){case 1:return hr(a.type)&&al(),i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 3:return Ya(),vt(Lr),vt(dr),_u(),i=a.flags,(i&65536)!==0&&(i&128)===0?(a.flags=i&-65537|128,a):null;case 5:return zi(a),null;case 13:if(vt(Nt),i=a.memoizedState,i!==null&&i.dehydrated!==null){if(a.alternate===null)throw Error(h(340));vo()}return i=a.flags,i&65536?(a.flags=i&-65537|128,a):null;case 19:return vt(Nt),null;case 4:return Ya(),null;case 10:return uf(a.type._context),null;case 22:case 23:return Fi(),null;case 24:return null;default:return null}}var Fu=!1,Jn=!1,wh=typeof WeakSet=="function"?WeakSet:Set,ze=null;function Cr(i,a){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Ct(i,a,m)}else d.current=null}function Ps(i,a,d){try{d()}catch(m){Ct(i,a,m)}}var No=!1;function bf(i,a){for(de(i.containerInfo),ze=a;ze!==null;)if(i=ze,a=i.child,(i.subtreeFlags&1028)!==0&&a!==null)a.return=i,ze=a;else for(;ze!==null;){i=ze;try{var d=i.alternate;if((i.flags&1024)!==0)switch(i.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,_=d.memoizedState,E=i.stateNode,N=E.getSnapshotBeforeUpdate(i.elementType===i.type?m:Li(i.type,m),_);E.__reactInternalSnapshotBeforeUpdate=N}break;case 3:mn&&ci(i.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(h(163))}}catch(F){Ct(i,i.return,F)}if(a=i.sibling,a!==null){a.return=i.return,ze=a;break}ze=i.return}return d=No,No=!1,d}function Ca(i,a,d){var m=a.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var _=m=m.next;do{if((_.tag&i)===i){var E=_.destroy;_.destroy=void 0,E!==void 0&&Ps(a,d,E)}_=_.next}while(_!==m)}}function kr(i,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&i)===i){var m=d.create;d.destroy=m()}d=d.next}while(d!==a)}}function Rn(i){var a=i.ref;if(a!==null){var d=i.stateNode;switch(i.tag){case 5:i=De(d);break;default:i=d}typeof a=="function"?a(i):a.current=i}}function Dh(i){var a=i.alternate;a!==null&&(i.alternate=null,Dh(a)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(a=i.stateNode,a!==null&&qi(a)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Oh(i){return i.tag===5||i.tag===3||i.tag===4}function Nh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Oh(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Gu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?Qe(d,i,a):Ss(d,i);else if(m!==4&&(i=i.child,i!==null))for(Gu(i,a,d),i=i.sibling;i!==null;)Gu(i,a,d),i=i.sibling}function Bu(i,a,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,a?lt(d,i,a):ao(d,i);else if(m!==4&&(i=i.child,i!==null))for(Bu(i,a,d),i=i.sibling;i!==null;)Bu(i,a,d),i=i.sibling}var Bn=null,Hi=!1;function $i(i,a,d){for(d=d.child;d!==null;)wf(i,a,d),d=d.sibling}function wf(i,a,d){if(Xi&&typeof Xi.onCommitFiberUnmount=="function")try{Xi.onCommitFiberUnmount(su,d)}catch{}switch(d.tag){case 5:Jn||Cr(d,a);case 6:if(mn){var m=Bn,_=Hi;Bn=null,$i(i,a,d),Bn=m,Hi=_,Bn!==null&&(Hi?fr(Bn,d.stateNode):cn(Bn,d.stateNode))}else $i(i,a,d);break;case 18:mn&&Bn!==null&&(Hi?fn(Bn,d.stateNode):Wt(Bn,d.stateNode));break;case 4:mn?(m=Bn,_=Hi,Bn=d.stateNode.containerInfo,Hi=!0,$i(i,a,d),Bn=m,Hi=_):(_r&&(m=d.stateNode.containerInfo,_=_s(m),di(m,_)),$i(i,a,d));break;case 0:case 11:case 14:case 15:if(!Jn&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){_=m=m.next;do{var E=_,N=E.destroy;E=E.tag,N!==void 0&&((E&2)!==0||(E&4)!==0)&&Ps(d,a,N),_=_.next}while(_!==m)}$i(i,a,d);break;case 1:if(!Jn&&(Cr(d,a),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(F){Ct(d,a,F)}$i(i,a,d);break;case 21:$i(i,a,d);break;case 22:d.mode&1?(Jn=(m=Jn)||d.memoizedState!==null,$i(i,a,d),Jn=m):$i(i,a,d);break;default:$i(i,a,d)}}function kn(i){var a=i.updateQueue;if(a!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new wh),a.forEach(function(m){var _=_m.bind(null,i,m);d.has(m)||(d.add(m),m.then(_,_))})}}function Hr(i,a){var d=a.deletions;if(d!==null)for(var m=0;m";case Jr:return":has("+(bn(i)||"")+")";case Fr:return'[role="'+i.value+'"]';case Iu:return'"'+i.value+'"';case ju:return'[data-testname="'+i.value+'"]';default:throw Error(h(365))}}function Ph(i,a){var d=[];i=[i,0];for(var m=0;m_&&(_=N),m&=~E}if(m=_,m=Gn()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*ym(m/1960))-m,10i?16:i,On===null)var m=!1;else{if(i=On,On=null,mi=0,(dt&6)!==0)throw Error(h(331));var _=dt;for(dt|=4,ze=i.current;ze!==null;){var E=ze,N=E.child;if((ze.flags&16)!==0){var F=E.deletions;if(F!==null){for(var ee=0;eeGn()-Lf?Bs(i,0):Mf|=d),Hn(i,a)}function ba(i,a){a===0&&((i.mode&1)===0?a=1:(a=bs,bs<<=1,(bs&130023424)===0&&(bs=4194304)));var d=er();i=Pi(i,a),i!==null&&(Qi(i,a,d),Hn(i,d))}function es(i){var a=i.memoizedState,d=0;a!==null&&(d=a.retryLane),ba(i,d)}function _m(i,a){var d=0;switch(i.tag){case 13:var m=i.stateNode,_=i.memoizedState;_!==null&&(d=_.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(h(314))}m!==null&&m.delete(a),ba(i,d)}var Uf;Uf=function(i,a,d){if(i!==null)if(i.memoizedProps!==a.pendingProps||Lr.current)Xn=!0;else{if((i.lanes&d)===0&&(a.flags&128)===0)return Xn=!1,bo(i,a,d);Xn=(i.flags&131072)!==0}else Xn=!1,ln&&(a.flags&1048576)!==0&&uh(a,ol,a.index);switch(a.lanes=0,a.tag){case 2:var m=a.type;Ro(i,a),i=a.pendingProps;var _=lo(a,dr.current);mo(a,d),_=Xe(null,a,m,i,_,d);var E=pt();return a.flags|=1,typeof _=="object"&&_!==null&&typeof _.render=="function"&&_.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,hr(m)?(E=!0,sl(a)):E=!1,a.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,hu(a),_.updater=gu,a.stateNode=_,_._reactInternals=a,hf(a,m,i,d),a=ml(null,a,m,!0,E,d)):(a.tag=0,ln&&E&&nf(a),Un(null,a,_,d),a=a.child),a;case 16:m=a.elementType;e:{switch(Ro(i,a),i=a.pendingProps,_=m._init,m=_(m._payload),a.type=m,_=a.tag=Fh(m),i=Li(m,i),_){case 0:a=pl(null,a,m,i,d);break e;case 1:a=Th(null,a,m,i,d);break e;case 11:a=vl(null,a,m,i,d);break e;case 14:a=_h(null,a,m,Li(m.type,i),d);break e}throw Error(h(306,m,""))}return a;case 0:return m=a.type,_=a.pendingProps,_=a.elementType===m?_:Li(m,_),pl(i,a,m,_,d);case 1:return m=a.type,_=a.pendingProps,_=a.elementType===m?_:Li(m,_),Th(i,a,m,_,d);case 3:e:{if(Cf(a),i===null)throw Error(h(387));m=a.pendingProps,E=a.memoizedState,_=E.element,df(i,a),go(a,m,null,d);var N=a.memoizedState;if(m=N.element,gn&&E.isDehydrated)if(E={element:m,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},a.updateQueue.baseState=E,a.memoizedState=E,a.flags&256){_=Xa(Error(h(423)),a),a=Rh(i,a,m,d,_);break e}else if(m!==_){_=Xa(Error(h(424)),a),a=Rh(i,a,m,d,_);break e}else for(gn&&(vi=be(a.stateNode.containerInfo),Qr=a,ln=!0,Mi=null,ll=!1),d=pi(a,null,m,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(vo(),m===_){a=En(i,a,d);break e}Un(i,a,m,d)}a=a.child}return a;case 5:return Pr(a),i===null&&af(a),m=a.type,_=a.pendingProps,E=i!==null?i.memoizedProps:null,N=_.children,Dt(m,_)?N=null:E!==null&&Dt(m,E)&&(a.flags|=32),Ch(i,a),Un(i,a,N,d),a.child;case 6:return i===null&&af(a),null;case 13:return bh(i,a,d);case 4:return Ln(a,a.stateNode.containerInfo),m=a.pendingProps,i===null?a.child=Sa(a,null,m,d):Un(i,a,m,d),a.child;case 11:return m=a.type,_=a.pendingProps,_=a.elementType===m?_:Li(m,_),vl(i,a,m,_,d);case 7:return Un(i,a,a.pendingProps,d),a.child;case 8:return Un(i,a,a.pendingProps.children,d),a.child;case 12:return Un(i,a,a.pendingProps.children,d),a.child;case 10:e:{if(m=a.type._context,_=a.pendingProps,E=a.memoizedProps,N=_.value,vh(a,m,N),E!==null)if(Ni(E.value,N)){if(E.children===_.children&&!Lr.current){a=En(i,a,d);break e}}else for(E=a.child,E!==null&&(E.return=a);E!==null;){var F=E.dependencies;if(F!==null){N=E.child;for(var ee=F.firstContext;ee!==null;){if(ee.context===m){if(E.tag===1){ee=Ji(-1,d&-d),ee.tag=2;var ye=E.updateQueue;if(ye!==null){ye=ye.shared;var Ue=ye.pending;Ue===null?ee.next=ee:(ee.next=Ue.next,Ue.next=ee),ye.pending=ee}}E.lanes|=d,ee=E.alternate,ee!==null&&(ee.lanes|=d),cf(E.return,d,a),F.lanes|=d;break}ee=ee.next}}else if(E.tag===10)N=E.type===a.type?null:E.child;else if(E.tag===18){if(N=E.return,N===null)throw Error(h(341));N.lanes|=d,F=N.alternate,F!==null&&(F.lanes|=d),cf(N,d,a),N=E.sibling}else N=E.child;if(N!==null)N.return=E;else for(N=E;N!==null;){if(N===a){N=null;break}if(E=N.sibling,E!==null){E.return=N.return,N=E;break}N=N.return}E=N}Un(i,a,_.children,d),a=a.child}return a;case 9:return _=a.type,m=a.pendingProps.children,mo(a,d),_=mr(_),m=m(_),a.flags|=1,Un(i,a,m,d),a.child;case 14:return m=a.type,_=Li(m,a.pendingProps),_=Li(m.type,_),_h(i,a,m,_,d);case 15:return Eh(i,a,a.type,a.pendingProps,d);case 17:return m=a.type,_=a.pendingProps,_=a.elementType===m?_:Li(m,_),Ro(i,a),a.tag=1,hr(m)?(i=!0,sl(a)):i=!1,mo(a,d),ph(a,m,_),hf(a,m,_,d),ml(null,a,m,!0,i,d);case 19:return Za(i,a,d);case 22:return xh(i,a,d)}throw Error(h(156,a.tag))};function Hh(i,a){return Zc(i,a)}function Em(i,a,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(i,a,d,m){return new Em(i,a,d,m)}function Ju(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Fh(i){if(typeof i=="function")return Ju(i)?1:0;if(i!=null){if(i=i.$$typeof,i===A)return 11;if(i===k)return 14}return 2}function na(i,a){var d=i.alternate;return d===null?(d=yi(i.tag,a,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=a,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,a=i.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function bl(i,a,d,m,_,E){var N=2;if(m=i,typeof i=="function")Ju(i)&&(N=1);else if(typeof i=="string")N=5;else e:switch(i){case x:return ts(d.children,_,E,a);case R:N=8,_|=8;break;case T:return i=yi(12,d,a,_|2),i.elementType=T,i.lanes=E,i;case M:return i=yi(13,d,a,_),i.elementType=M,i.lanes=E,i;case B:return i=yi(19,d,a,_),i.elementType=B,i.lanes=E,i;case q:return zo(d,_,E,a);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case O:N=10;break e;case w:N=9;break e;case A:N=11;break e;case k:N=14;break e;case H:N=16,m=null;break e}throw Error(h(130,i==null?i:typeof i,""))}return a=yi(N,d,a,_),a.elementType=i,a.type=m,a.lanes=E,a}function ts(i,a,d,m){return i=yi(7,i,m,a),i.lanes=d,i}function zo(i,a,d,m){return i=yi(22,i,m,a),i.elementType=q,i.lanes=d,i.stateNode={isHidden:!1},i}function wl(i,a,d){return i=yi(6,i,null,a),i.lanes=d,i}function Dl(i,a,d){return a=yi(4,i.children!==null?i.children:[],i.key,a),a.lanes=d,a.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},a}function xm(i,a,d,m,_){this.tag=a,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Mr,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Kc(0),this.expirationTimes=Kc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kc(0),this.identifierPrefix=m,this.onRecoverableError=_,gn&&(this.mutableSourceEagerHydrationData=null)}function Gh(i,a,d,m,_,E,N,F,ee){return i=new xm(i,a,d,F,ee),a===1?(a=1,E===!0&&(a|=8)):a=0,E=yi(3,null,null,a),i.current=E,E.stateNode=i,E.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},hu(E),i}function Bh(i){if(!i)return ja;i=i._reactInternals;e:{if(J(i)!==i||i.tag!==1)throw Error(h(170));var a=i;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(hr(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(h(171))}if(i.tag===1){var d=i.type;if(hr(d))return ru(i,d,a)}return a}function jh(i){var a=i._reactInternals;if(a===void 0)throw typeof i.render=="function"?Error(h(188)):(i=Object.keys(i).join(","),Error(h(268,i)));return i=pe(a),i===null?null:i.stateNode}function kf(i,a){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var d=i.retryLane;i.retryLane=d!==0&&d=ye&&E>=Ye&&_<=Ue&&N<=Ne){i.splice(a,1);break}else if(m!==ye||d.width!==ee.width||NeN){if(!(E!==Ye||d.height!==ee.height||Ue_)){ye>m&&(ee.width+=ye-m,ee.x=m),Ue<_&&(ee.width=_-ye),i.splice(a,1);break}}else{Ye>E&&(ee.height+=Ye-E,ee.y=E),Ned&&(d=N)),N ")+` No matching component was found for: `)+i.join(" > ")}return null},r.getPublicRootInstance=function(i){if(i=i.current,!i.child)return null;switch(i.child.tag){case 5:return De(i.child.stateNode);default:return i.child.stateNode}},r.injectIntoDevTools=function(i){if(i={bundleType:i.bundleType,version:i.version,rendererPackageName:i.rendererPackageName,rendererConfig:i.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:y.ReactCurrentDispatcher,findHostInstanceByFiber:Cm,findFiberByHostInstance:i.findFiberByHostInstance||Ih,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")i=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)i=!0;else{try{su=a.inject(i),Xi=a}catch{}i=!!a.checkDCE}}return i},r.isAlreadyRendering=function(){return!1},r.observeVisibleRects=function(i,a,d,m){if(!ui)throw Error(h(363));i=Af(i,a);var _=Ri(i,d,m).disconnect;return{disconnect:function(){_()}}},r.registerMutableSourceForHydration=function(i,a){var d=a._getVersion;d=d(a._source),i.mutableSourceEagerHydrationData==null?i.mutableSourceEagerHydrationData=[a,d]:i.mutableSourceEagerHydrationData.push(a,d)},r.runWithPriority=function(i,a){var d=Ot;try{return Ot=i,a()}finally{Ot=d}},r.shouldError=function(){return null},r.shouldSuspend=function(){return!1},r.updateContainer=function(i,a,d,m){var _=a.current,E=er(),N=tr(_);return d=Bh(d),a.context===null?a.context=d:a.pendingContext=d,a=Ji(E,N),a.payload={element:i},m=m===void 0?null:m,m!==null&&(a.callback=m),i=Va(_,a,N),i!==null&&($r(i,_,N,E),vu(i,_,N)),N},r}),Qp}var Xp={exports:{}};/** * @license React * react-reconciler.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var T0;function cT(){return T0||(T0=1,process.env.NODE_ENV!=="production"&&(Xp.exports=function(e){var r={},s=lr.default,u=Wp(),f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,h=!1;function y(t){h=t}function g(t){if(!h){for(var n=arguments.length,l=new Array(n>1?n-1:0),c=1;c1?n-1:0),c=1;c=1&&U>=0&&b[L]!==D[U];)U--;for(;L>=1&&U>=0;L--,U--)if(b[L]!==D[U]){if(L!==1||U!==1)do if(L--,U--,U<0||b[L]!==D[U]){var V=` `+b[L].replace(" at new "," at ");return t.displayName&&V.includes("")&&(V=V.replace("",t.displayName)),typeof t=="function"&&yo.set(t,V),V}while(L>=1&&U>=0);break}}}finally{mu=!1,pu.current=S,vu(),Error.prepareStackTrace=v}var $=t?t.displayName||t.name:"",se=$?ya($):"";return typeof t=="function"&&yo.set(t,se),se}function ph(t,n,l){return yu(t,!0)}function Su(t,n,l){return yu(t,!1)}function hf(t){var n=t.prototype;return!!(n&&n.isReactComponent)}function Os(t,n,l){if(t==null)return"";if(typeof t=="function")return yu(t,hf(t));if(typeof t=="string")return ya(t);switch(t){case li:return ya("Suspense");case ui:return ya("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case oi:return Su(t.render);case ca:return Os(t.type,n,l);case un:{var c=t,v=c._payload,S=c._init;try{return Os(S(v),n,l)}catch{}}}return""}var ul=Object.prototype.hasOwnProperty,vf={},pf=f.ReactDebugCurrentFrame;function Sa(t){if(t){var n=t._owner,l=Os(t.type,t._source,n?n.type:null);pf.setExtraStackFrame(l)}else pf.setExtraStackFrame(null)}function pi(t,n,l,c,v){{var S=Function.call.bind(ul);for(var C in t)if(S(t,C)){var b=void 0;try{if(typeof t[C]!="function"){var D=Error((c||"React class")+": "+l+" type `"+C+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[C]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}b=t[C](n,C,c,l,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){b=L}b&&!(b instanceof Error)&&(Sa(v),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",c||"React class",l,C,typeof b),Sa(null)),b instanceof Error&&!(b.message in vf)&&(vf[b.message]=!0,Sa(v),p("Failed %s type: %s",l,b.message),Sa(null))}}}var Ns=[],xr;xr=[];var Xr=-1;function Kr(t){return{current:t}}function rn(t,n){if(Xr<0){p("Unexpected pop.");return}n!==xr[Xr]&&p("Unexpected Fiber popped."),t.current=Ns[Xr],Ns[Xr]=null,xr[Xr]=null,Xr--}function Ln(t,n,l){Xr++,Ns[Xr]=t.current,xr[Xr]=l,t.current=n}var Ya;Ya={};var Pr={};Object.freeze(Pr);var zi=Kr(Pr),Nt=Kr(!1),So=Pr;function qa(t,n,l){return l&&gr(n)?So:zi.current}function _u(t,n,l){{var c=t.stateNode;c.__reactInternalMemoizedUnmaskedChildContext=n,c.__reactInternalMemoizedMaskedChildContext=l}}function _a(t,n){{var l=t.type,c=l.contextTypes;if(!c)return Pr;var v=t.stateNode;if(v&&v.__reactInternalMemoizedUnmaskedChildContext===n)return v.__reactInternalMemoizedMaskedChildContext;var S={};for(var C in c)S[C]=n[C];{var b=Be(t)||"Unknown";pi(c,S,"context",b)}return v&&_u(t,n,S),S}}function _o(){return Nt.current}function gr(t){{var n=t.childContextTypes;return n!=null}}function Zt(t){rn(Nt,t),rn(zi,t)}function Sn(t){rn(Nt,t),rn(zi,t)}function Pn(t,n,l){{if(zi.current!==Pr)throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");Ln(zi,n,t),Ln(Nt,l,t)}}function cl(t,n,l){{var c=t.stateNode,v=n.childContextTypes;if(typeof c.getChildContext!="function"){{var S=Be(t)||"Unknown";Ya[S]||(Ya[S]=!0,p("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.",S,S))}return l}var C=c.getChildContext();for(var b in C)if(!(b in v))throw new Error((Be(t)||"Unknown")+'.getChildContext(): key "'+b+'" is not defined in childContextTypes.');{var D=Be(t)||"Unknown";pi(v,C,"child context",D)}return R({},l,C)}}function Wa(t){{var n=t.stateNode,l=n&&n.__reactInternalMemoizedMergedChildContext||Pr;return So=zi.current,Ln(zi,l,t),Ln(Nt,Nt.current,t),!0}}function Eo(t,n,l){{var c=t.stateNode;if(!c)throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");if(l){var v=cl(t,n,So);c.__reactInternalMemoizedMergedChildContext=v,rn(Nt,t),rn(zi,t),Ln(zi,v,t),Ln(Nt,l,t)}else rn(Nt,t),Ln(Nt,l,t)}}function pm(t){{if(!Di(t)||t.tag!==I)throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");var n=t;do{switch(n.tag){case J:return n.stateNode.context;case I:{var l=n.type;if(gr(l))return n.stateNode.__reactInternalMemoizedMergedChildContext;break}}n=n.return}while(n!==null);throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.")}}var _n=0,Eu=1,Xe=0,pt=1,ct=2,Lt=8,zr=16,xu=Math.clz32?Math.clz32:gh,mf=Math.log,mh=Math.LN2;function gh(t){var n=t>>>0;return n===0?32:31-(mf(n)/mh|0)|0}var Cu=31,ce=0,zn=0,$e=1,As=2,Zi=4,Ui=8,ki=16,Qa=32,Ea=4194240,xo=64,fl=128,Tu=256,Ru=512,bu=1024,wu=2048,dl=4096,Du=8192,Ou=16384,Nu=32768,gf=65536,Au=131072,yf=262144,Sf=524288,Mu=1048576,Lu=2097152,hl=130023424,xa=4194304,_f=8388608,Ef=16777216,xf=33554432,Xa=67108864,Pu=xa,Ms=134217728,yh=268435455,Co=268435456,Ka=536870912,Ur=1073741824;function Sh(t){{if(t&$e)return"Sync";if(t&As)return"InputContinuousHydration";if(t&Zi)return"InputContinuous";if(t&Ui)return"DefaultHydration";if(t&ki)return"Default";if(t&Qa)return"TransitionHydration";if(t&Ea)return"Transition";if(t&hl)return"Retry";if(t&Ms)return"SelectiveHydration";if(t&Co)return"IdleHydration";if(t&Ka)return"Idle";if(t&Ur)return"Offscreen"}}var Qt=-1,zu=xo,Xn=xa;function Un(t){switch(Ja(t)){case $e:return $e;case As:return As;case Zi:return Zi;case Ui:return Ui;case ki:return ki;case Qa:return Qa;case xo:case fl:case Tu:case Ru:case bu:case wu:case dl:case Du:case Ou:case Nu:case gf:case Au:case yf:case Sf:case Mu:case Lu:return t&Ea;case xa:case _f:case Ef:case xf:case Xa:return t&hl;case Ms:return Ms;case Co:return Co;case Ka:return Ka;case Ur:return Ur;default:return p("Should have found matching lanes. This is a bug in React."),t}}function vl(t,n){var l=t.pendingLanes;if(l===ce)return ce;var c=ce,v=t.suspendedLanes,S=t.pingedLanes,C=l&yh;if(C!==ce){var b=C&~v;if(b!==ce)c=Un(b);else{var D=C&S;D!==ce&&(c=Un(D))}}else{var L=l&~v;L!==ce?c=Un(L):S!==ce&&(c=Un(S))}if(c===ce)return ce;if(n!==ce&&n!==c&&(n&v)===ce){var U=Ja(c),V=Ja(n);if(U>=V||U===ki&&(V&Ea)!==ce)return n}(c&Zi)!==ce&&(c|=l&ki);var $=t.entangledLanes;if($!==ce)for(var se=t.entanglements,fe=c&$;fe>0;){var le=Za(fe),Ie=1<0;){var v=Za(n),S=1<c&&(c=C),n&=~S}return c}function Eh(t,n){switch(t){case $e:case As:case Zi:return n+250;case Ui:case ki:case Qa:case xo:case fl:case Tu:case Ru:case bu:case wu:case dl:case Du:case Ou:case Nu:case gf:case Au:case yf:case Sf:case Mu:case Lu:return n+5e3;case xa:case _f:case Ef:case xf:case Xa:return Qt;case Ms:case Co:case Ka:case Ur:return Qt;default:return p("Should have found matching lanes. This is a bug in React."),Qt}}function xh(t,n){for(var l=t.pendingLanes,c=t.suspendedLanes,v=t.pingedLanes,S=t.expirationTimes,C=l;C>0;){var b=Za(C),D=1<0;){var v=Za(c),S=1<0;){var b=Za(C),D=1<0;){var v=Ro(l),S=1<0;){var v=Ro(n),S=1<0&&(C.forEach(function(b){var D=b.alternate;(D===null||!c.has(D))&&c.add(b)}),C.clear()),n&=~S}}function ze(t,n){return null}var Cr=$e,Ps=Zi,No=ki,bf=Ka,Ca=zn;function kr(){return Ca}function Rn(t){Ca=t}function Dh(t,n){var l=Ca;try{return Ca=t,n()}finally{Ca=l}}function Oh(t,n){return t!==0&&tn?t:n}function Gu(t,n){return t!==0&&t"u")return!1;var n=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(n.isDisabled)return!0;if(!n.supportsFiber)return p("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools"),!0;try{H&&(t=R({},t,{getLaneLabelMap:Af,injectProfilingHooks:Ph})),zs=n.inject(t),Zn=n}catch(l){p("React instrumentation encountered an error: %s.",l)}return!!n.checkDCE}function Iu(t,n){if(Zn&&typeof Zn.onScheduleFiberRoot=="function")try{Zn.onScheduleFiberRoot(zs,t,n)}catch(l){Jr||(Jr=!0,p("React instrumentation encountered an error: %s",l))}}function _l(t,n){if(Zn&&typeof Zn.onCommitFiberRoot=="function")try{var l=(t.current.flags&yt)===yt;if(q){var c;switch(n){case Cr:c=Hr;break;case Ps:c=Df;break;case No:c=Tr;break;case bf:c=Ah;break;default:c=Tr;break}Zn.onCommitFiberRoot(zs,t,c,l)}}catch(v){Jr||(Jr=!0,p("React instrumentation encountered an error: %s",v))}}function Of(t){if(Zn&&typeof Zn.onPostCommitFiberRoot=="function")try{Zn.onPostCommitFiberRoot(zs,t)}catch(n){Jr||(Jr=!0,p("React instrumentation encountered an error: %s",n))}}function Nf(t){if(Zn&&typeof Zn.onCommitFiberUnmount=="function")try{Zn.onCommitFiberUnmount(zs,t)}catch(n){Jr||(Jr=!0,p("React instrumentation encountered an error: %s",n))}}function bn(t){if(typeof Mh=="function"&&(Lh(t),y(t)),Zn&&typeof Zn.setStrictMode=="function")try{Zn.setStrictMode(zs,t)}catch(n){Jr||(Jr=!0,p("React instrumentation encountered an error: %s",n))}}function Ph(t){Oe=t}function Af(){{for(var t=new Map,n=1,l=0;l30){var L=S-S%5,U=(1<>L,se=S-L,fe=Xu(n)+se,le=b<0&&(st.forEach(function($){t.add(Be($)||"Component"),Vs.add($.type)}),st=[]);var n=new Set;tt.length>0&&(tt.forEach(function($){n.add(Be($)||"Component"),Vs.add($.type)}),tt=[]);var l=new Set;St.length>0&&(St.forEach(function($){l.add(Be($)||"Component"),Vs.add($.type)}),St=[]);var c=new Set;dn.length>0&&(dn.forEach(function($){c.add(Be($)||"Component"),Vs.add($.type)}),dn=[]);var v=new Set;_t.length>0&&(_t.forEach(function($){v.add(Be($)||"Component"),Vs.add($.type)}),_t=[]);var S=new Set;if(Si.length>0&&(Si.forEach(function($){S.add(Be($)||"Component"),Vs.add($.type)}),Si=[]),n.size>0){var C=je(n);p(`Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor. Please update the following components: %s`,C)}if(c.size>0){var b=je(c);p(`Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move data fetching code or side effects to componentDidUpdate. * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state Please update the following components: %s`,b)}if(S.size>0){var D=je(S);p(`Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move data fetching code or side effects to componentDidUpdate. Please update the following components: %s`,D)}if(t.size>0){var L=je(t);g(`componentWillMount has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move code with side effects to componentDidMount, and set initial state in the constructor. * Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. Please update the following components: %s`,L)}if(l.size>0){var U=je(l);g(`componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move data fetching code or side effects to componentDidUpdate. * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. Please update the following components: %s`,U)}if(v.size>0){var V=je(v);g(`componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details. * Move data fetching code or side effects to componentDidUpdate. * Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder. Please update the following components: %s`,V)}};var Vh=new Map,t1=new Set;te.recordLegacyContextWarning=function(t,n){var l=Me(t);if(l===null){p("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");return}if(!t1.has(t.type)){var c=Vh.get(l);(t.type.contextTypes!=null||t.type.childContextTypes!=null||n!==null&&typeof n.getChildContext=="function")&&(c===void 0&&(c=[],Vh.set(l,c)),c.push(t))}},te.flushLegacyContextWarning=function(){Vh.forEach(function(t,n){if(t.length!==0){var l=t[0],c=new Set;t.forEach(function(S){c.add(Be(S)||"Component"),t1.add(S.type)});var v=je(c);try{kt(l),p(`Legacy context API has been detected within a strict-mode tree. The old API will be supported in all 16.x releases, but applications using it should migrate to the new version. Please update the following components: %s Learn more about this warning here: https://reactjs.org/link/legacy-context`,v)}finally{jt()}}})},te.discardPendingWarnings=function(){st=[],tt=[],St=[],dn=[],_t=[],Si=[],Vh=new Map}}function n1(t){{var n=typeof Symbol=="function"&&Symbol.toStringTag,l=n&&t[Symbol.toStringTag]||t.constructor.name||"Object";return l}}function r1(t){try{return Tm(t),!1}catch{return!0}}function Tm(t){return""+t}function LR(t){if(r1(t))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",n1(t)),Tm(t)}function PR(t,n){if(r1(t))return p("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.",n,n1(t)),Tm(t)}function wa(t,n){if(t&&t.defaultProps){var l=R({},n),c=t.defaultProps;for(var v in c)l[v]===void 0&&(l[v]=c[v]);return l}return n}var Yh=Kr(null),Hf;Hf={};var qh=null,Zu=null,Rm=null,Wh=!1;function Qh(){qh=null,Zu=null,Rm=null,Wh=!1}function i1(){Wh=!0}function a1(){Wh=!1}function s1(t,n,l){iu?(Ln(Yh,n._currentValue,t),n._currentValue=l,n._currentRenderer!==void 0&&n._currentRenderer!==null&&n._currentRenderer!==Hf&&p("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),n._currentRenderer=Hf):(Ln(Yh,n._currentValue2,t),n._currentValue2=l,n._currentRenderer2!==void 0&&n._currentRenderer2!==null&&n._currentRenderer2!==Hf&&p("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."),n._currentRenderer2=Hf)}function bm(t,n){var l=Yh.current;rn(Yh,n),iu?t._currentValue=l:t._currentValue2=l}function wm(t,n,l){for(var c=t;c!==null;){var v=c.alternate;if(bo(c.childLanes,n)?v!==null&&!bo(v.childLanes,n)&&(v.childLanes=Ze(v.childLanes,n)):(c.childLanes=Ze(c.childLanes,n),v!==null&&(v.childLanes=Ze(v.childLanes,n))),c===l)break;c=c.return}c!==l&&p("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.")}function zR(t,n,l){UR(t,n,l)}function UR(t,n,l){var c=t.child;for(c!==null&&(c.return=t);c!==null;){var v=void 0,S=c.dependencies;if(S!==null){v=c.child;for(var C=S.firstContext;C!==null;){if(C.context===n){if(c.tag===I){var b=Ls(l),D=Ys(Qt,b);D.tag=Kh;var L=c.updateQueue;if(L!==null){var U=L.shared,V=U.pending;V===null?D.next=D:(D.next=V.next,V.next=D),U.pending=D}}c.lanes=Ze(c.lanes,l);var $=c.alternate;$!==null&&($.lanes=Ze($.lanes,l)),wm(c.return,l,t),S.lanes=Ze(S.lanes,l);break}C=C.next}}else if(c.tag===De)v=c.type===t.type?null:c.child;else if(c.tag===it){var se=c.return;if(se===null)throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");se.lanes=Ze(se.lanes,l);var fe=se.alternate;fe!==null&&(fe.lanes=Ze(fe.lanes,l)),wm(se,l,t),v=c.sibling}else v=c.child;if(v!==null)v.return=c;else for(v=c;v!==null;){if(v===t){v=null;break}var le=v.sibling;if(le!==null){le.return=v.return,v=le;break}v=v.return}c=v}}function $u(t,n){qh=t,Zu=null,Rm=null;var l=t.dependencies;if(l!==null){var c=l.firstContext;c!==null&&(En(l.lanes,n)&&$f(),l.firstContext=null)}}function Vn(t){Wh&&p("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");var n=iu?t._currentValue:t._currentValue2;if(Rm!==t){var l={context:t,memoizedValue:n,next:null};if(Zu===null){if(qh===null)throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");Zu=l,qh.dependencies={lanes:ce,firstContext:l}}else Zu=Zu.next=l}return n}var Ol=null;function Dm(t){Ol===null?Ol=[t]:Ol.push(t)}function kR(){if(Ol!==null){for(var t=0;t from render. Or maybe you meant to call this function rather than return it.")}}function E1(t){var n=t._payload,l=t._init;return l(n)}function x1(t){function n(K,ie){if(!!t){var Q=K.deletions;Q===null?(K.deletions=[ie],K.flags|=ci):Q.push(ie)}}function l(K,ie){if(!t)return null;for(var Q=ie;Q!==null;)n(K,Q),Q=Q.sibling;return null}function c(K,ie){for(var Q=new Map,Se=ie;Se!==null;)Se.key!==null?Q.set(Se.key,Se):Q.set(Se.index,Se),Se=Se.sibling;return Q}function v(K,ie){var Q=kl(K,ie);return Q.index=0,Q.sibling=null,Q}function S(K,ie,Q){if(K.index=Q,!t)return K.flags|=ve,ie;var Se=K.alternate;if(Se!==null){var Ge=Se.index;return GeKe?(Nn=mt,mt=null):Nn=mt.sibling;var Ir=$(K,mt,Q[Ke],Se);if(Ir===null){mt===null&&(mt=Nn);break}t&&mt&&Ir.alternate===null&&n(K,mt),sn=S(Ir,sn,Ke),At===null?nt=Ir:At.sibling=Ir,At=Ir,mt=Nn}if(Ke===Q.length){if(l(K,mt),d()){var Nr=Ke;Ra(K,Nr)}return nt}if(mt===null){for(;KeNr?(ji=Nn,Nn=null):ji=Nn.sibling;var ai=$(K,Nn,ii.value,Se);if(ai===null){Nn===null&&(Nn=ji);break}t&&Nn&&ai.alternate===null&&n(K,Nn),Ir=S(ai,Ir,Nr),Ke===null?sn=ai:Ke.sibling=ai,Ke=ai,Nn=ji}if(ii.done){if(l(K,Nn),d()){var Vr=Nr;Ra(K,Vr)}return sn}if(Nn===null){for(;!ii.done;Nr++,ii=mt.next()){var Xs=V(K,ii.value,Se);Xs!==null&&(Ir=S(Xs,Ir,Nr),Ke===null?sn=Xs:Ke.sibling=Xs,Ke=Xs)}if(d()){var mc=Nr;Ra(K,mc)}return sn}for(var md=c(K,Nn);!ii.done;Nr++,ii=mt.next()){var ds=se(md,K,Nr,ii.value,Se);ds!==null&&(t&&ds.alternate!==null&&md.delete(ds.key===null?Nr:ds.key),Ir=S(ds,Ir,Nr),Ke===null?sn=ds:Ke.sibling=ds,Ke=ds)}if(t&&md.forEach(function(fO){return n(K,fO)}),d()){var cO=Nr;Ra(K,cO)}return sn}function et(K,ie,Q,Se){if(ie!==null&&ie.tag===pe){l(K,ie.sibling);var Ge=v(ie,Q);return Ge.return=K,Ge}l(K,ie);var Pe=Ry(Q,K.mode,Se);return Pe.return=K,Pe}function We(K,ie,Q,Se){for(var Ge=Q.key,Pe=ie;Pe!==null;){if(Pe.key===Ge){var Tt=Q.type;if(Tt===gn){if(Pe.tag===ue){l(K,Pe.sibling);var nt=v(Pe,Q.props.children);return nt.return=K,nt._debugSource=Q._source,nt._debugOwner=Q._owner,nt}}else if(Pe.elementType===Tt||dE(Pe,Q)||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===un&&E1(Tt)===Pe.type){l(K,Pe.sibling);var At=v(Pe,Q.props);return At.ref=Ff(K,Pe,Q),At.return=K,At._debugSource=Q._source,At._debugOwner=Q._owner,At}l(K,Pe);break}else n(K,Pe);Pe=Pe.sibling}if(Q.type===gn){var mt=Yo(Q.props.children,K.mode,Se,Q.key);return mt.return=K,mt}else{var sn=Ty(Q,K.mode,Se);return sn.ref=Ff(K,ie,Q),sn.return=K,sn}}function Vt(K,ie,Q,Se){for(var Ge=Q.key,Pe=ie;Pe!==null;){if(Pe.key===Ge)if(Pe.tag===W&&Pe.stateNode.containerInfo===Q.containerInfo&&Pe.stateNode.implementation===Q.implementation){l(K,Pe.sibling);var Tt=v(Pe,Q.children||[]);return Tt.return=K,Tt}else{l(K,Pe);break}else n(K,Pe);Pe=Pe.sibling}var nt=by(Q,K.mode,Se);return nt.return=K,nt}function Rt(K,ie,Q,Se){var Ge=typeof Q=="object"&&Q!==null&&Q.type===gn&&Q.key===null;if(Ge&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case mn:return C(We(K,ie,Q,Se));case _r:return C(Vt(K,ie,Q,Se));case un:var Pe=Q._payload,Tt=Q._init;return Rt(K,ie,Tt(Pe),Se)}if(vt(Q))return le(K,ie,Q,Se);if(Te(Q))return Ie(K,ie,Q,Se);rv(K,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"?C(et(K,ie,""+Q,Se)):(typeof Q=="function"&&iv(K),l(K,ie))}return Rt}var ec=x1(!0),C1=x1(!1);function WR(t,n){if(t!==null&&n.child!==t.child)throw new Error("Resuming work not yet implemented.");if(n.child!==null){var l=n.child,c=kl(l,l.pendingProps);for(n.child=c,c.return=n;l.sibling!==null;)l=l.sibling,c=c.sibling=kl(l,l.pendingProps),c.return=n;c.sibling=null}}function QR(t,n){for(var l=t.child;l!==null;)GD(l,n),l=l.sibling}var Gf={},ko=Kr(Gf),Bf=Kr(Gf),av=Kr(Gf);function sv(t){if(t===Gf)throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");return t}function Km(){var t=sv(av.current);return t}function Jm(t,n){Ln(av,n,t),Ln(Bf,t,t),Ln(ko,Gf,t);var l=ja(n);rn(ko,t),Ln(ko,l,t)}function tc(t){rn(ko,t),rn(Bf,t),rn(av,t)}function jf(){var t=sv(ko.current);return t}function T1(t){var n=sv(av.current),l=sv(ko.current),c=dr(l,t.type,n);l!==c&&(Ln(Bf,t,t),Ln(ko,c,t))}function Zm(t){Bf.current===t&&(rn(ko,t),rn(Bf,t))}var XR=0,R1=1,b1=1,If=2,Da=Kr(XR);function $m(t,n){return(t&n)!==0}function nc(t){return t&R1}function eg(t,n){return t&R1|n}function KR(t,n){return t|n}function Ho(t,n){Ln(Da,n,t)}function rc(t){rn(Da,t)}function JR(t,n){var l=t.memoizedState;return l!==null?l.dehydrated!==null:(t.memoizedProps,!0)}function ov(t){for(var n=t;n!==null;){if(n.tag===de){var l=n.memoizedState;if(l!==null){var c=l.dehydrated;if(c===null||Ki(c)||ma(c))return n}}else if(n.tag===Dt&&n.memoizedProps.revealOrder!==void 0){var v=(n.flags&yt)!==ke;if(v)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)return null;for(;n.sibling===null;){if(n.return===null||n.return===t)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var _i=0,nr=1,ns=2,rr=4,Rr=8,tg=[];function ng(){for(var t=0;t=eb)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");b+=1,ig=!1,ir=null,ar=null,n.updateQueue=null,Fo=-1,Le.current=X1,C=l(c,v)}while(Yf)}Le.current=Ev,n._debugHookTypes=ra;var D=ir!==null&&ir.next!==null;if(Nl=ce,It=null,ir=null,ar=null,ae=null,ra=null,Fo=-1,t!==null&&(t.flags&fn)!==(n.flags&fn)&&(t.mode&pt)!==Xe&&p("Internal React error: Expected static flag was missing. Please notify the React team."),lv=!1,D)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return C}function oc(){var t=qf!==0;return qf=0,t}function w1(t,n,l){n.updateQueue=t.updateQueue,(n.mode&zr)!==Xe?n.flags&=~(ut|ht|Er|at):n.flags&=~(Er|at),t.lanes=yl(t.lanes,l)}function D1(){if(Le.current=Ev,lv){for(var t=It.memoizedState;t!==null;){var n=t.queue;n!==null&&(n.pending=null),t=t.next}lv=!1}Nl=ce,It=null,ir=null,ar=null,ra=null,Fo=-1,ae=null,B1=!1,Yf=!1,qf=0}function rs(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ar===null?It.memoizedState=ar=t:ar=ar.next=t,ar}function ia(){var t;if(ir===null){var n=It.alternate;n!==null?t=n.memoizedState:t=null}else t=ir.next;var l;if(ar===null?l=It.memoizedState:l=ar.next,l!==null)ar=l,l=ar.next,ir=t;else{if(t===null)throw new Error("Rendered more hooks than during the previous render.");ir=t;var c={memoizedState:ir.memoizedState,baseState:ir.baseState,baseQueue:ir.baseQueue,queue:ir.queue,next:null};ar===null?It.memoizedState=ar=c:ar=ar.next=c}return ar}function O1(){return{lastEffect:null,stores:null}}function sg(t,n){return typeof n=="function"?n(t):n}function og(t,n,l){var c=rs(),v;l!==void 0?v=l(n):v=n,c.memoizedState=c.baseState=v;var S={pending:null,interleaved:null,lanes:ce,dispatch:null,lastRenderedReducer:t,lastRenderedState:v};c.queue=S;var C=S.dispatch=ab.bind(null,It,S);return[c.memoizedState,C]}function lg(t,n,l){var c=ia(),v=c.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=t;var S=ir,C=S.baseQueue,b=v.pending;if(b!==null){if(C!==null){var D=C.next,L=b.next;C.next=L,b.next=D}S.baseQueue!==C&&p("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),S.baseQueue=C=b,v.pending=null}if(C!==null){var U=C.next,V=S.baseState,$=null,se=null,fe=null,le=U;do{var Ie=le.lane;if(bo(Nl,Ie)){if(fe!==null){var We={lane:zn,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};fe=fe.next=We}if(le.hasEagerState)V=le.eagerState;else{var Vt=le.action;V=t(V,Vt)}}else{var et={lane:Ie,action:le.action,hasEagerState:le.hasEagerState,eagerState:le.eagerState,next:null};fe===null?(se=fe=et,$=V):fe=fe.next=et,It.lanes=Ze(It.lanes,Ie),hd(Ie)}le=le.next}while(le!==null&&le!==U);fe===null?$=V:fe.next=se,On(V,c.memoizedState)||$f(),c.memoizedState=V,c.baseState=$,c.baseQueue=fe,v.lastRenderedState=V}var Rt=v.interleaved;if(Rt!==null){var K=Rt;do{var ie=K.lane;It.lanes=Ze(It.lanes,ie),hd(ie),K=K.next}while(K!==Rt)}else C===null&&(v.lanes=ce);var Q=v.dispatch;return[c.memoizedState,Q]}function ug(t,n,l){var c=ia(),v=c.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=t;var S=v.dispatch,C=v.pending,b=c.memoizedState;if(C!==null){v.pending=null;var D=C.next,L=D;do{var U=L.action;b=t(b,U),L=L.next}while(L!==D);On(b,c.memoizedState)||$f(),c.memoizedState=b,c.baseQueue===null&&(c.baseState=b),v.lastRenderedState=b}return[b,S]}function hO(t,n,l){}function vO(t,n,l){}function cg(t,n,l){var c=It,v=rs(),S,C=d();if(C){if(l===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");S=l(),ic||S!==l()&&(p("The result of getServerSnapshot should be cached to avoid an infinite loop"),ic=!0)}else{if(S=n(),!ic){var b=n();On(S,b)||(p("The result of getSnapshot should be cached to avoid an infinite loop"),ic=!0)}var D=Xv();if(D===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");To(D,Nl)||N1(c,n,S)}v.memoizedState=S;var L={value:S,getSnapshot:n};return v.queue=L,hv(M1.bind(null,c,L,t),[t]),c.flags|=Er,Wf(nr|Rr,A1.bind(null,c,L,S,n),void 0,null),S}function uv(t,n,l){var c=It,v=ia(),S=n();if(!ic){var C=n();On(S,C)||(p("The result of getSnapshot should be cached to avoid an infinite loop"),ic=!0)}var b=v.memoizedState,D=!On(b,S);D&&(v.memoizedState=S,$f());var L=v.queue;if(Xf(M1.bind(null,c,L,t),[t]),L.getSnapshot!==n||D||ar!==null&&ar.memoizedState.tag&nr){c.flags|=Er,Wf(nr|Rr,A1.bind(null,c,L,S,n),void 0,null);var U=Xv();if(U===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");To(U,Nl)||N1(c,n,S)}return S}function N1(t,n,l){t.flags|=Es;var c={getSnapshot:n,value:l},v=It.updateQueue;if(v===null)v=O1(),It.updateQueue=v,v.stores=[c];else{var S=v.stores;S===null?v.stores=[c]:S.push(c)}}function A1(t,n,l,c){n.value=l,n.getSnapshot=c,L1(n)&&P1(t)}function M1(t,n,l){var c=function(){L1(n)&&P1(t)};return l(c)}function L1(t){var n=t.getSnapshot,l=t.value;try{var c=n();return!On(l,c)}catch{return!0}}function P1(t){var n=ti(t,$e);n!==null&&qn(n,t,$e,Qt)}function cv(t){var n=rs();typeof t=="function"&&(t=t()),n.memoizedState=n.baseState=t;var l={pending:null,interleaved:null,lanes:ce,dispatch:null,lastRenderedReducer:sg,lastRenderedState:t};n.queue=l;var c=l.dispatch=sb.bind(null,It,l);return[n.memoizedState,c]}function fg(t){return lg(sg)}function dg(t){return ug(sg)}function Wf(t,n,l,c){var v={tag:t,create:n,destroy:l,deps:c,next:null},S=It.updateQueue;if(S===null)S=O1(),It.updateQueue=S,S.lastEffect=v.next=v;else{var C=S.lastEffect;if(C===null)S.lastEffect=v.next=v;else{var b=C.next;C.next=v,v.next=b,S.lastEffect=v}}return v}function hg(t){var n=rs();{var l={current:t};return n.memoizedState=l,l}}function fv(t){var n=ia();return n.memoizedState}function Qf(t,n,l,c){var v=rs(),S=c===void 0?null:c;It.flags|=t,v.memoizedState=Wf(nr|n,l,void 0,S)}function dv(t,n,l,c){var v=ia(),S=c===void 0?null:c,C=void 0;if(ir!==null){var b=ir.memoizedState;if(C=b.destroy,S!==null){var D=b.deps;if(ag(S,D)){v.memoizedState=Wf(n,l,C,S);return}}}It.flags|=t,v.memoizedState=Wf(nr|n,l,C,S)}function hv(t,n){return(It.mode&zr)!==Xe?Qf(ut|Er|xt,Rr,t,n):Qf(Er|xt,Rr,t,n)}function Xf(t,n){return dv(Er,Rr,t,n)}function vg(t,n){return Qf(at,ns,t,n)}function vv(t,n){return dv(at,ns,t,n)}function pg(t,n){var l=at;return l|=qe,(It.mode&zr)!==Xe&&(l|=ht),Qf(l,rr,t,n)}function pv(t,n){return dv(at,rr,t,n)}function z1(t,n){if(typeof n=="function"){var l=n,c=t();return l(c),function(){l(null)}}else if(n!=null){var v=n;v.hasOwnProperty("current")||p("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(v).join(", ")+"}");var S=t();return v.current=S,function(){v.current=null}}}function mg(t,n,l){typeof n!="function"&&p("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",n!==null?typeof n:"null");var c=l!=null?l.concat([t]):null,v=at;return v|=qe,(It.mode&zr)!==Xe&&(v|=ht),Qf(v,rr,z1.bind(null,n,t),c)}function mv(t,n,l){typeof n!="function"&&p("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",n!==null?typeof n:"null");var c=l!=null?l.concat([t]):null;return dv(at,rr,z1.bind(null,n,t),c)}function nb(t,n){}var gv=nb;function gg(t,n){var l=rs(),c=n===void 0?null:n;return l.memoizedState=[t,c],t}function yv(t,n){var l=ia(),c=n===void 0?null:n,v=l.memoizedState;if(v!==null&&c!==null){var S=v[1];if(ag(c,S))return v[0]}return l.memoizedState=[t,c],t}function yg(t,n){var l=rs(),c=n===void 0?null:n,v=t();return l.memoizedState=[v,c],v}function Sv(t,n){var l=ia(),c=n===void 0?null:n,v=l.memoizedState;if(v!==null&&c!==null){var S=v[1];if(ag(c,S))return v[0]}var C=t();return l.memoizedState=[C,c],C}function Sg(t){var n=rs();return n.memoizedState=t,t}function U1(t){var n=ia(),l=ir,c=l.memoizedState;return H1(n,c,t)}function k1(t){var n=ia();if(ir===null)return n.memoizedState=t,t;var l=ir.memoizedState;return H1(n,l,t)}function H1(t,n,l){var c=!Rh(Nl);if(c){if(!On(l,n)){var v=gl();It.lanes=Ze(It.lanes,v),hd(v),t.baseState=!0}return n}else return t.baseState&&(t.baseState=!1,$f()),t.memoizedState=l,l}function rb(t,n,l){var c=kr();Rn(Oh(c,Ps)),t(!0);var v=Vf.transition;Vf.transition={};var S=Vf.transition;Vf.transition._updatedFibers=new Set;try{t(!1),n()}finally{if(Rn(c),Vf.transition=v,v===null&&S._updatedFibers){var C=S._updatedFibers.size;C>10&&g("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),S._updatedFibers.clear()}}}function _g(){var t=cv(!1),n=t[0],l=t[1],c=rb.bind(null,l),v=rs();return v.memoizedState=c,[n,c]}function F1(){var t=fg(),n=t[0],l=ia(),c=l.memoizedState;return[n,c]}function G1(){var t=dg(),n=t[0],l=ia(),c=l.memoizedState;return[n,c]}var B1=!1;function ib(){return B1}function Eg(){var t=rs(),n=Xv(),l=n.identifierPrefix,c;if(d()){var v=Uh();c=":"+l+"R"+v;var S=qf++;S>0&&(c+="H"+S.toString(32)),c+=":"}else{var C=$R++;c=":"+l+"r"+C.toString(32)+":"}return t.memoizedState=c,c}function _v(){var t=ia(),n=t.memoizedState;return n}function ab(t,n,l){typeof arguments[3]=="function"&&p("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var c=Io(t),v={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(j1(t))I1(n,v);else{var S=o1(t,n,v,c);if(S!==null){var C=jr();qn(S,t,c,C),V1(S,n,c)}}Y1(t,c)}function sb(t,n,l){typeof arguments[3]=="function"&&p("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var c=Io(t),v={lane:c,action:l,hasEagerState:!1,eagerState:null,next:null};if(j1(t))I1(n,v);else{var S=t.alternate;if(t.lanes===ce&&(S===null||S.lanes===ce)){var C=n.lastRenderedReducer;if(C!==null){var b;b=Le.current,Le.current=Oa;try{var D=n.lastRenderedState,L=C(D,l);if(v.hasEagerState=!0,v.eagerState=L,On(L,D)){HR(t,n,v,c);return}}catch{}finally{Le.current=b}}}var U=o1(t,n,v,c);if(U!==null){var V=jr();qn(U,t,c,V),V1(U,n,c)}}Y1(t,c)}function j1(t){var n=t.alternate;return t===It||n!==null&&n===It}function I1(t,n){Yf=lv=!0;var l=t.pending;l===null?n.next=n:(n.next=l.next,l.next=n),t.pending=n}function V1(t,n,l){if(Uu(l)){var c=n.lanes;c=wo(c,t.pendingLanes);var v=Ze(c,l);n.lanes=v,Rf(t,v)}}function Y1(t,n,l){ea(t,n)}var Ev={readContext:Vn,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:w},q1=null,W1=null,Q1=null,X1=null,is=null,Oa=null,xv=null;{var xg=function(){p("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},rt=function(){p("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};q1={readContext:function(t){return Vn(t)},useCallback:function(t,n){return ae="useCallback",Ut(),ac(n),gg(t,n)},useContext:function(t){return ae="useContext",Ut(),Vn(t)},useEffect:function(t,n){return ae="useEffect",Ut(),ac(n),hv(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",Ut(),ac(l),mg(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",Ut(),ac(n),vg(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",Ut(),ac(n),pg(t,n)},useMemo:function(t,n){ae="useMemo",Ut(),ac(n);var l=Le.current;Le.current=is;try{return yg(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",Ut();var c=Le.current;Le.current=is;try{return og(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",Ut(),hg(t)},useState:function(t){ae="useState",Ut();var n=Le.current;Le.current=is;try{return cv(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",Ut(),void 0},useDeferredValue:function(t){return ae="useDeferredValue",Ut(),Sg(t)},useTransition:function(){return ae="useTransition",Ut(),_g()},useMutableSource:function(t,n,l){return ae="useMutableSource",Ut(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",Ut(),cg(t,n,l)},useId:function(){return ae="useId",Ut(),Eg()},unstable_isNewReconciler:w},W1={readContext:function(t){return Vn(t)},useCallback:function(t,n){return ae="useCallback",Re(),gg(t,n)},useContext:function(t){return ae="useContext",Re(),Vn(t)},useEffect:function(t,n){return ae="useEffect",Re(),hv(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",Re(),mg(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",Re(),vg(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",Re(),pg(t,n)},useMemo:function(t,n){ae="useMemo",Re();var l=Le.current;Le.current=is;try{return yg(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",Re();var c=Le.current;Le.current=is;try{return og(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",Re(),hg(t)},useState:function(t){ae="useState",Re();var n=Le.current;Le.current=is;try{return cv(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",Re(),void 0},useDeferredValue:function(t){return ae="useDeferredValue",Re(),Sg(t)},useTransition:function(){return ae="useTransition",Re(),_g()},useMutableSource:function(t,n,l){return ae="useMutableSource",Re(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",Re(),cg(t,n,l)},useId:function(){return ae="useId",Re(),Eg()},unstable_isNewReconciler:w},Q1={readContext:function(t){return Vn(t)},useCallback:function(t,n){return ae="useCallback",Re(),yv(t,n)},useContext:function(t){return ae="useContext",Re(),Vn(t)},useEffect:function(t,n){return ae="useEffect",Re(),Xf(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",Re(),mv(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",Re(),vv(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",Re(),pv(t,n)},useMemo:function(t,n){ae="useMemo",Re();var l=Le.current;Le.current=Oa;try{return Sv(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",Re();var c=Le.current;Le.current=Oa;try{return lg(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",Re(),fv()},useState:function(t){ae="useState",Re();var n=Le.current;Le.current=Oa;try{return fg(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",Re(),gv()},useDeferredValue:function(t){return ae="useDeferredValue",Re(),U1(t)},useTransition:function(){return ae="useTransition",Re(),F1()},useMutableSource:function(t,n,l){return ae="useMutableSource",Re(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",Re(),uv(t,n)},useId:function(){return ae="useId",Re(),_v()},unstable_isNewReconciler:w},X1={readContext:function(t){return Vn(t)},useCallback:function(t,n){return ae="useCallback",Re(),yv(t,n)},useContext:function(t){return ae="useContext",Re(),Vn(t)},useEffect:function(t,n){return ae="useEffect",Re(),Xf(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",Re(),mv(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",Re(),vv(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",Re(),pv(t,n)},useMemo:function(t,n){ae="useMemo",Re();var l=Le.current;Le.current=xv;try{return Sv(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",Re();var c=Le.current;Le.current=xv;try{return ug(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",Re(),fv()},useState:function(t){ae="useState",Re();var n=Le.current;Le.current=xv;try{return dg(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",Re(),gv()},useDeferredValue:function(t){return ae="useDeferredValue",Re(),k1(t)},useTransition:function(){return ae="useTransition",Re(),G1()},useMutableSource:function(t,n,l){return ae="useMutableSource",Re(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",Re(),uv(t,n)},useId:function(){return ae="useId",Re(),_v()},unstable_isNewReconciler:w},is={readContext:function(t){return xg(),Vn(t)},useCallback:function(t,n){return ae="useCallback",rt(),Ut(),gg(t,n)},useContext:function(t){return ae="useContext",rt(),Ut(),Vn(t)},useEffect:function(t,n){return ae="useEffect",rt(),Ut(),hv(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",rt(),Ut(),mg(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",rt(),Ut(),vg(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",rt(),Ut(),pg(t,n)},useMemo:function(t,n){ae="useMemo",rt(),Ut();var l=Le.current;Le.current=is;try{return yg(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",rt(),Ut();var c=Le.current;Le.current=is;try{return og(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",rt(),Ut(),hg(t)},useState:function(t){ae="useState",rt(),Ut();var n=Le.current;Le.current=is;try{return cv(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",rt(),Ut(),void 0},useDeferredValue:function(t){return ae="useDeferredValue",rt(),Ut(),Sg(t)},useTransition:function(){return ae="useTransition",rt(),Ut(),_g()},useMutableSource:function(t,n,l){return ae="useMutableSource",rt(),Ut(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",rt(),Ut(),cg(t,n,l)},useId:function(){return ae="useId",rt(),Ut(),Eg()},unstable_isNewReconciler:w},Oa={readContext:function(t){return xg(),Vn(t)},useCallback:function(t,n){return ae="useCallback",rt(),Re(),yv(t,n)},useContext:function(t){return ae="useContext",rt(),Re(),Vn(t)},useEffect:function(t,n){return ae="useEffect",rt(),Re(),Xf(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",rt(),Re(),mv(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",rt(),Re(),vv(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",rt(),Re(),pv(t,n)},useMemo:function(t,n){ae="useMemo",rt(),Re();var l=Le.current;Le.current=Oa;try{return Sv(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",rt(),Re();var c=Le.current;Le.current=Oa;try{return lg(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",rt(),Re(),fv()},useState:function(t){ae="useState",rt(),Re();var n=Le.current;Le.current=Oa;try{return fg(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",rt(),Re(),gv()},useDeferredValue:function(t){return ae="useDeferredValue",rt(),Re(),U1(t)},useTransition:function(){return ae="useTransition",rt(),Re(),F1()},useMutableSource:function(t,n,l){return ae="useMutableSource",rt(),Re(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",rt(),Re(),uv(t,n)},useId:function(){return ae="useId",rt(),Re(),_v()},unstable_isNewReconciler:w},xv={readContext:function(t){return xg(),Vn(t)},useCallback:function(t,n){return ae="useCallback",rt(),Re(),yv(t,n)},useContext:function(t){return ae="useContext",rt(),Re(),Vn(t)},useEffect:function(t,n){return ae="useEffect",rt(),Re(),Xf(t,n)},useImperativeHandle:function(t,n,l){return ae="useImperativeHandle",rt(),Re(),mv(t,n,l)},useInsertionEffect:function(t,n){return ae="useInsertionEffect",rt(),Re(),vv(t,n)},useLayoutEffect:function(t,n){return ae="useLayoutEffect",rt(),Re(),pv(t,n)},useMemo:function(t,n){ae="useMemo",rt(),Re();var l=Le.current;Le.current=Oa;try{return Sv(t,n)}finally{Le.current=l}},useReducer:function(t,n,l){ae="useReducer",rt(),Re();var c=Le.current;Le.current=Oa;try{return ug(t,n,l)}finally{Le.current=c}},useRef:function(t){return ae="useRef",rt(),Re(),fv()},useState:function(t){ae="useState",rt(),Re();var n=Le.current;Le.current=Oa;try{return dg(t)}finally{Le.current=n}},useDebugValue:function(t,n){return ae="useDebugValue",rt(),Re(),gv()},useDeferredValue:function(t){return ae="useDeferredValue",rt(),Re(),k1(t)},useTransition:function(){return ae="useTransition",rt(),Re(),G1()},useMutableSource:function(t,n,l){return ae="useMutableSource",rt(),Re(),void 0},useSyncExternalStore:function(t,n,l){return ae="useSyncExternalStore",rt(),Re(),uv(t,n)},useId:function(){return ae="useId",rt(),Re(),_v()},unstable_isNewReconciler:w}}var Go=u.unstable_now,K1=0,Cv=-1,Kf=-1,Tv=-1,Cg=!1,Rv=!1;function J1(){return Cg}function ob(){Rv=!0}function lb(){Cg=!1,Rv=!1}function ub(){Cg=Rv,Rv=!1}function Z1(){return K1}function $1(){K1=Go()}function Tg(t){Kf=Go(),t.actualStartTime<0&&(t.actualStartTime=Go())}function e_(t){Kf=-1}function bv(t,n){if(Kf>=0){var l=Go()-Kf;t.actualDuration+=l,n&&(t.selfBaseDuration=l),Kf=-1}}function as(t){if(Cv>=0){var n=Go()-Cv;Cv=-1;for(var l=t.return;l!==null;){switch(l.tag){case J:var c=l.stateNode;c.effectDuration+=n;return;case oe:var v=l.stateNode;v.effectDuration+=n;return}l=l.return}}}function Rg(t){if(Tv>=0){var n=Go()-Tv;Tv=-1;for(var l=t.return;l!==null;){switch(l.tag){case J:var c=l.stateNode;c!==null&&(c.passiveEffectDuration+=n);return;case oe:var v=l.stateNode;v!==null&&(v.passiveEffectDuration+=n);return}l=l.return}}}function ss(){Cv=Go()}function bg(){Tv=Go()}function wg(t){for(var n=t.child;n;)t.actualDuration+=n.actualDuration,n=n.sibling}function Al(t,n){return{value:t,source:n,stack:ye(n),digest:null}}function Dg(t,n,l){return{value:t,source:null,stack:l!=null?l:null,digest:n!=null?n:null}}function cb(t,n){return!0}function Og(t,n){try{var l=cb(t,n);if(l===!1)return;var c=n.value,v=n.source,S=n.stack,C=S!==null?S:"";if(c!=null&&c._suppressLogging){if(t.tag===I)return;console.error(c)}var b=v?Be(v):null,D=b?"The above error occurred in the <"+b+"> component:":"The above error occurred in one of your React components:",L;if(t.tag===J)L=`Consider adding an error boundary to your tree to customize error handling behavior. Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.`;else{var U=Be(t)||"Anonymous";L="React will try to recreate this component tree from scratch "+("using the error boundary you provided, "+U+".")}var V=D+` `+C+` `+(""+L);console.error(V)}catch($){setTimeout(function(){throw $})}}var fb=typeof WeakMap=="function"?WeakMap:Map;function t_(t,n,l){var c=Ys(Qt,l);c.tag=Om,c.payload={element:null};var v=n.value;return c.callback=function(){_D(v),Og(t,n)},c}function Ng(t,n,l){var c=Ys(Qt,l);c.tag=Om;var v=t.type.getDerivedStateFromError;if(typeof v=="function"){var S=n.value;c.payload=function(){return v(S)},c.callback=function(){hE(t),Og(t,n)}}var C=t.stateNode;return C!==null&&typeof C.componentDidCatch=="function"&&(c.callback=function(){hE(t),Og(t,n),typeof v!="function"&&yD(this);var D=n.value,L=n.stack;this.componentDidCatch(D,{componentStack:L!==null?L:""}),typeof v!="function"&&(En(t.lanes,$e)||p("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.",Be(t)||"Unknown"))}),c}function n_(t,n,l){var c=t.pingCache,v;if(c===null?(c=t.pingCache=new fb,v=new Set,c.set(n,v)):(v=c.get(n),v===void 0&&(v=new Set,c.set(n,v))),!v.has(l)){v.add(l);var S=ED.bind(null,t,n,l);Fr&&vd(t,l),n.then(S,S)}}function db(t,n,l,c){var v=t.updateQueue;if(v===null){var S=new Set;S.add(l),t.updateQueue=S}else v.add(l)}function hb(t,n){var l=t.tag;if((t.mode&pt)===Xe&&(l===j||l===Ce||l===me)){var c=t.alternate;c?(t.updateQueue=c.updateQueue,t.memoizedState=c.memoizedState,t.lanes=c.lanes):(t.updateQueue=null,t.memoizedState=null)}}function r_(t){var n=t;do{if(n.tag===de&&JR(n))return n;n=n.return}while(n!==null);return null}function i_(t,n,l,c,v){if((t.mode&pt)===Xe){if(t===n)t.flags|=Qn;else{if(t.flags|=yt,l.flags|=z,l.flags&=~(tu|xs),l.tag===I){var S=l.alternate;if(S===null)l.tag=Et;else{var C=Ys(Qt,$e);C.tag=Kh,Uo(l,C,$e)}}l.lanes=Ze(l.lanes,$e)}return t}return t.flags|=Qn,t.lanes=v,t}function vb(t,n,l,c,v){if(l.flags|=xs,Fr&&vd(t,v),c!==null&&typeof c=="object"&&typeof c.then=="function"){var S=c;hb(l),d()&&l.mode&pt&&Uf();var C=r_(n);if(C!==null){C.flags&=~fi,i_(C,n,l,t,v),C.mode&pt&&n_(t,S,v),db(C,t,S);return}else{if(!Th(v)){n_(t,S,v),hy();return}var b=new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");c=b}}else if(d()&&l.mode&pt){Uf();var D=r_(n);if(D!==null){(D.flags&Qn)===ke&&(D.flags|=fi),i_(D,n,l,t,v),m(Al(c,l));return}}c=Al(c,l),cD(c);var L=n;do{switch(L.tag){case J:{var U=c;L.flags|=Qn;var V=Ls(v);L.lanes=Ze(L.lanes,V);var $=t_(L,U,V);Mm(L,$);return}case I:var se=c,fe=L.type,le=L.stateNode;if((L.flags&yt)===ke&&(typeof fe.getDerivedStateFromError=="function"||le!==null&&typeof le.componentDidCatch=="function"&&!iE(le))){L.flags|=Qn;var Ie=Ls(v);L.lanes=Ze(L.lanes,Ie);var et=Ng(L,se,Ie);Mm(L,et);return}break}L=L.return}while(L!==null)}function pb(){return null}var Jf=f.ReactCurrentOwner,Na=!1,Ag,Zf,Mg,Lg,Pg,Ml,zg,wv;Ag={},Zf={},Mg={},Lg={},Pg={},Ml=!1,zg={},wv={};function ni(t,n,l,c){t===null?n.child=C1(n,null,l,c):n.child=ec(n,t.child,l,c)}function mb(t,n,l,c){n.child=ec(n,t.child,null,c),n.child=ec(n,null,l,c)}function a_(t,n,l,c,v){if(n.type!==n.elementType){var S=l.propTypes;S&&pi(S,c,"prop",Qe(l))}var C=l.render,b=n.ref,D,L;$u(n,v),Us(n);{if(Jf.current=n,G(!0),D=sc(t,n,C,c,b,v),L=oc(),n.mode&Lt){bn(!0);try{D=sc(t,n,C,c,b,v),L=oc()}finally{bn(!1)}}G(!1)}return $t(),t!==null&&!Na?(w1(t,n,v),qs(t,n,v)):(d()&&L&&zf(n),n.flags|=nn,ni(t,n,D,v),n.child)}function s_(t,n,l,c,v){if(t===null){var S=l.type;if(HD(S)&&l.compare===null&&l.defaultProps===void 0){var C=S;return C=pc(S),n.tag=me,n.type=C,Hg(n,S),o_(t,n,C,c,v)}{var b=S.propTypes;b&&pi(b,c,"prop",Qe(S))}var D=Cy(l.type,null,c,n,n.mode,v);return D.ref=n.ref,D.return=n,n.child=D,D}{var L=l.type,U=L.propTypes;U&&pi(U,c,"prop",Qe(L))}var V=t.child,$=Vg(t,v);if(!$){var se=V.memoizedProps,fe=l.compare;if(fe=fe!==null?fe:F,fe(se,c)&&t.ref===n.ref)return qs(t,n,v)}n.flags|=nn;var le=kl(V,c);return le.ref=n.ref,le.return=n,n.child=le,le}function o_(t,n,l,c,v){if(n.type!==n.elementType){var S=n.elementType;if(S.$$typeof===un){var C=S,b=C._payload,D=C._init;try{S=D(b)}catch{S=null}var L=S&&S.propTypes;L&&pi(L,c,"prop",Qe(S))}}if(t!==null){var U=t.memoizedProps;if(F(U,c)&&t.ref===n.ref&&n.type===t.type)if(Na=!1,n.pendingProps=c=U,Vg(t,v))(t.flags&z)!==ke&&(Na=!0);else return n.lanes=t.lanes,qs(t,n,v)}return Ug(t,n,l,c,v)}function l_(t,n,l){var c=n.pendingProps,v=c.children,S=t!==null?t.memoizedState:null;if(c.mode==="hidden"||M)if((n.mode&pt)===Xe){var C={baseLanes:ce,cachePool:null,transitions:null};n.memoizedState=C,Jv(n,l)}else if(En(l,Ur)){var V={baseLanes:ce,cachePool:null,transitions:null};n.memoizedState=V;var $=S!==null?S.baseLanes:l;Jv(n,$)}else{var b=null,D;if(S!==null){var L=S.baseLanes;D=Ze(L,l)}else D=l;n.lanes=n.childLanes=Ur;var U={baseLanes:D,cachePool:b,transitions:null};return n.memoizedState=U,n.updateQueue=null,Jv(n,D),null}else{var se;S!==null?(se=Ze(S.baseLanes,l),n.memoizedState=null):se=l,Jv(n,se)}return ni(t,n,v,l),n.child}function gb(t,n,l){var c=n.pendingProps;return ni(t,n,c,l),n.child}function yb(t,n,l){var c=n.pendingProps.children;return ni(t,n,c,l),n.child}function Sb(t,n,l){{n.flags|=at;{var c=n.stateNode;c.effectDuration=0,c.passiveEffectDuration=0}}var v=n.pendingProps,S=v.children;return ni(t,n,S,l),n.child}function u_(t,n){var l=n.ref;(t===null&&l!==null||t!==null&&t.ref!==l)&&(n.flags|=di,n.flags|=be)}function Ug(t,n,l,c,v){if(n.type!==n.elementType){var S=l.propTypes;S&&pi(S,c,"prop",Qe(l))}var C;{var b=qa(n,l,!0);C=_a(n,b)}var D,L;$u(n,v),Us(n);{if(Jf.current=n,G(!0),D=sc(t,n,l,c,C,v),L=oc(),n.mode&Lt){bn(!0);try{D=sc(t,n,l,c,C,v),L=oc()}finally{bn(!1)}}G(!1)}return $t(),t!==null&&!Na?(w1(t,n,v),qs(t,n,v)):(d()&&L&&zf(n),n.flags|=nn,ni(t,n,D,v),n.child)}function c_(t,n,l,c,v){{switch(xE(n)){case!1:{var S=n.stateNode,C=n.type,b=new C(n.memoizedProps,S.context),D=b.state;S.updater.enqueueSetState(S,D,null);break}case!0:{n.flags|=yt,n.flags|=Qn;var L=new Error("Simulated error coming from DevTools"),U=Ls(v);n.lanes=Ze(n.lanes,U);var V=Ng(n,Al(L,n),U);Mm(n,V);break}}if(n.type!==n.elementType){var $=l.propTypes;$&&pi($,c,"prop",Qe(l))}}var se;gr(l)?(se=!0,Wa(n)):se=!1,$u(n,v);var fe=n.stateNode,le;fe===null?(Ov(t,n),y1(n,l,c),Vm(n,l,c,v),le=!0):t===null?le=YR(n,l,c,v):le=qR(t,n,l,c,v);var Ie=kg(t,n,l,le,se,v);{var et=n.stateNode;le&&et.props!==c&&(Ml||p("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.",Be(n)||"a component"),Ml=!0)}return Ie}function kg(t,n,l,c,v,S){u_(t,n);var C=(n.flags&yt)!==ke;if(!c&&!C)return v&&Eo(n,l,!1),qs(t,n,S);var b=n.stateNode;Jf.current=n;var D;if(C&&typeof l.getDerivedStateFromError!="function")D=null,e_();else{Us(n);{if(G(!0),D=b.render(),n.mode&Lt){bn(!0);try{b.render()}finally{bn(!1)}}G(!1)}$t()}return n.flags|=nn,t!==null&&C?mb(t,n,D,S):ni(t,n,D,S),n.memoizedState=b.state,v&&Eo(n,l,!0),n.child}function f_(t){var n=t.stateNode;n.pendingContext?Pn(t,n.pendingContext,n.pendingContext!==n.context):n.context&&Pn(t,n.context,!1),Jm(t,n.containerInfo)}function _b(t,n,l){if(f_(n),t===null)throw new Error("Should have a current fiber. This is a bug in React.");var c=n.pendingProps,v=n.memoizedState,S=v.element;c1(t,n),ev(n,c,null,l);var C=n.memoizedState;n.stateNode;var b=C.element;if(pr&&v.isDehydrated){var D={element:b,isDehydrated:!1,cache:C.cache,pendingSuspenseBoundaries:C.pendingSuspenseBoundaries,transitions:C.transitions},L=n.updateQueue;if(L.baseState=D,n.memoizedState=D,n.flags&fi){var U=Al(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."),n);return d_(t,n,b,l,U)}else if(b!==S){var V=Al(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."),n);return d_(t,n,b,l,V)}else{Em(n);var $=C1(n,null,b,l);n.child=$;for(var se=$;se;)se.flags=se.flags&~Gt|wi,se=se.sibling}}else{if(i(),b===S)return qs(t,n,l);ni(t,n,b,l)}return n.child}function d_(t,n,l,c,v){return i(),m(v),n.flags|=fi,ni(t,n,l,c),n.child}function Eb(t,n,l){T1(n),t===null&&Dl(n);var c=n.type,v=n.pendingProps,S=t!==null?t.memoizedProps:null,C=v.children,b=ru(c,v);return b?C=null:S!==null&&ru(c,S)&&(n.flags|=da),u_(t,n),ni(t,n,C,l),n.child}function xb(t,n){return t===null&&Dl(n),null}function Cb(t,n,l,c){Ov(t,n);var v=n.pendingProps,S=l,C=S._payload,b=S._init,D=b(C);n.type=D;var L=n.tag=FD(D),U=wa(D,v),V;switch(L){case j:return Hg(n,D),n.type=D=pc(D),V=Ug(null,n,D,U,c),V;case I:return n.type=D=gy(D),V=c_(null,n,D,U,c),V;case Ce:return n.type=D=yy(D),V=a_(null,n,D,U,c),V;case he:{if(n.type!==n.elementType){var $=D.propTypes;$&&pi($,U,"prop",Qe(D))}return V=s_(null,n,D,wa(D.type,U),c),V}}var se="";throw D!==null&&typeof D=="object"&&D.$$typeof===un&&(se=" Did you wrap a component in React.lazy() more than once?"),new Error("Element type is invalid. Received a promise that resolves to: "+D+". "+("Lazy element type must resolve to a class or function."+se))}function Tb(t,n,l,c,v){Ov(t,n),n.tag=I;var S;return gr(l)?(S=!0,Wa(n)):S=!1,$u(n,v),y1(n,l,c),Vm(n,l,c,v),kg(null,n,l,!0,S,v)}function Rb(t,n,l,c){Ov(t,n);var v=n.pendingProps,S;{var C=qa(n,l,!1);S=_a(n,C)}$u(n,c);var b,D;Us(n);{if(l.prototype&&typeof l.prototype.render=="function"){var L=Qe(l)||"Unknown";Ag[L]||(p("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.",L,L),Ag[L]=!0)}n.mode&Lt&&te.recordLegacyContextWarning(n,null),G(!0),Jf.current=n,b=sc(null,n,l,v,S,c),D=oc(),G(!1)}if($t(),n.flags|=nn,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0){var U=Qe(l)||"Unknown";Zf[U]||(p("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",U,U,U),Zf[U]=!0)}if(typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0){{var V=Qe(l)||"Unknown";Zf[V]||(p("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.",V,V,V),Zf[V]=!0)}n.tag=I,n.memoizedState=null,n.updateQueue=null;var $=!1;return gr(l)?($=!0,Wa(n)):$=!1,n.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,Am(n),g1(n,b),Vm(n,l,v,c),kg(null,n,l,!0,$,c)}else{if(n.tag=j,n.mode&Lt){bn(!0);try{b=sc(null,n,l,v,S,c),D=oc()}finally{bn(!1)}}return d()&&D&&zf(n),ni(null,n,b,c),Hg(n,l),n.child}}function Hg(t,n){{if(n&&n.childContextTypes&&p("%s(...): childContextTypes cannot be defined on a function component.",n.displayName||n.name||"Component"),t.ref!==null){var l="",c=an();c&&(l+=` Check the render method of \``+c+"`.");var v=c||"",S=t._debugSource;S&&(v=S.fileName+":"+S.lineNumber),Pg[v]||(Pg[v]=!0,p("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s",l))}if(typeof n.getDerivedStateFromProps=="function"){var C=Qe(n)||"Unknown";Lg[C]||(p("%s: Function components do not support getDerivedStateFromProps.",C),Lg[C]=!0)}if(typeof n.contextType=="object"&&n.contextType!==null){var b=Qe(n)||"Unknown";Mg[b]||(p("%s: Function components do not support contextType.",b),Mg[b]=!0)}}}var Fg={dehydrated:null,treeContext:null,retryLane:zn};function Gg(t){return{baseLanes:t,cachePool:pb(),transitions:null}}function bb(t,n){var l=null;return{baseLanes:Ze(t.baseLanes,n),cachePool:l,transitions:t.transitions}}function wb(t,n,l,c){if(n!==null){var v=n.memoizedState;if(v===null)return!1}return $m(t,If)}function Db(t,n){return yl(t.childLanes,n)}function h_(t,n,l){var c=n.pendingProps;TE(n)&&(n.flags|=yt);var v=Da.current,S=!1,C=(n.flags&yt)!==ke;if(C||wb(v,t)?(S=!0,n.flags&=~yt):(t===null||t.memoizedState!==null)&&(v=KR(v,b1)),v=nc(v),Ho(n,v),t===null){Dl(n);var b=n.memoizedState;if(b!==null){var D=b.dehydrated;if(D!==null)return Lb(n,D)}var L=c.children,U=c.fallback;if(S){var V=Ob(n,L,U,l),$=n.child;return $.memoizedState=Gg(l),n.memoizedState=Fg,V}else return Bg(n,L)}else{var se=t.memoizedState;if(se!==null){var fe=se.dehydrated;if(fe!==null)return Pb(t,n,C,c,fe,se,l)}if(S){var le=c.fallback,Ie=c.children,et=Ab(t,n,Ie,le,l),We=n.child,Vt=t.child.memoizedState;return We.memoizedState=Vt===null?Gg(l):bb(Vt,l),We.childLanes=Db(t,l),n.memoizedState=Fg,et}else{var Rt=c.children,K=Nb(t,n,Rt,l);return n.memoizedState=null,K}}}function Bg(t,n,l){var c=t.mode,v={mode:"visible",children:n},S=jg(v,c);return S.return=t,t.child=S,S}function Ob(t,n,l,c){var v=t.mode,S=t.child,C={mode:"hidden",children:n},b,D;return(v&pt)===Xe&&S!==null?(b=S,b.childLanes=ce,b.pendingProps=C,t.mode&ct&&(b.actualDuration=0,b.actualStartTime=-1,b.selfBaseDuration=0,b.treeBaseDuration=0),D=Yo(l,v,c,null)):(b=jg(C,v),D=Yo(l,v,c,null)),b.return=t,D.return=t,b.sibling=D,t.child=b,D}function jg(t,n,l){return pE(t,n,ce,null)}function v_(t,n){return kl(t,n)}function Nb(t,n,l,c){var v=t.child,S=v.sibling,C=v_(v,{mode:"visible",children:l});if((n.mode&pt)===Xe&&(C.lanes=c),C.return=n,C.sibling=null,S!==null){var b=n.deletions;b===null?(n.deletions=[S],n.flags|=ci):b.push(S)}return n.child=C,C}function Ab(t,n,l,c,v){var S=n.mode,C=t.child,b=C.sibling,D={mode:"hidden",children:l},L;if((S&pt)===Xe&&n.child!==C){var U=n.child;L=U,L.childLanes=ce,L.pendingProps=D,n.mode&ct&&(L.actualDuration=0,L.actualStartTime=-1,L.selfBaseDuration=C.selfBaseDuration,L.treeBaseDuration=C.treeBaseDuration),n.deletions=null}else L=v_(C,D),L.subtreeFlags=C.subtreeFlags&fn;var V;return b!==null?V=kl(b,c):(V=Yo(c,S,v,null),V.flags|=Gt),V.return=n,L.return=n,L.sibling=V,n.child=L,V}function Dv(t,n,l,c){c!==null&&m(c),ec(n,t.child,null,l);var v=n.pendingProps,S=v.children,C=Bg(n,S);return C.flags|=Gt,n.memoizedState=null,C}function Mb(t,n,l,c,v){var S=n.mode,C={mode:"visible",children:l},b=jg(C,S),D=Yo(c,S,v,null);return D.flags|=Gt,b.return=n,D.return=n,b.sibling=D,n.child=b,(n.mode&pt)!==Xe&&ec(n,t.child,null,v),D}function Lb(t,n,l){return(t.mode&pt)===Xe?(p("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, ).render(element) or remove the Suspense components from the server rendered components."),t.lanes=$e):ma(n)?t.lanes=Ui:t.lanes=Ur,null}function Pb(t,n,l,c,v,S,C){if(l)if(n.flags&fi){n.flags&=~fi;var K=Dg(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));return Dv(t,n,C,K)}else{if(n.memoizedState!==null)return n.child=t.child,n.flags|=yt,null;var ie=c.children,Q=c.fallback,Se=Mb(t,n,ie,Q,C),Ge=n.child;return Ge.memoizedState=Gg(C),n.memoizedState=Fg,Se}else{if(_m(),(n.mode&pt)===Xe)return Dv(t,n,C,null);if(ma(v)){var b,D,L;{var U=uh(v);b=U.digest,D=U.message,L=U.stack}var V;D?V=new Error(D):V=new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");var $=Dg(V,b,L);return Dv(t,n,C,$)}var se=En(C,t.childLanes);if(Na||se){var fe=Xv();if(fe!==null){var le=Fu(fe,C);if(le!==zn&&le!==S.retryLane){S.retryLane=le;var Ie=Qt;ti(t,le),qn(fe,t,le,Ie)}}hy();var et=Dg(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));return Dv(t,n,C,et)}else if(Ki(v)){n.flags|=yt,n.child=t.child;var We=xD.bind(null,t);return nf(v,We),null}else{yi(n,v,S.treeContext);var Vt=c.children,Rt=Bg(n,Vt);return Rt.flags|=wi,Rt}}}function p_(t,n,l){t.lanes=Ze(t.lanes,n);var c=t.alternate;c!==null&&(c.lanes=Ze(c.lanes,n)),wm(t.return,n,l)}function zb(t,n,l){for(var c=n;c!==null;){if(c.tag===de){var v=c.memoizedState;v!==null&&p_(c,l,t)}else if(c.tag===Dt)p_(c,l,t);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)return;for(;c.sibling===null;){if(c.return===null||c.return===t)return;c=c.return}c.sibling.return=c.return,c=c.sibling}}function Ub(t){for(var n=t,l=null;n!==null;){var c=n.alternate;c!==null&&ov(c)===null&&(l=n),n=n.sibling}return l}function kb(t){if(t!==void 0&&t!=="forwards"&&t!=="backwards"&&t!=="together"&&!zg[t])if(zg[t]=!0,typeof t=="string")switch(t.toLowerCase()){case"together":case"forwards":case"backwards":{p('"%s" is not a valid value for revealOrder on . Use lowercase "%s" instead.',t,t.toLowerCase());break}case"forward":case"backward":{p('"%s" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use "%ss" instead.',t,t.toLowerCase());break}default:p('"%s" is not a supported revealOrder on . Did you mean "together", "forwards" or "backwards"?',t);break}else p('%s is not a supported value for revealOrder on . Did you mean "together", "forwards" or "backwards"?',t)}function Hb(t,n){t!==void 0&&!wv[t]&&(t!=="collapsed"&&t!=="hidden"?(wv[t]=!0,p('"%s" is not a supported value for tail on . Did you mean "collapsed" or "hidden"?',t)):n!=="forwards"&&n!=="backwards"&&(wv[t]=!0,p(' is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?',t)))}function m_(t,n){{var l=vt(t),c=!l&&typeof Te(t)=="function";if(l||c){var v=l?"array":"iterable";return p("A nested %s was passed to row #%s in . Wrap it in an additional SuspenseList to configure its revealOrder: ... {%s} ... ",v,n,v),!1}}return!0}function Fb(t,n){if((n==="forwards"||n==="backwards")&&t!==void 0&&t!==null&&t!==!1)if(vt(t)){for(var l=0;l. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?',n)}}function Ig(t,n,l,c,v){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:l,tailMode:v}:(S.isBackwards=n,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=l,S.tailMode=v)}function g_(t,n,l){var c=n.pendingProps,v=c.revealOrder,S=c.tail,C=c.children;kb(v),Hb(S,v),Fb(C,v),ni(t,n,C,l);var b=Da.current,D=$m(b,If);if(D)b=eg(b,If),n.flags|=yt;else{var L=t!==null&&(t.flags&yt)!==ke;L&&zb(n,n.child,l),b=nc(b)}if(Ho(n,b),(n.mode&pt)===Xe)n.memoizedState=null;else switch(v){case"forwards":{var U=Ub(n.child),V;U===null?(V=n.child,n.child=null):(V=U.sibling,U.sibling=null),Ig(n,!1,V,U,S);break}case"backwards":{var $=null,se=n.child;for(n.child=null;se!==null;){var fe=se.alternate;if(fe!==null&&ov(fe)===null){n.child=se;break}var le=se.sibling;se.sibling=$,$=se,se=le}Ig(n,!0,$,null,S);break}case"together":{Ig(n,!1,null,null,void 0);break}default:n.memoizedState=null}return n.child}function Gb(t,n,l){Jm(n,n.stateNode.containerInfo);var c=n.pendingProps;return t===null?n.child=ec(n,null,c,l):ni(t,n,c,l),n.child}var y_=!1;function Bb(t,n,l){var c=n.type,v=c._context,S=n.pendingProps,C=n.memoizedProps,b=S.value;{"value"in S||y_||(y_=!0,p("The `value` prop is required for the ``. Did you misspell it or forget to pass it?"));var D=n.type.propTypes;D&&pi(D,S,"prop","Context.Provider")}if(s1(n,v,b),C!==null){var L=C.value;if(On(L,b)){if(C.children===S.children&&!_o())return qs(t,n,l)}else zR(n,v,l)}var U=S.children;return ni(t,n,U,l),n.child}var S_=!1;function jb(t,n,l){var c=n.type;c._context===void 0?c!==c.Consumer&&(S_||(S_=!0,p("Rendering directly is not supported and will be removed in a future major release. Did you mean to render instead?"))):c=c._context;var v=n.pendingProps,S=v.children;typeof S!="function"&&p("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."),$u(n,l);var C=Vn(c);Us(n);var b;return Jf.current=n,G(!0),b=S(C),G(!1),$t(),n.flags|=nn,ni(t,n,b,l),n.child}function $f(){Na=!0}function Ov(t,n){(n.mode&pt)===Xe&&t!==null&&(t.alternate=null,n.alternate=null,n.flags|=Gt)}function qs(t,n,l){return t!==null&&(n.dependencies=t.dependencies),e_(),hd(n.lanes),En(l,n.childLanes)?(WR(t,n),n.child):null}function Ib(t,n,l){{var c=n.return;if(c===null)throw new Error("Cannot swap the root fiber.");if(t.alternate=null,n.alternate=null,l.index=n.index,l.sibling=n.sibling,l.return=n.return,l.ref=n.ref,n===c.child)c.child=l;else{var v=c.child;if(v===null)throw new Error("Expected parent to have a child.");for(;v.sibling!==n;)if(v=v.sibling,v===null)throw new Error("Expected to find the previous sibling.");v.sibling=l}var S=c.deletions;return S===null?(c.deletions=[t],c.flags|=ci):S.push(t),l.flags|=Gt,l}}function Vg(t,n){var l=t.lanes;return!!En(l,n)}function Vb(t,n,l){switch(n.tag){case J:f_(n),n.stateNode,i();break;case X:T1(n);break;case I:{var c=n.type;gr(c)&&Wa(n);break}case W:Jm(n,n.stateNode.containerInfo);break;case De:{var v=n.memoizedProps.value,S=n.type._context;s1(n,S,v);break}case oe:{var C=En(l,n.childLanes);C&&(n.flags|=at);{var b=n.stateNode;b.effectDuration=0,b.passiveEffectDuration=0}}break;case de:{var D=n.memoizedState;if(D!==null){if(D.dehydrated!==null)return Ho(n,nc(Da.current)),n.flags|=yt,null;var L=n.child,U=L.childLanes;if(En(l,U))return h_(t,n,l);Ho(n,nc(Da.current));var V=qs(t,n,l);return V!==null?V.sibling:null}else Ho(n,nc(Da.current));break}case Dt:{var $=(t.flags&yt)!==ke,se=En(l,n.childLanes);if($){if(se)return g_(t,n,l);n.flags|=yt}var fe=n.memoizedState;if(fe!==null&&(fe.rendering=null,fe.tail=null,fe.lastEffect=null),Ho(n,Da.current),se)break;return null}case Mt:case cr:return n.lanes=ce,l_(t,n,l)}return qs(t,n,l)}function __(t,n,l){if(n._debugNeedsRemount&&t!==null)return Ib(t,n,Cy(n.type,n.key,n.pendingProps,n._debugOwner||null,n.mode,n.lanes));if(t!==null){var c=t.memoizedProps,v=n.pendingProps;if(c!==v||_o()||n.type!==t.type)Na=!0;else{var S=Vg(t,l);if(!S&&(n.flags&yt)===ke)return Na=!1,Vb(t,n,l);(t.flags&z)!==ke?Na=!0:Na=!1}}else if(Na=!1,d()&&Bs(n)){var C=n.index,b=zh();Rl(n,b,C)}switch(n.lanes=ce,n.tag){case ne:return Rb(t,n,n.type,l);case Ve:{var D=n.elementType;return Cb(t,n,D,l)}case j:{var L=n.type,U=n.pendingProps,V=n.elementType===L?U:wa(L,U);return Ug(t,n,L,V,l)}case I:{var $=n.type,se=n.pendingProps,fe=n.elementType===$?se:wa($,se);return c_(t,n,$,fe,l)}case J:return _b(t,n,l);case X:return Eb(t,n,l);case pe:return xb(t,n);case de:return h_(t,n,l);case W:return Gb(t,n,l);case Ce:{var le=n.type,Ie=n.pendingProps,et=n.elementType===le?Ie:wa(le,Ie);return a_(t,n,le,et,l)}case ue:return gb(t,n,l);case we:return yb(t,n,l);case oe:return Sb(t,n,l);case De:return Bb(t,n,l);case Ae:return jb(t,n,l);case he:{var We=n.type,Vt=n.pendingProps,Rt=wa(We,Vt);if(n.type!==n.elementType){var K=We.propTypes;K&&pi(K,Rt,"prop",Qe(We))}return Rt=wa(We.type,Rt),s_(t,n,We,Rt,l)}case me:return o_(t,n,n.type,n.pendingProps,l);case Et:{var ie=n.type,Q=n.pendingProps,Se=n.elementType===ie?Q:wa(ie,Q);return Tb(t,n,ie,Se,l)}case Dt:return g_(t,n,l);case on:break;case Mt:return l_(t,n,l)}throw new Error("Unknown unit of work tag ("+n.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function os(t){t.flags|=at}function E_(t){t.flags|=di,t.flags|=be}function x_(t,n){var l=t!==null&&t.child===n.child;if(l)return!0;if((n.flags&ci)!==ke)return!1;for(var c=n.child;c!==null;){if((c.flags&yn)!==ke||(c.subtreeFlags&yn)!==ke)return!1;c=c.sibling}return!0}var ed,td,Nv,Av;if(vr)ed=function(t,n,l,c){for(var v=n.child;v!==null;){if(v.tag===X||v.tag===pe)hr(t,v.stateNode);else if(v.tag!==W){if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v===n)return;for(;v.sibling===null;){if(v.return===null||v.return===n)return;v=v.return}v.sibling.return=v.return,v=v.sibling}},td=function(t,n){},Nv=function(t,n,l,c,v){var S=t.memoizedProps;if(S!==c){var C=n.stateNode,b=jf(),D=qc(C,l,S,c,v,b);n.updateQueue=D,D&&os(n)}},Av=function(t,n,l,c){l!==c&&os(n)};else if(bs){ed=function(t,n,l,c){for(var v=n.child;v!==null;){if(v.tag===X){var S=v.stateNode;if(l&&c){var C=v.memoizedProps,b=v.type;S=ol(S,b,C,v)}hr(t,S)}else if(v.tag===pe){var D=v.stateNode;if(l&&c){var L=v.memoizedProps;D=Wr(D,L,v)}hr(t,D)}else if(v.tag!==W){if(v.tag===Mt&&v.memoizedState!==null){var U=v.child;U!==null&&(U.return=v),ed(t,v,!0,!0)}else if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v=v,v===n)return;for(;v.sibling===null;){if(v.return===null||v.return===n)return;v=v.return}v.sibling.return=v.return,v=v.sibling}};var C_=function(t,n,l,c){for(var v=n.child;v!==null;){if(v.tag===X){var S=v.stateNode;if(l&&c){var C=v.memoizedProps,b=v.type;S=ol(S,b,C,v)}ws(t,S)}else if(v.tag===pe){var D=v.stateNode;if(l&&c){var L=v.memoizedProps;D=Wr(D,L,v)}ws(t,D)}else if(v.tag!==W){if(v.tag===Mt&&v.memoizedState!==null){var U=v.child;U!==null&&(U.return=v),C_(t,v,!0,!0)}else if(v.child!==null){v.child.return=v,v=v.child;continue}}if(v=v,v===n)return;for(;v.sibling===null;){if(v.return===null||v.return===n)return;v=v.return}v.sibling.return=v.return,v=v.sibling}};td=function(t,n){var l=n.stateNode,c=x_(t,n);if(!c){var v=l.containerInfo,S=Ai(v);C_(S,n,!1,!1),l.pendingChildren=S,os(n),co(v,S)}},Nv=function(t,n,l,c,v){var S=t.stateNode,C=t.memoizedProps,b=x_(t,n);if(b&&C===c){n.stateNode=S;return}var D=n.stateNode,L=jf(),U=null;if(C!==c&&(U=qc(D,l,C,c,v,L)),b&&U===null){n.stateNode=S;return}var V=dm(S,U,l,C,c,n,b,D);al(V,l,c,v,L)&&os(n),n.stateNode=V,b?os(n):ed(V,n,!1,!1)},Av=function(t,n,l,c){if(l!==c){var v=Km(),S=jf();n.stateNode=sl(c,v,S,n),os(n)}else n.stateNode=t.stateNode}}else td=function(t,n){},Nv=function(t,n,l,c,v){},Av=function(t,n,l,c){};function nd(t,n){if(!d())switch(t.tailMode){case"hidden":{for(var l=t.tail,c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?t.tail=null:c.sibling=null;break}case"collapsed":{for(var v=t.tail,S=null;v!==null;)v.alternate!==null&&(S=v),v=v.sibling;S===null?!n&&t.tail!==null?t.tail.sibling=null:t.tail=null:S.sibling=null;break}}}function br(t){var n=t.alternate!==null&&t.alternate.child===t.child,l=ce,c=ke;if(n){if((t.mode&ct)!==Xe){for(var D=t.selfBaseDuration,L=t.child;L!==null;)l=Ze(l,Ze(L.lanes,L.childLanes)),c|=L.subtreeFlags&fn,c|=L.flags&fn,D+=L.treeBaseDuration,L=L.sibling;t.treeBaseDuration=D}else for(var U=t.child;U!==null;)l=Ze(l,Ze(U.lanes,U.childLanes)),c|=U.subtreeFlags&fn,c|=U.flags&fn,U.return=t,U=U.sibling;t.subtreeFlags|=c}else{if((t.mode&ct)!==Xe){for(var v=t.actualDuration,S=t.selfBaseDuration,C=t.child;C!==null;)l=Ze(l,Ze(C.lanes,C.childLanes)),c|=C.subtreeFlags,c|=C.flags,v+=C.actualDuration,S+=C.treeBaseDuration,C=C.sibling;t.actualDuration=v,t.treeBaseDuration=S}else for(var b=t.child;b!==null;)l=Ze(l,Ze(b.lanes,b.childLanes)),c|=b.subtreeFlags,c|=b.flags,b.return=t,b=b.sibling;t.subtreeFlags|=c}return t.childLanes=l,n}function Yb(t,n,l){if(Cm()&&(n.mode&pt)!==Xe&&(n.flags&yt)===ke)return Ih(n),i(),n.flags|=fi|xs|Qn,!1;var c=Is(n);if(l!==null&&l.dehydrated!==null)if(t===null){if(!c)throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");if(Bh(n),br(n),(n.mode&ct)!==Xe){var v=l!==null;if(v){var S=n.child;S!==null&&(n.treeBaseDuration-=S.treeBaseDuration)}}return!1}else{if(i(),(n.flags&yt)===ke&&(n.memoizedState=null),n.flags|=at,br(n),(n.mode&ct)!==Xe){var C=l!==null;if(C){var b=n.child;b!==null&&(n.treeBaseDuration-=b.treeBaseDuration)}}return!1}else return a(),!0}function T_(t,n,l){var c=n.pendingProps;switch(Ku(n),n.tag){case ne:case Ve:case me:case j:case Ce:case ue:case we:case oe:case Ae:case he:return br(n),null;case I:{var v=n.type;return gr(v)&&Zt(n),br(n),null}case J:{var S=n.stateNode;if(tc(n),Sn(n),ng(),S.pendingContext&&(S.context=S.pendingContext,S.pendingContext=null),t===null||t.child===null){var C=Is(n);if(C)os(n);else if(t!==null){var b=t.memoizedState;(!b.isDehydrated||(n.flags&fi)!==ke)&&(n.flags|=bi,a())}}return td(t,n),br(n),null}case X:{Zm(n);var D=Km(),L=n.type;if(t!==null&&n.stateNode!=null)Nv(t,n,L,c,D),t.ref!==n.ref&&E_(n);else{if(!c){if(n.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");return br(n),null}var U=jf(),V=Is(n);if(V)xm(n,D,U)&&os(n);else{var $=lo(L,c,D,U,n);ed($,n,!1,!1),n.stateNode=$,al($,L,c,D,U)&&os(n)}n.ref!==null&&E_(n)}return br(n),null}case pe:{var se=c;if(t&&n.stateNode!=null){var fe=t.memoizedProps;Av(t,n,fe,se)}else{if(typeof se!="string"&&n.stateNode===null)throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");var le=Km(),Ie=jf(),et=Is(n);et?Gh(n)&&os(n):n.stateNode=sl(se,le,Ie,n)}return br(n),null}case de:{rc(n);var We=n.memoizedState;if(t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){var Vt=Yb(t,n,We);if(!Vt)return n.flags&Qn?n:null}if((n.flags&yt)!==ke)return n.lanes=l,(n.mode&ct)!==Xe&&wg(n),n;var Rt=We!==null,K=t!==null&&t.memoizedState!==null;if(Rt!==K&&Rt){var ie=n.child;if(ie.flags|=ha,(n.mode&pt)!==Xe){var Q=t===null&&(n.memoizedProps.unstable_avoidThisFallback!==!0||!B);Q||$m(Da.current,b1)?uD():hy()}}var Se=n.updateQueue;if(Se!==null&&(n.flags|=at),br(n),(n.mode&ct)!==Xe&&Rt){var Ge=n.child;Ge!==null&&(n.treeBaseDuration-=Ge.treeBaseDuration)}return null}case W:return tc(n),td(t,n),t===null&&im(n.stateNode.containerInfo),br(n),null;case De:var Pe=n.type._context;return bm(Pe,n),br(n),null;case Et:{var Tt=n.type;return gr(Tt)&&Zt(n),br(n),null}case Dt:{rc(n);var nt=n.memoizedState;if(nt===null)return br(n),null;var At=(n.flags&yt)!==ke,mt=nt.rendering;if(mt===null)if(At)nd(nt,!1);else{var sn=fD()&&(t===null||(t.flags&yt)===ke);if(!sn)for(var Ke=n.child;Ke!==null;){var Nn=ov(Ke);if(Nn!==null){At=!0,n.flags|=yt,nd(nt,!1);var Ir=Nn.updateQueue;return Ir!==null&&(n.updateQueue=Ir,n.flags|=at),n.subtreeFlags=ke,QR(n,l),Ho(n,eg(Da.current,If)),n.child}Ke=Ke.sibling}nt.tail!==null&&kn()>Q_()&&(n.flags|=yt,At=!0,nd(nt,!1),n.lanes=Pu)}else{if(!At){var Nr=ov(mt);if(Nr!==null){n.flags|=yt,At=!0;var ji=Nr.updateQueue;if(ji!==null&&(n.updateQueue=ji,n.flags|=at),nd(nt,!0),nt.tail===null&&nt.tailMode==="hidden"&&!mt.alternate&&!d())return br(n),null}else kn()*2-nt.renderingStartTime>Q_()&&l!==Ur&&(n.flags|=yt,At=!0,nd(nt,!1),n.lanes=Pu)}if(nt.isBackwards)mt.sibling=n.child,n.child=mt;else{var ii=nt.last;ii!==null?ii.sibling=mt:n.child=mt,nt.last=mt}}if(nt.tail!==null){var ai=nt.tail;nt.rendering=ai,nt.tail=ai.sibling,nt.renderingStartTime=kn(),ai.sibling=null;var Vr=Da.current;return At?Vr=eg(Vr,If):Vr=nc(Vr),Ho(n,Vr),ai}return br(n),null}case on:break;case Mt:case cr:{dy(n);var Xs=n.memoizedState,mc=Xs!==null;if(t!==null){var md=t.memoizedState,ds=md!==null;ds!==mc&&!M&&(n.flags|=ha)}return!mc||(n.mode&pt)===Xe?br(n):En(cs,Ur)&&(br(n),vr&&n.subtreeFlags&(Gt|at)&&(n.flags|=ha)),null}case Mr:return null;case Yr:return null}throw new Error("Unknown unit of work tag ("+n.tag+"). This error is likely caused by a bug in React. Please file an issue.")}function qb(t,n,l){switch(Ku(n),n.tag){case I:{var c=n.type;gr(c)&&Zt(n);var v=n.flags;return v&Qn?(n.flags=v&~Qn|yt,(n.mode&ct)!==Xe&&wg(n),n):null}case J:{n.stateNode,tc(n),Sn(n),ng();var S=n.flags;return(S&Qn)!==ke&&(S&yt)===ke?(n.flags=S&~Qn|yt,n):null}case X:return Zm(n),null;case de:{rc(n);var C=n.memoizedState;if(C!==null&&C.dehydrated!==null){if(n.alternate===null)throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");i()}var b=n.flags;return b&Qn?(n.flags=b&~Qn|yt,(n.mode&ct)!==Xe&&wg(n),n):null}case Dt:return rc(n),null;case W:return tc(n),null;case De:var D=n.type._context;return bm(D,n),null;case Mt:case cr:return dy(n),null;case Mr:return null;default:return null}}function R_(t,n,l){switch(Ku(n),n.tag){case I:{var c=n.type.childContextTypes;c!=null&&Zt(n);break}case J:{n.stateNode,tc(n),Sn(n),ng();break}case X:{Zm(n);break}case W:tc(n);break;case de:rc(n);break;case Dt:rc(n);break;case De:var v=n.type._context;bm(v,n);break;case Mt:case cr:dy(n);break}}function b_(t,n,l,c,v,S,C,b,D){var L=Array.prototype.slice.call(arguments,3);try{n.apply(l,L)}catch(U){this.onError(U)}}var w_=b_;if(typeof window<"u"&&typeof window.dispatchEvent=="function"&&typeof document<"u"&&typeof document.createEvent=="function"){var Yg=document.createElement("react");w_=function(n,l,c,v,S,C,b,D,L){if(typeof document>"u"||document===null)throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");var U=document.createEvent("Event"),V=!1,$=!0,se=window.event,fe=Object.getOwnPropertyDescriptor(window,"event");function le(){Yg.removeEventListener(ie,et,!1),typeof window.event<"u"&&window.hasOwnProperty("event")&&(window.event=se)}var Ie=Array.prototype.slice.call(arguments,3);function et(){V=!0,le(),l.apply(c,Ie),$=!1}var We,Vt=!1,Rt=!1;function K(Q){if(We=Q.error,Vt=!0,We===null&&Q.colno===0&&Q.lineno===0&&(Rt=!0),Q.defaultPrevented&&We!=null&&typeof We=="object")try{We._suppressLogging=!0}catch{}}var ie="react-"+(n||"invokeguardedcallback");if(window.addEventListener("error",K),Yg.addEventListener(ie,et,!1),U.initEvent(ie,!1,!1),Yg.dispatchEvent(U),fe&&Object.defineProperty(window,"event",fe),V&&$&&(Vt?Rt&&(We=new Error("A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://reactjs.org/link/crossorigin-error for more information.")):We=new Error(`An error was thrown inside one of your components, but React doesn't know what it was. This is likely due to browser flakiness. React does its best to preserve the "Pause on exceptions" behavior of the DevTools, which requires some DEV-mode only tricks. It's possible that these don't work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.`),this.onError(We)),window.removeEventListener("error",K),!V)return le(),b_.apply(this,arguments)}}var Wb=w_,rd=!1,Mv=null,Qb={onError:function(t){rd=!0,Mv=t}};function D_(t,n,l,c,v,S,C,b,D){rd=!1,Mv=null,Wb.apply(Qb,arguments)}function Xb(){return rd}function O_(){if(rd){var t=Mv;return rd=!1,Mv=null,t}else throw new Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.")}var N_=null;N_=new Set;var Lv=!1,wr=!1,Kb=typeof WeakSet=="function"?WeakSet:Set,He=null,lc=null,uc=null;function Jb(t){D_(null,function(){throw t}),O_()}var Zb=function(t,n){if(n.props=t.memoizedProps,n.state=t.memoizedState,t.mode&ct)try{ss(),n.componentWillUnmount()}finally{as(t)}else n.componentWillUnmount()};function A_(t,n){try{Bo(rr,t)}catch(l){Kt(t,n,l)}}function qg(t,n,l){try{Zb(t,l)}catch(c){Kt(t,n,c)}}function $b(t,n,l){try{l.componentDidMount()}catch(c){Kt(t,n,c)}}function M_(t,n){try{P_(t)}catch(l){Kt(t,n,l)}}function cc(t,n){var l=t.ref;if(l!==null)if(typeof l=="function"){var c;try{if(q&&re&&t.mode&ct)try{ss(),c=l(null)}finally{as(t)}else c=l(null)}catch(v){Kt(t,n,v)}typeof c=="function"&&p("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Be(t))}else l.current=null}function Pv(t,n,l){try{l()}catch(c){Kt(t,n,c)}}var L_=!1;function ew(t,n){Lr(t.containerInfo),He=n,tw();var l=L_;return L_=!1,l}function tw(){for(;He!==null;){var t=He,n=t.child;(t.subtreeFlags&ot)!==ke&&n!==null?(n.return=t,He=n):nw()}}function nw(){for(;He!==null;){var t=He;kt(t);try{rw(t)}catch(l){Kt(t,t.return,l)}jt();var n=t.sibling;if(n!==null){n.return=t.return,He=n;return}He=t.return}}function rw(t){var n=t.alternate,l=t.flags;if((l&bi)!==ke){switch(kt(t),t.tag){case j:case Ce:case me:break;case I:{if(n!==null){var c=n.memoizedProps,v=n.memoizedState,S=t.stateNode;t.type===t.elementType&&!Ml&&(S.props!==t.memoizedProps&&p("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Be(t)||"instance"),S.state!==t.memoizedState&&p("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Be(t)||"instance"));var C=S.getSnapshotBeforeUpdate(t.elementType===t.type?c:wa(t.type,c),v);{var b=N_;C===void 0&&!b.has(t.type)&&(b.add(t.type),p("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.",Be(t)))}S.__reactInternalSnapshotBeforeUpdate=C}break}case J:{if(vr){var D=t.stateNode;lh(D.containerInfo)}break}case X:case pe:case W:case Et:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}jt()}}function Aa(t,n,l){var c=n.updateQueue,v=c!==null?c.lastEffect:null;if(v!==null){var S=v.next,C=S;do{if((C.tag&t)===t){var b=C.destroy;C.destroy=void 0,b!==void 0&&((t&Rr)!==_i?wn(n):(t&rr)!==_i&&Dn(n),(t&ns)!==_i&&pd(!0),Pv(n,l,b),(t&ns)!==_i&&pd(!1),(t&Rr)!==_i?$n():(t&rr)!==_i&&Mo())}C=C.next}while(C!==S)}}function Bo(t,n){var l=n.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var v=c.next,S=v;do{if((S.tag&t)===t){(t&Rr)!==_i?dt(n):(t&rr)!==_i&&Zr(n);var C=S.create;(t&ns)!==_i&&pd(!0),S.destroy=C(),(t&ns)!==_i&&pd(!1),(t&Rr)!==_i?jn():(t&rr)!==_i&&Ao();{var b=S.destroy;if(b!==void 0&&typeof b!="function"){var D=void 0;(S.tag&rr)!==ke?D="useLayoutEffect":(S.tag&ns)!==ke?D="useInsertionEffect":D="useEffect";var L=void 0;b===null?L=" You returned null. If your effect does not require clean up, return undefined (or nothing).":typeof b.then=="function"?L=` It looks like you wrote `+D+`(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately: `+D+`(() => { async function fetchData() { // You can await here const response = await MyAPI.getData(someId); // ... } fetchData(); }, [someId]); // Or [] if effect doesn't need props or state Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching`:L=" You returned: "+b,p("%s must not return anything besides a function, which is used for clean-up.%s",D,L)}}}S=S.next}while(S!==v)}}function iw(t,n){if((n.flags&at)!==ke)switch(n.tag){case oe:{var l=n.stateNode.passiveEffectDuration,c=n.memoizedProps,v=c.id,S=c.onPostCommit,C=Z1(),b=n.alternate===null?"mount":"update";J1()&&(b="nested-update"),typeof S=="function"&&S(v,b,l,C);var D=n.return;e:for(;D!==null;){switch(D.tag){case J:var L=D.stateNode;L.passiveEffectDuration+=l;break e;case oe:var U=D.stateNode;U.passiveEffectDuration+=l;break e}D=D.return}break}}}function aw(t,n,l,c){if((l.flags&qt)!==ke)switch(l.tag){case j:case Ce:case me:{if(!wr)if(l.mode&ct)try{ss(),Bo(rr|nr,l)}finally{as(l)}else Bo(rr|nr,l);break}case I:{var v=l.stateNode;if(l.flags&at&&!wr)if(n===null)if(l.type===l.elementType&&!Ml&&(v.props!==l.memoizedProps&&p("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Be(l)||"instance"),v.state!==l.memoizedState&&p("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Be(l)||"instance")),l.mode&ct)try{ss(),v.componentDidMount()}finally{as(l)}else v.componentDidMount();else{var S=l.elementType===l.type?n.memoizedProps:wa(l.type,n.memoizedProps),C=n.memoizedState;if(l.type===l.elementType&&!Ml&&(v.props!==l.memoizedProps&&p("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Be(l)||"instance"),v.state!==l.memoizedState&&p("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Be(l)||"instance")),l.mode&ct)try{ss(),v.componentDidUpdate(S,C,v.__reactInternalSnapshotBeforeUpdate)}finally{as(l)}else v.componentDidUpdate(S,C,v.__reactInternalSnapshotBeforeUpdate)}var b=l.updateQueue;b!==null&&(l.type===l.elementType&&!Ml&&(v.props!==l.memoizedProps&&p("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.",Be(l)||"instance"),v.state!==l.memoizedState&&p("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.",Be(l)||"instance")),d1(l,b,v));break}case J:{var D=l.updateQueue;if(D!==null){var L=null;if(l.child!==null)switch(l.child.tag){case X:L=Bt(l.child.stateNode);break;case I:L=l.child.stateNode;break}d1(l,D,L)}break}case X:{var U=l.stateNode;if(n===null&&l.flags&at){var V=l.type,$=l.memoizedProps;um(U,V,$,l)}break}case pe:break;case W:break;case oe:{{var se=l.memoizedProps,fe=se.onCommit,le=se.onRender,Ie=l.stateNode.effectDuration,et=Z1(),We=n===null?"mount":"update";J1()&&(We="nested-update"),typeof le=="function"&&le(l.memoizedProps.id,We,l.actualDuration,l.treeBaseDuration,l.actualStartTime,et);{typeof fe=="function"&&fe(l.memoizedProps.id,We,Ie,et),mD(l);var Vt=l.return;e:for(;Vt!==null;){switch(Vt.tag){case J:var Rt=Vt.stateNode;Rt.effectDuration+=Ie;break e;case oe:var K=Vt.stateNode;K.effectDuration+=Ie;break e}Vt=Vt.return}}}break}case de:{vw(t,l);break}case Dt:case Et:case on:case Mt:case cr:case Yr:break;default:throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.")}wr||l.flags&di&&P_(l)}function sw(t){switch(t.tag){case j:case Ce:case me:{if(t.mode&ct)try{ss(),A_(t,t.return)}finally{as(t)}else A_(t,t.return);break}case I:{var n=t.stateNode;typeof n.componentDidMount=="function"&&$b(t,t.return,n),M_(t,t.return);break}case X:{M_(t,t.return);break}}}function ow(t,n){var l=null;if(vr)for(var c=t;;){if(c.tag===X){if(l===null){l=c;try{var v=c.stateNode;n?Ni(v):ou(c.stateNode,c.memoizedProps)}catch(C){Kt(t,t.return,C)}}}else if(c.tag===pe){if(l===null)try{var S=c.stateNode;n?va(S):tf(S,c.memoizedProps)}catch(C){Kt(t,t.return,C)}}else if(!((c.tag===Mt||c.tag===cr)&&c.memoizedState!==null&&c!==t)){if(c.child!==null){c.child.return=c,c=c.child;continue}}if(c===t)return;for(;c.sibling===null;){if(c.return===null||c.return===t)return;l===c&&(l=null),c=c.return}l===c&&(l=null),c.sibling.return=c.return,c=c.sibling}}function P_(t){var n=t.ref;if(n!==null){var l=t.stateNode,c;switch(t.tag){case X:c=Bt(l);break;default:c=l}if(typeof n=="function"){var v;if(t.mode&ct)try{ss(),v=n(c)}finally{as(t)}else v=n(c);typeof v=="function"&&p("Unexpected return value from a callback ref in %s. A callback ref should not return a function.",Be(t))}else n.hasOwnProperty("current")||p("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().",Be(t)),n.current=c}}function lw(t){var n=t.alternate;n!==null&&(n.return=null),t.return=null}function z_(t){var n=t.alternate;n!==null&&(t.alternate=null,z_(n));{if(t.child=null,t.deletions=null,t.sibling=null,t.tag===X){var l=t.stateNode;l!==null&&Xc(l)}t.stateNode=null,t._debugOwner=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}}function uw(t){if(!!bs){var n=t.stateNode,l=n.containerInfo,c=Ai(l);fo(l,c)}}function cw(t){for(var n=t.return;n!==null;){if(U_(n))return n;n=n.return}throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.")}function U_(t){return t.tag===X||t.tag===J||t.tag===W}function k_(t){var n=t;e:for(;;){for(;n.sibling===null;){if(n.return===null||U_(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==X&&n.tag!==pe&&n.tag!==it;){if(n.flags&Gt||n.child===null||n.tag===W)continue e;n.child.return=n,n=n.child}if(!(n.flags&Gt))return n.stateNode}}function fw(t){if(!!vr){var n=cw(t);switch(n.tag){case X:{var l=n.stateNode;n.flags&da&&(oh(l),n.flags&=~da);var c=k_(t);Qg(t,c,l);break}case J:case W:{var v=n.stateNode.containerInfo,S=k_(t);Wg(t,S,v);break}default:throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.")}}}function Wg(t,n,l){var c=t.tag,v=c===X||c===pe;if(v){var S=t.stateNode;n?su(l,S,n):Gn(l,S)}else if(c!==W){var C=t.child;if(C!==null){Wg(C,n,l);for(var b=C.sibling;b!==null;)Wg(b,n,l),b=b.sibling}}}function Qg(t,n,l){var c=t.tag,v=c===X||c===pe;if(v){var S=t.stateNode;n?cm(l,S,n):lm(l,S)}else if(c!==W){var C=t.child;if(C!==null){Qg(C,n,l);for(var b=C.sibling;b!==null;)Qg(b,n,l),b=b.sibling}}}var Dr=null,Ma=!1;function dw(t,n,l){if(vr){var c=n;e:for(;c!==null;){switch(c.tag){case X:{Dr=c.stateNode,Ma=!1;break e}case J:{Dr=c.stateNode.containerInfo,Ma=!0;break e}case W:{Dr=c.stateNode.containerInfo,Ma=!0;break e}}c=c.return}if(Dr===null)throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");Xg(t,n,l),Dr=null,Ma=!1}else Xg(t,n,l);lw(l)}function ls(t,n,l){for(var c=l.child;c!==null;)Xg(t,n,c),c=c.sibling}function Xg(t,n,l){switch(Nf(l),l.tag){case X:wr||cc(l,n);case pe:{if(vr){var c=Dr,v=Ma;Dr=null,ls(t,n,l),Dr=c,Ma=v,Dr!==null&&(Ma?fm(Dr,l.stateNode):Xi(Dr,l.stateNode))}else ls(t,n,l);return}case it:{vr&&Dr!==null&&(Ma?lu(Dr,l.stateNode):dh(Dr,l.stateNode));return}case W:{if(vr){var S=Dr,C=Ma;Dr=l.stateNode.containerInfo,Ma=!0,ls(t,n,l),Dr=S,Ma=C}else uw(l),ls(t,n,l);return}case j:case Ce:case he:case me:{if(!wr){var b=l.updateQueue;if(b!==null){var D=b.lastEffect;if(D!==null){var L=D.next,U=L;do{var V=U,$=V.destroy,se=V.tag;$!==void 0&&((se&ns)!==_i?Pv(l,n,$):(se&rr)!==_i&&(Dn(l),l.mode&ct?(ss(),Pv(l,n,$),as(l)):Pv(l,n,$),Mo())),U=U.next}while(U!==L)}}}ls(t,n,l);return}case I:{if(!wr){cc(l,n);var fe=l.stateNode;typeof fe.componentWillUnmount=="function"&&qg(l,n,fe)}ls(t,n,l);return}case on:{ls(t,n,l);return}case Mt:{if(l.mode&pt){var le=wr;wr=le||l.memoizedState!==null,ls(t,n,l),wr=le}else ls(t,n,l);break}default:{ls(t,n,l);return}}}function hw(t){t.memoizedState}function vw(t,n){if(!!pr){var l=n.memoizedState;if(l===null){var c=n.alternate;if(c!==null){var v=c.memoizedState;if(v!==null){var S=v.dehydrated;S!==null&&af(S)}}}}}function H_(t){var n=t.updateQueue;if(n!==null){t.updateQueue=null;var l=t.stateNode;l===null&&(l=t.stateNode=new Kb),n.forEach(function(c){var v=CD.bind(null,t,c);if(!l.has(c)){if(l.add(c),Fr)if(lc!==null&&uc!==null)vd(uc,lc);else throw Error("Expected finished root and lanes to be set. This is a bug in React.");c.then(v,v)}})}}function pw(t,n,l){lc=l,uc=t,kt(n),F_(n,t),kt(n),lc=null,uc=null}function La(t,n,l){var c=n.deletions;if(c!==null)for(var v=0;v=0)return!0}break;case Hv:if(t.tag===X){var v=t.memoizedProps["data-testname"];if(typeof v=="string"&&v.toLowerCase()===n.value.toLowerCase())return!0}break;default:throw new Error("Invalid selector type specified.")}return!1}function $g(t){switch(t.$$typeof){case zv:var n=Qe(t.value)||"Unknown";return"<"+n+">";case Uv:return":has("+($g(t)||"")+")";case kv:return'[role="'+t.value+'"]';case Fv:return'"'+t.value+'"';case Hv:return'[data-testname="'+t.value+'"]';default:throw new Error("Invalid selector type specified.")}}function I_(t,n){for(var l=[],c=[t,0],v=0;vc&&(c=D)),D ")+` `)+`No matching component was found for: `+(" "+V.join(" > "))}return null}function Bw(t,n){if(!Qi)throw new Error("Test selector API is not supported by this renderer.");for(var l=Gv(t,n),c=[],v=0;v0;S--)for(var C=c[S],b=C.x,D=b+C.width,L=C.y,U=L+C.height,V=S-1;V>=0;V--)if(S!==V){var $=c[V],se=$.x,fe=se+$.width,le=$.y,Ie=le+$.height;if(b>=se&&L>=le&&D<=fe&&U<=Ie){c.splice(S,1);break}else if(b===se&&C.width===$.width&&!(IeU)){le>L&&($.height+=le-L,$.y=L),IeD)){se>b&&($.width+=se-b,$.x=b),fe=0&&Bv.splice(U,1),C()}}}var Yw=f.ReactCurrentActQueue;function qw(t){{var n=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0,l=typeof jest<"u";return rm&&l&&n!==!1}}function V_(){{var t=typeof IS_REACT_ACT_ENVIRONMENT<"u"?IS_REACT_ACT_ENVIRONMENT:void 0;return!t&&Yw.current!==null&&p("The current testing environment is not configured to support act(...)"),t}}var Ww=Math.ceil,ey=f.ReactCurrentDispatcher,ty=f.ReactCurrentOwner,xn=f.ReactCurrentBatchConfig,Pa=f.ReactCurrentActQueue,Yn=0,ny=1,Or=2,aa=4,Ws=0,ad=1,Ll=2,jv=3,sd=4,Y_=5,ry=6,ft=Yn,ri=null,Cn=null,sr=ce,cs=ce,iy=Kr(ce),or=Ws,od=null,Iv=ce,ld=ce,Vv=ce,ud=null,Ei=null,ay=0,q_=500,W_=1/0,Qw=500,Qs=null;function fc(){W_=kn()+Qw}function Q_(){return W_}var Yv=!1,sy=null,dc=null,Pl=!1,jo=null,cd=ce,oy=[],ly=null,Xw=50,fd=0,uy=null,cy=!1,qv=!1,Kw=50,hc=0,Wv=null,dd=Qt,Qv=ce,X_=!1;function Xv(){return ri}function jr(){return(ft&(Or|aa))!==Yn?kn():(dd!==Qt||(dd=kn()),dd)}function Io(t){var n=t.mode;if((n&pt)===Xe)return $e;if((ft&Or)!==Yn&&sr!==ce)return Ls(sr);var l=N()!==E;if(l){if(xn.transition!==null){var c=xn.transition;c._updatedFibers||(c._updatedFibers=new Set),c._updatedFibers.add(t)}return Qv===zn&&(Qv=gl()),Qv}var v=kr();if(v!==zn)return v;var S=am();return S}function Jw(t){var n=t.mode;return(n&pt)===Xe?$e:mm()}function qn(t,n,l,c){RD(),X_&&p("useInsertionEffect must not schedule updates."),cy&&(qv=!0),Oo(t,l,c),(ft&Or)!==ce&&t===ri?DD(n):(Fr&&Jn(t,n,l),OD(n),t===ri&&((ft&Or)===Yn&&(ld=Ze(ld,l)),or===sd&&Vo(t,sr)),xi(t,c),l===$e&&ft===Yn&&(n.mode&pt)===Xe&&!Pa.isBatchingLegacy&&(fc(),er()))}function Zw(t,n,l){var c=t.current;c.lanes=n,Oo(t,n,l),xi(t,l)}function $w(t){return(ft&Or)!==Yn}function xi(t,n){var l=t.callbackNode;xh(t,n);var c=vl(t,t===ri?sr:ce);if(c===ce){l!==null&&cE(l),t.callbackNode=null,t.callbackPriority=zn;return}var v=Ja(c),S=t.callbackPriority;if(S===v&&!(Pa.current!==null&&l!==my)){l==null&&S!==$e&&p("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");return}l!=null&&cE(l);var C;if(v===$e)t.tag===_n?(Pa.isBatchingLegacy!==null&&(Pa.didScheduleLegacyUpdate=!0),Qu(Z_.bind(null,t))):Tl(Z_.bind(null,t)),ah?Pa.current!==null?Pa.current.push(tr):Kc(function(){(ft&(Or|aa))===Yn&&tr()}):tp(Hr,tr),C=null;else{var b;switch(Bu(c)){case Cr:b=Hr;break;case Ps:b=Df;break;case No:b=Tr;break;case bf:b=Ah;break;default:b=Tr;break}C=tp(b,K_.bind(null,t))}t.callbackPriority=v,t.callbackNode=C}function K_(t,n){if(lb(),dd=Qt,Qv=ce,(ft&(Or|aa))!==Yn)throw new Error("Should not already be working.");var l=t.callbackNode,c=fs();if(c&&t.callbackNode!==l)return null;var v=vl(t,t===ri?sr:ce);if(v===ce)return null;var S=!To(t,v)&&!bh(t,v)&&!n,C=S?hD(t,v):Zv(t,v);if(C!==Ws){if(C===Ll){var b=pl(t);b!==ce&&(v=b,C=fy(t,b))}if(C===ad){var D=od;throw zl(t,ce),Vo(t,v),xi(t,kn()),D}if(C===ry)Vo(t,v);else{var L=!To(t,v),U=t.current.alternate;if(L&&!tD(U)){if(C=Zv(t,v),C===Ll){var V=pl(t);V!==ce&&(v=V,C=fy(t,V))}if(C===ad){var $=od;throw zl(t,ce),Vo(t,v),xi(t,kn()),$}}t.finishedWork=U,t.finishedLanes=v,eD(t,C,v)}}return xi(t,kn()),t.callbackNode===l?K_.bind(null,t):null}function fy(t,n){var l=ud;if($r(t)){var c=zl(t,n);c.flags|=fi,mo(t.containerInfo)}var v=Zv(t,n);if(v!==Ll){var S=Ei;Ei=l,S!==null&&J_(S)}return v}function J_(t){Ei===null?Ei=t:Ei.push.apply(Ei,t)}function eD(t,n,l){switch(n){case Ws:case ad:throw new Error("Root did not complete. This is a bug in React.");case Ll:{Ul(t,Ei,Qs);break}case jv:{if(Vo(t,l),Cf(l)&&!fE()){var c=ay+q_-kn();if(c>10){var v=vl(t,ce);if(v!==ce)break;var S=t.suspendedLanes;if(!bo(S,l)){jr(),Kn(t,S);break}t.timeoutHandle=Wc(Ul.bind(null,t,Ei,Qs),c);break}}Ul(t,Ei,Qs);break}case sd:{if(Vo(t,l),Tf(l))break;if(!fE()){var C=_h(t,l),b=C,D=kn()-b,L=TD(D)-D;if(L>10){t.timeoutHandle=Wc(Ul.bind(null,t,Ei,Qs),L);break}}Ul(t,Ei,Qs);break}case Y_:{Ul(t,Ei,Qs);break}default:throw new Error("Unknown root exit status.")}}function tD(t){for(var n=t;;){if(n.flags&Es){var l=n.updateQueue;if(l!==null){var c=l.stores;if(c!==null)for(var v=0;v0&&(vd(t,sr),v.clear()),wh(t,n)}Qs=ze(),zl(t,n)}Yu(n);do try{dD();break}catch(S){$_(t,S)}while(!0);if(Qh(),ft=l,tE(c),Cn!==null)throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");return Hs(),ri=null,sr=ce,or}function dD(){for(;Cn!==null;)nE(Cn)}function hD(t,n){var l=ft;ft|=Or;var c=eE();if(ri!==t||sr!==n){if(Fr){var v=t.memoizedUpdaters;v.size>0&&(vd(t,sr),v.clear()),wh(t,n)}Qs=ze(),fc(),zl(t,n)}Yu(n);do try{vD();break}catch(S){$_(t,S)}while(!0);return Qh(),tE(c),ft=l,Cn!==null?(Ta(),Ws):(Hs(),ri=null,sr=ce,or)}function vD(){for(;Cn!==null&&!$i();)nE(Cn)}function nE(t){var n=t.alternate;kt(t);var l;(t.mode&ct)!==Xe?(Tg(t),l=vy(n,t,cs),bv(t,!0)):l=vy(n,t,cs),jt(),t.memoizedProps=t.pendingProps,l===null?rE(t):Cn=l,ty.current=null}function rE(t){var n=t;do{var l=n.alternate,c=n.return;if((n.flags&xs)===ke){kt(n);var v=void 0;if((n.mode&ct)===Xe?v=T_(l,n,cs):(Tg(n),v=T_(l,n,cs),bv(n,!1)),jt(),v!==null){Cn=v;return}}else{var S=qb(l,n);if(S!==null){S.flags&=rl,Cn=S;return}if((n.mode&ct)!==Xe){bv(n,!1);for(var C=n.actualDuration,b=n.child;b!==null;)C+=b.actualDuration,b=b.sibling;n.actualDuration=C}if(c!==null)c.flags|=xs,c.subtreeFlags=ke,c.deletions=null;else{or=ry,Cn=null;return}}var D=n.sibling;if(D!==null){Cn=D;return}n=c,Cn=n}while(n!==null);or===Ws&&(or=Y_)}function Ul(t,n,l){var c=kr(),v=xn.transition;try{xn.transition=null,Rn(Cr),pD(t,n,l,c)}finally{xn.transition=v,Rn(c)}return null}function pD(t,n,l,c){do fs();while(jo!==null);if(bD(),(ft&(Or|aa))!==Yn)throw new Error("Should not already be working.");var v=t.finishedWork,S=t.finishedLanes;if(ym(S),v===null)return El(),null;if(S===ce&&p("root.finishedLanes should not be empty during a commit. This is a bug in React."),t.finishedWork=null,t.finishedLanes=ce,v===t.current)throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");t.callbackNode=null,t.callbackPriority=zn;var C=Ze(v.lanes,v.childLanes);gm(t,C),t===ri&&(ri=null,Cn=null,sr=ce),((v.subtreeFlags&Wt)!==ke||(v.flags&Wt)!==ke)&&(Pl||(Pl=!0,ly=l,tp(Tr,function(){return fs(),null})));var b=(v.subtreeFlags&(ot|yn|qt|Wt))!==ke,D=(v.flags&(ot|yn|qt|Wt))!==ke;if(b||D){var L=xn.transition;xn.transition=null;var U=kr();Rn(Cr);var V=ft;ft|=aa,ty.current=null,ew(t,v),$1(),pw(t,v,S),Rs(t.containerInfo),t.current=v,Mf(S),mw(v,t,S),xl(),wf(),ft=V,Rn(U),xn.transition=L}else t.current=v,$1();var $=Pl;if(Pl?(Pl=!1,jo=t,cd=S):(hc=0,Wv=null),C=t.pendingLanes,C===ce&&(dc=null),$||oE(t.current,!1),_l(v.stateNode,c),Fr&&t.memoizedUpdaters.clear(),Iw(),xi(t,kn()),n!==null)for(var se=t.onRecoverableError,fe=0;feXw)throw fd=0,uy=null,new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");hc>Kw&&(hc=0,Wv=null,p("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."))}function bD(){te.flushLegacyContextWarning(),te.flushPendingUnsafeLifecycleWarnings()}function oE(t,n){kt(t),$v(t,ht,Mw),n&&$v(t,ut,Lw),$v(t,ht,Nw),n&&$v(t,ut,Aw),jt()}function $v(t,n,l){for(var c=t,v=null;c!==null;){var S=c.subtreeFlags&n;c!==v&&c.child!==null&&S!==ke?c=c.child:((c.flags&n)!==ke&&l(c),c.sibling!==null?c=c.sibling:c=v=c.return)}}var ep=null;function lE(t){{if((ft&Or)!==Yn||!(t.mode&pt))return;var n=t.tag;if(n!==ne&&n!==J&&n!==I&&n!==j&&n!==Ce&&n!==he&&n!==me)return;var l=Be(t)||"ReactComponent";if(ep!==null){if(ep.has(l))return;ep.add(l)}else ep=new Set([l]);var c=Ye;try{kt(t),p("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.")}finally{c?kt(t):jt()}}}var vy;{var wD=null;vy=function(t,n,l){var c=mE(wD,n);try{return __(t,n,l)}catch(S){if(Hh()||S!==null&&typeof S=="object"&&typeof S.then=="function")throw S;if(Qh(),D1(),R_(t,n),mE(n,c),n.mode&ct&&Tg(n),D_(null,__,null,t,n,l),Xb()){var v=O_();typeof v=="object"&&v!==null&&v._suppressLogging&&typeof S=="object"&&S!==null&&!S._suppressLogging&&(S._suppressLogging=!0)}throw S}}}var uE=!1,py;py=new Set;function DD(t){if(Ne&&!ib())switch(t.tag){case j:case Ce:case me:{var n=Cn&&Be(Cn)||"Unknown",l=n;if(!py.has(l)){py.add(l);var c=Be(t)||"Unknown";p("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render",c,n,n)}break}case I:{uE||(p("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."),uE=!0);break}}}function vd(t,n){if(Fr){var l=t.memoizedUpdaters;l.forEach(function(c){Jn(t,c,n)})}}var my={};function tp(t,n){{var l=Pa.current;return l!==null?(l.push(n),my):Bn(t,n)}}function cE(t){if(t!==my)return Hi(t)}function fE(){return Pa.current!==null}function OD(t){{if(t.mode&pt){if(!V_())return}else if(!qw()||ft!==Yn||t.tag!==j&&t.tag!==Ce&&t.tag!==me)return;if(Pa.current===null){var n=Ye;try{kt(t),p(`An update to %s inside a test was not wrapped in act(...). When testing, code that causes React state updates should be wrapped into act(...): act(() => { /* fire events that update state */ }); /* assert on the output */ This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`,Be(t))}finally{n?kt(t):jt()}}}}function ND(t){t.tag!==_n&&V_()&&Pa.current===null&&p(`A suspended resource finished loading inside a test, but the event was not wrapped in act(...). When testing, code that resolves suspended data should be wrapped into act(...): act(() => { /* finish loading suspended data */ }); /* assert on the output */ This ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act`)}function pd(t){X_=t}var sa=null,vc=null,AD=function(t){sa=t};function pc(t){{if(sa===null)return t;var n=sa(t);return n===void 0?t:n.current}}function gy(t){return pc(t)}function yy(t){{if(sa===null)return t;var n=sa(t);if(n===void 0){if(t!=null&&typeof t.render=="function"){var l=pc(t.render);if(t.render!==l){var c={$$typeof:oi,render:l};return t.displayName!==void 0&&(c.displayName=t.displayName),c}}return t}return n.current}}function dE(t,n){{if(sa===null)return!1;var l=t.elementType,c=n.type,v=!1,S=typeof c=="object"&&c!==null?c.$$typeof:null;switch(t.tag){case I:{typeof c=="function"&&(v=!0);break}case j:{(typeof c=="function"||S===un)&&(v=!0);break}case Ce:{(S===oi||S===un)&&(v=!0);break}case he:case me:{(S===ca||S===un)&&(v=!0);break}default:return!1}if(v){var C=sa(l);if(C!==void 0&&C===sa(c))return!0}return!1}}function hE(t){{if(sa===null||typeof WeakSet!="function")return;vc===null&&(vc=new WeakSet),vc.add(t)}}var MD=function(t,n){{if(sa===null)return;var l=n.staleFamilies,c=n.updatedFamilies;fs(),Kv(function(){Sy(t.current,c,l)})}},LD=function(t,n){{if(t.context!==Pr)return;fs(),Kv(function(){SE(n,t,null,null)})}};function Sy(t,n,l){{var c=t.alternate,v=t.child,S=t.sibling,C=t.tag,b=t.type,D=null;switch(C){case j:case me:case I:D=b;break;case Ce:D=b.render;break}if(sa===null)throw new Error("Expected resolveFamily to be set during hot reload.");var L=!1,U=!1;if(D!==null){var V=sa(D);V!==void 0&&(l.has(V)?U=!0:n.has(V)&&(C===I?U=!0:L=!0))}if(vc!==null&&(vc.has(t)||c!==null&&vc.has(c))&&(U=!0),U&&(t._debugNeedsRemount=!0),U||L){var $=ti(t,$e);$!==null&&qn($,t,$e,Qt)}v!==null&&!U&&Sy(v,n,l),S!==null&&Sy(S,n,l)}}var PD=function(t,n){{var l=new Set,c=new Set(n.map(function(v){return v.current}));return _y(t.current,c,l),l}};function _y(t,n,l){{var c=t.child,v=t.sibling,S=t.tag,C=t.type,b=null;switch(S){case j:case me:case I:b=C;break;case Ce:b=C.render;break}var D=!1;b!==null&&n.has(b)&&(D=!0),D?zD(t,l):c!==null&&_y(c,n,l),v!==null&&_y(v,n,l)}}function zD(t,n){{var l=UD(t,n);if(l)return;for(var c=t;;){switch(c.tag){case X:n.add(c.stateNode);return;case W:n.add(c.stateNode.containerInfo);return;case J:n.add(c.stateNode.containerInfo);return}if(c.return===null)throw new Error("Expected to reach root first.");c=c.return}}}function UD(t,n){for(var l=t,c=!1;;){if(l.tag===X)c=!0,n.add(l.stateNode);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)return c;for(;l.sibling===null;){if(l.return===null||l.return===t)return c;l=l.return}l.sibling.return=l.return,l=l.sibling}return!1}var Ey;{Ey=!1;try{var vE=Object.preventExtensions({})}catch{Ey=!0}}function kD(t,n,l,c){this.tag=t,this.key=l,this.elementType=null,this.type=null,this.stateNode=null,this.return=null,this.child=null,this.sibling=null,this.index=0,this.ref=null,this.pendingProps=n,this.memoizedProps=null,this.updateQueue=null,this.memoizedState=null,this.dependencies=null,this.mode=c,this.flags=ke,this.subtreeFlags=ke,this.deletions=null,this.lanes=ce,this.childLanes=ce,this.alternate=null,this.actualDuration=Number.NaN,this.actualStartTime=Number.NaN,this.selfBaseDuration=Number.NaN,this.treeBaseDuration=Number.NaN,this.actualDuration=0,this.actualStartTime=-1,this.selfBaseDuration=0,this.treeBaseDuration=0,this._debugSource=null,this._debugOwner=null,this._debugNeedsRemount=!1,this._debugHookTypes=null,!Ey&&typeof Object.preventExtensions=="function"&&Object.preventExtensions(this)}var Bi=function(t,n,l,c){return new kD(t,n,l,c)};function xy(t){var n=t.prototype;return!!(n&&n.isReactComponent)}function HD(t){return typeof t=="function"&&!xy(t)&&t.defaultProps===void 0}function FD(t){if(typeof t=="function")return xy(t)?I:j;if(t!=null){var n=t.$$typeof;if(n===oi)return Ce;if(n===ca)return he}return ne}function kl(t,n){var l=t.alternate;l===null?(l=Bi(t.tag,n,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l._debugSource=t._debugSource,l._debugOwner=t._debugOwner,l._debugHookTypes=t._debugHookTypes,l.alternate=t,t.alternate=l):(l.pendingProps=n,l.type=t.type,l.flags=ke,l.subtreeFlags=ke,l.deletions=null,l.actualDuration=0,l.actualStartTime=-1),l.flags=t.flags&fn,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue;var c=t.dependencies;switch(l.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.selfBaseDuration=t.selfBaseDuration,l.treeBaseDuration=t.treeBaseDuration,l._debugNeedsRemount=t._debugNeedsRemount,l.tag){case ne:case j:case me:l.type=pc(t.type);break;case I:l.type=gy(t.type);break;case Ce:l.type=yy(t.type);break}return l}function GD(t,n){t.flags&=fn|Gt;var l=t.alternate;if(l===null)t.childLanes=ce,t.lanes=n,t.child=null,t.subtreeFlags=ke,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null,t.selfBaseDuration=0,t.treeBaseDuration=0;else{t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=ke,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type;var c=l.dependencies;t.dependencies=c===null?null:{lanes:c.lanes,firstContext:c.firstContext},t.selfBaseDuration=l.selfBaseDuration,t.treeBaseDuration=l.treeBaseDuration}return t}function BD(t,n,l){var c;return t===Eu?(c=pt,n===!0&&(c|=Lt,c|=zr)):c=Xe,Fr&&(c|=ct),Bi(J,null,null,c)}function Cy(t,n,l,c,v,S){var C=ne,b=t;if(typeof t=="function")xy(t)?(C=I,b=gy(b)):b=pc(b);else if(typeof t=="string")C=X;else{e:switch(t){case gn:return Yo(l.children,v,S,n);case Yi:C=we,v|=Lt,(v&pt)!==Xe&&(v|=zr);break;case qr:return jD(l,v,S,n);case li:return ID(l,v,S,n);case ui:return VD(l,v,S,n);case ys:return pE(l,v,S,n);case Fa:case fa:case Ri:case ao:case Wi:default:{if(typeof t=="object"&&t!==null)switch(t.$$typeof){case si:C=De;break e;case qi:C=Ae;break e;case oi:C=Ce,b=yy(b);break e;case ca:C=he;break e;case un:C=Ve,b=null;break e}var D="";{(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(D+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var L=c?Be(c):null;L&&(D+=` Check the render method of \``+L+"`.")}throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(t==null?t:typeof t)+"."+D))}}}var U=Bi(C,l,n,v);return U.elementType=t,U.type=b,U.lanes=S,U._debugOwner=c,U}function Ty(t,n,l){var c=null;c=t._owner;var v=t.type,S=t.key,C=t.props,b=Cy(v,S,C,c,n,l);return b._debugSource=t._source,b._debugOwner=t._owner,b}function Yo(t,n,l,c){var v=Bi(ue,t,c,n);return v.lanes=l,v}function jD(t,n,l,c){typeof t.id!="string"&&p('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',typeof t.id);var v=Bi(oe,t,c,n|ct);return v.elementType=qr,v.lanes=l,v.stateNode={effectDuration:0,passiveEffectDuration:0},v}function ID(t,n,l,c){var v=Bi(de,t,c,n);return v.elementType=li,v.lanes=l,v}function VD(t,n,l,c){var v=Bi(Dt,t,c,n);return v.elementType=ui,v.lanes=l,v}function pE(t,n,l,c){var v=Bi(Mt,t,c,n);v.elementType=ys,v.lanes=l;var S={isHidden:!1};return v.stateNode=S,v}function Ry(t,n,l){var c=Bi(pe,t,null,n);return c.lanes=l,c}function YD(){var t=Bi(X,null,null,Xe);return t.elementType="DELETED",t}function qD(t){var n=Bi(it,null,null,Xe);return n.stateNode=t,n}function by(t,n,l){var c=t.children!==null?t.children:[],v=Bi(W,c,t.key,n);return v.lanes=l,v.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},v}function mE(t,n){return t===null&&(t=Bi(ne,null,null,Xe)),t.tag=n.tag,t.key=n.key,t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.return=n.return,t.child=n.child,t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t.pendingProps=n.pendingProps,t.memoizedProps=n.memoizedProps,t.updateQueue=n.updateQueue,t.memoizedState=n.memoizedState,t.dependencies=n.dependencies,t.mode=n.mode,t.flags=n.flags,t.subtreeFlags=n.subtreeFlags,t.deletions=n.deletions,t.lanes=n.lanes,t.childLanes=n.childLanes,t.alternate=n.alternate,t.actualDuration=n.actualDuration,t.actualStartTime=n.actualStartTime,t.selfBaseDuration=n.selfBaseDuration,t.treeBaseDuration=n.treeBaseDuration,t._debugSource=n._debugSource,t._debugOwner=n._debugOwner,t._debugNeedsRemount=n._debugNeedsRemount,t._debugHookTypes=n._debugHookTypes,t}function WD(t,n,l,c,v){this.tag=n,this.containerInfo=t,this.pendingChildren=null,this.current=null,this.pingCache=null,this.finishedWork=null,this.timeoutHandle=Qc,this.context=null,this.pendingContext=null,this.callbackNode=null,this.callbackPriority=zn,this.eventTimes=Do(ce),this.expirationTimes=Do(Qt),this.pendingLanes=ce,this.suspendedLanes=ce,this.pingedLanes=ce,this.expiredLanes=ce,this.mutableReadLanes=ce,this.finishedLanes=ce,this.entangledLanes=ce,this.entanglements=Do(ce),this.identifierPrefix=c,this.onRecoverableError=v,pr&&(this.mutableSourceEagerHydrationData=null),this.effectDuration=0,this.passiveEffectDuration=0;{this.memoizedUpdaters=new Set;for(var S=this.pendingUpdatersLaneMap=[],C=0;C3&&arguments[3]!==void 0?arguments[3]:null;return LR(c),{$$typeof:_r,key:c==null?null:""+c,children:t,containerInfo:n,implementation:l}}var wy,Dy;wy=!1,Dy={};function yE(t){if(!t)return Pr;var n=T(t),l=pm(n);if(n.tag===I){var c=n.type;if(gr(c))return cl(n,c,l)}return l}function KD(t){var n=T(t);if(n===void 0){if(typeof t.render=="function")throw new Error("Unable to find node on an unmounted component.");var l=Object.keys(t).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+l)}var c=il(n);return c===null?null:c.stateNode}function JD(t,n){{var l=T(t);if(l===void 0){if(typeof t.render=="function")throw new Error("Unable to find node on an unmounted component.");var c=Object.keys(t).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+c)}var v=il(l);if(v===null)return null;if(v.mode&Lt){var S=Be(l)||"Component";if(!Dy[S]){Dy[S]=!0;var C=Ye;try{kt(v),l.mode&Lt?p("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",n,n,S):p("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",n,n,S)}finally{C?kt(C):jt()}}}return v.stateNode}}function ZD(t,n,l,c,v,S,C,b){var D=!1,L=null;return gE(t,n,D,L,l,c,v,S,C)}function $D(t,n,l,c,v,S,C,b,D,L){var U=!0,V=gE(l,c,U,t,v,S,C,b,D);V.context=yE(null);var $=V.current,se=jr(),fe=Io($),le=Ys(se,fe);return le.callback=n!=null?n:null,Uo($,le,fe),Zw(V,fe,se),V}function SE(t,n,l,c){Iu(n,t);var v=n.current,S=jr(),C=Io(v);qu(C);var b=yE(l);n.context===null?n.context=b:n.pendingContext=b,Ne&&Ye!==null&&!wy&&(wy=!0,p(`Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate. Check the render method of %s.`,Be(Ye)||"Unknown"));var D=Ys(S,C);D.payload={element:t},c=c===void 0?null:c,c!==null&&(typeof c!="function"&&p("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",c),D.callback=c);var L=Uo(v,D,C);return L!==null&&(qn(L,v,C,S),$h(L,v,C)),C}function eO(t){var n=t.current;if(!n.child)return null;switch(n.child.tag){case X:return Bt(n.child.stateNode);default:return n.child.stateNode}}function tO(t){switch(t.tag){case J:{var n=t.stateNode;if($r(n)){var l=Ch(n);nD(n,l)}break}case de:{Kv(function(){var v=ti(t,$e);if(v!==null){var S=jr();qn(v,t,$e,S)}});var c=$e;np(t,c);break}}}function _E(t,n){var l=t.memoizedState;l!==null&&l.dehydrated!==null&&(l.retryLane=Hu(l.retryLane,n))}function np(t,n){_E(t,n);var l=t.alternate;l&&_E(l,n)}function nO(t){if(t.tag===de){var n=$e,l=ti(t,n);if(l!==null){var c=jr();qn(l,t,n,c)}np(t,n)}}function rO(t){if(t.tag===de){var n=Ms,l=ti(t,n);if(l!==null){var c=jr();qn(l,t,n,c)}np(t,n)}}function iO(t){if(t.tag===de){var n=Io(t),l=ti(t,n);if(l!==null){var c=jr();qn(l,t,n,c)}np(t,n)}}function aO(t){var n=Yc(t);return n===null?null:n.stateNode}var EE=function(t){return null};function xE(t){return EE(t)}var CE=function(t){return!1};function TE(t){return CE(t)}var RE=null,bE=null,wE=null,DE=null,OE=null,NE=null,AE=null,ME=null,LE=null;{var PE=function(t,n,l){var c=n[l],v=vt(t)?t.slice():R({},t);return l+1===n.length?(vt(v)?v.splice(c,1):delete v[c],v):(v[c]=PE(t[c],n,l+1),v)},zE=function(t,n){return PE(t,n,0)},UE=function(t,n,l,c){var v=n[c],S=vt(t)?t.slice():R({},t);if(c+1===n.length){var C=l[c];S[C]=S[v],vt(S)?S.splice(v,1):delete S[v]}else S[v]=UE(t[v],n,l,c+1);return S},kE=function(t,n,l){if(n.length!==l.length){g("copyWithRename() expects paths of the same length");return}else for(var c=0;c=n.length)return c;var v=n[l],S=vt(t)?t.slice():R({},t);return S[v]=HE(t[v],n,l+1,c),S},FE=function(t,n,l){return HE(t,n,0,l)},Oy=function(t,n){for(var l=t.memoizedState;l!==null&&n>0;)l=l.next,n--;return l};RE=function(t,n,l,c){var v=Oy(t,n);if(v!==null){var S=FE(v.memoizedState,l,c);v.memoizedState=S,v.baseState=S,t.memoizedProps=R({},t.memoizedProps);var C=ti(t,$e);C!==null&&qn(C,t,$e,Qt)}},bE=function(t,n,l){var c=Oy(t,n);if(c!==null){var v=zE(c.memoizedState,l);c.memoizedState=v,c.baseState=v,t.memoizedProps=R({},t.memoizedProps);var S=ti(t,$e);S!==null&&qn(S,t,$e,Qt)}},wE=function(t,n,l,c){var v=Oy(t,n);if(v!==null){var S=kE(v.memoizedState,l,c);v.memoizedState=S,v.baseState=S,t.memoizedProps=R({},t.memoizedProps);var C=ti(t,$e);C!==null&&qn(C,t,$e,Qt)}},DE=function(t,n,l){t.pendingProps=FE(t.memoizedProps,n,l),t.alternate&&(t.alternate.pendingProps=t.pendingProps);var c=ti(t,$e);c!==null&&qn(c,t,$e,Qt)},OE=function(t,n){t.pendingProps=zE(t.memoizedProps,n),t.alternate&&(t.alternate.pendingProps=t.pendingProps);var l=ti(t,$e);l!==null&&qn(l,t,$e,Qt)},NE=function(t,n,l){t.pendingProps=kE(t.memoizedProps,n,l),t.alternate&&(t.alternate.pendingProps=t.pendingProps);var c=ti(t,$e);c!==null&&qn(c,t,$e,Qt)},AE=function(t){var n=ti(t,$e);n!==null&&qn(n,t,$e,Qt)},ME=function(t){EE=t},LE=function(t){CE=t}}function sO(t){var n=il(t);return n===null?null:n.stateNode}function oO(t){return null}function lO(){return Ye}function uO(t){var n=t.findFiberByHostInstance,l=f.ReactCurrentDispatcher;return ju({bundleType:t.bundleType,version:t.version,rendererPackageName:t.rendererPackageName,rendererConfig:t.rendererConfig,overrideHookState:RE,overrideHookStateDeletePath:bE,overrideHookStateRenamePath:wE,overrideProps:DE,overridePropsDeletePath:OE,overridePropsRenamePath:NE,setErrorHandler:ME,setSuspenseHandler:LE,scheduleUpdate:AE,currentDispatcherRef:l,findHostInstanceByFiber:sO,findFiberByHostInstance:n||oO,findHostInstancesForRefresh:PD,scheduleRefresh:MD,scheduleRoot:LD,setRefreshHandler:AD,getCurrentFiber:lO,reconcilerVersion:QD})}return r.attemptContinuousHydration=rO,r.attemptDiscreteHydration=nO,r.attemptHydrationAtCurrentPriority=iO,r.attemptSynchronousHydration=tO,r.batchedUpdates=iD,r.createComponentSelector=Pw,r.createContainer=ZD,r.createHasPseudoClassSelector=zw,r.createHydrationContainer=$D,r.createPortal=XD,r.createRoleSelector=Uw,r.createTestNameSelector=Hw,r.createTextSelector=kw,r.deferredUpdates=rD,r.discreteUpdates=aD,r.findAllNodes=Gv,r.findBoundingRects=Bw,r.findHostInstance=KD,r.findHostInstanceWithNoPortals=aO,r.findHostInstanceWithWarning=JD,r.flushControlled=oD,r.flushPassiveEffects=fs,r.flushSync=Kv,r.focusWithin=jw,r.getCurrentUpdatePriority=kr,r.getFindAllNodesFailureDescription=Gw,r.getPublicRootInstance=eO,r.injectIntoDevTools=uO,r.isAlreadyRendering=sD,r.observeVisibleRects=Vw,r.registerMutableSourceForHydration=ZR,r.runWithPriority=Dh,r.shouldError=xE,r.shouldSuspend=TE,r.updateContainer=SE,r})),Xp.exports}(function(o){process.env.NODE_ENV==="production"?o.exports=uT():o.exports=cT()})(S0);const fT=jE(S0.exports);var Kp={exports:{}},no={};/** * @license React * react-reconciler-constants.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var R0;function dT(){return R0||(R0=1,no.ConcurrentRoot=1,no.ContinuousEventPriority=4,no.DefaultEventPriority=16,no.DiscreteEventPriority=1,no.IdleEventPriority=536870912,no.LegacyRoot=0),no}var ro={};/** * @license React * react-reconciler-constants.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var b0;function hT(){return b0||(b0=1,process.env.NODE_ENV!=="production"&&function(){var o=1,e=4,r=16,s=536870912,u=o,f=e,h=r,y=s,g=0,p=1;ro.ConcurrentRoot=p,ro.ContinuousEventPriority=f,ro.DefaultEventPriority=h,ro.DiscreteEventPriority=u,ro.IdleEventPriority=y,ro.LegacyRoot=g}()),ro}(function(o){process.env.NODE_ENV==="production"?o.exports=dT():o.exports=hT()})(Kp);const w0={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let D0=!1,O0=!1;const Jp=".react-konva-event",vT=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. Position of a node will be changed during drag&drop, so you should update state of the react app as well. Consider to add onDragMove or onDragEnd events. For more info see: https://github.com/konvajs/react-konva/issues/256 `,pT=`ReactKonva: You are using "zIndex" attribute for a Konva node. react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. For more info see: https://github.com/konvajs/react-konva/issues/194 `,mT={};function nh(o,e,r=mT){if(!D0&&"zIndex"in e&&(console.warn(pT),D0=!0),!O0&&e.draggable){var s=e.x!==void 0||e.y!==void 0,u=e.onDragEnd||e.onDragMove;s&&!u&&(console.warn(vT),O0=!0)}for(var f in r)if(!w0[f]){var h=f.slice(0,2)==="on",y=r[f]!==e[f];if(h&&y){var g=f.substr(2).toLowerCase();g.substr(0,7)==="content"&&(g="content"+g.substr(7,1).toUpperCase()+g.substr(8)),o.off(g,r[f])}var p=!e.hasOwnProperty(f);p&&o.setAttr(f,void 0)}var x=e._useStrictMode,R={},T=!1;const O={};for(var f in e)if(!w0[f]){var h=f.slice(0,2)==="on",w=r[f]!==e[f];if(h&&w){var g=f.substr(2).toLowerCase();g.substr(0,7)==="content"&&(g="content"+g.substr(7,1).toUpperCase()+g.substr(8)),e[f]&&(O[g]=e[f])}!h&&(e[f]!==r[f]||x&&e[f]!==o.getAttr(f))&&(T=!0,R[f]=e[f])}T&&(o.setAttrs(R),io(o));for(var g in O)o.on(g+Jp,O[g])}function io(o){if(!Fe.autoDrawEnabled){var e=o.getLayer()||o.getStage();e&&e.batchDraw()}}var Zp=Wp();const N0={},gT={};Jo.Node.prototype._applyProps=nh;function yT(o,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}o.add(e),io(o)}function ST(o,e,r){let s=Jo[o];s||(console.error(`Konva has no node with the type ${o}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${o}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=Jo.Group);const u={},f={};for(var h in e){var y=h.slice(0,2)==="on";y?f[h]=e[h]:u[h]=e[h]}const g=new s(u);return nh(g,f),g}function _T(o,e,r){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${o}"`)}function ET(o,e,r){return!1}function xT(o){return o}function CT(){return null}function TT(){return null}function RT(o,e,r,s){return gT}function bT(){}function wT(o){}function DT(o,e){return!1}function OT(){return N0}function NT(){return N0}const AT=setTimeout,MT=clearTimeout,LT=-1;function PT(o,e){return!1}const zT=!1,UT=!0,kT=!0;function HT(o,e){e.parent===o?e.moveToTop():o.add(e),io(o)}function FT(o,e){e.parent===o?e.moveToTop():o.add(e),io(o)}function A0(o,e,r){e._remove(),o.add(e),e.setZIndex(r.getZIndex()),io(o)}function GT(o,e,r){A0(o,e,r)}function BT(o,e){e.destroy(),e.off(Jp),io(o)}function jT(o,e){e.destroy(),e.off(Jp),io(o)}function IT(o,e,r){console.error(`Text components are not yet supported in ReactKonva. You text is: "${r}"`)}function VT(o,e,r){}function YT(o,e,r,s,u){nh(o,u,s)}function qT(o){o.hide(),io(o)}function WT(o){}function QT(o,e){(e.visible==null||e.visible)&&o.show()}function XT(o,e){}function KT(o){}function JT(){}const ZT=Object.freeze(Object.defineProperty({__proto__:null,appendInitialChild:yT,createInstance:ST,createTextInstance:_T,finalizeInitialChildren:ET,getPublicInstance:xT,prepareForCommit:CT,preparePortalMount:TT,prepareUpdate:RT,resetAfterCommit:bT,resetTextContent:wT,shouldDeprioritizeSubtree:DT,getRootHostContext:OT,getChildHostContext:NT,scheduleTimeout:AT,cancelTimeout:MT,noTimeout:LT,shouldSetTextContent:PT,isPrimaryRenderer:zT,warnsIfNotActing:UT,supportsMutation:kT,appendChild:HT,appendChildToContainer:FT,insertBefore:A0,insertInContainerBefore:GT,removeChild:BT,removeChildFromContainer:jT,commitTextUpdate:IT,commitMount:VT,commitUpdate:YT,hideInstance:qT,hideTextInstance:WT,unhideInstance:QT,unhideTextInstance:XT,clearContainer:KT,detachDeletedInstance:JT,getCurrentEventPriority:()=>Kp.exports.DefaultEventPriority,now:Zp.unstable_now,idlePriority:Zp.unstable_IdlePriority,run:Zp.unstable_runWithPriority},Symbol.toStringTag,{value:"Module"}));var rh={exports:{}},Fc={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var M0;function $T(){if(M0)return Fc;M0=1;var o=lr.default,e=Symbol.for("react.element"),r=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,u=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function h(y,g,p){var x,R={},T=null,O=null;p!==void 0&&(T=""+p),g.key!==void 0&&(T=""+g.key),g.ref!==void 0&&(O=g.ref);for(x in g)s.call(g,x)&&!f.hasOwnProperty(x)&&(R[x]=g[x]);if(y&&y.defaultProps)for(x in g=y.defaultProps,g)R[x]===void 0&&(R[x]=g[x]);return{$$typeof:e,type:y,key:T,ref:O,props:R,_owner:u.current}}return Fc.Fragment=r,Fc.jsx=h,Fc.jsxs=h,Fc}var Gc={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var L0;function eR(){return L0||(L0=1,process.env.NODE_ENV!=="production"&&function(){var o=lr.default,e=Symbol.for("react.element"),r=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),y=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),w=Symbol.iterator,A="@@iterator";function M(z){if(z===null||typeof z!="object")return null;var ve=w&&z[w]||z[A];return typeof ve=="function"?ve:null}var B=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function k(z){{for(var ve=arguments.length,be=new Array(ve>1?ve-1:0),qe=1;qe=1&&Wt>=0&&ot[qt]!==yn[Wt];)Wt--;for(;qt>=1&&Wt>=0;qt--,Wt--)if(ot[qt]!==yn[Wt]){if(qt!==1||Wt!==1)do if(qt--,Wt--,Wt<0||ot[qt]!==yn[Wt]){var fn=` `+ot[qt].replace(" at new "," at ");return z.displayName&&fn.includes("")&&(fn=fn.replace("",z.displayName)),typeof z=="function"&&Yr.set(z,fn),fn}while(qt>=1&&Wt>=0);break}}}finally{Mr=!1,on.current=ht,Dt(),Error.prepareStackTrace=xt}var Ga=z?z.displayName||z.name:"",Cs=Ga?cr(Ga):"";return typeof z=="function"&&Yr.set(z,Cs),Cs}function gn(z,ve,be){return _r(z,!1)}function Yi(z){var ve=z.prototype;return!!(ve&&ve.isReactComponent)}function qr(z,ve,be){if(z==null)return"";if(typeof z=="function")return _r(z,Yi(z));if(typeof z=="string")return cr(z);switch(z){case p:return cr("Suspense");case x:return cr("SuspenseList")}if(typeof z=="object")switch(z.$$typeof){case g:return gn(z.render);case R:return qr(z.type,ve,be);case T:{var qe=z,xt=qe._payload,ht=qe._init;try{return qr(ht(xt),ve,be)}catch{}}}return""}var si=Object.prototype.hasOwnProperty,qi={},oi=B.ReactDebugCurrentFrame;function li(z){if(z){var ve=z._owner,be=qr(z.type,z._source,ve?ve.type:null);oi.setExtraStackFrame(be)}else oi.setExtraStackFrame(null)}function ui(z,ve,be,qe,xt){{var ht=Function.call.bind(si);for(var ut in z)if(ht(z,ut)){var ot=void 0;try{if(typeof z[ut]!="function"){var yn=Error((qe||"React class")+": "+be+" type `"+ut+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof z[ut]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw yn.name="Invariant Violation",yn}ot=z[ut](ve,ut,qe,be,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(qt){ot=qt}ot&&!(ot instanceof Error)&&(li(xt),k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",qe||"React class",be,ut,typeof ot),li(null)),ot instanceof Error&&!(ot.message in qi)&&(qi[ot.message]=!0,li(xt),k("Failed %s type: %s",be,ot.message),li(null))}}}var ca=Array.isArray;function un(z){return ca(z)}function fa(z){{var ve=typeof Symbol=="function"&&Symbol.toStringTag,be=ve&&z[Symbol.toStringTag]||z.constructor.name||"Object";return be}}function Wi(z){try{return ys(z),!1}catch{return!0}}function ys(z){return""+z}function Fa(z){if(Wi(z))return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",fa(z)),ys(z)}var Ri=B.ReactCurrentOwner,ao={key:!0,ref:!0,__self:!0,__source:!0},Ss,so,Te;Te={};function Je(z){if(si.call(z,"ref")){var ve=Object.getOwnPropertyDescriptor(z,"ref").get;if(ve&&ve.isReactWarning)return!1}return z.ref!==void 0}function lt(z){if(si.call(z,"key")){var ve=Object.getOwnPropertyDescriptor(z,"key").get;if(ve&&ve.isReactWarning)return!1}return z.key!==void 0}function Qe(z,ve){if(typeof z.ref=="string"&&Ri.current&&ve&&Ri.current.stateNode!==ve){var be=ue(Ri.current.type);Te[be]||(k('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',ue(Ri.current.type),z.ref),Te[be]=!0)}}function cn(z,ve){{var be=function(){Ss||(Ss=!0,k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ve))};be.isReactWarning=!0,Object.defineProperty(z,"key",{get:be,configurable:!0})}}function fr(z,ve){{var be=function(){so||(so=!0,k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",ve))};be.isReactWarning=!0,Object.defineProperty(z,"ref",{get:be,configurable:!0})}}var Be=function(z,ve,be,qe,xt,ht,ut){var ot={$$typeof:e,type:z,key:ve,ref:be,props:ut,_owner:ht};return ot._store={},Object.defineProperty(ot._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(ot,"_self",{configurable:!1,enumerable:!1,writable:!1,value:qe}),Object.defineProperty(ot,"_source",{configurable:!1,enumerable:!1,writable:!1,value:xt}),Object.freeze&&(Object.freeze(ot.props),Object.freeze(ot)),ot};function ke(z,ve,be,qe,xt){{var ht,ut={},ot=null,yn=null;be!==void 0&&(Fa(be),ot=""+be),lt(ve)&&(Fa(ve.key),ot=""+ve.key),Je(ve)&&(yn=ve.ref,Qe(ve,xt));for(ht in ve)si.call(ve,ht)&&!ao.hasOwnProperty(ht)&&(ut[ht]=ve[ht]);if(z&&z.defaultProps){var qt=z.defaultProps;for(ht in qt)ut[ht]===void 0&&(ut[ht]=qt[ht])}if(ot||yn){var Wt=typeof z=="function"?z.displayName||z.name||"Unknown":z;ot&&cn(ut,Wt),yn&&fr(ut,Wt)}return Be(z,ot,yn,xt,qe,Ri.current,ut)}}var nn=B.ReactCurrentOwner,Gt=B.ReactDebugCurrentFrame;function at(z){if(z){var ve=z._owner,be=qr(z.type,z._source,ve?ve.type:null);Gt.setExtraStackFrame(be)}else Gt.setExtraStackFrame(null)}var ci;ci=!1;function da(z){return typeof z=="object"&&z!==null&&z.$$typeof===e}function _s(){{if(nn.current){var z=ue(nn.current.type);if(z)return` Check the render method of \``+z+"`."}return""}}function yt(z){{if(z!==void 0){var ve=z.fileName.replace(/^.*[\\\/]/,""),be=z.lineNumber;return` Check your code at `+ve+":"+be+"."}return""}}var fi={};function di(z){{var ve=_s();if(!ve){var be=typeof z=="string"?z:z.displayName||z.name;be&&(ve=` Check the top-level render call using <`+be+">.")}return ve}}function bi(z,ve){{if(!z._store||z._store.validated||z.key!=null)return;z._store.validated=!0;var be=di(ve);if(fi[be])return;fi[be]=!0;var qe="";z&&z._owner&&z._owner!==nn.current&&(qe=" It was passed a child from "+ue(z._owner.type)+"."),at(z),k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',be,qe),at(null)}}function Er(z,ve){{if(typeof z!="object")return;if(un(z))for(var be=0;be",ot=" Did you accidentally export a JSX literal instead of a component?"):qt=typeof z,k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",qt,ot)}var Wt=ke(z,ve,be,xt,ht);if(Wt==null)return Wt;if(ut){var fn=ve.children;if(fn!==void 0)if(qe)if(un(fn)){for(var Ga=0;Gae in o?tR(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,H0=(o,e)=>{for(var r in e||(e={}))iR.call(e,r)&&k0(o,r,e[r]);if(U0)for(var r of U0(e))aR.call(e,r)&&k0(o,r,e[r]);return o},sR=(o,e)=>nR(o,rR(e));function $p(o,e,r){if(!o)return;if(r(o)===!0)return o;let s=e?o.return:o.child;for(;s;){const u=$p(s,e,r);if(u)return u;s=e?null:s.sibling}}function F0(o){try{return Object.defineProperties(o,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return o}}const em=F0(Ua.createContext(null));class G0 extends Ua.Component{render(){return ur(em.Provider,{value:this._reactInternals,children:this.props.children})}}const{ReactCurrentOwner:oR,ReactCurrentDispatcher:lR}=Ua.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function uR(){const o=Ua.useContext(em);if(!o)throw new Error("its-fine: useFiber must be called within a !");const e=Ua.useId();return Ua.useMemo(()=>{var s;return(s=oR.current)!=null?s:$p(o,!1,u=>{let f=u.memoizedState;for(;f;){if(f.memoizedState===e)return!0;f=f.next}})},[o,e])}const Bc=[],B0=new WeakMap;function cR(){var o;const e=uR();Bc.splice(0,Bc.length),$p(e,!0,r=>{var s;const u=(s=r.type)==null?void 0:s._context;u&&u!==em&&Bc.push(F0(u))});for(const r of Bc){const s=(o=lR.current)==null?void 0:o.readContext(r);B0.set(r,s)}return Ua.useMemo(()=>Bc.reduce((r,s)=>u=>Ua.createElement(r,null,Ua.createElement(s.Provider,sR(H0({},u),{value:B0.get(s)}))),r=>ur(G0,{...H0({},r)})),[])}function fR(o){const e=lr.default.useRef();return lr.default.useLayoutEffect(()=>{e.current=o}),e.current}const dR=o=>{const e=lr.default.useRef(),r=lr.default.useRef(),s=lr.default.useRef(),u=fR(o),f=cR(),h=y=>{const{forwardedRef:g}=o;!g||(typeof g=="function"?g(y):g.current=y)};return lr.default.useLayoutEffect(()=>(r.current=new Jo.Stage({width:o.width,height:o.height,container:e.current}),h(r.current),s.current=jc.createContainer(r.current,Kp.exports.LegacyRoot,!1,null),jc.updateContainer(ur(f,{children:o.children}),s.current),()=>{!Jo.isBrowser||(h(null),jc.updateContainer(null,s.current,null),r.current.destroy())}),[]),lr.default.useLayoutEffect(()=>{h(r.current),nh(r.current,o,u),jc.updateContainer(ur(f,{children:o.children}),s.current,null)}),ur("div",{ref:e,accessKey:o.accessKey,className:o.className,role:o.role,style:o.style,tabIndex:o.tabIndex,title:o.title})},hR="Layer",vR="Rect",pR="Line",mR="Image",gR="Text",yR="Transformer",jc=fT(ZT);jc.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:process.env.NODE_ENV!=="production"?1:0,version:lr.default.version,rendererPackageName:"react-konva"});const SR=lr.default.forwardRef((o,e)=>ur(G0,{children:ur(dR,{...o,forwardedRef:e})})),j0=o=>o*Math.PI/180,tm=(o,e,r,s,u)=>{const f=j0(u);return{x:(o-r)*Math.cos(f)-(e-s)*Math.sin(f)+r,y:(o-r)*Math.sin(f)+(e-s)*Math.cos(f)+s}},_R=(o,e,r,s,u)=>{const f=j0(u);return{x:o+r*Math.cos(f)+s*Math.sin(-f),y:e+s*Math.cos(f)+r*Math.sin(f)}},I0=(o,e)=>Math.hypot(o.x-e.x,o.y-e.y),V0=o=>{const e=o.scaleX(),r=o.scaleY(),s=o.width()*e,u=o.height()*r,f=s/2,h=u/2,y=o.x(),g=o.y(),p={x:y,y:g},x=o.rotation(),{x:R,y:T}=_R(p.x,p.y,f,h,x);return{points:[p,tm(R+f,T-h,R,T,x),tm(R+f,T+h,R,T,x),tm(R-f,T+h,R,T,x)],rotation:x}},Y0=({annotation:o,isDraggable:e,isSelected:r,isListening:s,isDebug:u=!1,onSelect:f,onChange:h})=>{const y=gt.useRef(null),g=gt.useRef(null);gt.useEffect(()=>{var A;r&&g.current&&y.current&&(g.current.nodes([y.current]),(A=g.current.getLayer())==null||A.batchDraw())},[r]);const[p,x,R]=o.points,T=I0(x,p),O=I0(R,x),w=gt.useMemo(()=>o.points.reduce((A,M)=>A.x>M.x||A.x===M.x&&A.y{const A=y.current;if(A===null)return;const{points:M,rotation:B}=V0(A);h(M,B)},onTransformEnd:()=>{const A=y.current;if(A===null)return;const{points:M,rotation:B}=V0(A);h(M,B),A.scaleX(1),A.scaleY(1)}}),r&&ur(yR,{ref:g}),ur(gR,{x:w.x+5,y:w.y,text:o.texts.join(` `),fill:o.color,fontSize:17,visible:o.texts.length>0}),u&&ur(pR,{name:"debug",points:o.points.flatMap(({x:A,y:M})=>[A,M]),closed:!0,stroke:"red",listening:!1})]})},ER=gt.memo(({annotations:o,send:e,selectedIndex:r,isIdle:s})=>ur(P0,{children:o.map((u,f)=>u.type==="boundingBox"?ur(Y0,{annotation:u,isDraggable:f===r&&s,isSelected:f===r&&s,isListening:!0,onSelect:h=>e({type:"UPDATE.SELECTED.INDEX",selectedIndex:f,button:h.evt.button}),onChange:(h,y)=>e({type:"UPDATE.SELECTED.POINTS",points:h,rotation:y})},u.id):null)})),xR=({service:o,cursorX:e,cursorY:r})=>{const[s,u]=Kx(o);return s.matches("creating")?ur(Y0,{annotation:{id:"creating",type:"boundingBox",color:s.context.color,texts:s.context.texts,points:[{x:Math.min(s.context.points[0].x,e!=null?e:0),y:Math.min(s.context.points[0].y,r!=null?r:0)},{x:Math.max(s.context.points[0].x,e!=null?e:0),y:Math.min(s.context.points[0].y,r!=null?r:0)},{x:Math.max(s.context.points[0].x,e!=null?e:0),y:Math.max(s.context.points[0].y,r!=null?r:0)},{x:Math.min(s.context.points[0].x,e!=null?e:0),y:Math.max(s.context.points[0].y,r!=null?r:0)}],rotation:0},isDraggable:!1,isSelected:!1,isListening:!1,onSelect:()=>{},onChange:()=>{}}):null},q0=window.matchMedia("(prefers-color-scheme: dark)").matches?"#FFFFFF":"#000000",W0=o=>fetch(o).then(e=>e.json()),CR=({stageWidth:o=window.innerWidth,stageHeight:e=window.innerHeight,stageRef:r,handleMouseDown:s,handleMouseMove:u,handleContextMenu:f,cursorX:h,cursorY:y,state:g,send:p,children:x})=>{const{context:{annotations:R,selectedIndex:T}}=g;return ur(SR,{ref:r,width:o,height:e,onMouseDown:s,onMouseMove:u,onContextMenu:f,children:z0(hR,{children:[x,g.matches("boundingBox")&&ur(xR,{service:g.children.boundingBox,cursorX:h,cursorY:y}),ur(ER,{annotations:R,selectedIndex:T,send:p,isIdle:g.matches("idle")})]})})},Q0="persisted-context",X0=localStorage.getItem(Q0),TR=o=>{var pe,ue,we;const[e,r]=gt.useState(q0),[s,u]=gt.useState([]),[f,h]=gt.useState({x:null,y:null}),y=gt.useRef(null),g=gt.useRef(null),[p,x]=qx(o,{context:X0?JSON.parse(X0):o.initialState.context}),{context:R}=p,{annotations:T,selectedIndex:O}=R,w=o.resolveState(p),A=gt.useCallback((Ae,De="right-click")=>{var Mt,cr,Mr;const{x:Ce,y:oe}=(Mr=(cr=(Mt=Ae.target)==null?void 0:Mt.getStage())==null?void 0:cr.getPointerPosition())!=null?Mr:{};if(Ce===void 0||oe===void 0)return;const{button:de,altKey:he,ctrlKey:me,metaKey:Ve,shiftKey:Et}=Ae.evt,Dt={"middle-click":de===1,"right-click":de===2,"alt+click":he,"ctrl+click":me,"meta+click":Ve,"shift+click":Et}[De];x({type:"ADD.POINT",point:{x:Ce,y:oe},color:e,texts:s,isAdded:Dt?!1:Ae.evt.button===0,isFinished:Dt}),Ae.target===Ae.target.getStage()&&x({type:"UPDATE.SELECTED.INDEX",selectedIndex:-1,button:de});const on=g.current;on!==null&&(on.style.display="none")},[e,x,s]),M=gt.useCallback(Ae=>{var oe,de,he;const{x:De,y:Ce}=(he=(de=(oe=Ae.target)==null?void 0:oe.getStage())==null?void 0:de.getPointerPosition())!=null?he:{};De===void 0||Ce===void 0||p.matches("idle")||h({x:De,y:Ce})},[p]),B=gt.useCallback(Ae=>{var me,Ve,Et;Ae.evt.preventDefault();const De=Ae.target.getStage();if(Ae.target===De)return;const Ce=g.current;if(Ce===null||De===null)return;Ce.style.display="initial";const oe=De.container().getBoundingClientRect(),{x:de,y:he}=(Et=(Ve=(me=Ae.target)==null?void 0:me.getStage())==null?void 0:Ve.getPointerPosition())!=null?Et:{};de===void 0||he===void 0||(Ce.style.top=oe.top+he+4+"px",Ce.style.left=oe.left+de+4+"px")},[]),k=gt.useCallback(()=>{const Ae=g.current;Ae!==null&&(Ae.style.display="none",x("REMOVE.SELECTED.ANNOTATION"))},[x]),H=gt.useCallback(Ae=>{x({type:"UPDATE.ANNOTATIONS",annotations:Ae,prevAnnotations:T})},[T,x]),q=gt.useCallback(async Ae=>{const{annotations:De}=await W0(Ae);H(De)},[H]),re=gt.useCallback(Ae=>{const De=Ae.target.value;r(De),x({type:"UPDATE.SELECTED.COLOR",color:De})},[x]),j=gt.useCallback(Ae=>{const De=Ae.target.value.split(",");u(De),x({type:"UPDATE.SELECTED.TEXTS",texts:De})},[x]),I=(pe=T[O])==null?void 0:pe.color;gt.useEffect(()=>{r(Ae=>I||Ae)},[I]);const ne=(ue=T[O])==null?void 0:ue.texts;gt.useEffect(()=>{u(Ae=>ne||Ae)},[ne]);const J=((we=y.current)==null?void 0:we.find(".creating")[0])!==void 0,W=gt.useMemo(()=>({undo:!J,redo:!J,save:!J,reset:!J,remove:w.can("REMOVE.SELECTED.ANNOTATION"),fetch:w.can({type:"UPDATE.ANNOTATIONS",annotations:T,prevAnnotations:T}),retry:w.can("RETRY")}),[T,J,w]),X=gt.useMemo(()=>({stageRef:y,handleMouseDown:A,handleMouseMove:M,handleContextMenu:B,cursorX:f.x,cursorY:f.y,state:p,send:x}),[f.x,f.y,B,A,M,x,p]);return{menuRef:g,color:e,onChangeColor:re,texts:s,onChangeTexts:j,state:p,send:x,can:W,handleDeleteMenu:k,fetchAnnotations:q,componentProps:X,localStorageKey:Q0}};var nl=lr.default,RR=function(e,r,s){const u=nl.useRef("loading"),f=nl.useRef(),[h,y]=nl.useState(0),g=nl.useRef(),p=nl.useRef(),x=nl.useRef();return(g.current!==e||p.current!==r||x.current!==s)&&(u.current="loading",f.current=void 0,g.current=e,p.current=r,x.current=s),nl.useLayoutEffect(function(){if(!e)return;var R=document.createElement("img");function T(){u.current="loaded",f.current=R,y(Math.random())}function O(){u.current="failed",f.current=void 0,y(Math.random())}return R.addEventListener("load",T),R.addEventListener("error",O),r&&(R.crossOrigin=r),s&&(R.referrerpolicy=s),R.src=e,function(){R.removeEventListener("load",T),R.removeEventListener("error",O)}},[e,r,s]),[f.current,u.current]};const bR=({url:o,...e})=>{const[r]=RR(o);return ur(mR,{...e,image:r})};var K0=Object.prototype.hasOwnProperty;function J0(o,e,r){for(r of o.keys())if(Ic(r,e))return r}function Ic(o,e){var r,s,u;if(o===e)return!0;if(o&&e&&(r=o.constructor)===e.constructor){if(r===Date)return o.getTime()===e.getTime();if(r===RegExp)return o.toString()===e.toString();if(r===Array){if((s=o.length)===e.length)for(;s--&&Ic(o[s],e[s]););return s===-1}if(r===Set){if(o.size!==e.size)return!1;for(s of o)if(u=s,u&&typeof u=="object"&&(u=J0(e,u),!u)||!e.has(u))return!1;return!0}if(r===Map){if(o.size!==e.size)return!1;for(s of o)if(u=s[0],u&&typeof u=="object"&&(u=J0(e,u),!u)||!Ic(s[1],e.get(u)))return!1;return!0}if(r===ArrayBuffer)o=new Uint8Array(o),e=new Uint8Array(e);else if(r===DataView){if((s=o.byteLength)===e.byteLength)for(;s--&&o.getInt8(s)===e.getInt8(s););return s===-1}if(ArrayBuffer.isView(o)){if((s=o.byteLength)===e.byteLength)for(;s--&&o[s]===e[s];);return s===-1}if(!r||typeof o=="object"){s=0;for(r in o)if(K0.call(o,r)&&++s&&!K0.call(e,r)||!(r in e)||!Ic(o[r],e[r]))return!1;return Object.keys(e).length===s}}return o!==o&&e!==e}const Z0="boundingBox",$0={points:[],color:q0,texts:[]},wR=gS({id:Z0,predictableActionArguments:!0,context:$0,initial:"idle",states:{idle:{on:{"ADD.POINT":{target:"creating",cond:(o,e)=>e.isAdded&&o.points.length===0,actions:Ar({points:(o,e)=>o.points.concat(e.point),color:(o,e)=>e.color,texts:(o,e)=>e.texts})}}},creating:{on:{"ADD.POINT":[{target:"created",cond:(o,e)=>e.isAdded&&o.points.length===1,actions:Ar({points:(o,e)=>{const r=o.points[0],s=e.point,u={x:Math.max(r.x,s.x),y:Math.max(r.y,s.y)},f={x:Math.min(r.x,s.x),y:Math.min(r.y,s.y)},h={x:u.x,y:f.y},y={x:f.x,y:u.y};let g=o.points.slice();return g=[f,h,u,y],g}})},{target:"idle",cond:(o,e)=>e.isFinished&&o.points.length===1,actions:Sp("RESET")}]}},created:{entry:[Gx(o=>({type:"COMMIT.ANNOTATION",annotation:DR(o)})),Sp("RESET")]}},on:{RESET:{target:"idle",actions:Ar({...$0})}}});function DR({points:o,color:e,texts:r}){return{id:crypto.randomUUID(),type:Z0,color:e,texts:r,points:o,rotation:0}}const{choose:OR}=sS,e1=-2,NR=o=>({initial:"loading",states:{loading:{invoke:{id:"fetch-annotations",src:()=>W0(o),onDone:{target:"loaded",actions:[Ar({annotations:(e,r)=>r.data.annotations||[],selectedIndex:e1}),OR([{cond:e=>e.annotations.length>0,actions:["snapshot"]}])]},onError:{target:"failure"}}},loaded:{type:"final"},failure:{on:{RETRY:"loading"}}}}),{choose:AR}=sS,nm={annotations:[],selectedIndex:-1,snapshots:[],redo:[]},MR=(o="")=>gS({id:"root",predictableActionArguments:!0,context:nm,initial:"initial",states:{initial:{...NR(o),always:[{target:"idle",cond:e=>o.length===0||e.annotations.length>0||e.selectedIndex===e1}]},idle:{on:{"CHANGE.TOOL.BBOX":{target:"boundingBox"},"UPDATE.SELECTED.INDEX":{cond:(e,r)=>r.button===0||r.button===2,actions:Ar({selectedIndex:(e,r)=>r.selectedIndex})},"UPDATE.SELECTED.POINTS":{cond:e=>Boolean(e.annotations[e.selectedIndex]),actions:[Ar({annotations:(e,r)=>{const s=structuredClone(e.annotations),u=s[e.selectedIndex];return u&&(u.points=r.points,u.rotation=r.rotation),s}}),"snapshot"]},"UPDATE.SELECTED.COLOR":{cond:e=>Boolean(e.annotations[e.selectedIndex]),actions:[Ar({annotations:(e,r)=>{const s=structuredClone(e.annotations),u=s[e.selectedIndex];return u&&(u.color=r.color),s}}),"snapshot"]},"UPDATE.SELECTED.TEXTS":{cond:e=>Boolean(e.annotations[e.selectedIndex]),actions:[Ar({annotations:(e,r)=>{const s=structuredClone(e.annotations),u=s[e.selectedIndex];return u&&(u.texts=r.texts),s}}),"snapshot"]},"REMOVE.SELECTED.ANNOTATION":{cond:e=>Boolean(e.annotations[e.selectedIndex]),actions:[Ar({annotations:e=>e.annotations[e.selectedIndex]?e.annotations.filter((s,u)=>u!==e.selectedIndex):e.annotations}),"snapshot","resetSelectedIndex"]},"UPDATE.ANNOTATIONS":{cond:(e,r)=>Array.isArray(r.annotations),actions:[Ar({annotations:(e,r)=>r.annotations}),AR([{cond:(e,r)=>!Ic(r.prevAnnotations,r.annotations),actions:["snapshot"]}])]}},exit:["resetSelectedIndex"]},boundingBox:{invoke:{id:"boundingBox",src:"boundingBoxMachine"},on:{"COMMIT.ANNOTATION":{actions:[Ar({annotations:(e,r)=>e.annotations.concat(r.annotation)}),"snapshot"]},"ADD.POINT":{actions:Sp((e,r)=>({...r,type:"ADD.POINT"}),{to:"boundingBox"})}}}},on:{"CHANGE.TOOL.IDLE":{target:"idle"},UNDO:{cond:e=>e.snapshots.length>0,actions:Ar(e=>{var h;const r=e.snapshots.pop(),s=e.snapshots.at(-1)||[],u=(h=e.annotations[e.selectedIndex])==null?void 0:h.id,f=s.findIndex(({id:y})=>y===u);return{annotations:s,snapshots:[...e.snapshots],redo:r?[...e.redo,r]:e.redo,selectedIndex:f}})},REDO:{cond:e=>e.redo.length>0,actions:Ar(e=>{var h;const r=e.redo.pop(),s=r||[],u=(h=e.annotations[e.selectedIndex])==null?void 0:h.id,f=s.findIndex(({id:y})=>y===u);return{annotations:s,snapshots:r?[...e.snapshots,r]:e.snapshots,redo:[...e.redo],selectedIndex:f}})},SAVE:{actions:async(e,r)=>{await r.callback(e)}},RESET:{actions:[async(e,r)=>{await r.callback()},Ar({...nm})]}}},{actions:{snapshot:Ar({snapshots:e=>[...e.snapshots,e.annotations],redo:[]}),resetSelectedIndex:Ar({selectedIndex:e=>nm.selectedIndex})},services:{boundingBoxMachine:wR}});za.URLImage=bR,za.XShapeStage=CR,za.createRootMachine=MR,za.useXShape=TR,Object.defineProperties(za,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});