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.
- package/dist/construct/index.browser.js +13 -12
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +1 -1
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +13 -12
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.js +13 -12
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +13 -12
- package/dist/prep/index.browser.js.map +1 -1
- package/dist/prep/index.browser.min.js +1 -1
- package/dist/prep/index.browser.min.js.map +1 -1
- package/dist/prep/index.cjs +13 -12
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.js +13 -12
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/config/config.ts +13 -12
- package/tangram-construct.min.js +1 -1
- package/tangram-prep.min.js +1 -1
package/tangram-construct.min.js
CHANGED
|
@@ -38,5 +38,5 @@ var TangramConstructPlugin=function(Me){"use strict";function gh(c,i){return i.f
|
|
|
38
38
|
`+v[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{ji=!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 Qi(t.type,!1);case 11:return Qi(t.type.render,!1);case 1:return Qi(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 Le(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 vu(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 ke(t){return t.replace(sy,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function Vi(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=""+Le(e)):t.value!==""+Le(e)&&(t.value=""+Le(e)):o!=="submit"&&o!=="reset"||t.removeAttribute("value"),e!=null?Zi(t,o,Le(e)):l!=null?Zi(t,o,Le(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=""+Le(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?""+Le(l):"",e=e!=null?""+Le(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 Zi(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=""+Le(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=""+Le(e),e!==t.value&&(t.value=e),l==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=l!=null?""+Le(l):""}function Lo(t,e,l,n){if(e==null){if(n!=null){if(l!=null)throw Error(f(92));if(Et(n)){if(1<n.length)throw Error(f(93));n=n[0]}l=n}l==null&&(l=""),e=l}l=Le(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 Li(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 Ki(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[Ue]||null;t:switch(t=e.stateNode,e.type){case"input":if(Vi(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="'+ke(""+e)+'"][type="radio"]'),e=0;e<l.length;e++){var n=l[e];if(n!==t&&n.form===t.form){var a=n[Ue]||null;if(!a)throw Error(f(90));Vi(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 Ji=!1;function Po(t,e,l){if(Ji)return t(e,l);Ji=!0;try{var n=t(e);return n}finally{if(Ji=!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[Ue]||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,$i=null,Su=null;function $o(){if(Su)return Su;var t,e=$i,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 Be(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},Tu=Be(Wl),pa=g({},Wl,{view:0,detail:0}),my=Be(pa),Ii,Wi,va,Au=g({},pa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:tc,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!==va&&(va&&t.type==="mousemove"?(Ii=t.screenX-va.screenX,Wi=t.screenY-va.screenY):Wi=Ii=0,va=t),Ii)},movementY:function(t){return"movementY"in t?t.movementY:Wi}}),Wo=Be(Au),py=g({},Au,{dataTransfer:0}),vy=Be(py),gy=g({},pa,{relatedTarget:0}),Fi=Be(gy),by=g({},Wl,{animationName:0,elapsedTime:0,pseudoElement:0}),Sy=Be(by),xy=g({},Wl,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),My=Be(xy),Ty=g({},Wl,{data:0}),Fo=Be(Ty),Ay={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 tc(){return _y}var zy=g({},pa,{key:function(t){if(t.key){var e=Ay[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:tc,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=Be(zy),Ry=g({},Au,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tr=Be(Ry),Uy=g({},pa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:tc}),By=Be(Uy),Ny=g({},Wl,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=Be(Ny),qy=g({},Au,{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=Be(qy),Yy=g({},Wl,{newState:0,oldState:0}),Gy=Be(Yy),Xy=[9,13,27,32],ec=yl&&"CompositionEvent"in window,ga=null;yl&&"documentMode"in document&&(ga=document.documentMode);var wy=yl&&"TextEvent"in window&&!ga,er=yl&&(!ec||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"||!ec&&ar(t,e)?(t=$o(),Su=$i=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 Tu("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 lc;if(yl){var nc="oninput"in document;if(!nc){var rr=document.createElement("div");rr.setAttribute("oninput","return;"),nc=typeof rr.oninput=="function"}lc=nc}else lc=!1;or=lc&&(!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,Ki(t)),Po(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 Py(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Ye=typeof Object.is=="function"?Object.is:Py;function xa(t,e){if(Ye(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(!St.call(e,a)||!Ye(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 pr(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 ac(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 $y=yl&&"documentMode"in document&&11>=document.documentMode,Un=null,uc=null,Ma=null,ic=!1;function vr(t,e,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;ic||Un==null||Un!==gu(n)||(n=Un,"selectionStart"in n&&ac(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(uc,"onSelect"),0<n.length&&(e=new Tu("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")},cc={},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(cc[t])return cc[t];if(!Bn[t])return t;var e=Bn[t],l;for(l in e)if(e.hasOwnProperty(l)&&l in gr)return cc[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"),Tr=new Map,fc="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(" ");fc.push("scrollEnd");function tl(t,e){Tr.set(t,e),Il(e,[t])}var Ar=new WeakMap;function Ke(t,e){if(typeof t=="object"&&t!==null){var l=Ar.get(t);return l!==void 0?l:(e={value:t,source:e,stack:wo(e)},Ar.set(t,e),e)}return{value:t,source:e,stack:wo(e)}}var Je=[],Nn=0,oc=0;function Ou(){for(var t=Nn,e=oc=Nn=0;e<t;){var l=Je[e];Je[e++]=null;var n=Je[e];Je[e++]=null;var a=Je[e];Je[e++]=null;var u=Je[e];if(Je[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){Je[Nn++]=t,Je[Nn++]=e,Je[Nn++]=l,Je[Nn++]=n,oc|=n,t.lanes|=n,t=t.alternate,t!==null&&(t.lanes|=n)}function rc(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-xt(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,vf=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 Ge(t,e,l,n){return new tm(t,e,l,n)}function sc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function ml(t,e){var l=t.alternate;return l===null?(l=Ge(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")sc(t)&&(o=1);else if(typeof t=="string")o=lp(t,l,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case et:return t=Ge(31,l,e,a),t.elementType=et,t.lanes=u,t;case w:return en(l.children,a,u,e);case Z:o=8,a|=24;break;case $:return t=Ge(12,l,e,a|2),t.elementType=$,t.lanes=u,t;case L:return t=Ge(13,l,e,a),t.elementType=L,t.lanes=u,t;case dt:return t=Ge(19,l,e,a),t.elementType=dt,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case gt:case V:o=10;break t;case Mt:o=9;break t;case ft:o=11;break t;case I:o=14;break t;case it:o=16,n=null;break t}o=29,l=Error(f(130,t===null?"null":typeof t,"")),n=null}return e=Ge(o,l,e,a),e.elementType=t,e.type=n,e.lanes=u,e}function en(t,e,l,n){return t=Ge(7,t,n,e),t.lanes=l,t}function dc(t,e,l){return t=Ge(6,t,null,e),t.lanes=l,t}function hc(t,e,l){return e=Ge(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,Pe=[],$e=0,ln=null,pl=1,vl="";function nn(t,e){Cn[Yn++]=Uu,Cn[Yn++]=Ru,Ru=t,Uu=e}function _r(t,e,l){Pe[$e++]=pl,Pe[$e++]=vl,Pe[$e++]=ln,ln=t;var n=pl;t=vl;var a=32-xt(n)-1;n&=~(1<<a),l+=1;var u=32-xt(e)+a;if(30<u){var o=a-a%5;u=(n&(1<<o)-1).toString(32),n>>=o,a-=o,pl=1<<32-xt(e)+a|l<<a|n,vl=u+t}else pl=1<<u|l<<a|n,vl=t}function yc(t){t.return!==null&&(nn(t,1),_r(t,1,0))}function mc(t){for(;t===Ru;)Ru=Cn[--Yn],Cn[Yn]=null,Uu=Cn[--Yn],Cn[Yn]=null;for(;t===ln;)ln=Pe[--$e],Pe[$e]=null,vl=Pe[--$e],Pe[$e]=null,pl=Pe[--$e],Pe[$e]=null}var _e=null,Wt=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[Ue]=n,l){case"dialog":Dt("cancel",e),Dt("close",e);break;case"iframe":case"object":case"embed":Dt("load",e);break;case"video":case"audio":for(l=0;l<Pa.length;l++)Dt(Pa[l],e);break;case"source":Dt("error",e);break;case"img":case"image":case"link":Dt("error",e),Dt("load",e);break;case"details":Dt("toggle",e);break;case"input":Dt("invalid",e),Vo(e,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0),vu(e);break;case"select":Dt("invalid",e);break;case"textarea":Dt("invalid",e),Lo(e,n.value,n.defaultValue,n.children),vu(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&&(Dt("beforetoggle",e),Dt("toggle",e)),n.onScroll!=null&&Dt("scroll",e),n.onScrollEnd!=null&&Dt("scrollend",e),n.onClick!=null&&(e.onclick=si),e=!0):e=!1,e||un(t)}function Dr(t){for(_e=t.return;_e;)switch(_e.tag){case 5:case 13:cl=!1;return;case 27:case 3:cl=!0;return;default:_e=_e.return}}function Ta(t){if(t!==_e)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")||Nf(t.type,t.memoizedProps)),l=!l),l&&Wt&&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){Wt=ll(t.nextSibling);break t}e--}else l!=="$"&&l!=="$!"&&l!=="$?"||e++;t=t.nextSibling}Wt=null}}else e===27?(e=Wt,Ll(t.type)?(t=Yf,Yf=null,Wt=t):Wt=e):Wt=_e?ll(t.stateNode.nextSibling):null;return!0}function Aa(){Wt=_e=null,qt=!1}function Rr(){var t=an;return t!==null&&(qe===null?qe=t:qe.push.apply(qe,t),an=null),t}function Ea(t){an===null?an=[t]:an.push(t)}var vc=z(null),cn=null,gl=null;function Rl(t,e,l){C(vc,e._currentValue),e._currentValue=l}function bl(t){t._currentValue=vc.current,q(vc)}function gc(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 bc(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 v=0;v<e.length;v++)if(s.context===e[v]){u.lanes|=l,s=u.alternate,s!==null&&(s.lanes|=l),gc(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),gc(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;Ye(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&&bc(e,t,l,n),e.flags|=262144}function Bu(t){for(t=t.firstContext;t!==null;){if(!Ye(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:V,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sc(){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,xc=0,Gn=0,Xn=null;function am(t,e){if(za===null){var l=za=[];xc=0,Gn=Af(),Xn={status:"pending",value:void 0,then:function(n){l.push(n)}}}return xc++,e.then(Br,Br),e}function Br(){if(--xc===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 Mc(){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=Mc();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 Ac(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ec(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 Oc(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 _c=!1;function Ba(){if(_c){var t=Xn;if(t!==null)throw t}}function Na(t,e,l,n){_c=!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 v=s,E=v.next;v.next=null,o===null?u=E:o.next=E,o=v;var U=t.alternate;U!==null&&(U=U.updateQueue,s=U.lastBaseUpdate,s!==o&&(s===null?U.firstBaseUpdate=E:s.next=E,U.lastBaseUpdate=v))}if(u!==null){var H=a.baseState;o=0,U=E=v=null,s=u;do{var O=s.lane&-536870913,_=O!==s.lane;if(_?(Bt&O)===O:(n&O)===O){O!==0&&O===Gn&&(_c=!0),U!==null&&(U=U.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});t:{var vt=t,yt=s;O=e;var jt=l;switch(yt.tag){case 1:if(vt=yt.payload,typeof vt=="function"){H=vt.call(jt,H,O);break t}H=vt;break t;case 3:vt.flags=vt.flags&-65537|128;case 0:if(vt=yt.payload,O=typeof vt=="function"?vt.call(jt,H,O):vt,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?(E=U=_,v=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&&(v=H),a.baseState=v,a.firstBaseUpdate=E,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 zc(){C(Yu,Ol),C(wn,wn.current)}function Dc(){Ol=Yu.current,q(wn),q(Yu)}var Hl=0,Ot=null,Xt=null,ue=null,Gu=!1,jn=!1,rn=!1,Xu=0,Ha=0,Qn=null,im=0;function ee(){throw Error(f(321))}function Rc(t,e){if(e===null)return!1;for(var l=0;l<e.length&&l<t.length;l++)if(!Ye(t[l],e[l]))return!1;return!0}function Uc(t,e,l,n,a,u){return Hl=u,Ot=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=Ot=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){Ot=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&&(Ot.flags|=1024),e}function Bc(){var t=Xu!==0;return Xu=0,t}function Nc(t,e,l){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~l}function Hc(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=Ot=null,jn=!1,Ha=Xu=0,Qn=null}function Ne(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ue===null?Ot.memoizedState=ue=t:ue=ue.next=t,ue}function ie(){if(Xt===null){var t=Ot.alternate;t=t!==null?t.memoizedState:null}else t=Xt.next;var e=ue===null?Ot.memoizedState:ue.next;if(e!==null)ue=e,Xt=t;else{if(t===null)throw Ot.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?Ot.memoizedState=ue=t:ue=ue.next=t}return ue}function qc(){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=Ot,(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===V)return xe(t)}throw Error(f(438,String(t)))}function Cc(t){var e=null,l=Ot.updateQueue;if(l!==null&&(e=l.memoCache),e==null){var n=Ot.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=qc(),Ot.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]=pt;return e.index++,l}function Sl(t,e){return typeof e=="function"?e(t):e}function ju(t){var e=ie();return Yc(e,Xt,t)}function Yc(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,v=null,E=e,U=!1;do{var H=E.lane&-536870913;if(H!==E.lane?(Bt&H)===H:(Hl&H)===H){var O=E.revertLane;if(O===0)v!==null&&(v=v.next={lane:0,revertLane:0,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null}),H===Gn&&(U=!0);else if((Hl&O)===O){E=E.next,O===Gn&&(U=!0);continue}else H={lane:0,revertLane:E.revertLane,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},v===null?(s=v=H,o=u):v=v.next=H,Ot.lanes|=O,jl|=O;H=E.action,rn&&l(u,H),u=E.hasEagerState?E.eagerState:l(u,H)}else O={lane:H,revertLane:E.revertLane,action:E.action,hasEagerState:E.hasEagerState,eagerState:E.eagerState,next:null},v===null?(s=v=O,o=u):v=v.next=O,Ot.lanes|=H,jl|=H;E=E.next}while(E!==null&&E!==e);if(v===null?o=u:v.next=s,!Ye(u,t.memoizedState)&&(de=!0,U&&(l=Xn,l!==null)))throw l;t.memoizedState=u,t.baseState=o,t.baseQueue=v,n.lastRenderedState=u}return a===null&&(n.lanes=0),[t.memoizedState,n.dispatch]}function Gc(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);Ye(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=Ot,a=ie(),u=qt;if(u){if(l===void 0)throw Error(f(407));l=l()}else l=e();var o=!Ye((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=Ot.updateQueue,e===null?(e=qc(),Ot.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,Pr(e)&&$r(t)}function Jr(t,e,l){return l(function(){Pr(e)&&$r(t)})}function Pr(t){var e=t.getSnapshot;t=t.value;try{var l=e();return!Ye(t,l)}catch(n){return!0}}function $r(t){var e=Hn(t,2);e!==null&&Ve(e,t,2)}function Xc(t){var e=Ne();if(typeof t=="function"){var l=t;if(t=l(),rn){Tt(!0);try{l()}finally{Tt(!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,Yc(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),v=D.S;v!==null&&v(o,s),Fr(t,e,s)}catch(E){wc(t,e,E)}finally{D.T=u}}else try{u=l(a,n),Fr(t,e,u)}catch(E){wc(t,e,E)}}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 wc(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 wc(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=Ot;if(qt){if(Wt){e:{for(var a=Wt,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){Wt=ll(a.nextSibling),n=a.data==="F!";break t}}un(n)}n=!1}n&&(e=l[0])}}return l=Ne(),l.memoizedState=l.baseState=e,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ls,lastRenderedState:e},l.queue=n,l=Ms.bind(null,Ot,n),n.dispatch=l,n=Xc(!1),u=Lc.bind(null,Ot,!1,n.queue),n=Ne(),a={state:e,dispatch:null,action:t,pending:null},n.queue=a,l=fm.bind(null,Ot,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=Yc(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&&(Ot.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=Ot.updateQueue,e===null&&(e=qc(),Ot.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=Ne();n=n===void 0?null:n,Ot.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&&Rc(n,Xt.memoizedState.deps)?a.memoizedState=Vn(e,u,l,n):(Ot.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 jc(){}function ys(t,e){var l=ie();e=e===void 0?null:e;var n=l.memoizedState;return e!==null&&Rc(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&&Rc(e,n[1]))return n[0];if(n=t(),rn){Tt(!0);try{t()}finally{Tt(!1)}}return l.memoizedState=[n,e],n}function Qc(t,e,l){return l===void 0||Hl&1073741824?t.memoizedState=e:(t.memoizedState=l,t=gd(),Ot.lanes|=t,jl|=t,l)}function ps(t,e,l,n){return Ye(l,e)?l:wn.current!==null?(t=Qc(t,l,n),Ye(t,e)||(de=!0),t):Hl&42?(t=gd(),Ot.lanes|=t,jl|=t,e):(de=!0,t.memoizedState=l)}function vs(t,e,l,n,a){var u=j.p;j.p=u!==0&&8>u?u:8;var o=D.T,s={};D.T=s,Lc(t,!1,e,l);try{var v=a(),E=D.S;if(E!==null&&E(s,v),v!==null&&typeof v=="object"&&typeof v.then=="function"){var U=um(v,n);Ya(t,e,U,Qe(t))}else Ya(t,e,n,Qe(t))}catch(H){Ya(t,e,{then:function(){},status:"rejected",reason:H},Qe())}finally{j.p=u,D.T=o}}function rm(){}function Vc(t,e,l,n){if(t.tag!==5)throw Error(f(476));var a=gs(t).queue;vs(t,a,e,P,l===null?rm:function(){return bs(t),l(n)})}function gs(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sl,lastRenderedState:P},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,{},Qe())}function Zc(){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=Qe();t=Bl(l);var n=Nl(e,t,l);n!==null&&(Ve(n,e,l),Ua(n,e,l)),e={cache:Sc()},t.payload=e;return}e=e.return}}function dm(t,e,l){var n=Qe();l={lane:n,revertLane:0,action:l,hasEagerState:!1,eagerState:null,next:null},Zu(t)?Ts(e,l):(l=rc(t,e,l,n),l!==null&&(Ve(l,t,n),As(l,e,n)))}function Ms(t,e,l){var n=Qe();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))Ts(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,Ye(s,o))return _u(t,e,a,0),Vt===null&&Ou(),!1}catch(v){}finally{}if(l=rc(t,e,a,n),l!==null)return Ve(l,t,n),As(l,e,n),!0}return!1}function Lc(t,e,l,n){if(n={lane:2,revertLane:Af(),action:n,hasEagerState:!1,eagerState:null,next:null},Zu(t)){if(e)throw Error(f(479))}else e=rc(t,l,n,2),e!==null&&Ve(e,t,2)}function Zu(t){var e=t.alternate;return t===Ot||e!==null&&e===Ot}function Ts(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 As(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:ee,useContext:ee,useEffect:ee,useImperativeHandle:ee,useLayoutEffect:ee,useInsertionEffect:ee,useMemo:ee,useReducer:ee,useRef:ee,useState:ee,useDebugValue:ee,useDeferredValue:ee,useTransition:ee,useSyncExternalStore:ee,useId:ee,useHostTransitionStatus:ee,useFormState:ee,useActionState:ee,useOptimistic:ee,useMemoCache:ee,useCacheRefresh:ee},Es={readContext:xe,use:wu,useCallback:function(t,e){return Ne().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=Ne();e=e===void 0?null:e;var n=t();if(rn){Tt(!0);try{t()}finally{Tt(!1)}}return l.memoizedState=[n,e],n},useReducer:function(t,e,l){var n=Ne();if(l!==void 0){var a=l(e);if(rn){Tt(!0);try{l(e)}finally{Tt(!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,Ot,t),[n.memoizedState,t]},useRef:function(t){var e=Ne();return t={current:t},e.memoizedState=t},useState:function(t){t=Xc(t);var e=t.queue,l=Ms.bind(null,Ot,e);return e.dispatch=l,[t.memoizedState,l]},useDebugValue:jc,useDeferredValue:function(t,e){var l=Ne();return Qc(l,t,e)},useTransition:function(){var t=Xc(!1);return t=vs.bind(null,Ot,t.queue,!0,!1),Ne().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,l){var n=Ot,a=Ne();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=Ne(),e=Vt.identifierPrefix;if(qt){var l=vl,n=pl;l=(n&~(1<<32-xt(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:Zc,useFormState:ns,useActionState:ns,useOptimistic:function(t){var e=Ne();e.memoizedState=e.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=l,e=Lc.bind(null,Ot,!0,l),l.dispatch=e,[t,e]},useMemoCache:Cc,useCacheRefresh:function(){return Ne().memoizedState=sm.bind(null,Ot)}},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:jc,useDeferredValue:function(t,e){var l=ie();return ps(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:Zc,useFormState:as,useActionState:as,useOptimistic:function(t,e){var l=ie();return Ir(l,Xt,t,e)},useMemoCache:Cc,useCacheRefresh:xs},hm={readContext:xe,use:wu,useCallback:ys,useContext:xe,useEffect:os,useImperativeHandle:hs,useInsertionEffect:rs,useLayoutEffect:ss,useMemo:ms,useReducer:Gc,useRef:cs,useState:function(){return Gc(Sl)},useDebugValue:jc,useDeferredValue:function(t,e){var l=ie();return Xt===null?Qc(l,t,e):ps(l,Xt.memoizedState,t,e)},useTransition:function(){var t=Gc(Sl)[0],e=ie().memoizedState;return[typeof t=="boolean"?t:qa(t),e]},useSyncExternalStore:Lr,useId:Ss,useHostTransitionStatus:Zc,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:Cc,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===A?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 T=M.deletions;T===null?(M.deletions=[x],M.flags|=16):T.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,T){return M.index=T,t?(T=M.alternate,T!==null?(T=T.index,T<x?(M.flags|=67108866,x):T):(M.flags|=67108866,x)):(M.flags|=1048576,x)}function o(M){return t&&M.alternate===null&&(M.flags|=67108866),M}function s(M,x,T,B){return x===null||x.tag!==6?(x=dc(T,M.mode,B),x.return=M,x):(x=a(x,T),x.return=M,x)}function v(M,x,T,B){var F=T.type;return F===w?U(M,x,T.props.children,B,T.key):x!==null&&(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===it&&_s(F)===x.type)?(x=a(x,T.props),Xa(x,T),x.return=M,x):(x=Du(T.type,T.key,T.props,null,M.mode,B),Xa(x,T),x.return=M,x)}function E(M,x,T,B){return x===null||x.tag!==4||x.stateNode.containerInfo!==T.containerInfo||x.stateNode.implementation!==T.implementation?(x=hc(T,M.mode,B),x.return=M,x):(x=a(x,T.children||[]),x.return=M,x)}function U(M,x,T,B,F){return x===null||x.tag!==7?(x=en(T,M.mode,B,F),x.return=M,x):(x=a(x,T),x.return=M,x)}function H(M,x,T){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=dc(""+x,M.mode,T),x.return=M,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case R:return T=Du(x.type,x.key,x.props,null,M.mode,T),Xa(T,x),T.return=M,T;case G:return x=hc(x,M.mode,T),x.return=M,x;case it:var B=x._init;return x=B(x._payload),H(M,x,T)}if(Et(x)||K(x))return x=en(x,M.mode,T,null),x.return=M,x;if(typeof x.then=="function")return H(M,ku(x),T);if(x.$$typeof===V)return H(M,Nu(M,x),T);Ku(M,x)}return null}function O(M,x,T,B){var F=x!==null?x.key:null;if(typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint")return F!==null?null:s(M,x,""+T,B);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case R:return T.key===F?v(M,x,T,B):null;case G:return T.key===F?E(M,x,T,B):null;case it:return F=T._init,T=F(T._payload),O(M,x,T,B)}if(Et(T)||K(T))return F!==null?null:U(M,x,T,B,null);if(typeof T.then=="function")return O(M,x,ku(T),B);if(T.$$typeof===V)return O(M,x,Nu(M,T),B);Ku(M,T)}return null}function _(M,x,T,B,F){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return M=M.get(T)||null,s(x,M,""+B,F);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case R:return M=M.get(B.key===null?T:B.key)||null,v(x,M,B,F);case G:return M=M.get(B.key===null?T:B.key)||null,E(x,M,B,F);case it:var _t=B._init;return B=_t(B._payload),_(M,x,T,B,F)}if(Et(B)||K(B))return M=M.get(T)||null,U(x,M,B,F,null);if(typeof B.then=="function")return _(M,x,T,ku(B),F);if(B.$$typeof===V)return _(M,x,T,Nu(x,B),F);Ku(x,B)}return null}function vt(M,x,T,B){for(var F=null,_t=null,nt=x,mt=x=0,ye=null;nt!==null&&mt<T.length;mt++){nt.index>mt?(ye=nt,nt=null):ye=nt.sibling;var Ht=O(M,nt,T[mt],B);if(Ht===null){nt===null&&(nt=ye);break}t&&nt&&Ht.alternate===null&&e(M,nt),x=u(Ht,x,mt),_t===null?F=Ht:_t.sibling=Ht,_t=Ht,nt=ye}if(mt===T.length)return l(M,nt),qt&&nn(M,mt),F;if(nt===null){for(;mt<T.length;mt++)nt=H(M,T[mt],B),nt!==null&&(x=u(nt,x,mt),_t===null?F=nt:_t.sibling=nt,_t=nt);return qt&&nn(M,mt),F}for(nt=n(nt);mt<T.length;mt++)ye=_(nt,M,mt,T[mt],B),ye!==null&&(t&&ye.alternate!==null&&nt.delete(ye.key===null?mt:ye.key),x=u(ye,x,mt),_t===null?F=ye:_t.sibling=ye,_t=ye);return t&&nt.forEach(function($l){return e(M,$l)}),qt&&nn(M,mt),F}function yt(M,x,T,B){if(T==null)throw Error(f(151));for(var F=null,_t=null,nt=x,mt=x=0,ye=null,Ht=T.next();nt!==null&&!Ht.done;mt++,Ht=T.next()){nt.index>mt?(ye=nt,nt=null):ye=nt.sibling;var $l=O(M,nt,Ht.value,B);if($l===null){nt===null&&(nt=ye);break}t&&nt&&$l.alternate===null&&e(M,nt),x=u($l,x,mt),_t===null?F=$l:_t.sibling=$l,_t=$l,nt=ye}if(Ht.done)return l(M,nt),qt&&nn(M,mt),F;if(nt===null){for(;!Ht.done;mt++,Ht=T.next())Ht=H(M,Ht.value,B),Ht!==null&&(x=u(Ht,x,mt),_t===null?F=Ht:_t.sibling=Ht,_t=Ht);return qt&&nn(M,mt),F}for(nt=n(nt);!Ht.done;mt++,Ht=T.next())Ht=_(nt,M,mt,Ht.value,B),Ht!==null&&(t&&Ht.alternate!==null&&nt.delete(Ht.key===null?mt:Ht.key),x=u(Ht,x,mt),_t===null?F=Ht:_t.sibling=Ht,_t=Ht);return t&&nt.forEach(function(yp){return e(M,yp)}),qt&&nn(M,mt),F}function jt(M,x,T,B){if(typeof T=="object"&&T!==null&&T.type===w&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case R:t:{for(var F=T.key;x!==null;){if(x.key===F){if(F=T.type,F===w){if(x.tag===7){l(M,x.sibling),B=a(x,T.props.children),B.return=M,M=B;break t}}else if(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===it&&_s(F)===x.type){l(M,x.sibling),B=a(x,T.props),Xa(B,T),B.return=M,M=B;break t}l(M,x);break}else e(M,x);x=x.sibling}T.type===w?(B=en(T.props.children,M.mode,B,T.key),B.return=M,M=B):(B=Du(T.type,T.key,T.props,null,M.mode,B),Xa(B,T),B.return=M,M=B)}return o(M);case G:t:{for(F=T.key;x!==null;){if(x.key===F)if(x.tag===4&&x.stateNode.containerInfo===T.containerInfo&&x.stateNode.implementation===T.implementation){l(M,x.sibling),B=a(x,T.children||[]),B.return=M,M=B;break t}else{l(M,x);break}else e(M,x);x=x.sibling}B=hc(T,M.mode,B),B.return=M,M=B}return o(M);case it:return F=T._init,T=F(T._payload),jt(M,x,T,B)}if(Et(T))return vt(M,x,T,B);if(K(T)){if(F=K(T),typeof F!="function")throw Error(f(150));return T=F.call(T),yt(M,x,T,B)}if(typeof T.then=="function")return jt(M,x,ku(T),B);if(T.$$typeof===V)return jt(M,x,Nu(M,T),B);Ku(M,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,x!==null&&x.tag===6?(l(M,x.sibling),B=a(x,T),B.return=M,M=B):(l(M,x),B=dc(T,M.mode,B),B.return=M,M=B),o(M)):l(M,x)}return function(M,x,T,B){try{Ga=0;var F=jt(M,x,T,B);return Zn=null,F}catch(nt){if(nt===Da||nt===qu)throw nt;var _t=Ge(29,nt,null,M.mode);return _t.lanes=B,_t.return=M,_t}finally{}}}var Ln=zs(!0),Ds=zs(!1),Ie=z(null),fl=null;function ql(t){var e=t.alternate;C(oe,oe.current&1),C(Ie,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(Ie,t),fl===null){var e=t.alternate;e!==null&&e.memoizedState!==null&&(fl=t)}}else Cl()}function Cl(){C(oe,oe.current),C(Ie,Ie.current)}function xl(t){q(Ie),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==="$?"||Cf(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 Kc={enqueueSetState:function(t,e,l){t=t._reactInternals;var n=Qe(),a=Bl(n);a.payload=e,l!=null&&(a.callback=l),e=Nl(t,a,n),e!==null&&(Ve(e,t,n),Ua(e,t,n))},enqueueReplaceState:function(t,e,l){t=t._reactInternals;var n=Qe(),a=Bl(n);a.tag=1,a.payload=e,l!=null&&(a.callback=l),e=Nl(t,a,n),e!==null&&(Ve(e,t,n),Ua(e,t,n))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var l=Qe(),n=Bl(l);n.tag=2,e!=null&&(n.callback=e),e=Nl(t,n,l),e!==null&&(Ve(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&&Kc.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 Pu=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){Pu(t)}function Hs(t){console.error(t)}function qs(t){Pu(t)}function $u(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 Jc(t,e,l){return l=Bl(l),l.tag=3,l.payload={element:null},l.callback=function(){$u(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=Ie.current,l!==null){switch(l.tag){case 13:return fl===null?bf():l.alternate===null&&Ft===0&&(Ft=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),xf(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)),xf(t,n,a)),!1}throw Error(f(435,l.tag))}return xf(t,n,a),bf(),!1}if(qt)return e=Ie.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=Jc(t.stateNode,n,a),Oc(t,a),Ft!==4&&(Ft=2)),!1;var u=Error(f(520),{cause:n});if(u=Ke(u,l),ka===null?ka=[u]:ka.push(u),Ft!==4&&(Ft=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=Jc(l.stateNode,n,t),Oc(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),Oc(l,a),!1}l=l.return}while(l!==null);return!1}var Xs=Error(f(461)),de=!1;function pe(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=Uc(t,e,l,o,u,a),s=Bc(),t!==null&&!de?(Nc(t,e,a),Ml(t,e,a)):(qt&&s&&yc(e),e.flags|=1,pe(t,e,n,a),e.child)}function js(t,e,l,n,a){if(t===null){var u=l.type;return typeof u=="function"&&!sc(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,!lf(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,lf(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):zc(),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),zc(),Cl());return pe(t,e,a,l),e.child}function Zs(t,e,l,n){var a=Mc();return a=a===null?null:{parent:fe._currentValue,pool:a},e.memoizedState={baseLanes:l,cachePool:a},t!==null&&Hu(e,null),zc(),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=Uc(t,e,l,n,void 0,a),n=Bc(),t!==null&&!de?(Nc(t,e,a),Ml(t,e,a)):(qt&&n&&yc(e),e.flags|=1,pe(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=Bc(),t!==null&&!de?(Nc(t,e,u),Ml(t,e,u)):(qt&&n&&yc(e),e.flags|=1,pe(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=Kc,e.stateNode=u,u._reactInternals=e,u=e.stateNode,u.props=n,u.state=e.memoizedState,u.refs={},Ac(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&&Kc.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,v=sn(l,s);u.props=v;var E=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||E!==o)&&Bs(e,u,n,o),Ul=!1;var O=e.memoizedState;u.state=O,Na(e,n,u,a),Ba(),E=e.memoizedState,s||O!==E||Ul?(typeof H=="function"&&(kc(e,l,H,n),E=e.memoizedState),(v=Ul||Us(e,l,v,n,O,E,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=E),u.props=n,u.state=E,u.context=o,n=v):(typeof u.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{u=e.stateNode,Ec(t,e),o=e.memoizedProps,U=sn(l,o),u.props=U,H=e.pendingProps,O=u.context,E=l.contextType,v=qn,typeof E=="object"&&E!==null&&(v=xe(E)),s=l.getDerivedStateFromProps,(E=typeof s=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(o!==H||O!==v)&&Bs(e,u,n,v),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,_,v)||t!==null&&t.dependencies!==null&&Bu(t.dependencies))?(E||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(n,_,v),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(n,_,v)),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=v,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)):pe(t,e,l,a),e.memoizedState=u.state,t=e.child):t=Ml(t,e,a),t}function Ks(t,e,l,n){return Aa(),e.flags|=256,pe(t,e,l,n),e.child}var $c={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ic(t){return{baseLanes:t,cachePool:Hr()}}function Wc(t,e,l){return t=t!==null?t.childLanes&~l:0,e&&(t|=We),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=Wt,v;if(v=s){t:{for(v=s,s=cl;v.nodeType!==8;){if(!s){s=null;break t}if(v=ll(v.nextSibling),v===null){s=null;break t}}s=v}s!==null?(e.memoizedState={dehydrated:s,treeContext:ln!==null?{id:pl,overflow:vl}:null,retryLane:536870912,hydrationErrors:null},v=Ge(18,null,null,0),v.stateNode=s,v.return=e,e.child=v,_e=e,Wt=null,v=!0):v=!1}v||un(e)}if(s=e.memoizedState,s!==null&&(s=s.dehydrated,s!==null))return Cf(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=Ic(l),a.childLanes=Wc(t,o,l),e.memoizedState=$c,n):(ql(e),Fc(e,s))}if(v=t.memoizedState,v!==null&&(s=v.dehydrated,s!==null)){if(u)e.flags&256?(ql(e),e.flags&=-257,e=tf(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=Ic(l),n.childLanes=Wc(t,o,l),e.memoizedState=$c,e=a);else if(ql(e),Cf(s)){if(o=s.nextSibling&&s.nextSibling.dataset,o)var E=o.dgst;o=E,n=Error(f(419)),n.stack="",n.digest=o,Ea({value:n,source:null,stack:null}),e=tf(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!==v.retryLane))throw v.retryLane=n,Hn(t,n),Ve(o,t,n),Xs;s.data==="$?"||bf(),e=tf(t,e,l)}else s.data==="$?"?(e.flags|=192,e.child=t.child,e=null):(t=v.treeContext,Wt=ll(s.nextSibling),_e=e,qt=!0,an=null,cl=!1,t!==null&&(Pe[$e++]=pl,Pe[$e++]=vl,Pe[$e++]=ln,pl=t.id,vl=t.overflow,ln=e),e=Fc(e,n.children),e.flags|=4096);return e}return a?(Cl(),a=n.fallback,s=e.mode,v=t.child,E=v.sibling,n=ml(v,{mode:"hidden",children:n.children}),n.subtreeFlags=v.subtreeFlags&65011712,E!==null?a=ml(E,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=Ic(l):(v=s.cachePool,v!==null?(E=fe._currentValue,v=v.parent!==E?{parent:E,pool:E}:v):v=Hr(),s={baseLanes:s.baseLanes|l,cachePool:v}),a.memoizedState=s,a.childLanes=Wc(t,o,l),e.memoizedState=$c,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 Fc(t,e){return e=Wu({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function Wu(t,e){return t=Ge(22,t,null,e),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function tf(t,e,l){return Ln(e,t.child,null,l),t=Fc(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Ps(t,e,l){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),gc(t.return,e,l)}function ef(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 $s(t,e,l){var n=e.pendingProps,a=n.revealOrder,u=n.tail;if(pe(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&&Ps(t,l,e);else if(t.tag===19)Ps(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),ef(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}ef(e,!0,l,null,u);break;case"together":ef(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 lf(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),Aa();break;case 27:case 5:ct(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 $s(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(!lf(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")sc(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===ft){e.tag=11,e=ws(null,e,n,t,l);break t}else if(a===I){e.tag=14,e=js(null,e,n,t,l);break t}}throw e=ht(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,Ec(t,e),Na(e,n,null,l);var o=e.memoizedState;if(n=o.cache,Rl(e,fe,n),n!==u.cache&&bc(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(Wt=ll(t.firstChild),_e=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(Aa(),n===a){e=Ml(t,e,l);break t}pe(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[Ue]=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 ct(e),t===null&&qt&&(n=e.stateNode=Wd(e.type,e.pendingProps,N.current),_e=e,cl=!0,a=Wt,Ll(e.type)?(Yf=a,Wt=ll(n.firstChild)):Wt=a),pe(t,e,e.pendingProps.children,l),Iu(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&qt&&((a=n=Wt)&&(n=Vm(n,e.type,e.pendingProps,cl),n!==null?(e.stateNode=n,_e=e,Wt=ll(n.firstChild),cl=!1,a=!0):a=!1),a||un(e)),ct(e),a=e.type,u=e.pendingProps,o=t!==null?t.memoizedProps:null,n=u.children,Nf(a,u)?n=null:o!==null&&Nf(a,o)&&(e.flags|=32),e.memoizedState!==null&&(a=Uc(t,e,cm,null,null,l),eu._currentValue=a),Iu(t,e),pe(t,e,n,l),e.child;case 6:return t===null&&qt&&((t=l=Wt)&&(l=Zm(l,e.pendingProps,cl),l!==null?(e.stateNode=l,_e=e,Wt=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):pe(t,e,n,l),e.child;case 11:return ws(t,e,e.type,e.pendingProps,l);case 7:return pe(t,e,e.pendingProps,l),e.child;case 8:return pe(t,e,e.pendingProps.children,l),e.child;case 12:return pe(t,e,e.pendingProps.children,l),e.child;case 10:return n=e.pendingProps,Rl(e,e.type,n.value),pe(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,pe(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 $s(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=Mc(),a===null&&(a=Vt,u=Sc(),a.pooledCache=u,u.refCount++,u!==null&&(a.pooledCacheLanes|=l),a=u),e.memoizedState={parent:n,cache:a},Ac(e),Rl(e,fe,a)):(t.lanes&l&&(Ec(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&&bc(e,[fe],l,!0))),pe(t,e,e.pendingProps.children,l),e.child;case 29:throw e.pendingProps}throw Error(f(156,e.tag))}function Tl(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=Ie.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,Pn|=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 $t(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 pm(t,e,l){var n=e.pendingProps;switch(mc(e),e.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(e),null;case 1:return $t(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),lt(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(Ta(e)?Tl(e):t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Rr())),$t(e),null;case 26:return l=e.memoizedState,t===null?(Tl(e),l!==null?($t(e),Ws(e,l)):($t(e),e.flags&=-16777217)):l?l!==t.memoizedState?(Tl(e),$t(e),Ws(e,l)):($t(e),e.flags&=-16777217):(t.memoizedProps!==n&&Tl(e),$t(e),e.flags&=-16777217),null;case 27:Y(e),l=N.current;var a=e.type;if(t!==null&&e.stateNode!=null)t.memoizedProps!==n&&Tl(e);else{if(!n){if(e.stateNode===null)throw Error(f(166));return $t(e),null}t=J.current,Ta(e)?zr(e):(t=Wd(a,n,l),e.stateNode=t,Tl(e))}return $t(e),null;case 5:if(Y(e),l=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==n&&Tl(e);else{if(!n){if(e.stateNode===null)throw Error(f(166));return $t(e),null}if(t=J.current,Ta(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[Ue]=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&&Tl(e)}}return $t(e),e.flags&=-16777217,null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==n&&Tl(e);else{if(typeof n!="string"&&e.stateNode===null)throw Error(f(166));if(t=N.current,Ta(e)){if(t=e.stateNode,l=e.memoizedProps,n=null,a=_e,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 $t(e),null;case 13:if(n=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Ta(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 Aa(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;$t(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),$t(e),null;case 4:return lt(),t===null&&zf(e.stateNode.containerInfo),$t(e),null;case 10:return bl(e.type),$t(e),null;case 19:if(q(oe),a=e.memoizedState,a===null)return $t(e),null;if(n=(e.flags&128)!==0,u=a.rendering,u===null)if(n)wa(a,!1);else{if(Ft!==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 $t(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):($t(e),null);case 22:case 23:return xl(e),Dc(),n=e.memoizedState!==null,t!==null?t.memoizedState!==null!==n&&(e.flags|=8192):n&&(e.flags|=8192),n?l&536870912&&!(e.flags&128)&&($t(e),e.subtreeFlags&6&&(e.flags|=8192)):$t(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),$t(e),null;case 25:return null;case 30:return null}throw Error(f(156,e.tag))}function vm(t,e){switch(mc(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return bl(fe),lt(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return Y(e),null;case 13:if(xl(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(f(340));Aa()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return q(oe),null;case 4:return lt(),null;case 10:return bl(e.type),null;case 22:case 23:return xl(e),Dc(),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(mc(e),e.tag){case 3:bl(fe),lt();break;case 26:case 27:case 5:Y(e);break;case 4:lt();break;case 13:xl(e);break;case 19:q(oe);break;case 10:bl(e.type);break;case 22:case 23:xl(e),Dc(),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 v=l,E=s;try{E()}catch(U){Qt(a,v,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 nf(t,e,l){try{var n=t.stateNode;Gm(n,t.type,l,e),n[Ue]=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 af(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 uf(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(uf(t,e,l),t=t.sibling;t!==null;)uf(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[Ue]=l}catch(u){Qt(t,t.return,u)}}var Al=!1,le=!1,cf=!1,ud=typeof WeakSet=="function"?WeakSet:Set,he=null;function gm(t,e){if(t=t.containerInfo,Uf=gi,t=pr(t),ac(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(yt){l=null;break t}var o=0,s=-1,v=-1,E=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||(v=o+n),H.nodeType===3&&(o+=H.nodeValue.length),(_=H.firstChild)!==null;)O=H,H=_;for(;;){if(H===t)break e;if(O===l&&++E===a&&(s=o),O===u&&++U===n&&(v=o),(_=H.nextSibling)!==null)break;H=O,O=H.parentNode}H=_}l=s===-1||v===-1?null:{start:s,end:v}}else l=null}l=l||{start:0,end:0}}else l=null;for(Bf={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 vt=sn(l.type,a,l.elementType===l.type);t=n.getSnapshotBeforeUpdate(vt,u),n.__reactInternalSnapshotBeforeUpdate=t}catch(yt){Qt(l,l.return,yt)}}break;case 3:if(t&1024){if(t=e.stateNode.containerInfo,l=t.nodeType,l===9)qf(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":qf(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||Al,!n){e=e!==null&&e.memoizedState!==null||le,a=Al;var u=le;Al=n,(le=e)&&!u?Xl(t,l,(l.subtreeFlags&8772)!==0):Gl(t,l),Al=a,le=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&&Xi(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,He=!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(ut&&typeof ut.onCommitFiberUnmount=="function")try{ut.onCommitFiberUnmount(Ut,l)}catch(u){}switch(l.tag){case 26:le||ol(l,e),El(t,e,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:le||ol(l,e);var n=Kt,a=He;Ll(l.type)&&(Kt=l.stateNode,He=!1),El(t,e,l),Ia(l.stateNode),Kt=n,He=a;break;case 5:le||ol(l,e);case 6:if(n=Kt,a=He,Kt=null,El(t,e,l),Kt=n,He=a,Kt!==null)if(He)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&&(He?(t=Kt,$d(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),uu(t)):$d(Kt,l.stateNode));break;case 4:n=Kt,a=He,Kt=l.stateNode.containerInfo,He=!0,El(t,e,l),Kt=n,He=a;break;case 0:case 11:case 14:case 15:le||Yl(2,l,e),le||Yl(4,l,e),El(t,e,l);break;case 1:le||(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:le=(n=le)||l.memoizedState!==null,El(t,e,l),le=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 ff(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 Xe(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,He=!1;break t}break;case 5:Kt=s.stateNode,He=!1;break t;case 3:case 4:Kt=s.stateNode.containerInfo,He=!0;break t}s=s.return}if(Kt===null)throw Error(f(160));fd(u,o,a),Kt=null,He=!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:Xe(e,t),we(t),n&4&&(Yl(3,t,t.return),ja(3,t),Yl(5,t,t.return));break;case 1:Xe(e,t),we(t),n&512&&(le||l===null||ol(l,l.return)),n&64&&Al&&(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(Xe(e,t),we(t),n&512&&(le||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&&nf(t,t.memoizedProps,l.memoizedProps)}break;case 27:Xe(e,t),we(t),n&512&&(le||l===null||ol(l,l.return)),l!==null&&n&4&&nf(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Xe(e,t),we(t),n&512&&(le||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,nf(t,a,l!==null?l.memoizedProps:a)),n&1024&&(cf=!0);break;case 6:if(Xe(e,t),we(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),Xe(e,t),el=a,we(t),n&4&&l!==null&&l.memoizedState.isDehydrated)try{uu(e.containerInfo)}catch(_){Qt(t,t.return,_)}cf&&(cf=!1,sd(t));break;case 4:n=el,el=hi(t.stateNode.containerInfo),Xe(e,t),we(t),el=n;break;case 12:Xe(e,t),we(t);break;case 13:Xe(e,t),we(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(yf=Nt()),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,ff(t,n)));break;case 22:a=t.memoizedState!==null;var v=l!==null&&l.memoizedState!==null,E=Al,U=le;if(Al=E||a,le=U||v,Xe(e,t),le=U,Al=E,we(t),n&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(l===null||v||Al||le||dn(t)),l=null,e=t;;){if(e.tag===5||e.tag===26){if(l===null){v=l=e;try{if(u=v.stateNode,a)o=u.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{s=v.stateNode;var H=v.memoizedProps.style,O=H!=null&&H.hasOwnProperty("display")?H.display:null;s.style.display=O==null||typeof O=="boolean"?"":(""+O).trim()}}catch(_){Qt(v,v.return,_)}}}else if(e.tag===6){if(l===null){v=e;try{v.stateNode.nodeValue=a?"":v.memoizedProps}catch(_){Qt(v,v.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,ff(t,l))));break;case 19:Xe(e,t),we(t),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,ff(t,n)));break;case 30:break;case 21:break;default:Xe(e,t),we(t)}}function we(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=af(t);ti(t,u,a);break;case 5:var o=l.stateNode;l.flags&32&&(_n(o,""),l.flags&=-33);var s=af(t);ti(t,s,o);break;case 3:case 4:var v=l.stateNode.containerInfo,E=af(t);uf(t,E,v);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(E){Qt(n,n.return,E)}if(n=u,a=n.updateQueue,a!==null){var s=n.stateNode;try{var v=a.shared.hiddenCallbacks;if(v!==null)for(a.shared.hiddenCallbacks=null,a=0;a<v.length;a++)wr(v[a],s)}catch(E){Qt(n,n.return,E)}}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 of(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 rf(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(v){Qt(e,e.return,v)}}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&&of(o,e);break;case 24:rl(t,e,l,n),a&2048&&rf(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,v=n,E=o.flags;switch(o.tag){case 0:case 11:case 15:kn(u,o,s,v,a),ja(8,o);break;case 23:break;case 22:var U=o.stateNode;o.memoizedState!==null?U._visibility&2?kn(u,o,s,v,a):Va(u,o):(U._visibility|=2,kn(u,o,s,v,a)),a&&E&2048&&of(o.alternate,o);break;case 24:kn(u,o,s,v,a),a&&E&2048&&rf(o.alternate,o);break;default:kn(u,o,s,v,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&&of(n.alternate,n);break;case 24:Va(l,n),a&2048&&rf(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&&ap(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,pd(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,pd(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 pd(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,zt=null,Bt=0,Yt=0,je=null,wl=!1,Jn=!1,sf=!1,Ol=0,Ft=0,jl=0,hn=0,df=0,We=0,Pn=0,ka=null,qe=null,hf=!1,yf=0,li=1/0,ni=null,Ql=null,ve=0,Vl=null,$n=null,In=0,mf=0,pf=null,vd=null,Ka=0,vf=null;function Qe(){if(Ct&2&&Bt!==0)return Bt&-Bt;if(D.T!==null){var t=Gn;return t!==0?t:Af()}return bn()}function gd(){We===0&&(We=!(Bt&536870912)||qt?re():536870912);var t=Ie.current;return t!==null&&(t.flags|=32),We}function Ve(t,e,l){(t===Vt&&(Yt===2||Yt===9)||t.cancelPendingCommit!==null)&&(Wn(t,0),Zl(t,Bt,We,!1)),Oe(t,l),(!(Ct&2)||t!==Vt)&&(t===Vt&&(!(Ct&2)&&(hn|=l),Ft===4&&Zl(t,Bt,We,!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||Re(t,e),a=n?Am(t,e):Sf(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=Sf(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 v=s.current.memoizedState.isDehydrated;if(v&&(Wn(s,o).flags|=256),o=Sf(s,o,!1),o!==2){if(sf&&!v){s.errorRecoveryDisabledLanes|=u,hn|=u,a=4;break t}u=qe,qe=a,u!==null&&(qe===null?qe=u:qe.push.apply(qe,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,We,!wl);break t;case 2:qe=null;break;case 3:case 5:break;default:throw Error(f(329))}if((e&62914560)===e&&(a=yf+300-Nt(),10<a)){if(Zl(n,e,We,!wl),dl(n,0,!0)!==0)break t;n.timeoutHandle=Jd(Sd.bind(null,n,l,qe,ni,hf,e,We,hn,Pn,wl,u,2,-0,0),a);break t}Sd(n,l,qe,ni,hf,e,We,hn,Pn,wl,u,0,-0,0)}}break}while(!0);sl(t)}function Sd(t,e,l,n,a,u,o,s,v,E,U,H,O,_){if(t.timeoutHandle=-1,H=e.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(tu={stylesheets:null,count:0,unsuspend:np},hd(e),H=up(),H!==null)){t.cancelPendingCommit=H(_d.bind(null,t,e,u,l,n,a,o,s,v,U,1,O,_)),Zl(t,u,o,!E);return}_d(t,e,u,l,n,a,o,s,v)}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(!Ye(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&=~df,e&=~hn,t.suspendedLanes|=e,t.pingedLanes&=~e,n&&(t.warmLanes|=e),n=t.expirationTimes;for(var a=e;0<a;){var u=31-xt(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 gf(){if(zt!==null){if(Yt===0)var t=zt.return;else t=zt,gl=cn=null,Hc(t),Zn=null,Ga=0,t=zt;for(;t!==null;)Fs(t.alternate,t),t=t.return;zt=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()),gf(),Vt=t,zt=l=ml(t.current,null),Bt=e,Yt=0,je=null,wl=!1,Jn=Re(t,e),sf=!1,Pn=We=df=hn=jl=Ft=0,qe=ka=null,hf=!1,e&8&&(e|=e&32);var n=t.entangledLanes;if(n!==0)for(t=t.entanglements,n&=e;0<n;){var a=31-xt(n),u=1<<a;e|=t[a],n&=~u}return Ol=e,Ou(),l}function xd(t,e){Ot=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,je=e,zt===null&&(Ft=1,$u(t,Ke(e,t.current)))}function Md(){var t=D.H;return D.H=Lu,t===null?Lu:t}function Td(){var t=D.A;return D.A=Sm,t}function bf(){Ft=4,wl||(Bt&4194048)!==Bt&&Ie.current!==null||(Jn=!0),!(jl&134217727)&&!(hn&134217727)||Vt===null||Zl(Vt,Bt,We,!1)}function Sf(t,e,l){var n=Ct;Ct|=2;var a=Md(),u=Td();(Vt!==t||Bt!==e)&&(ni=null,Wn(t,e)),e=!1;var o=Ft;t:do try{if(Yt!==0&&zt!==null){var s=zt,v=je;switch(Yt){case 8:gf(),o=6;break t;case 3:case 2:case 9:case 6:Ie.current===null&&(e=!0);var E=Yt;if(Yt=0,je=null,Fn(t,s,v,E),l&&Jn){o=0;break t}break;default:E=Yt,Yt=0,je=null,Fn(t,s,v,E)}}Tm(),o=Ft;break}catch(U){xd(t,U)}while(!0);return e&&t.shellSuspendCounter++,gl=cn=null,Ct=n,D.H=a,D.A=u,zt===null&&(Vt=null,Bt=0,Ou()),o}function Tm(){for(;zt!==null;)Ad(zt)}function Am(t,e){var l=Ct;Ct|=2;var n=Md(),a=Td();Vt!==t||Bt!==e?(ni=null,li=Nt()+500,Wn(t,e)):Jn=Re(t,e);t:do try{if(Yt!==0&&zt!==null){e=zt;var u=je;e:switch(Yt){case 1:Yt=0,je=null,Fn(t,e,u,1);break;case 2:case 9:if(Cr(u)){Yt=0,je=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,je=null,Ed(e)):(Yt=0,je=null,Fn(t,e,u,7));break;case 5:var o=null;switch(zt.tag){case 26:o=zt.memoizedState;case 5:case 27:var s=zt;if(!o||ih(o)){Yt=0,je=null;var v=s.sibling;if(v!==null)zt=v;else{var E=s.return;E!==null?(zt=E,ui(E)):zt=null}break e}}Yt=0,je=null,Fn(t,e,u,5);break;case 6:Yt=0,je=null,Fn(t,e,u,6);break;case 8:gf(),Ft=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,zt!==null?0:(Vt=null,Bt=0,Ou(),Ft)}function Em(){for(;zt!==null&&!te();)Ad(zt)}function Ad(t){var e=Is(t.alternate,t,Ol);t.memoizedProps=t.pendingProps,e===null?ui(t):zt=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:Hc(e);default:Fs(l,e),e=zt=Or(e,Ol),e=Is(l,e,Ol)}t.memoizedProps=t.pendingProps,e===null?ui(t):zt=e}function Fn(t,e,l,n){gl=cn=null,Hc(e),Zn=null,Ga=0;var a=e.return;try{if(ym(t,a,e,l,Bt)){Ft=1,$u(t,Ke(l,t.current)),zt=null;return}}catch(u){if(a!==null)throw zt=a,u;Ft=1,$u(t,Ke(l,t.current)),zt=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=Ie.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=pm(e.alternate,e,Ol);if(l!==null){zt=l;return}if(e=e.sibling,e!==null){zt=e;return}zt=e=t}while(e!==null);Ft===0&&(Ft=5)}function Od(t,e){do{var l=vm(t.alternate,t);if(l!==null){l.flags&=32767,zt=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!e&&(t=t.sibling,t!==null)){zt=t;return}zt=t=l}while(t!==null);Ft=6,zt=null}function _d(t,e,l,n,a,u,o,s,v){t.cancelPendingCommit=null;do ii();while(ve!==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|=oc,zl(t,l,u,o,s,v),t===Vt&&(zt=Vt=null,Bt=0),$n=e,Vl=t,In=l,mf=u,pf=a,vd=n,e.subtreeFlags&10256||e.flags&10256?(t.callbackNode=null,t.callbackPriority=0,Dm(Pt,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=j.p,j.p=2,o=Ct,Ct|=4;try{gm(t,e,l)}finally{Ct=o,j.p=a,D.T=n}}ve=1,zd(),Dd(),Rd()}}function zd(){if(ve===1){ve=0;var t=Vl,e=$n,l=(e.flags&13878)!==0;if(e.subtreeFlags&13878||l){l=D.T,D.T=null;var n=j.p;j.p=2;var a=Ct;Ct|=4;try{rd(e,t);var u=Bf,o=pr(t.containerInfo),s=u.focusedElem,v=u.selectionRange;if(o!==s&&s&&s.ownerDocument&&mr(s.ownerDocument.documentElement,s)){if(v!==null&&ac(s)){var E=v.start,U=v.end;if(U===void 0&&(U=E),"selectionStart"in s)s.selectionStart=E,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(),vt=s.textContent.length,yt=Math.min(v.start,vt),jt=v.end===void 0?yt:Math.min(v.end,vt);!_.extend&&yt>jt&&(o=jt,jt=yt,yt=o);var M=yr(s,yt),x=yr(s,jt);if(M&&x&&(_.rangeCount!==1||_.anchorNode!==M.node||_.anchorOffset!==M.offset||_.focusNode!==x.node||_.focusOffset!==x.offset)){var T=H.createRange();T.setStart(M.node,M.offset),_.removeAllRanges(),yt>jt?(_.addRange(T),_.extend(x.node,x.offset)):(T.setEnd(x.node,x.offset),_.addRange(T))}}}}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=!!Uf,Bf=Uf=null}finally{Ct=a,j.p=n,D.T=l}}t.current=e,ve=2}}function Dd(){if(ve===2){ve=0;var t=Vl,e=$n,l=(e.flags&8772)!==0;if(e.subtreeFlags&8772||l){l=D.T,D.T=null;var n=j.p;j.p=2;var a=Ct;Ct|=4;try{id(t,e.alternate,e)}finally{Ct=a,j.p=n,D.T=l}}ve=3}}function Rd(){if(ve===4||ve===3){ve=0,Gt();var t=Vl,e=$n,l=In,n=vd;e.subtreeFlags&10256||e.flags&10256?ve=5:(ve=0,$n=Vl=null,Ud(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(Ql=null),il(l),e=e.stateNode,ut&&typeof ut.onCommitFiberRoot=="function")try{ut.onCommitFiberRoot(Ut,e,void 0,(e.current.flags&128)===128)}catch(v){}if(n!==null){e=D.T,a=j.p,j.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,j.p=a}}In&3&&ii(),sl(t),a=t.pendingLanes,l&4194090&&a&42?t===vf?Ka++:(Ka=0,vf=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(ve!==5)return!1;var t=Vl,e=mf;mf=0;var l=il(In),n=D.T,a=j.p;try{j.p=32>l?32:l,D.T=null,l=pf,pf=null;var u=Vl,o=In;if(ve=0,$n=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),ut&&typeof ut.onPostCommitFiberRoot=="function")try{ut.onPostCommitFiberRoot(Ut,u)}catch(v){}return!0}finally{j.p=a,D.T=n,Ud(t,e)}}function Nd(t,e,l){e=Ke(l,e),e=Jc(t.stateNode,e,2),t=Nl(t,e,2),t!==null&&(Oe(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),Oe(n,2),sl(n));break}}e=e.return}}function xf(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)||(sf=!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&&(Ft===4||Ft===3&&(Bt&62914560)===Bt&&300>Nt()-yf?!(Ct&2)&&Wn(t,0):df|=l,Pn===Bt&&(Pn=0)),sl(t)}function Hd(t,e){e===0&&(e=al()),t=Hn(t,e),t!==null&&(Oe(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 st(t,e)}var ci=null,ta=null,Mf=!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,Mf||(Mf=!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-xt(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)||Re(n,u)||(l=!0,Gd(n,u));n=n.next}while(l);Tf=!1}}function Rm(){qd()}function qd(){fi=Mf=!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-xt(u),s=1<<o,v=a[o];v===-1?(!(s&l)||s&n)&&(a[o]=Ci(s,e)):v<=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)||Re(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=Pt;break;case 268435456:l=ae;break;default:l=Pt}return n=Yd.bind(null,t),l=st(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(ve!==0&&ve!==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?st(Zt,Rm):qd()})}function Af(){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[Ue]||null).action),o=n.submitter;o&&(e=(e=o[Ue]||null)?Xd(e.formAction):o.getAttribute("formAction"),e!==null&&(u=e,o=null));var s=new Tu("action","action",null,n,a);t.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(yn!==0){var v=o?wd(a,o):new FormData(a);Vc(l,{pending:!0,data:v,method:a.method,action:u},null,v)}}else typeof u=="function"&&(s.preventDefault(),v=o?wd(a,o):new FormData(a),Vc(l,{pending:!0,data:v,method:a.method,action:u},u,v))},currentTarget:a}]})}}for(var Ef=0;Ef<fc.length;Ef++){var Of=fc[Ef],Nm=Of.toLowerCase(),Hm=Of[0].toUpperCase()+Of.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"),An("onMouseEnter",["mouseout","mouseover"]),An("onMouseLeave",["mouseout","mouseover"]),An("onPointerEnter",["pointerout","pointerover"]),An("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 Pa="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(Pa));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],v=s.instance,E=s.currentTarget;if(s=s.listener,v!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=E;try{u(a)}catch(U){Pu(U)}a.currentTarget=null,u=v}else for(o=0;o<n.length;o++){if(s=n[o],v=s.instance,E=s.currentTarget,s=s.listener,v!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=E;try{u(a)}catch(U){Pu(U)}a.currentTarget=null,u=v}}}}function Dt(t,e){var l=e[Gi];l===void 0&&(l=e[Gi]=new Set);var n=t+"__bubble";l.has(n)||(Qd(e,t,2,!1),l.add(n))}function _f(t,e,l){var n=0;e&&(n|=4),Qd(l,t,n,e)}var oi="_reactListening"+Math.random().toString(36).slice(2);function zf(t){if(!t[oi]){t[oi]=!0,qo.forEach(function(l){l!=="selectionchange"&&(qm.has(l)||_f(l,!1,t),_f(l,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[oi]||(e[oi]=!0,_f("selectionchange",!1,e))}}function Qd(t,e,l,n){switch(dh(e)){case 2:var a=fp;break;case 8:a=op;break;default:a=Qf}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 Df(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 v=o.tag;if((v===3||v===4)&&o.stateNode.containerInfo===a)return;o=o.return}for(;s!==null;){if(o=xn(s),o===null)return;if(v=o.tag,v===5||v===6||v===26||v===27){n=u=o;continue t}s=s.parentNode}}n=n.return}Po(function(){var E=u,U=Ki(l),H=[];t:{var O=Tr.get(t);if(O!==void 0){var _=Tu,vt=t;switch(t){case"keypress":if(xu(l)===0)break t;case"keydown":case"keyup":_=Dy;break;case"focusin":vt="focus",_=Fi;break;case"focusout":vt="blur",_=Fi;break;case"beforeblur":case"afterblur":_=Fi;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":_=vy;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 yt=(e&4)!==0,jt=!yt&&(t==="scroll"||t==="scrollend"),M=yt?O!==null?O+"Capture":null:O;yt=[];for(var x=E,T;x!==null;){var B=x;if(T=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||T===null||M===null||(B=ya(x,M),B!=null&&yt.push($a(x,B,T))),jt)break;x=x.return}0<yt.length&&(O=new _(O,vt,null,l,U),H.push({event:O,listeners:yt}))}}if(!(e&7)){t:{if(O=t==="mouseover"||t==="pointerover",_=t==="mouseout"||t==="pointerout",O&&l!==ki&&(vt=l.relatedTarget||l.fromElement)&&(xn(vt)||vt[Sn]))break t;if((_||O)&&(O=U.window===U?U:(O=U.ownerDocument)?O.defaultView||O.parentWindow:window,_?(vt=l.relatedTarget||l.toElement,_=E,vt=vt?xn(vt):null,vt!==null&&(jt=p(vt),yt=vt.tag,vt!==jt||yt!==5&&yt!==27&&yt!==6)&&(vt=null)):(_=null,vt=E),_!==vt)){if(yt=Wo,B="onMouseLeave",M="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(yt=tr,B="onPointerLeave",M="onPointerEnter",x="pointer"),jt=_==null?O:ha(_),T=vt==null?O:ha(vt),O=new yt(B,x+"leave",_,l,U),O.target=jt,O.relatedTarget=T,B=null,xn(U)===E&&(yt=new yt(M,x+"enter",vt,l,U),yt.target=T,yt.relatedTarget=jt,B=yt),jt=B,_&&vt)e:{for(yt=_,M=vt,x=0,T=yt;T;T=ea(T))x++;for(T=0,B=M;B;B=ea(B))T++;for(;0<x-T;)yt=ea(yt),x--;for(;0<T-x;)M=ea(M),T--;for(;x--;){if(yt===M||M!==null&&yt===M.alternate)break e;yt=ea(yt),M=ea(M)}yt=null}else yt=null;_!==null&&Vd(H,O,_,yt,!1),vt!==null&&jt!==null&&Vd(H,jt,vt,yt,!0)}}t:{if(O=E?ha(E):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 _t=Ly}else _=O.nodeName,!_||_.toLowerCase()!=="input"||O.type!=="checkbox"&&O.type!=="radio"?E&&Li(E.elementType)&&(F=fr):F=Ky;if(F&&(F=F(t,E))){cr(H,F,l,U);break t}_t&&_t(t,O,E),t==="focusout"&&E&&O.type==="number"&&E.memoizedProps.value!=null&&Zi(O,"number",O.value)}switch(_t=E?ha(E):window,t){case"focusin":(ir(_t)||_t.contentEditable==="true")&&(Un=_t,uc=E,Ma=null);break;case"focusout":Ma=uc=Un=null;break;case"mousedown":ic=!0;break;case"contextmenu":case"mouseup":case"dragend":ic=!1,vr(H,l,U);break;case"selectionchange":if($y)break;case"keydown":case"keyup":vr(H,l,U)}var nt;if(ec)t:{switch(t){case"compositionstart":var mt="onCompositionStart";break t;case"compositionend":mt="onCompositionEnd";break t;case"compositionupdate":mt="onCompositionUpdate";break t}mt=void 0}else Rn?ar(t,l)&&(mt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(mt="onCompositionStart");mt&&(er&&l.locale!=="ko"&&(Rn||mt!=="onCompositionStart"?mt==="onCompositionEnd"&&Rn&&(nt=$o()):(Dl=U,$i="value"in Dl?Dl.value:Dl.textContent,Rn=!0)),_t=ri(E,mt),0<_t.length&&(mt=new Fo(mt,t,null,l,U),H.push({event:mt,listeners:_t}),nt?mt.data=nt:(nt=ur(l),nt!==null&&(mt.data=nt)))),(nt=wy?jy(t,l):Qy(t,l))&&(mt=ri(E,"onBeforeInput"),0<mt.length&&(_t=new Fo("onBeforeInput","beforeinput",null,l,U),H.push({event:_t,listeners:mt}),_t.data=nt)),Bm(H,t,E,l,U)}jd(H,e)})}function $a(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($a(t,a,u)),a=ya(t,e),a!=null&&n.push($a(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,v=s.alternate,E=s.stateNode;if(s=s.tag,v!==null&&v===n)break;s!==5&&s!==26&&s!==27||E===null||(v=E,a?(E=ya(l,u),E!=null&&o.unshift($a(l,E,v))):a||(E=ya(l,u),E!=null&&o.push($a(l,E,v)))),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":pu(t,"class",n);break;case"tabIndex":pu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":pu(t,l,n);break;case"style":Ko(t,n,u);break;case"data":if(e!=="object"){pu(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&&Dt("scroll",t);break;case"onScrollEnd":n!=null&&Dt("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":Dt("beforetoggle",t),Dt("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 Rf(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&&Dt("scroll",t);break;case"onScrollEnd":n!=null&&Dt("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[Ue]||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":Dt("error",t),Dt("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":Dt("invalid",t);var s=u=o=a=null,v=null,E=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":v=U;break;case"defaultChecked":E=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,v,E,o,a,!1),vu(t);return;case"select":Dt("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":Dt("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),vu(t);return;case"option":for(v in l)if(l.hasOwnProperty(v)&&(n=l[v],n!=null))switch(v){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,e,v,n,l,null)}return;case"dialog":Dt("beforetoggle",t),Dt("toggle",t),Dt("cancel",t),Dt("close",t);break;case"iframe":case"object":Dt("load",t);break;case"video":case"audio":for(n=0;n<Pa.length;n++)Dt(Pa[n],t);break;case"image":Dt("error",t),Dt("load",t);break;case"details":Dt("toggle",t);break;case"embed":case"source":case"link":Dt("error",t),Dt("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(E in l)if(l.hasOwnProperty(E)&&(n=l[E],n!=null))switch(E){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,E,n,l,null)}return;default:if(Li(e)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&Rf(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,v=null,E=null,U=null;for(_ in l){var H=l[_];if(l.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":v=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":E=_;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)}}Vi(t,o,s,v,E,U,u,a);return;case"select":_=o=s=O=null;for(u in l)if(v=l[u],l.hasOwnProperty(u)&&v!=null)switch(u){case"value":break;case"multiple":_=v;default:n.hasOwnProperty(u)||wt(t,e,u,null,n,v)}for(a in n)if(u=n[a],v=l[a],n.hasOwnProperty(a)&&(u!=null||v!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==v&&wt(t,e,a,u,n,v)}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 vt in l)if(O=l[vt],l.hasOwnProperty(vt)&&O!=null&&!n.hasOwnProperty(vt))switch(vt){case"selected":t.selected=!1;break;default:wt(t,e,vt,null,n,O)}for(v in n)if(O=n[v],_=l[v],n.hasOwnProperty(v)&&O!==_&&(O!=null||_!=null))switch(v){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,e,v,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 yt in l)O=l[yt],l.hasOwnProperty(yt)&&O!=null&&!n.hasOwnProperty(yt)&&wt(t,e,yt,null,n,O);for(E in n)if(O=n[E],_=l[E],n.hasOwnProperty(E)&&O!==_&&(O!=null||_!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,e));break;default:wt(t,e,E,O,n,_)}return;default:if(Li(e)){for(var jt in l)O=l[jt],l.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Rf(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||Rf(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 Uf=null,Bf=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 Nf(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 Hf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===Hf?!1:(Hf=t,!0):(Hf=null,!1)}var Jd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,Pd=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof Pd!="undefined"?function(t){return Pd.resolve(null).then(t).catch(Qm)}:Jd;function Qm(t){setTimeout(function(){throw t})}function Ll(t){return t==="head"}function $d(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,v=o.nodeName;o[da]||v==="SCRIPT"||v==="STYLE"||v==="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 qf(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":qf(l),Xi(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 Cf(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 Yf=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]);Xi(t)}var Fe=new Map,Fd=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _l=j.d;j.d={f:km,r:Km,D:Jm,C:Pm,L:$m,m:Im,X:Fm,S:Wm,M:tp};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=ke(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 Pm(t,e){_l.C(t,e),th("preconnect",t,e)}function $m(t,e,l){_l.L(t,e,l);var n=la;if(n&&t&&e){var a='link[rel="preload"][as="'+ke(e)+'"]';e==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+ke(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+ke(l.imageSizes)+'"]')):a+='[href="'+ke(t)+'"]';var u=a;switch(e){case"style":u=na(t);break;case"script":u=aa(t)}Fe.has(u)||(t=g({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),Fe.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="'+ke(n)+'"][href="'+ke(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!Fe.has(u)&&(t=g({rel:"modulepreload",href:t},e),Fe.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=Tn(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=Fe.get(u))&&Gf(t,l);var v=o=n.createElement("link");se(v),ge(v,"link",t),v._p=new Promise(function(E,U){v.onload=E,v.onerror=U}),v.addEventListener("load",function(){s.loading|=1}),v.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=Tn(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0},e),(e=Fe.get(a))&&Xf(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 tp(t,e){_l.M(t,e);var l=la;if(l&&t){var n=Tn(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=Fe.get(a))&&Xf(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=Tn(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=Tn(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),Fe.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},Fe.set(t,l),u||ep(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=Tn(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="'+ke(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function lh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function ep(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="'+ke(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~="'+ke(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=Fe.get(a))&&Gf(n,a),u=(t.ownerDocument||t).createElement("link"),se(u);var o=u;return o._p=new Promise(function(s,v){o.onload=s,o.onerror=v}),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=Fe.get(u))&&(n=g({},l),Xf(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 Gf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function Xf(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 lp(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 np(){}function ap(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=pi.bind(n),t.then(n,n)),e.state.loading|=4,e.instance=u,se(u);return}u=t.ownerDocument||t,l=lh(l),(a=Fe.get(a))&&Gf(l,a),u=u.createElement("link"),se(u);var o=u;o._p=new Promise(function(s,v){o.onload=s,o.onerror=v}),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=pi.bind(n),t.addEventListener("load",e),t.addEventListener("error",e))}}function up(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&wf(t,t.stylesheets),0<t.count?function(e){var l=setTimeout(function(){if(t.stylesheets&&wf(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 pi(){if(this.count--,this.count===0){if(this.stylesheets)wf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var vi=null;function wf(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,vi=new Map,e.forEach(ip,t),vi=null,pi.call(t))}function ip(t,e){if(!(e.state.loading&4)){var l=vi.get(t);if(l)var n=l.get(null);else{l=new Map,vi.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=pi.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:V,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function cp(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,v,E,U,H){return t=new cp(t,e,l,o,s,v,E,H),e=1,u===!0&&(e|=24),u=Ge(3,null,null,e),t.current=u,u.stateNode=t,e=Sc(),e.refCount++,t.pooledCache=e,e.refCount++,u.memoizedState={element:n,isDehydrated:l,cache:e},Ac(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&&(Ve(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 jf(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&&Ve(e,t,67108864),jf(t,67108864)}}var gi=!0;function fp(t,e,l,n){var a=D.T;D.T=null;var u=j.p;try{j.p=2,Qf(t,e,l,n)}finally{j.p=u,D.T=a}}function op(t,e,l,n){var a=D.T;D.T=null;var u=j.p;try{j.p=8,Qf(t,e,l,n)}finally{j.p=u,D.T=a}}function Qf(t,e,l,n){if(gi){var a=Vf(n);if(a===null)Df(t,e,n,bi,l),hh(t,n);else if(sp(a,t,e,l,n))n.stopPropagation();else if(hh(t,n),e&4&&-1<rp.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 v=1<<31-xt(o);s.entanglements[1]|=v,o&=~v}sl(u),!(Ct&6)&&(li=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Ve(s,u,2),ai(),jf(u,2)}if(u=Vf(n),u===null&&Df(t,e,n,bi,l),u===a)break;a=u}a!==null&&n.stopPropagation()}else Df(t,e,n,null,l)}}function Vf(t){return t=Ki(t),Zf(t)}var bi=null;function Zf(t){if(bi=null,t=xn(t),t!==null){var e=p(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(It()){case Zt:return 2;case kt:return 8;case Pt:case Lt:return 32;case ae:return 268435456;default:return 32}default:return 32}}var Lf=!1,kl=null,Kl=null,Jl=null,lu=new Map,nu=new Map,Pl=[],rp="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 sp(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=p(e);if(l!==null){if(e=l.tag,e===13){if(e=b(l),e!==null){t.blockedOn=e,Yi(t.priority,function(){if(l.tag===13){var n=Qe();n=sa(n);var a=Hn(l,n);a!==null&&Ve(a,l,n),jf(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=Vf(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 dp(){Lf=!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,Lf||(Lf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dp)))}var Mi=null;function ph(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(Zf(n||l)===null)continue;break}var u=Mn(l);u!==null&&(t.splice(e,3),e-=3,Vc(u,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function uu(t){function e(v){return xi(v,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<Pl.length;l++){var n=Pl[l];n.blockedOn===t&&(n.blockedOn=null)}for(;0<Pl.length&&(l=Pl[0],l.blockedOn===null);)yh(l),l.blockedOn===null&&Pl.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[Ue]||null;if(typeof u=="function")o||ph(l);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Ue]||null)s=o.formAction;else if(Zf(a)!==null)continue}else s=o.action;typeof s=="function"?l[n+1]=s:(l.splice(n,3),n-=3),ph(l)}}}function kf(t){this._internalRoot=t}Ti.prototype.render=kf.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(f(409));var l=e.current,n=Qe();oh(l,n,t,e,null,null)},Ti.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 Ti(t){this._internalRoot=t}Ti.prototype.unstable_scheduleHydration=function(t){if(t){var e=bn();t={blockedOn:null,target:t,priority:e};for(var l=0;l<Pl.length&&e!==0&&e<Pl[l].priority;l++);Pl.splice(l,0,t),l===0&&yh(t)}};var vh=i.version;if(vh!=="19.1.1")throw Error(f(527,vh,"19.1.1"));j.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 hp={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ai=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ai.isDisabled&&Ai.supportsFiber)try{Ut=Ai.inject(hp),ut=Ai}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,zf(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,v=null,E=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&&(v=l.unstable_transitionCallbacks),l.formState!==void 0&&(E=l.formState)),e=ch(t,1,!0,e,l!=null?l:null,n,a,u,o,s,v,E),e.context=fh(null),l=e.current,n=Qe(),n=sa(n),a=Bl(n),a.callback=null,Nl(l,a,n),l=n,e.current.lanes=l,Oe(e,l),sl(e),t[Sn]=e.current,zf(t),new Ti(e)},ua.version="19.1.1",ua}function no(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(no)}catch(c){console.error(c)}}no(),$f.exports=_h();var zh=$f.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,ao=Object.getOwnPropertySymbols,qh=Object.prototype.hasOwnProperty,Ch=Object.prototype.propertyIsEnumerable,uo=(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)&&uo(c,r,i[r]);if(ao)for(var r of ao(i))Ch.call(i,r)&&uo(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 p=this.state.sectors[r];p&&(p.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(p=>p.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 p=h,b=p.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:p.sectorId,array:p.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,p=(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<=p)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 p=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>=p&&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 p=i[h],b=i[f];if(!(!p||!b)&&jh(c,p,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const p=i[f],b=i[h];if(!p||!b)continue;const S=p.x,y=p.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 io(c,i,r){let f=1/0,h=-1/0;for(const p of c){const b=p.x*i+p.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 p=f[h],b=f[(h+1)%f.length];if(!p||!b)continue;const S=b.x-p.x,y=-(b.y-p.y),m=S,g=io(c,y,m),A=io(i,y,m);if(g.max<=A.min+mn||A.max<=g.min+mn)return!1}return!0}function Vh(c,i){const r=c.map(h=>{let p=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<p&&(p=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:p,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let p=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<p&&(p=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:p,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let p=0;p<i.length;p++){const b=c[h],S=i[p],y=r[h],m=f[p];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 p=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:p,height:b,cx:(i+f)/2,cy:(r+h)/2}}function co(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 p=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:p,height:b}}function fo(c){return co(c.shape)}function Lh(c,i){if(c.shape&&c.shape.length)return co(c.shape);let r=1/0,f=1/0,h=-1/0,p=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=fo(m),A=y.offset.x+g.min.x,R=y.offset.y+g.min.y,G=y.offset.x+g.max.x,w=y.offset.y+g.max.y;A<r&&(r=A),R<f&&(f=R),G>h&&(h=G),w>p&&(p=w)}const b=Math.max(0,h-r),S=Math.max(0,p-f);return{min:{x:r,y:f},max:{x:h,y:p},width:b,height:S}}function ne(c,i){return"parts"in c?Lh(c,i):fo(c)}const Te=k.layout.grid.stepPx;function pn(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(p=>p.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}]],p=[];for(const b of h)for(const S of b)p.push({x:S.x-r,y:S.y-f});return p}function ca(c,i,r,f,h,p){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 A=y/g,R=m/g;let G=-1/0,w=-1/0;for(const Z of r.support){const $=Z.x*A+Z.y*R;$>G&&(G=$);const gt=-(Z.x*A+Z.y*R);gt>w&&(w=gt)}if(h==="workspace"){const[Z,$]=f.bands.workspace,gt=p?0:Z+w,Mt=$-G,V=Math.min(Math.max(g,gt),Mt);if(Math.abs(V-g)<1e-6)return{x:c,y:i};const ft=f.cx+V*A,L=f.cy+V*R;return{x:ft-r.aabb.width/2,y:L-r.aabb.height/2}}else{const Z=f.bands.silhouette[1]-G;if(g<=Z)return{x:c,y:i};const $=f.cx+Z*A,gt=f.cy+Z*R;return{x:$-r.aabb.width/2,y:gt-r.aabb.height/2}}}function oo(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],p=r[(f+1)%r.length];if(!h||!p)continue;const b=Math.round(Math.abs(p.x-h.x)),S=Math.round(Math.abs(p.y-h.y));b&&(i=i?oo(i,b):b),S&&(i=i?oo(i,S):S)}return i||1}function ro(c,i,r){if(!c||c.length===0)return[];const f=Zh(c),h=(f.min.x+f.max.x)/2,p=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Te)*Te,S=Math.round(r.cy/Te)*Te,y=b-i*h,m=S-i*p,g=Math.round(y/Te)*Te,A=Math.round(m/Te)*Te;return c.map(R=>R.map(G=>({x:i*G.x+g,y:i*G.y+A})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Te)*Te,h=Math.ceil(c.y/Te)*Te;for(let p=h;p<=i.y;p+=Te)for(let b=f;b<=i.x;b+=Te)r.push({x:b,y:p});return r}function Di(c,i,r,f){const[h,p]=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>p)){if(f){let A=Math.atan2(m,y);if(i.mode==="circle"?A<-Math.PI/2&&(A+=2*Math.PI):A<Math.PI&&(A+=2*Math.PI),A<f.start||A>=f.end)continue}b.push(S)}}return b}function Kh(c,i,r=cu){const f=[];t:for(const h of c)for(const p of i)if(r(h,p)){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 p of f){const b=p.x-c.cx,S=p.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(p)}return h}const ou=(c,i=Te)=>c*Math.SQRT2*i;function so(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 Ph(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],p=r[(f+1)%r.length];if(!h||!p)continue;const b=Math.round(Math.abs(p.x-h.x)),S=Math.round(Math.abs(p.y-h.y));b&&(i=i?so(i,b):b),S&&(i=i?so(i,S):S)}return i||1}function $h(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 p=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:p,cy:b}}function ho(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:p,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,A=((i=c.masks)!=null?i:[]).flat(),R=A.length?Ph(A):0,G=R?2*S/R:1;let w=0;if(c.masks&&c.masks.length)for(const j of c.masks){if(!(j!=null&&j.length))continue;const P=$h(j),{cx:X,cy:d}=P;for(const z of j)for(const q of z){const C=(q.x-X)*G,J=(q.y-d)*G,ot=Math.hypot(C,J);ot>w&&(w=ot)}}const Z=f==="circle"?Math.PI*2:Math.PI,$=Z/Math.max(1,r),gt=Z/Math.max(1,p),Mt=Z/Math.max(1,b),V=Math.sin($/2),ft=Math.sin(gt/2),L=Math.sin(Mt/2),dt=ou(y,S),I=ou(m,S),it=ou(g,S),et=I*(.5+1/(2*Math.max(1e-9,ft))),pt=it*(.5+1/(2*Math.max(1e-9,L))),Rt=dt/(2*Math.max(1e-9,V))-dt/2,K=Math.max(et,pt,Rt),bt=dt,ht=h==="workspace"?2*w:0,Et=bt+ht,D=K+Et;return{innerR_min:K,dr_min:Et,outerR_min:D,Tw_min:bt,Tp_min:ht,Rshape_px_max:w}}function Ih(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:p,D_ws_px:b}=c,S=f+h;if(i<r+S){const gt=r+S;return{innerR:r,Tw:f,Tp:h,outerR:gt}}const y=i,m=r,g=y-m,A=Math.max(0,g-S),R=1,G=1+p/Math.max(1e-9,b),w=A*(R/(R+G)),Z=f+w,$=g-Z;return{innerR:m,Tw:Z,Tp:$,outerR:y}}function Wh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=ho(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",p){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,A=f==="semicircle"?c.h-y:g,R=Math.min(m,A)-y,G=ho({n:i,layoutMode:f,target:h,qsMaxSlots:p.qsMaxSlots,primitivesSlots:p.primitivesSlots,masks:(b=p.masks)!=null?b:[]});let w,Z,$;if(h==="workspace"){const dt=ou(k.layout.constraints.workspaceDiamAnchors),I=Ih({outerRViewportBound:R,innerR_min:G.innerR_min,Tw_min:G.Tw_min,Tp_min:G.Tp_min,Rshape_px_max:G.Rshape_px_max,D_ws_px:dt});w=I.innerR,Z=I.outerR,$={workspace:[I.innerR,I.innerR+I.Tw],silhouette:[I.innerR+I.Tw,I.outerR]}}else Z=Math.max(R,G.outerR_min),w=Math.min(G.innerR_min,Z),Z<G.outerR_min&&(Z=G.outerR_min,w=G.innerR_min),$={silhouette:[w,Z],workspace:[w,Z]};const gt=f==="circle"?Math.PI*2:Math.PI,Mt=f==="circle"?-Math.PI/2:Math.PI,V=Mt+gt,ft=gt/i,L=[];for(let dt=0;dt<i;dt++){const I=(S=r[dt])!=null?S:String(dt),it=Mt+dt*ft,et=it+ft,pt=(it+et)/2;L.push({id:I,index:dt,start:it,end:et,mid:pt})}return{mode:f,cx:m,cy:g,innerR:w,outerR:Z,sectors:L,bands:$,sweepStart:Mt,sweepEnd:V}}function Ri(c,i,r,f,h,p){const b=p-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),A=c+f*Math.cos(p),R=i+f*Math.sin(p),G=c+r*Math.cos(p),w=i+r*Math.sin(p);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${A} ${R}`,`L ${G} ${w}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function yo(c,i,r,f){var h;const p=c-r.cx,b=i-r.cy,S=Math.hypot(p,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,p);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const A of r.sectors)if(g>=A.start&&g<A.end)return A.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function mo(c,i,r,f=.85){const[h,p]=c.bands[r],b=(h+p)/2,S=p-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),A=c.cy+b*Math.sin(i.mid);return{cx:g,cy:A,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 Ui(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},p={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=p.x-h.x,S=p.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 A=0;A<y;A++){const R=Math.round(h.x+A*m),G=Math.round(h.y+A*g),w=Math.round(h.x+(A+1)*m),Z=Math.round(h.y+(A+1)*g);f.push({a:{x:R,y:G},b:{x:w,y:Z}})}return f}function fa(c,i,r,f,h){let p;try{p=f(c.blueprintId)}catch(G){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",G),[]}if(!(p!=null&&p.shape))return[];const b=p.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=ne(p,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,A=b.map(G=>({x:G.x+m,y:G.y+g})),R=[];for(let G=0;G<A.length;G++){const w=A[G],Z=A[(G+1)%A.length];if(!w||!Z){R.push(!1);continue}const $=Ui(w,Z,S);let gt=!1;if(c.blueprintId.startsWith("comp:"))for(let Mt=0;Mt<p.shape.length;Mt++){if(Mt===i)continue;const V=p.shape[Mt];if(!V)continue;const ft=V.map(L=>({x:L.x+m,y:L.y+g}));for(let L=0;L<ft.length;L++){const dt=ft[L],I=ft[(L+1)%ft.length];if(!dt||!I)continue;const it=Ui(dt,I,S);for(const et of $)if(it.some(pt=>et.a.x===pt.a.x&&et.a.y===pt.a.y&&et.b.x===pt.b.x&&et.b.y===pt.b.y||et.a.x===pt.b.x&&et.a.y===pt.b.y&&et.b.x===pt.a.x&&et.b.y===pt.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(!gt&&k.game.hideTouchingBorders)for(const Mt of r){if(Mt.id===c.id)continue;const V=f(Mt.blueprintId);if(!(V!=null&&V.shape))continue;const ft=ne(V,h),L=Mt.pos.x-ft.min.x,dt=Mt.pos.y-ft.min.y;for(const I of V.shape){const it=I.map(et=>({x:et.x+L,y:et.y+dt}));for(let et=0;et<it.length;et++){const pt=it[et],Rt=it[(et+1)%it.length];if(!pt||!Rt)continue;const K=Ui(pt,Rt,S);for(const bt of $)if(K.some(ht=>bt.a.x===ht.a.x&&bt.a.y===ht.a.y&&bt.b.x===ht.b.x&&bt.b.y===ht.b.y||bt.a.x===ht.b.x&&bt.a.y===ht.b.y&&bt.b.x===ht.a.x&&bt.b.y===ht.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(gt)break}R.push(gt)}return R}function e0(c){return k.game.hideTouchingBorders}var l0=Object.defineProperty,n0=Object.defineProperties,a0=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertySymbols,u0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,vo=(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)&&vo(c,r,i[r]);if(po)for(var r of po(i))i0.call(i,r)&&vo(c,r,i[r]);return c},su=(c,i)=>n0(c,a0(i));function Bi(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:p,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:A,draggingId:R,selectedPieceId:G,dragInvalid:w,lockedPieceId:Z,svgRef:$,setPieceRef:gt,onPiecePointerDown:Mt,onBlueprintPointerDown:V,onRootPointerDown:ft,onPointerMove:L,onPointerUp:dt,onCenterBadgePointerDown:I}=c,it=f.w,et=f.h,pt=i.state.blueprintView,Rt=pt==="primitives"?i.state.primitives:i.state.quickstash,K=i.state.cfg.maxQuickstashSlots,bt=i.state.primitives.length,ht=pt==="primitives"?Math.max(1,bt):Math.max(1,K),Et=(r.mode==="circle"?Math.PI*2:Math.PI)/ht,D=r.mode==="circle"?-Math.PI/2:Math.PI,j=N=>D+(N+.5)*Et,P=(N,at=k.layout.grid.stepPx)=>N*Math.SQRT2*at,X=pt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=P(X),z=d/(2*Math.max(1e-9,Math.sin(Et/2))),q=b+k.size.centerBadge.marginPx+d/2,C=r.innerR-(b+k.size.centerBadge.marginPx),J=Math.min(Math.max(z,q),C),ot=(N,at,W)=>{const lt=ne(N,St=>i.getPrimitive(St)),ct=lt.min.x+lt.width/2,Y=lt.min.y+lt.height/2;return tt.createElement("g",{key:N.id,transform:`translate(${at}, ${W}) scale(1) translate(${-ct}, ${-Y})`},("shape"in N?N.shape:[]).map((St,st)=>tt.createElement("path",{key:st,d:Bi(St),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>V(Jt,N,{bx:at,by:W,cx:ct,cy:Y})})))};return tt.createElement("svg",{ref:$,width:h,height:p,viewBox:`0 0 ${it} ${et}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:L,onPointerUp:dt,onPointerDown:N=>{ft(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,at)=>{const W=!!i.state.sectors[N.id].completedAt,lt=at%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,ct=at%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,Y=r.bands.silhouette,St=r.bands.workspace;return tt.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?tt.createElement(tt.Fragment,null,tt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:lt,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),tt.createElement("path",{d:Ri(r.cx,r.cy,St[0],St[1],N.start,N.end),fill:W?k.color.completion.fill:ct,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):tt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:W?k.color.completion.fill:lt,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=ne(at,Gt=>i.getPrimitive(Gt)),lt=R===N.id,ct=N.sectorId&&i.isSectorCompleted(N.sectorId),Y=Z===N.id,St=G===N.id,st=lt&&w,Jt=N.x-W.min.x,te=N.y-W.min.y;return tt.createElement("g",{key:N.id,ref:gt(N.id),transform:`translate(${Jt}, ${te})`,style:{cursor:ct?"default":A?"pointer":"grab"},pointerEvents:A&<?"none":"auto"},("shape"in at?at.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),tt.createElement(tt.Fragment,{key:Nt},tt.createElement("path",{d:Bi(Gt),fill:Y||st?k.color.piece.invalidFill:lt?k.color.piece.draggingFill:k.color.piece.validFill,opacity:Y||st?k.opacity.piece.invalid:lt?k.opacity.piece.dragging:ct?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:It=>Mt(It,N)}),(()=>{const It=g.filter(Q=>Q.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),kt=It.map(Q=>su(ru({},Q),{pos:{x:Q.x,y:Q.y}})),Pt=fa(Zt,Nt,kt,Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)),Lt=R?It.find(Q=>Q.id===R):null;let ae;if(N.blueprintId.startsWith("comp:")){const Q=fa(Zt,Nt,[],rt=>i.getBlueprint(rt),rt=>i.getPrimitive(rt));ae=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],rt=>i.getBlueprint(rt),rt=>i.getPrimitive(rt)):new Array(Pt.length).fill(!1)).map((rt,Ut)=>rt&&!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(Pt.length).fill(!1);return t0(Gt).map((Q,rt)=>{const Ut=ae[rt]||!1;let ut;return lt&&N.blueprintId.startsWith("comp:")?ut=fa(Zt,Nt,[],Tt=>i.getBlueprint(Tt),Tt=>i.getPrimitive(Tt))[rt]||!1:ut=lt?!1:(Pt[rt]||!1)&&!Ut,tt.createElement("path",{key:`stroke-${Nt}-${rt}`,d:Q,fill:"none",stroke:ut?"none":Y||st?k.color.piece.invalidStroke:St||lt?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ut?0:St||lt?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:Tt=>Mt(Tt,N)})})})()))))}),r.sectors.map(N=>{var at;const W=(at=y.get(N.id))!=null?at:[];return W.length?tt.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((lt,ct)=>tt.createElement("path",{key:ct,d:Bi(lt),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:at,invalid:W})=>{const lt=N==="inner-ring";return tt.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((ct,Y)=>tt.createElement("circle",{key:`inv-${Y}`,cx:ct.x,cy:ct.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),at.map((ct,Y)=>tt.createElement("circle",{key:`val-${Y}`,cx:ct.x,cy:ct.y,r:lt?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:lt?k.color.anchors.invalid:k.color.anchors.valid,opacity:lt?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 tt.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?I:void 0},tt.createElement("circle",{r:b,fill:at?k.color.blueprint.badgeFill:"#ccc",opacity:at?1:.5}),tt.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:at?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Rt.map((N,at)=>{const W=j(at),lt=r.cx+J*Math.cos(W),ct=r.cy+J*Math.sin(W);return ot(N,lt,ct)}),i.state.endedAt&&tt.createElement("g",{pointerEvents:"none"},tt.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},tt.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),tt.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 p of c)for(const b of p)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,p=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=p;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),p=o0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of p)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 p of i)p.x<r&&(r=p.x),p.y<f&&(f=p.y);const h=new Set;for(const p of i)h.add(`${p.x-r},${p.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),p=go(f);return d0(h,p)}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=tt.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=tt.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=tt.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const A=c.getBlueprint(g.blueprintId),R=ne(A,c.getPrimitive);y.push(...pn(A,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=tt.useRef(new Map),p=tt.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=tt.useCallback(S=>{const y=p(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},[p,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class p0{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 p=ne(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-p.min.x),y:i.y+(b.y-p.min.y)};let y=null,m=1/0;for(const R of h){const G=R.x-S.x,w=R.y-S.y,Z=G*G+w*w;Z<m&&(m=Z,y=R)}const g=Math.sqrt(m),A=g<=this.config.snapRadiusPx;return{tl:y&&A?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:A}}snapTopLeftToNodes(i,r,f,h){const{tl:p}=this.nearestNodeSnap(i,r,f,h);return p}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},p=fu(f,h);return Di(p,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},p={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,p),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},p=fu(f,h);return Di(p,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 p=(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,A=m.y-y.y,R=Math.hypot(g,A),G=Math.max(1,Math.ceil(R/p));for(let w=0;w<=G;w++){const Z=w/G,$={x:y.x+Z*g,y:y.y+Z*A};if(!this.insideAnySilhouette($,r))return!1}}return!0}}function v0(){return new p0({stepPx:k.layout.grid.stepPx,snapRadiusPx:k.game.snapRadiusPx,densitySampleStepPx:Math.max(1,Math.round(k.layout.grid.stepPx/3))})}const oa=v0();function Ni(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:tt.useMemo(()=>{var h,p;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=(p=(h=c.state.cfg.sectors.find($=>$.id===S.id))==null?void 0:h.silhouette.mask)!=null?p:[];if(!y||y.length===0)continue;const m=mo(i,S,"silhouette",1),g=ro(y,r,{cx:m.cx,cy:m.cy}),A=x0(i,S),R=S0(i,S,g),G=$=>`${$.x},${$.y}`,w=new Set(R.map(G)),Z=A.filter($=>!w.has(G($)));b.push({sectorId:S.id,valid:R,invalid:Z})}return b},[f.target,c.state.sectors,i,r])}}function T0(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},p={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=p.x-h.x,S=p.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 A=0;A<y;A++){const R=Math.round(h.x+A*m),G=Math.round(h.y+A*g),w=Math.round(h.x+(A+1)*m),Z=Math.round(h.y+(A+1)*g);f.push({a:{x:R,y:G},b:{x:w,y:Z}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const p=ne(h,r),b=c.pos.x-p.min.x,S=c.pos.y-p.min.y,y=[];for(const m of h.shape){const g=m.map(A=>({x:A.x+b,y:A.y+S}));for(let A=0;A<g.length;A++){const R=g[A],G=g[(A+1)%g.length];!R||!G||y.push(...T0(R,G,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,p=So(c,r,f,h);if(p.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=p.filter(A=>m.some(R=>A.a.x===R.a.x&&A.a.y===R.a.y&&A.b.x===R.b.x&&A.b.y===R.b.y||A.a.x===R.b.x&&A.a.y===R.b.y&&A.b.x===R.a.x&&A.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function A0(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 p=new Map;for(const m of h)p.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const A=h[m],R=h[g];!A||!R||xo(A,[R],r,f).isAttached&&(p.get(A.id).push(R.id),p.get(R.id).push(A.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=p.get(m)||[];for(const A of g)y(A)}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,To=(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)&&To(c,r,i[r]);if(Mo)for(var r of Mo(i))D0.call(i,r)&&To(c,r,i[r]);return c},U0=(c,i)=>O0(c,_0(i));function B0(c,i,r,f,h,p,b,S,y,m,g){const A=c.state.cfg,R=A.input==="click",G=tt.useRef(null),w=tt.useRef(null),[Z,$]=tt.useState(null),gt=tt.useRef(new Map),[Mt,V]=tt.useState(null);tt.useEffect(()=>{Z===null&&(w.current=null)},[Z]);const ft=X=>d=>{const z=gt.current;d?z.set(X,d):z.delete(X)},L=(X,d)=>{const z=G.current,q=z.createSVGPoint();q.x=X,q.y=d;const C=z.getScreenCTM();if(!C)return{x:0,y:0};const J=q.matrixTransform(C.inverse());return{x:J.x,y:J.y}},dt=()=>{if(!w.current)return;const X=w.current;X.raf==null&&(X.raf=requestAnimationFrame(()=>{X.raf=null;const d=gt.current.get(X.id);d&&d.setAttribute("transform",`translate(${X.tlx-X.minx}, ${X.tly-X.miny})`)}))},I=(X,d)=>yo(X,d,i,A.target),it=k.layout.grid.stepPx,et=X=>{if(!X)return null;const d=Math.round(X.x/it),z=Math.round(X.y/it);return`${d},${z}`},pt=X=>({x:Math.round(X.x/it)*it,y:Math.round(X.y/it)*it}),Rt=(X,d)=>{if(!w.current)return;const z=w.current,q=pt(X),C=et(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},K=(X,d,z)=>{if(!w.current)return;const q=w.current;q.snapAnchor=X,q.snapAnchorId=et(X),q.snapAnchorSectorId=d,q.snapAnchorDist=X&&z!==void 0?z:null},bt=(X,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(X,d,z)},ht=X=>{const d=c.findPiece(X);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=ne(z,c.getPrimitive);return pn(z,q,d.pos).map(C=>C.map(J=>[J.x,J.y]))},Et=(X,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&Z)return;if(A.mode==="prep"&&d.sectorId){const lt=c.getPiecesInSector(d.sectorId),ct=c.findPiece(d.id);if(ct&&A0(ct,lt,Y=>c.getBlueprint(Y),Y=>c.getPrimitive(Y))){V(d.id),setTimeout(()=>V(null),500);return}}if(R){X.stopPropagation();const lt=c.getBlueprint(d.blueprintId),ct=ne(lt,Gt=>c.getPrimitive(Gt)),Y=ia(lt,ct),{x:St,y:st}=L(X.clientX,X.clientY),Jt=pt({x:St,y:st}),te=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,te),g){const Gt="kind"in lt?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},ht(d.id),d.sectorId)}w.current={id:d.id,dx:St-d.x,dy:st-d.y,tlx:d.x,tly:d.y,aabb:{width:ct.width,height:ct.height},minx:ct.min.x,miny:ct.min.y,support:Y,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:Jt,pointerAnchorId:et(Jt),pointerAnchorSectorId:te,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},K(null,d.sectorId),$(d.id),y();return}(z=G.current)==null||z.setPointerCapture(X.pointerId);const q=c.getBlueprint(d.blueprintId),C=ne(q,lt=>c.getPrimitive(lt)),J=ia(q,C),{x:ot,y:N}=L(X.clientX,X.clientY),at=pt({x:ot,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(at.x,at.y,W),g){const lt="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,lt,"sector",{x:d.x,y:d.y},ht(d.id),d.sectorId)}w.current={id:d.id,dx:ot-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:J,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:at,pointerAnchorId:et(at),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},K(null,d.sectorId),$(d.id),y()},D=X=>{var d,z,q,C,J,ot,N,at;const{x:W,y:lt}=L(X.clientX,X.clientY),ct=pt({x:W,y:lt}),Y=Math.hypot(W-i.cx,lt-i.cy),St=Y<i.innerR?void 0:(d=I(W,lt))!=null?d:void 0;if(!w.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(ct.x,ct.y,St);return}const st=w.current,Jt=W-st.dx,te=lt-st.dy;Rt({x:W,y:lt},St);let Gt=ca(Jt,te,{aabb:st.aabb,support:st.support},i,c.state.cfg.target,Y<i.innerR);const Nt=Gt.x+st.aabb.width/2,It=Gt.y+st.aabb.height/2,Zt=Math.hypot(Nt-i.cx,It-i.cy)<i.innerR,kt=Zt?null:I(Nt,It);let Pt=null,Lt=null,ae=kt!=null?kt:void 0,Q=!1,rt=!1;if(Zt){const Ut=h.find(ut=>ut.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ut=f(st.id);if(ut){const Tt=c.getBlueprint(ut.blueprintId),xt=Ni(Gt,Tt,c.getPrimitive,Ut.valid);Gt=xt.tl,Pt=xt.node,Lt=xt.dist,ae=void 0}}st.validSnap=!1}else if(kt){const Ut=b(kt),ut=h.find(xt=>xt.sectorId===kt),Tt=A.target==="workspace"&&A.mode!=="prep"?(z=ut==null?void 0:ut.valid)!=null?z:[]:[...(q=ut==null?void 0:ut.valid)!=null?q:[],...(C=ut==null?void 0:ut.invalid)!=null?C:[]];if(Tt.length){const xt=f(st.id);if(xt){const Ce=c.getBlueprint(xt.blueprintId),De=Ni(Gt,Ce,c.getPrimitive,Tt);if(Gt=De.tl,Pt=De.node,Lt=De.dist,ae=kt,Ut)st.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,nl=f(st.id);let Ee=!0;if(nl){const ce=c.getBlueprint(nl.blueprintId),dl=ne(ce,c.getPrimitive),Re=pn(ce,dl,Gt),Ci=r.filter(re=>re.id!==st.id&&I(re.x+ne(c.getBlueprint(re.blueprintId),c.getPrimitive).width/2,re.y+ne(c.getBlueprint(re.blueprintId),c.getPrimitive).height/2)===kt);for(const re of Ci){const al=c.getBlueprint(re.blueprintId),ul=ne(al,c.getPrimitive),Oe=pn(al,ul,{x:re.x,y:re.y});if(Vh(Re,Oe)){Ee=!1;break}}if(A.target==="workspace"){if(A.mode==="prep"){const re=c.getPiecesInSector(kt),al=re.filter(bn=>bn.id!==st.id),ul=al.length===0,Oe=c.findPiece(st.id),zl=Oe==null?void 0:Oe.sectorId,ra=(J=c.state.cfg.maxCompositeSize)!=null?J:0,yu=ra>0,sa=re.length-(zl===kt?1:0),il=yu&&sa+1>ra;if(ul)st.validSnap=Ee&&!il,rt=il;else if(Oe){const bn=U0(R0({},Oe),{pos:{x:Gt.x,y:Gt.y}}),Yi=xo(bn,al,Ze=>c.getBlueprint(Ze),Ze=>c.getPrimitive(Ze));st.validSnap=Ee&&Yi.isAttached&&!il,rt=il}else st.validSnap=Ee&&!il,rt=il}else st.validSnap=Ee,rt=!1;Q=!Ee}else{const re=zl=>`${zl.x},${zl.y}`,al=new Set(((ot=ut==null?void 0:ut.valid)!=null?ot:[]).map(re)),ul=!!De.node&&al.has(re(De.node))&&De.dist<=(gn!=null?gn:0);let Oe=!1;if(ul){const zl=(N=p.get(kt))!=null?N:[];Oe=g0(Re,zl)}st.validSnap=ul&&Oe&&Ee,Q=!Ee}}}}}}else st.validSnap=c.state.cfg.target==="workspace",Pt=null,Lt=null,ae=void 0,rt=!1;st.overlaps=Q,st.maxExceeded=rt,K(Pt,ae,Lt!=null?Lt:void 0),st.tlx=Gt.x,st.tly=Gt.y,st.prevValidSnap!==st.validSnap&&(st.prevValidSnap=(at=st.validSnap)!=null?at:!1,y()),dt()},j=()=>{var X,d,z,q,C,J,ot,N,at,W,lt,ct;if(!w.current||R)return;const Y=w.current;if(Y.validSnap===!1){const It=c.findPiece(Y.id),Zt=c.state.cfg,kt=Y.tlx+Y.aabb.width/2,Pt=Y.tly+Y.aabb.height/2,Lt=I(kt,Pt);let ae="outside_bounds";if(Y.maxExceeded?ae="no_valid_anchor":Y.overlaps?ae="overlapping":Lt&&(ae="no_valid_anchor"),bt({x:kt,y:Pt},"invalid_placement",{invalidPlacement:{reason:ae,attemptedSectorId:Lt!=null?Lt:void 0}}),Zt.mode==="prep"&&Y.originalPos)c.move(Y.id,{x:Y.originalPos.x,y:Y.originalPos.y}),g&&g.recordPlacedown("placed",Y.originalPos.sectorId,{x:Y.originalPos.x,y:Y.originalPos.y},ht(Y.id),(X=Y.snapAnchorId)!=null?X:void 0,!1,(d=Y.overlaps)!=null?d:!1);else{const Q=It==null?void 0:It.sectorId;c.remove(Y.id),Q&&S(Q),g&&g.recordPlacedown("deleted",Q,void 0,void 0,(z=Y.snapAnchorId)!=null?z:void 0,!1,(q=Y.overlaps)!=null?q:!1)}w.current=null,$(null),y();return}w.current=null,Y.raf&&(cancelAnimationFrame(Y.raf),Y.raf=null);const St={x:Y.tlx,y:Y.tly},st=St.x+Y.aabb.width/2,Jt=St.y+Y.aabb.height/2;if(Math.hypot(st-i.cx,Jt-i.cy)<i.innerR){const It=c.findPiece(Y.id),Zt=It==null?void 0:It.sectorId;c.remove(Y.id),Zt&&S(Zt),g&&g.recordPlacedown("deleted",Zt,void 0,void 0,(C=Y.snapAnchorId)!=null?C:void 0,!1,(J=Y.overlaps)!=null?J:!1),$(null),y();return}const te=I(st,Jt);if(te&&b(te)){bt({x:st,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:te}}),Y.originalPos?(c.move(Y.id,{x:Y.originalPos.x,y:Y.originalPos.y}),Y.originalPos.sectorId&&c.drop(Y.id,Y.originalPos.sectorId),g&&g.recordPlacedown("placed",Y.originalPos.sectorId,{x:Y.originalPos.x,y:Y.originalPos.y},ht(Y.id),(ot=Y.snapAnchorId)!=null?ot:void 0,!1,(N=Y.overlaps)!=null?N:!1)):(c.remove(Y.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(at=Y.snapAnchorId)!=null?at:void 0,!1,(W=Y.overlaps)!=null?W:!1)),$(null),y();return}c.move(Y.id,St),c.drop(Y.id,te);const Gt=te?S(te):!1,Nt=Y.validSnap===void 0?!0:Y.validSnap;g&&g.recordPlacedown("placed",te,St,ht(Y.id),(lt=Y.snapAnchorId)!=null?lt:void 0,Nt,(ct=Y.overlaps)!=null?ct:!1,Gt),$(null),Y.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},P=(X,d,z)=>{var q,C,J,ot,N,at,W,lt;if(R&&Z)return;X.stopPropagation();const{x:ct,y:Y}=L(X.clientX,X.clientY),St=ne(d,c.getPrimitive),st=ia(d,St);if(R){const Pt=bo(ct,Y,z),Lt={x:ct-(Pt.x-St.min.x),y:Y-(Pt.y-St.min.y)},ae=Math.hypot(ct-i.cx,Y-i.cy)<i.innerR,Q=ca(Lt.x,Lt.y,{aabb:St,support:st},i,c.state.cfg.target,ae),rt=c.spawnFromBlueprint(d,Q),Ut=pt({x:ct,y:Y}),ut=(q=I(ct,Y))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ut),g){const ce="kind"in d?"primitive":"composite";g.recordPickup(rt,d.id,ce,"blueprint",Q,ht(rt),void 0)}const Tt=Q;let xt=Tt,Ce=null;const De=Tt.x+St.width/2,gn=Tt.y+St.height/2,nl=I(De,gn);if(nl){const ce=h.find(Re=>Re.sectorId===nl),dl=c.state.cfg.target==="workspace"?(C=ce==null?void 0:ce.valid)!=null?C:[]:[...(J=ce==null?void 0:ce.valid)!=null?J:[],...(ot=ce==null?void 0:ce.invalid)!=null?ot:[]];if(dl.length){const Re=Ni(Tt,d,c.getPrimitive,dl);xt=Re.tl,Ce={node:Re.node,dist:Re.dist}}}c.move(rt,xt),w.current={id:rt,dx:ct-xt.x,dy:Y-xt.y,tlx:xt.x,tly:xt.y,aabb:St,minx:St.min.x,miny:St.min.y,support:st,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:et(Ut),pointerAnchorSectorId:ut,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Rt({x:ct,y:Y},ut);const Ee=(N=I(xt.x+St.width/2,xt.y+St.height/2))!=null?N:void 0;K((at=Ce==null?void 0:Ce.node)!=null?at:null,Ee,Ce==null?void 0:Ce.dist),$(rt),y(),dt();return}(W=G.current)==null||W.setPointerCapture(X.pointerId);const Jt=bo(ct,Y,z),te={x:ct-(Jt.x-St.min.x),y:Y-(Jt.y-St.min.y)},Gt=Math.hypot(ct-i.cx,Y-i.cy)<i.innerR,Nt=ca(te.x,te.y,{aabb:St,support:st},i,c.state.cfg.target,Gt),It=c.spawnFromBlueprint(d,Nt),Zt=pt({x:ct,y:Y}),kt=(lt=I(ct,Y))!=null?lt:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,kt),g){const Pt="kind"in d?"primitive":"composite";g.recordPickup(It,d.id,Pt,"blueprint",Nt,ht(It),void 0)}w.current={id:It,dx:ct-Nt.x,dy:Y-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:St,minx:St.min.x,miny:St.min.y,support:st,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:et(Zt),pointerAnchorSectorId:kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Rt({x:ct,y:Y},kt),K(null,void 0),$(It),y(),dt()};return{draggingId:Z,dragInvalid:!!(w.current&&w.current.validSnap===!1),lockedPieceId:Mt,svgRef:G,onPiecePointerDown:Et,onBlueprintPointerDown:P,onPointerMove:D,onPointerUp:j,setPieceRef:ft,setDraggingId:$,dragRef:w}}function N0(c,i,r,f,h,p,b,S,y,m,g,A,R){const G=c.state.cfg,w=(dt,I)=>yo(dt,I,i,G.target),Z=dt=>{const I=c.findPiece(dt);if(!I)return[];const it=c.getBlueprint(I.blueprintId);if(!it)return[];const et=ne(it,c.getPrimitive);return pn(it,et,I.pos).map(pt=>pt.map(Rt=>[Rt.x,Rt.y]))},$=()=>{var dt,I,it,et,pt,Rt;const K=b.current;return{anchorId:(I=(dt=K==null?void 0:K.snapAnchorId)!=null?dt:K==null?void 0:K.pointerAnchorId)!=null?I:void 0,wasValid:(K==null?void 0:K.validSnap)!==!1,wasOverlapping:(it=K==null?void 0:K.overlaps)!=null?it:!1,anchorX:(et=K==null?void 0:K.pointerAnchor)==null?void 0:et.x,anchorY:(pt=K==null?void 0:K.pointerAnchor)==null?void 0:pt.y,sectorId:(Rt=K==null?void 0:K.snapAnchorSectorId)!=null?Rt:K==null?void 0:K.pointerAnchorSectorId}},gt=(dt,I,it)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(dt,I,it)},[Mt,V]=tt.useState(null),[ft,L]=tt.useState(null);return{pendingBpId:Mt,selectedPieceId:ft,onRootPointerDown:dt=>{var I,it;const{x:et,y:pt}=g(dt.clientX,dt.clientY);if(f){const Rt=w(et,pt);if(h&&b.current){const K=b.current,bt=K.tlx+K.aabb.width/2,ht=K.tly+K.aabb.height/2;if(S(et,pt)){const P=c.findPiece(K.id),X=P==null?void 0:P.sectorId,d=$();c.remove(K.id),X&&m(X),R&&R.recordPlacedown("deleted",X,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),p(null),L(null),V(null),A();return}if(Math.hypot(bt-i.cx,ht-i.cy)<i.innerR){const P=c.findPiece(K.id),X=P==null?void 0:P.sectorId,d=$();c.remove(K.id),X&&m(X),R&&R.recordPlacedown("deleted",X,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),p(null),L(null),V(null),A();return}const Et=w(bt,ht);if(!Et){gt({x:bt,y:ht},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),A();return}if(y(Et)){gt({x:bt,y:ht},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:Et}}),A();return}if(K.validSnap===!1){const P=$().wasOverlapping?"overlapping":"no_valid_anchor";gt({x:bt,y:ht},"invalid_placement",{invalidPlacement:{reason:P,attemptedSectorId:Et}}),A();return}c.move(K.id,{x:K.tlx,y:K.tly}),c.drop(K.id,Et);const D=$(),j=m(Et);R&&R.recordPlacedown("placed",Et,{x:K.tlx,y:K.tly},Z(K.id),D.anchorId,D.wasValid,D.wasOverlapping,j),p(null),L(null),V(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),A();return}if(ft){if(S(et,pt)){const K=c.findPiece(ft),bt=K==null?void 0:K.sectorId;c.remove(ft),bt&&m(bt),R&&R.recordPlacedown("deleted"),L(null),A();return}if(Rt&&y(Rt)){L(null),A();return}if(Rt){const K=r.find(bt=>bt.id===ft);if(L(null),K){const bt=c.getBlueprint(K.blueprintId),ht=ne(bt,c.getPrimitive),Et=ia(bt,ht),D={x:et-ht.width/2,y:pt-ht.height/2},j=ca(D.x,D.y,{aabb:{width:ht.width,height:ht.height},support:Et},i,c.state.cfg.target,!1),P=(I=c.state.cfg.maxCompositeSize)!=null?I:0;if(c.state.cfg.mode==="prep"&&P>0&&c.getPiecesInSector(Rt).length-(K.sectorId===Rt?1:0)+1>P){A();return}c.move(K.id,{x:j.x,y:j.y}),c.drop(K.id,Rt),m(Rt),A()}return}L(null),A();return}if(Mt){const K=w(et,pt);if(S(et,pt)||!K||y(K)){V(null),A();return}const bt=c.getBlueprint(Mt),ht=ne(bt,c.getPrimitive),Et=ia(bt,ht),D={x:et-ht.width/2,y:pt-ht.height/2},j=ca(D.x,D.y,{aabb:{width:ht.width,height:ht.height},support:Et},i,c.state.cfg.target,!1),P=c.spawnFromBlueprint(bt,j),X=(it=c.state.cfg.maxCompositeSize)!=null?it:0;if(c.state.cfg.mode==="prep"&&X>0&&c.getPiecesInSector(K).length+1>X){c.remove(P),V(null),A();return}c.drop(P,K),V(null),m(K),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),A();return}}},clearSelection:()=>{L(null),V(null)},setPendingBp:V,setSelectedPiece:L}}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 Hi;const q0=new Uint8Array(16);function C0(){if(!Hi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hi=crypto.getRandomValues.bind(crypto)}return Hi(q0)}var Ao={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,p,b;if(Ao.randomUUID&&!i&&!c)return Ao.randomUUID();c=c||{};const f=(b=(p=c.random)!=null?p:(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:p=>this.recordSectorCompletion(p)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,p,b,S){const y=this.toAnchorPoint(p),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,p,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(),A=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),G=f?this.toAnchorPoint(f):void 0,w=h?this.toAnchorVertices(h):void 0,Z={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:A,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(Z.placedownSectorId=r),i==="placed"&&G&&(Z.placedownPosition=G),i==="placed"&&w&&(Z.placedownVertices=w),p&&(Z.placedownAnchorId=p),this.previousSnapshotId!==void 0&&(Z.preSnapshotId=this.previousSnapshotId),this.interactions.push(Z),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(Z),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",p=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===p&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:p,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 p=this.buildFinalBlueprintState(h),b=p.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:p,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const p=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=p.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:p,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 A=this.controller.getBlueprint(g.blueprintId),R=A&&"kind"in A?A.kind:g.blueprintId,G=this.controller.findPiece(g.pieceId);if(!G||!A)return{kind:R,position:g.position};const w=ne(A,this.controller.getPrimitive),Z={x:G.pos.x-w.min.x,y:G.pos.y-w.min.y},$=this.toAnchorPoint(Z);return{kind:R,position:$}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,p=0;for(const g of f)h+=g.position.x,p+=g.position.y;const b=Math.round(h/f.length),S=Math.round(p/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=[],p=[];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&&p.push(y.id);const A=((m==null?void 0:m.pieces)||[]).map(G=>({pieceId:G.id,blueprintId:G.blueprintId,blueprintType:this.getBlueprintType(G.blueprintId),position:this.toAnchorPoint(G.pos),vertices:this.getPieceVertices(G.id)})),R={sectorId:y.id,completed:g,pieceCount:A.length,pieces:A};(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:p,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 p=ne(h,S=>this.controller.getPrimitive(S)),b=((r=pn(h,p,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 p=r.get(h.blueprintId);p.totalPieces++,p.bySector.set(f.sectorId,(p.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 p=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 p&&(h.blueprintType==="composite"&&"parts"in p?(b.parts=p.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),p.shape&&(b.shape=p.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),p.label&&(b.label=p.label)):h.blueprintType==="primitive"&&"kind"in p&&(p.shape&&(b.shape=p.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=p.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,vn=(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},qi=(c,i)=>Q0(c,V0(i));function k0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:p,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:A,height:R,onSectorComplete:G,onPiecePlace:w,onPieceRemove:Z,onInteraction:$,onTrialEnd:gt,onControllerReady:Mt}=c,V=tt.useMemo(()=>{const Q=vn(vn(qi(vn({n:i.length,layout:h,target:p,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,p,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),ft=tt.useMemo(()=>{if(!$&&!gt)return null;const Q={};return $&&(Q.onInteraction=$),gt&&(Q.onTrialEnd=gt),new w0(V,Q)},[V,$,gt]);tt.useEffect(()=>{Mt&&Mt(V)},[V,Mt]),tt.useEffect(()=>()=>{ft&&ft.dispose()},[ft]);const{layout:L,viewBox:dt}=tt.useMemo(()=>{const Q=i.length,rt=i.map(Tt=>Tt.id),Ut=i.map(Tt=>{var xt;return(xt=Tt.silhouette.mask)!=null?xt:[]}),ut=Wh({n:Q,layoutMode:h,target:p,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:Fh({w:ut.LOGICAL_W,h:ut.LOGICAL_H},Q,rt,h,p,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ut.LOGICAL_W,h:ut.LOGICAL_H}}},[i,h,p,y,f.length]),[,I]=tt.useReducer(Q=>Q+1,0);tt.useEffect(()=>{Mt&&Mt(V,L,I)},[V,L,Mt,I]);const[it,et]=tt.useState(!1);tt.useEffect(()=>{i.every(Q=>V.isSectorCompleted(Q.id))&&!it&&(et(!0),ft&&setTimeout(()=>{ft.finalizeTrial("auto_complete")},0))},[V.updateCount,i,it,V,ft]);const pt=tt.useCallback(Q=>{G&&G(Q,V.snapshot())},[G,V]),Rt=tt.useMemo(()=>({onSectorComplete:pt,onPiecePlace:w||(()=>{}),onPieceRemove:Z||(()=>{})}),[pt,w,Z]),K=()=>{const Q={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const rt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return qi(vn({},Q),{width:`${rt}px`,height:`${rt}px`})}else{const rt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return qi(vn({},Q),{width:`${rt}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),rt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:Q,height:rt}}})();tt.useEffect(()=>{if(V.state.cfg.mode!=="construction"||!S||S<=0||it)return;const Q=window.setTimeout(()=>{it||(V.state.endedAt||(V.state.endedAt=performance.now(),I()),ft==null||ft.finalizeTrial("timeout"),et(!0))},S);return()=>{window.clearTimeout(Q)}},[V,S,it,ft,I]);const ht=Q=>V.isSectorCompleted(Q),{pieces:Et,pieceById:D,getSectorPiecePolysCached:j}=m0(V),P=V.state.cfg.input==="click",X=Math.max(k.size.centerBadge.minPx,L.innerR*k.size.centerBadge.fractionOfOuterR),d=V.state.cfg.layout==="semicircle"?{x:L.cx,y:L.cy-X-k.size.centerBadge.marginPx}:{x:L.cx,y:L.cy},z=(Q,rt)=>Math.hypot(Q-d.x,rt-d.y)<=X,q=tt.useMemo(()=>V.state.cfg.sectors.map(Q=>{var rt;return(rt=Q.silhouette.mask)!=null?rt:[]}),[V.state.cfg.sectors]),C=tt.useMemo(()=>{const Q=kh(q.flat());return Q?k.layout.grid.unitPx/Q:1},[q]),{anchorDots:J}=M0(V,L,C),ot=tt.useMemo(()=>{var Q,rt;const Ut=new Map;for(const ut of L.sectors){const Tt=(rt=(Q=V.state.cfg.sectors.find(De=>De.id===ut.id))==null?void 0:Q.silhouette.mask)!=null?rt:[];if(!(Tt!=null&&Tt.length))continue;const xt=mo(L,ut,"silhouette",1),Ce=ro(Tt,C,{cx:xt.cx,cy:xt.cy});Ut.set(ut.id,Ce)}return Ut},[L,C,V.state.cfg.sectors]),N=Q=>{var rt,Ut,ut;if(!Q||ht(Q))return!1;if(V.state.cfg.target==="silhouette"){const Tt=(rt=ot.get(Q))!=null?rt:[];if(!Tt.length)return!1;const xt=j(Q);if(r0(Tt,xt))return V.markSectorCompleted(Q),!0}else{const Tt=(ut=(Ut=V.state.cfg.sectors.find(De=>De.id===Q))==null?void 0:Ut.silhouette.mask)!=null?ut:[];if(!Tt.length)return!1;const xt=y0(Tt,C),Ce=j(Q);if(h0(xt,Ce))return V.markSectorCompleted(Q),!0}return!1},at=B0(V,L,Et,D,J,ot,ht,N,I,void 0,ft),{draggingId:W,dragInvalid:lt,svgRef:ct,onPiecePointerDown:Y,onBlueprintPointerDown:St,onPointerMove:st,onPointerUp:Jt,setPieceRef:te,setDraggingId:Gt,lockedPieceId:Nt,dragRef:It}=at,Zt=(Q,rt)=>{const Ut=ct.current,ut=Ut.createSVGPoint();ut.x=Q,ut.y=rt;const Tt=Ut.getScreenCTM();if(!Tt)return{x:0,y:0};const xt=ut.matrixTransform(Tt.inverse());return{x:xt.x,y:xt.y}},kt=N0(V,L,Et,P,W,Gt,It,z,ht,N,Zt,I,ft),{selectedPieceId:Pt,onRootPointerDown:Lt}=kt,ae=Q=>{if(W)return;const{x:rt,y:Ut}=Zt(Q.clientX,Q.clientY);if(V.state.cfg.mode==="prep"){if(!V.isSubmitEnabled()||it){Q.stopPropagation();return}et(!0),ft&&ft.finalizeTrial("submit"),Q.stopPropagation();return}if(ft!=null&&ft.recordClickEvent){const ut=V.state.blueprintView,Tt=ut==="primitives"?"quickstash":"primitives";ft.recordClickEvent({x:rt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ut,to:Tt}})}V.switchBlueprintView(),I(),Q.stopPropagation()};return tt.createElement("div",{className:"tangram-gameboard",style:K()},tt.createElement(c0,vn({controller:V,layout:L,viewBox:dt,width:bt.width,height:bt.height,badgeR:X,badgeCenter:d,placedSilBySector:ot,anchorDots:J,pieces:Et,clickMode:P,draggingId:W,selectedPieceId:Pt,dragInvalid:lt,lockedPieceId:Nt,svgRef:ct,setPieceRef:te,onPiecePointerDown:Y,onBlueprintPointerDown:St,onRootPointerDown:Lt,onPointerMove:st,onPointerUp:Jt,onCenterBadgePointerDown:ae},Rt)))}const K0=40*Math.SQRT2,ze=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 P0(c,i,r,f,h,p){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Ae(r+p*Math.cos(b),f+p*Math.sin(b))}function $0(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),p=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=p[b-1];m===void 0||g===void 0||f.push(P0(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:[ze,ze,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,ze,ze,20,20,ze,ze],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:medtriangle",kind:"medtriangle",sideLens:[20,20,20,20,ze,ze,ze,ze],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:largetriangle",kind:"largetriangle",sideLens:[ze,ze,ze,ze,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 p=I0[i],b=$0(r,f,p);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:p}=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 A of m.shape)S.push(A.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:p!=null?p:`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 f=new Set(["square","smalltriangle","parallelogram","medtriangle","largetriangle"]),h=[...W0].sort((m,g)=>i.primitiveOrder.indexOf(m.kind)-i.primitiveOrder.indexOf(g.kind)),p=i.tangrams.map((m,g)=>{const A=m.solutionTans.filter(G=>{var w;const Z=(w=G.name)!=null?w:G.kind;return f.has(Z)}).map((G,w)=>G.vertices.map(([Z,$])=>({x:Z!=null?Z:0,y:-($!=null?$:0)}))),R=`sector${g}`;return{id:R,tangramId:m.tangramID,silhouette:{id:R,mask:A}}});let b=[];if(i.quickstash_macros&&i.quickstash_macros.length>0){const m=i.quickstash_macros[0];if(m&&"parts"in m&&m.parts&&m.parts[0]&&"anchorOffset"in m.parts[0]){const g=new Map;h.forEach(A=>g.set(A.kind,A)),b=i.quickstash_macros.map(A=>F0(A,g,k.layout.grid.stepPx))}else b=i.quickstash_macros}const S=Bo(Bo({sectors:p,quickstash:b,primitives:h,layout:i.layout,target:i.target,input:i.input,timeLimitMs:i.time_limit_ms,maxQuickstashSlots:k.layout.defaults.maxQuickstashSlots,mode:"construction"},i.onInteraction&&{onInteraction:i.onInteraction}),i.onTrialEnd&&{onTrialEnd:i.onTrialEnd}),y=zh.createRoot(c);return y.render(tt.createElement(k0,S)),{root:y,display_element:c,jsPsych:r}}const ay={name:"tangram-construct",version:"1.0.0",parameters:{tangrams:{type:Me.ParameterType.COMPLEX,default:void 0,description:"Array of TangramSpec objects defining target shapes to construct"},quickstash_macros:{type:Me.ParameterType.COMPLEX,default:[],description:"Array of MacroSpec objects created in prep trial"},primitive_order:{type:Me.ParameterType.OBJECT,default:["square","smalltriangle","parallelogram","medtriangle","largetriangle"],description:"Array of primitive names in the order they should be displayed"},target:{type:Me.ParameterType.SELECT,options:["workspace","silhouette"],default:"silhouette",description:"Placement target: workspace (free placement) or silhouette (onto target shape)"},input:{type:Me.ParameterType.SELECT,options:["click","drag"],default:"drag",description:"Input mode: drag (mouse/touch drag) or click (click to select/place)"},layout:{type:Me.ParameterType.SELECT,options:["circle","semicircle"],default:"semicircle",description:"Layout mode: full circle or semicircle piece arrangement"},time_limit_ms:{type:Me.ParameterType.INT,default:0,description:"Time limit in milliseconds (0 = no limit)"},snap_radius_px:{type:Me.ParameterType.INT,default:18,description:"Snap radius for anchor-based piece placement"},onInteraction:{type:Me.ParameterType.FUNCTION,default:void 0,description:"Callback for each interaction event (e.g., socket.emit)"},onTrialEnd:{type:Me.ParameterType.FUNCTION,default:void 0,description:"Callback when trial completes with full data"}},data:{events:{type:Me.ParameterType.COMPLEX,description:"Chronological log of all user interactions and game events"},completion_times:{type:Me.ParameterType.COMPLEX,description:"Array of completion times in milliseconds for each tangram"},final_state:{type:Me.ParameterType.COMPLEX,description:"Array describing completion status of each tangram sector"},macros_used:{type:Me.ParameterType.COMPLEX,description:"Array tracking which macros were used and when"},trial_duration_ms:{type:Me.ParameterType.INT,description:"Total time from trial start to completion"}},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={tangrams:r.tangrams,quickstash_macros:r.quickstash_macros,primitiveOrder:r.primitive_order,target:r.target,input:r.input,layout:r.layout,time_limit_ms:r.time_limit_ms,onInteraction:r.onInteraction,onTrialEnd:f},{root:p,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:p,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":pu(t,"class",n);break;case"tabIndex":pu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":pu(t,l,n);break;case"style":Ko(t,n,u);break;case"data":if(e!=="object"){pu(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&&Dt("scroll",t);break;case"onScrollEnd":n!=null&&Dt("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":Dt("beforetoggle",t),Dt("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 Rf(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&&Dt("scroll",t);break;case"onScrollEnd":n!=null&&Dt("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[Ue]||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":Dt("error",t),Dt("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":Dt("invalid",t);var s=u=o=a=null,v=null,E=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":v=U;break;case"defaultChecked":E=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,v,E,o,a,!1),vu(t);return;case"select":Dt("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":Dt("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),vu(t);return;case"option":for(v in l)if(l.hasOwnProperty(v)&&(n=l[v],n!=null))switch(v){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,e,v,n,l,null)}return;case"dialog":Dt("beforetoggle",t),Dt("toggle",t),Dt("cancel",t),Dt("close",t);break;case"iframe":case"object":Dt("load",t);break;case"video":case"audio":for(n=0;n<Pa.length;n++)Dt(Pa[n],t);break;case"image":Dt("error",t),Dt("load",t);break;case"details":Dt("toggle",t);break;case"embed":case"source":case"link":Dt("error",t),Dt("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(E in l)if(l.hasOwnProperty(E)&&(n=l[E],n!=null))switch(E){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,e));default:wt(t,e,E,n,l,null)}return;default:if(Li(e)){for(U in l)l.hasOwnProperty(U)&&(n=l[U],n!==void 0&&Rf(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,v=null,E=null,U=null;for(_ in l){var H=l[_];if(l.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":v=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":E=_;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)}}Vi(t,o,s,v,E,U,u,a);return;case"select":_=o=s=O=null;for(u in l)if(v=l[u],l.hasOwnProperty(u)&&v!=null)switch(u){case"value":break;case"multiple":_=v;default:n.hasOwnProperty(u)||wt(t,e,u,null,n,v)}for(a in n)if(u=n[a],v=l[a],n.hasOwnProperty(a)&&(u!=null||v!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==v&&wt(t,e,a,u,n,v)}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 vt in l)if(O=l[vt],l.hasOwnProperty(vt)&&O!=null&&!n.hasOwnProperty(vt))switch(vt){case"selected":t.selected=!1;break;default:wt(t,e,vt,null,n,O)}for(v in n)if(O=n[v],_=l[v],n.hasOwnProperty(v)&&O!==_&&(O!=null||_!=null))switch(v){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,e,v,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 yt in l)O=l[yt],l.hasOwnProperty(yt)&&O!=null&&!n.hasOwnProperty(yt)&&wt(t,e,yt,null,n,O);for(E in n)if(O=n[E],_=l[E],n.hasOwnProperty(E)&&O!==_&&(O!=null||_!=null))switch(E){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,e));break;default:wt(t,e,E,O,n,_)}return;default:if(Li(e)){for(var jt in l)O=l[jt],l.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Rf(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||Rf(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 Uf=null,Bf=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 Nf(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 Hf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===Hf?!1:(Hf=t,!0):(Hf=null,!1)}var Jd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,Pd=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof Pd!="undefined"?function(t){return Pd.resolve(null).then(t).catch(Qm)}:Jd;function Qm(t){setTimeout(function(){throw t})}function Ll(t){return t==="head"}function $d(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,v=o.nodeName;o[da]||v==="SCRIPT"||v==="STYLE"||v==="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 qf(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":qf(l),Xi(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 Cf(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 Yf=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]);Xi(t)}var Fe=new Map,Fd=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _l=j.d;j.d={f:km,r:Km,D:Jm,C:Pm,L:$m,m:Im,X:Fm,S:Wm,M:tp};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=ke(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 Pm(t,e){_l.C(t,e),th("preconnect",t,e)}function $m(t,e,l){_l.L(t,e,l);var n=la;if(n&&t&&e){var a='link[rel="preload"][as="'+ke(e)+'"]';e==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+ke(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+ke(l.imageSizes)+'"]')):a+='[href="'+ke(t)+'"]';var u=a;switch(e){case"style":u=na(t);break;case"script":u=aa(t)}Fe.has(u)||(t=g({rel:"preload",href:e==="image"&&l&&l.imageSrcSet?void 0:t,as:e},l),Fe.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="'+ke(n)+'"][href="'+ke(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!Fe.has(u)&&(t=g({rel:"modulepreload",href:t},e),Fe.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=Tn(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=Fe.get(u))&&Gf(t,l);var v=o=n.createElement("link");se(v),ge(v,"link",t),v._p=new Promise(function(E,U){v.onload=E,v.onerror=U}),v.addEventListener("load",function(){s.loading|=1}),v.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=Tn(l).hoistableScripts,a=aa(t),u=n.get(a);u||(u=l.querySelector(Fa(a)),u||(t=g({src:t,async:!0},e),(e=Fe.get(a))&&Xf(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 tp(t,e){_l.M(t,e);var l=la;if(l&&t){var n=Tn(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=Fe.get(a))&&Xf(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=Tn(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=Tn(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),Fe.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},Fe.set(t,l),u||ep(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=Tn(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="'+ke(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function lh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function ep(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="'+ke(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~="'+ke(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=Fe.get(a))&&Gf(n,a),u=(t.ownerDocument||t).createElement("link"),se(u);var o=u;return o._p=new Promise(function(s,v){o.onload=s,o.onerror=v}),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=Fe.get(u))&&(n=g({},l),Xf(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 Gf(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function Xf(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 lp(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 np(){}function ap(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=pi.bind(n),t.then(n,n)),e.state.loading|=4,e.instance=u,se(u);return}u=t.ownerDocument||t,l=lh(l),(a=Fe.get(a))&&Gf(l,a),u=u.createElement("link"),se(u);var o=u;o._p=new Promise(function(s,v){o.onload=s,o.onerror=v}),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=pi.bind(n),t.addEventListener("load",e),t.addEventListener("error",e))}}function up(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&wf(t,t.stylesheets),0<t.count?function(e){var l=setTimeout(function(){if(t.stylesheets&&wf(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 pi(){if(this.count--,this.count===0){if(this.stylesheets)wf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var vi=null;function wf(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,vi=new Map,e.forEach(ip,t),vi=null,pi.call(t))}function ip(t,e){if(!(e.state.loading&4)){var l=vi.get(t);if(l)var n=l.get(null);else{l=new Map,vi.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=pi.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:V,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function cp(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,v,E,U,H){return t=new cp(t,e,l,o,s,v,E,H),e=1,u===!0&&(e|=24),u=Ge(3,null,null,e),t.current=u,u.stateNode=t,e=Sc(),e.refCount++,t.pooledCache=e,e.refCount++,u.memoizedState={element:n,isDehydrated:l,cache:e},Ac(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&&(Ve(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 jf(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&&Ve(e,t,67108864),jf(t,67108864)}}var gi=!0;function fp(t,e,l,n){var a=D.T;D.T=null;var u=j.p;try{j.p=2,Qf(t,e,l,n)}finally{j.p=u,D.T=a}}function op(t,e,l,n){var a=D.T;D.T=null;var u=j.p;try{j.p=8,Qf(t,e,l,n)}finally{j.p=u,D.T=a}}function Qf(t,e,l,n){if(gi){var a=Vf(n);if(a===null)Df(t,e,n,bi,l),hh(t,n);else if(sp(a,t,e,l,n))n.stopPropagation();else if(hh(t,n),e&4&&-1<rp.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 v=1<<31-xt(o);s.entanglements[1]|=v,o&=~v}sl(u),!(Ct&6)&&(li=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Ve(s,u,2),ai(),jf(u,2)}if(u=Vf(n),u===null&&Df(t,e,n,bi,l),u===a)break;a=u}a!==null&&n.stopPropagation()}else Df(t,e,n,null,l)}}function Vf(t){return t=Ki(t),Zf(t)}var bi=null;function Zf(t){if(bi=null,t=xn(t),t!==null){var e=p(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(It()){case Zt:return 2;case kt:return 8;case Pt:case Lt:return 32;case ae:return 268435456;default:return 32}default:return 32}}var Lf=!1,kl=null,Kl=null,Jl=null,lu=new Map,nu=new Map,Pl=[],rp="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 sp(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=p(e);if(l!==null){if(e=l.tag,e===13){if(e=b(l),e!==null){t.blockedOn=e,Yi(t.priority,function(){if(l.tag===13){var n=Qe();n=sa(n);var a=Hn(l,n);a!==null&&Ve(a,l,n),jf(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=Vf(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 dp(){Lf=!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,Lf||(Lf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dp)))}var Mi=null;function ph(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(Zf(n||l)===null)continue;break}var u=Mn(l);u!==null&&(t.splice(e,3),e-=3,Vc(u,{pending:!0,data:a,method:l.method,action:n},n,a))}}))}function uu(t){function e(v){return xi(v,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<Pl.length;l++){var n=Pl[l];n.blockedOn===t&&(n.blockedOn=null)}for(;0<Pl.length&&(l=Pl[0],l.blockedOn===null);)yh(l),l.blockedOn===null&&Pl.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[Ue]||null;if(typeof u=="function")o||ph(l);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Ue]||null)s=o.formAction;else if(Zf(a)!==null)continue}else s=o.action;typeof s=="function"?l[n+1]=s:(l.splice(n,3),n-=3),ph(l)}}}function kf(t){this._internalRoot=t}Ti.prototype.render=kf.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(f(409));var l=e.current,n=Qe();oh(l,n,t,e,null,null)},Ti.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 Ti(t){this._internalRoot=t}Ti.prototype.unstable_scheduleHydration=function(t){if(t){var e=bn();t={blockedOn:null,target:t,priority:e};for(var l=0;l<Pl.length&&e!==0&&e<Pl[l].priority;l++);Pl.splice(l,0,t),l===0&&yh(t)}};var vh=i.version;if(vh!=="19.1.1")throw Error(f(527,vh,"19.1.1"));j.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 hp={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ai=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ai.isDisabled&&Ai.supportsFiber)try{Ut=Ai.inject(hp),ut=Ai}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,zf(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,v=null,E=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&&(v=l.unstable_transitionCallbacks),l.formState!==void 0&&(E=l.formState)),e=ch(t,1,!0,e,l!=null?l:null,n,a,u,o,s,v,E),e.context=fh(null),l=e.current,n=Qe(),n=sa(n),a=Bl(n),a.callback=null,Nl(l,a,n),l=n,e.current.lanes=l,Oe(e,l),sl(e),t[Sn]=e.current,zf(t),new Ti(e)},ua.version="19.1.1",ua}function no(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(no)}catch(c){console.error(c)}}no(),$f.exports=_h();var zh=$f.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,ao=Object.getOwnPropertySymbols,qh=Object.prototype.hasOwnProperty,Ch=Object.prototype.propertyIsEnumerable,uo=(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)&&uo(c,r,i[r]);if(ao)for(var r of ao(i))Ch.call(i,r)&&uo(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 p=this.state.sectors[r];p&&(p.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(p=>p.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 p=h,b=p.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:p.sectorId,array:p.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,p=(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<=p)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 p=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>=p&&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 p=i[h],b=i[f];if(!(!p||!b)&&jh(c,p,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const p=i[f],b=i[h];if(!p||!b)continue;const S=p.x,y=p.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 io(c,i,r){let f=1/0,h=-1/0;for(const p of c){const b=p.x*i+p.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 p=f[h],b=f[(h+1)%f.length];if(!p||!b)continue;const S=b.x-p.x,y=-(b.y-p.y),m=S,g=io(c,y,m),A=io(i,y,m);if(g.max<=A.min+mn||A.max<=g.min+mn)return!1}return!0}function Vh(c,i){const r=c.map(h=>{let p=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<p&&(p=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:p,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let p=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<p&&(p=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:p,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let p=0;p<i.length;p++){const b=c[h],S=i[p],y=r[h],m=f[p];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 p=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:p,height:b,cx:(i+f)/2,cy:(r+h)/2}}function co(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 p=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:p,height:b}}function fo(c){return co(c.shape)}function Lh(c,i){if(c.shape&&c.shape.length)return co(c.shape);let r=1/0,f=1/0,h=-1/0,p=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=fo(m),A=y.offset.x+g.min.x,R=y.offset.y+g.min.y,G=y.offset.x+g.max.x,w=y.offset.y+g.max.y;A<r&&(r=A),R<f&&(f=R),G>h&&(h=G),w>p&&(p=w)}const b=Math.max(0,h-r),S=Math.max(0,p-f);return{min:{x:r,y:f},max:{x:h,y:p},width:b,height:S}}function ne(c,i){return"parts"in c?Lh(c,i):fo(c)}const Te=k.layout.grid.stepPx;function pn(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(p=>p.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}]],p=[];for(const b of h)for(const S of b)p.push({x:S.x-r,y:S.y-f});return p}function ca(c,i,r,f,h,p){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 A=y/g,R=m/g;let G=-1/0,w=-1/0;for(const Z of r.support){const $=Z.x*A+Z.y*R;$>G&&(G=$);const gt=-(Z.x*A+Z.y*R);gt>w&&(w=gt)}if(h==="workspace"){const[Z,$]=f.bands.workspace,gt=p?0:Z+w,Mt=$-G,V=Math.min(Math.max(g,gt),Mt);if(Math.abs(V-g)<1e-6)return{x:c,y:i};const ft=f.cx+V*A,L=f.cy+V*R;return{x:ft-r.aabb.width/2,y:L-r.aabb.height/2}}else{const Z=f.bands.silhouette[1]-G;if(g<=Z)return{x:c,y:i};const $=f.cx+Z*A,gt=f.cy+Z*R;return{x:$-r.aabb.width/2,y:gt-r.aabb.height/2}}}function oo(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],p=r[(f+1)%r.length];if(!h||!p)continue;const b=Math.round(Math.abs(p.x-h.x)),S=Math.round(Math.abs(p.y-h.y));b&&(i=i?oo(i,b):b),S&&(i=i?oo(i,S):S)}return i||1}function ro(c,i,r){if(!c||c.length===0)return[];const f=Zh(c),h=(f.min.x+f.max.x)/2,p=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Te)*Te,S=Math.round(r.cy/Te)*Te,y=b-i*h,m=S-i*p,g=Math.round(y/Te)*Te,A=Math.round(m/Te)*Te;return c.map(R=>R.map(G=>({x:i*G.x+g,y:i*G.y+A})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Te)*Te,h=Math.ceil(c.y/Te)*Te;for(let p=h;p<=i.y;p+=Te)for(let b=f;b<=i.x;b+=Te)r.push({x:b,y:p});return r}function Di(c,i,r,f){const[h,p]=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>p)){if(f){let A=Math.atan2(m,y);if(i.mode==="circle"?A<-Math.PI/2&&(A+=2*Math.PI):A<Math.PI&&(A+=2*Math.PI),A<f.start||A>=f.end)continue}b.push(S)}}return b}function Kh(c,i,r=cu){const f=[];t:for(const h of c)for(const p of i)if(r(h,p)){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 p of f){const b=p.x-c.cx,S=p.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(p)}return h}const ou=(c,i=Te)=>c*Math.SQRT2*i;function so(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 Ph(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],p=r[(f+1)%r.length];if(!h||!p)continue;const b=Math.round(Math.abs(p.x-h.x)),S=Math.round(Math.abs(p.y-h.y));b&&(i=i?so(i,b):b),S&&(i=i?so(i,S):S)}return i||1}function $h(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 p=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:p,cy:b}}function ho(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:p,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,A=((i=c.masks)!=null?i:[]).flat(),R=A.length?Ph(A):0,G=R?2*S/R:1;let w=0;if(c.masks&&c.masks.length)for(const j of c.masks){if(!(j!=null&&j.length))continue;const P=$h(j),{cx:X,cy:d}=P;for(const z of j)for(const q of z){const C=(q.x-X)*G,J=(q.y-d)*G,ot=Math.hypot(C,J);ot>w&&(w=ot)}}const Z=f==="circle"?Math.PI*2:Math.PI,$=Z/Math.max(1,r),gt=Z/Math.max(1,p),Mt=Z/Math.max(1,b),V=Math.sin($/2),ft=Math.sin(gt/2),L=Math.sin(Mt/2),dt=ou(y,S),I=ou(m,S),it=ou(g,S),et=I*(.5+1/(2*Math.max(1e-9,ft))),pt=it*(.5+1/(2*Math.max(1e-9,L))),Rt=dt/(2*Math.max(1e-9,V))-dt/2,K=Math.max(et,pt,Rt),bt=dt,ht=h==="workspace"?2*w:0,Et=bt+ht,D=K+Et;return{innerR_min:K,dr_min:Et,outerR_min:D,Tw_min:bt,Tp_min:ht,Rshape_px_max:w}}function Ih(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:p,D_ws_px:b}=c,S=f+h;if(i<r+S){const gt=r+S;return{innerR:r,Tw:f,Tp:h,outerR:gt}}const y=i,m=r,g=y-m,A=Math.max(0,g-S),R=1,G=1+p/Math.max(1e-9,b),w=A*(R/(R+G)),Z=f+w,$=g-Z;return{innerR:m,Tw:Z,Tp:$,outerR:y}}function Wh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=ho(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",p){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,A=f==="semicircle"?c.h-y:g,R=Math.min(m,A)-y,G=ho({n:i,layoutMode:f,target:h,qsMaxSlots:p.qsMaxSlots,primitivesSlots:p.primitivesSlots,masks:(b=p.masks)!=null?b:[]});let w,Z,$;if(h==="workspace"){const dt=ou(k.layout.constraints.workspaceDiamAnchors),I=Ih({outerRViewportBound:R,innerR_min:G.innerR_min,Tw_min:G.Tw_min,Tp_min:G.Tp_min,Rshape_px_max:G.Rshape_px_max,D_ws_px:dt});w=I.innerR,Z=I.outerR,$={workspace:[I.innerR,I.innerR+I.Tw],silhouette:[I.innerR+I.Tw,I.outerR]}}else Z=Math.max(R,G.outerR_min),w=Math.min(G.innerR_min,Z),Z<G.outerR_min&&(Z=G.outerR_min,w=G.innerR_min),$={silhouette:[w,Z],workspace:[w,Z]};const gt=f==="circle"?Math.PI*2:Math.PI,Mt=f==="circle"?-Math.PI/2:Math.PI,V=Mt+gt,ft=gt/i,L=[];for(let dt=0;dt<i;dt++){const I=(S=r[dt])!=null?S:String(dt),it=Mt+dt*ft,et=it+ft,pt=(it+et)/2;L.push({id:I,index:dt,start:it,end:et,mid:pt})}return{mode:f,cx:m,cy:g,innerR:w,outerR:Z,sectors:L,bands:$,sweepStart:Mt,sweepEnd:V}}function Ri(c,i,r,f,h,p){const b=p-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),A=c+f*Math.cos(p),R=i+f*Math.sin(p),G=c+r*Math.cos(p),w=i+r*Math.sin(p);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${A} ${R}`,`L ${G} ${w}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function yo(c,i,r,f){var h;const p=c-r.cx,b=i-r.cy,S=Math.hypot(p,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,p);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const A of r.sectors)if(g>=A.start&&g<A.end)return A.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function mo(c,i,r,f=.85){const[h,p]=c.bands[r],b=(h+p)/2,S=p-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),A=c.cy+b*Math.sin(i.mid);return{cx:g,cy:A,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 Ui(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},p={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=p.x-h.x,S=p.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 A=0;A<y;A++){const R=Math.round(h.x+A*m),G=Math.round(h.y+A*g),w=Math.round(h.x+(A+1)*m),Z=Math.round(h.y+(A+1)*g);f.push({a:{x:R,y:G},b:{x:w,y:Z}})}return f}function fa(c,i,r,f,h){let p;try{p=f(c.blueprintId)}catch(G){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",G),[]}if(!(p!=null&&p.shape))return[];const b=p.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=ne(p,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,A=b.map(G=>({x:G.x+m,y:G.y+g})),R=[];for(let G=0;G<A.length;G++){const w=A[G],Z=A[(G+1)%A.length];if(!w||!Z){R.push(!1);continue}const $=Ui(w,Z,S);let gt=!1;if(c.blueprintId.startsWith("comp:"))for(let Mt=0;Mt<p.shape.length;Mt++){if(Mt===i)continue;const V=p.shape[Mt];if(!V)continue;const ft=V.map(L=>({x:L.x+m,y:L.y+g}));for(let L=0;L<ft.length;L++){const dt=ft[L],I=ft[(L+1)%ft.length];if(!dt||!I)continue;const it=Ui(dt,I,S);for(const et of $)if(it.some(pt=>et.a.x===pt.a.x&&et.a.y===pt.a.y&&et.b.x===pt.b.x&&et.b.y===pt.b.y||et.a.x===pt.b.x&&et.a.y===pt.b.y&&et.b.x===pt.a.x&&et.b.y===pt.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(!gt&&k.game.hideTouchingBorders)for(const Mt of r){if(Mt.id===c.id)continue;const V=f(Mt.blueprintId);if(!(V!=null&&V.shape))continue;const ft=ne(V,h),L=Mt.pos.x-ft.min.x,dt=Mt.pos.y-ft.min.y;for(const I of V.shape){const it=I.map(et=>({x:et.x+L,y:et.y+dt}));for(let et=0;et<it.length;et++){const pt=it[et],Rt=it[(et+1)%it.length];if(!pt||!Rt)continue;const K=Ui(pt,Rt,S);for(const bt of $)if(K.some(ht=>bt.a.x===ht.a.x&&bt.a.y===ht.a.y&&bt.b.x===ht.b.x&&bt.b.y===ht.b.y||bt.a.x===ht.b.x&&bt.a.y===ht.b.y&&bt.b.x===ht.a.x&&bt.b.y===ht.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(gt)break}R.push(gt)}return R}function e0(c){return k.game.hideTouchingBorders}var l0=Object.defineProperty,n0=Object.defineProperties,a0=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertySymbols,u0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,vo=(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)&&vo(c,r,i[r]);if(po)for(var r of po(i))i0.call(i,r)&&vo(c,r,i[r]);return c},su=(c,i)=>n0(c,a0(i));function Bi(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:p,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:A,draggingId:R,selectedPieceId:G,dragInvalid:w,lockedPieceId:Z,svgRef:$,setPieceRef:gt,onPiecePointerDown:Mt,onBlueprintPointerDown:V,onRootPointerDown:ft,onPointerMove:L,onPointerUp:dt,onCenterBadgePointerDown:I}=c,it=f.w,et=f.h,pt=i.state.blueprintView,Rt=pt==="primitives"?i.state.primitives:i.state.quickstash,K=i.state.cfg.maxQuickstashSlots,bt=i.state.primitives.length,ht=pt==="primitives"?Math.max(1,bt):Math.max(1,K),Et=(r.mode==="circle"?Math.PI*2:Math.PI)/ht,D=r.mode==="circle"?-Math.PI/2:Math.PI,j=N=>D+(N+.5)*Et,P=(N,at=k.layout.grid.stepPx)=>N*Math.SQRT2*at,X=pt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=P(X),z=d/(2*Math.max(1e-9,Math.sin(Et/2))),q=b+k.size.centerBadge.marginPx+d/2,C=r.innerR-(b+k.size.centerBadge.marginPx),J=Math.min(Math.max(z,q),C),ot=(N,at,W)=>{const lt=ne(N,St=>i.getPrimitive(St)),ct=lt.min.x+lt.width/2,Y=lt.min.y+lt.height/2;return tt.createElement("g",{key:N.id,transform:`translate(${at}, ${W}) scale(1) translate(${-ct}, ${-Y})`},("shape"in N?N.shape:[]).map((St,st)=>tt.createElement("path",{key:st,d:Bi(St),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>V(Jt,N,{bx:at,by:W,cx:ct,cy:Y})})))};return tt.createElement("svg",{ref:$,width:h,height:p,viewBox:`0 0 ${it} ${et}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:L,onPointerUp:dt,onPointerDown:N=>{ft(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,at)=>{const W=!!i.state.sectors[N.id].completedAt,lt=at%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,ct=at%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,Y=r.bands.silhouette,St=r.bands.workspace;return tt.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?tt.createElement(tt.Fragment,null,tt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:lt,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),tt.createElement("path",{d:Ri(r.cx,r.cy,St[0],St[1],N.start,N.end),fill:W?k.color.completion.fill:ct,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):tt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:W?k.color.completion.fill:lt,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=ne(at,Gt=>i.getPrimitive(Gt)),lt=R===N.id,ct=N.sectorId&&i.isSectorCompleted(N.sectorId),Y=Z===N.id,St=G===N.id,st=lt&&w,Jt=N.x-W.min.x,te=N.y-W.min.y;return tt.createElement("g",{key:N.id,ref:gt(N.id),transform:`translate(${Jt}, ${te})`,style:{cursor:ct?"default":A?"pointer":"grab"},pointerEvents:A&<?"none":"auto"},("shape"in at?at.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),tt.createElement(tt.Fragment,{key:Nt},tt.createElement("path",{d:Bi(Gt),fill:Y||st?k.color.piece.invalidFill:lt?k.color.piece.draggingFill:k.color.piece.validFill,opacity:Y||st?k.opacity.piece.invalid:lt?k.opacity.piece.dragging:ct?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:It=>Mt(It,N)}),(()=>{const It=g.filter(Q=>Q.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),kt=It.map(Q=>su(ru({},Q),{pos:{x:Q.x,y:Q.y}})),Pt=fa(Zt,Nt,kt,Q=>i.getBlueprint(Q),Q=>i.getPrimitive(Q)),Lt=R?It.find(Q=>Q.id===R):null;let ae;if(N.blueprintId.startsWith("comp:")){const Q=fa(Zt,Nt,[],rt=>i.getBlueprint(rt),rt=>i.getPrimitive(rt));ae=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],rt=>i.getBlueprint(rt),rt=>i.getPrimitive(rt)):new Array(Pt.length).fill(!1)).map((rt,Ut)=>rt&&!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(Pt.length).fill(!1);return t0(Gt).map((Q,rt)=>{const Ut=ae[rt]||!1;let ut;return lt&&N.blueprintId.startsWith("comp:")?ut=fa(Zt,Nt,[],Tt=>i.getBlueprint(Tt),Tt=>i.getPrimitive(Tt))[rt]||!1:ut=lt?!1:(Pt[rt]||!1)&&!Ut,tt.createElement("path",{key:`stroke-${Nt}-${rt}`,d:Q,fill:"none",stroke:ut?"none":Y||st?k.color.piece.invalidStroke:St||lt?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ut?0:St||lt?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:Tt=>Mt(Tt,N)})})})()))))}),r.sectors.map(N=>{var at;const W=(at=y.get(N.id))!=null?at:[];return W.length?tt.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((lt,ct)=>tt.createElement("path",{key:ct,d:Bi(lt),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:at,invalid:W})=>{const lt=N==="inner-ring";return tt.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((ct,Y)=>tt.createElement("circle",{key:`inv-${Y}`,cx:ct.x,cy:ct.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),at.map((ct,Y)=>tt.createElement("circle",{key:`val-${Y}`,cx:ct.x,cy:ct.y,r:lt?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:lt?k.color.anchors.invalid:k.color.anchors.valid,opacity:lt?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 tt.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?I:void 0},tt.createElement("circle",{r:b,fill:at?k.color.blueprint.badgeFill:"#ccc",opacity:at?1:.5}),tt.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:at?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Rt.map((N,at)=>{const W=j(at),lt=r.cx+J*Math.cos(W),ct=r.cy+J*Math.sin(W);return ot(N,lt,ct)}),i.state.endedAt&&tt.createElement("g",{pointerEvents:"none"},tt.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},tt.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),tt.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 p of c)for(const b of p)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,p=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=p;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),p=o0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of p)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 p of i)p.x<r&&(r=p.x),p.y<f&&(f=p.y);const h=new Set;for(const p of i)h.add(`${p.x-r},${p.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),p=go(f);return d0(h,p)}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=tt.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=tt.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=tt.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const A=c.getBlueprint(g.blueprintId),R=ne(A,c.getPrimitive);y.push(...pn(A,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=tt.useRef(new Map),p=tt.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=tt.useCallback(S=>{const y=p(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},[p,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class p0{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 p=ne(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-p.min.x),y:i.y+(b.y-p.min.y)};let y=null,m=1/0;for(const R of h){const G=R.x-S.x,w=R.y-S.y,Z=G*G+w*w;Z<m&&(m=Z,y=R)}const g=Math.sqrt(m),A=g<=this.config.snapRadiusPx;return{tl:y&&A?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:A}}snapTopLeftToNodes(i,r,f,h){const{tl:p}=this.nearestNodeSnap(i,r,f,h);return p}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},p=fu(f,h);return Di(p,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},p={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,p),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},p=fu(f,h);return Di(p,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 p=(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,A=m.y-y.y,R=Math.hypot(g,A),G=Math.max(1,Math.ceil(R/p));for(let w=0;w<=G;w++){const Z=w/G,$={x:y.x+Z*g,y:y.y+Z*A};if(!this.insideAnySilhouette($,r))return!1}}return!0}}function v0(){return new p0({stepPx:k.layout.grid.stepPx,snapRadiusPx:k.game.snapRadiusPx,densitySampleStepPx:Math.max(1,Math.round(k.layout.grid.stepPx/3))})}const oa=v0();function Ni(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:tt.useMemo(()=>{var h,p;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=(p=(h=c.state.cfg.sectors.find($=>$.id===S.id))==null?void 0:h.silhouette.mask)!=null?p:[];if(!y||y.length===0)continue;const m=mo(i,S,"silhouette",1),g=ro(y,r,{cx:m.cx,cy:m.cy}),A=x0(i,S),R=S0(i,S,g),G=$=>`${$.x},${$.y}`,w=new Set(R.map(G)),Z=A.filter($=>!w.has(G($)));b.push({sectorId:S.id,valid:R,invalid:Z})}return b},[f.target,c.state.sectors,i,r])}}function T0(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},p={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=p.x-h.x,S=p.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 A=0;A<y;A++){const R=Math.round(h.x+A*m),G=Math.round(h.y+A*g),w=Math.round(h.x+(A+1)*m),Z=Math.round(h.y+(A+1)*g);f.push({a:{x:R,y:G},b:{x:w,y:Z}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const p=ne(h,r),b=c.pos.x-p.min.x,S=c.pos.y-p.min.y,y=[];for(const m of h.shape){const g=m.map(A=>({x:A.x+b,y:A.y+S}));for(let A=0;A<g.length;A++){const R=g[A],G=g[(A+1)%g.length];!R||!G||y.push(...T0(R,G,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,p=So(c,r,f,h);if(p.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=p.filter(A=>m.some(R=>A.a.x===R.a.x&&A.a.y===R.a.y&&A.b.x===R.b.x&&A.b.y===R.b.y||A.a.x===R.b.x&&A.a.y===R.b.y&&A.b.x===R.a.x&&A.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function A0(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 p=new Map;for(const m of h)p.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const A=h[m],R=h[g];!A||!R||xo(A,[R],r,f).isAttached&&(p.get(A.id).push(R.id),p.get(R.id).push(A.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=p.get(m)||[];for(const A of g)y(A)}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,To=(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)&&To(c,r,i[r]);if(Mo)for(var r of Mo(i))D0.call(i,r)&&To(c,r,i[r]);return c},U0=(c,i)=>O0(c,_0(i));function B0(c,i,r,f,h,p,b,S,y,m,g){const A=c.state.cfg,R=A.input==="click",G=tt.useRef(null),w=tt.useRef(null),[Z,$]=tt.useState(null),gt=tt.useRef(new Map),[Mt,V]=tt.useState(null);tt.useEffect(()=>{Z===null&&(w.current=null)},[Z]);const ft=X=>d=>{const z=gt.current;d?z.set(X,d):z.delete(X)},L=(X,d)=>{const z=G.current,q=z.createSVGPoint();q.x=X,q.y=d;const C=z.getScreenCTM();if(!C)return{x:0,y:0};const J=q.matrixTransform(C.inverse());return{x:J.x,y:J.y}},dt=()=>{if(!w.current)return;const X=w.current;X.raf==null&&(X.raf=requestAnimationFrame(()=>{X.raf=null;const d=gt.current.get(X.id);d&&d.setAttribute("transform",`translate(${X.tlx-X.minx}, ${X.tly-X.miny})`)}))},I=(X,d)=>yo(X,d,i,A.target),it=k.layout.grid.stepPx,et=X=>{if(!X)return null;const d=Math.round(X.x/it),z=Math.round(X.y/it);return`${d},${z}`},pt=X=>({x:Math.round(X.x/it)*it,y:Math.round(X.y/it)*it}),Rt=(X,d)=>{if(!w.current)return;const z=w.current,q=pt(X),C=et(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},K=(X,d,z)=>{if(!w.current)return;const q=w.current;q.snapAnchor=X,q.snapAnchorId=et(X),q.snapAnchorSectorId=d,q.snapAnchorDist=X&&z!==void 0?z:null},bt=(X,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(X,d,z)},ht=X=>{const d=c.findPiece(X);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=ne(z,c.getPrimitive);return pn(z,q,d.pos).map(C=>C.map(J=>[J.x,J.y]))},Et=(X,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&Z)return;if(A.mode==="prep"&&d.sectorId){const lt=c.getPiecesInSector(d.sectorId),ct=c.findPiece(d.id);if(ct&&A0(ct,lt,Y=>c.getBlueprint(Y),Y=>c.getPrimitive(Y))){V(d.id),setTimeout(()=>V(null),500);return}}if(R){X.stopPropagation();const lt=c.getBlueprint(d.blueprintId),ct=ne(lt,Gt=>c.getPrimitive(Gt)),Y=ia(lt,ct),{x:St,y:st}=L(X.clientX,X.clientY),Jt=pt({x:St,y:st}),te=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,te),g){const Gt="kind"in lt?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},ht(d.id),d.sectorId)}w.current={id:d.id,dx:St-d.x,dy:st-d.y,tlx:d.x,tly:d.y,aabb:{width:ct.width,height:ct.height},minx:ct.min.x,miny:ct.min.y,support:Y,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:Jt,pointerAnchorId:et(Jt),pointerAnchorSectorId:te,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},K(null,d.sectorId),$(d.id),y();return}(z=G.current)==null||z.setPointerCapture(X.pointerId);const q=c.getBlueprint(d.blueprintId),C=ne(q,lt=>c.getPrimitive(lt)),J=ia(q,C),{x:ot,y:N}=L(X.clientX,X.clientY),at=pt({x:ot,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(at.x,at.y,W),g){const lt="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,lt,"sector",{x:d.x,y:d.y},ht(d.id),d.sectorId)}w.current={id:d.id,dx:ot-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:J,fromIcon:!1,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:{x:d.x,y:d.y,sectorId:d.sectorId},pointerAnchor:at,pointerAnchorId:et(at),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},K(null,d.sectorId),$(d.id),y()},D=X=>{var d,z,q,C,J,ot,N,at;const{x:W,y:lt}=L(X.clientX,X.clientY),ct=pt({x:W,y:lt}),Y=Math.hypot(W-i.cx,lt-i.cy),St=Y<i.innerR?void 0:(d=I(W,lt))!=null?d:void 0;if(!w.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(ct.x,ct.y,St);return}const st=w.current,Jt=W-st.dx,te=lt-st.dy;Rt({x:W,y:lt},St);let Gt=ca(Jt,te,{aabb:st.aabb,support:st.support},i,c.state.cfg.target,Y<i.innerR);const Nt=Gt.x+st.aabb.width/2,It=Gt.y+st.aabb.height/2,Zt=Math.hypot(Nt-i.cx,It-i.cy)<i.innerR,kt=Zt?null:I(Nt,It);let Pt=null,Lt=null,ae=kt!=null?kt:void 0,Q=!1,rt=!1;if(Zt){const Ut=h.find(ut=>ut.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ut=f(st.id);if(ut){const Tt=c.getBlueprint(ut.blueprintId),xt=Ni(Gt,Tt,c.getPrimitive,Ut.valid);Gt=xt.tl,Pt=xt.node,Lt=xt.dist,ae=void 0}}st.validSnap=!1}else if(kt){const Ut=b(kt),ut=h.find(xt=>xt.sectorId===kt),Tt=A.target==="workspace"&&A.mode!=="prep"?(z=ut==null?void 0:ut.valid)!=null?z:[]:[...(q=ut==null?void 0:ut.valid)!=null?q:[],...(C=ut==null?void 0:ut.invalid)!=null?C:[]];if(Tt.length){const xt=f(st.id);if(xt){const Ce=c.getBlueprint(xt.blueprintId),De=Ni(Gt,Ce,c.getPrimitive,Tt);if(Gt=De.tl,Pt=De.node,Lt=De.dist,ae=kt,Ut)st.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,nl=f(st.id);let Ee=!0;if(nl){const ce=c.getBlueprint(nl.blueprintId),dl=ne(ce,c.getPrimitive),Re=pn(ce,dl,Gt),Ci=r.filter(re=>re.id!==st.id&&I(re.x+ne(c.getBlueprint(re.blueprintId),c.getPrimitive).width/2,re.y+ne(c.getBlueprint(re.blueprintId),c.getPrimitive).height/2)===kt);for(const re of Ci){const al=c.getBlueprint(re.blueprintId),ul=ne(al,c.getPrimitive),Oe=pn(al,ul,{x:re.x,y:re.y});if(Vh(Re,Oe)){Ee=!1;break}}if(A.target==="workspace"){if(A.mode==="prep"){const re=c.getPiecesInSector(kt),al=re.filter(bn=>bn.id!==st.id),ul=al.length===0,Oe=c.findPiece(st.id),zl=Oe==null?void 0:Oe.sectorId,ra=(J=c.state.cfg.maxCompositeSize)!=null?J:0,yu=ra>0,sa=re.length-(zl===kt?1:0),il=yu&&sa+1>ra;if(ul)st.validSnap=Ee&&!il,rt=il;else if(Oe){const bn=U0(R0({},Oe),{pos:{x:Gt.x,y:Gt.y}}),Yi=xo(bn,al,Ze=>c.getBlueprint(Ze),Ze=>c.getPrimitive(Ze));st.validSnap=Ee&&Yi.isAttached&&!il,rt=il}else st.validSnap=Ee&&!il,rt=il}else st.validSnap=Ee,rt=!1;Q=!Ee}else{const re=zl=>`${zl.x},${zl.y}`,al=new Set(((ot=ut==null?void 0:ut.valid)!=null?ot:[]).map(re)),ul=!!De.node&&al.has(re(De.node))&&De.dist<=(gn!=null?gn:0);let Oe=!1;if(ul){const zl=(N=p.get(kt))!=null?N:[];Oe=g0(Re,zl)}st.validSnap=ul&&Oe&&Ee,Q=!Ee}}}}}}else st.validSnap=c.state.cfg.target==="workspace",Pt=null,Lt=null,ae=void 0,rt=!1;st.overlaps=Q,st.maxExceeded=rt,K(Pt,ae,Lt!=null?Lt:void 0),st.tlx=Gt.x,st.tly=Gt.y,st.prevValidSnap!==st.validSnap&&(st.prevValidSnap=(at=st.validSnap)!=null?at:!1,y()),dt()},j=()=>{var X,d,z,q,C,J,ot,N,at,W,lt,ct;if(!w.current||R)return;const Y=w.current;if(Y.validSnap===!1){const It=c.findPiece(Y.id),Zt=c.state.cfg,kt=Y.tlx+Y.aabb.width/2,Pt=Y.tly+Y.aabb.height/2,Lt=I(kt,Pt);let ae="outside_bounds";if(Y.maxExceeded?ae="no_valid_anchor":Y.overlaps?ae="overlapping":Lt&&(ae="no_valid_anchor"),bt({x:kt,y:Pt},"invalid_placement",{invalidPlacement:{reason:ae,attemptedSectorId:Lt!=null?Lt:void 0}}),Zt.mode==="prep"&&Y.originalPos)c.move(Y.id,{x:Y.originalPos.x,y:Y.originalPos.y}),g&&g.recordPlacedown("placed",Y.originalPos.sectorId,{x:Y.originalPos.x,y:Y.originalPos.y},ht(Y.id),(X=Y.snapAnchorId)!=null?X:void 0,!1,(d=Y.overlaps)!=null?d:!1);else{const Q=It==null?void 0:It.sectorId;c.remove(Y.id),Q&&S(Q),g&&g.recordPlacedown("deleted",Q,void 0,void 0,(z=Y.snapAnchorId)!=null?z:void 0,!1,(q=Y.overlaps)!=null?q:!1)}w.current=null,$(null),y();return}w.current=null,Y.raf&&(cancelAnimationFrame(Y.raf),Y.raf=null);const St={x:Y.tlx,y:Y.tly},st=St.x+Y.aabb.width/2,Jt=St.y+Y.aabb.height/2;if(Math.hypot(st-i.cx,Jt-i.cy)<i.innerR){const It=c.findPiece(Y.id),Zt=It==null?void 0:It.sectorId;c.remove(Y.id),Zt&&S(Zt),g&&g.recordPlacedown("deleted",Zt,void 0,void 0,(C=Y.snapAnchorId)!=null?C:void 0,!1,(J=Y.overlaps)!=null?J:!1),$(null),y();return}const te=I(st,Jt);if(te&&b(te)){bt({x:st,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:te}}),Y.originalPos?(c.move(Y.id,{x:Y.originalPos.x,y:Y.originalPos.y}),Y.originalPos.sectorId&&c.drop(Y.id,Y.originalPos.sectorId),g&&g.recordPlacedown("placed",Y.originalPos.sectorId,{x:Y.originalPos.x,y:Y.originalPos.y},ht(Y.id),(ot=Y.snapAnchorId)!=null?ot:void 0,!1,(N=Y.overlaps)!=null?N:!1)):(c.remove(Y.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(at=Y.snapAnchorId)!=null?at:void 0,!1,(W=Y.overlaps)!=null?W:!1)),$(null),y();return}c.move(Y.id,St),c.drop(Y.id,te);const Gt=te?S(te):!1,Nt=Y.validSnap===void 0?!0:Y.validSnap;g&&g.recordPlacedown("placed",te,St,ht(Y.id),(lt=Y.snapAnchorId)!=null?lt:void 0,Nt,(ct=Y.overlaps)!=null?ct:!1,Gt),$(null),Y.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},P=(X,d,z)=>{var q,C,J,ot,N,at,W,lt;if(R&&Z)return;X.stopPropagation();const{x:ct,y:Y}=L(X.clientX,X.clientY),St=ne(d,c.getPrimitive),st=ia(d,St);if(R){const Pt=bo(ct,Y,z),Lt={x:ct-(Pt.x-St.min.x),y:Y-(Pt.y-St.min.y)},ae=Math.hypot(ct-i.cx,Y-i.cy)<i.innerR,Q=ca(Lt.x,Lt.y,{aabb:St,support:st},i,c.state.cfg.target,ae),rt=c.spawnFromBlueprint(d,Q),Ut=pt({x:ct,y:Y}),ut=(q=I(ct,Y))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ut),g){const ce="kind"in d?"primitive":"composite";g.recordPickup(rt,d.id,ce,"blueprint",Q,ht(rt),void 0)}const Tt=Q;let xt=Tt,Ce=null;const De=Tt.x+St.width/2,gn=Tt.y+St.height/2,nl=I(De,gn);if(nl){const ce=h.find(Re=>Re.sectorId===nl),dl=c.state.cfg.target==="workspace"?(C=ce==null?void 0:ce.valid)!=null?C:[]:[...(J=ce==null?void 0:ce.valid)!=null?J:[],...(ot=ce==null?void 0:ce.invalid)!=null?ot:[]];if(dl.length){const Re=Ni(Tt,d,c.getPrimitive,dl);xt=Re.tl,Ce={node:Re.node,dist:Re.dist}}}c.move(rt,xt),w.current={id:rt,dx:ct-xt.x,dy:Y-xt.y,tlx:xt.x,tly:xt.y,aabb:St,minx:St.min.x,miny:St.min.y,support:st,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:et(Ut),pointerAnchorSectorId:ut,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Rt({x:ct,y:Y},ut);const Ee=(N=I(xt.x+St.width/2,xt.y+St.height/2))!=null?N:void 0;K((at=Ce==null?void 0:Ce.node)!=null?at:null,Ee,Ce==null?void 0:Ce.dist),$(rt),y(),dt();return}(W=G.current)==null||W.setPointerCapture(X.pointerId);const Jt=bo(ct,Y,z),te={x:ct-(Jt.x-St.min.x),y:Y-(Jt.y-St.min.y)},Gt=Math.hypot(ct-i.cx,Y-i.cy)<i.innerR,Nt=ca(te.x,te.y,{aabb:St,support:st},i,c.state.cfg.target,Gt),It=c.spawnFromBlueprint(d,Nt),Zt=pt({x:ct,y:Y}),kt=(lt=I(ct,Y))!=null?lt:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,kt),g){const Pt="kind"in d?"primitive":"composite";g.recordPickup(It,d.id,Pt,"blueprint",Nt,ht(It),void 0)}w.current={id:It,dx:ct-Nt.x,dy:Y-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:St,minx:St.min.x,miny:St.min.y,support:st,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:et(Zt),pointerAnchorSectorId:kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Rt({x:ct,y:Y},kt),K(null,void 0),$(It),y(),dt()};return{draggingId:Z,dragInvalid:!!(w.current&&w.current.validSnap===!1),lockedPieceId:Mt,svgRef:G,onPiecePointerDown:Et,onBlueprintPointerDown:P,onPointerMove:D,onPointerUp:j,setPieceRef:ft,setDraggingId:$,dragRef:w}}function N0(c,i,r,f,h,p,b,S,y,m,g,A,R){const G=c.state.cfg,w=(dt,I)=>yo(dt,I,i,G.target),Z=dt=>{const I=c.findPiece(dt);if(!I)return[];const it=c.getBlueprint(I.blueprintId);if(!it)return[];const et=ne(it,c.getPrimitive);return pn(it,et,I.pos).map(pt=>pt.map(Rt=>[Rt.x,Rt.y]))},$=()=>{var dt,I,it,et,pt,Rt;const K=b.current;return{anchorId:(I=(dt=K==null?void 0:K.snapAnchorId)!=null?dt:K==null?void 0:K.pointerAnchorId)!=null?I:void 0,wasValid:(K==null?void 0:K.validSnap)!==!1,wasOverlapping:(it=K==null?void 0:K.overlaps)!=null?it:!1,anchorX:(et=K==null?void 0:K.pointerAnchor)==null?void 0:et.x,anchorY:(pt=K==null?void 0:K.pointerAnchor)==null?void 0:pt.y,sectorId:(Rt=K==null?void 0:K.snapAnchorSectorId)!=null?Rt:K==null?void 0:K.pointerAnchorSectorId}},gt=(dt,I,it)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(dt,I,it)},[Mt,V]=tt.useState(null),[ft,L]=tt.useState(null);return{pendingBpId:Mt,selectedPieceId:ft,onRootPointerDown:dt=>{var I,it;const{x:et,y:pt}=g(dt.clientX,dt.clientY);if(f){const Rt=w(et,pt);if(h&&b.current){const K=b.current,bt=K.tlx+K.aabb.width/2,ht=K.tly+K.aabb.height/2;if(S(et,pt)){const P=c.findPiece(K.id),X=P==null?void 0:P.sectorId,d=$();c.remove(K.id),X&&m(X),R&&R.recordPlacedown("deleted",X,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),p(null),L(null),V(null),A();return}if(Math.hypot(bt-i.cx,ht-i.cy)<i.innerR){const P=c.findPiece(K.id),X=P==null?void 0:P.sectorId,d=$();c.remove(K.id),X&&m(X),R&&R.recordPlacedown("deleted",X,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),p(null),L(null),V(null),A();return}const Et=w(bt,ht);if(!Et){gt({x:bt,y:ht},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),A();return}if(y(Et)){gt({x:bt,y:ht},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:Et}}),A();return}if(K.validSnap===!1){const P=$().wasOverlapping?"overlapping":"no_valid_anchor";gt({x:bt,y:ht},"invalid_placement",{invalidPlacement:{reason:P,attemptedSectorId:Et}}),A();return}c.move(K.id,{x:K.tlx,y:K.tly}),c.drop(K.id,Et);const D=$(),j=m(Et);R&&R.recordPlacedown("placed",Et,{x:K.tlx,y:K.tly},Z(K.id),D.anchorId,D.wasValid,D.wasOverlapping,j),p(null),L(null),V(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),A();return}if(ft){if(S(et,pt)){const K=c.findPiece(ft),bt=K==null?void 0:K.sectorId;c.remove(ft),bt&&m(bt),R&&R.recordPlacedown("deleted"),L(null),A();return}if(Rt&&y(Rt)){L(null),A();return}if(Rt){const K=r.find(bt=>bt.id===ft);if(L(null),K){const bt=c.getBlueprint(K.blueprintId),ht=ne(bt,c.getPrimitive),Et=ia(bt,ht),D={x:et-ht.width/2,y:pt-ht.height/2},j=ca(D.x,D.y,{aabb:{width:ht.width,height:ht.height},support:Et},i,c.state.cfg.target,!1),P=(I=c.state.cfg.maxCompositeSize)!=null?I:0;if(c.state.cfg.mode==="prep"&&P>0&&c.getPiecesInSector(Rt).length-(K.sectorId===Rt?1:0)+1>P){A();return}c.move(K.id,{x:j.x,y:j.y}),c.drop(K.id,Rt),m(Rt),A()}return}L(null),A();return}if(Mt){const K=w(et,pt);if(S(et,pt)||!K||y(K)){V(null),A();return}const bt=c.getBlueprint(Mt),ht=ne(bt,c.getPrimitive),Et=ia(bt,ht),D={x:et-ht.width/2,y:pt-ht.height/2},j=ca(D.x,D.y,{aabb:{width:ht.width,height:ht.height},support:Et},i,c.state.cfg.target,!1),P=c.spawnFromBlueprint(bt,j),X=(it=c.state.cfg.maxCompositeSize)!=null?it:0;if(c.state.cfg.mode==="prep"&&X>0&&c.getPiecesInSector(K).length+1>X){c.remove(P),V(null),A();return}c.drop(P,K),V(null),m(K),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),A();return}}},clearSelection:()=>{L(null),V(null)},setPendingBp:V,setSelectedPiece:L}}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 Hi;const q0=new Uint8Array(16);function C0(){if(!Hi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Hi=crypto.getRandomValues.bind(crypto)}return Hi(q0)}var Ao={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,p,b;if(Ao.randomUUID&&!i&&!c)return Ao.randomUUID();c=c||{};const f=(b=(p=c.random)!=null?p:(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:p=>this.recordSectorCompletion(p)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,p,b,S){const y=this.toAnchorPoint(p),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,p,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(),A=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),G=f?this.toAnchorPoint(f):void 0,w=h?this.toAnchorVertices(h):void 0,Z={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:A,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(Z.placedownSectorId=r),i==="placed"&&G&&(Z.placedownPosition=G),i==="placed"&&w&&(Z.placedownVertices=w),p&&(Z.placedownAnchorId=p),this.previousSnapshotId!==void 0&&(Z.preSnapshotId=this.previousSnapshotId),this.interactions.push(Z),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(Z),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",p=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===p&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:p,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 p=this.buildFinalBlueprintState(h),b=p.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:p,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const p=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=p.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:p,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 A=this.controller.getBlueprint(g.blueprintId),R=A&&"kind"in A?A.kind:g.blueprintId,G=this.controller.findPiece(g.pieceId);if(!G||!A)return{kind:R,position:g.position};const w=ne(A,this.controller.getPrimitive),Z={x:G.pos.x-w.min.x,y:G.pos.y-w.min.y},$=this.toAnchorPoint(Z);return{kind:R,position:$}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,p=0;for(const g of f)h+=g.position.x,p+=g.position.y;const b=Math.round(h/f.length),S=Math.round(p/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=[],p=[];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&&p.push(y.id);const A=((m==null?void 0:m.pieces)||[]).map(G=>({pieceId:G.id,blueprintId:G.blueprintId,blueprintType:this.getBlueprintType(G.blueprintId),position:this.toAnchorPoint(G.pos),vertices:this.getPieceVertices(G.id)})),R={sectorId:y.id,completed:g,pieceCount:A.length,pieces:A};(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:p,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 p=ne(h,S=>this.controller.getPrimitive(S)),b=((r=pn(h,p,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 p=r.get(h.blueprintId);p.totalPieces++,p.bySector.set(f.sectorId,(p.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 p=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 p&&(h.blueprintType==="composite"&&"parts"in p?(b.parts=p.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),p.shape&&(b.shape=p.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),p.label&&(b.label=p.label)):h.blueprintType==="primitive"&&"kind"in p&&(p.shape&&(b.shape=p.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=p.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,vn=(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},qi=(c,i)=>Q0(c,V0(i));function k0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:p,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:A,height:R,onSectorComplete:G,onPiecePlace:w,onPieceRemove:Z,onInteraction:$,onTrialEnd:gt,onControllerReady:Mt}=c,V=tt.useMemo(()=>{const Q=vn(vn(qi(vn({n:i.length,layout:h,target:p,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,p,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),ft=tt.useMemo(()=>{if(!$&&!gt)return null;const Q={};return $&&(Q.onInteraction=$),gt&&(Q.onTrialEnd=gt),new w0(V,Q)},[V,$,gt]);tt.useEffect(()=>{Mt&&Mt(V)},[V,Mt]),tt.useEffect(()=>()=>{ft&&ft.dispose()},[ft]);const{layout:L,viewBox:dt}=tt.useMemo(()=>{const Q=i.length,rt=i.map(Tt=>Tt.id),Ut=i.map(Tt=>{var xt;return(xt=Tt.silhouette.mask)!=null?xt:[]}),ut=Wh({n:Q,layoutMode:h,target:p,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:Fh({w:ut.LOGICAL_W,h:ut.LOGICAL_H},Q,rt,h,p,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ut.LOGICAL_W,h:ut.LOGICAL_H}}},[i,h,p,y,f.length]),[,I]=tt.useReducer(Q=>Q+1,0);tt.useEffect(()=>{Mt&&Mt(V,L,I)},[V,L,Mt,I]);const[it,et]=tt.useState(!1);tt.useEffect(()=>{i.every(Q=>V.isSectorCompleted(Q.id))&&!it&&(et(!0),ft&&setTimeout(()=>{ft.finalizeTrial("auto_complete")},0))},[V.updateCount,i,it,V,ft]);const pt=tt.useCallback(Q=>{G&&G(Q,V.snapshot())},[G,V]),Rt=tt.useMemo(()=>({onSectorComplete:pt,onPiecePlace:w||(()=>{}),onPieceRemove:Z||(()=>{})}),[pt,w,Z]),K=()=>{const Q={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const rt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return qi(vn({},Q),{width:`${rt}px`,height:`${rt}px`})}else{const rt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return qi(vn({},Q),{width:`${rt}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),rt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:Q,height:rt}}})();tt.useEffect(()=>{if(V.state.cfg.mode!=="construction"||!S||S<=0||it)return;const Q=window.setTimeout(()=>{it||(V.state.endedAt||(V.state.endedAt=performance.now(),I()),ft==null||ft.finalizeTrial("timeout"),et(!0))},S);return()=>{window.clearTimeout(Q)}},[V,S,it,ft,I]);const ht=Q=>V.isSectorCompleted(Q),{pieces:Et,pieceById:D,getSectorPiecePolysCached:j}=m0(V),P=V.state.cfg.input==="click",X=Math.max(k.size.centerBadge.minPx,L.innerR*k.size.centerBadge.fractionOfOuterR),d=V.state.cfg.layout==="semicircle"?{x:L.cx,y:L.cy-X-k.size.centerBadge.marginPx}:{x:L.cx,y:L.cy},z=(Q,rt)=>Math.hypot(Q-d.x,rt-d.y)<=X,q=tt.useMemo(()=>V.state.cfg.sectors.map(Q=>{var rt;return(rt=Q.silhouette.mask)!=null?rt:[]}),[V.state.cfg.sectors]),C=tt.useMemo(()=>{const Q=kh(q.flat());return Q?k.layout.grid.unitPx/Q:1},[q]),{anchorDots:J}=M0(V,L,C),ot=tt.useMemo(()=>{var Q,rt;const Ut=new Map;for(const ut of L.sectors){const Tt=(rt=(Q=V.state.cfg.sectors.find(De=>De.id===ut.id))==null?void 0:Q.silhouette.mask)!=null?rt:[];if(!(Tt!=null&&Tt.length))continue;const xt=mo(L,ut,"silhouette",1),Ce=ro(Tt,C,{cx:xt.cx,cy:xt.cy});Ut.set(ut.id,Ce)}return Ut},[L,C,V.state.cfg.sectors]),N=Q=>{var rt,Ut,ut;if(!Q||ht(Q))return!1;if(V.state.cfg.target==="silhouette"){const Tt=(rt=ot.get(Q))!=null?rt:[];if(!Tt.length)return!1;const xt=j(Q);if(r0(Tt,xt))return V.markSectorCompleted(Q),!0}else{const Tt=(ut=(Ut=V.state.cfg.sectors.find(De=>De.id===Q))==null?void 0:Ut.silhouette.mask)!=null?ut:[];if(!Tt.length)return!1;const xt=y0(Tt,C),Ce=j(Q);if(h0(xt,Ce))return V.markSectorCompleted(Q),!0}return!1},at=B0(V,L,Et,D,J,ot,ht,N,I,void 0,ft),{draggingId:W,dragInvalid:lt,svgRef:ct,onPiecePointerDown:Y,onBlueprintPointerDown:St,onPointerMove:st,onPointerUp:Jt,setPieceRef:te,setDraggingId:Gt,lockedPieceId:Nt,dragRef:It}=at,Zt=(Q,rt)=>{const Ut=ct.current,ut=Ut.createSVGPoint();ut.x=Q,ut.y=rt;const Tt=Ut.getScreenCTM();if(!Tt)return{x:0,y:0};const xt=ut.matrixTransform(Tt.inverse());return{x:xt.x,y:xt.y}},kt=N0(V,L,Et,P,W,Gt,It,z,ht,N,Zt,I,ft),{selectedPieceId:Pt,onRootPointerDown:Lt}=kt,ae=Q=>{if(W)return;const{x:rt,y:Ut}=Zt(Q.clientX,Q.clientY);if(V.state.cfg.mode==="prep"){if(!V.isSubmitEnabled()||it){Q.stopPropagation();return}et(!0),ft&&ft.finalizeTrial("submit"),Q.stopPropagation();return}if(ft!=null&&ft.recordClickEvent){const ut=V.state.blueprintView,Tt=ut==="primitives"?"quickstash":"primitives";ft.recordClickEvent({x:rt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ut,to:Tt}})}V.switchBlueprintView(),I(),Q.stopPropagation()};return tt.createElement("div",{className:"tangram-gameboard",style:K()},tt.createElement(c0,vn({controller:V,layout:L,viewBox:dt,width:bt.width,height:bt.height,badgeR:X,badgeCenter:d,placedSilBySector:ot,anchorDots:J,pieces:Et,clickMode:P,draggingId:W,selectedPieceId:Pt,dragInvalid:lt,lockedPieceId:Nt,svgRef:ct,setPieceRef:te,onPiecePointerDown:Y,onBlueprintPointerDown:St,onRootPointerDown:Lt,onPointerMove:st,onPointerUp:Jt,onCenterBadgePointerDown:ae},Rt)))}const K0=40*Math.SQRT2,ze=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 P0(c,i,r,f,h,p){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Ae(r+p*Math.cos(b),f+p*Math.sin(b))}function $0(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),p=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=p[b-1];m===void 0||g===void 0||f.push(P0(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:[ze,ze,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,ze,ze,20,20,ze,ze],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:medtriangle",kind:"medtriangle",sideLens:[20,20,20,20,ze,ze,ze,ze],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:largetriangle",kind:"largetriangle",sideLens:[ze,ze,ze,ze,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 p=I0[i],b=$0(r,f,p);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:p}=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 A of m.shape)S.push(A.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:p!=null?p:`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 f=new Set(["square","smalltriangle","parallelogram","medtriangle","largetriangle"]),h=[...W0].sort((m,g)=>i.primitiveOrder.indexOf(m.kind)-i.primitiveOrder.indexOf(g.kind)),p=i.tangrams.map((m,g)=>{const A=m.solutionTans.filter(G=>{var w;const Z=(w=G.name)!=null?w:G.kind;return f.has(Z)}).map((G,w)=>G.vertices.map(([Z,$])=>({x:Z!=null?Z:0,y:-($!=null?$:0)}))),R=`sector${g}`;return{id:R,tangramId:m.tangramID,silhouette:{id:R,mask:A}}});let b=[];if(i.quickstash_macros&&i.quickstash_macros.length>0){const m=i.quickstash_macros[0];if(m&&"parts"in m&&m.parts&&m.parts[0]&&"anchorOffset"in m.parts[0]){const g=new Map;h.forEach(A=>g.set(A.kind,A)),b=i.quickstash_macros.map(A=>F0(A,g,k.layout.grid.stepPx))}else b=i.quickstash_macros}const S=Bo(Bo({sectors:p,quickstash:b,primitives:h,layout:i.layout,target:i.target,input:i.input,timeLimitMs:i.time_limit_ms,maxQuickstashSlots:k.layout.defaults.maxQuickstashSlots,mode:"construction"},i.onInteraction&&{onInteraction:i.onInteraction}),i.onTrialEnd&&{onTrialEnd:i.onTrialEnd}),y=zh.createRoot(c);return y.render(tt.createElement(k0,S)),{root:y,display_element:c,jsPsych:r}}const ay={name:"tangram-construct",version:"1.0.0",parameters:{tangrams:{type:Me.ParameterType.COMPLEX,default:void 0,description:"Array of TangramSpec objects defining target shapes to construct"},quickstash_macros:{type:Me.ParameterType.COMPLEX,default:[],description:"Array of MacroSpec objects created in prep trial"},primitive_order:{type:Me.ParameterType.OBJECT,default:["square","smalltriangle","parallelogram","medtriangle","largetriangle"],description:"Array of primitive names in the order they should be displayed"},target:{type:Me.ParameterType.SELECT,options:["workspace","silhouette"],default:"silhouette",description:"Placement target: workspace (free placement) or silhouette (onto target shape)"},input:{type:Me.ParameterType.SELECT,options:["click","drag"],default:"drag",description:"Input mode: drag (mouse/touch drag) or click (click to select/place)"},layout:{type:Me.ParameterType.SELECT,options:["circle","semicircle"],default:"semicircle",description:"Layout mode: full circle or semicircle piece arrangement"},time_limit_ms:{type:Me.ParameterType.INT,default:0,description:"Time limit in milliseconds (0 = no limit)"},snap_radius_px:{type:Me.ParameterType.INT,default:18,description:"Snap radius for anchor-based piece placement"},onInteraction:{type:Me.ParameterType.FUNCTION,default:void 0,description:"Callback for each interaction event (e.g., socket.emit)"},onTrialEnd:{type:Me.ParameterType.FUNCTION,default:void 0,description:"Callback when trial completes with full data"}},data:{events:{type:Me.ParameterType.COMPLEX,description:"Chronological log of all user interactions and game events"},completion_times:{type:Me.ParameterType.COMPLEX,description:"Array of completion times in milliseconds for each tangram"},final_state:{type:Me.ParameterType.COMPLEX,description:"Array describing completion status of each tangram sector"},macros_used:{type:Me.ParameterType.COMPLEX,description:"Array tracking which macros were used and when"},trial_duration_ms:{type:Me.ParameterType.INT,description:"Total time from trial start to completion"}},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={tangrams:r.tangrams,quickstash_macros:r.quickstash_macros,primitiveOrder:r.primitive_order,target:r.target,input:r.input,layout:r.layout,time_limit_ms:r.time_limit_ms,onInteraction:r.onInteraction,onTrialEnd:f},{root:p,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:p,jsPsych:S}}}return No.info=ay,No}(jsPsychModule);
|
|
42
42
|
//# sourceMappingURL=index.browser.min.js.map
|