jspsych-tangram 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,5 +38,5 @@ var TangramPrepPlugin=function(Fe){"use strict";function gh(c,i){return i.forEac
38
38
  `+p[n].replace(" at new "," at ");return t.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",t.displayName)),U}while(1<=n&&0<=a);break}}}finally{Qi=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?En(l):""}function oy(t){switch(t.tag){case 26:case 27:case 5:return En(t.type);case 16:return En("Lazy");case 13:return En("Suspense");case 19:return En("SuspenseList");case 0:case 15:return Vi(t.type,!1);case 11:return Vi(t.type.render,!1);case 1:return Vi(t.type,!0);case 31:return En("Activity");default:return""}}function wo(t){try{var e="";do e+=oy(t),t=t.return;while(t);return e}catch(l){return`
39
39
  Error generating stack: `+l.message+`
40
40
  `+l.stack}}function Ze(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function jo(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function ry(t){var e=jo(t)?"checked":"value",l=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof l!="undefined"&&typeof l.get=="function"&&typeof l.set=="function"){var a=l.get,u=l.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,u.call(this,o)}}),Object.defineProperty(t,e,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function pu(t){t._valueTracker||(t._valueTracker=ry(t))}function Qo(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var l=e.getValue(),n="";return t&&(n=jo(t)?t.checked?"true":"false":t.value),t=n,t!==l?(e.setValue(t),!0):!1}function gu(t){if(t=t||(typeof document!="undefined"?document:void 0),typeof t=="undefined")return null;try{return t.activeElement||t.body}catch(e){return t.body}}var sy=/[\n"\\]/g;function Le(t){return t.replace(sy,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Zi(t,e,l,n,a,u,o,s){t.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?t.type=o:t.removeAttribute("type"),e!=null?o==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Ze(e)):t.value!==""+Ze(e)&&(t.value=""+Ze(e)):o!=="submit"&&o!=="reset"||t.removeAttribute("value"),e!=null?Li(t,o,Ze(e)):l!=null?Li(t,o,Ze(l)):n!=null&&t.removeAttribute("value"),a==null&&u!=null&&(t.defaultChecked=!!u),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.name=""+Ze(s):t.removeAttribute("name")}function Vo(t,e,l,n,a,u,o,s){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),e!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||e!=null))return;l=l!=null?""+Ze(l):"",e=e!=null?""+Ze(e):l,s||e===t.value||(t.value=e),t.defaultValue=e}n=n!=null?n:a,n=typeof n!="function"&&typeof n!="symbol"&&!!n,t.checked=s?t.checked:!!n,t.defaultChecked=!!n,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(t.name=o)}function Li(t,e,l){e==="number"&&gu(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function On(t,e,l,n){if(t=t.options,e){e={};for(var a=0;a<l.length;a++)e["$"+l[a]]=!0;for(l=0;l<t.length;l++)a=e.hasOwnProperty("$"+t[l].value),t[l].selected!==a&&(t[l].selected=a),a&&n&&(t[l].defaultSelected=!0)}else{for(l=""+Ze(l),e=null,a=0;a<t.length;a++){if(t[a].value===l){t[a].selected=!0,n&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function Zo(t,e,l){if(e!=null&&(e=""+Ze(e),e!==t.value&&(t.value=e),l==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=l!=null?""+Ze(l):""}function Lo(t,e,l,n){if(e==null){if(n!=null){if(l!=null)throw Error(f(92));if(Tt(n)){if(1<n.length)throw Error(f(93));n=n[0]}l=n}l==null&&(l=""),e=l}l=Ze(e),t.defaultValue=l,n=t.textContent,n===l&&n!==""&&n!==null&&(t.value=n)}function _n(t,e){if(e){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=e;return}}t.textContent=e}var dy=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Ko(t,e,l){var n=e.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?n?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":n?t.setProperty(e,l):typeof l!="number"||l===0||dy.has(e)?e==="float"?t.cssFloat=l:t[e]=(""+l).trim():t[e]=l+"px"}function ko(t,e,l){if(e!=null&&typeof e!="object")throw Error(f(62));if(t=t.style,l!=null){for(var n in l)!l.hasOwnProperty(n)||e!=null&&e.hasOwnProperty(n)||(n.indexOf("--")===0?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="");for(var a in e)n=e[a],e.hasOwnProperty(a)&&l[a]!==n&&Ko(t,a,n)}else for(var u in e)e.hasOwnProperty(u)&&Ko(t,u,e[u])}function Ki(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),yy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bu(t){return yy.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var ki=null;function Ji(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zn=null,Dn=null;function Jo(t){var e=Mn(t);if(e&&(t=e.stateNode)){var l=t[Re]||null;t:switch(t=e.stateNode,e.type){case"input":if(Zi(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),e=l.name,l.type==="radio"&&e!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Le(""+e)+'"][type="radio"]'),e=0;e<l.length;e++){var n=l[e];if(n!==t&&n.form===t.form){var a=n[Re]||null;if(!a)throw Error(f(90));Zi(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<l.length;e++)n=l[e],n.form===t.form&&Qo(n)}break t;case"textarea":Zo(t,l.value,l.defaultValue);break t;case"select":e=l.value,e!=null&&On(t,!!l.multiple,e,!1)}}}var $i=!1;function $o(t,e,l){if($i)return t(e,l);$i=!0;try{var n=t(e);return n}finally{if($i=!1,(zn!==null||Dn!==null)&&(ai(),zn&&(e=zn,t=Dn,Dn=zn=null,Jo(e),t)))for(e=0;e<t.length;e++)Jo(t[e])}}function ya(t,e){var l=t.stateNode;if(l===null)return null;var n=l[Re]||null;if(n===null)return null;l=n[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(t=t.type,n=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!n;break t;default:t=!1}if(t)return null;if(l&&typeof l!="function")throw Error(f(231,e,typeof l));return l}var yl=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),Pi=!1;if(yl)try{var ma={};Object.defineProperty(ma,"passive",{get:function(){Pi=!0}}),window.addEventListener("test",ma,ma),window.removeEventListener("test",ma,ma)}catch(t){Pi=!1}var Dl=null,Ii=null,Su=null;function Po(){if(Su)return Su;var t,e=Ii,l=e.length,n,a="value"in Dl?Dl.value:Dl.textContent,u=a.length;for(t=0;t<l&&e[t]===a[t];t++);var o=l-t;for(n=1;n<=o&&e[l-n]===a[u-n];n++);return Su=a.slice(t,1<n?1-n:void 0)}function xu(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Mu(){return!0}function Io(){return!1}function Ue(t){function e(l,n,a,u,o){this._reactName=l,this._targetInst=a,this.type=n,this.nativeEvent=u,this.target=o,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(l=t[s],this[s]=l?l(u):u[s]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Mu:Io,this.isPropagationStopped=Io,this}return g(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Mu)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Mu)},persist:function(){},isPersistent:Mu}),e}var Wl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Au=Ue(Wl),va=g({},Wl,{view:0,detail:0}),my=Ue(va),Wi,Fi,pa,Tu=g({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ec,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==pa&&(pa&&t.type==="mousemove"?(Wi=t.screenX-pa.screenX,Fi=t.screenY-pa.screenY):Fi=Wi=0,pa=t),Wi)},movementY:function(t){return"movementY"in t?t.movementY:Fi}}),Wo=Ue(Tu),vy=g({},Tu,{dataTransfer:0}),py=Ue(vy),gy=g({},va,{relatedTarget:0}),tc=Ue(gy),by=g({},Wl,{animationName:0,elapsedTime:0,pseudoElement:0}),Sy=Ue(by),xy=g({},Wl,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),My=Ue(xy),Ay=g({},Wl,{data:0}),Fo=Ue(Ay),Ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ey={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _y(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Oy[t])?!!e[t]:!1}function ec(){return _y}var zy=g({},va,{key:function(t){if(t.key){var e=Ty[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=xu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ey[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ec,charCode:function(t){return t.type==="keypress"?xu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Dy=Ue(zy),Ry=g({},Tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tr=Ue(Ry),Uy=g({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ec}),By=Ue(Uy),Ny=g({},Wl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=Ue(Ny),qy=g({},Tu,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Cy=Ue(qy),Yy=g({},Wl,{newState:0,oldState:0}),Gy=Ue(Yy),Xy=[9,13,27,32],lc=yl&&"CompositionEvent"in window,ga=null;yl&&"documentMode"in document&&(ga=document.documentMode);var wy=yl&&"TextEvent"in window&&!ga,er=yl&&(!lc||ga&&8<ga&&11>=ga),lr=" ",nr=!1;function ar(t,e){switch(t){case"keyup":return Xy.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ur(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Rn=!1;function jy(t,e){switch(t){case"compositionend":return ur(e);case"keypress":return e.which!==32?null:(nr=!0,lr);case"textInput":return t=e.data,t===lr&&nr?null:t;default:return null}}function Qy(t,e){if(Rn)return t==="compositionend"||!lc&&ar(t,e)?(t=Po(),Su=Ii=Dl=null,Rn=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return er&&e.locale!=="ko"?null:e.data;default:return null}}var Vy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function ir(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Vy[t.type]:e==="textarea"}function cr(t,e,l,n){zn?Dn?Dn.push(n):Dn=[n]:zn=n,e=ri(e,"onChange"),0<e.length&&(l=new Au("onChange","change",null,l,n),t.push({event:l,listeners:e}))}var ba=null,Sa=null;function Zy(t){jd(t,0)}function Eu(t){var e=ha(t);if(Qo(e))return t}function fr(t,e){if(t==="change")return e}var or=!1;if(yl){var nc;if(yl){var ac="oninput"in document;if(!ac){var rr=document.createElement("div");rr.setAttribute("oninput","return;"),ac=typeof rr.oninput=="function"}nc=ac}else nc=!1;or=nc&&(!document.documentMode||9<document.documentMode)}function sr(){ba&&(ba.detachEvent("onpropertychange",dr),Sa=ba=null)}function dr(t){if(t.propertyName==="value"&&Eu(Sa)){var e=[];cr(e,Sa,t,Ji(t)),$o(Zy,e)}}function Ly(t,e,l){t==="focusin"?(sr(),ba=e,Sa=l,ba.attachEvent("onpropertychange",dr)):t==="focusout"&&sr()}function Ky(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Eu(Sa)}function ky(t,e){if(t==="click")return Eu(e)}function Jy(t,e){if(t==="input"||t==="change")return Eu(e)}function $y(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ce=typeof Object.is=="function"?Object.is:$y;function xa(t,e){if(Ce(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var l=Object.keys(t),n=Object.keys(e);if(l.length!==n.length)return!1;for(n=0;n<l.length;n++){var a=l[n];if(!xt.call(e,a)||!Ce(t[a],e[a]))return!1}return!0}function hr(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function yr(t,e){var l=hr(t);t=0;for(var n;l;){if(l.nodeType===3){if(n=t+l.textContent.length,t<=e&&n>=e)return{node:l,offset:e-t};t=n}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=hr(l)}}function mr(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?mr(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function vr(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=gu(t.document);e instanceof t.HTMLIFrameElement;){try{var l=typeof e.contentWindow.location.href=="string"}catch(n){l=!1}if(l)t=e.contentWindow;else break;e=gu(t.document)}return e}function uc(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var Py=yl&&"documentMode"in document&&11>=document.documentMode,Un=null,ic=null,Ma=null,cc=!1;function pr(t,e,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;cc||Un==null||Un!==gu(n)||(n=Un,"selectionStart"in n&&uc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ma&&xa(Ma,n)||(Ma=n,n=ri(ic,"onSelect"),0<n.length&&(e=new Au("onSelect","select",null,e,l),t.push({event:e,listeners:n}),e.target=Un)))}function Fl(t,e){var l={};return l[t.toLowerCase()]=e.toLowerCase(),l["Webkit"+t]="webkit"+e,l["Moz"+t]="moz"+e,l}var Bn={animationend:Fl("Animation","AnimationEnd"),animationiteration:Fl("Animation","AnimationIteration"),animationstart:Fl("Animation","AnimationStart"),transitionrun:Fl("Transition","TransitionRun"),transitionstart:Fl("Transition","TransitionStart"),transitioncancel:Fl("Transition","TransitionCancel"),transitionend:Fl("Transition","TransitionEnd")},fc={},gr={};yl&&(gr=document.createElement("div").style,"AnimationEvent"in window||(delete Bn.animationend.animation,delete Bn.animationiteration.animation,delete Bn.animationstart.animation),"TransitionEvent"in window||delete Bn.transitionend.transition);function tn(t){if(fc[t])return fc[t];if(!Bn[t])return t;var e=Bn[t],l;for(l in e)if(e.hasOwnProperty(l)&&l in gr)return fc[t]=e[l];return t}var br=tn("animationend"),Sr=tn("animationiteration"),xr=tn("animationstart"),Iy=tn("transitionrun"),Wy=tn("transitionstart"),Fy=tn("transitioncancel"),Mr=tn("transitionend"),Ar=new Map,oc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");oc.push("scrollEnd");function tl(t,e){Ar.set(t,e),Il(e,[t])}var Tr=new WeakMap;function Ke(t,e){if(typeof t=="object"&&t!==null){var l=Tr.get(t);return l!==void 0?l:(e={value:t,source:e,stack:wo(e)},Tr.set(t,e),e)}return{value:t,source:e,stack:wo(e)}}var ke=[],Nn=0,rc=0;function Ou(){for(var t=Nn,e=rc=Nn=0;e<t;){var l=ke[e];ke[e++]=null;var n=ke[e];ke[e++]=null;var a=ke[e];ke[e++]=null;var u=ke[e];if(ke[e++]=null,n!==null&&a!==null){var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}u!==0&&Er(l,a,u)}}function _u(t,e,l,n){ke[Nn++]=t,ke[Nn++]=e,ke[Nn++]=l,ke[Nn++]=n,rc|=n,t.lanes|=n,t=t.alternate,t!==null&&(t.lanes|=n)}function sc(t,e,l,n){return _u(t,e,l,n),zu(t)}function Hn(t,e){return _u(t,null,null,e),zu(t)}function Er(t,e,l){t.lanes|=l;var n=t.alternate;n!==null&&(n.lanes|=l);for(var a=!1,u=t.return;u!==null;)u.childLanes|=l,n=u.alternate,n!==null&&(n.childLanes|=l),u.tag===22&&(t=u.stateNode,t===null||t._visibility&1||(a=!0)),t=u,u=u.return;return t.tag===3?(u=t.stateNode,a&&e!==null&&(a=31-Mt(l),t=u.hiddenUpdates,n=t[a],n===null?t[a]=[e]:n.push(e),e.lane=l|536870912),u):null}function zu(t){if(50<ka)throw ka=0,gf=null,Error(f(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var qn={};function tm(t,e,l,n){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ye(t,e,l,n){return new tm(t,e,l,n)}function dc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ml(t,e){var l=t.alternate;return l===null?(l=Ye(t.tag,e,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=e,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,e=t.dependencies,l.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function Or(t,e){t.flags&=65011714;var l=t.alternate;return l===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,e=l.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function Du(t,e,l,n,a,u){var o=0;if(n=t,typeof t=="function")dc(t)&&(o=1);else if(typeof t=="string")o=lv(t,l,K.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case tt:return t=Ye(31,l,e,a),t.elementType=tt,t.lanes=u,t;case j:return en(l.children,a,u,e);case J:o=8,a|=24;break;case I:return t=Ye(12,l,e,a|2),t.elementType=I,t.lanes=u,t;case V:return t=Ye(13,l,e,a),t.elementType=V,t.lanes=u,t;case ht:return t=Ye(19,l,e,a),t.elementType=ht,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case st:case Z:o=10;break t;case dt:o=9;break t;case lt:o=11;break t;case P:o=14;break t;case nt:o=16,n=null;break t}o=29,l=Error(f(130,t===null?"null":typeof t,"")),n=null}return e=Ye(o,l,e,a),e.elementType=t,e.type=n,e.lanes=u,e}function en(t,e,l,n){return t=Ye(7,t,n,e),t.lanes=l,t}function hc(t,e,l){return t=Ye(6,t,null,e),t.lanes=l,t}function yc(t,e,l){return e=Ye(4,t.children!==null?t.children:[],t.key,e),e.lanes=l,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var Cn=[],Yn=0,Ru=null,Uu=0,Je=[],$e=0,ln=null,vl=1,pl="";function nn(t,e){Cn[Yn++]=Uu,Cn[Yn++]=Ru,Ru=t,Uu=e}function _r(t,e,l){Je[$e++]=vl,Je[$e++]=pl,Je[$e++]=ln,ln=t;var n=vl;t=pl;var a=32-Mt(n)-1;n&=~(1<<a),l+=1;var u=32-Mt(e)+a;if(30<u){var o=a-a%5;u=(n&(1<<o)-1).toString(32),n>>=o,a-=o,vl=1<<32-Mt(e)+a|l<<a|n,pl=u+t}else vl=1<<u|l<<a|n,pl=t}function mc(t){t.return!==null&&(nn(t,1),_r(t,1,0))}function vc(t){for(;t===Ru;)Ru=Cn[--Yn],Cn[Yn]=null,Uu=Cn[--Yn],Cn[Yn]=null;for(;t===ln;)ln=Je[--$e],Je[$e]=null,pl=Je[--$e],Je[$e]=null,vl=Je[--$e],Je[$e]=null}var Oe=null,Ft=null,qt=!1,an=null,cl=!1,pc=Error(f(519));function un(t){var e=Error(f(418,""));throw Ea(Ke(e,t)),pc}function zr(t){var e=t.stateNode,l=t.type,n=t.memoizedProps;switch(e[Se]=t,e[Re]=n,l){case"dialog":Rt("cancel",e),Rt("close",e);break;case"iframe":case"object":case"embed":Rt("load",e);break;case"video":case"audio":for(l=0;l<$a.length;l++)Rt($a[l],e);break;case"source":Rt("error",e);break;case"img":case"image":case"link":Rt("error",e),Rt("load",e);break;case"details":Rt("toggle",e);break;case"input":Rt("invalid",e),Vo(e,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0),pu(e);break;case"select":Rt("invalid",e);break;case"textarea":Rt("invalid",e),Lo(e,n.value,n.defaultValue,n.children),pu(e)}l=n.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||e.textContent===""+l||n.suppressHydrationWarning===!0||Ld(e.textContent,l)?(n.popover!=null&&(Rt("beforetoggle",e),Rt("toggle",e)),n.onScroll!=null&&Rt("scroll",e),n.onScrollEnd!=null&&Rt("scrollend",e),n.onClick!=null&&(e.onclick=si),e=!0):e=!1,e||un(t)}function Dr(t){for(Oe=t.return;Oe;)switch(Oe.tag){case 5:case 13:cl=!1;return;case 27:case 3:cl=!0;return;default:Oe=Oe.return}}function Aa(t){if(t!==Oe)return!1;if(!qt)return Dr(t),qt=!0,!1;var e=t.tag,l;if((l=e!==3&&e!==27)&&((l=e===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||Hf(t.type,t.memoizedProps)),l=!l),l&&Ft&&un(t),Dr(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(f(317));t:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8)if(l=t.data,l==="/$"){if(e===0){Ft=ll(t.nextSibling);break t}e--}else l!=="$"&&l!=="$!"&&l!=="$?"||e++;t=t.nextSibling}Ft=null}}else e===27?(e=Ft,Ll(t.type)?(t=Gf,Gf=null,Ft=t):Ft=e):Ft=Oe?ll(t.stateNode.nextSibling):null;return!0}function Ta(){Ft=Oe=null,qt=!1}function Rr(){var t=an;return t!==null&&(He===null?He=t:He.push.apply(He,t),an=null),t}function Ea(t){an===null?an=[t]:an.push(t)}var gc=z(null),cn=null,gl=null;function Rl(t,e,l){C(gc,e._currentValue),e._currentValue=l}function bl(t){t._currentValue=gc.current,q(gc)}function bc(t,e,l){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,n!==null&&(n.childLanes|=e)):n!==null&&(n.childLanes&e)!==e&&(n.childLanes|=e),t===l)break;t=t.return}}function Sc(t,e,l,n){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var u=a.dependencies;if(u!==null){var o=a.child;u=u.firstContext;t:for(;u!==null;){var s=u;u=a;for(var p=0;p<e.length;p++)if(s.context===e[p]){u.lanes|=l,s=u.alternate,s!==null&&(s.lanes|=l),bc(u.return,l,t),n||(o=null);break t}u=s.next}}else if(a.tag===18){if(o=a.return,o===null)throw Error(f(341));o.lanes|=l,u=o.alternate,u!==null&&(u.lanes|=l),bc(o,l,t),o=null}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}}function Oa(t,e,l,n){t=null;for(var a=e,u=!1;a!==null;){if(!u){if(a.flags&524288)u=!0;else if(a.flags&262144)break}if(a.tag===10){var o=a.alternate;if(o===null)throw Error(f(387));if(o=o.memoizedProps,o!==null){var s=a.type;Ce(a.pendingProps.value,o.value)||(t!==null?t.push(s):t=[s])}}else if(a===at.current){if(o=a.alternate,o===null)throw Error(f(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(eu):t=[eu])}a=a.return}t!==null&&Sc(e,t,l,n),e.flags|=262144}function Bu(t){for(t=t.firstContext;t!==null;){if(!Ce(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function fn(t){cn=t,gl=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function xe(t){return Ur(cn,t)}function Nu(t,e){return cn===null&&fn(t),Ur(t,e)}function Ur(t,e){var l=e._currentValue;if(e={context:e,memoizedValue:l,next:null},gl===null){if(t===null)throw Error(f(308));gl=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else gl=gl.next=e;return l}var em=typeof AbortController!="undefined"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(l,n){t.push(n)}};this.abort=function(){e.aborted=!0,t.forEach(function(l){return l()})}},lm=c.unstable_scheduleCallback,nm=c.unstable_NormalPriority,fe={$$typeof:Z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xc(){return{controller:new em,data:new Map,refCount:0}}function _a(t){t.refCount--,t.refCount===0&&lm(nm,function(){t.controller.abort()})}var za=null,Mc=0,Gn=0,Xn=null;function am(t,e){if(za===null){var l=za=[];Mc=0,Gn=Ef(),Xn={status:"pending",value:void 0,then:function(n){l.push(n)}}}return Mc++,e.then(Br,Br),e}function Br(){if(--Mc===0&&za!==null){Xn!==null&&(Xn.status="fulfilled");var t=za;za=null,Gn=0,Xn=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function um(t,e){var l=[],n={status:"pending",value:null,reason:null,then:function(a){l.push(a)}};return t.then(function(){n.status="fulfilled",n.value=e;for(var a=0;a<l.length;a++)(0,l[a])(e)},function(a){for(n.status="rejected",n.reason=a,a=0;a<l.length;a++)(0,l[a])(void 0)}),n}var Nr=D.S;D.S=function(t,e){typeof e=="object"&&e!==null&&typeof e.then=="function"&&am(t,e),Nr!==null&&Nr(t,e)};var on=z(null);function Ac(){var t=on.current;return t!==null?t:Vt.pooledCache}function Hu(t,e){e===null?C(on,on.current):C(on,e.pool)}function Hr(){var t=Ac();return t===null?null:{parent:fe._currentValue,pool:t}}var Da=Error(f(460)),qr=Error(f(474)),qu=Error(f(542)),Tc={then:function(){}};function Cr(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Cu(){}function Yr(t,e,l){switch(l=t[l],l===void 0?t.push(e):l!==e&&(e.then(Cu,Cu),e=l),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,Xr(t),t;default:if(typeof e.status=="string")e.then(Cu,Cu);else{if(t=Vt,t!==null&&100<t.shellSuspendCounter)throw Error(f(482));t=e,t.status="pending",t.then(function(n){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=n}},function(n){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=n}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,Xr(t),t}throw Ra=e,Da}}var Ra=null;function Gr(){if(Ra===null)throw Error(f(459));var t=Ra;return Ra=null,t}function Xr(t){if(t===Da||t===qu)throw Error(f(483))}var Ul=!1;function Ec(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oc(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Bl(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Nl(t,e,l){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,Ct&2){var a=n.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),n.pending=e,e=zu(t),Er(t,null,l),e}return _u(t,n,e,l),zu(t)}function Ua(t,e,l){if(e=e.updateQueue,e!==null&&(e=e.shared,(l&4194048)!==0)){var n=e.lanes;n&=t.pendingLanes,l|=n,e.lanes=l,yu(t,l)}}function _c(t,e){var l=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var a=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var o={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?a=u=o:u=u.next=o,l=l.next}while(l!==null);u===null?a=u=e:u=u.next=e}else a=u=e;l={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:u,shared:n.shared,callbacks:n.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=e:t.next=e,l.lastBaseUpdate=e}var zc=!1;function Ba(){if(zc){var t=Xn;if(t!==null)throw t}}function Na(t,e,l,n){zc=!1;var a=t.updateQueue;Ul=!1;var u=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var p=s,T=p.next;p.next=null,o===null?u=T:o.next=T,o=p;var U=t.alternate;U!==null&&(U=U.updateQueue,s=U.lastBaseUpdate,s!==o&&(s===null?U.firstBaseUpdate=T:s.next=T,U.lastBaseUpdate=p))}if(u!==null){var H=a.baseState;o=0,U=T=p=null,s=u;do{var O=s.lane&-536870913,_=O!==s.lane;if(_?(Bt&O)===O:(n&O)===O){O!==0&&O===Gn&&(zc=!0),U!==null&&(U=U.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});t:{var St=t,pt=s;O=e;var jt=l;switch(pt.tag){case 1:if(St=pt.payload,typeof St=="function"){H=St.call(jt,H,O);break t}H=St;break t;case 3:St.flags=St.flags&-65537|128;case 0:if(St=pt.payload,O=typeof St=="function"?St.call(jt,H,O):St,O==null)break t;H=g({},H,O);break t;case 2:Ul=!0}}O=s.callback,O!==null&&(t.flags|=64,_&&(t.flags|=8192),_=a.callbacks,_===null?a.callbacks=[O]:_.push(O))}else _={lane:O,tag:s.tag,payload:s.payload,callback:s.callback,next:null},U===null?(T=U=_,p=H):U=U.next=_,o|=O;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;_=s,s=_.next,_.next=null,a.lastBaseUpdate=_,a.shared.pending=null}}while(!0);U===null&&(p=H),a.baseState=p,a.firstBaseUpdate=T,a.lastBaseUpdate=U,u===null&&(a.shared.lanes=0),jl|=o,t.lanes=o,t.memoizedState=H}}function wr(t,e){if(typeof t!="function")throw Error(f(191,t));t.call(e)}function jr(t,e){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)wr(l[t],e)}var wn=z(null),Yu=z(0);function Qr(t,e){t=Ol,C(Yu,t),C(wn,e),Ol=t|e.baseLanes}function Dc(){C(Yu,Ol),C(wn,wn.current)}function Rc(){Ol=Yu.current,q(wn),q(Yu)}var Hl=0,_t=null,Xt=null,ue=null,Gu=!1,jn=!1,rn=!1,Xu=0,Ha=0,Qn=null,im=0;function le(){throw Error(f(321))}function Uc(t,e){if(e===null)return!1;for(var l=0;l<e.length&&l<t.length;l++)if(!Ce(t[l],e[l]))return!1;return!0}function Bc(t,e,l,n,a,u){return Hl=u,_t=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,D.H=t===null||t.memoizedState===null?Es:Os,rn=!1,u=l(n,a),rn=!1,jn&&(u=Zr(e,l,n,a)),Vr(t),u}function Vr(t){D.H=Lu;var e=Xt!==null&&Xt.next!==null;if(Hl=0,ue=Xt=_t=null,Gu=!1,Ha=0,Qn=null,e)throw Error(f(300));t===null||de||(t=t.dependencies,t!==null&&Bu(t)&&(de=!0))}function Zr(t,e,l,n){_t=t;var a=0;do{if(jn&&(Qn=null),Ha=0,jn=!1,25<=a)throw Error(f(301));if(a+=1,ue=Xt=null,t.updateQueue!=null){var u=t.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}D.H=hm,u=e(l,n)}while(jn);return u}function cm(){var t=D.H,e=t.useState()[0];return e=typeof e.then=="function"?qa(e):e,t=t.useState()[0],(Xt!==null?Xt.memoizedState:null)!==t&&(_t.flags|=1024),e}function Nc(){var t=Xu!==0;return Xu=0,t}function Hc(t,e,l){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~l}function qc(t){if(Gu){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}Gu=!1}Hl=0,ue=Xt=_t=null,jn=!1,Ha=Xu=0,Qn=null}function Be(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ue===null?_t.memoizedState=ue=t:ue=ue.next=t,ue}function ie(){if(Xt===null){var t=_t.alternate;t=t!==null?t.memoizedState:null}else t=Xt.next;var e=ue===null?_t.memoizedState:ue.next;if(e!==null)ue=e,Xt=t;else{if(t===null)throw _t.alternate===null?Error(f(467)):Error(f(310));Xt=t,t={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},ue===null?_t.memoizedState=ue=t:ue=ue.next=t}return ue}function Cc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qa(t){var e=Ha;return Ha+=1,Qn===null&&(Qn=[]),t=Yr(Qn,t,e),e=_t,(ue===null?e.memoizedState:ue.next)===null&&(e=e.alternate,D.H=e===null||e.memoizedState===null?Es:Os),t}function wu(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return qa(t);if(t.$$typeof===Z)return xe(t)}throw Error(f(438,String(t)))}function Yc(t){var e=null,l=_t.updateQueue;if(l!==null&&(e=l.memoCache),e==null){var n=_t.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(e={data:n.data.map(function(a){return a.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),l===null&&(l=Cc(),_t.updateQueue=l),l.memoCache=e,l=e.data[e.index],l===void 0)for(l=e.data[e.index]=Array(t),n=0;n<t;n++)l[n]=mt;return e.index++,l}function Sl(t,e){return typeof e=="function"?e(t):e}function ju(t){var e=ie();return Gc(e,Xt,t)}function Gc(t,e,l){var n=t.queue;if(n===null)throw Error(f(311));n.lastRenderedReducer=l;var a=t.baseQueue,u=n.pending;if(u!==null){if(a!==null){var o=a.next;a.next=u.next,u.next=o}e.baseQueue=a=u,n.pending=null}if(u=t.baseState,a===null)t.memoizedState=u;else{e=a.next;var s=o=null,p=null,T=e,U=!1;do{var H=T.lane&-536870913;if(H!==T.lane?(Bt&H)===H:(Hl&H)===H){var O=T.revertLane;if(O===0)p!==null&&(p=p.next={lane:0,revertLane:0,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null}),H===Gn&&(U=!0);else if((Hl&O)===O){T=T.next,O===Gn&&(U=!0);continue}else H={lane:0,revertLane:T.revertLane,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},p===null?(s=p=H,o=u):p=p.next=H,_t.lanes|=O,jl|=O;H=T.action,rn&&l(u,H),u=T.hasEagerState?T.eagerState:l(u,H)}else O={lane:H,revertLane:T.revertLane,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},p===null?(s=p=O,o=u):p=p.next=O,_t.lanes|=H,jl|=H;T=T.next}while(T!==null&&T!==e);if(p===null?o=u:p.next=s,!Ce(u,t.memoizedState)&&(de=!0,U&&(l=Xn,l!==null)))throw l;t.memoizedState=u,t.baseState=o,t.baseQueue=p,n.lastRenderedState=u}return a===null&&(n.lanes=0),[t.memoizedState,n.dispatch]}function Xc(t){var e=ie(),l=e.queue;if(l===null)throw Error(f(311));l.lastRenderedReducer=t;var n=l.dispatch,a=l.pending,u=e.memoizedState;if(a!==null){l.pending=null;var o=a=a.next;do u=t(u,o.action),o=o.next;while(o!==a);Ce(u,e.memoizedState)||(de=!0),e.memoizedState=u,e.baseQueue===null&&(e.baseState=u),l.lastRenderedState=u}return[u,n]}function Lr(t,e,l){var n=_t,a=ie(),u=qt;if(u){if(l===void 0)throw Error(f(407));l=l()}else l=e();var o=!Ce((Xt||a).memoizedState,l);o&&(a.memoizedState=l,de=!0),a=a.queue;var s=Jr.bind(null,n,a,t);if(Ca(2048,8,s,[t]),a.getSnapshot!==e||o||ue!==null&&ue.memoizedState.tag&1){if(n.flags|=2048,Vn(9,Qu(),kr.bind(null,n,a,l,e),null),Vt===null)throw Error(f(349));u||Hl&124||Kr(n,e,l)}return l}function Kr(t,e,l){t.flags|=16384,t={getSnapshot:e,value:l},e=_t.updateQueue,e===null?(e=Cc(),_t.updateQueue=e,e.stores=[t]):(l=e.stores,l===null?e.stores=[t]:l.push(t))}function kr(t,e,l,n){e.value=l,e.getSnapshot=n,$r(e)&&Pr(t)}function Jr(t,e,l){return l(function(){$r(e)&&Pr(t)})}function $r(t){var e=t.getSnapshot;t=t.value;try{var l=e();return!Ce(t,l)}catch(n){return!0}}function Pr(t){var e=Hn(t,2);e!==null&&Qe(e,t,2)}function wc(t){var e=Be();if(typeof t=="function"){var l=t;if(t=l(),rn){At(!0);try{l()}finally{At(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:t},e}function Ir(t,e,l,n){return t.baseState=l,Gc(t,Xt,typeof n=="function"?n:Sl)}function fm(t,e,l,n,a){if(Zu(t))throw Error(f(485));if(t=e.action,t!==null){var u={payload:a,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(o){u.listeners.push(o)}};D.T!==null?l(!0):u.isTransition=!1,n(u),l=e.pending,l===null?(u.next=e.pending=u,Wr(e,u)):(u.next=l.next,e.pending=l.next=u)}}function Wr(t,e){var l=e.action,n=e.payload,a=t.state;if(e.isTransition){var u=D.T,o={};D.T=o;try{var s=l(a,n),p=D.S;p!==null&&p(o,s),Fr(t,e,s)}catch(T){jc(t,e,T)}finally{D.T=u}}else try{u=l(a,n),Fr(t,e,u)}catch(T){jc(t,e,T)}}function Fr(t,e,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(n){ts(t,e,n)},function(n){return jc(t,e,n)}):ts(t,e,l)}function ts(t,e,l){e.status="fulfilled",e.value=l,es(e),t.state=l,e=t.pending,e!==null&&(l=e.next,l===e?t.pending=null:(l=l.next,e.next=l,Wr(t,l)))}function jc(t,e,l){var n=t.pending;if(t.pending=null,n!==null){n=n.next;do e.status="rejected",e.reason=l,es(e),e=e.next;while(e!==n)}t.action=null}function es(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function ls(t,e){return e}function ns(t,e){if(qt){var l=Vt.formState;if(l!==null){t:{var n=_t;if(qt){if(Ft){e:{for(var a=Ft,u=cl;a.nodeType!==8;){if(!u){a=null;break e}if(a=ll(a.nextSibling),a===null){a=null;break e}}u=a.data,a=u==="F!"||u==="F"?a:null}if(a){Ft=ll(a.nextSibling),n=a.data==="F!";break t}}un(n)}n=!1}n&&(e=l[0])}}return l=Be(),l.memoizedState=l.baseState=e,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e},l.queue=n,l=Ms.bind(null,_t,n),n.dispatch=l,n=wc(!1),u=Kc.bind(null,_t,!1,n.queue),n=Be(),a={state:e,dispatch:null,action:t,pending:null},n.queue=a,l=fm.bind(null,_t,a,u,l),a.dispatch=l,n.memoizedState=t,[e,l,!1]}function as(t){var e=ie();return us(e,Xt,t)}function us(t,e,l){if(e=Gc(t,e,ls)[0],t=ju(Sl)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var n=qa(e)}catch(o){throw o===Da?qu:o}else n=e;e=ie();var a=e.queue,u=a.dispatch;return l!==e.memoizedState&&(_t.flags|=2048,Vn(9,Qu(),om.bind(null,a,l),null)),[n,u,t]}function om(t,e){t.action=e}function is(t){var e=ie(),l=Xt;if(l!==null)return us(e,l,t);ie(),e=e.memoizedState,l=ie();var n=l.queue.dispatch;return l.memoizedState=t,[e,n,!1]}function Vn(t,e,l,n){return t={tag:t,create:l,deps:n,inst:e,next:null},e=_t.updateQueue,e===null&&(e=Cc(),_t.updateQueue=e),l=e.lastEffect,l===null?e.lastEffect=t.next=t:(n=l.next,l.next=t,t.next=n,e.lastEffect=t),t}function Qu(){return{destroy:void 0,resource:void 0}}function cs(){return ie().memoizedState}function Vu(t,e,l,n){var a=Be();n=n===void 0?null:n,_t.flags|=t,a.memoizedState=Vn(1|e,Qu(),l,n)}function Ca(t,e,l,n){var a=ie();n=n===void 0?null:n;var u=a.memoizedState.inst;Xt!==null&&n!==null&&Uc(n,Xt.memoizedState.deps)?a.memoizedState=Vn(e,u,l,n):(_t.flags|=t,a.memoizedState=Vn(1|e,u,l,n))}function fs(t,e){Vu(8390656,8,t,e)}function os(t,e){Ca(2048,8,t,e)}function rs(t,e){return Ca(4,2,t,e)}function ss(t,e){return Ca(4,4,t,e)}function ds(t,e){if(typeof e=="function"){t=t();var l=e(t);return function(){typeof l=="function"?l():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function hs(t,e,l){l=l!=null?l.concat([t]):null,Ca(4,4,ds.bind(null,e,t),l)}function Qc(){}function ys(t,e){var l=ie();e=e===void 0?null:e;var n=l.memoizedState;return e!==null&&Uc(e,n[1])?n[0]:(l.memoizedState=[t,e],t)}function ms(t,e){var l=ie();e=e===void 0?null:e;var n=l.memoizedState;if(e!==null&&Uc(e,n[1]))return n[0];if(n=t(),rn){At(!0);try{t()}finally{At(!1)}}return l.memoizedState=[n,e],n}function Vc(t,e,l){return l===void 0||Hl&1073741824?t.memoizedState=e:(t.memoizedState=l,t=gd(),_t.lanes|=t,jl|=t,l)}function vs(t,e,l,n){return Ce(l,e)?l:wn.current!==null?(t=Vc(t,l,n),Ce(t,e)||(de=!0),t):Hl&42?(t=gd(),_t.lanes|=t,jl|=t,e):(de=!0,t.memoizedState=l)}function ps(t,e,l,n,a){var u=G.p;G.p=u!==0&&8>u?u:8;var o=D.T,s={};D.T=s,Kc(t,!1,e,l);try{var p=a(),T=D.S;if(T!==null&&T(s,p),p!==null&&typeof p=="object"&&typeof p.then=="function"){var U=um(p,n);Ya(t,e,U,je(t))}else Ya(t,e,n,je(t))}catch(H){Ya(t,e,{then:function(){},status:"rejected",reason:H},je())}finally{G.p=u,D.T=o}}function rm(){}function Zc(t,e,l,n){if(t.tag!==5)throw Error(f(476));var a=gs(t).queue;ps(t,a,e,$,l===null?rm:function(){return bs(t),l(n)})}function gs(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:$},next:null};var l={};return e.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:l},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function bs(t){var e=gs(t).next.queue;Ya(t,e,{},je())}function Lc(){return xe(eu)}function Ss(){return ie().memoizedState}function xs(){return ie().memoizedState}function sm(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var l=je();t=Bl(l);var n=Nl(e,t,l);n!==null&&(Qe(n,e,l),Ua(n,e,l)),e={cache:xc()},t.payload=e;return}e=e.return}}function dm(t,e,l){var n=je();l={lane:n,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null},Zu(t)?As(e,l):(l=sc(t,e,l,n),l!==null&&(Qe(l,t,n),Ts(l,e,n)))}function Ms(t,e,l){var n=je();Ya(t,e,l,n)}function Ya(t,e,l,n){var a={lane:n,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null};if(Zu(t))As(e,a);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=e.lastRenderedReducer,u!==null))try{var o=e.lastRenderedState,s=u(o,l);if(a.hasEagerState=!0,a.eagerState=s,Ce(s,o))return _u(t,e,a,0),Vt===null&&Ou(),!1}catch(p){}finally{}if(l=sc(t,e,a,n),l!==null)return Qe(l,t,n),Ts(l,e,n),!0}return!1}function Kc(t,e,l,n){if(n={lane:2,revertLane:Ef(),action:n,hasEagerState:!1,eagerState:null,next:null},Zu(t)){if(e)throw Error(f(479))}else e=sc(t,l,n,2),e!==null&&Qe(e,t,2)}function Zu(t){var e=t.alternate;return t===_t||e!==null&&e===_t}function As(t,e){jn=Gu=!0;var l=t.pending;l===null?e.next=e:(e.next=l.next,l.next=e),t.pending=e}function Ts(t,e,l){if(l&4194048){var n=e.lanes;n&=t.pendingLanes,l|=n,e.lanes=l,yu(t,l)}}var Lu={readContext:xe,use:wu,useCallback:le,useContext:le,useEffect:le,useImperativeHandle:le,useLayoutEffect:le,useInsertionEffect:le,useMemo:le,useReducer:le,useRef:le,useState:le,useDebugValue:le,useDeferredValue:le,useTransition:le,useSyncExternalStore:le,useId:le,useHostTransitionStatus:le,useFormState:le,useActionState:le,useOptimistic:le,useMemoCache:le,useCacheRefresh:le},Es={readContext:xe,use:wu,useCallback:function(t,e){return Be().memoizedState=[t,e===void 0?null:e],t},useContext:xe,useEffect:fs,useImperativeHandle:function(t,e,l){l=l!=null?l.concat([t]):null,Vu(4194308,4,ds.bind(null,e,t),l)},useLayoutEffect:function(t,e){return Vu(4194308,4,t,e)},useInsertionEffect:function(t,e){Vu(4,2,t,e)},useMemo:function(t,e){var l=Be();e=e===void 0?null:e;var n=t();if(rn){At(!0);try{t()}finally{At(!1)}}return l.memoizedState=[n,e],n},useReducer:function(t,e,l){var n=Be();if(l!==void 0){var a=l(e);if(rn){At(!0);try{l(e)}finally{At(!1)}}}else a=e;return n.memoizedState=n.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},n.queue=t,t=t.dispatch=dm.bind(null,_t,t),[n.memoizedState,t]},useRef:function(t){var e=Be();return t={current:t},e.memoizedState=t},useState:function(t){t=wc(t);var e=t.queue,l=Ms.bind(null,_t,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:Qc,useDeferredValue:function(t,e){var l=Be();return Vc(l,t,e)},useTransition:function(){var t=wc(!1);return t=ps.bind(null,_t,t.queue,!0,!1),Be().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var n=_t,a=Be();if(qt){if(l===void 0)throw Error(f(407));l=l()}else{if(l=e(),Vt===null)throw Error(f(349));Bt&124||Kr(n,e,l)}a.memoizedState=l;var u={value:l,getSnapshot:e};return a.queue=u,fs(Jr.bind(null,n,u,t),[t]),n.flags|=2048,Vn(9,Qu(),kr.bind(null,n,u,l,e),null),l},useId:function(){var t=Be(),e=Vt.identifierPrefix;if(qt){var l=pl,n=vl;l=(n&~(1<<32-Mt(n)-1)).toString(32)+l,e="\xAB"+e+"R"+l,l=Xu++,0<l&&(e+="H"+l.toString(32)),e+="\xBB"}else l=im++,e="\xAB"+e+"r"+l.toString(32)+"\xBB";return t.memoizedState=e},useHostTransitionStatus:Lc,useFormState:ns,useActionState:ns,useOptimistic:function(t){var e=Be();e.memoizedState=e.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=l,e=Kc.bind(null,_t,!0,l),l.dispatch=e,[t,e]},useMemoCache:Yc,useCacheRefresh:function(){return Be().memoizedState=sm.bind(null,_t)}},Os={readContext:xe,use:wu,useCallback:ys,useContext:xe,useEffect:os,useImperativeHandle:hs,useInsertionEffect:rs,useLayoutEffect:ss,useMemo:ms,useReducer:ju,useRef:cs,useState:function(){return ju(Sl)},useDebugValue:Qc,useDeferredValue:function(t,e){var l=ie();return vs(l,Xt.memoizedState,t,e)},useTransition:function(){var t=ju(Sl)[0],e=ie().memoizedState;return[typeof t=="boolean"?t:qa(t),e]},useSyncExternalStore:Lr,useId:Ss,useHostTransitionStatus:Lc,useFormState:as,useActionState:as,useOptimistic:function(t,e){var l=ie();return Ir(l,Xt,t,e)},useMemoCache:Yc,useCacheRefresh:xs},hm={readContext:xe,use:wu,useCallback:ys,useContext:xe,useEffect:os,useImperativeHandle:hs,useInsertionEffect:rs,useLayoutEffect:ss,useMemo:ms,useReducer:Xc,useRef:cs,useState:function(){return Xc(Sl)},useDebugValue:Qc,useDeferredValue:function(t,e){var l=ie();return Xt===null?Vc(l,t,e):vs(l,Xt.memoizedState,t,e)},useTransition:function(){var t=Xc(Sl)[0],e=ie().memoizedState;return[typeof t=="boolean"?t:qa(t),e]},useSyncExternalStore:Lr,useId:Ss,useHostTransitionStatus:Lc,useFormState:is,useActionState:is,useOptimistic:function(t,e){var l=ie();return Xt!==null?Ir(l,Xt,t,e):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:Yc,useCacheRefresh:xs},Zn=null,Ga=0;function Ku(t){var e=Ga;return Ga+=1,Zn===null&&(Zn=[]),Yr(Zn,t,e)}function Xa(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function ku(t,e){throw e.$$typeof===E?Error(f(525)):(t=Object.prototype.toString.call(e),Error(f(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function _s(t){var e=t._init;return e(t._payload)}function zs(t){function e(M,x){if(t){var A=M.deletions;A===null?(M.deletions=[x],M.flags|=16):A.push(x)}}function l(M,x){if(!t)return null;for(;x!==null;)e(M,x),x=x.sibling;return null}function n(M){for(var x=new Map;M!==null;)M.key!==null?x.set(M.key,M):x.set(M.index,M),M=M.sibling;return x}function a(M,x){return M=ml(M,x),M.index=0,M.sibling=null,M}function u(M,x,A){return M.index=A,t?(A=M.alternate,A!==null?(A=A.index,A<x?(M.flags|=67108866,x):A):(M.flags|=67108866,x)):(M.flags|=1048576,x)}function o(M){return t&&M.alternate===null&&(M.flags|=67108866),M}function s(M,x,A,B){return x===null||x.tag!==6?(x=hc(A,M.mode,B),x.return=M,x):(x=a(x,A),x.return=M,x)}function p(M,x,A,B){var F=A.type;return F===j?U(M,x,A.props.children,B,A.key):x!==null&&(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===nt&&_s(F)===x.type)?(x=a(x,A.props),Xa(x,A),x.return=M,x):(x=Du(A.type,A.key,A.props,null,M.mode,B),Xa(x,A),x.return=M,x)}function T(M,x,A,B){return x===null||x.tag!==4||x.stateNode.containerInfo!==A.containerInfo||x.stateNode.implementation!==A.implementation?(x=yc(A,M.mode,B),x.return=M,x):(x=a(x,A.children||[]),x.return=M,x)}function U(M,x,A,B,F){return x===null||x.tag!==7?(x=en(A,M.mode,B,F),x.return=M,x):(x=a(x,A),x.return=M,x)}function H(M,x,A){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=hc(""+x,M.mode,A),x.return=M,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case R:return A=Du(x.type,x.key,x.props,null,M.mode,A),Xa(A,x),A.return=M,A;case w:return x=yc(x,M.mode,A),x.return=M,x;case nt:var B=x._init;return x=B(x._payload),H(M,x,A)}if(Tt(x)||L(x))return x=en(x,M.mode,A,null),x.return=M,x;if(typeof x.then=="function")return H(M,Ku(x),A);if(x.$$typeof===Z)return H(M,Nu(M,x),A);ku(M,x)}return null}function O(M,x,A,B){var F=x!==null?x.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return F!==null?null:s(M,x,""+A,B);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case R:return A.key===F?p(M,x,A,B):null;case w:return A.key===F?T(M,x,A,B):null;case nt:return F=A._init,A=F(A._payload),O(M,x,A,B)}if(Tt(A)||L(A))return F!==null?null:U(M,x,A,B,null);if(typeof A.then=="function")return O(M,x,Ku(A),B);if(A.$$typeof===Z)return O(M,x,Nu(M,A),B);ku(M,A)}return null}function _(M,x,A,B,F){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return M=M.get(A)||null,s(x,M,""+B,F);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case R:return M=M.get(B.key===null?A:B.key)||null,p(x,M,B,F);case w:return M=M.get(B.key===null?A:B.key)||null,T(x,M,B,F);case nt:var zt=B._init;return B=zt(B._payload),_(M,x,A,B,F)}if(Tt(B)||L(B))return M=M.get(A)||null,U(x,M,B,F,null);if(typeof B.then=="function")return _(M,x,A,Ku(B),F);if(B.$$typeof===Z)return _(M,x,A,Nu(x,B),F);ku(x,B)}return null}function St(M,x,A,B){for(var F=null,zt=null,it=x,gt=x=0,ye=null;it!==null&&gt<A.length;gt++){it.index>gt?(ye=it,it=null):ye=it.sibling;var Ht=O(M,it,A[gt],B);if(Ht===null){it===null&&(it=ye);break}t&&it&&Ht.alternate===null&&e(M,it),x=u(Ht,x,gt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht,it=ye}if(gt===A.length)return l(M,it),qt&&nn(M,gt),F;if(it===null){for(;gt<A.length;gt++)it=H(M,A[gt],B),it!==null&&(x=u(it,x,gt),zt===null?F=it:zt.sibling=it,zt=it);return qt&&nn(M,gt),F}for(it=n(it);gt<A.length;gt++)ye=_(it,M,gt,A[gt],B),ye!==null&&(t&&ye.alternate!==null&&it.delete(ye.key===null?gt:ye.key),x=u(ye,x,gt),zt===null?F=ye:zt.sibling=ye,zt=ye);return t&&it.forEach(function(Pl){return e(M,Pl)}),qt&&nn(M,gt),F}function pt(M,x,A,B){if(A==null)throw Error(f(151));for(var F=null,zt=null,it=x,gt=x=0,ye=null,Ht=A.next();it!==null&&!Ht.done;gt++,Ht=A.next()){it.index>gt?(ye=it,it=null):ye=it.sibling;var Pl=O(M,it,Ht.value,B);if(Pl===null){it===null&&(it=ye);break}t&&it&&Pl.alternate===null&&e(M,it),x=u(Pl,x,gt),zt===null?F=Pl:zt.sibling=Pl,zt=Pl,it=ye}if(Ht.done)return l(M,it),qt&&nn(M,gt),F;if(it===null){for(;!Ht.done;gt++,Ht=A.next())Ht=H(M,Ht.value,B),Ht!==null&&(x=u(Ht,x,gt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht);return qt&&nn(M,gt),F}for(it=n(it);!Ht.done;gt++,Ht=A.next())Ht=_(it,M,gt,Ht.value,B),Ht!==null&&(t&&Ht.alternate!==null&&it.delete(Ht.key===null?gt:Ht.key),x=u(Ht,x,gt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht);return t&&it.forEach(function(yv){return e(M,yv)}),qt&&nn(M,gt),F}function jt(M,x,A,B){if(typeof A=="object"&&A!==null&&A.type===j&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case R:t:{for(var F=A.key;x!==null;){if(x.key===F){if(F=A.type,F===j){if(x.tag===7){l(M,x.sibling),B=a(x,A.props.children),B.return=M,M=B;break t}}else if(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===nt&&_s(F)===x.type){l(M,x.sibling),B=a(x,A.props),Xa(B,A),B.return=M,M=B;break t}l(M,x);break}else e(M,x);x=x.sibling}A.type===j?(B=en(A.props.children,M.mode,B,A.key),B.return=M,M=B):(B=Du(A.type,A.key,A.props,null,M.mode,B),Xa(B,A),B.return=M,M=B)}return o(M);case w:t:{for(F=A.key;x!==null;){if(x.key===F)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){l(M,x.sibling),B=a(x,A.children||[]),B.return=M,M=B;break t}else{l(M,x);break}else e(M,x);x=x.sibling}B=yc(A,M.mode,B),B.return=M,M=B}return o(M);case nt:return F=A._init,A=F(A._payload),jt(M,x,A,B)}if(Tt(A))return St(M,x,A,B);if(L(A)){if(F=L(A),typeof F!="function")throw Error(f(150));return A=F.call(A),pt(M,x,A,B)}if(typeof A.then=="function")return jt(M,x,Ku(A),B);if(A.$$typeof===Z)return jt(M,x,Nu(M,A),B);ku(M,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,x!==null&&x.tag===6?(l(M,x.sibling),B=a(x,A),B.return=M,M=B):(l(M,x),B=hc(A,M.mode,B),B.return=M,M=B),o(M)):l(M,x)}return function(M,x,A,B){try{Ga=0;var F=jt(M,x,A,B);return Zn=null,F}catch(it){if(it===Da||it===qu)throw it;var zt=Ye(29,it,null,M.mode);return zt.lanes=B,zt.return=M,zt}finally{}}}var Ln=zs(!0),Ds=zs(!1),Pe=z(null),fl=null;function ql(t){var e=t.alternate;C(oe,oe.current&1),C(Pe,t),fl===null&&(e===null||wn.current!==null||e.memoizedState!==null)&&(fl=t)}function Rs(t){if(t.tag===22){if(C(oe,oe.current),C(Pe,t),fl===null){var e=t.alternate;e!==null&&e.memoizedState!==null&&(fl=t)}}else Cl()}function Cl(){C(oe,oe.current),C(Pe,Pe.current)}function xl(t){q(Pe),fl===t&&(fl=null),q(oe)}var oe=z(0);function Ju(t){for(var e=t;e!==null;){if(e.tag===13){var l=e.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||l.data==="$?"||Yf(l)))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}function kc(t,e,l,n){e=t.memoizedState,l=l(n,e),l=l==null?e:g({},e,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var Jc={enqueueSetState:function(t,e,l){t=t._reactInternals;var n=je(),a=Bl(n);a.payload=e,l!=null&&(a.callback=l),e=Nl(t,a,n),e!==null&&(Qe(e,t,n),Ua(e,t,n))},enqueueReplaceState:function(t,e,l){t=t._reactInternals;var n=je(),a=Bl(n);a.tag=1,a.payload=e,l!=null&&(a.callback=l),e=Nl(t,a,n),e!==null&&(Qe(e,t,n),Ua(e,t,n))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var l=je(),n=Bl(l);n.tag=2,e!=null&&(n.callback=e),e=Nl(t,n,l),e!==null&&(Qe(e,t,l),Ua(e,t,l))}};function Us(t,e,l,n,a,u,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,u,o):e.prototype&&e.prototype.isPureReactComponent?!xa(l,n)||!xa(a,u):!0}function Bs(t,e,l,n){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(l,n),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(l,n),e.state!==t&&Jc.enqueueReplaceState(e,e.state,null)}function sn(t,e){var l=e;if("ref"in e){l={};for(var n in e)n!=="ref"&&(l[n]=e[n])}if(t=t.defaultProps){l===e&&(l=g({},l));for(var a in t)l[a]===void 0&&(l[a]=t[a])}return l}var $u=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function Ns(t){$u(t)}function Hs(t){console.error(t)}function qs(t){$u(t)}function Pu(t,e){try{var l=t.onUncaughtError;l(e.value,{componentStack:e.stack})}catch(n){setTimeout(function(){throw n})}}function Cs(t,e,l){try{var n=t.onCaughtError;n(l.value,{componentStack:l.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function $c(t,e,l){return l=Bl(l),l.tag=3,l.payload={element:null},l.callback=function(){Pu(t,e)},l}function Ys(t){return t=Bl(t),t.tag=3,t}function Gs(t,e,l,n){var a=l.type.getDerivedStateFromError;if(typeof a=="function"){var u=n.value;t.payload=function(){return a(u)},t.callback=function(){Cs(e,l,n)}}var o=l.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(t.callback=function(){Cs(e,l,n),typeof a!="function"&&(Ql===null?Ql=new Set([this]):Ql.add(this));var s=n.stack;this.componentDidCatch(n.value,{componentStack:s!==null?s:""})})}function ym(t,e,l,n,a){if(l.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(e=l.alternate,e!==null&&Oa(e,l,a,!0),l=Pe.current,l!==null){switch(l.tag){case 13:return fl===null?Sf():l.alternate===null&&te===0&&(te=3),l.flags&=-257,l.flags|=65536,l.lanes=a,n===Tc?l.flags|=16384:(e=l.updateQueue,e===null?l.updateQueue=new Set([n]):e.add(n),Mf(t,n,a)),!1;case 22:return l.flags|=65536,n===Tc?l.flags|=16384:(e=l.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([n])},l.updateQueue=e):(l=e.retryQueue,l===null?e.retryQueue=new Set([n]):l.add(n)),Mf(t,n,a)),!1}throw Error(f(435,l.tag))}return Mf(t,n,a),Sf(),!1}if(qt)return e=Pe.current,e!==null?(!(e.flags&65536)&&(e.flags|=256),e.flags|=65536,e.lanes=a,n!==pc&&(t=Error(f(422),{cause:n}),Ea(Ke(t,l)))):(n!==pc&&(e=Error(f(423),{cause:n}),Ea(Ke(e,l))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,n=Ke(n,l),a=$c(t.stateNode,n,a),_c(t,a),te!==4&&(te=2)),!1;var u=Error(f(520),{cause:n});if(u=Ke(u,l),Ka===null?Ka=[u]:Ka.push(u),te!==4&&(te=2),e===null)return!0;n=Ke(n,l),l=e;do{switch(l.tag){case 3:return l.flags|=65536,t=a&-a,l.lanes|=t,t=$c(l.stateNode,n,t),_c(l,t),!1;case 1:if(e=l.type,u=l.stateNode,(l.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Ql===null||!Ql.has(u))))return l.flags|=65536,a&=-a,l.lanes|=a,a=Ys(a),Gs(a,t,l,n),_c(l,a),!1}l=l.return}while(l!==null);return!1}var Xs=Error(f(461)),de=!1;function ve(t,e,l,n){e.child=t===null?Ds(e,null,l,n):Ln(e,t.child,l,n)}function ws(t,e,l,n,a){l=l.render;var u=e.ref;if("ref"in n){var o={};for(var s in n)s!=="ref"&&(o[s]=n[s])}else o=n;return fn(e),n=Bc(t,e,l,o,u,a),s=Nc(),t!==null&&!de?(Hc(t,e,a),Ml(t,e,a)):(qt&&s&&mc(e),e.flags|=1,ve(t,e,n,a),e.child)}function js(t,e,l,n,a){if(t===null){var u=l.type;return typeof u=="function"&&!dc(u)&&u.defaultProps===void 0&&l.compare===null?(e.tag=15,e.type=u,Qs(t,e,u,n,a)):(t=Du(l.type,null,n,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(u=t.child,!nf(t,a)){var o=u.memoizedProps;if(l=l.compare,l=l!==null?l:xa,l(o,n)&&t.ref===e.ref)return Ml(t,e,a)}return e.flags|=1,t=ml(u,n),t.ref=e.ref,t.return=e,e.child=t}function Qs(t,e,l,n,a){if(t!==null){var u=t.memoizedProps;if(xa(u,n)&&t.ref===e.ref)if(de=!1,e.pendingProps=n=u,nf(t,a))t.flags&131072&&(de=!0);else return e.lanes=t.lanes,Ml(t,e,a)}return Pc(t,e,l,n,a)}function Vs(t,e,l){var n=e.pendingProps,a=n.children,u=t!==null?t.memoizedState:null;if(n.mode==="hidden"){if(e.flags&128){if(n=u!==null?u.baseLanes|l:l,t!==null){for(a=e.child=t.child,u=0;a!==null;)u=u|a.lanes|a.childLanes,a=a.sibling;e.childLanes=u&~n}else e.childLanes=0,e.child=null;return Zs(t,e,n,l)}if(l&536870912)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Hu(e,u!==null?u.cachePool:null),u!==null?Qr(e,u):Dc(),Rs(e);else return e.lanes=e.childLanes=536870912,Zs(t,e,u!==null?u.baseLanes|l:l,l)}else u!==null?(Hu(e,u.cachePool),Qr(e,u),Cl(),e.memoizedState=null):(t!==null&&Hu(e,null),Dc(),Cl());return ve(t,e,a,l),e.child}function Zs(t,e,l,n){var a=Ac();return a=a===null?null:{parent:fe._currentValue,pool:a},e.memoizedState={baseLanes:l,cachePool:a},t!==null&&Hu(e,null),Dc(),Rs(e),t!==null&&Oa(t,e,n,!0),null}function Iu(t,e){var l=e.ref;if(l===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(f(284));(t===null||t.ref!==l)&&(e.flags|=4194816)}}function Pc(t,e,l,n,a){return fn(e),l=Bc(t,e,l,n,void 0,a),n=Nc(),t!==null&&!de?(Hc(t,e,a),Ml(t,e,a)):(qt&&n&&mc(e),e.flags|=1,ve(t,e,l,a),e.child)}function Ls(t,e,l,n,a,u){return fn(e),e.updateQueue=null,l=Zr(e,n,l,a),Vr(t),n=Nc(),t!==null&&!de?(Hc(t,e,u),Ml(t,e,u)):(qt&&n&&mc(e),e.flags|=1,ve(t,e,l,u),e.child)}function Ks(t,e,l,n,a){if(fn(e),e.stateNode===null){var u=qn,o=l.contextType;typeof o=="object"&&o!==null&&(u=xe(o)),u=new l(n,u),e.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Jc,e.stateNode=u,u._reactInternals=e,u=e.stateNode,u.props=n,u.state=e.memoizedState,u.refs={},Ec(e),o=l.contextType,u.context=typeof o=="object"&&o!==null?xe(o):qn,u.state=e.memoizedState,o=l.getDerivedStateFromProps,typeof o=="function"&&(kc(e,l,o,n),u.state=e.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(o=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),o!==u.state&&Jc.enqueueReplaceState(u,u.state,null),Na(e,n,u,a),Ba(),u.state=e.memoizedState),typeof u.componentDidMount=="function"&&(e.flags|=4194308),n=!0}else if(t===null){u=e.stateNode;var s=e.memoizedProps,p=sn(l,s);u.props=p;var T=u.context,U=l.contextType;o=qn,typeof U=="object"&&U!==null&&(o=xe(U));var H=l.getDerivedStateFromProps;U=typeof H=="function"||typeof u.getSnapshotBeforeUpdate=="function",s=e.pendingProps!==s,U||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(s||T!==o)&&Bs(e,u,n,o),Ul=!1;var O=e.memoizedState;u.state=O,Na(e,n,u,a),Ba(),T=e.memoizedState,s||O!==T||Ul?(typeof H=="function"&&(kc(e,l,H,n),T=e.memoizedState),(p=Ul||Us(e,l,p,n,O,T,o))?(U||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(e.flags|=4194308)):(typeof u.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=T),u.props=n,u.state=T,u.context=o,n=p):(typeof u.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{u=e.stateNode,Oc(t,e),o=e.memoizedProps,U=sn(l,o),u.props=U,H=e.pendingProps,O=u.context,T=l.contextType,p=qn,typeof T=="object"&&T!==null&&(p=xe(T)),s=l.getDerivedStateFromProps,(T=typeof s=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(o!==H||O!==p)&&Bs(e,u,n,p),Ul=!1,O=e.memoizedState,u.state=O,Na(e,n,u,a),Ba();var _=e.memoizedState;o!==H||O!==_||Ul||t!==null&&t.dependencies!==null&&Bu(t.dependencies)?(typeof s=="function"&&(kc(e,l,s,n),_=e.memoizedState),(U=Ul||Us(e,l,U,n,O,_,p)||t!==null&&t.dependencies!==null&&Bu(t.dependencies))?(T||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(n,_,p),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(n,_,p)),typeof u.componentDidUpdate=="function"&&(e.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof u.componentDidUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(e.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=_),u.props=n,u.state=_,u.context=p,n=U):(typeof u.componentDidUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(e.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(e.flags|=1024),n=!1)}return u=n,Iu(t,e),n=(e.flags&128)!==0,u||n?(u=e.stateNode,l=n&&typeof l.getDerivedStateFromError!="function"?null:u.render(),e.flags|=1,t!==null&&n?(e.child=Ln(e,t.child,null,a),e.child=Ln(e,null,l,a)):ve(t,e,l,a),e.memoizedState=u.state,t=e.child):t=Ml(t,e,a),t}function ks(t,e,l,n){return Ta(),e.flags|=256,ve(t,e,l,n),e.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:Hr()}}function Fc(t,e,l){return t=t!==null?t.childLanes&~l:0,e&&(t|=Ie),t}function Js(t,e,l){var n=e.pendingProps,a=!1,u=(e.flags&128)!==0,o;if((o=u)||(o=t!==null&&t.memoizedState===null?!1:(oe.current&2)!==0),o&&(a=!0,e.flags&=-129),o=(e.flags&32)!==0,e.flags&=-33,t===null){if(qt){if(a?ql(e):Cl(),qt){var s=Ft,p;if(p=s){t:{for(p=s,s=cl;p.nodeType!==8;){if(!s){s=null;break t}if(p=ll(p.nextSibling),p===null){s=null;break t}}s=p}s!==null?(e.memoizedState={dehydrated:s,treeContext:ln!==null?{id:vl,overflow:pl}:null,retryLane:536870912,hydrationErrors:null},p=Ye(18,null,null,0),p.stateNode=s,p.return=e,e.child=p,Oe=e,Ft=null,p=!0):p=!1}p||un(e)}if(s=e.memoizedState,s!==null&&(s=s.dehydrated,s!==null))return Yf(s)?e.lanes=32:e.lanes=536870912,null;xl(e)}return s=n.children,n=n.fallback,a?(Cl(),a=e.mode,s=Wu({mode:"hidden",children:s},a),n=en(n,a,l,null),s.return=e,n.return=e,s.sibling=n,e.child=s,a=e.child,a.memoizedState=Wc(l),a.childLanes=Fc(t,o,l),e.memoizedState=Ic,n):(ql(e),tf(e,s))}if(p=t.memoizedState,p!==null&&(s=p.dehydrated,s!==null)){if(u)e.flags&256?(ql(e),e.flags&=-257,e=ef(t,e,l)):e.memoizedState!==null?(Cl(),e.child=t.child,e.flags|=128,e=null):(Cl(),a=n.fallback,s=e.mode,n=Wu({mode:"visible",children:n.children},s),a=en(a,s,l,null),a.flags|=2,n.return=e,a.return=e,n.sibling=a,e.child=n,Ln(e,t.child,null,l),n=e.child,n.memoizedState=Wc(l),n.childLanes=Fc(t,o,l),e.memoizedState=Ic,e=a);else if(ql(e),Yf(s)){if(o=s.nextSibling&&s.nextSibling.dataset,o)var T=o.dgst;o=T,n=Error(f(419)),n.stack="",n.digest=o,Ea({value:n,source:null,stack:null}),e=ef(t,e,l)}else if(de||Oa(t,e,l,!1),o=(l&t.childLanes)!==0,de||o){if(o=Vt,o!==null&&(n=l&-l,n=n&42?1:sa(n),n=n&(o.suspendedLanes|l)?0:n,n!==0&&n!==p.retryLane))throw p.retryLane=n,Hn(t,n),Qe(o,t,n),Xs;s.data==="$?"||Sf(),e=ef(t,e,l)}else s.data==="$?"?(e.flags|=192,e.child=t.child,e=null):(t=p.treeContext,Ft=ll(s.nextSibling),Oe=e,qt=!0,an=null,cl=!1,t!==null&&(Je[$e++]=vl,Je[$e++]=pl,Je[$e++]=ln,vl=t.id,pl=t.overflow,ln=e),e=tf(e,n.children),e.flags|=4096);return e}return a?(Cl(),a=n.fallback,s=e.mode,p=t.child,T=p.sibling,n=ml(p,{mode:"hidden",children:n.children}),n.subtreeFlags=p.subtreeFlags&65011712,T!==null?a=ml(T,a):(a=en(a,s,l,null),a.flags|=2),a.return=e,n.return=e,n.sibling=a,e.child=n,n=a,a=e.child,s=t.child.memoizedState,s===null?s=Wc(l):(p=s.cachePool,p!==null?(T=fe._currentValue,p=p.parent!==T?{parent:T,pool:T}:p):p=Hr(),s={baseLanes:s.baseLanes|l,cachePool:p}),a.memoizedState=s,a.childLanes=Fc(t,o,l),e.memoizedState=Ic,n):(ql(e),l=t.child,t=l.sibling,l=ml(l,{mode:"visible",children:n.children}),l.return=e,l.sibling=null,t!==null&&(o=e.deletions,o===null?(e.deletions=[t],e.flags|=16):o.push(t)),e.child=l,e.memoizedState=null,l)}function tf(t,e){return e=Wu({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Wu(t,e){return t=Ye(22,t,null,e),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function ef(t,e,l){return Ln(e,t.child,null,l),t=tf(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function $s(t,e,l){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),bc(t.return,e,l)}function lf(t,e,l,n,a){var u=t.memoizedState;u===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:l,tailMode:a}:(u.isBackwards=e,u.rendering=null,u.renderingStartTime=0,u.last=n,u.tail=l,u.tailMode=a)}function Ps(t,e,l){var n=e.pendingProps,a=n.revealOrder,u=n.tail;if(ve(t,e,n.children,l),n=oe.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&$s(t,l,e);else if(t.tag===19)$s(t,l,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}switch(C(oe,n),a){case"forwards":for(l=e.child,a=null;l!==null;)t=l.alternate,t!==null&&Ju(t)===null&&(a=l),l=l.sibling;l=a,l===null?(a=e.child,e.child=null):(a=l.sibling,l.sibling=null),lf(e,!1,a,l,u);break;case"backwards":for(l=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&Ju(t)===null){e.child=a;break}t=a.sibling,a.sibling=l,l=a,a=t}lf(e,!0,l,null,u);break;case"together":lf(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Ml(t,e,l){if(t!==null&&(e.dependencies=t.dependencies),jl|=e.lanes,!(l&e.childLanes))if(t!==null){if(Oa(t,e,l,!1),(l&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(f(153));if(e.child!==null){for(t=e.child,l=ml(t,t.pendingProps),e.child=l,l.return=e;t.sibling!==null;)t=t.sibling,l=l.sibling=ml(t,t.pendingProps),l.return=e;l.sibling=null}return e.child}function nf(t,e){return t.lanes&e?!0:(t=t.dependencies,!!(t!==null&&Bu(t)))}function mm(t,e,l){switch(e.tag){case 3:W(e,e.stateNode.containerInfo),Rl(e,fe,t.memoizedState.cache),Ta();break;case 27:case 5:rt(e);break;case 4:W(e,e.stateNode.containerInfo);break;case 10:Rl(e,e.type,e.memoizedProps.value);break;case 13:var n=e.memoizedState;if(n!==null)return n.dehydrated!==null?(ql(e),e.flags|=128,null):l&e.child.childLanes?Js(t,e,l):(ql(e),t=Ml(t,e,l),t!==null?t.sibling:null);ql(e);break;case 19:var a=(t.flags&128)!==0;if(n=(l&e.childLanes)!==0,n||(Oa(t,e,l,!1),n=(l&e.childLanes)!==0),a){if(n)return Ps(t,e,l);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),C(oe,oe.current),n)break;return null;case 22:case 23:return e.lanes=0,Vs(t,e,l);case 24:Rl(e,fe,t.memoizedState.cache)}return Ml(t,e,l)}function Is(t,e,l){if(t!==null)if(t.memoizedProps!==e.pendingProps)de=!0;else{if(!nf(t,l)&&!(e.flags&128))return de=!1,mm(t,e,l);de=!!(t.flags&131072)}else de=!1,qt&&e.flags&1048576&&_r(e,Uu,e.index);switch(e.lanes=0,e.tag){case 16:t:{t=e.pendingProps;var n=e.elementType,a=n._init;if(n=a(n._payload),e.type=n,typeof n=="function")dc(n)?(t=sn(n,t),e.tag=1,e=Ks(null,e,n,t,l)):(e.tag=0,e=Pc(null,e,n,t,l));else{if(n!=null){if(a=n.$$typeof,a===lt){e.tag=11,e=ws(null,e,n,t,l);break t}else if(a===P){e.tag=14,e=js(null,e,n,t,l);break t}}throw e=ct(n)||n,Error(f(306,e,""))}}return e;case 0:return Pc(t,e,e.type,e.pendingProps,l);case 1:return n=e.type,a=sn(n,e.pendingProps),Ks(t,e,n,a,l);case 3:t:{if(W(e,e.stateNode.containerInfo),t===null)throw Error(f(387));n=e.pendingProps;var u=e.memoizedState;a=u.element,Oc(t,e),Na(e,n,null,l);var o=e.memoizedState;if(n=o.cache,Rl(e,fe,n),n!==u.cache&&Sc(e,[fe],l,!0),Ba(),n=o.element,u.isDehydrated)if(u={element:n,isDehydrated:!1,cache:o.cache},e.updateQueue.baseState=u,e.memoizedState=u,e.flags&256){e=ks(t,e,n,l);break t}else if(n!==a){a=Ke(Error(f(424)),e),Ea(a),e=ks(t,e,n,l);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ft=ll(t.firstChild),Oe=e,qt=!0,an=null,cl=!0,l=Ds(e,null,n,l),e.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Ta(),n===a){e=Ml(t,e,l);break t}ve(t,e,n,l)}e=e.child}return e;case 26:return Iu(t,e),t===null?(l=eh(e.type,null,e.pendingProps,null))?e.memoizedState=l:qt||(l=e.type,t=e.pendingProps,n=di(N.current).createElement(l),n[Se]=e,n[Re]=t,ge(n,l,t),se(n),e.stateNode=n):e.memoizedState=eh(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return rt(e),t===null&&qt&&(n=e.stateNode=Wd(e.type,e.pendingProps,N.current),Oe=e,cl=!0,a=Ft,Ll(e.type)?(Gf=a,Ft=ll(n.firstChild)):Ft=a),ve(t,e,e.pendingProps.children,l),Iu(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&qt&&((a=n=Ft)&&(n=Vm(n,e.type,e.pendingProps,cl),n!==null?(e.stateNode=n,Oe=e,Ft=ll(n.firstChild),cl=!1,a=!0):a=!1),a||un(e)),rt(e),a=e.type,u=e.pendingProps,o=t!==null?t.memoizedProps:null,n=u.children,Hf(a,u)?n=null:o!==null&&Hf(a,o)&&(e.flags|=32),e.memoizedState!==null&&(a=Bc(t,e,cm,null,null,l),eu._currentValue=a),Iu(t,e),ve(t,e,n,l),e.child;case 6:return t===null&&qt&&((t=l=Ft)&&(l=Zm(l,e.pendingProps,cl),l!==null?(e.stateNode=l,Oe=e,Ft=null,t=!0):t=!1),t||un(e)),null;case 13:return Js(t,e,l);case 4:return W(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Ln(e,null,n,l):ve(t,e,n,l),e.child;case 11:return ws(t,e,e.type,e.pendingProps,l);case 7:return ve(t,e,e.pendingProps,l),e.child;case 8:return ve(t,e,e.pendingProps.children,l),e.child;case 12:return ve(t,e,e.pendingProps.children,l),e.child;case 10:return n=e.pendingProps,Rl(e,e.type,n.value),ve(t,e,n.children,l),e.child;case 9:return a=e.type._context,n=e.pendingProps.children,fn(e),a=xe(a),n=n(a),e.flags|=1,ve(t,e,n,l),e.child;case 14:return js(t,e,e.type,e.pendingProps,l);case 15:return Qs(t,e,e.type,e.pendingProps,l);case 19:return Ps(t,e,l);case 31:return n=e.pendingProps,l=e.mode,n={mode:n.mode,children:n.children},t===null?(l=Wu(n,l),l.ref=e.ref,e.child=l,l.return=e,e=l):(l=ml(t.child,n),l.ref=e.ref,e.child=l,l.return=e,e=l),e;case 22:return Vs(t,e,l);case 24:return fn(e),n=xe(fe),t===null?(a=Ac(),a===null&&(a=Vt,u=xc(),a.pooledCache=u,u.refCount++,u!==null&&(a.pooledCacheLanes|=l),a=u),e.memoizedState={parent:n,cache:a},Ec(e),Rl(e,fe,a)):(t.lanes&l&&(Oc(t,e),Na(e,null,null,l),Ba()),a=t.memoizedState,u=e.memoizedState,a.parent!==n?(a={parent:n,cache:n},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),Rl(e,fe,n)):(n=u.cache,Rl(e,fe,n),n!==a.cache&&Sc(e,[fe],l,!0))),ve(t,e,e.pendingProps.children,l),e.child;case 29:throw e.pendingProps}throw Error(f(156,e.tag))}function Al(t){t.flags|=4}function Ws(t,e){if(e.type!=="stylesheet"||e.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!ih(e)){if(e=Pe.current,e!==null&&((Bt&4194048)===Bt?fl!==null:(Bt&62914560)!==Bt&&!(Bt&536870912)||e!==fl))throw Ra=Tc,qr;t.flags|=8192}}function Fu(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?al():536870912,t.lanes|=e,$n|=e)}function wa(t,e){if(!qt)switch(t.tailMode){case"hidden":e=t.tail;for(var l=null;e!==null;)e.alternate!==null&&(l=e),e=e.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var n=null;l!==null;)l.alternate!==null&&(n=l),l=l.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Pt(t){var e=t.alternate!==null&&t.alternate.child===t.child,l=0,n=0;if(e)for(var a=t.child;a!==null;)l|=a.lanes|a.childLanes,n|=a.subtreeFlags&65011712,n|=a.flags&65011712,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)l|=a.lanes|a.childLanes,n|=a.subtreeFlags,n|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=n,t.childLanes=l,e}function vm(t,e,l){var n=e.pendingProps;switch(vc(e),e.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(e),null;case 1:return Pt(e),null;case 3:return l=e.stateNode,n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),bl(fe),ut(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(Aa(e)?Al(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Rr())),Pt(e),null;case 26:return l=e.memoizedState,t===null?(Al(e),l!==null?(Pt(e),Ws(e,l)):(Pt(e),e.flags&=-16777217)):l?l!==t.memoizedState?(Al(e),Pt(e),Ws(e,l)):(Pt(e),e.flags&=-16777217):(t.memoizedProps!==n&&Al(e),Pt(e),e.flags&=-16777217),null;case 27:X(e),l=N.current;var a=e.type;if(t!==null&&e.stateNode!=null)t.memoizedProps!==n&&Al(e);else{if(!n){if(e.stateNode===null)throw Error(f(166));return Pt(e),null}t=K.current,Aa(e)?zr(e):(t=Wd(a,n,l),e.stateNode=t,Al(e))}return Pt(e),null;case 5:if(X(e),l=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==n&&Al(e);else{if(!n){if(e.stateNode===null)throw Error(f(166));return Pt(e),null}if(t=K.current,Aa(e))zr(e);else{switch(a=di(N.current),t){case 1:t=a.createElementNS("http://www.w3.org/2000/svg",l);break;case 2:t=a.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;default:switch(l){case"svg":t=a.createElementNS("http://www.w3.org/2000/svg",l);break;case"math":t=a.createElementNS("http://www.w3.org/1998/Math/MathML",l);break;case"script":t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild);break;case"select":t=typeof n.is=="string"?a.createElement("select",{is:n.is}):a.createElement("select"),n.multiple?t.multiple=!0:n.size&&(t.size=n.size);break;default:t=typeof n.is=="string"?a.createElement(l,{is:n.is}):a.createElement(l)}}t[Se]=e,t[Re]=n;t:for(a=e.child;a!==null;){if(a.tag===5||a.tag===6)t.appendChild(a.stateNode);else if(a.tag!==4&&a.tag!==27&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===e)break t;for(;a.sibling===null;){if(a.return===null||a.return===e)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}e.stateNode=t;t:switch(ge(t,l,n),l){case"button":case"input":case"select":case"textarea":t=!!n.autoFocus;break t;case"img":t=!0;break t;default:t=!1}t&&Al(e)}}return Pt(e),e.flags&=-16777217,null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==n&&Al(e);else{if(typeof n!="string"&&e.stateNode===null)throw Error(f(166));if(t=N.current,Aa(e)){if(t=e.stateNode,l=e.memoizedProps,n=null,a=Oe,a!==null)switch(a.tag){case 27:case 5:n=a.memoizedProps}t[Se]=e,t=!!(t.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||Ld(t.nodeValue,l)),t||un(e)}else t=di(t).createTextNode(n),t[Se]=e,e.stateNode=t}return Pt(e),null;case 13:if(n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Aa(e),n!==null&&n.dehydrated!==null){if(t===null){if(!a)throw Error(f(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(f(317));a[Se]=e}else Ta(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Pt(e),a=!1}else a=Rr(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(xl(e),e):(xl(e),null)}if(xl(e),e.flags&128)return e.lanes=l,e;if(l=n!==null,t=t!==null&&t.memoizedState!==null,l){n=e.child,a=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(a=n.alternate.memoizedState.cachePool.pool);var u=null;n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048)}return l!==t&&l&&(e.child.flags|=8192),Fu(e,e.updateQueue),Pt(e),null;case 4:return ut(),t===null&&Df(e.stateNode.containerInfo),Pt(e),null;case 10:return bl(e.type),Pt(e),null;case 19:if(q(oe),a=e.memoizedState,a===null)return Pt(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)wa(a,!1);else{if(te!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(u=Ju(t),u!==null){for(e.flags|=128,wa(a,!1),t=u.updateQueue,e.updateQueue=t,Fu(e,t),e.subtreeFlags=0,t=l,l=e.child;l!==null;)Or(l,t),l=l.sibling;return C(oe,oe.current&1|2),e.child}t=t.sibling}a.tail!==null&&Nt()>li&&(e.flags|=128,n=!0,wa(a,!1),e.lanes=4194304)}else{if(!n)if(t=Ju(u),t!==null){if(e.flags|=128,n=!0,t=t.updateQueue,e.updateQueue=t,Fu(e,t),wa(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!qt)return Pt(e),null}else 2*Nt()-a.renderingStartTime>li&&l!==536870912&&(e.flags|=128,n=!0,wa(a,!1),e.lanes=4194304);a.isBackwards?(u.sibling=e.child,e.child=u):(t=a.last,t!==null?t.sibling=u:e.child=u,a.last=u)}return a.tail!==null?(e=a.tail,a.rendering=e,a.tail=e.sibling,a.renderingStartTime=Nt(),e.sibling=null,t=oe.current,C(oe,n?t&1|2:t&1),e):(Pt(e),null);case 22:case 23:return xl(e),Rc(),n=e.memoizedState!==null,t!==null?t.memoizedState!==null!==n&&(e.flags|=8192):n&&(e.flags|=8192),n?l&536870912&&!(e.flags&128)&&(Pt(e),e.subtreeFlags&6&&(e.flags|=8192)):Pt(e),l=e.updateQueue,l!==null&&Fu(e,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),n=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),n!==l&&(e.flags|=2048),t!==null&&q(on),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),e.memoizedState.cache!==l&&(e.flags|=2048),bl(fe),Pt(e),null;case 25:return null;case 30:return null}throw Error(f(156,e.tag))}function pm(t,e){switch(vc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return bl(fe),ut(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return X(e),null;case 13:if(xl(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(f(340));Ta()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return q(oe),null;case 4:return ut(),null;case 10:return bl(e.type),null;case 22:case 23:return xl(e),Rc(),t!==null&&q(on),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return bl(fe),null;case 25:return null;default:return null}}function Fs(t,e){switch(vc(e),e.tag){case 3:bl(fe),ut();break;case 26:case 27:case 5:X(e);break;case 4:ut();break;case 13:xl(e);break;case 19:q(oe);break;case 10:bl(e.type);break;case 22:case 23:xl(e),Rc(),t!==null&&q(on);break;case 24:bl(fe)}}function ja(t,e){try{var l=e.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var a=n.next;l=a;do{if((l.tag&t)===t){n=void 0;var u=l.create,o=l.inst;n=u(),o.destroy=n}l=l.next}while(l!==a)}}catch(s){Qt(e,e.return,s)}}function Yl(t,e,l){try{var n=e.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var u=a.next;n=u;do{if((n.tag&t)===t){var o=n.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,a=e;var p=l,T=s;try{T()}catch(U){Qt(a,p,U)}}}n=n.next}while(n!==u)}}catch(U){Qt(e,e.return,U)}}function td(t){var e=t.updateQueue;if(e!==null){var l=t.stateNode;try{jr(e,l)}catch(n){Qt(t,t.return,n)}}}function ed(t,e,l){l.props=sn(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(n){Qt(t,e,n)}}function Qa(t,e){try{var l=t.ref;if(l!==null){switch(t.tag){case 26:case 27:case 5:var n=t.stateNode;break;case 30:n=t.stateNode;break;default:n=t.stateNode}typeof l=="function"?t.refCleanup=l(n):l.current=n}}catch(a){Qt(t,e,a)}}function ol(t,e){var l=t.ref,n=t.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(a){Qt(t,e,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(a){Qt(t,e,a)}else l.current=null}function ld(t){var e=t.type,l=t.memoizedProps,n=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break t;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(a){Qt(t,t.return,a)}}function af(t,e,l){try{var n=t.stateNode;Gm(n,t.type,l,e),n[Re]=e}catch(a){Qt(t,t.return,a)}}function nd(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Ll(t.type)||t.tag===4}function uf(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||nd(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Ll(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function cf(t,e,l){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,e):(e=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,e.appendChild(t),l=l._reactRootContainer,l!=null||e.onclick!==null||(e.onclick=si));else if(n!==4&&(n===27&&Ll(t.type)&&(l=t.stateNode,e=null),t=t.child,t!==null))for(cf(t,e,l),t=t.sibling;t!==null;)cf(t,e,l),t=t.sibling}function ti(t,e,l){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?l.insertBefore(t,e):l.appendChild(t);else if(n!==4&&(n===27&&Ll(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(ti(t,e,l),t=t.sibling;t!==null;)ti(t,e,l),t=t.sibling}function ad(t){var e=t.stateNode,l=t.memoizedProps;try{for(var n=t.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);ge(e,n,l),e[Se]=t,e[Re]=l}catch(u){Qt(t,t.return,u)}}var Tl=!1,ne=!1,ff=!1,ud=typeof WeakSet=="function"?WeakSet:Set,he=null;function gm(t,e){if(t=t.containerInfo,Bf=gi,t=vr(t),uc(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else t:{l=(l=t.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var a=n.anchorOffset,u=n.focusNode;n=n.focusOffset;try{l.nodeType,u.nodeType}catch(pt){l=null;break t}var o=0,s=-1,p=-1,T=0,U=0,H=t,O=null;e:for(;;){for(var _;H!==l||a!==0&&H.nodeType!==3||(s=o+a),H!==u||n!==0&&H.nodeType!==3||(p=o+n),H.nodeType===3&&(o+=H.nodeValue.length),(_=H.firstChild)!==null;)O=H,H=_;for(;;){if(H===t)break e;if(O===l&&++T===a&&(s=o),O===u&&++U===n&&(p=o),(_=H.nextSibling)!==null)break;H=O,O=H.parentNode}H=_}l=s===-1||p===-1?null:{start:s,end:p}}else l=null}l=l||{start:0,end:0}}else l=null;for(Nf={focusedElem:t,selectionRange:l},gi=!1,he=e;he!==null;)if(e=he,t=e.child,(e.subtreeFlags&1024)!==0&&t!==null)t.return=e,he=t;else for(;he!==null;){switch(e=he,u=e.alternate,t=e.flags,e.tag){case 0:break;case 11:case 15:break;case 1:if(t&1024&&u!==null){t=void 0,l=e,a=u.memoizedProps,u=u.memoizedState,n=l.stateNode;try{var St=sn(l.type,a,l.elementType===l.type);t=n.getSnapshotBeforeUpdate(St,u),n.__reactInternalSnapshotBeforeUpdate=t}catch(pt){Qt(l,l.return,pt)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,l=t.nodeType,l===9)Cf(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Cf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(f(163))}if(t=e.sibling,t!==null){t.return=e.return,he=t;break}he=e.return}}function id(t,e,l){var n=l.flags;switch(l.tag){case 0:case 11:case 15:Gl(t,l),n&4&&ja(5,l);break;case 1:if(Gl(t,l),n&4)if(t=l.stateNode,e===null)try{t.componentDidMount()}catch(o){Qt(l,l.return,o)}else{var a=sn(l.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(o){Qt(l,l.return,o)}}n&64&&td(l),n&512&&Qa(l,l.return);break;case 3:if(Gl(t,l),n&64&&(t=l.updateQueue,t!==null)){if(e=null,l.child!==null)switch(l.child.tag){case 27:case 5:e=l.child.stateNode;break;case 1:e=l.child.stateNode}try{jr(t,e)}catch(o){Qt(l,l.return,o)}}break;case 27:e===null&&n&4&&ad(l);case 26:case 5:Gl(t,l),e===null&&n&4&&ld(l),n&512&&Qa(l,l.return);break;case 12:Gl(t,l);break;case 13:Gl(t,l),n&4&&od(t,l),n&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=_m.bind(null,l),Lm(t,l))));break;case 22:if(n=l.memoizedState!==null||Tl,!n){e=e!==null&&e.memoizedState!==null||ne,a=Tl;var u=ne;Tl=n,(ne=e)&&!u?Xl(t,l,(l.subtreeFlags&8772)!==0):Gl(t,l),Tl=a,ne=u}break;case 30:break;default:Gl(t,l)}}function cd(t){var e=t.alternate;e!==null&&(t.alternate=null,cd(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&wi(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var kt=null,Ne=!1;function El(t,e,l){for(l=l.child;l!==null;)fd(t,e,l),l=l.sibling}function fd(t,e,l){if(ot&&typeof ot.onCommitFiberUnmount=="function")try{ot.onCommitFiberUnmount(Ut,l)}catch(u){}switch(l.tag){case 26:ne||ol(l,e),El(t,e,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:ne||ol(l,e);var n=kt,a=Ne;Ll(l.type)&&(kt=l.stateNode,Ne=!1),El(t,e,l),Ia(l.stateNode),kt=n,Ne=a;break;case 5:ne||ol(l,e);case 6:if(n=kt,a=Ne,kt=null,El(t,e,l),kt=n,Ne=a,kt!==null)if(Ne)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(l.stateNode)}catch(u){Qt(l,e,u)}else try{kt.removeChild(l.stateNode)}catch(u){Qt(l,e,u)}break;case 18:kt!==null&&(Ne?(t=kt,Pd(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),uu(t)):Pd(kt,l.stateNode));break;case 4:n=kt,a=Ne,kt=l.stateNode.containerInfo,Ne=!0,El(t,e,l),kt=n,Ne=a;break;case 0:case 11:case 14:case 15:ne||Yl(2,l,e),ne||Yl(4,l,e),El(t,e,l);break;case 1:ne||(ol(l,e),n=l.stateNode,typeof n.componentWillUnmount=="function"&&ed(l,e,n)),El(t,e,l);break;case 21:El(t,e,l);break;case 22:ne=(n=ne)||l.memoizedState!==null,El(t,e,l),ne=n;break;default:El(t,e,l)}}function od(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{uu(t)}catch(l){Qt(e,e.return,l)}}function bm(t){switch(t.tag){case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new ud),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new ud),e;default:throw Error(f(435,t.tag))}}function of(t,e){var l=bm(t);e.forEach(function(n){var a=zm.bind(null,t,n);l.has(n)||(l.add(n),n.then(a,a))})}function Ge(t,e){var l=e.deletions;if(l!==null)for(var n=0;n<l.length;n++){var a=l[n],u=t,o=e,s=o;t:for(;s!==null;){switch(s.tag){case 27:if(Ll(s.type)){kt=s.stateNode,Ne=!1;break t}break;case 5:kt=s.stateNode,Ne=!1;break t;case 3:case 4:kt=s.stateNode.containerInfo,Ne=!0;break t}s=s.return}if(kt===null)throw Error(f(160));fd(u,o,a),kt=null,Ne=!1,u=a.alternate,u!==null&&(u.return=null),a.return=null}if(e.subtreeFlags&13878)for(e=e.child;e!==null;)rd(e,t),e=e.sibling}var el=null;function rd(t,e){var l=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Ge(e,t),Xe(t),n&4&&(Yl(3,t,t.return),ja(3,t),Yl(5,t,t.return));break;case 1:Ge(e,t),Xe(t),n&512&&(ne||l===null||ol(l,l.return)),n&64&&Tl&&(t=t.updateQueue,t!==null&&(n=t.callbacks,n!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?n:l.concat(n))));break;case 26:var a=el;if(Ge(e,t),Xe(t),n&512&&(ne||l===null||ol(l,l.return)),n&4){var u=l!==null?l.memoizedState:null;if(n=t.memoizedState,l===null)if(n===null)if(t.stateNode===null){t:{n=t.type,l=t.memoizedProps,a=a.ownerDocument||a;e:switch(n){case"title":u=a.getElementsByTagName("title")[0],(!u||u[da]||u[Se]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=a.createElement(n),a.head.insertBefore(u,a.querySelector("head > title"))),ge(u,n,l),u[Se]=t,se(u),n=u;break t;case"link":var o=ah("link","href",a).get(n+(l.href||""));if(o){for(var s=0;s<o.length;s++)if(u=o[s],u.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&u.getAttribute("rel")===(l.rel==null?null:l.rel)&&u.getAttribute("title")===(l.title==null?null:l.title)&&u.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){o.splice(s,1);break e}}u=a.createElement(n),ge(u,n,l),a.head.appendChild(u);break;case"meta":if(o=ah("meta","content",a).get(n+(l.content||""))){for(s=0;s<o.length;s++)if(u=o[s],u.getAttribute("content")===(l.content==null?null:""+l.content)&&u.getAttribute("name")===(l.name==null?null:l.name)&&u.getAttribute("property")===(l.property==null?null:l.property)&&u.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&u.getAttribute("charset")===(l.charSet==null?null:l.charSet)){o.splice(s,1);break e}}u=a.createElement(n),ge(u,n,l),a.head.appendChild(u);break;default:throw Error(f(468,n))}u[Se]=t,se(u),n=u}t.stateNode=n}else uh(a,t.type,t.stateNode);else t.stateNode=nh(a,n,t.memoizedProps);else u!==n?(u===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):u.count--,n===null?uh(a,t.type,t.stateNode):nh(a,n,t.memoizedProps)):n===null&&t.stateNode!==null&&af(t,t.memoizedProps,l.memoizedProps)}break;case 27:Ge(e,t),Xe(t),n&512&&(ne||l===null||ol(l,l.return)),l!==null&&n&4&&af(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Ge(e,t),Xe(t),n&512&&(ne||l===null||ol(l,l.return)),t.flags&32){a=t.stateNode;try{_n(a,"")}catch(_){Qt(t,t.return,_)}}n&4&&t.stateNode!=null&&(a=t.memoizedProps,af(t,a,l!==null?l.memoizedProps:a)),n&1024&&(ff=!0);break;case 6:if(Ge(e,t),Xe(t),n&4){if(t.stateNode===null)throw Error(f(162));n=t.memoizedProps,l=t.stateNode;try{l.nodeValue=n}catch(_){Qt(t,t.return,_)}}break;case 3:if(mi=null,a=el,el=hi(e.containerInfo),Ge(e,t),el=a,Xe(t),n&4&&l!==null&&l.memoizedState.isDehydrated)try{uu(e.containerInfo)}catch(_){Qt(t,t.return,_)}ff&&(ff=!1,sd(t));break;case 4:n=el,el=hi(t.stateNode.containerInfo),Ge(e,t),Xe(t),el=n;break;case 12:Ge(e,t),Xe(t);break;case 13:Ge(e,t),Xe(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(mf=Nt()),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,of(t,n)));break;case 22:a=t.memoizedState!==null;var p=l!==null&&l.memoizedState!==null,T=Tl,U=ne;if(Tl=T||a,ne=U||p,Ge(e,t),ne=U,Tl=T,Xe(t),n&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(l===null||p||Tl||ne||dn(t)),l=null,e=t;;){if(e.tag===5||e.tag===26){if(l===null){p=l=e;try{if(u=p.stateNode,a)o=u.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{s=p.stateNode;var H=p.memoizedProps.style,O=H!=null&&H.hasOwnProperty("display")?H.display:null;s.style.display=O==null||typeof O=="boolean"?"":(""+O).trim()}}catch(_){Qt(p,p.return,_)}}}else if(e.tag===6){if(l===null){p=e;try{p.stateNode.nodeValue=a?"":p.memoizedProps}catch(_){Qt(p,p.return,_)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break t;for(;e.sibling===null;){if(e.return===null||e.return===t)break t;l===e&&(l=null),e=e.return}l===e&&(l=null),e.sibling.return=e.return,e=e.sibling}n&4&&(n=t.updateQueue,n!==null&&(l=n.retryQueue,l!==null&&(n.retryQueue=null,of(t,l))));break;case 19:Ge(e,t),Xe(t),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,of(t,n)));break;case 30:break;case 21:break;default:Ge(e,t),Xe(t)}}function Xe(t){var e=t.flags;if(e&2){try{for(var l,n=t.return;n!==null;){if(nd(n)){l=n;break}n=n.return}if(l==null)throw Error(f(160));switch(l.tag){case 27:var a=l.stateNode,u=uf(t);ti(t,u,a);break;case 5:var o=l.stateNode;l.flags&32&&(_n(o,""),l.flags&=-33);var s=uf(t);ti(t,s,o);break;case 3:case 4:var p=l.stateNode.containerInfo,T=uf(t);cf(t,T,p);break;default:throw Error(f(161))}}catch(U){Qt(t,t.return,U)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function sd(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;sd(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function Gl(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)id(t,e.alternate,e),e=e.sibling}function dn(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:Yl(4,e,e.return),dn(e);break;case 1:ol(e,e.return);var l=e.stateNode;typeof l.componentWillUnmount=="function"&&ed(e,e.return,l),dn(e);break;case 27:Ia(e.stateNode);case 26:case 5:ol(e,e.return),dn(e);break;case 22:e.memoizedState===null&&dn(e);break;case 30:dn(e);break;default:dn(e)}t=t.sibling}}function Xl(t,e,l){for(l=l&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var n=e.alternate,a=t,u=e,o=u.flags;switch(u.tag){case 0:case 11:case 15:Xl(a,u,l),ja(4,u);break;case 1:if(Xl(a,u,l),n=u,a=n.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(T){Qt(n,n.return,T)}if(n=u,a=n.updateQueue,a!==null){var s=n.stateNode;try{var p=a.shared.hiddenCallbacks;if(p!==null)for(a.shared.hiddenCallbacks=null,a=0;a<p.length;a++)wr(p[a],s)}catch(T){Qt(n,n.return,T)}}l&&o&64&&td(u),Qa(u,u.return);break;case 27:ad(u);case 26:case 5:Xl(a,u,l),l&&n===null&&o&4&&ld(u),Qa(u,u.return);break;case 12:Xl(a,u,l);break;case 13:Xl(a,u,l),l&&o&4&&od(a,u);break;case 22:u.memoizedState===null&&Xl(a,u,l),Qa(u,u.return);break;case 30:break;default:Xl(a,u,l)}e=e.sibling}}function rf(t,e){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&_a(l))}function sf(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&_a(t))}function rl(t,e,l,n){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)dd(t,e,l,n),e=e.sibling}function dd(t,e,l,n){var a=e.flags;switch(e.tag){case 0:case 11:case 15:rl(t,e,l,n),a&2048&&ja(9,e);break;case 1:rl(t,e,l,n);break;case 3:rl(t,e,l,n),a&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&_a(t)));break;case 12:if(a&2048){rl(t,e,l,n),t=e.stateNode;try{var u=e.memoizedProps,o=u.id,s=u.onPostCommit;typeof s=="function"&&s(o,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(p){Qt(e,e.return,p)}}else rl(t,e,l,n);break;case 13:rl(t,e,l,n);break;case 23:break;case 22:u=e.stateNode,o=e.alternate,e.memoizedState!==null?u._visibility&2?rl(t,e,l,n):Va(t,e):u._visibility&2?rl(t,e,l,n):(u._visibility|=2,Kn(t,e,l,n,(e.subtreeFlags&10256)!==0)),a&2048&&rf(o,e);break;case 24:rl(t,e,l,n),a&2048&&sf(e.alternate,e);break;default:rl(t,e,l,n)}}function Kn(t,e,l,n,a){for(a=a&&(e.subtreeFlags&10256)!==0,e=e.child;e!==null;){var u=t,o=e,s=l,p=n,T=o.flags;switch(o.tag){case 0:case 11:case 15:Kn(u,o,s,p,a),ja(8,o);break;case 23:break;case 22:var U=o.stateNode;o.memoizedState!==null?U._visibility&2?Kn(u,o,s,p,a):Va(u,o):(U._visibility|=2,Kn(u,o,s,p,a)),a&&T&2048&&rf(o.alternate,o);break;case 24:Kn(u,o,s,p,a),a&&T&2048&&sf(o.alternate,o);break;default:Kn(u,o,s,p,a)}e=e.sibling}}function Va(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var l=t,n=e,a=n.flags;switch(n.tag){case 22:Va(l,n),a&2048&&rf(n.alternate,n);break;case 24:Va(l,n),a&2048&&sf(n.alternate,n);break;default:Va(l,n)}e=e.sibling}}var Za=8192;function kn(t){if(t.subtreeFlags&Za)for(t=t.child;t!==null;)hd(t),t=t.sibling}function hd(t){switch(t.tag){case 26:kn(t),t.flags&Za&&t.memoizedState!==null&&av(el,t.memoizedState,t.memoizedProps);break;case 5:kn(t);break;case 3:case 4:var e=el;el=hi(t.stateNode.containerInfo),kn(t),el=e;break;case 22:t.memoizedState===null&&(e=t.alternate,e!==null&&e.memoizedState!==null?(e=Za,Za=16777216,kn(t),Za=e):kn(t));break;default:kn(t)}}function yd(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function La(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var l=0;l<e.length;l++){var n=e[l];he=n,vd(n,t)}yd(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)md(t),t=t.sibling}function md(t){switch(t.tag){case 0:case 11:case 15:La(t),t.flags&2048&&Yl(9,t,t.return);break;case 3:La(t);break;case 12:La(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,ei(t)):La(t);break;default:La(t)}}function ei(t){var e=t.deletions;if(t.flags&16){if(e!==null)for(var l=0;l<e.length;l++){var n=e[l];he=n,vd(n,t)}yd(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:Yl(8,e,e.return),ei(e);break;case 22:l=e.stateNode,l._visibility&2&&(l._visibility&=-3,ei(e));break;default:ei(e)}t=t.sibling}}function vd(t,e){for(;he!==null;){var l=he;switch(l.tag){case 0:case 11:case 15:Yl(8,l,e);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var n=l.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:_a(l.memoizedState.cache)}if(n=l.child,n!==null)n.return=l,he=n;else t:for(l=t;he!==null;){n=he;var a=n.sibling,u=n.return;if(cd(n),n===l){he=null;break t}if(a!==null){a.return=u,he=a;break t}he=u}}}var Sm={getCacheForType:function(t){var e=xe(fe),l=e.data.get(t);return l===void 0&&(l=t(),e.data.set(t,l)),l}},xm=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Vt=null,Dt=null,Bt=0,Yt=0,we=null,wl=!1,Jn=!1,df=!1,Ol=0,te=0,jl=0,hn=0,hf=0,Ie=0,$n=0,Ka=null,He=null,yf=!1,mf=0,li=1/0,ni=null,Ql=null,pe=0,Vl=null,Pn=null,In=0,vf=0,pf=null,pd=null,ka=0,gf=null;function je(){if(Ct&2&&Bt!==0)return Bt&-Bt;if(D.T!==null){var t=Gn;return t!==0?t:Ef()}return bn()}function gd(){Ie===0&&(Ie=!(Bt&536870912)||qt?re():536870912);var t=Pe.current;return t!==null&&(t.flags|=32),Ie}function Qe(t,e,l){(t===Vt&&(Yt===2||Yt===9)||t.cancelPendingCommit!==null)&&(Wn(t,0),Zl(t,Bt,Ie,!1)),Ee(t,l),(!(Ct&2)||t!==Vt)&&(t===Vt&&(!(Ct&2)&&(hn|=l),te===4&&Zl(t,Bt,Ie,!1)),sl(t))}function bd(t,e,l){if(Ct&6)throw Error(f(327));var n=!l&&(e&124)===0&&(e&t.expiredLanes)===0||De(t,e),a=n?Tm(t,e):xf(t,e,!0),u=n;do{if(a===0){Jn&&!n&&Zl(t,e,0,!1);break}else{if(l=t.current.alternate,u&&!Mm(l)){a=xf(t,e,!1),u=!1;continue}if(a===2){if(u=e,t.errorRecoveryDisabledLanes&u)var o=0;else o=t.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){e=o;t:{var s=t;a=Ka;var p=s.current.memoizedState.isDehydrated;if(p&&(Wn(s,o).flags|=256),o=xf(s,o,!1),o!==2){if(df&&!p){s.errorRecoveryDisabledLanes|=u,hn|=u,a=4;break t}u=He,He=a,u!==null&&(He===null?He=u:He.push.apply(He,u))}a=o}if(u=!1,a!==2)continue}}if(a===1){Wn(t,0),Zl(t,e,0,!0);break}t:{switch(n=t,u=a,u){case 0:case 1:throw Error(f(345));case 4:if((e&4194048)!==e)break;case 6:Zl(n,e,Ie,!wl);break t;case 2:He=null;break;case 3:case 5:break;default:throw Error(f(329))}if((e&62914560)===e&&(a=mf+300-Nt(),10<a)){if(Zl(n,e,Ie,!wl),dl(n,0,!0)!==0)break t;n.timeoutHandle=Jd(Sd.bind(null,n,l,He,ni,yf,e,Ie,hn,$n,wl,u,2,-0,0),a);break t}Sd(n,l,He,ni,yf,e,Ie,hn,$n,wl,u,0,-0,0)}}break}while(!0);sl(t)}function Sd(t,e,l,n,a,u,o,s,p,T,U,H,O,_){if(t.timeoutHandle=-1,H=e.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(tu={stylesheets:null,count:0,unsuspend:nv},hd(e),H=uv(),H!==null)){t.cancelPendingCommit=H(_d.bind(null,t,e,u,l,n,a,o,s,p,U,1,O,_)),Zl(t,u,o,!T);return}_d(t,e,u,l,n,a,o,s,p)}function Mm(t){for(var e=t;;){var l=e.tag;if((l===0||l===11||l===15)&&e.flags&16384&&(l=e.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var n=0;n<l.length;n++){var a=l[n],u=a.getSnapshot;a=a.value;try{if(!Ce(u(),a))return!1}catch(o){return!1}}if(l=e.child,e.subtreeFlags&16384&&l!==null)l.return=e,e=l;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function Zl(t,e,l,n){e&=~hf,e&=~hn,t.suspendedLanes|=e,t.pingedLanes&=~e,n&&(t.warmLanes|=e),n=t.expirationTimes;for(var a=e;0<a;){var u=31-Mt(a),o=1<<u;n[u]=-1,a&=~o}l!==0&&ra(t,l,e)}function ai(){return Ct&6?!0:(Ja(0),!1)}function bf(){if(Dt!==null){if(Yt===0)var t=Dt.return;else t=Dt,gl=cn=null,qc(t),Zn=null,Ga=0,t=Dt;for(;t!==null;)Fs(t.alternate,t),t=t.return;Dt=null}}function Wn(t,e){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,wm(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),bf(),Vt=t,Dt=l=ml(t.current,null),Bt=e,Yt=0,we=null,wl=!1,Jn=De(t,e),df=!1,$n=Ie=hf=hn=jl=te=0,He=Ka=null,yf=!1,e&8&&(e|=e&32);var n=t.entangledLanes;if(n!==0)for(t=t.entanglements,n&=e;0<n;){var a=31-Mt(n),u=1<<a;e|=t[a],n&=~u}return Ol=e,Ou(),l}function xd(t,e){_t=null,D.H=Lu,e===Da||e===qu?(e=Gr(),Yt=3):e===qr?(e=Gr(),Yt=4):Yt=e===Xs?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,we=e,Dt===null&&(te=1,Pu(t,Ke(e,t.current)))}function Md(){var t=D.H;return D.H=Lu,t===null?Lu:t}function Ad(){var t=D.A;return D.A=Sm,t}function Sf(){te=4,wl||(Bt&4194048)!==Bt&&Pe.current!==null||(Jn=!0),!(jl&134217727)&&!(hn&134217727)||Vt===null||Zl(Vt,Bt,Ie,!1)}function xf(t,e,l){var n=Ct;Ct|=2;var a=Md(),u=Ad();(Vt!==t||Bt!==e)&&(ni=null,Wn(t,e)),e=!1;var o=te;t:do try{if(Yt!==0&&Dt!==null){var s=Dt,p=we;switch(Yt){case 8:bf(),o=6;break t;case 3:case 2:case 9:case 6:Pe.current===null&&(e=!0);var T=Yt;if(Yt=0,we=null,Fn(t,s,p,T),l&&Jn){o=0;break t}break;default:T=Yt,Yt=0,we=null,Fn(t,s,p,T)}}Am(),o=te;break}catch(U){xd(t,U)}while(!0);return e&&t.shellSuspendCounter++,gl=cn=null,Ct=n,D.H=a,D.A=u,Dt===null&&(Vt=null,Bt=0,Ou()),o}function Am(){for(;Dt!==null;)Td(Dt)}function Tm(t,e){var l=Ct;Ct|=2;var n=Md(),a=Ad();Vt!==t||Bt!==e?(ni=null,li=Nt()+500,Wn(t,e)):Jn=De(t,e);t:do try{if(Yt!==0&&Dt!==null){e=Dt;var u=we;e:switch(Yt){case 1:Yt=0,we=null,Fn(t,e,u,1);break;case 2:case 9:if(Cr(u)){Yt=0,we=null,Ed(e);break}e=function(){Yt!==2&&Yt!==9||Vt!==t||(Yt=7),sl(t)},u.then(e,e);break t;case 3:Yt=7;break t;case 4:Yt=5;break t;case 7:Cr(u)?(Yt=0,we=null,Ed(e)):(Yt=0,we=null,Fn(t,e,u,7));break;case 5:var o=null;switch(Dt.tag){case 26:o=Dt.memoizedState;case 5:case 27:var s=Dt;if(!o||ih(o)){Yt=0,we=null;var p=s.sibling;if(p!==null)Dt=p;else{var T=s.return;T!==null?(Dt=T,ui(T)):Dt=null}break e}}Yt=0,we=null,Fn(t,e,u,5);break;case 6:Yt=0,we=null,Fn(t,e,u,6);break;case 8:bf(),te=6;break t;default:throw Error(f(462))}}Em();break}catch(U){xd(t,U)}while(!0);return gl=cn=null,D.H=n,D.A=a,Ct=l,Dt!==null?0:(Vt=null,Bt=0,Ou(),te)}function Em(){for(;Dt!==null&&!ee();)Td(Dt)}function Td(t){var e=Is(t.alternate,t,Ol);t.memoizedProps=t.pendingProps,e===null?ui(t):Dt=e}function Ed(t){var e=t,l=e.alternate;switch(e.tag){case 15:case 0:e=Ls(l,e,e.pendingProps,e.type,void 0,Bt);break;case 11:e=Ls(l,e,e.pendingProps,e.type.render,e.ref,Bt);break;case 5:qc(e);default:Fs(l,e),e=Dt=Or(e,Ol),e=Is(l,e,Ol)}t.memoizedProps=t.pendingProps,e===null?ui(t):Dt=e}function Fn(t,e,l,n){gl=cn=null,qc(e),Zn=null,Ga=0;var a=e.return;try{if(ym(t,a,e,l,Bt)){te=1,Pu(t,Ke(l,t.current)),Dt=null;return}}catch(u){if(a!==null)throw Dt=a,u;te=1,Pu(t,Ke(l,t.current)),Dt=null;return}e.flags&32768?(qt||n===1?t=!0:Jn||Bt&536870912?t=!1:(wl=t=!0,(n===2||n===9||n===3||n===6)&&(n=Pe.current,n!==null&&n.tag===13&&(n.flags|=16384))),Od(e,t)):ui(e)}function ui(t){var e=t;do{if(e.flags&32768){Od(e,wl);return}t=e.return;var l=vm(e.alternate,e,Ol);if(l!==null){Dt=l;return}if(e=e.sibling,e!==null){Dt=e;return}Dt=e=t}while(e!==null);te===0&&(te=5)}function Od(t,e){do{var l=pm(t.alternate,t);if(l!==null){l.flags&=32767,Dt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!e&&(t=t.sibling,t!==null)){Dt=t;return}Dt=t=l}while(t!==null);te=6,Dt=null}function _d(t,e,l,n,a,u,o,s,p){t.cancelPendingCommit=null;do ii();while(pe!==0);if(Ct&6)throw Error(f(327));if(e!==null){if(e===t.current)throw Error(f(177));if(u=e.lanes|e.childLanes,u|=rc,zl(t,l,u,o,s,p),t===Vt&&(Dt=Vt=null,Bt=0),Pn=e,Vl=t,In=l,vf=u,pf=a,pd=n,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,Dm($t,function(){return Bd(),null})):(t.callbackNode=null,t.callbackPriority=0),n=(e.flags&13878)!==0,e.subtreeFlags&13878||n){n=D.T,D.T=null,a=G.p,G.p=2,o=Ct,Ct|=4;try{gm(t,e,l)}finally{Ct=o,G.p=a,D.T=n}}pe=1,zd(),Dd(),Rd()}}function zd(){if(pe===1){pe=0;var t=Vl,e=Pn,l=(e.flags&13878)!==0;if(e.subtreeFlags&13878||l){l=D.T,D.T=null;var n=G.p;G.p=2;var a=Ct;Ct|=4;try{rd(e,t);var u=Nf,o=vr(t.containerInfo),s=u.focusedElem,p=u.selectionRange;if(o!==s&&s&&s.ownerDocument&&mr(s.ownerDocument.documentElement,s)){if(p!==null&&uc(s)){var T=p.start,U=p.end;if(U===void 0&&(U=T),"selectionStart"in s)s.selectionStart=T,s.selectionEnd=Math.min(U,s.value.length);else{var H=s.ownerDocument||document,O=H&&H.defaultView||window;if(O.getSelection){var _=O.getSelection(),St=s.textContent.length,pt=Math.min(p.start,St),jt=p.end===void 0?pt:Math.min(p.end,St);!_.extend&&pt>jt&&(o=jt,jt=pt,pt=o);var M=yr(s,pt),x=yr(s,jt);if(M&&x&&(_.rangeCount!==1||_.anchorNode!==M.node||_.anchorOffset!==M.offset||_.focusNode!==x.node||_.focusOffset!==x.offset)){var A=H.createRange();A.setStart(M.node,M.offset),_.removeAllRanges(),pt>jt?(_.addRange(A),_.extend(x.node,x.offset)):(A.setEnd(x.node,x.offset),_.addRange(A))}}}}for(H=[],_=s;_=_.parentNode;)_.nodeType===1&&H.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<H.length;s++){var B=H[s];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}gi=!!Bf,Nf=Bf=null}finally{Ct=a,G.p=n,D.T=l}}t.current=e,pe=2}}function Dd(){if(pe===2){pe=0;var t=Vl,e=Pn,l=(e.flags&8772)!==0;if(e.subtreeFlags&8772||l){l=D.T,D.T=null;var n=G.p;G.p=2;var a=Ct;Ct|=4;try{id(t,e.alternate,e)}finally{Ct=a,G.p=n,D.T=l}}pe=3}}function Rd(){if(pe===4||pe===3){pe=0,Gt();var t=Vl,e=Pn,l=In,n=pd;e.subtreeFlags&10256||e.flags&10256?pe=5:(pe=0,Pn=Vl=null,Ud(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(Ql=null),il(l),e=e.stateNode,ot&&typeof ot.onCommitFiberRoot=="function")try{ot.onCommitFiberRoot(Ut,e,void 0,(e.current.flags&128)===128)}catch(p){}if(n!==null){e=D.T,a=G.p,G.p=2,D.T=null;try{for(var u=t.onRecoverableError,o=0;o<n.length;o++){var s=n[o];u(s.value,{componentStack:s.stack})}}finally{D.T=e,G.p=a}}In&3&&ii(),sl(t),a=t.pendingLanes,l&4194090&&a&42?t===gf?ka++:(ka=0,gf=t):ka=0,Ja(0)}}function Ud(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,_a(e)))}function ii(t){return zd(),Dd(),Rd(),Bd()}function Bd(){if(pe!==5)return!1;var t=Vl,e=vf;vf=0;var l=il(In),n=D.T,a=G.p;try{G.p=32>l?32:l,D.T=null,l=pf,pf=null;var u=Vl,o=In;if(pe=0,Pn=Vl=null,In=0,Ct&6)throw Error(f(331));var s=Ct;if(Ct|=4,md(u.current),dd(u,u.current,o,l),Ct=s,Ja(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Ut,u)}catch(p){}return!0}finally{G.p=a,D.T=n,Ud(t,e)}}function Nd(t,e,l){e=Ke(l,e),e=$c(t.stateNode,e,2),t=Nl(t,e,2),t!==null&&(Ee(t,2),sl(t))}function Qt(t,e,l){if(t.tag===3)Nd(t,t,l);else for(;e!==null;){if(e.tag===3){Nd(e,t,l);break}else if(e.tag===1){var n=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Ql===null||!Ql.has(n))){t=Ke(l,t),l=Ys(2),n=Nl(e,l,2),n!==null&&(Gs(l,n,e,t),Ee(n,2),sl(n));break}}e=e.return}}function Mf(t,e,l){var n=t.pingCache;if(n===null){n=t.pingCache=new xm;var a=new Set;n.set(e,a)}else a=n.get(e),a===void 0&&(a=new Set,n.set(e,a));a.has(l)||(df=!0,a.add(l),t=Om.bind(null,t,e,l),e.then(t,t))}function Om(t,e,l){var n=t.pingCache;n!==null&&n.delete(e),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,Vt===t&&(Bt&l)===l&&(te===4||te===3&&(Bt&62914560)===Bt&&300>Nt()-mf?!(Ct&2)&&Wn(t,0):hf|=l,$n===Bt&&($n=0)),sl(t)}function Hd(t,e){e===0&&(e=al()),t=Hn(t,e),t!==null&&(Ee(t,e),sl(t))}function _m(t){var e=t.memoizedState,l=0;e!==null&&(l=e.retryLane),Hd(t,l)}function zm(t,e){var l=0;switch(t.tag){case 13:var n=t.stateNode,a=t.memoizedState;a!==null&&(l=a.retryLane);break;case 19:n=t.stateNode;break;case 22:n=t.stateNode._retryCache;break;default:throw Error(f(314))}n!==null&&n.delete(e),Hd(t,l)}function Dm(t,e){return vt(t,e)}var ci=null,ta=null,Af=!1,fi=!1,Tf=!1,yn=0;function sl(t){t!==ta&&t.next===null&&(ta===null?ci=ta=t:ta=ta.next=t),fi=!0,Af||(Af=!0,Um())}function Ja(t,e){if(!Tf&&fi){Tf=!0;do for(var l=!1,n=ci;n!==null;){if(t!==0){var a=n.pendingLanes;if(a===0)var u=0;else{var o=n.suspendedLanes,s=n.pingedLanes;u=(1<<31-Mt(42|t)+1)-1,u&=a&~(o&~s),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,Gd(n,u))}else u=Bt,u=dl(n,n===Vt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),!(u&3)||De(n,u)||(l=!0,Gd(n,u));n=n.next}while(l);Tf=!1}}function Rm(){qd()}function qd(){fi=Af=!1;var t=0;yn!==0&&(Xm()&&(t=yn),yn=0);for(var e=Nt(),l=null,n=ci;n!==null;){var a=n.next,u=Cd(n,e);u===0?(n.next=null,l===null?ci=a:l.next=a,a===null&&(ta=l)):(l=n,(t!==0||u&3)&&(fi=!0)),n=a}Ja(t)}function Cd(t,e){for(var l=t.suspendedLanes,n=t.pingedLanes,a=t.expirationTimes,u=t.pendingLanes&-62914561;0<u;){var o=31-Mt(u),s=1<<o,p=a[o];p===-1?(!(s&l)||s&n)&&(a[o]=Yi(s,e)):p<=e&&(t.expiredLanes|=s),u&=~s}if(e=Vt,l=Bt,l=dl(t,t===e?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),n=t.callbackNode,l===0||t===e&&(Yt===2||Yt===9)||t.cancelPendingCommit!==null)return n!==null&&n!==null&&Jt(n),t.callbackNode=null,t.callbackPriority=0;if(!(l&3)||De(t,l)){if(e=l&-l,e===t.callbackPriority)return e;switch(n!==null&&Jt(n),il(l)){case 2:case 8:l=Kt;break;case 32:l=$t;break;case 268435456:l=ae;break;default:l=$t}return n=Yd.bind(null,t),l=vt(l,n),t.callbackPriority=e,t.callbackNode=l,e}return n!==null&&n!==null&&Jt(n),t.callbackPriority=2,t.callbackNode=null,2}function Yd(t,e){if(pe!==0&&pe!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(ii()&&t.callbackNode!==l)return null;var n=Bt;return n=dl(t,t===Vt?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),n===0?null:(bd(t,n,e),Cd(t,Nt()),t.callbackNode!=null&&t.callbackNode===l?Yd.bind(null,t):null)}function Gd(t,e){if(ii())return null;bd(t,e,!0)}function Um(){jm(function(){Ct&6?vt(Zt,Rm):qd()})}function Ef(){return yn===0&&(yn=re()),yn}function Xd(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:bu(""+t)}function wd(t,e){var l=e.ownerDocument.createElement("input");return l.name=e.name,l.value=e.value,t.id&&l.setAttribute("form",t.id),e.parentNode.insertBefore(l,e),t=new FormData(t),l.parentNode.removeChild(l),t}function Bm(t,e,l,n,a){if(e==="submit"&&l&&l.stateNode===a){var u=Xd((a[Re]||null).action),o=n.submitter;o&&(e=(e=o[Re]||null)?Xd(e.formAction):o.getAttribute("formAction"),e!==null&&(u=e,o=null));var s=new Au("action","action",null,n,a);t.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(yn!==0){var p=o?wd(a,o):new FormData(a);Zc(l,{pending:!0,data:p,method:a.method,action:u},null,p)}}else typeof u=="function"&&(s.preventDefault(),p=o?wd(a,o):new FormData(a),Zc(l,{pending:!0,data:p,method:a.method,action:u},u,p))},currentTarget:a}]})}}for(var Of=0;Of<oc.length;Of++){var _f=oc[Of],Nm=_f.toLowerCase(),Hm=_f[0].toUpperCase()+_f.slice(1);tl(Nm,"on"+Hm)}tl(br,"onAnimationEnd"),tl(Sr,"onAnimationIteration"),tl(xr,"onAnimationStart"),tl("dblclick","onDoubleClick"),tl("focusin","onFocus"),tl("focusout","onBlur"),tl(Iy,"onTransitionRun"),tl(Wy,"onTransitionStart"),tl(Fy,"onTransitionCancel"),tl(Mr,"onTransitionEnd"),Tn("onMouseEnter",["mouseout","mouseover"]),Tn("onMouseLeave",["mouseout","mouseover"]),Tn("onPointerEnter",["pointerout","pointerover"]),Tn("onPointerLeave",["pointerout","pointerover"]),Il("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Il("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Il("onBeforeInput",["compositionend","keypress","textInput","paste"]),Il("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Il("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Il("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $a="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),qm=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($a));function jd(t,e){e=(e&4)!==0;for(var l=0;l<t.length;l++){var n=t[l],a=n.event;n=n.listeners;t:{var u=void 0;if(e)for(var o=n.length-1;0<=o;o--){var s=n[o],p=s.instance,T=s.currentTarget;if(s=s.listener,p!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=T;try{u(a)}catch(U){$u(U)}a.currentTarget=null,u=p}else for(o=0;o<n.length;o++){if(s=n[o],p=s.instance,T=s.currentTarget,s=s.listener,p!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=T;try{u(a)}catch(U){$u(U)}a.currentTarget=null,u=p}}}}function Rt(t,e){var l=e[Xi];l===void 0&&(l=e[Xi]=new Set);var n=t+"__bubble";l.has(n)||(Qd(e,t,2,!1),l.add(n))}function zf(t,e,l){var n=0;e&&(n|=4),Qd(l,t,n,e)}var oi="_reactListening"+Math.random().toString(36).slice(2);function Df(t){if(!t[oi]){t[oi]=!0,qo.forEach(function(l){l!=="selectionchange"&&(qm.has(l)||zf(l,!1,t),zf(l,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[oi]||(e[oi]=!0,zf("selectionchange",!1,e))}}function Qd(t,e,l,n){switch(dh(e)){case 2:var a=fv;break;case 8:a=ov;break;default:a=Vf}l=a.bind(null,e,l,t),a=void 0,!Pi||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),n?a!==void 0?t.addEventListener(e,l,{capture:!0,passive:a}):t.addEventListener(e,l,!0):a!==void 0?t.addEventListener(e,l,{passive:a}):t.addEventListener(e,l,!1)}function Rf(t,e,l,n,a){var u=n;if(!(e&1)&&!(e&2)&&n!==null)t:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var s=n.stateNode.containerInfo;if(s===a)break;if(o===4)for(o=n.return;o!==null;){var p=o.tag;if((p===3||p===4)&&o.stateNode.containerInfo===a)return;o=o.return}for(;s!==null;){if(o=xn(s),o===null)return;if(p=o.tag,p===5||p===6||p===26||p===27){n=u=o;continue t}s=s.parentNode}}n=n.return}$o(function(){var T=u,U=Ji(l),H=[];t:{var O=Ar.get(t);if(O!==void 0){var _=Au,St=t;switch(t){case"keypress":if(xu(l)===0)break t;case"keydown":case"keyup":_=Dy;break;case"focusin":St="focus",_=tc;break;case"focusout":St="blur",_=tc;break;case"beforeblur":case"afterblur":_=tc;break;case"click":if(l.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_=Wo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_=py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_=By;break;case br:case Sr:case xr:_=Sy;break;case Mr:_=Hy;break;case"scroll":case"scrollend":_=my;break;case"wheel":_=Cy;break;case"copy":case"cut":case"paste":_=My;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":_=tr;break;case"toggle":case"beforetoggle":_=Gy}var pt=(e&4)!==0,jt=!pt&&(t==="scroll"||t==="scrollend"),M=pt?O!==null?O+"Capture":null:O;pt=[];for(var x=T,A;x!==null;){var B=x;if(A=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||A===null||M===null||(B=ya(x,M),B!=null&&pt.push(Pa(x,B,A))),jt)break;x=x.return}0<pt.length&&(O=new _(O,St,null,l,U),H.push({event:O,listeners:pt}))}}if(!(e&7)){t:{if(O=t==="mouseover"||t==="pointerover",_=t==="mouseout"||t==="pointerout",O&&l!==ki&&(St=l.relatedTarget||l.fromElement)&&(xn(St)||St[Sn]))break t;if((_||O)&&(O=U.window===U?U:(O=U.ownerDocument)?O.defaultView||O.parentWindow:window,_?(St=l.relatedTarget||l.toElement,_=T,St=St?xn(St):null,St!==null&&(jt=v(St),pt=St.tag,St!==jt||pt!==5&&pt!==27&&pt!==6)&&(St=null)):(_=null,St=T),_!==St)){if(pt=Wo,B="onMouseLeave",M="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(pt=tr,B="onPointerLeave",M="onPointerEnter",x="pointer"),jt=_==null?O:ha(_),A=St==null?O:ha(St),O=new pt(B,x+"leave",_,l,U),O.target=jt,O.relatedTarget=A,B=null,xn(U)===T&&(pt=new pt(M,x+"enter",St,l,U),pt.target=A,pt.relatedTarget=jt,B=pt),jt=B,_&&St)e:{for(pt=_,M=St,x=0,A=pt;A;A=ea(A))x++;for(A=0,B=M;B;B=ea(B))A++;for(;0<x-A;)pt=ea(pt),x--;for(;0<A-x;)M=ea(M),A--;for(;x--;){if(pt===M||M!==null&&pt===M.alternate)break e;pt=ea(pt),M=ea(M)}pt=null}else pt=null;_!==null&&Vd(H,O,_,pt,!1),St!==null&&jt!==null&&Vd(H,jt,St,pt,!0)}}t:{if(O=T?ha(T):window,_=O.nodeName&&O.nodeName.toLowerCase(),_==="select"||_==="input"&&O.type==="file")var F=fr;else if(ir(O))if(or)F=Jy;else{F=Ky;var zt=Ly}else _=O.nodeName,!_||_.toLowerCase()!=="input"||O.type!=="checkbox"&&O.type!=="radio"?T&&Ki(T.elementType)&&(F=fr):F=ky;if(F&&(F=F(t,T))){cr(H,F,l,U);break t}zt&&zt(t,O,T),t==="focusout"&&T&&O.type==="number"&&T.memoizedProps.value!=null&&Li(O,"number",O.value)}switch(zt=T?ha(T):window,t){case"focusin":(ir(zt)||zt.contentEditable==="true")&&(Un=zt,ic=T,Ma=null);break;case"focusout":Ma=ic=Un=null;break;case"mousedown":cc=!0;break;case"contextmenu":case"mouseup":case"dragend":cc=!1,pr(H,l,U);break;case"selectionchange":if(Py)break;case"keydown":case"keyup":pr(H,l,U)}var it;if(lc)t:{switch(t){case"compositionstart":var gt="onCompositionStart";break t;case"compositionend":gt="onCompositionEnd";break t;case"compositionupdate":gt="onCompositionUpdate";break t}gt=void 0}else Rn?ar(t,l)&&(gt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(gt="onCompositionStart");gt&&(er&&l.locale!=="ko"&&(Rn||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&Rn&&(it=Po()):(Dl=U,Ii="value"in Dl?Dl.value:Dl.textContent,Rn=!0)),zt=ri(T,gt),0<zt.length&&(gt=new Fo(gt,t,null,l,U),H.push({event:gt,listeners:zt}),it?gt.data=it:(it=ur(l),it!==null&&(gt.data=it)))),(it=wy?jy(t,l):Qy(t,l))&&(gt=ri(T,"onBeforeInput"),0<gt.length&&(zt=new Fo("onBeforeInput","beforeinput",null,l,U),H.push({event:zt,listeners:gt}),zt.data=it)),Bm(H,t,T,l,U)}jd(H,e)})}function Pa(t,e,l){return{instance:t,listener:e,currentTarget:l}}function ri(t,e){for(var l=e+"Capture",n=[];t!==null;){var a=t,u=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||u===null||(a=ya(t,l),a!=null&&n.unshift(Pa(t,a,u)),a=ya(t,e),a!=null&&n.push(Pa(t,a,u))),t.tag===3)return n;t=t.return}return[]}function ea(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Vd(t,e,l,n,a){for(var u=e._reactName,o=[];l!==null&&l!==n;){var s=l,p=s.alternate,T=s.stateNode;if(s=s.tag,p!==null&&p===n)break;s!==5&&s!==26&&s!==27||T===null||(p=T,a?(T=ya(l,u),T!=null&&o.unshift(Pa(l,T,p))):a||(T=ya(l,u),T!=null&&o.push(Pa(l,T,p)))),l=l.return}o.length!==0&&t.push({event:e,listeners:o})}var Cm=/\r\n?/g,Ym=/\u0000|\uFFFD/g;function Zd(t){return(typeof t=="string"?t:""+t).replace(Cm,`
41
- `).replace(Ym,"")}function Ld(t,e){return e=Zd(e),Zd(t)===e}function si(){}function wt(t,e,l,n,a,u){switch(l){case"children":typeof n=="string"?e==="body"||e==="textarea"&&n===""||_n(t,n):(typeof n=="number"||typeof n=="bigint")&&e!=="body"&&_n(t,""+n);break;case"className":vu(t,"class",n);break;case"tabIndex":vu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":vu(t,l,n);break;case"style":ko(t,n,u);break;case"data":if(e!=="object"){vu(t,"data",n);break}case"src":case"href":if(n===""&&(e!=="a"||l!=="href")){t.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(l);break}n=bu(""+n),t.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(l==="formAction"?(e!=="input"&&wt(t,e,"name",a.name,a,null),wt(t,e,"formEncType",a.formEncType,a,null),wt(t,e,"formMethod",a.formMethod,a,null),wt(t,e,"formTarget",a.formTarget,a,null)):(wt(t,e,"encType",a.encType,a,null),wt(t,e,"method",a.method,a,null),wt(t,e,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(l);break}n=bu(""+n),t.setAttribute(l,n);break;case"onClick":n!=null&&(t.onclick=si);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=l}}break;case"multiple":t.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":t.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){t.removeAttribute("xlink:href");break}l=bu(""+n),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,""+n):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":n===!0?t.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,n):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?t.setAttribute(l,n):t.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?t.removeAttribute(l):t.setAttribute(l,n);break;case"popover":Rt("beforetoggle",t),Rt("toggle",t),mu(t,"popover",n);break;case"xlinkActuate":hl(t,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":hl(t,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":hl(t,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":hl(t,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":hl(t,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":hl(t,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":hl(t,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":hl(t,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":hl(t,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":mu(t,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=hy.get(l)||l,mu(t,l,n))}}function Uf(t,e,l,n,a,u){switch(l){case"style":ko(t,n,u);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=l}}break;case"children":typeof n=="string"?_n(t,n):(typeof n=="number"||typeof n=="bigint")&&_n(t,""+n);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"onClick":n!=null&&(t.onclick=si);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Co.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(a=l.endsWith("Capture"),e=l.slice(2,a?l.length-7:void 0),u=t[Re]||null,u=u!=null?u[l]:null,typeof u=="function"&&t.removeEventListener(e,u,a),typeof n=="function")){typeof u!="function"&&u!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(e,n,a);break t}l in t?t[l]=n:n===!0?t.setAttribute(l,""):mu(t,l,n)}}}function ge(t,e,l){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",t),Rt("load",t);var n=!1,a=!1,u;for(u in l)if(l.hasOwnProperty(u)){var o=l[u];if(o!=null)switch(u){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,u,o,l,null)}}a&&wt(t,e,"srcSet",l.srcSet,l,null),n&&wt(t,e,"src",l.src,l,null);return;case"input":Rt("invalid",t);var s=u=o=a=null,p=null,T=null;for(n in l)if(l.hasOwnProperty(n)){var U=l[n];if(U!=null)switch(n){case"name":a=U;break;case"type":o=U;break;case"checked":p=U;break;case"defaultChecked":T=U;break;case"value":u=U;break;case"defaultValue":s=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,e));break;default:wt(t,e,n,U,l,null)}}Vo(t,u,s,p,T,o,a,!1),pu(t);return;case"select":Rt("invalid",t),n=o=u=null;for(a in l)if(l.hasOwnProperty(a)&&(s=l[a],s!=null))switch(a){case"value":u=s;break;case"defaultValue":o=s;break;case"multiple":n=s;default:wt(t,e,a,s,l,null)}e=u,l=o,t.multiple=!!n,e!=null?On(t,!!n,e,!1):l!=null&&On(t,!!n,l,!0);return;case"textarea":Rt("invalid",t),u=a=n=null;for(o in l)if(l.hasOwnProperty(o)&&(s=l[o],s!=null))switch(o){case"value":n=s;break;case"defaultValue":a=s;break;case"children":u=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(f(91));break;default:wt(t,e,o,s,l,null)}Lo(t,n,a,u),pu(t);return;case"option":for(p in l)if(l.hasOwnProperty(p)&&(n=l[p],n!=null))switch(p){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,e,p,n,l,null)}return;case"dialog":Rt("beforetoggle",t),Rt("toggle",t),Rt("cancel",t),Rt("close",t);break;case"iframe":case"object":Rt("load",t);break;case"video":case"audio":for(n=0;n<$a.length;n++)Rt($a[n],t);break;case"image":Rt("error",t),Rt("load",t);break;case"details":Rt("toggle",t);break;case"embed":case"source":case"link":Rt("error",t),Rt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in l)if(l.hasOwnProperty(T)&&(n=l[T],n!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,T,n,l,null)}return;default:if(Ki(e)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&Uf(t,e,U,n,l,void 0));return}}for(s in l)l.hasOwnProperty(s)&&(n=l[s],n!=null&&wt(t,e,s,n,l,null))}function Gm(t,e,l,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,u=null,o=null,s=null,p=null,T=null,U=null;for(_ in l){var H=l[_];if(l.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":p=H;default:n.hasOwnProperty(_)||wt(t,e,_,null,n,H)}}for(var O in n){var _=n[O];if(H=l[O],n.hasOwnProperty(O)&&(_!=null||H!=null))switch(O){case"type":u=_;break;case"name":a=_;break;case"checked":T=_;break;case"defaultChecked":U=_;break;case"value":o=_;break;case"defaultValue":s=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(f(137,e));break;default:_!==H&&wt(t,e,O,_,n,H)}}Zi(t,o,s,p,T,U,u,a);return;case"select":_=o=s=O=null;for(u in l)if(p=l[u],l.hasOwnProperty(u)&&p!=null)switch(u){case"value":break;case"multiple":_=p;default:n.hasOwnProperty(u)||wt(t,e,u,null,n,p)}for(a in n)if(u=n[a],p=l[a],n.hasOwnProperty(a)&&(u!=null||p!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==p&&wt(t,e,a,u,n,p)}e=s,l=o,n=_,O!=null?On(t,!!l,O,!1):!!n!=!!l&&(e!=null?On(t,!!l,e,!0):On(t,!!l,l?[]:"",!1));return;case"textarea":_=O=null;for(s in l)if(a=l[s],l.hasOwnProperty(s)&&a!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:wt(t,e,s,null,n,a)}for(o in n)if(a=n[o],u=l[o],n.hasOwnProperty(o)&&(a!=null||u!=null))switch(o){case"value":O=a;break;case"defaultValue":_=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(f(91));break;default:a!==u&&wt(t,e,o,a,n,u)}Zo(t,O,_);return;case"option":for(var St in l)if(O=l[St],l.hasOwnProperty(St)&&O!=null&&!n.hasOwnProperty(St))switch(St){case"selected":t.selected=!1;break;default:wt(t,e,St,null,n,O)}for(p in n)if(O=n[p],_=l[p],n.hasOwnProperty(p)&&O!==_&&(O!=null||_!=null))switch(p){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,e,p,O,n,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var pt in l)O=l[pt],l.hasOwnProperty(pt)&&O!=null&&!n.hasOwnProperty(pt)&&wt(t,e,pt,null,n,O);for(T in n)if(O=n[T],_=l[T],n.hasOwnProperty(T)&&O!==_&&(O!=null||_!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,e));break;default:wt(t,e,T,O,n,_)}return;default:if(Ki(e)){for(var jt in l)O=l[jt],l.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Uf(t,e,jt,void 0,n,O);for(U in n)O=n[U],_=l[U],!n.hasOwnProperty(U)||O===_||O===void 0&&_===void 0||Uf(t,e,U,O,n,_);return}}for(var M in l)O=l[M],l.hasOwnProperty(M)&&O!=null&&!n.hasOwnProperty(M)&&wt(t,e,M,null,n,O);for(H in n)O=n[H],_=l[H],!n.hasOwnProperty(H)||O===_||O==null&&_==null||wt(t,e,H,O,n,_)}var Bf=null,Nf=null;function di(t){return t.nodeType===9?t:t.ownerDocument}function Kd(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kd(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function Hf(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var qf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===qf?!1:(qf=t,!0):(qf=null,!1)}var Jd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,$d=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof $d!="undefined"?function(t){return $d.resolve(null).then(t).catch(Qm)}:Jd;function Qm(t){setTimeout(function(){throw t})}function Ll(t){return t==="head"}function Pd(t,e){var l=e,n=0,a=0;do{var u=l.nextSibling;if(t.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(0<n&&8>n){l=n;var o=t.ownerDocument;if(l&1&&Ia(o.documentElement),l&2&&Ia(o.body),l&4)for(l=o.head,Ia(l),o=l.firstChild;o;){var s=o.nextSibling,p=o.nodeName;o[da]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&o.rel.toLowerCase()==="stylesheet"||l.removeChild(o),o=s}}if(a===0){t.removeChild(u),uu(e);return}a--}else l==="$"||l==="$?"||l==="$!"?a++:n=l.charCodeAt(0)-48;else n=0;l=u}while(l);uu(e)}function Cf(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var l=e;switch(e=e.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Cf(l),wi(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function Vm(t,e,l,n){for(;t.nodeType===1;){var a=l;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!n&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(n){if(!t[da])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(u=t.getAttribute("rel"),u==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(u!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(u=t.getAttribute("src"),(u!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&u&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var u=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===u)return t}else return t;if(t=ll(t.nextSibling),t===null)break}return null}function Zm(t,e,l){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=ll(t.nextSibling),t===null))return null;return t}function Yf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function Lm(t,e){var l=t.ownerDocument;if(t.data!=="$?"||l.readyState==="complete")e();else{var n=function(){e(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),t._reactRetry=n}}function ll(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="F!"||e==="F")break;if(e==="/$")return null}}return t}var Gf=null;function Id(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"){if(e===0)return t;e--}else l==="/$"&&e++}t=t.previousSibling}return null}function Wd(t,e,l){switch(e=di(l),t){case"html":if(t=e.documentElement,!t)throw Error(f(452));return t;case"head":if(t=e.head,!t)throw Error(f(453));return t;case"body":if(t=e.body,!t)throw Error(f(454));return t;default:throw Error(f(451))}}function Ia(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);wi(t)}var We=new Map,Fd=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _l=G.d;G.d={f:Km,r:km,D:Jm,C:$m,L:Pm,m:Im,X:Fm,S:Wm,M:tv};function Km(){var t=_l.f(),e=ai();return t||e}function km(t){var e=Mn(t);e!==null&&e.tag===5&&e.type==="form"?bs(e):_l.r(t)}var la=typeof document=="undefined"?null:document;function th(t,e,l){var n=la;if(n&&typeof e=="string"&&e){var a=Le(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof l=="string"&&(a+='[crossorigin="'+l+'"]'),Fd.has(a)||(Fd.add(a),t={rel:t,crossOrigin:l,href:e},n.querySelector(a)===null&&(e=n.createElement("link"),ge(e,"link",t),se(e),n.head.appendChild(e)))}}function Jm(t){_l.D(t),th("dns-prefetch",t,null)}function $m(t,e){_l.C(t,e),th("preconnect",t,e)}function Pm(t,e,l){_l.L(t,e,l);var n=la;if(n&&t&&e){var a='link[rel="preload"][as="'+Le(e)+'"]';e==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+Le(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+Le(l.imageSizes)+'"]')):a+='[href="'+Le(t)+'"]';var u=a;switch(e){case"style":u=na(t);break;case"script":u=aa(t)}We.has(u)||(t=g({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),We.set(u,t),n.querySelector(a)!==null||e==="style"&&n.querySelector(Wa(u))||e==="script"&&n.querySelector(Fa(u))||(e=n.createElement("link"),ge(e,"link",t),se(e),n.head.appendChild(e)))}}function Im(t,e){_l.m(t,e);var l=la;if(l&&t){var n=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Le(n)+'"][href="'+Le(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!We.has(u)&&(t=g({rel:"modulepreload",href:t},e),We.set(u,t),l.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Fa(u)))return}n=l.createElement("link"),ge(n,"link",t),se(n),l.head.appendChild(n)}}}function Wm(t,e,l){_l.S(t,e,l);var n=la;if(n&&t){var a=An(n).hoistableStyles,u=na(t);e=e||"default";var o=a.get(u);if(!o){var s={loading:0,preload:null};if(o=n.querySelector(Wa(u)))s.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":e},l),(l=We.get(u))&&Xf(t,l);var p=o=n.createElement("link");se(p),ge(p,"link",t),p._p=new Promise(function(T,U){p.onload=T,p.onerror=U}),p.addEventListener("load",function(){s.loading|=1}),p.addEventListener("error",function(){s.loading|=2}),s.loading|=4,yi(o,e,n)}o={type:"stylesheet",instance:o,count:1,state:s},a.set(u,o)}}}function Fm(t,e){_l.X(t,e);var l=la;if(l&&t){var n=An(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0},e),(e=We.get(a))&&wf(t,e),u=l.createElement("script"),se(u),ge(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function tv(t,e){_l.M(t,e);var l=la;if(l&&t){var n=An(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0,type:"module"},e),(e=We.get(a))&&wf(t,e),u=l.createElement("script"),se(u),ge(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function eh(t,e,l,n){var a=(a=N.current)?hi(a):null;if(!a)throw Error(f(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=na(l.href),l=An(a).hoistableStyles,n=l.get(e),n||(n={type:"style",instance:null,count:0,state:null},l.set(e,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=na(l.href);var u=An(a).hoistableStyles,o=u.get(t);if(o||(a=a.ownerDocument||a,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,o),(u=a.querySelector(Wa(t)))&&!u._p&&(o.instance=u,o.state.loading=5),We.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},We.set(t,l),u||ev(a,t,l,o.state))),e&&n===null)throw Error(f(528,""));return o}if(e&&n!==null)throw Error(f(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=aa(l),l=An(a).hoistableScripts,n=l.get(e),n||(n={type:"script",instance:null,count:0,state:null},l.set(e,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,t))}}function na(t){return'href="'+Le(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function lh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function ev(t,e,l,n){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?n.loading=1:(e=t.createElement("link"),n.preload=e,e.addEventListener("load",function(){return n.loading|=1}),e.addEventListener("error",function(){return n.loading|=2}),ge(e,"link",l),se(e),t.head.appendChild(e))}function aa(t){return'[src="'+Le(t)+'"]'}function Fa(t){return"script[async]"+t}function nh(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var n=t.querySelector('style[data-href~="'+Le(l.href)+'"]');if(n)return e.instance=n,se(n),n;var a=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(t.ownerDocument||t).createElement("style"),se(n),ge(n,"style",a),yi(n,l.precedence,t),e.instance=n;case"stylesheet":a=na(l.href);var u=t.querySelector(Wa(a));if(u)return e.state.loading|=4,e.instance=u,se(u),u;n=lh(l),(a=We.get(a))&&Xf(n,a),u=(t.ownerDocument||t).createElement("link"),se(u);var o=u;return o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),ge(u,"link",n),e.state.loading|=4,yi(u,l.precedence,t),e.instance=u;case"script":return u=aa(l.src),(a=t.querySelector(Fa(u)))?(e.instance=a,se(a),a):(n=l,(a=We.get(u))&&(n=g({},l),wf(n,a)),t=t.ownerDocument||t,a=t.createElement("script"),se(a),ge(a,"link",n),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(f(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(n=e.instance,e.state.loading|=4,yi(n,l.precedence,t));return e.instance}function yi(t,e,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=n.length?n[n.length-1]:null,u=a,o=0;o<n.length;o++){var s=n[o];if(s.dataset.precedence===e)u=s;else if(u!==a)break}u?u.parentNode.insertBefore(t,u.nextSibling):(e=l.nodeType===9?l.head:l,e.insertBefore(t,e.firstChild))}function Xf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function wf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var mi=null;function ah(t,e,l){if(mi===null){var n=new Map,a=mi=new Map;a.set(l,n)}else a=mi,n=a.get(l),n||(n=new Map,a.set(l,n));if(n.has(t))return n;for(n.set(t,null),l=l.getElementsByTagName(t),a=0;a<l.length;a++){var u=l[a];if(!(u[da]||u[Se]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var o=u.getAttribute(e)||"";o=t+o;var s=n.get(o);s?s.push(u):n.set(o,[u])}}return n}function uh(t,e,l){t=t.ownerDocument||t,t.head.insertBefore(l,e==="title"?t.querySelector("head > title"):null)}function lv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function ih(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}var tu=null;function nv(){}function av(t,e,l){if(tu===null)throw Error(f(475));var n=tu;if(e.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&!(e.state.loading&4)){if(e.instance===null){var a=na(l.href),u=t.querySelector(Wa(a));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(n.count++,n=vi.bind(n),t.then(n,n)),e.state.loading|=4,e.instance=u,se(u);return}u=t.ownerDocument||t,l=lh(l),(a=We.get(a))&&Xf(l,a),u=u.createElement("link"),se(u);var o=u;o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),ge(u,"link",l),e.instance=u}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(e,t),(t=e.state.preload)&&!(e.state.loading&3)&&(n.count++,e=vi.bind(n),t.addEventListener("load",e),t.addEventListener("error",e))}}function uv(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&jf(t,t.stylesheets),0<t.count?function(e){var l=setTimeout(function(){if(t.stylesheets&&jf(t,t.stylesheets),t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}},6e4);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(l)}}:null}function vi(){if(this.count--,this.count===0){if(this.stylesheets)jf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pi=null;function jf(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pi=new Map,e.forEach(iv,t),pi=null,vi.call(t))}function iv(t,e){if(!(e.state.loading&4)){var l=pi.get(t);if(l)var n=l.get(null);else{l=new Map,pi.set(t,l);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<a.length;u++){var o=a[u];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(l.set(o.dataset.precedence,o),n=o)}n&&l.set(null,n)}a=e.instance,o=a.getAttribute("data-precedence"),u=l.get(o)||n,u===n&&l.set(null,a),l.set(o,a),this.count++,n=vi.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),u?u.parentNode.insertBefore(a,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var eu={$$typeof:Z,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function cv(t,e,l,n,a,u,o,s){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ul(0),this.hiddenUpdates=ul(null),this.identifierPrefix=n,this.onUncaughtError=a,this.onCaughtError=u,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=new Map}function ch(t,e,l,n,a,u,o,s,p,T,U,H){return t=new cv(t,e,l,o,s,p,T,H),e=1,u===!0&&(e|=24),u=Ye(3,null,null,e),t.current=u,u.stateNode=t,e=xc(),e.refCount++,t.pooledCache=e,e.refCount++,u.memoizedState={element:n,isDehydrated:l,cache:e},Ec(u),t}function fh(t){return t?(t=qn,t):qn}function oh(t,e,l,n,a,u){a=fh(a),n.context===null?n.context=a:n.pendingContext=a,n=Bl(e),n.payload={element:l},u=u===void 0?null:u,u!==null&&(n.callback=u),l=Nl(t,n,e),l!==null&&(Qe(l,t,e),Ua(l,t,e))}function rh(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<e?l:e}}function Qf(t,e){rh(t,e),(t=t.alternate)&&rh(t,e)}function sh(t){if(t.tag===13){var e=Hn(t,67108864);e!==null&&Qe(e,t,67108864),Qf(t,67108864)}}var gi=!0;function fv(t,e,l,n){var a=D.T;D.T=null;var u=G.p;try{G.p=2,Vf(t,e,l,n)}finally{G.p=u,D.T=a}}function ov(t,e,l,n){var a=D.T;D.T=null;var u=G.p;try{G.p=8,Vf(t,e,l,n)}finally{G.p=u,D.T=a}}function Vf(t,e,l,n){if(gi){var a=Zf(n);if(a===null)Rf(t,e,n,bi,l),hh(t,n);else if(sv(a,t,e,l,n))n.stopPropagation();else if(hh(t,n),e&4&&-1<rv.indexOf(t)){for(;a!==null;){var u=Mn(a);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var o=ce(u.pendingLanes);if(o!==0){var s=u;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var p=1<<31-Mt(o);s.entanglements[1]|=p,o&=~p}sl(u),!(Ct&6)&&(li=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Qe(s,u,2),ai(),Qf(u,2)}if(u=Zf(n),u===null&&Rf(t,e,n,bi,l),u===a)break;a=u}a!==null&&n.stopPropagation()}else Rf(t,e,n,null,l)}}function Zf(t){return t=Ji(t),Lf(t)}var bi=null;function Lf(t){if(bi=null,t=xn(t),t!==null){var e=v(t);if(e===null)t=null;else{var l=e.tag;if(l===13){if(t=b(e),t!==null)return t;t=null}else if(l===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return bi=t,null}function dh(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Wt()){case Zt:return 2;case Kt:return 8;case $t:case Lt:return 32;case ae:return 268435456;default:return 32}default:return 32}}var Kf=!1,Kl=null,kl=null,Jl=null,lu=new Map,nu=new Map,$l=[],rv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hh(t,e){switch(t){case"focusin":case"focusout":Kl=null;break;case"dragenter":case"dragleave":kl=null;break;case"mouseover":case"mouseout":Jl=null;break;case"pointerover":case"pointerout":lu.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(e.pointerId)}}function au(t,e,l,n,a,u){return t===null||t.nativeEvent!==u?(t={blockedOn:e,domEventName:l,eventSystemFlags:n,nativeEvent:u,targetContainers:[a]},e!==null&&(e=Mn(e),e!==null&&sh(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function sv(t,e,l,n,a){switch(e){case"focusin":return Kl=au(Kl,t,e,l,n,a),!0;case"dragenter":return kl=au(kl,t,e,l,n,a),!0;case"mouseover":return Jl=au(Jl,t,e,l,n,a),!0;case"pointerover":var u=a.pointerId;return lu.set(u,au(lu.get(u)||null,t,e,l,n,a)),!0;case"gotpointercapture":return u=a.pointerId,nu.set(u,au(nu.get(u)||null,t,e,l,n,a)),!0}return!1}function yh(t){var e=xn(t.target);if(e!==null){var l=v(e);if(l!==null){if(e=l.tag,e===13){if(e=b(l),e!==null){t.blockedOn=e,Gi(t.priority,function(){if(l.tag===13){var n=je();n=sa(n);var a=Hn(l,n);a!==null&&Qe(a,l,n),Qf(l,n)}});return}}else if(e===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Si(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var l=Zf(t.nativeEvent);if(l===null){l=t.nativeEvent;var n=new l.constructor(l.type,l);ki=n,l.target.dispatchEvent(n),ki=null}else return e=Mn(l),e!==null&&sh(e),t.blockedOn=l,!1;e.shift()}return!0}function mh(t,e,l){Si(t)&&l.delete(e)}function dv(){Kf=!1,Kl!==null&&Si(Kl)&&(Kl=null),kl!==null&&Si(kl)&&(kl=null),Jl!==null&&Si(Jl)&&(Jl=null),lu.forEach(mh),nu.forEach(mh)}function xi(t,e){t.blockedOn===e&&(t.blockedOn=null,Kf||(Kf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dv)))}var Mi=null;function vh(t){Mi!==t&&(Mi=t,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Mi===t&&(Mi=null);for(var e=0;e<t.length;e+=3){var l=t[e],n=t[e+1],a=t[e+2];if(typeof n!="function"){if(Lf(n||l)===null)continue;break}var u=Mn(l);u!==null&&(t.splice(e,3),e-=3,Zc(u,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function uu(t){function e(p){return xi(p,t)}Kl!==null&&xi(Kl,t),kl!==null&&xi(kl,t),Jl!==null&&xi(Jl,t),lu.forEach(e),nu.forEach(e);for(var l=0;l<$l.length;l++){var n=$l[l];n.blockedOn===t&&(n.blockedOn=null)}for(;0<$l.length&&(l=$l[0],l.blockedOn===null);)yh(l),l.blockedOn===null&&$l.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var a=l[n],u=l[n+1],o=a[Re]||null;if(typeof u=="function")o||vh(l);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Re]||null)s=o.formAction;else if(Lf(a)!==null)continue}else s=o.action;typeof s=="function"?l[n+1]=s:(l.splice(n,3),n-=3),vh(l)}}}function kf(t){this._internalRoot=t}Ai.prototype.render=kf.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(f(409));var l=e.current,n=je();oh(l,n,t,e,null,null)},Ai.prototype.unmount=kf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;oh(t.current,2,null,t,null,null),ai(),e[Sn]=null}};function Ai(t){this._internalRoot=t}Ai.prototype.unstable_scheduleHydration=function(t){if(t){var e=bn();t={blockedOn:null,target:t,priority:e};for(var l=0;l<$l.length&&e!==0&&e<$l[l].priority;l++);$l.splice(l,0,t),l===0&&yh(t)}};var ph=i.version;if(ph!=="19.1.1")throw Error(f(527,ph,"19.1.1"));G.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(f(188)):(t=Object.keys(t).join(","),Error(f(268,t)));return t=y(e),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var hv={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ti=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ti.isDisabled&&Ti.supportsFiber)try{Ut=Ti.inject(hv),ot=Ti}catch(t){}}return ua.createRoot=function(t,e){if(!h(t))throw Error(f(299));var l=!1,n="",a=Ns,u=Hs,o=qs,s=null;return e!=null&&(e.unstable_strictMode===!0&&(l=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(u=e.onCaughtError),e.onRecoverableError!==void 0&&(o=e.onRecoverableError),e.unstable_transitionCallbacks!==void 0&&(s=e.unstable_transitionCallbacks)),e=ch(t,1,!1,null,null,l,n,a,u,o,s,null),t[Sn]=e.current,Df(t),new kf(e)},ua.hydrateRoot=function(t,e,l){if(!h(t))throw Error(f(299));var n=!1,a="",u=Ns,o=Hs,s=qs,p=null,T=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(a=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(o=l.onCaughtError),l.onRecoverableError!==void 0&&(s=l.onRecoverableError),l.unstable_transitionCallbacks!==void 0&&(p=l.unstable_transitionCallbacks),l.formState!==void 0&&(T=l.formState)),e=ch(t,1,!0,e,l!=null?l:null,n,a,u,o,s,p,T),e.context=fh(null),l=e.current,n=je(),n=sa(n),a=Bl(n),a.callback=null,Nl(l,a,n),l=n,e.current.lanes=l,Ee(e,l),sl(e),t[Sn]=e.current,Df(t),new Ai(e)},ua.version="19.1.1",ua}function ao(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ao)}catch(c){console.error(c)}}ao(),If.exports=_h();var zh=If.exports;const k={color:{bands:{silhouette:{fillEven:"#eef2ff",fillOdd:"#f6f7fb",stroke:"#c7d2fe"},workspace:{fillEven:"#f3f4f6",fillOdd:"#f9fafb",stroke:"#e5e7eb"}},completion:{fill:"#dcfce7",stroke:"#86efac"},silhouetteMask:"#94a3b8",anchors:{invalid:"#7dd3fc",valid:"#475569"},piece:{draggingFill:"#1d4ed8",validFill:"#60a5fa",invalidFill:"#ef4444",invalidStroke:"#dc2626",selectedStroke:"#111827",allGreenStroke:"#86efac",borderStroke:"#374151"},ui:{light:"#60a5fa",dark:"#1d4ed8"},blueprint:{fill:"#374151",selectedStroke:"#111827",badgeFill:"#eef2ff",labelFill:"#374151"}},opacity:{blueprint:.95,silhouetteMask:.45,anchors:{valid:.8,invalid:.5},piece:{invalid:.35,dragging:.6,locked:.7,normal:.95}},size:{stroke:{bandPx:1,pieceSelectedPx:1.5,allGreenStrokePx:6,pieceBorderPx:1},anchorRadiusPx:{valid:1,invalid:1},badgeFontPx:12,centerBadge:{fractionOfOuterR:.15,minPx:20,marginPx:4}},layout:{grid:{stepPx:20,unitPx:40},paddingPx:1,constraints:{workspaceDiamAnchors:10,quickstashDiamAnchors:7,primitiveDiamAnchors:5},defaults:{maxQuickstashSlots:1}},game:{snapRadiusPx:15,showBorders:!0,hideTouchingBorders:!0}};function Dh(c){return c.parts!==void 0}function Rh(c){return!Dh(c)}class Uh{constructor(){this.byId=new Map,this.primitivesByKind=new Map}registerAll(i){for(const r of i)this.register(r)}register(i){this.byId.set(i.id,i),Rh(i)&&this.primitivesByKind.set(i.kind,i)}get(i){return this.byId.get(i)}getPrimitive(i){return this.primitivesByKind.get(i)}}var Bh=Object.defineProperty,Nh=Object.defineProperties,Hh=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,qh=Object.prototype.hasOwnProperty,Ch=Object.prototype.propertyIsEnumerable,io=(c,i,r)=>i in c?Bh(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,zi=(c,i)=>{for(var r in i||(i={}))qh.call(i,r)&&io(c,r,i[r]);if(uo)for(var r of uo(i))Ch.call(i,r)&&io(c,r,i[r]);return c},Yh=(c,i)=>Nh(c,Hh(i));let Gh=0;const Xh=()=>`p_${++Gh}`,iu=()=>performance.now();class wh{constructor(i,r,f,h){if(this.registry=new Uh,this._updateCount=0,this.trackingCallbacks=null,!i||i.length===0)throw new Error("BaseGameController: sectors array is required and cannot be empty");if(!f||f.length===0)throw new Error("BaseGameController: primitives array is required and cannot be empty");if(!h)throw new Error("BaseGameController: config is required");this.sectors=i,this.quickstash=r||[],this.primitives=f,this.config=h,this.registry.registerAll(f),this.registry.registerAll(r),this.t0=iu(),this.state=this.initializeState()}get updateCount(){return this._updateCount}notifyStateChange(){this._updateCount++}initializeState(){var i;const r={};for(const f of this.sectors)r[f.id]={sectorId:f.id,pieces:[]};return{cfg:{n:this.config.n,layout:this.config.layout,target:this.config.target,input:this.config.input,maxQuickstashSlots:this.config.maxQuickstashSlots,timeLimitMs:this.config.timeLimitMs,snapRadiusPx:k.game.snapRadiusPx,maxCompositeSize:(i=this.config.maxCompositeSize)!=null?i:0,sectors:this.sectors,mode:this.config.mode},blueprintView:this.config.mode==="prep"?"primitives":"quickstash",primitives:this.primitives,quickstash:this.quickstash,sectors:r,startedAt:this.t0}}setTrackingCallbacks(i){this.trackingCallbacks=i}getState(){return this.state}getSnapRadius(){return k.game.snapRadiusPx}getTarget(){return this.config.target}getInputMode(){return this.config.input}getBlueprint(i){return this.registry.get(i)}getPrimitive(i){return this.registry.getPrimitive(i)}getPiecesInSector(i){const r=this.state.sectors[i];return r?r.pieces:[]}isSectorCompleted(i){var r;return!!((r=this.state.sectors[i])!=null&&r.completedAt)}markSectorCompleted(i){var r;const f=this.state.sectors[i];!f||f.completedAt||(f.completedAt=iu(),(r=this.trackingCallbacks)!=null&&r.onSectorCompleted&&this.trackingCallbacks.onSectorCompleted(i),Object.values(this.state.sectors).every(h=>!!h.completedAt)&&!this.state.endedAt&&(this.state.endedAt=iu()))}spawnFromBlueprint(i,r){const f=Xh(),h={id:f,blueprintId:i.id,pos:zi({},r)};return this.getFloating().pieces.push(h),this.notifyStateChange(),f}move(i,r){const f=this.findPiece(i);f&&(f.pos=zi({},r),this.notifyStateChange())}drop(i,r){const f=this.findPiece(i);if(!f)return;const h=this.findPieceLocation(i);if(this.removeFromCurrent(i),h!=null&&h.sectorId&&delete f.sectorId,!r){this.getFloating().pieces.push(f),this.notifyStateChange();return}if(this.isSectorCompleted(r)){this.notifyStateChange();return}const v=this.state.sectors[r];v&&(v.pieces.push(f),f.sectorId=r,this.notifyStateChange())}remove(i){const r=this.findPieceLocation(i);r&&(r.array.splice(r.index,1),this.notifyStateChange())}findPiece(i){var r;for(const f of Object.values(this.state.sectors)){const h=f.pieces.find(v=>v.id===i);if(h)return h}return(r=this.getFloating().pieces.find(f=>f.id===i))!=null?r:null}getFloating(){return this._floating||(this._floating={sectorId:"-floating-",pieces:[]}),this._floating}findPieceLocation(i){for(const h of Object.values(this.state.sectors)){const v=h,b=v.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:v.sectorId,array:v.pieces,index:b}}const r=this.getFloating(),f=r.pieces.findIndex(h=>h.id===i);return f>=0?{array:r.pieces,index:f}:null}removeFromCurrent(i){const r=this.findPieceLocation(i);r&&r.array.splice(r.index,1)}switchBlueprintView(){if(this.config.mode==="prep")return;const i=this.state.blueprintView==="primitives"?"quickstash":"primitives";this.state.blueprintView=i}isSubmitEnabled(){var i,r,f;if(this.config.mode!=="prep")return!0;const h=(i=this.config.minPiecesPerMacro)!=null?i:2,v=(r=this.config.maxCompositeSize)!=null?r:1/0,b=(f=this.config.requireAllSlots)!=null?f:!1,S=Object.values(this.state.sectors);let y=0;for(const m of S){const g=m.pieces.length;if(g>=h&&g<=v)y++;else if(g>0)return!1}return b?y===S.length:!0}snapshot(){return{perSector:Object.values(this.state.sectors).map(i=>{const r=i,f={sectorId:r.sectorId,pieceCount:r.pieces.length};return r.completedAt?Yh(zi({},f),{completedAt:r.completedAt}):f}),events:[],timeMs:iu()-this.t0,completed:!!this.state.endedAt}}}function jh(c,i,r,f=1e-9){const h=(r.y-i.y)*(c.x-i.x)-(r.x-i.x)*(c.y-i.y);if(Math.abs(h)>f)return!1;const v=Math.min(i.x,r.x)-f,b=Math.max(i.x,r.x)+f,S=Math.min(i.y,r.y)-f,y=Math.max(i.y,r.y)+f;return c.x>=v&&c.x<=b&&c.y>=S&&c.y<=y}function cu(c,i){for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[h],b=i[f];if(!(!v||!b)&&jh(c,v,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[f],b=i[h];if(!v||!b)continue;const S=v.x,y=v.y,m=b.x,g=b.y;y>c.y!=g>c.y&&c.x<(m-S)*(c.y-y)/(g-y+1e-12)+S&&(r=!r)}return r}function co(c,i,r){let f=1/0,h=-1/0;for(const v of c){const b=v.x*i+v.y*r;b<f&&(f=b),b>h&&(h=b)}return{min:f,max:h}}const mn=1e-6;function Qh(c,i){const r=[c,i];for(const f of r)for(let h=0;h<f.length;h++){const v=f[h],b=f[(h+1)%f.length];if(!v||!b)continue;const S=b.x-v.x,y=-(b.y-v.y),m=S,g=co(c,y,m),E=co(i,y,m);if(g.max<=E.min+mn||E.max<=g.min+mn)return!1}return!0}function Vh(c,i){const r=c.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let v=0;v<i.length;v++){const b=c[h],S=i[v],y=r[h],m=f[v];if(!(!b||!S||!y||!m)&&!(y.maxX<=m.minX+mn||m.maxX<=y.minX+mn||y.maxY<=m.minY+mn||m.maxY<=y.minY+mn)&&Qh(b,S))return!0}return!1}function Zh(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b,cx:(i+f)/2,cy:(r+h)/2}}function fo(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b}}function oo(c){return fo(c.shape)}function Lh(c,i){if(c.shape&&c.shape.length)return fo(c.shape);let r=1/0,f=1/0,h=-1/0,v=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=oo(m),E=y.offset.x+g.min.x,R=y.offset.y+g.min.y,w=y.offset.x+g.max.x,j=y.offset.y+g.max.y;E<r&&(r=E),R<f&&(f=R),w>h&&(h=w),j>v&&(v=j)}const b=Math.max(0,h-r),S=Math.max(0,v-f);return{min:{x:r,y:f},max:{x:h,y:v},width:b,height:S}}function It(c,i){return"parts"in c?Lh(c,i):oo(c)}const Me=k.layout.grid.stepPx;function vn(c,i,r){const f=r.x-i.min.x,h=r.y-i.min.y;return("shape"in c&&c.shape?c.shape:[]).map(v=>v.map(b=>({x:b.x+f,y:b.y+h})))}function ia(c,i){const r=i.min.x+i.width/2,f=i.min.y+i.height/2,h="shape"in c&&c.shape&&c.shape.length?c.shape:[[{x:i.min.x,y:i.min.y},{x:i.min.x+i.width,y:i.min.y},{x:i.min.x+i.width,y:i.min.y+i.height},{x:i.min.x,y:i.min.y+i.height}]],v=[];for(const b of h)for(const S of b)v.push({x:S.x-r,y:S.y-f});return v}function ca(c,i,r,f,h,v){const b=c+r.aabb.width/2,S=i+r.aabb.height/2,y=b-f.cx,m=S-f.cy,g=Math.hypot(y,m);if(g===0)return{x:c,y:i};const E=y/g,R=m/g;let w=-1/0,j=-1/0;for(const J of r.support){const I=J.x*E+J.y*R;I>w&&(w=I);const st=-(J.x*E+J.y*R);st>j&&(j=st)}if(h==="workspace"){const[J,I]=f.bands.workspace,st=v?0:J+j,dt=I-w,Z=Math.min(Math.max(g,st),dt);if(Math.abs(Z-g)<1e-6)return{x:c,y:i};const lt=f.cx+Z*E,V=f.cy+Z*R;return{x:lt-r.aabb.width/2,y:V-r.aabb.height/2}}else{const J=f.bands.silhouette[1]-w;if(g<=J)return{x:c,y:i};const I=f.cx+J*E,st=f.cy+J*R;return{x:I-r.aabb.width/2,y:st-r.aabb.height/2}}}function ro(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function Kh(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ro(i,b):b),S&&(i=i?ro(i,S):S)}return i||1}function so(c,i,r){if(!c||c.length===0)return[];const f=Zh(c),h=(f.min.x+f.max.x)/2,v=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Me)*Me,S=Math.round(r.cy/Me)*Me,y=b-i*h,m=S-i*v,g=Math.round(y/Me)*Me,E=Math.round(m/Me)*Me;return c.map(R=>R.map(w=>({x:i*w.x+g,y:i*w.y+E})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Me)*Me,h=Math.ceil(c.y/Me)*Me;for(let v=h;v<=i.y;v+=Me)for(let b=f;b<=i.x;b+=Me)r.push({x:b,y:v});return r}function Di(c,i,r,f){const[h,v]=i.bands[r],b=[];for(const S of c){const y=S.x-i.cx,m=S.y-i.cy,g=Math.hypot(y,m);if(!(g<h||g>v)){if(f){let E=Math.atan2(m,y);if(i.mode==="circle"?E<-Math.PI/2&&(E+=2*Math.PI):E<Math.PI&&(E+=2*Math.PI),E<f.start||E>=f.end)continue}b.push(S)}}return b}function kh(c,i,r=cu){const f=[];t:for(const h of c)for(const v of i)if(r(h,v)){f.push(h);continue t}return f}function Jh(c){const i={x:c.cx-c.innerR,y:c.cy-c.innerR-6},r={x:c.cx+c.innerR,y:c.cy+c.innerR+6},f=fu(i,r),h=[];for(const v of f){const b=v.x-c.cx,S=v.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(v)}return h}const ou=(c,i=Me)=>c*Math.SQRT2*i;function ho(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function $h(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ho(i,b):b),S&&(i=i?ho(i,S):S)}return i||1}function Ph(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:v,cy:b}}function yo(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:v,primitivesSlots:b,gridPx:S=k.layout.grid.stepPx,reqWorkspaceDiamAnchors:y=k.layout.constraints.workspaceDiamAnchors,reqQuickstashDiamAnchors:m=k.layout.constraints.quickstashDiamAnchors,reqPrimitiveDiamAnchors:g=k.layout.constraints.primitiveDiamAnchors}=c,E=((i=c.masks)!=null?i:[]).flat(),R=E.length?$h(E):0,w=R?2*S/R:1;let j=0;if(c.masks&&c.masks.length)for(const G of c.masks){if(!(G!=null&&G.length))continue;const $=Ph(G),{cx:Y,cy:d}=$;for(const z of G)for(const q of z){const C=(q.x-Y)*w,K=(q.y-d)*w,ft=Math.hypot(C,K);ft>j&&(j=ft)}}const J=f==="circle"?Math.PI*2:Math.PI,I=J/Math.max(1,r),st=J/Math.max(1,v),dt=J/Math.max(1,b),Z=Math.sin(I/2),lt=Math.sin(st/2),V=Math.sin(dt/2),ht=ou(y,S),P=ou(m,S),nt=ou(g,S),tt=P*(.5+1/(2*Math.max(1e-9,lt))),mt=nt*(.5+1/(2*Math.max(1e-9,V))),Ot=ht/(2*Math.max(1e-9,Z))-ht/2,L=Math.max(tt,mt,Ot),bt=ht,ct=h==="workspace"?2*j:0,Tt=bt+ct,D=L+Tt;return{innerR_min:L,dr_min:Tt,outerR_min:D,Tw_min:bt,Tp_min:ct,Rshape_px_max:j}}function Ih(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:v,D_ws_px:b}=c,S=f+h;if(i<r+S){const st=r+S;return{innerR:r,Tw:f,Tp:h,outerR:st}}const y=i,m=r,g=y-m,E=Math.max(0,g-S),R=1,w=1+v/Math.max(1e-9,b),j=E*(R/(R+w)),J=f+j,I=g-J;return{innerR:m,Tw:J,Tp:I,outerR:y}}function Wh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=yo(c);if(i==="circle"){const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h}}else{const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h/2}}}function Fh(c,i,r,f="circle",h="workspace",v){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,E=f==="semicircle"?c.h-y:g,R=Math.min(m,E)-y,w=yo({n:i,layoutMode:f,target:h,qsMaxSlots:v.qsMaxSlots,primitivesSlots:v.primitivesSlots,masks:(b=v.masks)!=null?b:[]});let j,J,I;if(h==="workspace"){const ht=ou(k.layout.constraints.workspaceDiamAnchors),P=Ih({outerRViewportBound:R,innerR_min:w.innerR_min,Tw_min:w.Tw_min,Tp_min:w.Tp_min,Rshape_px_max:w.Rshape_px_max,D_ws_px:ht});j=P.innerR,J=P.outerR,I={workspace:[P.innerR,P.innerR+P.Tw],silhouette:[P.innerR+P.Tw,P.outerR]}}else J=Math.max(R,w.outerR_min),j=Math.min(w.innerR_min,J),J<w.outerR_min&&(J=w.outerR_min,j=w.innerR_min),I={silhouette:[j,J],workspace:[j,J]};const st=f==="circle"?Math.PI*2:Math.PI,dt=f==="circle"?-Math.PI/2:Math.PI,Z=dt+st,lt=st/i,V=[];for(let ht=0;ht<i;ht++){const P=(S=r[ht])!=null?S:String(ht),nt=dt+ht*lt,tt=nt+lt,mt=(nt+tt)/2;V.push({id:P,index:ht,start:nt,end:tt,mid:mt})}return{mode:f,cx:m,cy:g,innerR:j,outerR:J,sectors:V,bands:I,sweepStart:dt,sweepEnd:Z}}function Ri(c,i,r,f,h,v){const b=v-h>Math.PI?1:0,S=c+r*Math.cos(h),y=i+r*Math.sin(h),m=c+f*Math.cos(h),g=i+f*Math.sin(h),E=c+f*Math.cos(v),R=i+f*Math.sin(v),w=c+r*Math.cos(v),j=i+r*Math.sin(v);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${E} ${R}`,`L ${w} ${j}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function mo(c,i,r,f){var h;const v=c-r.cx,b=i-r.cy,S=Math.hypot(v,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,v);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const E of r.sectors)if(g>=E.start&&g<E.end)return E.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function Ui(c,i,r,f=.85){const[h,v]=c.bands[r],b=(h+v)/2,S=v-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),E=c.cy+b*Math.sin(i.mid);return{cx:g,cy:E,w:y,h:m}}function t0(c){const i=[];for(let r=0;r<c.length;r++){const f=c[r],h=c[(r+1)%c.length];f&&h&&i.push(`M ${f.x} ${f.y} L ${h.x} ${h.y}`)}return i}function Bi(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),w=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),J=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:w},b:{x:j,y:J}})}return f}function fa(c,i,r,f,h){let v;try{v=f(c.blueprintId)}catch(w){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",w),[]}if(!(v!=null&&v.shape))return[];const b=v.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=It(v,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,E=b.map(w=>({x:w.x+m,y:w.y+g})),R=[];for(let w=0;w<E.length;w++){const j=E[w],J=E[(w+1)%E.length];if(!j||!J){R.push(!1);continue}const I=Bi(j,J,S);let st=!1;if(c.blueprintId.startsWith("comp:"))for(let dt=0;dt<v.shape.length;dt++){if(dt===i)continue;const Z=v.shape[dt];if(!Z)continue;const lt=Z.map(V=>({x:V.x+m,y:V.y+g}));for(let V=0;V<lt.length;V++){const ht=lt[V],P=lt[(V+1)%lt.length];if(!ht||!P)continue;const nt=Bi(ht,P,S);for(const tt of I)if(nt.some(mt=>tt.a.x===mt.a.x&&tt.a.y===mt.a.y&&tt.b.x===mt.b.x&&tt.b.y===mt.b.y||tt.a.x===mt.b.x&&tt.a.y===mt.b.y&&tt.b.x===mt.a.x&&tt.b.y===mt.a.y)){st=!0;break}if(st)break}if(st)break}if(!st&&k.game.hideTouchingBorders)for(const dt of r){if(dt.id===c.id)continue;const Z=f(dt.blueprintId);if(!(Z!=null&&Z.shape))continue;const lt=It(Z,h),V=dt.pos.x-lt.min.x,ht=dt.pos.y-lt.min.y;for(const P of Z.shape){const nt=P.map(tt=>({x:tt.x+V,y:tt.y+ht}));for(let tt=0;tt<nt.length;tt++){const mt=nt[tt],Ot=nt[(tt+1)%nt.length];if(!mt||!Ot)continue;const L=Bi(mt,Ot,S);for(const bt of I)if(L.some(ct=>bt.a.x===ct.a.x&&bt.a.y===ct.a.y&&bt.b.x===ct.b.x&&bt.b.y===ct.b.y||bt.a.x===ct.b.x&&bt.a.y===ct.b.y&&bt.b.x===ct.a.x&&bt.b.y===ct.a.y)){st=!0;break}if(st)break}if(st)break}if(st)break}R.push(st)}return R}function e0(c){return k.game.hideTouchingBorders}var l0=Object.defineProperty,n0=Object.defineProperties,a0=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,u0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,po=(c,i,r)=>i in c?l0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ru=(c,i)=>{for(var r in i||(i={}))u0.call(i,r)&&po(c,r,i[r]);if(vo)for(var r of vo(i))i0.call(i,r)&&po(c,r,i[r]);return c},su=(c,i)=>n0(c,a0(i));function Ni(c){return`M ${c.map(i=>`${i.x} ${i.y}`).join(" L ")} Z`}function c0(c){const{controller:i,layout:r,viewBox:f,width:h,height:v,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:E,draggingId:R,selectedPieceId:w,dragInvalid:j,lockedPieceId:J,svgRef:I,setPieceRef:st,onPiecePointerDown:dt,onBlueprintPointerDown:Z,onRootPointerDown:lt,onPointerMove:V,onPointerUp:ht,onCenterBadgePointerDown:P}=c,nt=f.w,tt=f.h,mt=i.state.blueprintView,Ot=mt==="primitives"?i.state.primitives:i.state.quickstash,L=i.state.cfg.maxQuickstashSlots,bt=i.state.primitives.length,ct=mt==="primitives"?Math.max(1,bt):Math.max(1,L),Tt=(r.mode==="circle"?Math.PI*2:Math.PI)/ct,D=r.mode==="circle"?-Math.PI/2:Math.PI,G=N=>D+(N+.5)*Tt,$=(N,at=k.layout.grid.stepPx)=>N*Math.SQRT2*at,Y=mt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=$(Y),z=d/(2*Math.max(1e-9,Math.sin(Tt/2))),q=b+k.size.centerBadge.marginPx+d/2,C=r.innerR-(b+k.size.centerBadge.marginPx),K=Math.min(Math.max(z,q),C),ft=(N,at,W)=>{const ut=It(N,xt=>i.getPrimitive(xt)),rt=ut.min.x+ut.width/2,X=ut.min.y+ut.height/2;return et.createElement("g",{key:N.id,transform:`translate(${at}, ${W}) scale(1) translate(${-rt}, ${-X})`},("shape"in N?N.shape:[]).map((xt,vt)=>et.createElement("path",{key:vt,d:Ni(xt),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>Z(Jt,N,{bx:at,by:W,cx:rt,cy:X})})))};return et.createElement("svg",{ref:I,width:h,height:v,viewBox:`0 0 ${nt} ${tt}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:V,onPointerUp:ht,onPointerDown:N=>{lt(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,at)=>{const W=!!i.state.sectors[N.id].completedAt,ut=at%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,rt=at%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,X=r.bands.silhouette,xt=r.bands.workspace;return et.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?et.createElement(et.Fragment,null,et.createElement("path",{d:Ri(r.cx,r.cy,X[0],X[1],N.start,N.end),fill:ut,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),et.createElement("path",{d:Ri(r.cx,r.cy,xt[0],xt[1],N.start,N.end),fill:W?k.color.completion.fill:rt,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):et.createElement("path",{d:Ri(r.cx,r.cy,X[0],X[1],N.start,N.end),fill:W?k.color.completion.fill:ut,stroke:W?k.color.completion.stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}))}),g.sort((N,at)=>R===N.id?1:R===at.id?-1:0).map(N=>{const at=i.getBlueprint(N.blueprintId),W=It(at,Gt=>i.getPrimitive(Gt)),ut=R===N.id,rt=N.sectorId&&i.isSectorCompleted(N.sectorId),X=J===N.id,xt=w===N.id,vt=ut&&j,Jt=N.x-W.min.x,ee=N.y-W.min.y;return et.createElement("g",{key:N.id,ref:st(N.id),transform:`translate(${Jt}, ${ee})`,style:{cursor:rt?"default":E?"pointer":"grab"},pointerEvents:E&&ut?"none":"auto"},("shape"in at?at.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),et.createElement(et.Fragment,{key:Nt},et.createElement("path",{d:Ni(Gt),fill:X||vt?k.color.piece.invalidFill:ut?k.color.piece.draggingFill:k.color.piece.validFill,opacity:X||vt?k.opacity.piece.invalid:ut?k.opacity.piece.dragging:rt?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:Wt=>dt(Wt,N)}),(()=>{const Wt=g.filter(Q=>Q.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),Kt=Wt.map(Q=>su(ru({},Q),{pos:{x:Q.x,y:Q.y}})),$t=fa(Zt,Nt,Kt,Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)),Lt=R?Wt.find(Q=>Q.id===R):null;let ae;if(N.blueprintId.startsWith("comp:")){const Q=fa(Zt,Nt,[],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt));ae=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt)):new Array($t.length).fill(!1)).map((yt,Ut)=>yt&&!Q[Ut])}else ae=Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)):new Array($t.length).fill(!1);return t0(Gt).map((Q,yt)=>{const Ut=ae[yt]||!1;let ot;return ut&&N.blueprintId.startsWith("comp:")?ot=fa(Zt,Nt,[],At=>i.getBlueprint(At),At=>i.getPrimitive(At))[yt]||!1:ot=ut?!1:($t[yt]||!1)&&!Ut,et.createElement("path",{key:`stroke-${Nt}-${yt}`,d:Q,fill:"none",stroke:ot?"none":X||vt?k.color.piece.invalidStroke:xt||ut?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ot?0:xt||ut?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:At=>dt(At,N)})})})()))))}),r.sectors.map(N=>{var at;const W=(at=y.get(N.id))!=null?at:[];return W.length?et.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((ut,rt)=>et.createElement("path",{key:rt,d:Ni(ut),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:at,invalid:W})=>{const ut=N==="inner-ring";return et.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((rt,X)=>et.createElement("circle",{key:`inv-${X}`,cx:rt.x,cy:rt.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),at.map((rt,X)=>et.createElement("circle",{key:`val-${X}`,cx:rt.x,cy:rt.y,r:ut?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:ut?k.color.anchors.invalid:k.color.anchors.valid,opacity:ut?k.opacity.anchors.invalid:k.opacity.anchors.valid})))}),(()=>{const N=i.state.cfg.mode==="prep",at=N?i.isSubmitEnabled():!0,W=!R&&(!N||at);return et.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?P:void 0},et.createElement("circle",{r:b,fill:at?k.color.blueprint.badgeFill:"#ccc",opacity:at?1:.5}),et.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:at?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Ot.map((N,at)=>{const W=G(at),ut=r.cx+K*Math.cos(W),rt=r.cy+K*Math.sin(W);return ft(N,ut,rt)}),i.state.endedAt&&et.createElement("g",{pointerEvents:"none"},et.createElement("circle",{cx:r.cx,cy:r.cy,r:r.outerR-3,fill:"none",stroke:k.color.piece.allGreenStroke,strokeWidth:k.size.stroke.allGreenStrokePx,opacity:0},et.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),et.createElement("animate",{attributeName:"opacity",from:"1",to:"0",begin:"560ms",dur:"520ms",fill:"freeze"}))))}function f0(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const v of c)for(const b of v)b.x<i&&(i=b.x),b.y<r&&(r=b.y),b.x>f&&(f=b.x),b.y>h&&(h=b.y);return{minX:i,minY:r,maxX:f,maxY:h}}function o0(c,i,r,f){const h=k.layout.grid.stepPx,v=Math.floor((c-h/2)/h)*h+h/2,b=Math.floor((i-h/2)/h)*h+h/2,S=[];for(let y=b;y<=f;y+=h)for(let m=v;m<=r;m+=h)S.push({x:m,y});return S}function du(c){if(!c.length)return new Set;const{minX:i,minY:r,maxX:f,maxY:h}=f0(c),v=o0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of v)for(const m of c)if(cu(y,m)){S.add(b(y));continue t}return S}function r0(c,i){if(!c.length)return!1;const r=du(c);if(r.size===0)return!1;const f=du(i);if(f.size===0)return!1;for(const h of r)if(!f.has(h))return!1;return!0}function s0(c){const i=[];for(const r of c){const[f,h]=r.split(",");i.push({x:Number(f),y:Number(h)})}return i}function go(c){if(c.size===0)return c;const i=s0(c);let r=1/0,f=1/0;for(const v of i)v.x<r&&(r=v.x),v.y<f&&(f=v.y);const h=new Set;for(const v of i)h.add(`${v.x-r},${v.y-f}`);return h}function d0(c,i){if(c.size!==i.size)return!1;for(const r of c)if(!i.has(r))return!1;return!0}function h0(c,i){if(!c.length)return!1;const r=du(c),f=du(i);if(r.size===0||f.size===0)return!1;const h=go(r),v=go(f);return d0(h,v)}function bo(c,i,r){return{x:c-r.bx+r.cx,y:i-r.by+r.cy}}function y0(c,i){return!c||c.length===0?[]:c.map(r=>r.map(f=>({x:i*f.x,y:i*f.y})))}function m0(c){const i=et.useMemo(()=>{const S=[];for(const m of Object.values(c.state.sectors))for(const g of m.pieces)S.push({id:g.id,blueprintId:g.blueprintId,x:g.pos.x,y:g.pos.y,sectorId:m.sectorId});const y=c._floating;if(y!=null&&y.pieces)for(const m of y.pieces)S.push({id:m.id,blueprintId:m.blueprintId,x:m.pos.x,y:m.pos.y});return S},[c.state.sectors,c._floating,c.updateCount]),r=et.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=et.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const E=c.getBlueprint(g.blueprintId),R=It(E,c.getPrimitive);y.push(...vn(E,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=et.useRef(new Map),v=et.useCallback(S=>{const y=c.state.sectors[S];return y?y.pieces.slice().sort((m,g)=>m.id<g.id?-1:1).map(m=>`${m.id}@${m.pos.x},${m.pos.y}`).join("|"):""},[c.state.sectors]),b=et.useCallback(S=>{const y=v(S),m=h.current.get(S);if(m&&m.sig===y)return m.polys;const g=f(S);return h.current.set(S,{sig:y,polys:g}),g},[v,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class v0{constructor(i){this.config=i}referenceVertex(i){var r,f;return(f=("shape"in i&&(r=i.shape)!=null&&r[0]?i.shape[0]:[{x:0,y:0}])[0])!=null?f:{x:0,y:0}}nearestNodeSnap(i,r,f,h){if(!h.length)return{tl:i,node:null,dist:1/0,accepted:!1};const v=It(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-v.min.x),y:i.y+(b.y-v.min.y)};let y=null,m=1/0;for(const R of h){const w=R.x-S.x,j=R.y-S.y,J=w*w+j*j;J<m&&(m=J,y=R)}const g=Math.sqrt(m),E=g<=this.config.snapRadiusPx;return{tl:y&&E?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:E}}snapTopLeftToNodes(i,r,f,h){const{tl:v}=this.nearestNodeSnap(i,r,f,h);return v}generateWorkspaceNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},v={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,v),S=Di(b,i,"silhouette",r);return kh(S,f,cu)}generateSilhouetteBandNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"silhouette",r)}insideAnySilhouette(i,r){for(const f of r)if(cu(i,f))return!0;return!1}polyFullyInside(i,r,f){var h;if(!i.length)return!0;if(!r.length)return!1;const v=(h=f!=null?f:this.config.densitySampleStepPx)!=null?h:Math.max(1,Math.round(k.layout.grid.stepPx/3));for(const b of i)if(!(b.length<2))for(let S=0;S<b.length;S++){const y=b[S],m=b[(S+1)%b.length];if(!y||!m)continue;const g=m.x-y.x,E=m.y-y.y,R=Math.hypot(g,E),w=Math.max(1,Math.ceil(R/v));for(let j=0;j<=w;j++){const J=j/w,I={x:y.x+J*g,y:y.y+J*E};if(!this.insideAnySilhouette(I,r))return!1}}return!0}}function p0(){return new v0({stepPx:k.layout.grid.stepPx,snapRadiusPx:k.game.snapRadiusPx,densitySampleStepPx:Math.max(1,Math.round(k.layout.grid.stepPx/3))})}const oa=p0();function Hi(c,i,r,f){const h=oa.nearestNodeSnap(c,i,r,f);return{tl:h.tl,node:h.node,dist:h.dist}}function g0(c,i,r){return oa.polyFullyInside(c,i,r)}function b0(c,i){return oa.generateWorkspaceNodes(c,i)}function S0(c,i,r){return oa.generateSilhouetteNodes(c,i,r)}function x0(c,i){return oa.generateSilhouetteBandNodes(c,i)}function M0(c,i,r){const f=c.state.cfg;return{anchorDots:et.useMemo(()=>{var h,v;const b=[];b.push({sectorId:"inner-ring",valid:Jh(i),invalid:[]});for(const S of i.sectors)if(f.target==="workspace")b.push({sectorId:S.id,valid:b0(i,S),invalid:[]});else{const y=(v=(h=c.state.cfg.sectors.find(I=>I.id===S.id))==null?void 0:h.silhouette.mask)!=null?v:[];if(!y||y.length===0)continue;const m=Ui(i,S,"silhouette",1),g=so(y,r,{cx:m.cx,cy:m.cy}),E=x0(i,S),R=S0(i,S,g),w=I=>`${I.x},${I.y}`,j=new Set(R.map(w)),J=E.filter(I=>!j.has(w(I)));b.push({sectorId:S.id,valid:R,invalid:J})}return b},[f.target,c.state.sectors,i,r])}}function A0(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),w=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),J=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:w},b:{x:j,y:J}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const v=It(h,r),b=c.pos.x-v.min.x,S=c.pos.y-v.min.y,y=[];for(const m of h.shape){const g=m.map(E=>({x:E.x+b,y:E.y+S}));for(let E=0;E<g.length;E++){const R=g[E],w=g[(E+1)%g.length];!R||!w||y.push(...A0(R,w,f))}}return y}function xo(c,i,r,f){if(i.length===0)return{isAttached:!0,attachedPieceIds:[],sharedEdgeLength:0};const h=k.layout.grid.stepPx,v=So(c,r,f,h);if(v.length===0)return{isAttached:!1,attachedPieceIds:[],sharedEdgeLength:0};let b=0;const S=[];for(const y of i){const m=So(y,r,f,h),g=v.filter(E=>m.some(R=>E.a.x===R.a.x&&E.a.y===R.a.y&&E.b.x===R.b.x&&E.b.y===R.b.y||E.a.x===R.b.x&&E.a.y===R.b.y&&E.b.x===R.a.x&&E.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function T0(c,i,r,f){if(i.length<=2)return!1;const h=i.filter(m=>m.id!==c.id);if(h.length<=1)return!1;const v=new Map;for(const m of h)v.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const E=h[m],R=h[g];!E||!R||xo(E,[R],r,f).isAttached&&(v.get(E.id).push(R.id),v.get(R.id).push(E.id))}const b=new Set,S=h[0];if(!S)return!1;function y(m){if(b.has(m))return;b.add(m);const g=v.get(m)||[];for(const E of g)y(E)}return y(S.id),b.size!==h.length}var E0=Object.defineProperty,O0=Object.defineProperties,_0=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,z0=Object.prototype.hasOwnProperty,D0=Object.prototype.propertyIsEnumerable,Ao=(c,i,r)=>i in c?E0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,R0=(c,i)=>{for(var r in i||(i={}))z0.call(i,r)&&Ao(c,r,i[r]);if(Mo)for(var r of Mo(i))D0.call(i,r)&&Ao(c,r,i[r]);return c},U0=(c,i)=>O0(c,_0(i));function B0(c,i,r,f,h,v,b,S,y,m,g){const E=c.state.cfg,R=E.input==="click",w=et.useRef(null),j=et.useRef(null),[J,I]=et.useState(null),st=et.useRef(new Map),[dt,Z]=et.useState(null);et.useEffect(()=>{J===null&&(j.current=null)},[J]);const lt=Y=>d=>{const z=st.current;d?z.set(Y,d):z.delete(Y)},V=(Y,d)=>{const z=w.current,q=z.createSVGPoint();q.x=Y,q.y=d;const C=z.getScreenCTM();if(!C)return{x:0,y:0};const K=q.matrixTransform(C.inverse());return{x:K.x,y:K.y}},ht=()=>{if(!j.current)return;const Y=j.current;Y.raf==null&&(Y.raf=requestAnimationFrame(()=>{Y.raf=null;const d=st.current.get(Y.id);d&&d.setAttribute("transform",`translate(${Y.tlx-Y.minx}, ${Y.tly-Y.miny})`)}))},P=(Y,d)=>mo(Y,d,i,E.target),nt=k.layout.grid.stepPx,tt=Y=>{if(!Y)return null;const d=Math.round(Y.x/nt),z=Math.round(Y.y/nt);return`${d},${z}`},mt=Y=>({x:Math.round(Y.x/nt)*nt,y:Math.round(Y.y/nt)*nt}),Ot=(Y,d)=>{if(!j.current)return;const z=j.current,q=mt(Y),C=tt(q);g!=null&&g.recordMouseMove&&(C!==z.pointerAnchorId||d!==z.pointerAnchorSectorId)&&g.recordMouseMove(q.x,q.y,d),z.pointerAnchor=q,z.pointerAnchorId=C,z.pointerAnchorSectorId=d},L=(Y,d,z)=>{if(!j.current)return;const q=j.current;q.snapAnchor=Y,q.snapAnchorId=tt(Y),q.snapAnchorSectorId=d,q.snapAnchorDist=Y&&z!==void 0?z:null},bt=(Y,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(Y,d,z)},ct=Y=>{const d=c.findPiece(Y);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=It(z,c.getPrimitive);return vn(z,q,d.pos).map(C=>C.map(K=>[K.x,K.y]))},Tt=(Y,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&J)return;if(E.mode==="prep"&&d.sectorId){const ut=c.getPiecesInSector(d.sectorId),rt=c.findPiece(d.id);if(rt&&T0(rt,ut,X=>c.getBlueprint(X),X=>c.getPrimitive(X))){Z(d.id),setTimeout(()=>Z(null),500);return}}if(R){Y.stopPropagation();const ut=c.getBlueprint(d.blueprintId),rt=It(ut,Gt=>c.getPrimitive(Gt)),X=ia(ut,rt),{x:xt,y:vt}=V(Y.clientX,Y.clientY),Jt=mt({x:xt,y:vt}),ee=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,ee),g){const Gt="kind"in ut?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},ct(d.id),d.sectorId)}j.current={id:d.id,dx:xt-d.x,dy:vt-d.y,tlx:d.x,tly:d.y,aabb:{width:rt.width,height:rt.height},minx:rt.min.x,miny:rt.min.y,support:X,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:Jt,pointerAnchorId:tt(Jt),pointerAnchorSectorId:ee,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),I(d.id),y();return}(z=w.current)==null||z.setPointerCapture(Y.pointerId);const q=c.getBlueprint(d.blueprintId),C=It(q,ut=>c.getPrimitive(ut)),K=ia(q,C),{x:ft,y:N}=V(Y.clientX,Y.clientY),at=mt({x:ft,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(at.x,at.y,W),g){const ut="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,ut,"sector",{x:d.x,y:d.y},ct(d.id),d.sectorId)}j.current={id:d.id,dx:ft-d.x,dy:N-d.y,tlx:d.x,tly:d.y,aabb:{width:C.width,height:C.height},minx:C.min.x,miny:C.min.y,support:K,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:at,pointerAnchorId:tt(at),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),I(d.id),y()},D=Y=>{var d,z,q,C,K,ft,N,at;const{x:W,y:ut}=V(Y.clientX,Y.clientY),rt=mt({x:W,y:ut}),X=Math.hypot(W-i.cx,ut-i.cy),xt=X<i.innerR?void 0:(d=P(W,ut))!=null?d:void 0;if(!j.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(rt.x,rt.y,xt);return}const vt=j.current,Jt=W-vt.dx,ee=ut-vt.dy;Ot({x:W,y:ut},xt);let Gt=ca(Jt,ee,{aabb:vt.aabb,support:vt.support},i,c.state.cfg.target,X<i.innerR);const Nt=Gt.x+vt.aabb.width/2,Wt=Gt.y+vt.aabb.height/2,Zt=Math.hypot(Nt-i.cx,Wt-i.cy)<i.innerR,Kt=Zt?null:P(Nt,Wt);let $t=null,Lt=null,ae=Kt!=null?Kt:void 0,Q=!1,yt=!1;if(Zt){const Ut=h.find(ot=>ot.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ot=f(vt.id);if(ot){const At=c.getBlueprint(ot.blueprintId),Mt=Hi(Gt,At,c.getPrimitive,Ut.valid);Gt=Mt.tl,$t=Mt.node,Lt=Mt.dist,ae=void 0}}vt.validSnap=!1}else if(Kt){const Ut=b(Kt),ot=h.find(Mt=>Mt.sectorId===Kt),At=E.target==="workspace"&&E.mode!=="prep"?(z=ot==null?void 0:ot.valid)!=null?z:[]:[...(q=ot==null?void 0:ot.valid)!=null?q:[],...(C=ot==null?void 0:ot.invalid)!=null?C:[]];if(At.length){const Mt=f(vt.id);if(Mt){const qe=c.getBlueprint(Mt.blueprintId),ze=Hi(Gt,qe,c.getPrimitive,At);if(Gt=ze.tl,$t=ze.node,Lt=ze.dist,ae=Kt,Ut)vt.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,nl=f(vt.id);let Te=!0;if(nl){const ce=c.getBlueprint(nl.blueprintId),dl=It(ce,c.getPrimitive),De=vn(ce,dl,Gt),Yi=r.filter(re=>re.id!==vt.id&&P(re.x+It(c.getBlueprint(re.blueprintId),c.getPrimitive).width/2,re.y+It(c.getBlueprint(re.blueprintId),c.getPrimitive).height/2)===Kt);for(const re of Yi){const al=c.getBlueprint(re.blueprintId),ul=It(al,c.getPrimitive),Ee=vn(al,ul,{x:re.x,y:re.y});if(Vh(De,Ee)){Te=!1;break}}if(E.target==="workspace"){if(E.mode==="prep"){const re=c.getPiecesInSector(Kt),al=re.filter(bn=>bn.id!==vt.id),ul=al.length===0,Ee=c.findPiece(vt.id),zl=Ee==null?void 0:Ee.sectorId,ra=(K=c.state.cfg.maxCompositeSize)!=null?K:0,yu=ra>0,sa=re.length-(zl===Kt?1:0),il=yu&&sa+1>ra;if(ul)vt.validSnap=Te&&!il,yt=il;else if(Ee){const bn=U0(R0({},Ee),{pos:{x:Gt.x,y:Gt.y}}),Gi=xo(bn,al,Ve=>c.getBlueprint(Ve),Ve=>c.getPrimitive(Ve));vt.validSnap=Te&&Gi.isAttached&&!il,yt=il}else vt.validSnap=Te&&!il,yt=il}else vt.validSnap=Te,yt=!1;Q=!Te}else{const re=zl=>`${zl.x},${zl.y}`,al=new Set(((ft=ot==null?void 0:ot.valid)!=null?ft:[]).map(re)),ul=!!ze.node&&al.has(re(ze.node))&&ze.dist<=(gn!=null?gn:0);let Ee=!1;if(ul){const zl=(N=v.get(Kt))!=null?N:[];Ee=g0(De,zl)}vt.validSnap=ul&&Ee&&Te,Q=!Te}}}}}}else vt.validSnap=c.state.cfg.target==="workspace",$t=null,Lt=null,ae=void 0,yt=!1;vt.overlaps=Q,vt.maxExceeded=yt,L($t,ae,Lt!=null?Lt:void 0),vt.tlx=Gt.x,vt.tly=Gt.y,vt.prevValidSnap!==vt.validSnap&&(vt.prevValidSnap=(at=vt.validSnap)!=null?at:!1,y()),ht()},G=()=>{var Y,d,z,q,C,K,ft,N,at,W,ut,rt;if(!j.current||R)return;const X=j.current;if(X.validSnap===!1){const Wt=c.findPiece(X.id),Zt=c.state.cfg,Kt=X.tlx+X.aabb.width/2,$t=X.tly+X.aabb.height/2,Lt=P(Kt,$t);let ae="outside_bounds";if(X.maxExceeded?ae="no_valid_anchor":X.overlaps?ae="overlapping":Lt&&(ae="no_valid_anchor"),bt({x:Kt,y:$t},"invalid_placement",{invalidPlacement:{reason:ae,attemptedSectorId:Lt!=null?Lt:void 0}}),Zt.mode==="prep"&&X.originalPos)c.move(X.id,{x:X.originalPos.x,y:X.originalPos.y}),g&&g.recordPlacedown("placed",X.originalPos.sectorId,{x:X.originalPos.x,y:X.originalPos.y},ct(X.id),(Y=X.snapAnchorId)!=null?Y:void 0,!1,(d=X.overlaps)!=null?d:!1);else{const Q=Wt==null?void 0:Wt.sectorId;c.remove(X.id),Q&&S(Q),g&&g.recordPlacedown("deleted",Q,void 0,void 0,(z=X.snapAnchorId)!=null?z:void 0,!1,(q=X.overlaps)!=null?q:!1)}j.current=null,I(null),y();return}j.current=null,X.raf&&(cancelAnimationFrame(X.raf),X.raf=null);const xt={x:X.tlx,y:X.tly},vt=xt.x+X.aabb.width/2,Jt=xt.y+X.aabb.height/2;if(Math.hypot(vt-i.cx,Jt-i.cy)<i.innerR){const Wt=c.findPiece(X.id),Zt=Wt==null?void 0:Wt.sectorId;c.remove(X.id),Zt&&S(Zt),g&&g.recordPlacedown("deleted",Zt,void 0,void 0,(C=X.snapAnchorId)!=null?C:void 0,!1,(K=X.overlaps)!=null?K:!1),I(null),y();return}const ee=P(vt,Jt);if(ee&&b(ee)){bt({x:vt,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ee}}),X.originalPos?(c.move(X.id,{x:X.originalPos.x,y:X.originalPos.y}),X.originalPos.sectorId&&c.drop(X.id,X.originalPos.sectorId),g&&g.recordPlacedown("placed",X.originalPos.sectorId,{x:X.originalPos.x,y:X.originalPos.y},ct(X.id),(ft=X.snapAnchorId)!=null?ft:void 0,!1,(N=X.overlaps)!=null?N:!1)):(c.remove(X.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(at=X.snapAnchorId)!=null?at:void 0,!1,(W=X.overlaps)!=null?W:!1)),I(null),y();return}c.move(X.id,xt),c.drop(X.id,ee);const Gt=ee?S(ee):!1,Nt=X.validSnap===void 0?!0:X.validSnap;g&&g.recordPlacedown("placed",ee,xt,ct(X.id),(ut=X.snapAnchorId)!=null?ut:void 0,Nt,(rt=X.overlaps)!=null?rt:!1,Gt),I(null),X.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},$=(Y,d,z)=>{var q,C,K,ft,N,at,W,ut;if(R&&J)return;Y.stopPropagation();const{x:rt,y:X}=V(Y.clientX,Y.clientY),xt=It(d,c.getPrimitive),vt=ia(d,xt);if(R){const $t=bo(rt,X,z),Lt={x:rt-($t.x-xt.min.x),y:X-($t.y-xt.min.y)},ae=Math.hypot(rt-i.cx,X-i.cy)<i.innerR,Q=ca(Lt.x,Lt.y,{aabb:xt,support:vt},i,c.state.cfg.target,ae),yt=c.spawnFromBlueprint(d,Q),Ut=mt({x:rt,y:X}),ot=(q=P(rt,X))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ot),g){const ce="kind"in d?"primitive":"composite";g.recordPickup(yt,d.id,ce,"blueprint",Q,ct(yt),void 0)}const At=Q;let Mt=At,qe=null;const ze=At.x+xt.width/2,gn=At.y+xt.height/2,nl=P(ze,gn);if(nl){const ce=h.find(De=>De.sectorId===nl),dl=c.state.cfg.target==="workspace"?(C=ce==null?void 0:ce.valid)!=null?C:[]:[...(K=ce==null?void 0:ce.valid)!=null?K:[],...(ft=ce==null?void 0:ce.invalid)!=null?ft:[]];if(dl.length){const De=Hi(At,d,c.getPrimitive,dl);Mt=De.tl,qe={node:De.node,dist:De.dist}}}c.move(yt,Mt),j.current={id:yt,dx:rt-Mt.x,dy:X-Mt.y,tlx:Mt.x,tly:Mt.y,aabb:xt,minx:xt.min.x,miny:xt.min.y,support:vt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:tt(Ut),pointerAnchorSectorId:ot,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Ot({x:rt,y:X},ot);const Te=(N=P(Mt.x+xt.width/2,Mt.y+xt.height/2))!=null?N:void 0;L((at=qe==null?void 0:qe.node)!=null?at:null,Te,qe==null?void 0:qe.dist),I(yt),y(),ht();return}(W=w.current)==null||W.setPointerCapture(Y.pointerId);const Jt=bo(rt,X,z),ee={x:rt-(Jt.x-xt.min.x),y:X-(Jt.y-xt.min.y)},Gt=Math.hypot(rt-i.cx,X-i.cy)<i.innerR,Nt=ca(ee.x,ee.y,{aabb:xt,support:vt},i,c.state.cfg.target,Gt),Wt=c.spawnFromBlueprint(d,Nt),Zt=mt({x:rt,y:X}),Kt=(ut=P(rt,X))!=null?ut:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,Kt),g){const $t="kind"in d?"primitive":"composite";g.recordPickup(Wt,d.id,$t,"blueprint",Nt,ct(Wt),void 0)}j.current={id:Wt,dx:rt-Nt.x,dy:X-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:xt,minx:xt.min.x,miny:xt.min.y,support:vt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:tt(Zt),pointerAnchorSectorId:Kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Ot({x:rt,y:X},Kt),L(null,void 0),I(Wt),y(),ht()};return{draggingId:J,dragInvalid:!!(j.current&&j.current.validSnap===!1),lockedPieceId:dt,svgRef:w,onPiecePointerDown:Tt,onBlueprintPointerDown:$,onPointerMove:D,onPointerUp:G,setPieceRef:lt,setDraggingId:I,dragRef:j}}function N0(c,i,r,f,h,v,b,S,y,m,g,E,R){const w=c.state.cfg,j=(ht,P)=>mo(ht,P,i,w.target),J=ht=>{const P=c.findPiece(ht);if(!P)return[];const nt=c.getBlueprint(P.blueprintId);if(!nt)return[];const tt=It(nt,c.getPrimitive);return vn(nt,tt,P.pos).map(mt=>mt.map(Ot=>[Ot.x,Ot.y]))},I=()=>{var ht,P,nt,tt,mt,Ot;const L=b.current;return{anchorId:(P=(ht=L==null?void 0:L.snapAnchorId)!=null?ht:L==null?void 0:L.pointerAnchorId)!=null?P:void 0,wasValid:(L==null?void 0:L.validSnap)!==!1,wasOverlapping:(nt=L==null?void 0:L.overlaps)!=null?nt:!1,anchorX:(tt=L==null?void 0:L.pointerAnchor)==null?void 0:tt.x,anchorY:(mt=L==null?void 0:L.pointerAnchor)==null?void 0:mt.y,sectorId:(Ot=L==null?void 0:L.snapAnchorSectorId)!=null?Ot:L==null?void 0:L.pointerAnchorSectorId}},st=(ht,P,nt)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(ht,P,nt)},[dt,Z]=et.useState(null),[lt,V]=et.useState(null);return{pendingBpId:dt,selectedPieceId:lt,onRootPointerDown:ht=>{var P,nt;const{x:tt,y:mt}=g(ht.clientX,ht.clientY);if(f){const Ot=j(tt,mt);if(h&&b.current){const L=b.current,bt=L.tlx+L.aabb.width/2,ct=L.tly+L.aabb.height/2;if(S(tt,mt)){const $=c.findPiece(L.id),Y=$==null?void 0:$.sectorId,d=I();c.remove(L.id),Y&&m(Y),R&&R.recordPlacedown("deleted",Y,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),V(null),Z(null),E();return}if(Math.hypot(bt-i.cx,ct-i.cy)<i.innerR){const $=c.findPiece(L.id),Y=$==null?void 0:$.sectorId,d=I();c.remove(L.id),Y&&m(Y),R&&R.recordPlacedown("deleted",Y,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),V(null),Z(null),E();return}const Tt=j(bt,ct);if(!Tt){st({x:bt,y:ct},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),E();return}if(y(Tt)){st({x:bt,y:ct},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:Tt}}),E();return}if(L.validSnap===!1){const $=I().wasOverlapping?"overlapping":"no_valid_anchor";st({x:bt,y:ct},"invalid_placement",{invalidPlacement:{reason:$,attemptedSectorId:Tt}}),E();return}c.move(L.id,{x:L.tlx,y:L.tly}),c.drop(L.id,Tt);const D=I(),G=m(Tt);R&&R.recordPlacedown("placed",Tt,{x:L.tlx,y:L.tly},J(L.id),D.anchorId,D.wasValid,D.wasOverlapping,G),v(null),V(null),Z(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}if(lt){if(S(tt,mt)){const L=c.findPiece(lt),bt=L==null?void 0:L.sectorId;c.remove(lt),bt&&m(bt),R&&R.recordPlacedown("deleted"),V(null),E();return}if(Ot&&y(Ot)){V(null),E();return}if(Ot){const L=r.find(bt=>bt.id===lt);if(V(null),L){const bt=c.getBlueprint(L.blueprintId),ct=It(bt,c.getPrimitive),Tt=ia(bt,ct),D={x:tt-ct.width/2,y:mt-ct.height/2},G=ca(D.x,D.y,{aabb:{width:ct.width,height:ct.height},support:Tt},i,c.state.cfg.target,!1),$=(P=c.state.cfg.maxCompositeSize)!=null?P:0;if(c.state.cfg.mode==="prep"&&$>0&&c.getPiecesInSector(Ot).length-(L.sectorId===Ot?1:0)+1>$){E();return}c.move(L.id,{x:G.x,y:G.y}),c.drop(L.id,Ot),m(Ot),E()}return}V(null),E();return}if(dt){const L=j(tt,mt);if(S(tt,mt)||!L||y(L)){Z(null),E();return}const bt=c.getBlueprint(dt),ct=It(bt,c.getPrimitive),Tt=ia(bt,ct),D={x:tt-ct.width/2,y:mt-ct.height/2},G=ca(D.x,D.y,{aabb:{width:ct.width,height:ct.height},support:Tt},i,c.state.cfg.target,!1),$=c.spawnFromBlueprint(bt,G),Y=(nt=c.state.cfg.maxCompositeSize)!=null?nt:0;if(c.state.cfg.mode==="prep"&&Y>0&&c.getPiecesInSector(L).length+1>Y){c.remove($),Z(null),E();return}c.drop($,L),Z(null),m(L),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}}},clearSelection:()=>{V(null),Z(null)},setPendingBp:Z,setSelectedPiece:V}}const me=[];for(let c=0;c<256;++c)me.push((c+256).toString(16).slice(1));function H0(c,i=0){return(me[c[i+0]]+me[c[i+1]]+me[c[i+2]]+me[c[i+3]]+"-"+me[c[i+4]]+me[c[i+5]]+"-"+me[c[i+6]]+me[c[i+7]]+"-"+me[c[i+8]]+me[c[i+9]]+"-"+me[c[i+10]]+me[c[i+11]]+me[c[i+12]]+me[c[i+13]]+me[c[i+14]]+me[c[i+15]]).toLowerCase()}let qi;const q0=new Uint8Array(16);function C0(){if(!qi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qi=crypto.getRandomValues.bind(crypto)}return qi(q0)}var To={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,v,b;if(To.randomUUID&&!i&&!c)return To.randomUUID();c=c||{};const f=(b=(v=c.random)!=null?v:(h=c.rng)==null?void 0:h.call(c))!=null?b:C0();if(f.length<16)throw new Error("Random bytes length must be >= 16");return f[6]=f[6]&15|64,f[8]=f[8]&63|128,H0(f)}var Y0=Object.defineProperty,Eo=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,X0=Object.prototype.propertyIsEnumerable,Oo=(c,i,r)=>i in c?Y0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,_o=(c,i)=>{for(var r in i||(i={}))G0.call(i,r)&&Oo(c,r,i[r]);if(Eo)for(var r of Eo(i))X0.call(i,r)&&Oo(c,r,i[r]);return c};class w0{constructor(i,r,f,h){this.gridStep=k.layout.grid.stepPx,this.interactionIndex=0,this.currentPickup=null,this.previousSnapshotId=void 0,this.clickEvents=[],this.mouseTracking=[],this.interactions=[],this.completionTimes=[],this.createdMacros=[],this.controller=i,this.callbacks=r,this.trialId=f||hu(),this.gameId=h||hu(),this.trialStartTime=Date.now(),this.controller.setTrackingCallbacks({onSectorCompleted:v=>this.recordSectorCompletion(v)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,v,b,S){const y=this.toAnchorPoint(v),m=this.toAnchorVertices(b);this.currentPickup={pieceId:i,blueprintId:r,blueprintType:f,timestamp:Date.now(),source:h,sectorId:S,position:y,vertices:m}}recordPlacedown(i,r,f,h,v,b,S,y){if(!this.currentPickup){console.warn("[InteractionTracker] recordPlacedown called without pickup");return}const m=this.determineInteractionType(this.currentPickup.source,i),g=Date.now(),E=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),w=f?this.toAnchorPoint(f):void 0,j=h?this.toAnchorVertices(h):void 0,J={interactionId:hu(),trialId:this.trialId,gameId:this.gameId,interactionIndex:this.interactionIndex++,interactionType:m,pieceId:this.currentPickup.pieceId,blueprintId:this.currentPickup.blueprintId,blueprintType:this.currentPickup.blueprintType,pickupTimestamp:this.currentPickup.timestamp,pickupSource:this.currentPickup.source,pickupSectorId:this.currentPickup.sectorId,pickupPosition:this.currentPickup.position,pickupVertices:this.currentPickup.vertices,placedownTimestamp:g,placedownOutcome:i,wasValid:i==="placed"&&b===!0,wasOverlapping:i==="placed"&&S===!0,holdDuration:E,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(J.placedownSectorId=r),i==="placed"&&w&&(J.placedownPosition=w),i==="placed"&&j&&(J.placedownVertices=j),v&&(J.placedownAnchorId=v),this.previousSnapshotId!==void 0&&(J.preSnapshotId=this.previousSnapshotId),this.interactions.push(J),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(J),this.currentPickup=null,this.clickEvents=[],this.mouseTracking=[]}recordClickEvent(i,r,f){const h=this.toAnchorPoint(i);this.clickEvents.push(_o({timestamp:Date.now(),location:h,clickType:r},f))}recordMouseMove(i,r,f){const h=this.currentPickup?"while_holding":"before_pickup",v=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===v&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:v,anchorY:b,sectorId:f,phase:h})}recordSectorCompletion(i){this.completionTimes.push({sectorId:i,completedAt:Date.now()})}recordMacroCreation(i){this.createdMacros.push(i)}finalizeTrial(i){const r=Date.now(),f=r-this.trialStartTime,h=this.buildStateSnapshot();if(this.controller.state.cfg.mode==="construction"){const v=this.buildFinalBlueprintState(h),b=v.filter(y=>y.blueprintType==="composite").map(y=>_o({id:y.blueprintId,parts:y.parts},y.label&&{label:y.label})),S={trialType:"construction",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:i,completionTimes:this.completionTimes,finalBlueprintState:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const v=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=v.map(y=>({id:y.macroId.startsWith("comp:")?y.macroId:`comp:${y.macroId}`,parts:y.parts})),S={trialType:"prep",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:"submit",createdMacros:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}}determineInteractionType(i,r){return r==="deleted"?"delete":i==="blueprint"?"spawn":"move"}toAnchorValue(i){return Math.round(i/this.gridStep)}toAnchorPoint(i){return{x:this.toAnchorValue(i.x),y:this.toAnchorValue(i.y)}}toAnchorVertices(i){return i.map(r=>r.map(f=>[this.toAnchorValue(f[0]),this.toAnchorValue(f[1])]))}buildMacrosFromSnapshot(i){return i.sectors.map(r=>{const f=r.pieces.map(g=>{const E=this.controller.getBlueprint(g.blueprintId),R=E&&"kind"in E?E.kind:g.blueprintId,w=this.controller.findPiece(g.pieceId);if(!w||!E)return{kind:R,position:g.position};const j=It(E,this.controller.getPrimitive),J={x:w.pos.x-j.min.x,y:w.pos.y-j.min.y},I=this.toAnchorPoint(J);return{kind:R,position:I}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,v=0;for(const g of f)h+=g.position.x,v+=g.position.y;const b=Math.round(h/f.length),S=Math.round(v/f.length),y=f.map(g=>({kind:g.kind,anchorOffset:{x:Math.round(g.position.x-b),y:Math.round(g.position.y-S)}})),m=r.pieces.flatMap(g=>g.vertices||[]);return{macroId:r.sectorId,parts:y,shape:m,pieceCount:r.pieceCount}})}buildStateSnapshot(i){const r=hu(),f=Date.now(),h=[],v=[];for(const y of this.controller.state.cfg.sectors){const m=this.controller.state.sectors[y.id],g=y.id===i||!!(m!=null&&m.completedAt);g&&v.push(y.id);const E=((m==null?void 0:m.pieces)||[]).map(w=>({pieceId:w.id,blueprintId:w.blueprintId,blueprintType:this.getBlueprintType(w.blueprintId),position:this.toAnchorPoint(w.pos),vertices:this.getPieceVertices(w.id)})),R={sectorId:y.id,completed:g,pieceCount:E.length,pieces:E};(m==null?void 0:m.completedAt)!==void 0&&(R.completedAt=m.completedAt),h.push(R)}const b=this.controller.state.cfg.sectors.map(y=>({sectorId:y.id,tangramId:y.tangramId})),S={primitives:this.controller.state.primitives.map(y=>y.id),quickstash:this.controller.state.quickstash.map(y=>y.id)};return{snapshotId:r,timestamp:f,sectors:h,completedSectorIds:v,sectorTangramMap:b,blueprintOrder:S}}getBlueprintType(i){const r=this.controller.getBlueprint(i);return r?"kind"in r?"primitive":"composite":"primitive"}getPieceVertices(i){var r;const f=this.controller.findPiece(i);if(!f)return[];const h=this.controller.getBlueprint(f.blueprintId);if(!h)return[];const v=It(h,S=>this.controller.getPrimitive(S)),b=((r=vn(h,v,f.pos))!=null?r:[]).map(S=>S.map(y=>[y.x,y.y]));return this.toAnchorVertices(b)}buildFinalBlueprintState(i){const r=new Map;for(const f of i.sectors)for(const h of f.pieces){r.has(h.blueprintId)||r.set(h.blueprintId,{blueprintType:h.blueprintType,totalPieces:0,bySector:new Map});const v=r.get(h.blueprintId);v.totalPieces++,v.bySector.set(f.sectorId,(v.bySector.get(f.sectorId)||0)+1)}for(const f of this.controller.state.primitives)r.has(f.id)||r.set(f.id,{blueprintType:"primitive",totalPieces:0,bySector:new Map});for(const f of this.controller.state.quickstash)r.has(f.id)||r.set(f.id,{blueprintType:"composite",totalPieces:0,bySector:new Map});return Array.from(r.entries()).map(([f,h])=>{const v=this.controller.getBlueprint(f),b={blueprintId:f,blueprintType:h.blueprintType,totalPieces:h.totalPieces,bySector:Array.from(h.bySector.entries()).map(([S,y])=>({sectorId:S,count:y}))};return v&&(h.blueprintType==="composite"&&"parts"in v?(b.parts=v.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),v.label&&(b.label=v.label)):h.blueprintType==="primitive"&&"kind"in v&&(v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=v.kind)),b})}}var j0=Object.defineProperty,Q0=Object.defineProperties,V0=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,Z0=Object.prototype.hasOwnProperty,L0=Object.prototype.propertyIsEnumerable,Do=(c,i,r)=>i in c?j0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pn=(c,i)=>{for(var r in i||(i={}))Z0.call(i,r)&&Do(c,r,i[r]);if(zo)for(var r of zo(i))L0.call(i,r)&&Do(c,r,i[r]);return c},Ci=(c,i)=>Q0(c,V0(i));function K0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:E,height:R,onSectorComplete:w,onPiecePlace:j,onPieceRemove:J,onInteraction:I,onTrialEnd:st,onControllerReady:dt}=c,Z=et.useMemo(()=>{const Q=pn(pn(Ci(pn({n:i.length,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y},m!==void 0&&{maxCompositeSize:m}),{mode:g||"construction"}),c.minPiecesPerMacro!==void 0&&{minPiecesPerMacro:c.minPiecesPerMacro}),c.requireAllSlots!==void 0&&{requireAllSlots:c.requireAllSlots});return new wh(i,r,f,Q)},[i,r,f,h,v,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),lt=et.useMemo(()=>{if(!I&&!st)return null;const Q={};return I&&(Q.onInteraction=I),st&&(Q.onTrialEnd=st),new w0(Z,Q)},[Z,I,st]);et.useEffect(()=>{dt&&dt(Z)},[Z,dt]),et.useEffect(()=>()=>{lt&&lt.dispose()},[lt]);const{layout:V,viewBox:ht}=et.useMemo(()=>{const Q=i.length,yt=i.map(At=>At.id),Ut=i.map(At=>{var Mt;return(Mt=At.silhouette.mask)!=null?Mt:[]}),ot=Wh({n:Q,layoutMode:h,target:v,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:Fh({w:ot.LOGICAL_W,h:ot.LOGICAL_H},Q,yt,h,v,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ot.LOGICAL_W,h:ot.LOGICAL_H}}},[i,h,v,y,f.length]),[,P]=et.useReducer(Q=>Q+1,0);et.useEffect(()=>{dt&&dt(Z,V,P)},[Z,V,dt,P]);const[nt,tt]=et.useState(!1);et.useEffect(()=>{i.every(Q=>Z.isSectorCompleted(Q.id))&&!nt&&(tt(!0),lt&&setTimeout(()=>{lt.finalizeTrial("auto_complete")},0))},[Z.updateCount,i,nt,Z,lt]);const mt=et.useCallback(Q=>{w&&w(Q,Z.snapshot())},[w,Z]),Ot=et.useMemo(()=>({onSectorComplete:mt,onPiecePlace:j||(()=>{}),onPieceRemove:J||(()=>{})}),[mt,j,J]),L=()=>{const Q={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return Ci(pn({},Q),{width:`${yt}px`,height:`${yt}px`})}else{const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return Ci(pn({},Q),{width:`${yt}px`,height:`${Ut}px`})}},bt=(()=>{if(h==="circle"){const Q=Math.min(window.innerWidth*.96,window.innerHeight*.96);return{width:Q,height:Q}}else{const Q=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),yt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:Q,height:yt}}})();et.useEffect(()=>{if(Z.state.cfg.mode!=="construction"||!S||S<=0||nt)return;const Q=window.setTimeout(()=>{nt||(Z.state.endedAt||(Z.state.endedAt=performance.now(),P()),lt==null||lt.finalizeTrial("timeout"),tt(!0))},S);return()=>{window.clearTimeout(Q)}},[Z,S,nt,lt,P]);const ct=Q=>Z.isSectorCompleted(Q),{pieces:Tt,pieceById:D,getSectorPiecePolysCached:G}=m0(Z),$=Z.state.cfg.input==="click",Y=Math.max(k.size.centerBadge.minPx,V.innerR*k.size.centerBadge.fractionOfOuterR),d=Z.state.cfg.layout==="semicircle"?{x:V.cx,y:V.cy-Y-k.size.centerBadge.marginPx}:{x:V.cx,y:V.cy},z=(Q,yt)=>Math.hypot(Q-d.x,yt-d.y)<=Y,q=et.useMemo(()=>Z.state.cfg.sectors.map(Q=>{var yt;return(yt=Q.silhouette.mask)!=null?yt:[]}),[Z.state.cfg.sectors]),C=et.useMemo(()=>{const Q=Kh(q.flat());return Q?k.layout.grid.unitPx/Q:1},[q]),{anchorDots:K}=M0(Z,V,C),ft=et.useMemo(()=>{var Q,yt;const Ut=new Map;for(const ot of V.sectors){const At=(yt=(Q=Z.state.cfg.sectors.find(ze=>ze.id===ot.id))==null?void 0:Q.silhouette.mask)!=null?yt:[];if(!(At!=null&&At.length))continue;const Mt=Ui(V,ot,"silhouette",1),qe=so(At,C,{cx:Mt.cx,cy:Mt.cy});Ut.set(ot.id,qe)}return Ut},[V,C,Z.state.cfg.sectors]),N=Q=>{var yt,Ut,ot;if(!Q||ct(Q))return!1;if(Z.state.cfg.target==="silhouette"){const At=(yt=ft.get(Q))!=null?yt:[];if(!At.length)return!1;const Mt=G(Q);if(r0(At,Mt))return Z.markSectorCompleted(Q),!0}else{const At=(ot=(Ut=Z.state.cfg.sectors.find(ze=>ze.id===Q))==null?void 0:Ut.silhouette.mask)!=null?ot:[];if(!At.length)return!1;const Mt=y0(At,C),qe=G(Q);if(h0(Mt,qe))return Z.markSectorCompleted(Q),!0}return!1},at=B0(Z,V,Tt,D,K,ft,ct,N,P,void 0,lt),{draggingId:W,dragInvalid:ut,svgRef:rt,onPiecePointerDown:X,onBlueprintPointerDown:xt,onPointerMove:vt,onPointerUp:Jt,setPieceRef:ee,setDraggingId:Gt,lockedPieceId:Nt,dragRef:Wt}=at,Zt=(Q,yt)=>{const Ut=rt.current,ot=Ut.createSVGPoint();ot.x=Q,ot.y=yt;const At=Ut.getScreenCTM();if(!At)return{x:0,y:0};const Mt=ot.matrixTransform(At.inverse());return{x:Mt.x,y:Mt.y}},Kt=N0(Z,V,Tt,$,W,Gt,Wt,z,ct,N,Zt,P,lt),{selectedPieceId:$t,onRootPointerDown:Lt}=Kt,ae=Q=>{if(W)return;const{x:yt,y:Ut}=Zt(Q.clientX,Q.clientY);if(Z.state.cfg.mode==="prep"){if(!Z.isSubmitEnabled()||nt){Q.stopPropagation();return}tt(!0),lt&&lt.finalizeTrial("submit"),Q.stopPropagation();return}if(lt!=null&&lt.recordClickEvent){const ot=Z.state.blueprintView,At=ot==="primitives"?"quickstash":"primitives";lt.recordClickEvent({x:yt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ot,to:At}})}Z.switchBlueprintView(),P(),Q.stopPropagation()};return et.createElement("div",{className:"tangram-gameboard",style:L()},et.createElement(c0,pn({controller:Z,layout:V,viewBox:ht,width:bt.width,height:bt.height,badgeR:Y,badgeCenter:d,placedSilBySector:ft,anchorDots:K,pieces:Tt,clickMode:$,draggingId:W,selectedPieceId:$t,dragInvalid:ut,lockedPieceId:Nt,svgRef:rt,setPieceRef:ee,onPiecePointerDown:X,onBlueprintPointerDown:xt,onRootPointerDown:Lt,onPointerMove:vt,onPointerUp:Jt,onCenterBadgePointerDown:ae},Ot)))}const k0=40*Math.SQRT2,_e=k0/2,Ae=(c,i)=>({x:c,y:i});function J0(c,i){const r=c.length;if(r===0)return[];const f=(i%r+r)%r;return c.slice(f).concat(c.slice(0,f))}function $0(c,i,r,f,h,v){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Ae(r+v*Math.cos(b),f+v*Math.sin(b))}function P0(c,i,r){let f;if(r){const b=r[0],S=r[1],y=Ae(-b.x*40,b.y*40),m=Ae(-S.x*40,S.y*40);f=[y,m]}else{const b=c[0];if(b===void 0)throw new Error("No side lengths provided");f=[Ae(0,0),Ae(b,0)]}const h=J0(c,1),v=i;for(let b=1;b<c.length-1;b++){const S=f[b-1],y=f[b];if(!S||!y)continue;const m=h[b-1],g=v[b-1];m===void 0||g===void 0||f.push($0(S.x,S.y,y.x,y.y,g,m))}return f}const I0={smalltriangle:[Ae(0,0),Ae(.5,.5)],parallelogram:[Ae(0,0),Ae(.5,0)],largetriangle:[Ae(0,0),Ae(.5,-.5)],medtriangle:[Ae(0,0),Ae(.5,0)],square:[Ae(0,0),Ae(.5,0)]},W0=[{id:"prim:square",kind:"square",sideLens:[20,20,20,20,20,20,20,20],angles:[180,90,180,90,180,90,180,90],color:"#f43f5e"},{id:"prim:smalltriangle",kind:"smalltriangle",sideLens:[_e,_e,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,_e,_e,20,20,_e,_e],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:medtriangle",kind:"medtriangle",sideLens:[20,20,20,20,_e,_e,_e,_e],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:largetriangle",kind:"largetriangle",sideLens:[_e,_e,_e,_e,20,20,20,20,20,20,20,20],angles:[180,180,180,45,180,180,180,90,180,180,180,45],color:"#8b5cf6"}].map(({id:c,kind:i,sideLens:r,angles:f,color:h})=>{const v=I0[i],b=P0(r,f,v);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:v}=c,b=h.map(y=>({kind:y.kind,offset:{x:y.anchorOffset.x*r,y:y.anchorOffset.y*r}})),S=[];for(const y of h){const m=i.get(y.kind);if(!m)continue;const g={x:y.anchorOffset.x*r,y:y.anchorOffset.y*r};for(const E of m.shape)S.push(E.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:v!=null?v:`Composite-${f}`}}var ty=Object.defineProperty,Ro=Object.getOwnPropertySymbols,ey=Object.prototype.hasOwnProperty,ly=Object.prototype.propertyIsEnumerable,Uo=(c,i,r)=>i in c?ty(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,Bo=(c,i)=>{for(var r in i||(i={}))ey.call(i,r)&&Uo(c,r,i[r]);if(Ro)for(var r of Ro(i))ly.call(i,r)&&Uo(c,r,i[r]);return c};function ny(c,i,r){const{numQuickstashSlots:f,maxPiecesPerMacro:h,minPiecesPerMacro:v,inputMode:b,layoutMode:S,requireAllSlots:y,quickstashMacros:m,primitiveOrder:g,onInteraction:E,onTrialEnd:R}=i,w=[...W0].sort((st,dt)=>g.indexOf(st.kind)-g.indexOf(dt.kind)),j=Array.from({length:f},(st,dt)=>({id:`prep-sector-${dt}`,tangramId:`prep-sector-${dt}`,silhouette:{id:`prep-silhouette-${dt}`,mask:[]}})),J=zh.createRoot(c),I=(st,dt,Z)=>{if(m&&m.length>0&&dt){const lt=new Map;w.forEach(V=>lt.set(V.kind,V)),m.forEach((V,ht)=>{const P=`prep-sector-${ht}`,nt=F0(V,lt,k.layout.grid.stepPx),tt=dt.sectors.find(G=>G.id===P);if(!tt)return;const mt=Ui(dt,tt,"workspace",1);let Ot=1/0,L=1/0,bt=-1/0,ct=-1/0;nt.parts.forEach(G=>{const $=lt.get(G.kind);if(!$)return;const Y=It($,st.getPrimitive),d=G.offset.x+Y.min.x,z=G.offset.y+Y.min.y,q=G.offset.x+Y.max.x,C=G.offset.y+Y.max.y;Ot=Math.min(Ot,d),L=Math.min(L,z),bt=Math.max(bt,q),ct=Math.max(ct,C)});const Tt=Ot+(bt-Ot)/2,D=L+(ct-L)/2;nt.parts.forEach(G=>{const $=lt.get(G.kind);if(!$){console.warn(`Unknown primitive kind: ${G.kind}`);return}const Y=It($,st.getPrimitive),d=G.offset.x+Y.min.x,z=G.offset.y+Y.min.y,q=mt.cx+(d-Tt),C=mt.cy+(z-D),K=k.layout.grid.stepPx,ft=Math.round(q/K)*K,N=Math.round(C/K)*K,at=st.spawnFromBlueprint($,{x:ft,y:N});st.drop(at,P)})}),Z&&Z()}};return J.render(et.createElement(K0,Bo(Bo({sectors:j,quickstash:[],primitives:w,layout:S,target:"workspace",input:b,timeLimitMs:0,maxQuickstashSlots:0,maxCompositeSize:h,mode:"prep",minPiecesPerMacro:v,requireAllSlots:y,onControllerReady:I},E&&{onInteraction:E}),R&&{onTrialEnd:R}))),{root:J,display_element:c,jsPsych:r}}const ay={name:"tangram-prep",version:"1.0.0",parameters:{num_quickstash_slots:{type:Fe.ParameterType.INT,default:void 0},max_pieces_per_macro:{type:Fe.ParameterType.INT,default:2},min_pieces_per_macro:{type:Fe.ParameterType.INT,default:2},input:{type:Fe.ParameterType.STRING,default:"click"},layout:{type:Fe.ParameterType.STRING,default:"semicircle"},require_all_slots:{type:Fe.ParameterType.BOOL,default:void 0},quickstash_macros:{type:Fe.ParameterType.COMPLEX,default:[],description:"Array of AnchorComposite objects to edit as primitive pieces"},primitive_order:{type:Fe.ParameterType.OBJECT,default:["square","smalltriangle","parallelogram","medtriangle","largetriangle"],description:"Array of primitive names in the order they should be displayed"},onInteraction:{type:Fe.ParameterType.FUNCTION,default:void 0},onTrialEnd:{type:Fe.ParameterType.FUNCTION,default:void 0}},data:{completed:{type:Fe.ParameterType.BOOL}},citations:""};class No{constructor(i){this.jsPsych=i}trial(i,r){const f=y=>{r.onTrialEnd&&r.onTrialEnd(y);const m=i.__reactContext;m!=null&&m.root&&m.root.unmount(),i.innerHTML="",this.jsPsych.finishTrial(y)},h={numQuickstashSlots:r.num_quickstash_slots,maxPiecesPerMacro:r.max_pieces_per_macro,minPiecesPerMacro:r.min_pieces_per_macro,inputMode:r.input,layoutMode:r.layout,requireAllSlots:r.require_all_slots,quickstashMacros:r.quickstash_macros,primitiveOrder:r.primitive_order,onInteraction:r.onInteraction,onTrialEnd:f},{root:v,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:v,jsPsych:S}}}return No.info=ay,No}(jsPsychModule);
41
+ `).replace(Ym,"")}function Ld(t,e){return e=Zd(e),Zd(t)===e}function si(){}function wt(t,e,l,n,a,u){switch(l){case"children":typeof n=="string"?e==="body"||e==="textarea"&&n===""||_n(t,n):(typeof n=="number"||typeof n=="bigint")&&e!=="body"&&_n(t,""+n);break;case"className":vu(t,"class",n);break;case"tabIndex":vu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":vu(t,l,n);break;case"style":ko(t,n,u);break;case"data":if(e!=="object"){vu(t,"data",n);break}case"src":case"href":if(n===""&&(e!=="a"||l!=="href")){t.removeAttribute(l);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(l);break}n=bu(""+n),t.setAttribute(l,n);break;case"action":case"formAction":if(typeof n=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(l==="formAction"?(e!=="input"&&wt(t,e,"name",a.name,a,null),wt(t,e,"formEncType",a.formEncType,a,null),wt(t,e,"formMethod",a.formMethod,a,null),wt(t,e,"formTarget",a.formTarget,a,null)):(wt(t,e,"encType",a.encType,a,null),wt(t,e,"method",a.method,a,null),wt(t,e,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(l);break}n=bu(""+n),t.setAttribute(l,n);break;case"onClick":n!=null&&(t.onclick=si);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=l}}break;case"multiple":t.multiple=n&&typeof n!="function"&&typeof n!="symbol";break;case"muted":t.muted=n&&typeof n!="function"&&typeof n!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(n==null||typeof n=="function"||typeof n=="boolean"||typeof n=="symbol"){t.removeAttribute("xlink:href");break}l=bu(""+n),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,""+n):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":n&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":n===!0?t.setAttribute(l,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(l,n):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?t.setAttribute(l,n):t.removeAttribute(l);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?t.removeAttribute(l):t.setAttribute(l,n);break;case"popover":Rt("beforetoggle",t),Rt("toggle",t),mu(t,"popover",n);break;case"xlinkActuate":hl(t,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":hl(t,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":hl(t,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":hl(t,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":hl(t,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":hl(t,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":hl(t,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":hl(t,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":hl(t,"http://www.w3.org/XML/1998/namespace","xml:space",n);break;case"is":mu(t,"is",n);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=hy.get(l)||l,mu(t,l,n))}}function Uf(t,e,l,n,a,u){switch(l){case"style":ko(t,n,u);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(l=n.__html,l!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=l}}break;case"children":typeof n=="string"?_n(t,n):(typeof n=="number"||typeof n=="bigint")&&_n(t,""+n);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"onClick":n!=null&&(t.onclick=si);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Co.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(a=l.endsWith("Capture"),e=l.slice(2,a?l.length-7:void 0),u=t[Re]||null,u=u!=null?u[l]:null,typeof u=="function"&&t.removeEventListener(e,u,a),typeof n=="function")){typeof u!="function"&&u!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(e,n,a);break t}l in t?t[l]=n:n===!0?t.setAttribute(l,""):mu(t,l,n)}}}function ge(t,e,l){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",t),Rt("load",t);var n=!1,a=!1,u;for(u in l)if(l.hasOwnProperty(u)){var o=l[u];if(o!=null)switch(u){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,u,o,l,null)}}a&&wt(t,e,"srcSet",l.srcSet,l,null),n&&wt(t,e,"src",l.src,l,null);return;case"input":Rt("invalid",t);var s=u=o=a=null,p=null,T=null;for(n in l)if(l.hasOwnProperty(n)){var U=l[n];if(U!=null)switch(n){case"name":a=U;break;case"type":o=U;break;case"checked":p=U;break;case"defaultChecked":T=U;break;case"value":u=U;break;case"defaultValue":s=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,e));break;default:wt(t,e,n,U,l,null)}}Vo(t,u,s,p,T,o,a,!1),pu(t);return;case"select":Rt("invalid",t),n=o=u=null;for(a in l)if(l.hasOwnProperty(a)&&(s=l[a],s!=null))switch(a){case"value":u=s;break;case"defaultValue":o=s;break;case"multiple":n=s;default:wt(t,e,a,s,l,null)}e=u,l=o,t.multiple=!!n,e!=null?On(t,!!n,e,!1):l!=null&&On(t,!!n,l,!0);return;case"textarea":Rt("invalid",t),u=a=n=null;for(o in l)if(l.hasOwnProperty(o)&&(s=l[o],s!=null))switch(o){case"value":n=s;break;case"defaultValue":a=s;break;case"children":u=s;break;case"dangerouslySetInnerHTML":if(s!=null)throw Error(f(91));break;default:wt(t,e,o,s,l,null)}Lo(t,n,a,u),pu(t);return;case"option":for(p in l)if(l.hasOwnProperty(p)&&(n=l[p],n!=null))switch(p){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,e,p,n,l,null)}return;case"dialog":Rt("beforetoggle",t),Rt("toggle",t),Rt("cancel",t),Rt("close",t);break;case"iframe":case"object":Rt("load",t);break;case"video":case"audio":for(n=0;n<$a.length;n++)Rt($a[n],t);break;case"image":Rt("error",t),Rt("load",t);break;case"details":Rt("toggle",t);break;case"embed":case"source":case"link":Rt("error",t),Rt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in l)if(l.hasOwnProperty(T)&&(n=l[T],n!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,T,n,l,null)}return;default:if(Ki(e)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&Uf(t,e,U,n,l,void 0));return}}for(s in l)l.hasOwnProperty(s)&&(n=l[s],n!=null&&wt(t,e,s,n,l,null))}function Gm(t,e,l,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,u=null,o=null,s=null,p=null,T=null,U=null;for(_ in l){var H=l[_];if(l.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":p=H;default:n.hasOwnProperty(_)||wt(t,e,_,null,n,H)}}for(var O in n){var _=n[O];if(H=l[O],n.hasOwnProperty(O)&&(_!=null||H!=null))switch(O){case"type":u=_;break;case"name":a=_;break;case"checked":T=_;break;case"defaultChecked":U=_;break;case"value":o=_;break;case"defaultValue":s=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(f(137,e));break;default:_!==H&&wt(t,e,O,_,n,H)}}Zi(t,o,s,p,T,U,u,a);return;case"select":_=o=s=O=null;for(u in l)if(p=l[u],l.hasOwnProperty(u)&&p!=null)switch(u){case"value":break;case"multiple":_=p;default:n.hasOwnProperty(u)||wt(t,e,u,null,n,p)}for(a in n)if(u=n[a],p=l[a],n.hasOwnProperty(a)&&(u!=null||p!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==p&&wt(t,e,a,u,n,p)}e=s,l=o,n=_,O!=null?On(t,!!l,O,!1):!!n!=!!l&&(e!=null?On(t,!!l,e,!0):On(t,!!l,l?[]:"",!1));return;case"textarea":_=O=null;for(s in l)if(a=l[s],l.hasOwnProperty(s)&&a!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:wt(t,e,s,null,n,a)}for(o in n)if(a=n[o],u=l[o],n.hasOwnProperty(o)&&(a!=null||u!=null))switch(o){case"value":O=a;break;case"defaultValue":_=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(f(91));break;default:a!==u&&wt(t,e,o,a,n,u)}Zo(t,O,_);return;case"option":for(var St in l)if(O=l[St],l.hasOwnProperty(St)&&O!=null&&!n.hasOwnProperty(St))switch(St){case"selected":t.selected=!1;break;default:wt(t,e,St,null,n,O)}for(p in n)if(O=n[p],_=l[p],n.hasOwnProperty(p)&&O!==_&&(O!=null||_!=null))switch(p){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,e,p,O,n,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var pt in l)O=l[pt],l.hasOwnProperty(pt)&&O!=null&&!n.hasOwnProperty(pt)&&wt(t,e,pt,null,n,O);for(T in n)if(O=n[T],_=l[T],n.hasOwnProperty(T)&&O!==_&&(O!=null||_!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,e));break;default:wt(t,e,T,O,n,_)}return;default:if(Ki(e)){for(var jt in l)O=l[jt],l.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Uf(t,e,jt,void 0,n,O);for(U in n)O=n[U],_=l[U],!n.hasOwnProperty(U)||O===_||O===void 0&&_===void 0||Uf(t,e,U,O,n,_);return}}for(var M in l)O=l[M],l.hasOwnProperty(M)&&O!=null&&!n.hasOwnProperty(M)&&wt(t,e,M,null,n,O);for(H in n)O=n[H],_=l[H],!n.hasOwnProperty(H)||O===_||O==null&&_==null||wt(t,e,H,O,n,_)}var Bf=null,Nf=null;function di(t){return t.nodeType===9?t:t.ownerDocument}function Kd(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function kd(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function Hf(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var qf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===qf?!1:(qf=t,!0):(qf=null,!1)}var Jd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,$d=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof $d!="undefined"?function(t){return $d.resolve(null).then(t).catch(Qm)}:Jd;function Qm(t){setTimeout(function(){throw t})}function Ll(t){return t==="head"}function Pd(t,e){var l=e,n=0,a=0;do{var u=l.nextSibling;if(t.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(0<n&&8>n){l=n;var o=t.ownerDocument;if(l&1&&Ia(o.documentElement),l&2&&Ia(o.body),l&4)for(l=o.head,Ia(l),o=l.firstChild;o;){var s=o.nextSibling,p=o.nodeName;o[da]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&o.rel.toLowerCase()==="stylesheet"||l.removeChild(o),o=s}}if(a===0){t.removeChild(u),uu(e);return}a--}else l==="$"||l==="$?"||l==="$!"?a++:n=l.charCodeAt(0)-48;else n=0;l=u}while(l);uu(e)}function Cf(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var l=e;switch(e=e.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Cf(l),wi(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function Vm(t,e,l,n){for(;t.nodeType===1;){var a=l;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!n&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(n){if(!t[da])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(u=t.getAttribute("rel"),u==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(u!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(u=t.getAttribute("src"),(u!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&u&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var u=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===u)return t}else return t;if(t=ll(t.nextSibling),t===null)break}return null}function Zm(t,e,l){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=ll(t.nextSibling),t===null))return null;return t}function Yf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function Lm(t,e){var l=t.ownerDocument;if(t.data!=="$?"||l.readyState==="complete")e();else{var n=function(){e(),l.removeEventListener("DOMContentLoaded",n)};l.addEventListener("DOMContentLoaded",n),t._reactRetry=n}}function ll(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="F!"||e==="F")break;if(e==="/$")return null}}return t}var Gf=null;function Id(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"){if(e===0)return t;e--}else l==="/$"&&e++}t=t.previousSibling}return null}function Wd(t,e,l){switch(e=di(l),t){case"html":if(t=e.documentElement,!t)throw Error(f(452));return t;case"head":if(t=e.head,!t)throw Error(f(453));return t;case"body":if(t=e.body,!t)throw Error(f(454));return t;default:throw Error(f(451))}}function Ia(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);wi(t)}var We=new Map,Fd=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _l=G.d;G.d={f:Km,r:km,D:Jm,C:$m,L:Pm,m:Im,X:Fm,S:Wm,M:tv};function Km(){var t=_l.f(),e=ai();return t||e}function km(t){var e=Mn(t);e!==null&&e.tag===5&&e.type==="form"?bs(e):_l.r(t)}var la=typeof document=="undefined"?null:document;function th(t,e,l){var n=la;if(n&&typeof e=="string"&&e){var a=Le(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof l=="string"&&(a+='[crossorigin="'+l+'"]'),Fd.has(a)||(Fd.add(a),t={rel:t,crossOrigin:l,href:e},n.querySelector(a)===null&&(e=n.createElement("link"),ge(e,"link",t),se(e),n.head.appendChild(e)))}}function Jm(t){_l.D(t),th("dns-prefetch",t,null)}function $m(t,e){_l.C(t,e),th("preconnect",t,e)}function Pm(t,e,l){_l.L(t,e,l);var n=la;if(n&&t&&e){var a='link[rel="preload"][as="'+Le(e)+'"]';e==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+Le(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+Le(l.imageSizes)+'"]')):a+='[href="'+Le(t)+'"]';var u=a;switch(e){case"style":u=na(t);break;case"script":u=aa(t)}We.has(u)||(t=g({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),We.set(u,t),n.querySelector(a)!==null||e==="style"&&n.querySelector(Wa(u))||e==="script"&&n.querySelector(Fa(u))||(e=n.createElement("link"),ge(e,"link",t),se(e),n.head.appendChild(e)))}}function Im(t,e){_l.m(t,e);var l=la;if(l&&t){var n=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Le(n)+'"][href="'+Le(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!We.has(u)&&(t=g({rel:"modulepreload",href:t},e),We.set(u,t),l.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Fa(u)))return}n=l.createElement("link"),ge(n,"link",t),se(n),l.head.appendChild(n)}}}function Wm(t,e,l){_l.S(t,e,l);var n=la;if(n&&t){var a=An(n).hoistableStyles,u=na(t);e=e||"default";var o=a.get(u);if(!o){var s={loading:0,preload:null};if(o=n.querySelector(Wa(u)))s.loading=5;else{t=g({rel:"stylesheet",href:t,"data-precedence":e},l),(l=We.get(u))&&Xf(t,l);var p=o=n.createElement("link");se(p),ge(p,"link",t),p._p=new Promise(function(T,U){p.onload=T,p.onerror=U}),p.addEventListener("load",function(){s.loading|=1}),p.addEventListener("error",function(){s.loading|=2}),s.loading|=4,yi(o,e,n)}o={type:"stylesheet",instance:o,count:1,state:s},a.set(u,o)}}}function Fm(t,e){_l.X(t,e);var l=la;if(l&&t){var n=An(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0},e),(e=We.get(a))&&wf(t,e),u=l.createElement("script"),se(u),ge(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function tv(t,e){_l.M(t,e);var l=la;if(l&&t){var n=An(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0,type:"module"},e),(e=We.get(a))&&wf(t,e),u=l.createElement("script"),se(u),ge(u,"link",t),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function eh(t,e,l,n){var a=(a=N.current)?hi(a):null;if(!a)throw Error(f(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(e=na(l.href),l=An(a).hoistableStyles,n=l.get(e),n||(n={type:"style",instance:null,count:0,state:null},l.set(e,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=na(l.href);var u=An(a).hoistableStyles,o=u.get(t);if(o||(a=a.ownerDocument||a,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,o),(u=a.querySelector(Wa(t)))&&!u._p&&(o.instance=u,o.state.loading=5),We.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},We.set(t,l),u||ev(a,t,l,o.state))),e&&n===null)throw Error(f(528,""));return o}if(e&&n!==null)throw Error(f(529,""));return null;case"script":return e=l.async,l=l.src,typeof l=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=aa(l),l=An(a).hoistableScripts,n=l.get(e),n||(n={type:"script",instance:null,count:0,state:null},l.set(e,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,t))}}function na(t){return'href="'+Le(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function lh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function ev(t,e,l,n){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?n.loading=1:(e=t.createElement("link"),n.preload=e,e.addEventListener("load",function(){return n.loading|=1}),e.addEventListener("error",function(){return n.loading|=2}),ge(e,"link",l),se(e),t.head.appendChild(e))}function aa(t){return'[src="'+Le(t)+'"]'}function Fa(t){return"script[async]"+t}function nh(t,e,l){if(e.count++,e.instance===null)switch(e.type){case"style":var n=t.querySelector('style[data-href~="'+Le(l.href)+'"]');if(n)return e.instance=n,se(n),n;var a=g({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(t.ownerDocument||t).createElement("style"),se(n),ge(n,"style",a),yi(n,l.precedence,t),e.instance=n;case"stylesheet":a=na(l.href);var u=t.querySelector(Wa(a));if(u)return e.state.loading|=4,e.instance=u,se(u),u;n=lh(l),(a=We.get(a))&&Xf(n,a),u=(t.ownerDocument||t).createElement("link"),se(u);var o=u;return o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),ge(u,"link",n),e.state.loading|=4,yi(u,l.precedence,t),e.instance=u;case"script":return u=aa(l.src),(a=t.querySelector(Fa(u)))?(e.instance=a,se(a),a):(n=l,(a=We.get(u))&&(n=g({},l),wf(n,a)),t=t.ownerDocument||t,a=t.createElement("script"),se(a),ge(a,"link",n),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(f(443,e.type))}else e.type==="stylesheet"&&!(e.state.loading&4)&&(n=e.instance,e.state.loading|=4,yi(n,l.precedence,t));return e.instance}function yi(t,e,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=n.length?n[n.length-1]:null,u=a,o=0;o<n.length;o++){var s=n[o];if(s.dataset.precedence===e)u=s;else if(u!==a)break}u?u.parentNode.insertBefore(t,u.nextSibling):(e=l.nodeType===9?l.head:l,e.insertBefore(t,e.firstChild))}function Xf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function wf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var mi=null;function ah(t,e,l){if(mi===null){var n=new Map,a=mi=new Map;a.set(l,n)}else a=mi,n=a.get(l),n||(n=new Map,a.set(l,n));if(n.has(t))return n;for(n.set(t,null),l=l.getElementsByTagName(t),a=0;a<l.length;a++){var u=l[a];if(!(u[da]||u[Se]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var o=u.getAttribute(e)||"";o=t+o;var s=n.get(o);s?s.push(u):n.set(o,[u])}}return n}function uh(t,e,l){t=t.ownerDocument||t,t.head.insertBefore(l,e==="title"?t.querySelector("head > title"):null)}function lv(t,e,l){if(l===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function ih(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}var tu=null;function nv(){}function av(t,e,l){if(tu===null)throw Error(f(475));var n=tu;if(e.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&!(e.state.loading&4)){if(e.instance===null){var a=na(l.href),u=t.querySelector(Wa(a));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(n.count++,n=vi.bind(n),t.then(n,n)),e.state.loading|=4,e.instance=u,se(u);return}u=t.ownerDocument||t,l=lh(l),(a=We.get(a))&&Xf(l,a),u=u.createElement("link"),se(u);var o=u;o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),ge(u,"link",l),e.instance=u}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(e,t),(t=e.state.preload)&&!(e.state.loading&3)&&(n.count++,e=vi.bind(n),t.addEventListener("load",e),t.addEventListener("error",e))}}function uv(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&jf(t,t.stylesheets),0<t.count?function(e){var l=setTimeout(function(){if(t.stylesheets&&jf(t,t.stylesheets),t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}},6e4);return t.unsuspend=e,function(){t.unsuspend=null,clearTimeout(l)}}:null}function vi(){if(this.count--,this.count===0){if(this.stylesheets)jf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pi=null;function jf(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pi=new Map,e.forEach(iv,t),pi=null,vi.call(t))}function iv(t,e){if(!(e.state.loading&4)){var l=pi.get(t);if(l)var n=l.get(null);else{l=new Map,pi.set(t,l);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<a.length;u++){var o=a[u];(o.nodeName==="LINK"||o.getAttribute("media")!=="not all")&&(l.set(o.dataset.precedence,o),n=o)}n&&l.set(null,n)}a=e.instance,o=a.getAttribute("data-precedence"),u=l.get(o)||n,u===n&&l.set(null,a),l.set(o,a),this.count++,n=vi.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),u?u.parentNode.insertBefore(a,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var eu={$$typeof:Z,Provider:null,Consumer:null,_currentValue:$,_currentValue2:$,_threadCount:0};function cv(t,e,l,n,a,u,o,s){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ul(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ul(0),this.hiddenUpdates=ul(null),this.identifierPrefix=n,this.onUncaughtError=a,this.onCaughtError=u,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.incompleteTransitions=new Map}function ch(t,e,l,n,a,u,o,s,p,T,U,H){return t=new cv(t,e,l,o,s,p,T,H),e=1,u===!0&&(e|=24),u=Ye(3,null,null,e),t.current=u,u.stateNode=t,e=xc(),e.refCount++,t.pooledCache=e,e.refCount++,u.memoizedState={element:n,isDehydrated:l,cache:e},Ec(u),t}function fh(t){return t?(t=qn,t):qn}function oh(t,e,l,n,a,u){a=fh(a),n.context===null?n.context=a:n.pendingContext=a,n=Bl(e),n.payload={element:l},u=u===void 0?null:u,u!==null&&(n.callback=u),l=Nl(t,n,e),l!==null&&(Qe(l,t,e),Ua(l,t,e))}function rh(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<e?l:e}}function Qf(t,e){rh(t,e),(t=t.alternate)&&rh(t,e)}function sh(t){if(t.tag===13){var e=Hn(t,67108864);e!==null&&Qe(e,t,67108864),Qf(t,67108864)}}var gi=!0;function fv(t,e,l,n){var a=D.T;D.T=null;var u=G.p;try{G.p=2,Vf(t,e,l,n)}finally{G.p=u,D.T=a}}function ov(t,e,l,n){var a=D.T;D.T=null;var u=G.p;try{G.p=8,Vf(t,e,l,n)}finally{G.p=u,D.T=a}}function Vf(t,e,l,n){if(gi){var a=Zf(n);if(a===null)Rf(t,e,n,bi,l),hh(t,n);else if(sv(a,t,e,l,n))n.stopPropagation();else if(hh(t,n),e&4&&-1<rv.indexOf(t)){for(;a!==null;){var u=Mn(a);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var o=ce(u.pendingLanes);if(o!==0){var s=u;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var p=1<<31-Mt(o);s.entanglements[1]|=p,o&=~p}sl(u),!(Ct&6)&&(li=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Qe(s,u,2),ai(),Qf(u,2)}if(u=Zf(n),u===null&&Rf(t,e,n,bi,l),u===a)break;a=u}a!==null&&n.stopPropagation()}else Rf(t,e,n,null,l)}}function Zf(t){return t=Ji(t),Lf(t)}var bi=null;function Lf(t){if(bi=null,t=xn(t),t!==null){var e=v(t);if(e===null)t=null;else{var l=e.tag;if(l===13){if(t=b(e),t!==null)return t;t=null}else if(l===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return bi=t,null}function dh(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Wt()){case Zt:return 2;case Kt:return 8;case $t:case Lt:return 32;case ae:return 268435456;default:return 32}default:return 32}}var Kf=!1,Kl=null,kl=null,Jl=null,lu=new Map,nu=new Map,$l=[],rv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function hh(t,e){switch(t){case"focusin":case"focusout":Kl=null;break;case"dragenter":case"dragleave":kl=null;break;case"mouseover":case"mouseout":Jl=null;break;case"pointerover":case"pointerout":lu.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(e.pointerId)}}function au(t,e,l,n,a,u){return t===null||t.nativeEvent!==u?(t={blockedOn:e,domEventName:l,eventSystemFlags:n,nativeEvent:u,targetContainers:[a]},e!==null&&(e=Mn(e),e!==null&&sh(e)),t):(t.eventSystemFlags|=n,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function sv(t,e,l,n,a){switch(e){case"focusin":return Kl=au(Kl,t,e,l,n,a),!0;case"dragenter":return kl=au(kl,t,e,l,n,a),!0;case"mouseover":return Jl=au(Jl,t,e,l,n,a),!0;case"pointerover":var u=a.pointerId;return lu.set(u,au(lu.get(u)||null,t,e,l,n,a)),!0;case"gotpointercapture":return u=a.pointerId,nu.set(u,au(nu.get(u)||null,t,e,l,n,a)),!0}return!1}function yh(t){var e=xn(t.target);if(e!==null){var l=v(e);if(l!==null){if(e=l.tag,e===13){if(e=b(l),e!==null){t.blockedOn=e,Gi(t.priority,function(){if(l.tag===13){var n=je();n=sa(n);var a=Hn(l,n);a!==null&&Qe(a,l,n),Qf(l,n)}});return}}else if(e===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Si(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var l=Zf(t.nativeEvent);if(l===null){l=t.nativeEvent;var n=new l.constructor(l.type,l);ki=n,l.target.dispatchEvent(n),ki=null}else return e=Mn(l),e!==null&&sh(e),t.blockedOn=l,!1;e.shift()}return!0}function mh(t,e,l){Si(t)&&l.delete(e)}function dv(){Kf=!1,Kl!==null&&Si(Kl)&&(Kl=null),kl!==null&&Si(kl)&&(kl=null),Jl!==null&&Si(Jl)&&(Jl=null),lu.forEach(mh),nu.forEach(mh)}function xi(t,e){t.blockedOn===e&&(t.blockedOn=null,Kf||(Kf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dv)))}var Mi=null;function vh(t){Mi!==t&&(Mi=t,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Mi===t&&(Mi=null);for(var e=0;e<t.length;e+=3){var l=t[e],n=t[e+1],a=t[e+2];if(typeof n!="function"){if(Lf(n||l)===null)continue;break}var u=Mn(l);u!==null&&(t.splice(e,3),e-=3,Zc(u,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function uu(t){function e(p){return xi(p,t)}Kl!==null&&xi(Kl,t),kl!==null&&xi(kl,t),Jl!==null&&xi(Jl,t),lu.forEach(e),nu.forEach(e);for(var l=0;l<$l.length;l++){var n=$l[l];n.blockedOn===t&&(n.blockedOn=null)}for(;0<$l.length&&(l=$l[0],l.blockedOn===null);)yh(l),l.blockedOn===null&&$l.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(n=0;n<l.length;n+=3){var a=l[n],u=l[n+1],o=a[Re]||null;if(typeof u=="function")o||vh(l);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Re]||null)s=o.formAction;else if(Lf(a)!==null)continue}else s=o.action;typeof s=="function"?l[n+1]=s:(l.splice(n,3),n-=3),vh(l)}}}function kf(t){this._internalRoot=t}Ai.prototype.render=kf.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(f(409));var l=e.current,n=je();oh(l,n,t,e,null,null)},Ai.prototype.unmount=kf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;oh(t.current,2,null,t,null,null),ai(),e[Sn]=null}};function Ai(t){this._internalRoot=t}Ai.prototype.unstable_scheduleHydration=function(t){if(t){var e=bn();t={blockedOn:null,target:t,priority:e};for(var l=0;l<$l.length&&e!==0&&e<$l[l].priority;l++);$l.splice(l,0,t),l===0&&yh(t)}};var ph=i.version;if(ph!=="19.1.1")throw Error(f(527,ph,"19.1.1"));G.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(f(188)):(t=Object.keys(t).join(","),Error(f(268,t)));return t=y(e),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var hv={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ti=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ti.isDisabled&&Ti.supportsFiber)try{Ut=Ti.inject(hv),ot=Ti}catch(t){}}return ua.createRoot=function(t,e){if(!h(t))throw Error(f(299));var l=!1,n="",a=Ns,u=Hs,o=qs,s=null;return e!=null&&(e.unstable_strictMode===!0&&(l=!0),e.identifierPrefix!==void 0&&(n=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(u=e.onCaughtError),e.onRecoverableError!==void 0&&(o=e.onRecoverableError),e.unstable_transitionCallbacks!==void 0&&(s=e.unstable_transitionCallbacks)),e=ch(t,1,!1,null,null,l,n,a,u,o,s,null),t[Sn]=e.current,Df(t),new kf(e)},ua.hydrateRoot=function(t,e,l){if(!h(t))throw Error(f(299));var n=!1,a="",u=Ns,o=Hs,s=qs,p=null,T=null;return l!=null&&(l.unstable_strictMode===!0&&(n=!0),l.identifierPrefix!==void 0&&(a=l.identifierPrefix),l.onUncaughtError!==void 0&&(u=l.onUncaughtError),l.onCaughtError!==void 0&&(o=l.onCaughtError),l.onRecoverableError!==void 0&&(s=l.onRecoverableError),l.unstable_transitionCallbacks!==void 0&&(p=l.unstable_transitionCallbacks),l.formState!==void 0&&(T=l.formState)),e=ch(t,1,!0,e,l!=null?l:null,n,a,u,o,s,p,T),e.context=fh(null),l=e.current,n=je(),n=sa(n),a=Bl(n),a.callback=null,Nl(l,a,n),l=n,e.current.lanes=l,Ee(e,l),sl(e),t[Sn]=e.current,Df(t),new Ai(e)},ua.version="19.1.1",ua}function ao(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ao)}catch(c){console.error(c)}}ao(),If.exports=_h();var zh=If.exports;const k={color:{bands:{silhouette:{fillEven:"#fff2ccff",fillOdd:"#fff2ccff",stroke:"#b1b1b1"},workspace:{fillEven:"#fff2ccff",fillOdd:"#fff2ccff",stroke:"#b1b1b1"}},completion:{fill:"#ccfff2",stroke:"#13da57"},silhouetteMask:"#374151",anchors:{invalid:"#7dd3fc",valid:"#475569"},piece:{draggingFill:"#8e7cc3ff",validFill:"#8e7cc3ff",invalidFill:"#ef4444",invalidStroke:"#dc2626",selectedStroke:"#674ea7",allGreenStroke:"#86efac",borderStroke:"#674ea7"},ui:{light:"#60a5fa",dark:"#1d4ed8"},blueprint:{fill:"#374151",selectedStroke:"#111827",badgeFill:"#000000",labelFill:"#ffffff"}},opacity:{blueprint:.4,silhouetteMask:.25,anchors:{invalid:0,valid:0},piece:{invalid:.35,dragging:.75,locked:1,normal:1}},size:{stroke:{bandPx:5,pieceSelectedPx:3,allGreenStrokePx:10,pieceBorderPx:2},anchorRadiusPx:{valid:1,invalid:1},badgeFontPx:16,centerBadge:{fractionOfOuterR:.15,minPx:20,marginPx:4}},layout:{grid:{stepPx:20,unitPx:40},paddingPx:1,constraints:{workspaceDiamAnchors:10,quickstashDiamAnchors:7,primitiveDiamAnchors:5},defaults:{maxQuickstashSlots:1}},game:{snapRadiusPx:15,showBorders:!0,hideTouchingBorders:!0}};function Dh(c){return c.parts!==void 0}function Rh(c){return!Dh(c)}class Uh{constructor(){this.byId=new Map,this.primitivesByKind=new Map}registerAll(i){for(const r of i)this.register(r)}register(i){this.byId.set(i.id,i),Rh(i)&&this.primitivesByKind.set(i.kind,i)}get(i){return this.byId.get(i)}getPrimitive(i){return this.primitivesByKind.get(i)}}var Bh=Object.defineProperty,Nh=Object.defineProperties,Hh=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,qh=Object.prototype.hasOwnProperty,Ch=Object.prototype.propertyIsEnumerable,io=(c,i,r)=>i in c?Bh(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,zi=(c,i)=>{for(var r in i||(i={}))qh.call(i,r)&&io(c,r,i[r]);if(uo)for(var r of uo(i))Ch.call(i,r)&&io(c,r,i[r]);return c},Yh=(c,i)=>Nh(c,Hh(i));let Gh=0;const Xh=()=>`p_${++Gh}`,iu=()=>performance.now();class wh{constructor(i,r,f,h){if(this.registry=new Uh,this._updateCount=0,this.trackingCallbacks=null,!i||i.length===0)throw new Error("BaseGameController: sectors array is required and cannot be empty");if(!f||f.length===0)throw new Error("BaseGameController: primitives array is required and cannot be empty");if(!h)throw new Error("BaseGameController: config is required");this.sectors=i,this.quickstash=r||[],this.primitives=f,this.config=h,this.registry.registerAll(f),this.registry.registerAll(r),this.t0=iu(),this.state=this.initializeState()}get updateCount(){return this._updateCount}notifyStateChange(){this._updateCount++}initializeState(){var i;const r={};for(const f of this.sectors)r[f.id]={sectorId:f.id,pieces:[]};return{cfg:{n:this.config.n,layout:this.config.layout,target:this.config.target,input:this.config.input,maxQuickstashSlots:this.config.maxQuickstashSlots,timeLimitMs:this.config.timeLimitMs,snapRadiusPx:k.game.snapRadiusPx,maxCompositeSize:(i=this.config.maxCompositeSize)!=null?i:0,sectors:this.sectors,mode:this.config.mode},blueprintView:this.config.mode==="prep"?"primitives":"quickstash",primitives:this.primitives,quickstash:this.quickstash,sectors:r,startedAt:this.t0}}setTrackingCallbacks(i){this.trackingCallbacks=i}getState(){return this.state}getSnapRadius(){return k.game.snapRadiusPx}getTarget(){return this.config.target}getInputMode(){return this.config.input}getBlueprint(i){return this.registry.get(i)}getPrimitive(i){return this.registry.getPrimitive(i)}getPiecesInSector(i){const r=this.state.sectors[i];return r?r.pieces:[]}isSectorCompleted(i){var r;return!!((r=this.state.sectors[i])!=null&&r.completedAt)}markSectorCompleted(i){var r;const f=this.state.sectors[i];!f||f.completedAt||(f.completedAt=iu(),(r=this.trackingCallbacks)!=null&&r.onSectorCompleted&&this.trackingCallbacks.onSectorCompleted(i),Object.values(this.state.sectors).every(h=>!!h.completedAt)&&!this.state.endedAt&&(this.state.endedAt=iu()))}spawnFromBlueprint(i,r){const f=Xh(),h={id:f,blueprintId:i.id,pos:zi({},r)};return this.getFloating().pieces.push(h),this.notifyStateChange(),f}move(i,r){const f=this.findPiece(i);f&&(f.pos=zi({},r),this.notifyStateChange())}drop(i,r){const f=this.findPiece(i);if(!f)return;const h=this.findPieceLocation(i);if(this.removeFromCurrent(i),h!=null&&h.sectorId&&delete f.sectorId,!r){this.getFloating().pieces.push(f),this.notifyStateChange();return}if(this.isSectorCompleted(r)){this.notifyStateChange();return}const v=this.state.sectors[r];v&&(v.pieces.push(f),f.sectorId=r,this.notifyStateChange())}remove(i){const r=this.findPieceLocation(i);r&&(r.array.splice(r.index,1),this.notifyStateChange())}findPiece(i){var r;for(const f of Object.values(this.state.sectors)){const h=f.pieces.find(v=>v.id===i);if(h)return h}return(r=this.getFloating().pieces.find(f=>f.id===i))!=null?r:null}getFloating(){return this._floating||(this._floating={sectorId:"-floating-",pieces:[]}),this._floating}findPieceLocation(i){for(const h of Object.values(this.state.sectors)){const v=h,b=v.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:v.sectorId,array:v.pieces,index:b}}const r=this.getFloating(),f=r.pieces.findIndex(h=>h.id===i);return f>=0?{array:r.pieces,index:f}:null}removeFromCurrent(i){const r=this.findPieceLocation(i);r&&r.array.splice(r.index,1)}switchBlueprintView(){if(this.config.mode==="prep")return;const i=this.state.blueprintView==="primitives"?"quickstash":"primitives";this.state.blueprintView=i}isSubmitEnabled(){var i,r,f;if(this.config.mode!=="prep")return!0;const h=(i=this.config.minPiecesPerMacro)!=null?i:2,v=(r=this.config.maxCompositeSize)!=null?r:1/0,b=(f=this.config.requireAllSlots)!=null?f:!1,S=Object.values(this.state.sectors);let y=0;for(const m of S){const g=m.pieces.length;if(g>=h&&g<=v)y++;else if(g>0)return!1}return b?y===S.length:!0}snapshot(){return{perSector:Object.values(this.state.sectors).map(i=>{const r=i,f={sectorId:r.sectorId,pieceCount:r.pieces.length};return r.completedAt?Yh(zi({},f),{completedAt:r.completedAt}):f}),events:[],timeMs:iu()-this.t0,completed:!!this.state.endedAt}}}function jh(c,i,r,f=1e-9){const h=(r.y-i.y)*(c.x-i.x)-(r.x-i.x)*(c.y-i.y);if(Math.abs(h)>f)return!1;const v=Math.min(i.x,r.x)-f,b=Math.max(i.x,r.x)+f,S=Math.min(i.y,r.y)-f,y=Math.max(i.y,r.y)+f;return c.x>=v&&c.x<=b&&c.y>=S&&c.y<=y}function cu(c,i){for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[h],b=i[f];if(!(!v||!b)&&jh(c,v,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[f],b=i[h];if(!v||!b)continue;const S=v.x,y=v.y,m=b.x,g=b.y;y>c.y!=g>c.y&&c.x<(m-S)*(c.y-y)/(g-y+1e-12)+S&&(r=!r)}return r}function co(c,i,r){let f=1/0,h=-1/0;for(const v of c){const b=v.x*i+v.y*r;b<f&&(f=b),b>h&&(h=b)}return{min:f,max:h}}const mn=1e-6;function Qh(c,i){const r=[c,i];for(const f of r)for(let h=0;h<f.length;h++){const v=f[h],b=f[(h+1)%f.length];if(!v||!b)continue;const S=b.x-v.x,y=-(b.y-v.y),m=S,g=co(c,y,m),E=co(i,y,m);if(g.max<=E.min+mn||E.max<=g.min+mn)return!1}return!0}function Vh(c,i){const r=c.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let v=0;v<i.length;v++){const b=c[h],S=i[v],y=r[h],m=f[v];if(!(!b||!S||!y||!m)&&!(y.maxX<=m.minX+mn||m.maxX<=y.minX+mn||y.maxY<=m.minY+mn||m.maxY<=y.minY+mn)&&Qh(b,S))return!0}return!1}function Zh(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b,cx:(i+f)/2,cy:(r+h)/2}}function fo(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b}}function oo(c){return fo(c.shape)}function Lh(c,i){if(c.shape&&c.shape.length)return fo(c.shape);let r=1/0,f=1/0,h=-1/0,v=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=oo(m),E=y.offset.x+g.min.x,R=y.offset.y+g.min.y,w=y.offset.x+g.max.x,j=y.offset.y+g.max.y;E<r&&(r=E),R<f&&(f=R),w>h&&(h=w),j>v&&(v=j)}const b=Math.max(0,h-r),S=Math.max(0,v-f);return{min:{x:r,y:f},max:{x:h,y:v},width:b,height:S}}function It(c,i){return"parts"in c?Lh(c,i):oo(c)}const Me=k.layout.grid.stepPx;function vn(c,i,r){const f=r.x-i.min.x,h=r.y-i.min.y;return("shape"in c&&c.shape?c.shape:[]).map(v=>v.map(b=>({x:b.x+f,y:b.y+h})))}function ia(c,i){const r=i.min.x+i.width/2,f=i.min.y+i.height/2,h="shape"in c&&c.shape&&c.shape.length?c.shape:[[{x:i.min.x,y:i.min.y},{x:i.min.x+i.width,y:i.min.y},{x:i.min.x+i.width,y:i.min.y+i.height},{x:i.min.x,y:i.min.y+i.height}]],v=[];for(const b of h)for(const S of b)v.push({x:S.x-r,y:S.y-f});return v}function ca(c,i,r,f,h,v){const b=c+r.aabb.width/2,S=i+r.aabb.height/2,y=b-f.cx,m=S-f.cy,g=Math.hypot(y,m);if(g===0)return{x:c,y:i};const E=y/g,R=m/g;let w=-1/0,j=-1/0;for(const J of r.support){const I=J.x*E+J.y*R;I>w&&(w=I);const st=-(J.x*E+J.y*R);st>j&&(j=st)}if(h==="workspace"){const[J,I]=f.bands.workspace,st=v?0:J+j,dt=I-w,Z=Math.min(Math.max(g,st),dt);if(Math.abs(Z-g)<1e-6)return{x:c,y:i};const lt=f.cx+Z*E,V=f.cy+Z*R;return{x:lt-r.aabb.width/2,y:V-r.aabb.height/2}}else{const J=f.bands.silhouette[1]-w;if(g<=J)return{x:c,y:i};const I=f.cx+J*E,st=f.cy+J*R;return{x:I-r.aabb.width/2,y:st-r.aabb.height/2}}}function ro(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function Kh(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ro(i,b):b),S&&(i=i?ro(i,S):S)}return i||1}function so(c,i,r){if(!c||c.length===0)return[];const f=Zh(c),h=(f.min.x+f.max.x)/2,v=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Me)*Me,S=Math.round(r.cy/Me)*Me,y=b-i*h,m=S-i*v,g=Math.round(y/Me)*Me,E=Math.round(m/Me)*Me;return c.map(R=>R.map(w=>({x:i*w.x+g,y:i*w.y+E})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Me)*Me,h=Math.ceil(c.y/Me)*Me;for(let v=h;v<=i.y;v+=Me)for(let b=f;b<=i.x;b+=Me)r.push({x:b,y:v});return r}function Di(c,i,r,f){const[h,v]=i.bands[r],b=[];for(const S of c){const y=S.x-i.cx,m=S.y-i.cy,g=Math.hypot(y,m);if(!(g<h||g>v)){if(f){let E=Math.atan2(m,y);if(i.mode==="circle"?E<-Math.PI/2&&(E+=2*Math.PI):E<Math.PI&&(E+=2*Math.PI),E<f.start||E>=f.end)continue}b.push(S)}}return b}function kh(c,i,r=cu){const f=[];t:for(const h of c)for(const v of i)if(r(h,v)){f.push(h);continue t}return f}function Jh(c){const i={x:c.cx-c.innerR,y:c.cy-c.innerR-6},r={x:c.cx+c.innerR,y:c.cy+c.innerR+6},f=fu(i,r),h=[];for(const v of f){const b=v.x-c.cx,S=v.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(v)}return h}const ou=(c,i=Me)=>c*Math.SQRT2*i;function ho(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function $h(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ho(i,b):b),S&&(i=i?ho(i,S):S)}return i||1}function Ph(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:v,cy:b}}function yo(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:v,primitivesSlots:b,gridPx:S=k.layout.grid.stepPx,reqWorkspaceDiamAnchors:y=k.layout.constraints.workspaceDiamAnchors,reqQuickstashDiamAnchors:m=k.layout.constraints.quickstashDiamAnchors,reqPrimitiveDiamAnchors:g=k.layout.constraints.primitiveDiamAnchors}=c,E=((i=c.masks)!=null?i:[]).flat(),R=E.length?$h(E):0,w=R?2*S/R:1;let j=0;if(c.masks&&c.masks.length)for(const G of c.masks){if(!(G!=null&&G.length))continue;const $=Ph(G),{cx:Y,cy:d}=$;for(const z of G)for(const q of z){const C=(q.x-Y)*w,K=(q.y-d)*w,ft=Math.hypot(C,K);ft>j&&(j=ft)}}const J=f==="circle"?Math.PI*2:Math.PI,I=J/Math.max(1,r),st=J/Math.max(1,v),dt=J/Math.max(1,b),Z=Math.sin(I/2),lt=Math.sin(st/2),V=Math.sin(dt/2),ht=ou(y,S),P=ou(m,S),nt=ou(g,S),tt=P*(.5+1/(2*Math.max(1e-9,lt))),mt=nt*(.5+1/(2*Math.max(1e-9,V))),Ot=ht/(2*Math.max(1e-9,Z))-ht/2,L=Math.max(tt,mt,Ot),bt=ht,ct=h==="workspace"?2*j:0,Tt=bt+ct,D=L+Tt;return{innerR_min:L,dr_min:Tt,outerR_min:D,Tw_min:bt,Tp_min:ct,Rshape_px_max:j}}function Ih(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:v,D_ws_px:b}=c,S=f+h;if(i<r+S){const st=r+S;return{innerR:r,Tw:f,Tp:h,outerR:st}}const y=i,m=r,g=y-m,E=Math.max(0,g-S),R=1,w=1+v/Math.max(1e-9,b),j=E*(R/(R+w)),J=f+j,I=g-J;return{innerR:m,Tw:J,Tp:I,outerR:y}}function Wh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=yo(c);if(i==="circle"){const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h}}else{const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h/2}}}function Fh(c,i,r,f="circle",h="workspace",v){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,E=f==="semicircle"?c.h-y:g,R=Math.min(m,E)-y,w=yo({n:i,layoutMode:f,target:h,qsMaxSlots:v.qsMaxSlots,primitivesSlots:v.primitivesSlots,masks:(b=v.masks)!=null?b:[]});let j,J,I;if(h==="workspace"){const ht=ou(k.layout.constraints.workspaceDiamAnchors),P=Ih({outerRViewportBound:R,innerR_min:w.innerR_min,Tw_min:w.Tw_min,Tp_min:w.Tp_min,Rshape_px_max:w.Rshape_px_max,D_ws_px:ht});j=P.innerR,J=P.outerR,I={workspace:[P.innerR,P.innerR+P.Tw],silhouette:[P.innerR+P.Tw,P.outerR]}}else J=Math.max(R,w.outerR_min),j=Math.min(w.innerR_min,J),J<w.outerR_min&&(J=w.outerR_min,j=w.innerR_min),I={silhouette:[j,J],workspace:[j,J]};const st=f==="circle"?Math.PI*2:Math.PI,dt=f==="circle"?-Math.PI/2:Math.PI,Z=dt+st,lt=st/i,V=[];for(let ht=0;ht<i;ht++){const P=(S=r[ht])!=null?S:String(ht),nt=dt+ht*lt,tt=nt+lt,mt=(nt+tt)/2;V.push({id:P,index:ht,start:nt,end:tt,mid:mt})}return{mode:f,cx:m,cy:g,innerR:j,outerR:J,sectors:V,bands:I,sweepStart:dt,sweepEnd:Z}}function Ri(c,i,r,f,h,v){const b=v-h>Math.PI?1:0,S=c+r*Math.cos(h),y=i+r*Math.sin(h),m=c+f*Math.cos(h),g=i+f*Math.sin(h),E=c+f*Math.cos(v),R=i+f*Math.sin(v),w=c+r*Math.cos(v),j=i+r*Math.sin(v);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${E} ${R}`,`L ${w} ${j}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function mo(c,i,r,f){var h;const v=c-r.cx,b=i-r.cy,S=Math.hypot(v,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,v);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const E of r.sectors)if(g>=E.start&&g<E.end)return E.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function Ui(c,i,r,f=.85){const[h,v]=c.bands[r],b=(h+v)/2,S=v-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),E=c.cy+b*Math.sin(i.mid);return{cx:g,cy:E,w:y,h:m}}function t0(c){const i=[];for(let r=0;r<c.length;r++){const f=c[r],h=c[(r+1)%c.length];f&&h&&i.push(`M ${f.x} ${f.y} L ${h.x} ${h.y}`)}return i}function Bi(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),w=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),J=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:w},b:{x:j,y:J}})}return f}function fa(c,i,r,f,h){let v;try{v=f(c.blueprintId)}catch(w){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",w),[]}if(!(v!=null&&v.shape))return[];const b=v.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=It(v,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,E=b.map(w=>({x:w.x+m,y:w.y+g})),R=[];for(let w=0;w<E.length;w++){const j=E[w],J=E[(w+1)%E.length];if(!j||!J){R.push(!1);continue}const I=Bi(j,J,S);let st=!1;if(c.blueprintId.startsWith("comp:"))for(let dt=0;dt<v.shape.length;dt++){if(dt===i)continue;const Z=v.shape[dt];if(!Z)continue;const lt=Z.map(V=>({x:V.x+m,y:V.y+g}));for(let V=0;V<lt.length;V++){const ht=lt[V],P=lt[(V+1)%lt.length];if(!ht||!P)continue;const nt=Bi(ht,P,S);for(const tt of I)if(nt.some(mt=>tt.a.x===mt.a.x&&tt.a.y===mt.a.y&&tt.b.x===mt.b.x&&tt.b.y===mt.b.y||tt.a.x===mt.b.x&&tt.a.y===mt.b.y&&tt.b.x===mt.a.x&&tt.b.y===mt.a.y)){st=!0;break}if(st)break}if(st)break}if(!st&&k.game.hideTouchingBorders)for(const dt of r){if(dt.id===c.id)continue;const Z=f(dt.blueprintId);if(!(Z!=null&&Z.shape))continue;const lt=It(Z,h),V=dt.pos.x-lt.min.x,ht=dt.pos.y-lt.min.y;for(const P of Z.shape){const nt=P.map(tt=>({x:tt.x+V,y:tt.y+ht}));for(let tt=0;tt<nt.length;tt++){const mt=nt[tt],Ot=nt[(tt+1)%nt.length];if(!mt||!Ot)continue;const L=Bi(mt,Ot,S);for(const bt of I)if(L.some(ct=>bt.a.x===ct.a.x&&bt.a.y===ct.a.y&&bt.b.x===ct.b.x&&bt.b.y===ct.b.y||bt.a.x===ct.b.x&&bt.a.y===ct.b.y&&bt.b.x===ct.a.x&&bt.b.y===ct.a.y)){st=!0;break}if(st)break}if(st)break}if(st)break}R.push(st)}return R}function e0(c){return k.game.hideTouchingBorders}var l0=Object.defineProperty,n0=Object.defineProperties,a0=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,u0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,po=(c,i,r)=>i in c?l0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ru=(c,i)=>{for(var r in i||(i={}))u0.call(i,r)&&po(c,r,i[r]);if(vo)for(var r of vo(i))i0.call(i,r)&&po(c,r,i[r]);return c},su=(c,i)=>n0(c,a0(i));function Ni(c){return`M ${c.map(i=>`${i.x} ${i.y}`).join(" L ")} Z`}function c0(c){const{controller:i,layout:r,viewBox:f,width:h,height:v,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:E,draggingId:R,selectedPieceId:w,dragInvalid:j,lockedPieceId:J,svgRef:I,setPieceRef:st,onPiecePointerDown:dt,onBlueprintPointerDown:Z,onRootPointerDown:lt,onPointerMove:V,onPointerUp:ht,onCenterBadgePointerDown:P}=c,nt=f.w,tt=f.h,mt=i.state.blueprintView,Ot=mt==="primitives"?i.state.primitives:i.state.quickstash,L=i.state.cfg.maxQuickstashSlots,bt=i.state.primitives.length,ct=mt==="primitives"?Math.max(1,bt):Math.max(1,L),Tt=(r.mode==="circle"?Math.PI*2:Math.PI)/ct,D=r.mode==="circle"?-Math.PI/2:Math.PI,G=N=>D+(N+.5)*Tt,$=(N,at=k.layout.grid.stepPx)=>N*Math.SQRT2*at,Y=mt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=$(Y),z=d/(2*Math.max(1e-9,Math.sin(Tt/2))),q=b+k.size.centerBadge.marginPx+d/2,C=r.innerR-(b+k.size.centerBadge.marginPx),K=Math.min(Math.max(z,q),C),ft=(N,at,W)=>{const ut=It(N,xt=>i.getPrimitive(xt)),rt=ut.min.x+ut.width/2,X=ut.min.y+ut.height/2;return et.createElement("g",{key:N.id,transform:`translate(${at}, ${W}) scale(1) translate(${-rt}, ${-X})`},("shape"in N?N.shape:[]).map((xt,vt)=>et.createElement("path",{key:vt,d:Ni(xt),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>Z(Jt,N,{bx:at,by:W,cx:rt,cy:X})})))};return et.createElement("svg",{ref:I,width:h,height:v,viewBox:`0 0 ${nt} ${tt}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:V,onPointerUp:ht,onPointerDown:N=>{lt(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,at)=>{const W=!!i.state.sectors[N.id].completedAt,ut=at%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,rt=at%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,X=r.bands.silhouette,xt=r.bands.workspace;return et.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?et.createElement(et.Fragment,null,et.createElement("path",{d:Ri(r.cx,r.cy,X[0],X[1],N.start,N.end),fill:ut,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),et.createElement("path",{d:Ri(r.cx,r.cy,xt[0],xt[1],N.start,N.end),fill:W?k.color.completion.fill:rt,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):et.createElement("path",{d:Ri(r.cx,r.cy,X[0],X[1],N.start,N.end),fill:W?k.color.completion.fill:ut,stroke:W?k.color.completion.stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}))}),g.sort((N,at)=>R===N.id?1:R===at.id?-1:0).map(N=>{const at=i.getBlueprint(N.blueprintId),W=It(at,Gt=>i.getPrimitive(Gt)),ut=R===N.id,rt=N.sectorId&&i.isSectorCompleted(N.sectorId),X=J===N.id,xt=w===N.id,vt=ut&&j,Jt=N.x-W.min.x,ee=N.y-W.min.y;return et.createElement("g",{key:N.id,ref:st(N.id),transform:`translate(${Jt}, ${ee})`,style:{cursor:rt?"default":E?"pointer":"grab"},pointerEvents:E&&ut?"none":"auto"},("shape"in at?at.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),et.createElement(et.Fragment,{key:Nt},et.createElement("path",{d:Ni(Gt),fill:X||vt?k.color.piece.invalidFill:ut?k.color.piece.draggingFill:k.color.piece.validFill,opacity:X||vt?k.opacity.piece.invalid:ut?k.opacity.piece.dragging:rt?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:Wt=>dt(Wt,N)}),(()=>{const Wt=g.filter(Q=>Q.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),Kt=Wt.map(Q=>su(ru({},Q),{pos:{x:Q.x,y:Q.y}})),$t=fa(Zt,Nt,Kt,Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)),Lt=R?Wt.find(Q=>Q.id===R):null;let ae;if(N.blueprintId.startsWith("comp:")){const Q=fa(Zt,Nt,[],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt));ae=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt)):new Array($t.length).fill(!1)).map((yt,Ut)=>yt&&!Q[Ut])}else ae=Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)):new Array($t.length).fill(!1);return t0(Gt).map((Q,yt)=>{const Ut=ae[yt]||!1;let ot;return ut&&N.blueprintId.startsWith("comp:")?ot=fa(Zt,Nt,[],At=>i.getBlueprint(At),At=>i.getPrimitive(At))[yt]||!1:ot=ut?!1:($t[yt]||!1)&&!Ut,et.createElement("path",{key:`stroke-${Nt}-${yt}`,d:Q,fill:"none",stroke:ot?"none":X||vt?k.color.piece.invalidStroke:xt||ut?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ot?0:xt||ut?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:At=>dt(At,N)})})})()))))}),r.sectors.map(N=>{var at;const W=(at=y.get(N.id))!=null?at:[];return W.length?et.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((ut,rt)=>et.createElement("path",{key:rt,d:Ni(ut),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:at,invalid:W})=>{const ut=N==="inner-ring";return et.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((rt,X)=>et.createElement("circle",{key:`inv-${X}`,cx:rt.x,cy:rt.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),at.map((rt,X)=>et.createElement("circle",{key:`val-${X}`,cx:rt.x,cy:rt.y,r:ut?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:ut?k.color.anchors.invalid:k.color.anchors.valid,opacity:ut?k.opacity.anchors.invalid:k.opacity.anchors.valid})))}),(()=>{const N=i.state.cfg.mode==="prep",at=N?i.isSubmitEnabled():!0,W=!R&&(!N||at);return et.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?P:void 0},et.createElement("circle",{r:b,fill:at?k.color.blueprint.badgeFill:"#ccc",opacity:at?1:.5}),et.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:at?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Ot.map((N,at)=>{const W=G(at),ut=r.cx+K*Math.cos(W),rt=r.cy+K*Math.sin(W);return ft(N,ut,rt)}),i.state.endedAt&&et.createElement("g",{pointerEvents:"none"},et.createElement("circle",{cx:r.cx,cy:r.cy,r:r.outerR-3,fill:"none",stroke:k.color.piece.allGreenStroke,strokeWidth:k.size.stroke.allGreenStrokePx,opacity:0},et.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),et.createElement("animate",{attributeName:"opacity",from:"1",to:"0",begin:"560ms",dur:"520ms",fill:"freeze"}))))}function f0(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const v of c)for(const b of v)b.x<i&&(i=b.x),b.y<r&&(r=b.y),b.x>f&&(f=b.x),b.y>h&&(h=b.y);return{minX:i,minY:r,maxX:f,maxY:h}}function o0(c,i,r,f){const h=k.layout.grid.stepPx,v=Math.floor((c-h/2)/h)*h+h/2,b=Math.floor((i-h/2)/h)*h+h/2,S=[];for(let y=b;y<=f;y+=h)for(let m=v;m<=r;m+=h)S.push({x:m,y});return S}function du(c){if(!c.length)return new Set;const{minX:i,minY:r,maxX:f,maxY:h}=f0(c),v=o0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of v)for(const m of c)if(cu(y,m)){S.add(b(y));continue t}return S}function r0(c,i){if(!c.length)return!1;const r=du(c);if(r.size===0)return!1;const f=du(i);if(f.size===0)return!1;for(const h of r)if(!f.has(h))return!1;return!0}function s0(c){const i=[];for(const r of c){const[f,h]=r.split(",");i.push({x:Number(f),y:Number(h)})}return i}function go(c){if(c.size===0)return c;const i=s0(c);let r=1/0,f=1/0;for(const v of i)v.x<r&&(r=v.x),v.y<f&&(f=v.y);const h=new Set;for(const v of i)h.add(`${v.x-r},${v.y-f}`);return h}function d0(c,i){if(c.size!==i.size)return!1;for(const r of c)if(!i.has(r))return!1;return!0}function h0(c,i){if(!c.length)return!1;const r=du(c),f=du(i);if(r.size===0||f.size===0)return!1;const h=go(r),v=go(f);return d0(h,v)}function bo(c,i,r){return{x:c-r.bx+r.cx,y:i-r.by+r.cy}}function y0(c,i){return!c||c.length===0?[]:c.map(r=>r.map(f=>({x:i*f.x,y:i*f.y})))}function m0(c){const i=et.useMemo(()=>{const S=[];for(const m of Object.values(c.state.sectors))for(const g of m.pieces)S.push({id:g.id,blueprintId:g.blueprintId,x:g.pos.x,y:g.pos.y,sectorId:m.sectorId});const y=c._floating;if(y!=null&&y.pieces)for(const m of y.pieces)S.push({id:m.id,blueprintId:m.blueprintId,x:m.pos.x,y:m.pos.y});return S},[c.state.sectors,c._floating,c.updateCount]),r=et.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=et.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const E=c.getBlueprint(g.blueprintId),R=It(E,c.getPrimitive);y.push(...vn(E,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=et.useRef(new Map),v=et.useCallback(S=>{const y=c.state.sectors[S];return y?y.pieces.slice().sort((m,g)=>m.id<g.id?-1:1).map(m=>`${m.id}@${m.pos.x},${m.pos.y}`).join("|"):""},[c.state.sectors]),b=et.useCallback(S=>{const y=v(S),m=h.current.get(S);if(m&&m.sig===y)return m.polys;const g=f(S);return h.current.set(S,{sig:y,polys:g}),g},[v,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class v0{constructor(i){this.config=i}referenceVertex(i){var r,f;return(f=("shape"in i&&(r=i.shape)!=null&&r[0]?i.shape[0]:[{x:0,y:0}])[0])!=null?f:{x:0,y:0}}nearestNodeSnap(i,r,f,h){if(!h.length)return{tl:i,node:null,dist:1/0,accepted:!1};const v=It(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-v.min.x),y:i.y+(b.y-v.min.y)};let y=null,m=1/0;for(const R of h){const w=R.x-S.x,j=R.y-S.y,J=w*w+j*j;J<m&&(m=J,y=R)}const g=Math.sqrt(m),E=g<=this.config.snapRadiusPx;return{tl:y&&E?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:E}}snapTopLeftToNodes(i,r,f,h){const{tl:v}=this.nearestNodeSnap(i,r,f,h);return v}generateWorkspaceNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},v={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,v),S=Di(b,i,"silhouette",r);return kh(S,f,cu)}generateSilhouetteBandNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"silhouette",r)}insideAnySilhouette(i,r){for(const f of r)if(cu(i,f))return!0;return!1}polyFullyInside(i,r,f){var h;if(!i.length)return!0;if(!r.length)return!1;const v=(h=f!=null?f:this.config.densitySampleStepPx)!=null?h:Math.max(1,Math.round(k.layout.grid.stepPx/3));for(const b of i)if(!(b.length<2))for(let S=0;S<b.length;S++){const y=b[S],m=b[(S+1)%b.length];if(!y||!m)continue;const g=m.x-y.x,E=m.y-y.y,R=Math.hypot(g,E),w=Math.max(1,Math.ceil(R/v));for(let j=0;j<=w;j++){const J=j/w,I={x:y.x+J*g,y:y.y+J*E};if(!this.insideAnySilhouette(I,r))return!1}}return!0}}function p0(){return new v0({stepPx:k.layout.grid.stepPx,snapRadiusPx:k.game.snapRadiusPx,densitySampleStepPx:Math.max(1,Math.round(k.layout.grid.stepPx/3))})}const oa=p0();function Hi(c,i,r,f){const h=oa.nearestNodeSnap(c,i,r,f);return{tl:h.tl,node:h.node,dist:h.dist}}function g0(c,i,r){return oa.polyFullyInside(c,i,r)}function b0(c,i){return oa.generateWorkspaceNodes(c,i)}function S0(c,i,r){return oa.generateSilhouetteNodes(c,i,r)}function x0(c,i){return oa.generateSilhouetteBandNodes(c,i)}function M0(c,i,r){const f=c.state.cfg;return{anchorDots:et.useMemo(()=>{var h,v;const b=[];b.push({sectorId:"inner-ring",valid:Jh(i),invalid:[]});for(const S of i.sectors)if(f.target==="workspace")b.push({sectorId:S.id,valid:b0(i,S),invalid:[]});else{const y=(v=(h=c.state.cfg.sectors.find(I=>I.id===S.id))==null?void 0:h.silhouette.mask)!=null?v:[];if(!y||y.length===0)continue;const m=Ui(i,S,"silhouette",1),g=so(y,r,{cx:m.cx,cy:m.cy}),E=x0(i,S),R=S0(i,S,g),w=I=>`${I.x},${I.y}`,j=new Set(R.map(w)),J=E.filter(I=>!j.has(w(I)));b.push({sectorId:S.id,valid:R,invalid:J})}return b},[f.target,c.state.sectors,i,r])}}function A0(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),w=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),J=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:w},b:{x:j,y:J}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const v=It(h,r),b=c.pos.x-v.min.x,S=c.pos.y-v.min.y,y=[];for(const m of h.shape){const g=m.map(E=>({x:E.x+b,y:E.y+S}));for(let E=0;E<g.length;E++){const R=g[E],w=g[(E+1)%g.length];!R||!w||y.push(...A0(R,w,f))}}return y}function xo(c,i,r,f){if(i.length===0)return{isAttached:!0,attachedPieceIds:[],sharedEdgeLength:0};const h=k.layout.grid.stepPx,v=So(c,r,f,h);if(v.length===0)return{isAttached:!1,attachedPieceIds:[],sharedEdgeLength:0};let b=0;const S=[];for(const y of i){const m=So(y,r,f,h),g=v.filter(E=>m.some(R=>E.a.x===R.a.x&&E.a.y===R.a.y&&E.b.x===R.b.x&&E.b.y===R.b.y||E.a.x===R.b.x&&E.a.y===R.b.y&&E.b.x===R.a.x&&E.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function T0(c,i,r,f){if(i.length<=2)return!1;const h=i.filter(m=>m.id!==c.id);if(h.length<=1)return!1;const v=new Map;for(const m of h)v.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const E=h[m],R=h[g];!E||!R||xo(E,[R],r,f).isAttached&&(v.get(E.id).push(R.id),v.get(R.id).push(E.id))}const b=new Set,S=h[0];if(!S)return!1;function y(m){if(b.has(m))return;b.add(m);const g=v.get(m)||[];for(const E of g)y(E)}return y(S.id),b.size!==h.length}var E0=Object.defineProperty,O0=Object.defineProperties,_0=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,z0=Object.prototype.hasOwnProperty,D0=Object.prototype.propertyIsEnumerable,Ao=(c,i,r)=>i in c?E0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,R0=(c,i)=>{for(var r in i||(i={}))z0.call(i,r)&&Ao(c,r,i[r]);if(Mo)for(var r of Mo(i))D0.call(i,r)&&Ao(c,r,i[r]);return c},U0=(c,i)=>O0(c,_0(i));function B0(c,i,r,f,h,v,b,S,y,m,g){const E=c.state.cfg,R=E.input==="click",w=et.useRef(null),j=et.useRef(null),[J,I]=et.useState(null),st=et.useRef(new Map),[dt,Z]=et.useState(null);et.useEffect(()=>{J===null&&(j.current=null)},[J]);const lt=Y=>d=>{const z=st.current;d?z.set(Y,d):z.delete(Y)},V=(Y,d)=>{const z=w.current,q=z.createSVGPoint();q.x=Y,q.y=d;const C=z.getScreenCTM();if(!C)return{x:0,y:0};const K=q.matrixTransform(C.inverse());return{x:K.x,y:K.y}},ht=()=>{if(!j.current)return;const Y=j.current;Y.raf==null&&(Y.raf=requestAnimationFrame(()=>{Y.raf=null;const d=st.current.get(Y.id);d&&d.setAttribute("transform",`translate(${Y.tlx-Y.minx}, ${Y.tly-Y.miny})`)}))},P=(Y,d)=>mo(Y,d,i,E.target),nt=k.layout.grid.stepPx,tt=Y=>{if(!Y)return null;const d=Math.round(Y.x/nt),z=Math.round(Y.y/nt);return`${d},${z}`},mt=Y=>({x:Math.round(Y.x/nt)*nt,y:Math.round(Y.y/nt)*nt}),Ot=(Y,d)=>{if(!j.current)return;const z=j.current,q=mt(Y),C=tt(q);g!=null&&g.recordMouseMove&&(C!==z.pointerAnchorId||d!==z.pointerAnchorSectorId)&&g.recordMouseMove(q.x,q.y,d),z.pointerAnchor=q,z.pointerAnchorId=C,z.pointerAnchorSectorId=d},L=(Y,d,z)=>{if(!j.current)return;const q=j.current;q.snapAnchor=Y,q.snapAnchorId=tt(Y),q.snapAnchorSectorId=d,q.snapAnchorDist=Y&&z!==void 0?z:null},bt=(Y,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(Y,d,z)},ct=Y=>{const d=c.findPiece(Y);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=It(z,c.getPrimitive);return vn(z,q,d.pos).map(C=>C.map(K=>[K.x,K.y]))},Tt=(Y,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&J)return;if(E.mode==="prep"&&d.sectorId){const ut=c.getPiecesInSector(d.sectorId),rt=c.findPiece(d.id);if(rt&&T0(rt,ut,X=>c.getBlueprint(X),X=>c.getPrimitive(X))){Z(d.id),setTimeout(()=>Z(null),500);return}}if(R){Y.stopPropagation();const ut=c.getBlueprint(d.blueprintId),rt=It(ut,Gt=>c.getPrimitive(Gt)),X=ia(ut,rt),{x:xt,y:vt}=V(Y.clientX,Y.clientY),Jt=mt({x:xt,y:vt}),ee=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,ee),g){const Gt="kind"in ut?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},ct(d.id),d.sectorId)}j.current={id:d.id,dx:xt-d.x,dy:vt-d.y,tlx:d.x,tly:d.y,aabb:{width:rt.width,height:rt.height},minx:rt.min.x,miny:rt.min.y,support:X,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:Jt,pointerAnchorId:tt(Jt),pointerAnchorSectorId:ee,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),I(d.id),y();return}(z=w.current)==null||z.setPointerCapture(Y.pointerId);const q=c.getBlueprint(d.blueprintId),C=It(q,ut=>c.getPrimitive(ut)),K=ia(q,C),{x:ft,y:N}=V(Y.clientX,Y.clientY),at=mt({x:ft,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(at.x,at.y,W),g){const ut="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,ut,"sector",{x:d.x,y:d.y},ct(d.id),d.sectorId)}j.current={id:d.id,dx:ft-d.x,dy:N-d.y,tlx:d.x,tly:d.y,aabb:{width:C.width,height:C.height},minx:C.min.x,miny:C.min.y,support:K,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:at,pointerAnchorId:tt(at),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),I(d.id),y()},D=Y=>{var d,z,q,C,K,ft,N,at;const{x:W,y:ut}=V(Y.clientX,Y.clientY),rt=mt({x:W,y:ut}),X=Math.hypot(W-i.cx,ut-i.cy),xt=X<i.innerR?void 0:(d=P(W,ut))!=null?d:void 0;if(!j.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(rt.x,rt.y,xt);return}const vt=j.current,Jt=W-vt.dx,ee=ut-vt.dy;Ot({x:W,y:ut},xt);let Gt=ca(Jt,ee,{aabb:vt.aabb,support:vt.support},i,c.state.cfg.target,X<i.innerR);const Nt=Gt.x+vt.aabb.width/2,Wt=Gt.y+vt.aabb.height/2,Zt=Math.hypot(Nt-i.cx,Wt-i.cy)<i.innerR,Kt=Zt?null:P(Nt,Wt);let $t=null,Lt=null,ae=Kt!=null?Kt:void 0,Q=!1,yt=!1;if(Zt){const Ut=h.find(ot=>ot.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ot=f(vt.id);if(ot){const At=c.getBlueprint(ot.blueprintId),Mt=Hi(Gt,At,c.getPrimitive,Ut.valid);Gt=Mt.tl,$t=Mt.node,Lt=Mt.dist,ae=void 0}}vt.validSnap=!1}else if(Kt){const Ut=b(Kt),ot=h.find(Mt=>Mt.sectorId===Kt),At=E.target==="workspace"&&E.mode!=="prep"?(z=ot==null?void 0:ot.valid)!=null?z:[]:[...(q=ot==null?void 0:ot.valid)!=null?q:[],...(C=ot==null?void 0:ot.invalid)!=null?C:[]];if(At.length){const Mt=f(vt.id);if(Mt){const qe=c.getBlueprint(Mt.blueprintId),ze=Hi(Gt,qe,c.getPrimitive,At);if(Gt=ze.tl,$t=ze.node,Lt=ze.dist,ae=Kt,Ut)vt.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,nl=f(vt.id);let Te=!0;if(nl){const ce=c.getBlueprint(nl.blueprintId),dl=It(ce,c.getPrimitive),De=vn(ce,dl,Gt),Yi=r.filter(re=>re.id!==vt.id&&P(re.x+It(c.getBlueprint(re.blueprintId),c.getPrimitive).width/2,re.y+It(c.getBlueprint(re.blueprintId),c.getPrimitive).height/2)===Kt);for(const re of Yi){const al=c.getBlueprint(re.blueprintId),ul=It(al,c.getPrimitive),Ee=vn(al,ul,{x:re.x,y:re.y});if(Vh(De,Ee)){Te=!1;break}}if(E.target==="workspace"){if(E.mode==="prep"){const re=c.getPiecesInSector(Kt),al=re.filter(bn=>bn.id!==vt.id),ul=al.length===0,Ee=c.findPiece(vt.id),zl=Ee==null?void 0:Ee.sectorId,ra=(K=c.state.cfg.maxCompositeSize)!=null?K:0,yu=ra>0,sa=re.length-(zl===Kt?1:0),il=yu&&sa+1>ra;if(ul)vt.validSnap=Te&&!il,yt=il;else if(Ee){const bn=U0(R0({},Ee),{pos:{x:Gt.x,y:Gt.y}}),Gi=xo(bn,al,Ve=>c.getBlueprint(Ve),Ve=>c.getPrimitive(Ve));vt.validSnap=Te&&Gi.isAttached&&!il,yt=il}else vt.validSnap=Te&&!il,yt=il}else vt.validSnap=Te,yt=!1;Q=!Te}else{const re=zl=>`${zl.x},${zl.y}`,al=new Set(((ft=ot==null?void 0:ot.valid)!=null?ft:[]).map(re)),ul=!!ze.node&&al.has(re(ze.node))&&ze.dist<=(gn!=null?gn:0);let Ee=!1;if(ul){const zl=(N=v.get(Kt))!=null?N:[];Ee=g0(De,zl)}vt.validSnap=ul&&Ee&&Te,Q=!Te}}}}}}else vt.validSnap=c.state.cfg.target==="workspace",$t=null,Lt=null,ae=void 0,yt=!1;vt.overlaps=Q,vt.maxExceeded=yt,L($t,ae,Lt!=null?Lt:void 0),vt.tlx=Gt.x,vt.tly=Gt.y,vt.prevValidSnap!==vt.validSnap&&(vt.prevValidSnap=(at=vt.validSnap)!=null?at:!1,y()),ht()},G=()=>{var Y,d,z,q,C,K,ft,N,at,W,ut,rt;if(!j.current||R)return;const X=j.current;if(X.validSnap===!1){const Wt=c.findPiece(X.id),Zt=c.state.cfg,Kt=X.tlx+X.aabb.width/2,$t=X.tly+X.aabb.height/2,Lt=P(Kt,$t);let ae="outside_bounds";if(X.maxExceeded?ae="no_valid_anchor":X.overlaps?ae="overlapping":Lt&&(ae="no_valid_anchor"),bt({x:Kt,y:$t},"invalid_placement",{invalidPlacement:{reason:ae,attemptedSectorId:Lt!=null?Lt:void 0}}),Zt.mode==="prep"&&X.originalPos)c.move(X.id,{x:X.originalPos.x,y:X.originalPos.y}),g&&g.recordPlacedown("placed",X.originalPos.sectorId,{x:X.originalPos.x,y:X.originalPos.y},ct(X.id),(Y=X.snapAnchorId)!=null?Y:void 0,!1,(d=X.overlaps)!=null?d:!1);else{const Q=Wt==null?void 0:Wt.sectorId;c.remove(X.id),Q&&S(Q),g&&g.recordPlacedown("deleted",Q,void 0,void 0,(z=X.snapAnchorId)!=null?z:void 0,!1,(q=X.overlaps)!=null?q:!1)}j.current=null,I(null),y();return}j.current=null,X.raf&&(cancelAnimationFrame(X.raf),X.raf=null);const xt={x:X.tlx,y:X.tly},vt=xt.x+X.aabb.width/2,Jt=xt.y+X.aabb.height/2;if(Math.hypot(vt-i.cx,Jt-i.cy)<i.innerR){const Wt=c.findPiece(X.id),Zt=Wt==null?void 0:Wt.sectorId;c.remove(X.id),Zt&&S(Zt),g&&g.recordPlacedown("deleted",Zt,void 0,void 0,(C=X.snapAnchorId)!=null?C:void 0,!1,(K=X.overlaps)!=null?K:!1),I(null),y();return}const ee=P(vt,Jt);if(ee&&b(ee)){bt({x:vt,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ee}}),X.originalPos?(c.move(X.id,{x:X.originalPos.x,y:X.originalPos.y}),X.originalPos.sectorId&&c.drop(X.id,X.originalPos.sectorId),g&&g.recordPlacedown("placed",X.originalPos.sectorId,{x:X.originalPos.x,y:X.originalPos.y},ct(X.id),(ft=X.snapAnchorId)!=null?ft:void 0,!1,(N=X.overlaps)!=null?N:!1)):(c.remove(X.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(at=X.snapAnchorId)!=null?at:void 0,!1,(W=X.overlaps)!=null?W:!1)),I(null),y();return}c.move(X.id,xt),c.drop(X.id,ee);const Gt=ee?S(ee):!1,Nt=X.validSnap===void 0?!0:X.validSnap;g&&g.recordPlacedown("placed",ee,xt,ct(X.id),(ut=X.snapAnchorId)!=null?ut:void 0,Nt,(rt=X.overlaps)!=null?rt:!1,Gt),I(null),X.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},$=(Y,d,z)=>{var q,C,K,ft,N,at,W,ut;if(R&&J)return;Y.stopPropagation();const{x:rt,y:X}=V(Y.clientX,Y.clientY),xt=It(d,c.getPrimitive),vt=ia(d,xt);if(R){const $t=bo(rt,X,z),Lt={x:rt-($t.x-xt.min.x),y:X-($t.y-xt.min.y)},ae=Math.hypot(rt-i.cx,X-i.cy)<i.innerR,Q=ca(Lt.x,Lt.y,{aabb:xt,support:vt},i,c.state.cfg.target,ae),yt=c.spawnFromBlueprint(d,Q),Ut=mt({x:rt,y:X}),ot=(q=P(rt,X))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ot),g){const ce="kind"in d?"primitive":"composite";g.recordPickup(yt,d.id,ce,"blueprint",Q,ct(yt),void 0)}const At=Q;let Mt=At,qe=null;const ze=At.x+xt.width/2,gn=At.y+xt.height/2,nl=P(ze,gn);if(nl){const ce=h.find(De=>De.sectorId===nl),dl=c.state.cfg.target==="workspace"?(C=ce==null?void 0:ce.valid)!=null?C:[]:[...(K=ce==null?void 0:ce.valid)!=null?K:[],...(ft=ce==null?void 0:ce.invalid)!=null?ft:[]];if(dl.length){const De=Hi(At,d,c.getPrimitive,dl);Mt=De.tl,qe={node:De.node,dist:De.dist}}}c.move(yt,Mt),j.current={id:yt,dx:rt-Mt.x,dy:X-Mt.y,tlx:Mt.x,tly:Mt.y,aabb:xt,minx:xt.min.x,miny:xt.min.y,support:vt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:tt(Ut),pointerAnchorSectorId:ot,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Ot({x:rt,y:X},ot);const Te=(N=P(Mt.x+xt.width/2,Mt.y+xt.height/2))!=null?N:void 0;L((at=qe==null?void 0:qe.node)!=null?at:null,Te,qe==null?void 0:qe.dist),I(yt),y(),ht();return}(W=w.current)==null||W.setPointerCapture(Y.pointerId);const Jt=bo(rt,X,z),ee={x:rt-(Jt.x-xt.min.x),y:X-(Jt.y-xt.min.y)},Gt=Math.hypot(rt-i.cx,X-i.cy)<i.innerR,Nt=ca(ee.x,ee.y,{aabb:xt,support:vt},i,c.state.cfg.target,Gt),Wt=c.spawnFromBlueprint(d,Nt),Zt=mt({x:rt,y:X}),Kt=(ut=P(rt,X))!=null?ut:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,Kt),g){const $t="kind"in d?"primitive":"composite";g.recordPickup(Wt,d.id,$t,"blueprint",Nt,ct(Wt),void 0)}j.current={id:Wt,dx:rt-Nt.x,dy:X-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:xt,minx:xt.min.x,miny:xt.min.y,support:vt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:tt(Zt),pointerAnchorSectorId:Kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Ot({x:rt,y:X},Kt),L(null,void 0),I(Wt),y(),ht()};return{draggingId:J,dragInvalid:!!(j.current&&j.current.validSnap===!1),lockedPieceId:dt,svgRef:w,onPiecePointerDown:Tt,onBlueprintPointerDown:$,onPointerMove:D,onPointerUp:G,setPieceRef:lt,setDraggingId:I,dragRef:j}}function N0(c,i,r,f,h,v,b,S,y,m,g,E,R){const w=c.state.cfg,j=(ht,P)=>mo(ht,P,i,w.target),J=ht=>{const P=c.findPiece(ht);if(!P)return[];const nt=c.getBlueprint(P.blueprintId);if(!nt)return[];const tt=It(nt,c.getPrimitive);return vn(nt,tt,P.pos).map(mt=>mt.map(Ot=>[Ot.x,Ot.y]))},I=()=>{var ht,P,nt,tt,mt,Ot;const L=b.current;return{anchorId:(P=(ht=L==null?void 0:L.snapAnchorId)!=null?ht:L==null?void 0:L.pointerAnchorId)!=null?P:void 0,wasValid:(L==null?void 0:L.validSnap)!==!1,wasOverlapping:(nt=L==null?void 0:L.overlaps)!=null?nt:!1,anchorX:(tt=L==null?void 0:L.pointerAnchor)==null?void 0:tt.x,anchorY:(mt=L==null?void 0:L.pointerAnchor)==null?void 0:mt.y,sectorId:(Ot=L==null?void 0:L.snapAnchorSectorId)!=null?Ot:L==null?void 0:L.pointerAnchorSectorId}},st=(ht,P,nt)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(ht,P,nt)},[dt,Z]=et.useState(null),[lt,V]=et.useState(null);return{pendingBpId:dt,selectedPieceId:lt,onRootPointerDown:ht=>{var P,nt;const{x:tt,y:mt}=g(ht.clientX,ht.clientY);if(f){const Ot=j(tt,mt);if(h&&b.current){const L=b.current,bt=L.tlx+L.aabb.width/2,ct=L.tly+L.aabb.height/2;if(S(tt,mt)){const $=c.findPiece(L.id),Y=$==null?void 0:$.sectorId,d=I();c.remove(L.id),Y&&m(Y),R&&R.recordPlacedown("deleted",Y,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),V(null),Z(null),E();return}if(Math.hypot(bt-i.cx,ct-i.cy)<i.innerR){const $=c.findPiece(L.id),Y=$==null?void 0:$.sectorId,d=I();c.remove(L.id),Y&&m(Y),R&&R.recordPlacedown("deleted",Y,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),V(null),Z(null),E();return}const Tt=j(bt,ct);if(!Tt){st({x:bt,y:ct},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),E();return}if(y(Tt)){st({x:bt,y:ct},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:Tt}}),E();return}if(L.validSnap===!1){const $=I().wasOverlapping?"overlapping":"no_valid_anchor";st({x:bt,y:ct},"invalid_placement",{invalidPlacement:{reason:$,attemptedSectorId:Tt}}),E();return}c.move(L.id,{x:L.tlx,y:L.tly}),c.drop(L.id,Tt);const D=I(),G=m(Tt);R&&R.recordPlacedown("placed",Tt,{x:L.tlx,y:L.tly},J(L.id),D.anchorId,D.wasValid,D.wasOverlapping,G),v(null),V(null),Z(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}if(lt){if(S(tt,mt)){const L=c.findPiece(lt),bt=L==null?void 0:L.sectorId;c.remove(lt),bt&&m(bt),R&&R.recordPlacedown("deleted"),V(null),E();return}if(Ot&&y(Ot)){V(null),E();return}if(Ot){const L=r.find(bt=>bt.id===lt);if(V(null),L){const bt=c.getBlueprint(L.blueprintId),ct=It(bt,c.getPrimitive),Tt=ia(bt,ct),D={x:tt-ct.width/2,y:mt-ct.height/2},G=ca(D.x,D.y,{aabb:{width:ct.width,height:ct.height},support:Tt},i,c.state.cfg.target,!1),$=(P=c.state.cfg.maxCompositeSize)!=null?P:0;if(c.state.cfg.mode==="prep"&&$>0&&c.getPiecesInSector(Ot).length-(L.sectorId===Ot?1:0)+1>$){E();return}c.move(L.id,{x:G.x,y:G.y}),c.drop(L.id,Ot),m(Ot),E()}return}V(null),E();return}if(dt){const L=j(tt,mt);if(S(tt,mt)||!L||y(L)){Z(null),E();return}const bt=c.getBlueprint(dt),ct=It(bt,c.getPrimitive),Tt=ia(bt,ct),D={x:tt-ct.width/2,y:mt-ct.height/2},G=ca(D.x,D.y,{aabb:{width:ct.width,height:ct.height},support:Tt},i,c.state.cfg.target,!1),$=c.spawnFromBlueprint(bt,G),Y=(nt=c.state.cfg.maxCompositeSize)!=null?nt:0;if(c.state.cfg.mode==="prep"&&Y>0&&c.getPiecesInSector(L).length+1>Y){c.remove($),Z(null),E();return}c.drop($,L),Z(null),m(L),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}}},clearSelection:()=>{V(null),Z(null)},setPendingBp:Z,setSelectedPiece:V}}const me=[];for(let c=0;c<256;++c)me.push((c+256).toString(16).slice(1));function H0(c,i=0){return(me[c[i+0]]+me[c[i+1]]+me[c[i+2]]+me[c[i+3]]+"-"+me[c[i+4]]+me[c[i+5]]+"-"+me[c[i+6]]+me[c[i+7]]+"-"+me[c[i+8]]+me[c[i+9]]+"-"+me[c[i+10]]+me[c[i+11]]+me[c[i+12]]+me[c[i+13]]+me[c[i+14]]+me[c[i+15]]).toLowerCase()}let qi;const q0=new Uint8Array(16);function C0(){if(!qi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qi=crypto.getRandomValues.bind(crypto)}return qi(q0)}var To={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,v,b;if(To.randomUUID&&!i&&!c)return To.randomUUID();c=c||{};const f=(b=(v=c.random)!=null?v:(h=c.rng)==null?void 0:h.call(c))!=null?b:C0();if(f.length<16)throw new Error("Random bytes length must be >= 16");return f[6]=f[6]&15|64,f[8]=f[8]&63|128,H0(f)}var Y0=Object.defineProperty,Eo=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,X0=Object.prototype.propertyIsEnumerable,Oo=(c,i,r)=>i in c?Y0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,_o=(c,i)=>{for(var r in i||(i={}))G0.call(i,r)&&Oo(c,r,i[r]);if(Eo)for(var r of Eo(i))X0.call(i,r)&&Oo(c,r,i[r]);return c};class w0{constructor(i,r,f,h){this.gridStep=k.layout.grid.stepPx,this.interactionIndex=0,this.currentPickup=null,this.previousSnapshotId=void 0,this.clickEvents=[],this.mouseTracking=[],this.interactions=[],this.completionTimes=[],this.createdMacros=[],this.controller=i,this.callbacks=r,this.trialId=f||hu(),this.gameId=h||hu(),this.trialStartTime=Date.now(),this.controller.setTrackingCallbacks({onSectorCompleted:v=>this.recordSectorCompletion(v)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,v,b,S){const y=this.toAnchorPoint(v),m=this.toAnchorVertices(b);this.currentPickup={pieceId:i,blueprintId:r,blueprintType:f,timestamp:Date.now(),source:h,sectorId:S,position:y,vertices:m}}recordPlacedown(i,r,f,h,v,b,S,y){if(!this.currentPickup){console.warn("[InteractionTracker] recordPlacedown called without pickup");return}const m=this.determineInteractionType(this.currentPickup.source,i),g=Date.now(),E=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),w=f?this.toAnchorPoint(f):void 0,j=h?this.toAnchorVertices(h):void 0,J={interactionId:hu(),trialId:this.trialId,gameId:this.gameId,interactionIndex:this.interactionIndex++,interactionType:m,pieceId:this.currentPickup.pieceId,blueprintId:this.currentPickup.blueprintId,blueprintType:this.currentPickup.blueprintType,pickupTimestamp:this.currentPickup.timestamp,pickupSource:this.currentPickup.source,pickupSectorId:this.currentPickup.sectorId,pickupPosition:this.currentPickup.position,pickupVertices:this.currentPickup.vertices,placedownTimestamp:g,placedownOutcome:i,wasValid:i==="placed"&&b===!0,wasOverlapping:i==="placed"&&S===!0,holdDuration:E,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(J.placedownSectorId=r),i==="placed"&&w&&(J.placedownPosition=w),i==="placed"&&j&&(J.placedownVertices=j),v&&(J.placedownAnchorId=v),this.previousSnapshotId!==void 0&&(J.preSnapshotId=this.previousSnapshotId),this.interactions.push(J),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(J),this.currentPickup=null,this.clickEvents=[],this.mouseTracking=[]}recordClickEvent(i,r,f){const h=this.toAnchorPoint(i);this.clickEvents.push(_o({timestamp:Date.now(),location:h,clickType:r},f))}recordMouseMove(i,r,f){const h=this.currentPickup?"while_holding":"before_pickup",v=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===v&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:v,anchorY:b,sectorId:f,phase:h})}recordSectorCompletion(i){this.completionTimes.push({sectorId:i,completedAt:Date.now()})}recordMacroCreation(i){this.createdMacros.push(i)}finalizeTrial(i){const r=Date.now(),f=r-this.trialStartTime,h=this.buildStateSnapshot();if(this.controller.state.cfg.mode==="construction"){const v=this.buildFinalBlueprintState(h),b=v.filter(y=>y.blueprintType==="composite").map(y=>_o({id:y.blueprintId,parts:y.parts},y.label&&{label:y.label})),S={trialType:"construction",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:i,completionTimes:this.completionTimes,finalBlueprintState:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const v=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=v.map(y=>({id:y.macroId.startsWith("comp:")?y.macroId:`comp:${y.macroId}`,parts:y.parts})),S={trialType:"prep",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:"submit",createdMacros:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}}determineInteractionType(i,r){return r==="deleted"?"delete":i==="blueprint"?"spawn":"move"}toAnchorValue(i){return Math.round(i/this.gridStep)}toAnchorPoint(i){return{x:this.toAnchorValue(i.x),y:this.toAnchorValue(i.y)}}toAnchorVertices(i){return i.map(r=>r.map(f=>[this.toAnchorValue(f[0]),this.toAnchorValue(f[1])]))}buildMacrosFromSnapshot(i){return i.sectors.map(r=>{const f=r.pieces.map(g=>{const E=this.controller.getBlueprint(g.blueprintId),R=E&&"kind"in E?E.kind:g.blueprintId,w=this.controller.findPiece(g.pieceId);if(!w||!E)return{kind:R,position:g.position};const j=It(E,this.controller.getPrimitive),J={x:w.pos.x-j.min.x,y:w.pos.y-j.min.y},I=this.toAnchorPoint(J);return{kind:R,position:I}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,v=0;for(const g of f)h+=g.position.x,v+=g.position.y;const b=Math.round(h/f.length),S=Math.round(v/f.length),y=f.map(g=>({kind:g.kind,anchorOffset:{x:Math.round(g.position.x-b),y:Math.round(g.position.y-S)}})),m=r.pieces.flatMap(g=>g.vertices||[]);return{macroId:r.sectorId,parts:y,shape:m,pieceCount:r.pieceCount}})}buildStateSnapshot(i){const r=hu(),f=Date.now(),h=[],v=[];for(const y of this.controller.state.cfg.sectors){const m=this.controller.state.sectors[y.id],g=y.id===i||!!(m!=null&&m.completedAt);g&&v.push(y.id);const E=((m==null?void 0:m.pieces)||[]).map(w=>({pieceId:w.id,blueprintId:w.blueprintId,blueprintType:this.getBlueprintType(w.blueprintId),position:this.toAnchorPoint(w.pos),vertices:this.getPieceVertices(w.id)})),R={sectorId:y.id,completed:g,pieceCount:E.length,pieces:E};(m==null?void 0:m.completedAt)!==void 0&&(R.completedAt=m.completedAt),h.push(R)}const b=this.controller.state.cfg.sectors.map(y=>({sectorId:y.id,tangramId:y.tangramId})),S={primitives:this.controller.state.primitives.map(y=>y.id),quickstash:this.controller.state.quickstash.map(y=>y.id)};return{snapshotId:r,timestamp:f,sectors:h,completedSectorIds:v,sectorTangramMap:b,blueprintOrder:S}}getBlueprintType(i){const r=this.controller.getBlueprint(i);return r?"kind"in r?"primitive":"composite":"primitive"}getPieceVertices(i){var r;const f=this.controller.findPiece(i);if(!f)return[];const h=this.controller.getBlueprint(f.blueprintId);if(!h)return[];const v=It(h,S=>this.controller.getPrimitive(S)),b=((r=vn(h,v,f.pos))!=null?r:[]).map(S=>S.map(y=>[y.x,y.y]));return this.toAnchorVertices(b)}buildFinalBlueprintState(i){const r=new Map;for(const f of i.sectors)for(const h of f.pieces){r.has(h.blueprintId)||r.set(h.blueprintId,{blueprintType:h.blueprintType,totalPieces:0,bySector:new Map});const v=r.get(h.blueprintId);v.totalPieces++,v.bySector.set(f.sectorId,(v.bySector.get(f.sectorId)||0)+1)}for(const f of this.controller.state.primitives)r.has(f.id)||r.set(f.id,{blueprintType:"primitive",totalPieces:0,bySector:new Map});for(const f of this.controller.state.quickstash)r.has(f.id)||r.set(f.id,{blueprintType:"composite",totalPieces:0,bySector:new Map});return Array.from(r.entries()).map(([f,h])=>{const v=this.controller.getBlueprint(f),b={blueprintId:f,blueprintType:h.blueprintType,totalPieces:h.totalPieces,bySector:Array.from(h.bySector.entries()).map(([S,y])=>({sectorId:S,count:y}))};return v&&(h.blueprintType==="composite"&&"parts"in v?(b.parts=v.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),v.label&&(b.label=v.label)):h.blueprintType==="primitive"&&"kind"in v&&(v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=v.kind)),b})}}var j0=Object.defineProperty,Q0=Object.defineProperties,V0=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,Z0=Object.prototype.hasOwnProperty,L0=Object.prototype.propertyIsEnumerable,Do=(c,i,r)=>i in c?j0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pn=(c,i)=>{for(var r in i||(i={}))Z0.call(i,r)&&Do(c,r,i[r]);if(zo)for(var r of zo(i))L0.call(i,r)&&Do(c,r,i[r]);return c},Ci=(c,i)=>Q0(c,V0(i));function K0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:E,height:R,onSectorComplete:w,onPiecePlace:j,onPieceRemove:J,onInteraction:I,onTrialEnd:st,onControllerReady:dt}=c,Z=et.useMemo(()=>{const Q=pn(pn(Ci(pn({n:i.length,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y},m!==void 0&&{maxCompositeSize:m}),{mode:g||"construction"}),c.minPiecesPerMacro!==void 0&&{minPiecesPerMacro:c.minPiecesPerMacro}),c.requireAllSlots!==void 0&&{requireAllSlots:c.requireAllSlots});return new wh(i,r,f,Q)},[i,r,f,h,v,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),lt=et.useMemo(()=>{if(!I&&!st)return null;const Q={};return I&&(Q.onInteraction=I),st&&(Q.onTrialEnd=st),new w0(Z,Q)},[Z,I,st]);et.useEffect(()=>{dt&&dt(Z)},[Z,dt]),et.useEffect(()=>()=>{lt&&lt.dispose()},[lt]);const{layout:V,viewBox:ht}=et.useMemo(()=>{const Q=i.length,yt=i.map(At=>At.id),Ut=i.map(At=>{var Mt;return(Mt=At.silhouette.mask)!=null?Mt:[]}),ot=Wh({n:Q,layoutMode:h,target:v,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:Fh({w:ot.LOGICAL_W,h:ot.LOGICAL_H},Q,yt,h,v,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ot.LOGICAL_W,h:ot.LOGICAL_H}}},[i,h,v,y,f.length]),[,P]=et.useReducer(Q=>Q+1,0);et.useEffect(()=>{dt&&dt(Z,V,P)},[Z,V,dt,P]);const[nt,tt]=et.useState(!1);et.useEffect(()=>{i.every(Q=>Z.isSectorCompleted(Q.id))&&!nt&&(tt(!0),lt&&setTimeout(()=>{lt.finalizeTrial("auto_complete")},0))},[Z.updateCount,i,nt,Z,lt]);const mt=et.useCallback(Q=>{w&&w(Q,Z.snapshot())},[w,Z]),Ot=et.useMemo(()=>({onSectorComplete:mt,onPiecePlace:j||(()=>{}),onPieceRemove:J||(()=>{})}),[mt,j,J]),L=()=>{const Q={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return Ci(pn({},Q),{width:`${yt}px`,height:`${yt}px`})}else{const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return Ci(pn({},Q),{width:`${yt}px`,height:`${Ut}px`})}},bt=(()=>{if(h==="circle"){const Q=Math.min(window.innerWidth*.96,window.innerHeight*.96);return{width:Q,height:Q}}else{const Q=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),yt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:Q,height:yt}}})();et.useEffect(()=>{if(Z.state.cfg.mode!=="construction"||!S||S<=0||nt)return;const Q=window.setTimeout(()=>{nt||(Z.state.endedAt||(Z.state.endedAt=performance.now(),P()),lt==null||lt.finalizeTrial("timeout"),tt(!0))},S);return()=>{window.clearTimeout(Q)}},[Z,S,nt,lt,P]);const ct=Q=>Z.isSectorCompleted(Q),{pieces:Tt,pieceById:D,getSectorPiecePolysCached:G}=m0(Z),$=Z.state.cfg.input==="click",Y=Math.max(k.size.centerBadge.minPx,V.innerR*k.size.centerBadge.fractionOfOuterR),d=Z.state.cfg.layout==="semicircle"?{x:V.cx,y:V.cy-Y-k.size.centerBadge.marginPx}:{x:V.cx,y:V.cy},z=(Q,yt)=>Math.hypot(Q-d.x,yt-d.y)<=Y,q=et.useMemo(()=>Z.state.cfg.sectors.map(Q=>{var yt;return(yt=Q.silhouette.mask)!=null?yt:[]}),[Z.state.cfg.sectors]),C=et.useMemo(()=>{const Q=Kh(q.flat());return Q?k.layout.grid.unitPx/Q:1},[q]),{anchorDots:K}=M0(Z,V,C),ft=et.useMemo(()=>{var Q,yt;const Ut=new Map;for(const ot of V.sectors){const At=(yt=(Q=Z.state.cfg.sectors.find(ze=>ze.id===ot.id))==null?void 0:Q.silhouette.mask)!=null?yt:[];if(!(At!=null&&At.length))continue;const Mt=Ui(V,ot,"silhouette",1),qe=so(At,C,{cx:Mt.cx,cy:Mt.cy});Ut.set(ot.id,qe)}return Ut},[V,C,Z.state.cfg.sectors]),N=Q=>{var yt,Ut,ot;if(!Q||ct(Q))return!1;if(Z.state.cfg.target==="silhouette"){const At=(yt=ft.get(Q))!=null?yt:[];if(!At.length)return!1;const Mt=G(Q);if(r0(At,Mt))return Z.markSectorCompleted(Q),!0}else{const At=(ot=(Ut=Z.state.cfg.sectors.find(ze=>ze.id===Q))==null?void 0:Ut.silhouette.mask)!=null?ot:[];if(!At.length)return!1;const Mt=y0(At,C),qe=G(Q);if(h0(Mt,qe))return Z.markSectorCompleted(Q),!0}return!1},at=B0(Z,V,Tt,D,K,ft,ct,N,P,void 0,lt),{draggingId:W,dragInvalid:ut,svgRef:rt,onPiecePointerDown:X,onBlueprintPointerDown:xt,onPointerMove:vt,onPointerUp:Jt,setPieceRef:ee,setDraggingId:Gt,lockedPieceId:Nt,dragRef:Wt}=at,Zt=(Q,yt)=>{const Ut=rt.current,ot=Ut.createSVGPoint();ot.x=Q,ot.y=yt;const At=Ut.getScreenCTM();if(!At)return{x:0,y:0};const Mt=ot.matrixTransform(At.inverse());return{x:Mt.x,y:Mt.y}},Kt=N0(Z,V,Tt,$,W,Gt,Wt,z,ct,N,Zt,P,lt),{selectedPieceId:$t,onRootPointerDown:Lt}=Kt,ae=Q=>{if(W)return;const{x:yt,y:Ut}=Zt(Q.clientX,Q.clientY);if(Z.state.cfg.mode==="prep"){if(!Z.isSubmitEnabled()||nt){Q.stopPropagation();return}tt(!0),lt&&lt.finalizeTrial("submit"),Q.stopPropagation();return}if(lt!=null&&lt.recordClickEvent){const ot=Z.state.blueprintView,At=ot==="primitives"?"quickstash":"primitives";lt.recordClickEvent({x:yt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ot,to:At}})}Z.switchBlueprintView(),P(),Q.stopPropagation()};return et.createElement("div",{className:"tangram-gameboard",style:L()},et.createElement(c0,pn({controller:Z,layout:V,viewBox:ht,width:bt.width,height:bt.height,badgeR:Y,badgeCenter:d,placedSilBySector:ft,anchorDots:K,pieces:Tt,clickMode:$,draggingId:W,selectedPieceId:$t,dragInvalid:ut,lockedPieceId:Nt,svgRef:rt,setPieceRef:ee,onPiecePointerDown:X,onBlueprintPointerDown:xt,onRootPointerDown:Lt,onPointerMove:vt,onPointerUp:Jt,onCenterBadgePointerDown:ae},Ot)))}const k0=40*Math.SQRT2,_e=k0/2,Ae=(c,i)=>({x:c,y:i});function J0(c,i){const r=c.length;if(r===0)return[];const f=(i%r+r)%r;return c.slice(f).concat(c.slice(0,f))}function $0(c,i,r,f,h,v){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Ae(r+v*Math.cos(b),f+v*Math.sin(b))}function P0(c,i,r){let f;if(r){const b=r[0],S=r[1],y=Ae(-b.x*40,b.y*40),m=Ae(-S.x*40,S.y*40);f=[y,m]}else{const b=c[0];if(b===void 0)throw new Error("No side lengths provided");f=[Ae(0,0),Ae(b,0)]}const h=J0(c,1),v=i;for(let b=1;b<c.length-1;b++){const S=f[b-1],y=f[b];if(!S||!y)continue;const m=h[b-1],g=v[b-1];m===void 0||g===void 0||f.push($0(S.x,S.y,y.x,y.y,g,m))}return f}const I0={smalltriangle:[Ae(0,0),Ae(.5,.5)],parallelogram:[Ae(0,0),Ae(.5,0)],largetriangle:[Ae(0,0),Ae(.5,-.5)],medtriangle:[Ae(0,0),Ae(.5,0)],square:[Ae(0,0),Ae(.5,0)]},W0=[{id:"prim:square",kind:"square",sideLens:[20,20,20,20,20,20,20,20],angles:[180,90,180,90,180,90,180,90],color:"#f43f5e"},{id:"prim:smalltriangle",kind:"smalltriangle",sideLens:[_e,_e,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,_e,_e,20,20,_e,_e],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:medtriangle",kind:"medtriangle",sideLens:[20,20,20,20,_e,_e,_e,_e],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:largetriangle",kind:"largetriangle",sideLens:[_e,_e,_e,_e,20,20,20,20,20,20,20,20],angles:[180,180,180,45,180,180,180,90,180,180,180,45],color:"#8b5cf6"}].map(({id:c,kind:i,sideLens:r,angles:f,color:h})=>{const v=I0[i],b=P0(r,f,v);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:v}=c,b=h.map(y=>({kind:y.kind,offset:{x:y.anchorOffset.x*r,y:y.anchorOffset.y*r}})),S=[];for(const y of h){const m=i.get(y.kind);if(!m)continue;const g={x:y.anchorOffset.x*r,y:y.anchorOffset.y*r};for(const E of m.shape)S.push(E.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:v!=null?v:`Composite-${f}`}}var ty=Object.defineProperty,Ro=Object.getOwnPropertySymbols,ey=Object.prototype.hasOwnProperty,ly=Object.prototype.propertyIsEnumerable,Uo=(c,i,r)=>i in c?ty(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,Bo=(c,i)=>{for(var r in i||(i={}))ey.call(i,r)&&Uo(c,r,i[r]);if(Ro)for(var r of Ro(i))ly.call(i,r)&&Uo(c,r,i[r]);return c};function ny(c,i,r){const{numQuickstashSlots:f,maxPiecesPerMacro:h,minPiecesPerMacro:v,inputMode:b,layoutMode:S,requireAllSlots:y,quickstashMacros:m,primitiveOrder:g,onInteraction:E,onTrialEnd:R}=i,w=[...W0].sort((st,dt)=>g.indexOf(st.kind)-g.indexOf(dt.kind)),j=Array.from({length:f},(st,dt)=>({id:`prep-sector-${dt}`,tangramId:`prep-sector-${dt}`,silhouette:{id:`prep-silhouette-${dt}`,mask:[]}})),J=zh.createRoot(c),I=(st,dt,Z)=>{if(m&&m.length>0&&dt){const lt=new Map;w.forEach(V=>lt.set(V.kind,V)),m.forEach((V,ht)=>{const P=`prep-sector-${ht}`,nt=F0(V,lt,k.layout.grid.stepPx),tt=dt.sectors.find(G=>G.id===P);if(!tt)return;const mt=Ui(dt,tt,"workspace",1);let Ot=1/0,L=1/0,bt=-1/0,ct=-1/0;nt.parts.forEach(G=>{const $=lt.get(G.kind);if(!$)return;const Y=It($,st.getPrimitive),d=G.offset.x+Y.min.x,z=G.offset.y+Y.min.y,q=G.offset.x+Y.max.x,C=G.offset.y+Y.max.y;Ot=Math.min(Ot,d),L=Math.min(L,z),bt=Math.max(bt,q),ct=Math.max(ct,C)});const Tt=Ot+(bt-Ot)/2,D=L+(ct-L)/2;nt.parts.forEach(G=>{const $=lt.get(G.kind);if(!$){console.warn(`Unknown primitive kind: ${G.kind}`);return}const Y=It($,st.getPrimitive),d=G.offset.x+Y.min.x,z=G.offset.y+Y.min.y,q=mt.cx+(d-Tt),C=mt.cy+(z-D),K=k.layout.grid.stepPx,ft=Math.round(q/K)*K,N=Math.round(C/K)*K,at=st.spawnFromBlueprint($,{x:ft,y:N});st.drop(at,P)})}),Z&&Z()}};return J.render(et.createElement(K0,Bo(Bo({sectors:j,quickstash:[],primitives:w,layout:S,target:"workspace",input:b,timeLimitMs:0,maxQuickstashSlots:0,maxCompositeSize:h,mode:"prep",minPiecesPerMacro:v,requireAllSlots:y,onControllerReady:I},E&&{onInteraction:E}),R&&{onTrialEnd:R}))),{root:J,display_element:c,jsPsych:r}}const ay={name:"tangram-prep",version:"1.0.0",parameters:{num_quickstash_slots:{type:Fe.ParameterType.INT,default:void 0},max_pieces_per_macro:{type:Fe.ParameterType.INT,default:2},min_pieces_per_macro:{type:Fe.ParameterType.INT,default:2},input:{type:Fe.ParameterType.STRING,default:"click"},layout:{type:Fe.ParameterType.STRING,default:"semicircle"},require_all_slots:{type:Fe.ParameterType.BOOL,default:void 0},quickstash_macros:{type:Fe.ParameterType.COMPLEX,default:[],description:"Array of AnchorComposite objects to edit as primitive pieces"},primitive_order:{type:Fe.ParameterType.OBJECT,default:["square","smalltriangle","parallelogram","medtriangle","largetriangle"],description:"Array of primitive names in the order they should be displayed"},onInteraction:{type:Fe.ParameterType.FUNCTION,default:void 0},onTrialEnd:{type:Fe.ParameterType.FUNCTION,default:void 0}},data:{completed:{type:Fe.ParameterType.BOOL}},citations:""};class No{constructor(i){this.jsPsych=i}trial(i,r){const f=y=>{r.onTrialEnd&&r.onTrialEnd(y);const m=i.__reactContext;m!=null&&m.root&&m.root.unmount(),i.innerHTML="",this.jsPsych.finishTrial(y)},h={numQuickstashSlots:r.num_quickstash_slots,maxPiecesPerMacro:r.max_pieces_per_macro,minPiecesPerMacro:r.min_pieces_per_macro,inputMode:r.input,layoutMode:r.layout,requireAllSlots:r.require_all_slots,quickstashMacros:r.quickstash_macros,primitiveOrder:r.primitive_order,onInteraction:r.onInteraction,onTrialEnd:f},{root:v,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:v,jsPsych:S}}}return No.info=ay,No}(jsPsychModule);
42
42
  //# sourceMappingURL=index.browser.min.js.map