jspsych-tangram 0.0.3 → 0.0.4
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 +15 -16
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +13 -13
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +15 -16
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.js +15 -16
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +17 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +12 -11
- 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 +12 -11
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.js +12 -11
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/domain/primitives.ts +9 -10
- package/src/core/domain/types.ts +4 -3
- package/src/core/io/InteractionTracker.ts +1 -1
- package/src/core/io/quickstash.ts +3 -29
- package/src/core/types/plugin-interfaces.ts +1 -1
- package/src/plugins/tangram-construct/ConstructionApp.tsx +6 -7
- package/src/plugins/tangram-prep/PrepApp.tsx +1 -0
- package/tangram-construct.min.js +13 -13
- package/tangram-prep.min.js +1 -1
- package/src/core/io/stims.ts +0 -107
package/tangram-prep.min.js
CHANGED
|
@@ -38,5 +38,5 @@ var TangramPrepPlugin=function(ee){"use strict";function bh(c,i){return i.forEac
|
|
|
38
38
|
`+p[n].replace(" at new "," at ");return t.displayName&&U.includes("<anonymous>")&&(U=U.replace("<anonymous>",t.displayName)),U}while(1<=n&&0<=a);break}}}finally{Qi=!1,Error.prepareStackTrace=e}return(e=t?t.displayName||t.name:"")?En(e):""}function oy(t){switch(t.tag){case 26:case 27:case 5:return En(t.type);case 16:return En("Lazy");case 13:return En("Suspense");case 19:return En("SuspenseList");case 0:case 15:return Vi(t.type,!1);case 11:return Vi(t.type.render,!1);case 1:return Vi(t.type,!0);case 31:return En("Activity");default:return""}}function jo(t){try{var l="";do l+=oy(t),t=t.return;while(t);return l}catch(e){return`
|
|
39
39
|
Error generating stack: `+e.message+`
|
|
40
40
|
`+e.stack}}function Zl(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Qo(t){var l=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function ry(t){var l=Qo(t)?"checked":"value",e=Object.getOwnPropertyDescriptor(t.constructor.prototype,l),n=""+t[l];if(!t.hasOwnProperty(l)&&typeof e!="undefined"&&typeof e.get=="function"&&typeof e.set=="function"){var a=e.get,u=e.set;return Object.defineProperty(t,l,{configurable:!0,get:function(){return a.call(this)},set:function(o){n=""+o,u.call(this,o)}}),Object.defineProperty(t,l,{enumerable:e.enumerable}),{getValue:function(){return n},setValue:function(o){n=""+o},stopTracking:function(){t._valueTracker=null,delete t[l]}}}}function pu(t){t._valueTracker||(t._valueTracker=ry(t))}function Vo(t){if(!t)return!1;var l=t._valueTracker;if(!l)return!0;var e=l.getValue(),n="";return t&&(n=Qo(t)?t.checked?"true":"false":t.value),t=n,t!==e?(l.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(l){return t.body}}var sy=/[\n"\\]/g;function Ll(t){return t.replace(sy,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Zi(t,l,e,n,a,u,o,s){t.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?t.type=o:t.removeAttribute("type"),l!=null?o==="number"?(l===0&&t.value===""||t.value!=l)&&(t.value=""+Zl(l)):t.value!==""+Zl(l)&&(t.value=""+Zl(l)):o!=="submit"&&o!=="reset"||t.removeAttribute("value"),l!=null?Li(t,o,Zl(l)):e!=null?Li(t,o,Zl(e)):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=""+Zl(s):t.removeAttribute("name")}function Zo(t,l,e,n,a,u,o,s){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(t.type=u),l!=null||e!=null){if(!(u!=="submit"&&u!=="reset"||l!=null))return;e=e!=null?""+Zl(e):"",l=l!=null?""+Zl(l):e,s||l===t.value||(t.value=l),t.defaultValue=l}n=n!=null?n:a,n=typeof n!="function"&&typeof n!="symbol"&&!!n,t.checked=s?t.checked:!!n,t.defaultChecked=!!n,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(t.name=o)}function Li(t,l,e){l==="number"&&gu(t.ownerDocument)===t||t.defaultValue===""+e||(t.defaultValue=""+e)}function On(t,l,e,n){if(t=t.options,l){l={};for(var a=0;a<e.length;a++)l["$"+e[a]]=!0;for(e=0;e<t.length;e++)a=l.hasOwnProperty("$"+t[e].value),t[e].selected!==a&&(t[e].selected=a),a&&n&&(t[e].defaultSelected=!0)}else{for(e=""+Zl(e),l=null,a=0;a<t.length;a++){if(t[a].value===e){t[a].selected=!0,n&&(t[a].defaultSelected=!0);return}l!==null||t[a].disabled||(l=t[a])}l!==null&&(l.selected=!0)}}function Lo(t,l,e){if(l!=null&&(l=""+Zl(l),l!==t.value&&(t.value=l),e==null)){t.defaultValue!==l&&(t.defaultValue=l);return}t.defaultValue=e!=null?""+Zl(e):""}function Ko(t,l,e,n){if(l==null){if(n!=null){if(e!=null)throw Error(f(92));if(ht(n)){if(1<n.length)throw Error(f(93));n=n[0]}e=n}e==null&&(e=""),l=e}e=Zl(l),t.defaultValue=e,n=t.textContent,n===e&&n!==""&&n!==null&&(t.value=n)}function _n(t,l){if(l){var e=t.firstChild;if(e&&e===t.lastChild&&e.nodeType===3){e.nodeValue=l;return}}t.textContent=l}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,l,e){var n=l.indexOf("--")===0;e==null||typeof e=="boolean"||e===""?n?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="":n?t.setProperty(l,e):typeof e!="number"||e===0||dy.has(l)?l==="float"?t.cssFloat=e:t[l]=(""+e).trim():t[l]=e+"px"}function Jo(t,l,e){if(l!=null&&typeof l!="object")throw Error(f(62));if(t=t.style,e!=null){for(var n in e)!e.hasOwnProperty(n)||l!=null&&l.hasOwnProperty(n)||(n.indexOf("--")===0?t.setProperty(n,""):n==="float"?t.cssFloat="":t[n]="");for(var a in l)n=l[a],l.hasOwnProperty(a)&&e[a]!==n&&ko(t,a,n)}else for(var u in l)l.hasOwnProperty(u)&&ko(t,u,l[u])}function Ki(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var hy=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),yy=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function bu(t){return yy.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var ki=null;function Ji(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var zn=null,Dn=null;function Po(t){var l=Mn(t);if(l&&(t=l.stateNode)){var e=t[Rl]||null;t:switch(t=l.stateNode,l.type){case"input":if(Zi(t,e.value,e.defaultValue,e.defaultValue,e.checked,e.defaultChecked,e.type,e.name),l=e.name,e.type==="radio"&&l!=null){for(e=t;e.parentNode;)e=e.parentNode;for(e=e.querySelectorAll('input[name="'+Ll(""+l)+'"][type="radio"]'),l=0;l<e.length;l++){var n=e[l];if(n!==t&&n.form===t.form){var a=n[Rl]||null;if(!a)throw Error(f(90));Zi(n,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(l=0;l<e.length;l++)n=e[l],n.form===t.form&&Vo(n)}break t;case"textarea":Lo(t,e.value,e.defaultValue);break t;case"select":l=e.value,l!=null&&On(t,!!e.multiple,l,!1)}}}var Pi=!1;function $o(t,l,e){if(Pi)return t(l,e);Pi=!0;try{var n=t(l);return n}finally{if(Pi=!1,(zn!==null||Dn!==null)&&(ai(),zn&&(l=zn,t=Dn,Dn=zn=null,Po(l),t)))for(l=0;l<t.length;l++)Po(t[l])}}function ya(t,l){var e=t.stateNode;if(e===null)return null;var n=e[Rl]||null;if(n===null)return null;e=n[l];t:switch(l){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(e&&typeof e!="function")throw Error(f(231,l,typeof e));return e}var ye=!(typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"),$i=!1;if(ye)try{var ma={};Object.defineProperty(ma,"passive",{get:function(){$i=!0}}),window.addEventListener("test",ma,ma),window.removeEventListener("test",ma,ma)}catch(t){$i=!1}var De=null,Ii=null,Su=null;function Io(){if(Su)return Su;var t,l=Ii,e=l.length,n,a="value"in De?De.value:De.textContent,u=a.length;for(t=0;t<e&&l[t]===a[t];t++);var o=e-t;for(n=1;n<=o&&l[e-n]===a[u-n];n++);return Su=a.slice(t,1<n?1-n:void 0)}function xu(t){var l=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&l===13&&(t=13)):t=l,t===10&&(t=13),32<=t||t===13?t:0}function Mu(){return!0}function Wo(){return!1}function Ul(t){function l(e,n,a,u,o){this._reactName=e,this._targetInst=a,this.type=n,this.nativeEvent=u,this.target=o,this.currentTarget=null;for(var s in t)t.hasOwnProperty(s)&&(e=t[s],this[s]=e?e(u):u[s]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Mu:Wo,this.isPropagationStopped=Wo,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!="unknown"&&(e.returnValue=!1),this.isDefaultPrevented=Mu)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!="unknown"&&(e.cancelBubble=!0),this.isPropagationStopped=Mu)},persist:function(){},isPersistent:Mu}),l}var We={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Au=Ul(We),va=g({},We,{view:0,detail:0}),my=Ul(va),Wi,Fi,pa,Tu=g({},va,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:lc,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==pa&&(pa&&t.type==="mousemove"?(Wi=t.screenX-pa.screenX,Fi=t.screenY-pa.screenY):Fi=Wi=0,pa=t),Wi)},movementY:function(t){return"movementY"in t?t.movementY:Fi}}),Fo=Ul(Tu),vy=g({},Tu,{dataTransfer:0}),py=Ul(vy),gy=g({},va,{relatedTarget:0}),tc=Ul(gy),by=g({},We,{animationName:0,elapsedTime:0,pseudoElement:0}),Sy=Ul(by),xy=g({},We,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),My=Ul(xy),Ay=g({},We,{data:0}),tr=Ul(Ay),Ty={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ey={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Oy={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _y(t){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(t):(t=Oy[t])?!!l[t]:!1}function lc(){return _y}var zy=g({},va,{key:function(t){if(t.key){var l=Ty[t.key]||t.key;if(l!=="Unidentified")return l}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:lc,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=Ul(zy),Ry=g({},Tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lr=Ul(Ry),Uy=g({},va,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:lc}),By=Ul(Uy),Ny=g({},We,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hy=Ul(Ny),qy=g({},Tu,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Cy=Ul(qy),Yy=g({},We,{newState:0,oldState:0}),Gy=Ul(Yy),Xy=[9,13,27,32],ec=ye&&"CompositionEvent"in window,ga=null;ye&&"documentMode"in document&&(ga=document.documentMode);var wy=ye&&"TextEvent"in window&&!ga,er=ye&&(!ec||ga&&8<ga&&11>=ga),nr=" ",ar=!1;function ur(t,l){switch(t){case"keyup":return Xy.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ir(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Rn=!1;function jy(t,l){switch(t){case"compositionend":return ir(l);case"keypress":return l.which!==32?null:(ar=!0,nr);case"textInput":return t=l.data,t===nr&&ar?null:t;default:return null}}function Qy(t,l){if(Rn)return t==="compositionend"||!ec&&ur(t,l)?(t=Io(),Su=Ii=De=null,Rn=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return er&&l.locale!=="ko"?null:l.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 cr(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l==="input"?!!Vy[t.type]:l==="textarea"}function fr(t,l,e,n){zn?Dn?Dn.push(n):Dn=[n]:zn=n,l=ri(l,"onChange"),0<l.length&&(e=new Au("onChange","change",null,e,n),t.push({event:e,listeners:l}))}var ba=null,Sa=null;function Zy(t){Qd(t,0)}function Eu(t){var l=ha(t);if(Vo(l))return t}function or(t,l){if(t==="change")return l}var rr=!1;if(ye){var nc;if(ye){var ac="oninput"in document;if(!ac){var sr=document.createElement("div");sr.setAttribute("oninput","return;"),ac=typeof sr.oninput=="function"}nc=ac}else nc=!1;rr=nc&&(!document.documentMode||9<document.documentMode)}function dr(){ba&&(ba.detachEvent("onpropertychange",hr),Sa=ba=null)}function hr(t){if(t.propertyName==="value"&&Eu(Sa)){var l=[];fr(l,Sa,t,Ji(t)),$o(Zy,l)}}function Ly(t,l,e){t==="focusin"?(dr(),ba=l,Sa=e,ba.attachEvent("onpropertychange",hr)):t==="focusout"&&dr()}function Ky(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Eu(Sa)}function ky(t,l){if(t==="click")return Eu(l)}function Jy(t,l){if(t==="input"||t==="change")return Eu(l)}function Py(t,l){return t===l&&(t!==0||1/t===1/l)||t!==t&&l!==l}var Cl=typeof Object.is=="function"?Object.is:Py;function xa(t,l){if(Cl(t,l))return!0;if(typeof t!="object"||t===null||typeof l!="object"||l===null)return!1;var e=Object.keys(t),n=Object.keys(l);if(e.length!==n.length)return!1;for(n=0;n<e.length;n++){var a=e[n];if(!Mt.call(l,a)||!Cl(t[a],l[a]))return!1}return!0}function yr(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function mr(t,l){var e=yr(t);t=0;for(var n;e;){if(e.nodeType===3){if(n=t+e.textContent.length,t<=l&&n>=l)return{node:e,offset:l-t};t=n}t:{for(;e;){if(e.nextSibling){e=e.nextSibling;break t}e=e.parentNode}e=void 0}e=yr(e)}}function vr(t,l){return t&&l?t===l?!0:t&&t.nodeType===3?!1:l&&l.nodeType===3?vr(t,l.parentNode):"contains"in t?t.contains(l):t.compareDocumentPosition?!!(t.compareDocumentPosition(l)&16):!1:!1}function pr(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var l=gu(t.document);l instanceof t.HTMLIFrameElement;){try{var e=typeof l.contentWindow.location.href=="string"}catch(n){e=!1}if(e)t=l.contentWindow;else break;l=gu(t.document)}return l}function uc(t){var l=t&&t.nodeName&&t.nodeName.toLowerCase();return l&&(l==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||l==="textarea"||t.contentEditable==="true")}var $y=ye&&"documentMode"in document&&11>=document.documentMode,Un=null,ic=null,Ma=null,cc=!1;function gr(t,l,e){var n=e.window===e?e.document:e.nodeType===9?e:e.ownerDocument;cc||Un==null||Un!==gu(n)||(n=Un,"selectionStart"in n&&uc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ma&&xa(Ma,n)||(Ma=n,n=ri(ic,"onSelect"),0<n.length&&(l=new Au("onSelect","select",null,l,e),t.push({event:l,listeners:n}),l.target=Un)))}function Fe(t,l){var e={};return e[t.toLowerCase()]=l.toLowerCase(),e["Webkit"+t]="webkit"+l,e["Moz"+t]="moz"+l,e}var Bn={animationend:Fe("Animation","AnimationEnd"),animationiteration:Fe("Animation","AnimationIteration"),animationstart:Fe("Animation","AnimationStart"),transitionrun:Fe("Transition","TransitionRun"),transitionstart:Fe("Transition","TransitionStart"),transitioncancel:Fe("Transition","TransitionCancel"),transitionend:Fe("Transition","TransitionEnd")},fc={},br={};ye&&(br=document.createElement("div").style,"AnimationEvent"in window||(delete Bn.animationend.animation,delete Bn.animationiteration.animation,delete Bn.animationstart.animation),"TransitionEvent"in window||delete Bn.transitionend.transition);function tn(t){if(fc[t])return fc[t];if(!Bn[t])return t;var l=Bn[t],e;for(e in l)if(l.hasOwnProperty(e)&&e in br)return fc[t]=l[e];return t}var Sr=tn("animationend"),xr=tn("animationiteration"),Mr=tn("animationstart"),Iy=tn("transitionrun"),Wy=tn("transitionstart"),Fy=tn("transitioncancel"),Ar=tn("transitionend"),Tr=new Map,oc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");oc.push("scrollEnd");function Fl(t,l){Tr.set(t,l),Ie(l,[t])}var Er=new WeakMap;function Kl(t,l){if(typeof t=="object"&&t!==null){var e=Er.get(t);return e!==void 0?e:(l={value:t,source:l,stack:jo(l)},Er.set(t,l),l)}return{value:t,source:l,stack:jo(l)}}var kl=[],Nn=0,rc=0;function Ou(){for(var t=Nn,l=rc=Nn=0;l<t;){var e=kl[l];kl[l++]=null;var n=kl[l];kl[l++]=null;var a=kl[l];kl[l++]=null;var u=kl[l];if(kl[l++]=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&&Or(e,a,u)}}function _u(t,l,e,n){kl[Nn++]=t,kl[Nn++]=l,kl[Nn++]=e,kl[Nn++]=n,rc|=n,t.lanes|=n,t=t.alternate,t!==null&&(t.lanes|=n)}function sc(t,l,e,n){return _u(t,l,e,n),zu(t)}function Hn(t,l){return _u(t,null,null,l),zu(t)}function Or(t,l,e){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e);for(var a=!1,u=t.return;u!==null;)u.childLanes|=e,n=u.alternate,n!==null&&(n.childLanes|=e),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&&l!==null&&(a=31-At(e),t=u.hiddenUpdates,n=t[a],n===null?t[a]=[l]:n.push(l),l.lane=e|536870912),u):null}function zu(t){if(50<ka)throw ka=0,gf=null,Error(f(185));for(var l=t.return;l!==null;)t=l,l=t.return;return t.tag===3?t.stateNode:null}var qn={};function tm(t,l,e,n){this.tag=t,this.key=e,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,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 Yl(t,l,e,n){return new tm(t,l,e,n)}function dc(t){return t=t.prototype,!(!t||!t.isReactComponent)}function me(t,l){var e=t.alternate;return e===null?(e=Yl(t.tag,l,t.key,t.mode),e.elementType=t.elementType,e.type=t.type,e.stateNode=t.stateNode,e.alternate=t,t.alternate=e):(e.pendingProps=l,e.type=t.type,e.flags=0,e.subtreeFlags=0,e.deletions=null),e.flags=t.flags&65011712,e.childLanes=t.childLanes,e.lanes=t.lanes,e.child=t.child,e.memoizedProps=t.memoizedProps,e.memoizedState=t.memoizedState,e.updateQueue=t.updateQueue,l=t.dependencies,e.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},e.sibling=t.sibling,e.index=t.index,e.ref=t.ref,e.refCleanup=t.refCleanup,e}function _r(t,l){t.flags&=65011714;var e=t.alternate;return e===null?(t.childLanes=0,t.lanes=l,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,t.type=e.type,l=e.dependencies,t.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),t}function Du(t,l,e,n,a,u){var o=0;if(n=t,typeof t=="function")dc(t)&&(o=1);else if(typeof t=="string")o=ev(t,e,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case tt:return t=Yl(31,e,l,a),t.elementType=tt,t.lanes=u,t;case j:return ln(e.children,a,u,l);case K:o=8,a|=24;break;case $:return t=Yl(12,e,l,a|2),t.elementType=$,t.lanes=u,t;case Z:return t=Yl(13,e,l,a),t.elementType=Z,t.lanes=u,t;case ot:return t=Yl(19,e,l,a),t.elementType=ot,t.lanes=u,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case gt:case Q:o=10;break t;case bt:o=9;break t;case ut:o=11;break t;case I:o=14;break t;case et:o=16,n=null;break t}o=29,e=Error(f(130,t===null?"null":typeof t,"")),n=null}return l=Yl(o,e,l,a),l.elementType=t,l.type=n,l.lanes=u,l}function ln(t,l,e,n){return t=Yl(7,t,n,l),t.lanes=e,t}function hc(t,l,e){return t=Yl(6,t,null,l),t.lanes=e,t}function yc(t,l,e){return l=Yl(4,t.children!==null?t.children:[],t.key,l),l.lanes=e,l.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},l}var Cn=[],Yn=0,Ru=null,Uu=0,Jl=[],Pl=0,en=null,ve=1,pe="";function nn(t,l){Cn[Yn++]=Uu,Cn[Yn++]=Ru,Ru=t,Uu=l}function zr(t,l,e){Jl[Pl++]=ve,Jl[Pl++]=pe,Jl[Pl++]=en,en=t;var n=ve;t=pe;var a=32-At(n)-1;n&=~(1<<a),e+=1;var u=32-At(l)+a;if(30<u){var o=a-a%5;u=(n&(1<<o)-1).toString(32),n>>=o,a-=o,ve=1<<32-At(l)+a|e<<a|n,pe=u+t}else ve=1<<u|e<<a|n,pe=t}function mc(t){t.return!==null&&(nn(t,1),zr(t,1,0))}function vc(t){for(;t===Ru;)Ru=Cn[--Yn],Cn[Yn]=null,Uu=Cn[--Yn],Cn[Yn]=null;for(;t===en;)en=Jl[--Pl],Jl[Pl]=null,pe=Jl[--Pl],Jl[Pl]=null,ve=Jl[--Pl],Jl[Pl]=null}var Ol=null,Ft=null,qt=!1,an=null,ce=!1,pc=Error(f(519));function un(t){var l=Error(f(418,""));throw Ea(Kl(l,t)),pc}function Dr(t){var l=t.stateNode,e=t.type,n=t.memoizedProps;switch(l[Sl]=t,l[Rl]=n,e){case"dialog":Rt("cancel",l),Rt("close",l);break;case"iframe":case"object":case"embed":Rt("load",l);break;case"video":case"audio":for(e=0;e<Pa.length;e++)Rt(Pa[e],l);break;case"source":Rt("error",l);break;case"img":case"image":case"link":Rt("error",l),Rt("load",l);break;case"details":Rt("toggle",l);break;case"input":Rt("invalid",l),Zo(l,n.value,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name,!0),pu(l);break;case"select":Rt("invalid",l);break;case"textarea":Rt("invalid",l),Ko(l,n.value,n.defaultValue,n.children),pu(l)}e=n.children,typeof e!="string"&&typeof e!="number"&&typeof e!="bigint"||l.textContent===""+e||n.suppressHydrationWarning===!0||Kd(l.textContent,e)?(n.popover!=null&&(Rt("beforetoggle",l),Rt("toggle",l)),n.onScroll!=null&&Rt("scroll",l),n.onScrollEnd!=null&&Rt("scrollend",l),n.onClick!=null&&(l.onclick=si),l=!0):l=!1,l||un(t)}function Rr(t){for(Ol=t.return;Ol;)switch(Ol.tag){case 5:case 13:ce=!1;return;case 27:case 3:ce=!0;return;default:Ol=Ol.return}}function Aa(t){if(t!==Ol)return!1;if(!qt)return Rr(t),qt=!0,!1;var l=t.tag,e;if((e=l!==3&&l!==27)&&((e=l===5)&&(e=t.type,e=!(e!=="form"&&e!=="button")||Hf(t.type,t.memoizedProps)),e=!e),e&&Ft&&un(t),Rr(t),l===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(f(317));t:{for(t=t.nextSibling,l=0;t;){if(t.nodeType===8)if(e=t.data,e==="/$"){if(l===0){Ft=le(t.nextSibling);break t}l--}else e!=="$"&&e!=="$!"&&e!=="$?"||l++;t=t.nextSibling}Ft=null}}else l===27?(l=Ft,Le(t.type)?(t=Gf,Gf=null,Ft=t):Ft=l):Ft=Ol?le(t.stateNode.nextSibling):null;return!0}function Ta(){Ft=Ol=null,qt=!1}function Ur(){var t=an;return t!==null&&(Hl===null?Hl=t:Hl.push.apply(Hl,t),an=null),t}function Ea(t){an===null?an=[t]:an.push(t)}var gc=z(null),cn=null,ge=null;function Re(t,l,e){C(gc,l._currentValue),l._currentValue=e}function be(t){t._currentValue=gc.current,q(gc)}function bc(t,l,e){for(;t!==null;){var n=t.alternate;if((t.childLanes&l)!==l?(t.childLanes|=l,n!==null&&(n.childLanes|=l)):n!==null&&(n.childLanes&l)!==l&&(n.childLanes|=l),t===e)break;t=t.return}}function Sc(t,l,e,n){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var u=a.dependencies;if(u!==null){var o=a.child;u=u.firstContext;t:for(;u!==null;){var s=u;u=a;for(var p=0;p<l.length;p++)if(s.context===l[p]){u.lanes|=e,s=u.alternate,s!==null&&(s.lanes|=e),bc(u.return,e,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|=e,u=o.alternate,u!==null&&(u.lanes|=e),bc(o,e,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,l,e,n){t=null;for(var a=l,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;Cl(a.pendingProps.value,o.value)||(t!==null?t.push(s):t=[s])}}else if(a===ct.current){if(o=a.alternate,o===null)throw Error(f(387));o.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(lu):t=[lu])}a=a.return}t!==null&&Sc(l,t,e,n),l.flags|=262144}function Bu(t){for(t=t.firstContext;t!==null;){if(!Cl(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function fn(t){cn=t,ge=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function xl(t){return Br(cn,t)}function Nu(t,l){return cn===null&&fn(t),Br(t,l)}function Br(t,l){var e=l._currentValue;if(l={context:l,memoizedValue:e,next:null},ge===null){if(t===null)throw Error(f(308));ge=l,t.dependencies={lanes:0,firstContext:l},t.flags|=524288}else ge=ge.next=l;return e}var lm=typeof AbortController!="undefined"?AbortController:function(){var t=[],l=this.signal={aborted:!1,addEventListener:function(e,n){t.push(n)}};this.abort=function(){l.aborted=!0,t.forEach(function(e){return e()})}},em=c.unstable_scheduleCallback,nm=c.unstable_NormalPriority,fl={$$typeof:Q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xc(){return{controller:new lm,data:new Map,refCount:0}}function _a(t){t.refCount--,t.refCount===0&&em(nm,function(){t.controller.abort()})}var za=null,Mc=0,Gn=0,Xn=null;function am(t,l){if(za===null){var e=za=[];Mc=0,Gn=Ef(),Xn={status:"pending",value:void 0,then:function(n){e.push(n)}}}return Mc++,l.then(Nr,Nr),l}function Nr(){if(--Mc===0&&za!==null){Xn!==null&&(Xn.status="fulfilled");var t=za;za=null,Gn=0,Xn=null;for(var l=0;l<t.length;l++)(0,t[l])()}}function um(t,l){var e=[],n={status:"pending",value:null,reason:null,then:function(a){e.push(a)}};return t.then(function(){n.status="fulfilled",n.value=l;for(var a=0;a<e.length;a++)(0,e[a])(l)},function(a){for(n.status="rejected",n.reason=a,a=0;a<e.length;a++)(0,e[a])(void 0)}),n}var Hr=D.S;D.S=function(t,l){typeof l=="object"&&l!==null&&typeof l.then=="function"&&am(t,l),Hr!==null&&Hr(t,l)};var on=z(null);function Ac(){var t=on.current;return t!==null?t:Vt.pooledCache}function Hu(t,l){l===null?C(on,on.current):C(on,l.pool)}function qr(){var t=Ac();return t===null?null:{parent:fl._currentValue,pool:t}}var Da=Error(f(460)),Cr=Error(f(474)),qu=Error(f(542)),Tc={then:function(){}};function Yr(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Cu(){}function Gr(t,l,e){switch(e=t[e],e===void 0?t.push(l):e!==l&&(l.then(Cu,Cu),l=e),l.status){case"fulfilled":return l.value;case"rejected":throw t=l.reason,wr(t),t;default:if(typeof l.status=="string")l.then(Cu,Cu);else{if(t=Vt,t!==null&&100<t.shellSuspendCounter)throw Error(f(482));t=l,t.status="pending",t.then(function(n){if(l.status==="pending"){var a=l;a.status="fulfilled",a.value=n}},function(n){if(l.status==="pending"){var a=l;a.status="rejected",a.reason=n}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw t=l.reason,wr(t),t}throw Ra=l,Da}}var Ra=null;function Xr(){if(Ra===null)throw Error(f(459));var t=Ra;return Ra=null,t}function wr(t){if(t===Da||t===qu)throw Error(f(483))}var Ue=!1;function Ec(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Oc(t,l){t=t.updateQueue,l.updateQueue===t&&(l.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Be(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ne(t,l,e){var n=t.updateQueue;if(n===null)return null;if(n=n.shared,Ct&2){var a=n.pending;return a===null?l.next=l:(l.next=a.next,a.next=l),n.pending=l,l=zu(t),Or(t,null,e),l}return _u(t,n,l,e),zu(t)}function Ua(t,l,e){if(l=l.updateQueue,l!==null&&(l=l.shared,(e&4194048)!==0)){var n=l.lanes;n&=t.pendingLanes,e|=n,l.lanes=e,yu(t,e)}}function _c(t,l){var e=t.updateQueue,n=t.alternate;if(n!==null&&(n=n.updateQueue,e===n)){var a=null,u=null;if(e=e.firstBaseUpdate,e!==null){do{var o={lane:e.lane,tag:e.tag,payload:e.payload,callback:null,next:null};u===null?a=u=o:u=u.next=o,e=e.next}while(e!==null);u===null?a=u=l:u=u.next=l}else a=u=l;e={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:u,shared:n.shared,callbacks:n.callbacks},t.updateQueue=e;return}t=e.lastBaseUpdate,t===null?e.firstBaseUpdate=l:t.next=l,e.lastBaseUpdate=l}var zc=!1;function Ba(){if(zc){var t=Xn;if(t!==null)throw t}}function Na(t,l,e,n){zc=!1;var a=t.updateQueue;Ue=!1;var u=a.firstBaseUpdate,o=a.lastBaseUpdate,s=a.shared.pending;if(s!==null){a.shared.pending=null;var p=s,T=p.next;p.next=null,o===null?u=T:o.next=T,o=p;var U=t.alternate;U!==null&&(U=U.updateQueue,s=U.lastBaseUpdate,s!==o&&(s===null?U.firstBaseUpdate=T:s.next=T,U.lastBaseUpdate=p))}if(u!==null){var H=a.baseState;o=0,U=T=p=null,s=u;do{var O=s.lane&-536870913,_=O!==s.lane;if(_?(Bt&O)===O:(n&O)===O){O!==0&&O===Gn&&(zc=!0),U!==null&&(U=U.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});t:{var St=t,vt=s;O=l;var jt=e;switch(vt.tag){case 1:if(St=vt.payload,typeof St=="function"){H=St.call(jt,H,O);break t}H=St;break t;case 3:St.flags=St.flags&-65537|128;case 0:if(St=vt.payload,O=typeof St=="function"?St.call(jt,H,O):St,O==null)break t;H=g({},H,O);break t;case 2:Ue=!0}}O=s.callback,O!==null&&(t.flags|=64,_&&(t.flags|=8192),_=a.callbacks,_===null?a.callbacks=[O]:_.push(O))}else _={lane:O,tag:s.tag,payload:s.payload,callback:s.callback,next:null},U===null?(T=U=_,p=H):U=U.next=_,o|=O;if(s=s.next,s===null){if(s=a.shared.pending,s===null)break;_=s,s=_.next,_.next=null,a.lastBaseUpdate=_,a.shared.pending=null}}while(!0);U===null&&(p=H),a.baseState=p,a.firstBaseUpdate=T,a.lastBaseUpdate=U,u===null&&(a.shared.lanes=0),je|=o,t.lanes=o,t.memoizedState=H}}function jr(t,l){if(typeof t!="function")throw Error(f(191,t));t.call(l)}function Qr(t,l){var e=t.callbacks;if(e!==null)for(t.callbacks=null,t=0;t<e.length;t++)jr(e[t],l)}var wn=z(null),Yu=z(0);function Vr(t,l){t=Oe,C(Yu,t),C(wn,l),Oe=t|l.baseLanes}function Dc(){C(Yu,Oe),C(wn,wn.current)}function Rc(){Oe=Yu.current,q(wn),q(Yu)}var He=0,_t=null,Xt=null,ul=null,Gu=!1,jn=!1,rn=!1,Xu=0,Ha=0,Qn=null,im=0;function el(){throw Error(f(321))}function Uc(t,l){if(l===null)return!1;for(var e=0;e<l.length&&e<t.length;e++)if(!Cl(t[e],l[e]))return!1;return!0}function Bc(t,l,e,n,a,u){return He=u,_t=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,D.H=t===null||t.memoizedState===null?Os:_s,rn=!1,u=e(n,a),rn=!1,jn&&(u=Lr(l,e,n,a)),Zr(t),u}function Zr(t){D.H=Lu;var l=Xt!==null&&Xt.next!==null;if(He=0,ul=Xt=_t=null,Gu=!1,Ha=0,Qn=null,l)throw Error(f(300));t===null||dl||(t=t.dependencies,t!==null&&Bu(t)&&(dl=!0))}function Lr(t,l,e,n){_t=t;var a=0;do{if(jn&&(Qn=null),Ha=0,jn=!1,25<=a)throw Error(f(301));if(a+=1,ul=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=l(e,n)}while(jn);return u}function cm(){var t=D.H,l=t.useState()[0];return l=typeof l.then=="function"?qa(l):l,t=t.useState()[0],(Xt!==null?Xt.memoizedState:null)!==t&&(_t.flags|=1024),l}function Nc(){var t=Xu!==0;return Xu=0,t}function Hc(t,l,e){l.updateQueue=t.updateQueue,l.flags&=-2053,t.lanes&=~e}function qc(t){if(Gu){for(t=t.memoizedState;t!==null;){var l=t.queue;l!==null&&(l.pending=null),t=t.next}Gu=!1}He=0,ul=Xt=_t=null,jn=!1,Ha=Xu=0,Qn=null}function Bl(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ul===null?_t.memoizedState=ul=t:ul=ul.next=t,ul}function il(){if(Xt===null){var t=_t.alternate;t=t!==null?t.memoizedState:null}else t=Xt.next;var l=ul===null?_t.memoizedState:ul.next;if(l!==null)ul=l,Xt=t;else{if(t===null)throw _t.alternate===null?Error(f(467)):Error(f(310));Xt=t,t={memoizedState:Xt.memoizedState,baseState:Xt.baseState,baseQueue:Xt.baseQueue,queue:Xt.queue,next:null},ul===null?_t.memoizedState=ul=t:ul=ul.next=t}return ul}function Cc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qa(t){var l=Ha;return Ha+=1,Qn===null&&(Qn=[]),t=Gr(Qn,t,l),l=_t,(ul===null?l.memoizedState:ul.next)===null&&(l=l.alternate,D.H=l===null||l.memoizedState===null?Os:_s),t}function wu(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return qa(t);if(t.$$typeof===Q)return xl(t)}throw Error(f(438,String(t)))}function Yc(t){var l=null,e=_t.updateQueue;if(e!==null&&(l=e.memoCache),l==null){var n=_t.alternate;n!==null&&(n=n.updateQueue,n!==null&&(n=n.memoCache,n!=null&&(l={data:n.data.map(function(a){return a.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),e===null&&(e=Cc(),_t.updateQueue=e),e.memoCache=l,e=l.data[l.index],e===void 0)for(e=l.data[l.index]=Array(t),n=0;n<t;n++)e[n]=rt;return l.index++,e}function Se(t,l){return typeof l=="function"?l(t):l}function ju(t){var l=il();return Gc(l,Xt,t)}function Gc(t,l,e){var n=t.queue;if(n===null)throw Error(f(311));n.lastRenderedReducer=e;var a=t.baseQueue,u=n.pending;if(u!==null){if(a!==null){var o=a.next;a.next=u.next,u.next=o}l.baseQueue=a=u,n.pending=null}if(u=t.baseState,a===null)t.memoizedState=u;else{l=a.next;var s=o=null,p=null,T=l,U=!1;do{var H=T.lane&-536870913;if(H!==T.lane?(Bt&H)===H:(He&H)===H){var O=T.revertLane;if(O===0)p!==null&&(p=p.next={lane:0,revertLane:0,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null}),H===Gn&&(U=!0);else if((He&O)===O){T=T.next,O===Gn&&(U=!0);continue}else H={lane:0,revertLane:T.revertLane,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},p===null?(s=p=H,o=u):p=p.next=H,_t.lanes|=O,je|=O;H=T.action,rn&&e(u,H),u=T.hasEagerState?T.eagerState:e(u,H)}else O={lane:H,revertLane:T.revertLane,action:T.action,hasEagerState:T.hasEagerState,eagerState:T.eagerState,next:null},p===null?(s=p=O,o=u):p=p.next=O,_t.lanes|=H,je|=H;T=T.next}while(T!==null&&T!==l);if(p===null?o=u:p.next=s,!Cl(u,t.memoizedState)&&(dl=!0,U&&(e=Xn,e!==null)))throw e;t.memoizedState=u,t.baseState=o,t.baseQueue=p,n.lastRenderedState=u}return a===null&&(n.lanes=0),[t.memoizedState,n.dispatch]}function Xc(t){var l=il(),e=l.queue;if(e===null)throw Error(f(311));e.lastRenderedReducer=t;var n=e.dispatch,a=e.pending,u=l.memoizedState;if(a!==null){e.pending=null;var o=a=a.next;do u=t(u,o.action),o=o.next;while(o!==a);Cl(u,l.memoizedState)||(dl=!0),l.memoizedState=u,l.baseQueue===null&&(l.baseState=u),e.lastRenderedState=u}return[u,n]}function Kr(t,l,e){var n=_t,a=il(),u=qt;if(u){if(e===void 0)throw Error(f(407));e=e()}else e=l();var o=!Cl((Xt||a).memoizedState,e);o&&(a.memoizedState=e,dl=!0),a=a.queue;var s=Pr.bind(null,n,a,t);if(Ca(2048,8,s,[t]),a.getSnapshot!==l||o||ul!==null&&ul.memoizedState.tag&1){if(n.flags|=2048,Vn(9,Qu(),Jr.bind(null,n,a,e,l),null),Vt===null)throw Error(f(349));u||He&124||kr(n,l,e)}return e}function kr(t,l,e){t.flags|=16384,t={getSnapshot:l,value:e},l=_t.updateQueue,l===null?(l=Cc(),_t.updateQueue=l,l.stores=[t]):(e=l.stores,e===null?l.stores=[t]:e.push(t))}function Jr(t,l,e,n){l.value=e,l.getSnapshot=n,$r(l)&&Ir(t)}function Pr(t,l,e){return e(function(){$r(l)&&Ir(t)})}function $r(t){var l=t.getSnapshot;t=t.value;try{var e=l();return!Cl(t,e)}catch(n){return!0}}function Ir(t){var l=Hn(t,2);l!==null&&Ql(l,t,2)}function wc(t){var l=Bl();if(typeof t=="function"){var e=t;if(t=e(),rn){Tt(!0);try{e()}finally{Tt(!1)}}}return l.memoizedState=l.baseState=t,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Se,lastRenderedState:t},l}function Wr(t,l,e,n){return t.baseState=e,Gc(t,Xt,typeof n=="function"?n:Se)}function fm(t,l,e,n,a){if(Zu(t))throw Error(f(485));if(t=l.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?e(!0):u.isTransition=!1,n(u),e=l.pending,e===null?(u.next=l.pending=u,Fr(l,u)):(u.next=e.next,l.pending=e.next=u)}}function Fr(t,l){var e=l.action,n=l.payload,a=t.state;if(l.isTransition){var u=D.T,o={};D.T=o;try{var s=e(a,n),p=D.S;p!==null&&p(o,s),ts(t,l,s)}catch(T){jc(t,l,T)}finally{D.T=u}}else try{u=e(a,n),ts(t,l,u)}catch(T){jc(t,l,T)}}function ts(t,l,e){e!==null&&typeof e=="object"&&typeof e.then=="function"?e.then(function(n){ls(t,l,n)},function(n){return jc(t,l,n)}):ls(t,l,e)}function ls(t,l,e){l.status="fulfilled",l.value=e,es(l),t.state=e,l=t.pending,l!==null&&(e=l.next,e===l?t.pending=null:(e=e.next,l.next=e,Fr(t,e)))}function jc(t,l,e){var n=t.pending;if(t.pending=null,n!==null){n=n.next;do l.status="rejected",l.reason=e,es(l),l=l.next;while(l!==n)}t.action=null}function es(t){t=t.listeners;for(var l=0;l<t.length;l++)(0,t[l])()}function ns(t,l){return l}function as(t,l){if(qt){var e=Vt.formState;if(e!==null){t:{var n=_t;if(qt){if(Ft){l:{for(var a=Ft,u=ce;a.nodeType!==8;){if(!u){a=null;break l}if(a=le(a.nextSibling),a===null){a=null;break l}}u=a.data,a=u==="F!"||u==="F"?a:null}if(a){Ft=le(a.nextSibling),n=a.data==="F!";break t}}un(n)}n=!1}n&&(l=e[0])}}return e=Bl(),e.memoizedState=e.baseState=l,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ns,lastRenderedState:l},e.queue=n,e=As.bind(null,_t,n),n.dispatch=e,n=wc(!1),u=Kc.bind(null,_t,!1,n.queue),n=Bl(),a={state:l,dispatch:null,action:t,pending:null},n.queue=a,e=fm.bind(null,_t,a,u,e),a.dispatch=e,n.memoizedState=t,[l,e,!1]}function us(t){var l=il();return is(l,Xt,t)}function is(t,l,e){if(l=Gc(t,l,ns)[0],t=ju(Se)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var n=qa(l)}catch(o){throw o===Da?qu:o}else n=l;l=il();var a=l.queue,u=a.dispatch;return e!==l.memoizedState&&(_t.flags|=2048,Vn(9,Qu(),om.bind(null,a,e),null)),[n,u,t]}function om(t,l){t.action=l}function cs(t){var l=il(),e=Xt;if(e!==null)return is(l,e,t);il(),l=l.memoizedState,e=il();var n=e.queue.dispatch;return e.memoizedState=t,[l,n,!1]}function Vn(t,l,e,n){return t={tag:t,create:e,deps:n,inst:l,next:null},l=_t.updateQueue,l===null&&(l=Cc(),_t.updateQueue=l),e=l.lastEffect,e===null?l.lastEffect=t.next=t:(n=e.next,e.next=t,t.next=n,l.lastEffect=t),t}function Qu(){return{destroy:void 0,resource:void 0}}function fs(){return il().memoizedState}function Vu(t,l,e,n){var a=Bl();n=n===void 0?null:n,_t.flags|=t,a.memoizedState=Vn(1|l,Qu(),e,n)}function Ca(t,l,e,n){var a=il();n=n===void 0?null:n;var u=a.memoizedState.inst;Xt!==null&&n!==null&&Uc(n,Xt.memoizedState.deps)?a.memoizedState=Vn(l,u,e,n):(_t.flags|=t,a.memoizedState=Vn(1|l,u,e,n))}function os(t,l){Vu(8390656,8,t,l)}function rs(t,l){Ca(2048,8,t,l)}function ss(t,l){return Ca(4,2,t,l)}function ds(t,l){return Ca(4,4,t,l)}function hs(t,l){if(typeof l=="function"){t=t();var e=l(t);return function(){typeof e=="function"?e():l(null)}}if(l!=null)return t=t(),l.current=t,function(){l.current=null}}function ys(t,l,e){e=e!=null?e.concat([t]):null,Ca(4,4,hs.bind(null,l,t),e)}function Qc(){}function ms(t,l){var e=il();l=l===void 0?null:l;var n=e.memoizedState;return l!==null&&Uc(l,n[1])?n[0]:(e.memoizedState=[t,l],t)}function vs(t,l){var e=il();l=l===void 0?null:l;var n=e.memoizedState;if(l!==null&&Uc(l,n[1]))return n[0];if(n=t(),rn){Tt(!0);try{t()}finally{Tt(!1)}}return e.memoizedState=[n,l],n}function Vc(t,l,e){return e===void 0||He&1073741824?t.memoizedState=l:(t.memoizedState=e,t=bd(),_t.lanes|=t,je|=t,e)}function ps(t,l,e,n){return Cl(e,l)?e:wn.current!==null?(t=Vc(t,e,n),Cl(t,l)||(dl=!0),t):He&42?(t=bd(),_t.lanes|=t,je|=t,l):(dl=!0,t.memoizedState=e)}function gs(t,l,e,n,a){var u=w.p;w.p=u!==0&&8>u?u:8;var o=D.T,s={};D.T=s,Kc(t,!1,l,e);try{var p=a(),T=D.S;if(T!==null&&T(s,p),p!==null&&typeof p=="object"&&typeof p.then=="function"){var U=um(p,n);Ya(t,l,U,jl(t))}else Ya(t,l,n,jl(t))}catch(H){Ya(t,l,{then:function(){},status:"rejected",reason:H},jl())}finally{w.p=u,D.T=o}}function rm(){}function Zc(t,l,e,n){if(t.tag!==5)throw Error(f(476));var a=bs(t).queue;gs(t,a,l,P,e===null?rm:function(){return Ss(t),e(n)})}function bs(t){var l=t.memoizedState;if(l!==null)return l;l={memoizedState:P,baseState:P,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Se,lastRenderedState:P},next:null};var e={};return l.next={memoizedState:e,baseState:e,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Se,lastRenderedState:e},next:null},t.memoizedState=l,t=t.alternate,t!==null&&(t.memoizedState=l),l}function Ss(t){var l=bs(t).next.queue;Ya(t,l,{},jl())}function Lc(){return xl(lu)}function xs(){return il().memoizedState}function Ms(){return il().memoizedState}function sm(t){for(var l=t.return;l!==null;){switch(l.tag){case 24:case 3:var e=jl();t=Be(e);var n=Ne(l,t,e);n!==null&&(Ql(n,l,e),Ua(n,l,e)),l={cache:xc()},t.payload=l;return}l=l.return}}function dm(t,l,e){var n=jl();e={lane:n,revertLane:0,action:e,hasEagerState:!1,eagerState:null,next:null},Zu(t)?Ts(l,e):(e=sc(t,l,e,n),e!==null&&(Ql(e,t,n),Es(e,l,n)))}function As(t,l,e){var n=jl();Ya(t,l,e,n)}function Ya(t,l,e,n){var a={lane:n,revertLane:0,action:e,hasEagerState:!1,eagerState:null,next:null};if(Zu(t))Ts(l,a);else{var u=t.alternate;if(t.lanes===0&&(u===null||u.lanes===0)&&(u=l.lastRenderedReducer,u!==null))try{var o=l.lastRenderedState,s=u(o,e);if(a.hasEagerState=!0,a.eagerState=s,Cl(s,o))return _u(t,l,a,0),Vt===null&&Ou(),!1}catch(p){}finally{}if(e=sc(t,l,a,n),e!==null)return Ql(e,t,n),Es(e,l,n),!0}return!1}function Kc(t,l,e,n){if(n={lane:2,revertLane:Ef(),action:n,hasEagerState:!1,eagerState:null,next:null},Zu(t)){if(l)throw Error(f(479))}else l=sc(t,e,n,2),l!==null&&Ql(l,t,2)}function Zu(t){var l=t.alternate;return t===_t||l!==null&&l===_t}function Ts(t,l){jn=Gu=!0;var e=t.pending;e===null?l.next=l:(l.next=e.next,e.next=l),t.pending=l}function Es(t,l,e){if(e&4194048){var n=l.lanes;n&=t.pendingLanes,e|=n,l.lanes=e,yu(t,e)}}var Lu={readContext:xl,use:wu,useCallback:el,useContext:el,useEffect:el,useImperativeHandle:el,useLayoutEffect:el,useInsertionEffect:el,useMemo:el,useReducer:el,useRef:el,useState:el,useDebugValue:el,useDeferredValue:el,useTransition:el,useSyncExternalStore:el,useId:el,useHostTransitionStatus:el,useFormState:el,useActionState:el,useOptimistic:el,useMemoCache:el,useCacheRefresh:el},Os={readContext:xl,use:wu,useCallback:function(t,l){return Bl().memoizedState=[t,l===void 0?null:l],t},useContext:xl,useEffect:os,useImperativeHandle:function(t,l,e){e=e!=null?e.concat([t]):null,Vu(4194308,4,hs.bind(null,l,t),e)},useLayoutEffect:function(t,l){return Vu(4194308,4,t,l)},useInsertionEffect:function(t,l){Vu(4,2,t,l)},useMemo:function(t,l){var e=Bl();l=l===void 0?null:l;var n=t();if(rn){Tt(!0);try{t()}finally{Tt(!1)}}return e.memoizedState=[n,l],n},useReducer:function(t,l,e){var n=Bl();if(e!==void 0){var a=e(l);if(rn){Tt(!0);try{e(l)}finally{Tt(!1)}}}else a=l;return n.memoizedState=n.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},n.queue=t,t=t.dispatch=dm.bind(null,_t,t),[n.memoizedState,t]},useRef:function(t){var l=Bl();return t={current:t},l.memoizedState=t},useState:function(t){t=wc(t);var l=t.queue,e=As.bind(null,_t,l);return l.dispatch=e,[t.memoizedState,e]},useDebugValue:Qc,useDeferredValue:function(t,l){var e=Bl();return Vc(e,t,l)},useTransition:function(){var t=wc(!1);return t=gs.bind(null,_t,t.queue,!0,!1),Bl().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,l,e){var n=_t,a=Bl();if(qt){if(e===void 0)throw Error(f(407));e=e()}else{if(e=l(),Vt===null)throw Error(f(349));Bt&124||kr(n,l,e)}a.memoizedState=e;var u={value:e,getSnapshot:l};return a.queue=u,os(Pr.bind(null,n,u,t),[t]),n.flags|=2048,Vn(9,Qu(),Jr.bind(null,n,u,e,l),null),e},useId:function(){var t=Bl(),l=Vt.identifierPrefix;if(qt){var e=pe,n=ve;e=(n&~(1<<32-At(n)-1)).toString(32)+e,l="\xAB"+l+"R"+e,e=Xu++,0<e&&(l+="H"+e.toString(32)),l+="\xBB"}else e=im++,l="\xAB"+l+"r"+e.toString(32)+"\xBB";return t.memoizedState=l},useHostTransitionStatus:Lc,useFormState:as,useActionState:as,useOptimistic:function(t){var l=Bl();l.memoizedState=l.baseState=t;var e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=e,l=Kc.bind(null,_t,!0,e),e.dispatch=l,[t,l]},useMemoCache:Yc,useCacheRefresh:function(){return Bl().memoizedState=sm.bind(null,_t)}},_s={readContext:xl,use:wu,useCallback:ms,useContext:xl,useEffect:rs,useImperativeHandle:ys,useInsertionEffect:ss,useLayoutEffect:ds,useMemo:vs,useReducer:ju,useRef:fs,useState:function(){return ju(Se)},useDebugValue:Qc,useDeferredValue:function(t,l){var e=il();return ps(e,Xt.memoizedState,t,l)},useTransition:function(){var t=ju(Se)[0],l=il().memoizedState;return[typeof t=="boolean"?t:qa(t),l]},useSyncExternalStore:Kr,useId:xs,useHostTransitionStatus:Lc,useFormState:us,useActionState:us,useOptimistic:function(t,l){var e=il();return Wr(e,Xt,t,l)},useMemoCache:Yc,useCacheRefresh:Ms},hm={readContext:xl,use:wu,useCallback:ms,useContext:xl,useEffect:rs,useImperativeHandle:ys,useInsertionEffect:ss,useLayoutEffect:ds,useMemo:vs,useReducer:Xc,useRef:fs,useState:function(){return Xc(Se)},useDebugValue:Qc,useDeferredValue:function(t,l){var e=il();return Xt===null?Vc(e,t,l):ps(e,Xt.memoizedState,t,l)},useTransition:function(){var t=Xc(Se)[0],l=il().memoizedState;return[typeof t=="boolean"?t:qa(t),l]},useSyncExternalStore:Kr,useId:xs,useHostTransitionStatus:Lc,useFormState:cs,useActionState:cs,useOptimistic:function(t,l){var e=il();return Xt!==null?Wr(e,Xt,t,l):(e.baseState=t,[t,e.queue.dispatch])},useMemoCache:Yc,useCacheRefresh:Ms},Zn=null,Ga=0;function Ku(t){var l=Ga;return Ga+=1,Zn===null&&(Zn=[]),Gr(Zn,t,l)}function Xa(t,l){l=l.props.ref,t.ref=l!==void 0?l:null}function ku(t,l){throw l.$$typeof===E?Error(f(525)):(t=Object.prototype.toString.call(l),Error(f(31,t==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":t)))}function zs(t){var l=t._init;return l(t._payload)}function Ds(t){function l(M,x){if(t){var A=M.deletions;A===null?(M.deletions=[x],M.flags|=16):A.push(x)}}function e(M,x){if(!t)return null;for(;x!==null;)l(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=me(M,x),M.index=0,M.sibling=null,M}function u(M,x,A){return M.index=A,t?(A=M.alternate,A!==null?(A=A.index,A<x?(M.flags|=67108866,x):A):(M.flags|=67108866,x)):(M.flags|=1048576,x)}function o(M){return t&&M.alternate===null&&(M.flags|=67108866),M}function s(M,x,A,B){return x===null||x.tag!==6?(x=hc(A,M.mode,B),x.return=M,x):(x=a(x,A),x.return=M,x)}function p(M,x,A,B){var F=A.type;return F===j?U(M,x,A.props.children,B,A.key):x!==null&&(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===et&&zs(F)===x.type)?(x=a(x,A.props),Xa(x,A),x.return=M,x):(x=Du(A.type,A.key,A.props,null,M.mode,B),Xa(x,A),x.return=M,x)}function T(M,x,A,B){return x===null||x.tag!==4||x.stateNode.containerInfo!==A.containerInfo||x.stateNode.implementation!==A.implementation?(x=yc(A,M.mode,B),x.return=M,x):(x=a(x,A.children||[]),x.return=M,x)}function U(M,x,A,B,F){return x===null||x.tag!==7?(x=ln(A,M.mode,B,F),x.return=M,x):(x=a(x,A),x.return=M,x)}function H(M,x,A){if(typeof x=="string"&&x!==""||typeof x=="number"||typeof x=="bigint")return x=hc(""+x,M.mode,A),x.return=M,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case R:return A=Du(x.type,x.key,x.props,null,M.mode,A),Xa(A,x),A.return=M,A;case X:return x=yc(x,M.mode,A),x.return=M,x;case et:var B=x._init;return x=B(x._payload),H(M,x,A)}if(ht(x)||L(x))return x=ln(x,M.mode,A,null),x.return=M,x;if(typeof x.then=="function")return H(M,Ku(x),A);if(x.$$typeof===Q)return H(M,Nu(M,x),A);ku(M,x)}return null}function O(M,x,A,B){var F=x!==null?x.key:null;if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return F!==null?null:s(M,x,""+A,B);if(typeof A=="object"&&A!==null){switch(A.$$typeof){case R:return A.key===F?p(M,x,A,B):null;case X:return A.key===F?T(M,x,A,B):null;case et:return F=A._init,A=F(A._payload),O(M,x,A,B)}if(ht(A)||L(A))return F!==null?null:U(M,x,A,B,null);if(typeof A.then=="function")return O(M,x,Ku(A),B);if(A.$$typeof===Q)return O(M,x,Nu(M,A),B);ku(M,A)}return null}function _(M,x,A,B,F){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return M=M.get(A)||null,s(x,M,""+B,F);if(typeof B=="object"&&B!==null){switch(B.$$typeof){case R:return M=M.get(B.key===null?A:B.key)||null,p(x,M,B,F);case X:return M=M.get(B.key===null?A:B.key)||null,T(x,M,B,F);case et:var zt=B._init;return B=zt(B._payload),_(M,x,A,B,F)}if(ht(B)||L(B))return M=M.get(A)||null,U(x,M,B,F,null);if(typeof B.then=="function")return _(M,x,A,Ku(B),F);if(B.$$typeof===Q)return _(M,x,A,Nu(x,B),F);ku(x,B)}return null}function St(M,x,A,B){for(var F=null,zt=null,at=x,pt=x=0,yl=null;at!==null&&pt<A.length;pt++){at.index>pt?(yl=at,at=null):yl=at.sibling;var Ht=O(M,at,A[pt],B);if(Ht===null){at===null&&(at=yl);break}t&&at&&Ht.alternate===null&&l(M,at),x=u(Ht,x,pt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht,at=yl}if(pt===A.length)return e(M,at),qt&&nn(M,pt),F;if(at===null){for(;pt<A.length;pt++)at=H(M,A[pt],B),at!==null&&(x=u(at,x,pt),zt===null?F=at:zt.sibling=at,zt=at);return qt&&nn(M,pt),F}for(at=n(at);pt<A.length;pt++)yl=_(at,M,pt,A[pt],B),yl!==null&&(t&&yl.alternate!==null&&at.delete(yl.key===null?pt:yl.key),x=u(yl,x,pt),zt===null?F=yl:zt.sibling=yl,zt=yl);return t&&at.forEach(function($e){return l(M,$e)}),qt&&nn(M,pt),F}function vt(M,x,A,B){if(A==null)throw Error(f(151));for(var F=null,zt=null,at=x,pt=x=0,yl=null,Ht=A.next();at!==null&&!Ht.done;pt++,Ht=A.next()){at.index>pt?(yl=at,at=null):yl=at.sibling;var $e=O(M,at,Ht.value,B);if($e===null){at===null&&(at=yl);break}t&&at&&$e.alternate===null&&l(M,at),x=u($e,x,pt),zt===null?F=$e:zt.sibling=$e,zt=$e,at=yl}if(Ht.done)return e(M,at),qt&&nn(M,pt),F;if(at===null){for(;!Ht.done;pt++,Ht=A.next())Ht=H(M,Ht.value,B),Ht!==null&&(x=u(Ht,x,pt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht);return qt&&nn(M,pt),F}for(at=n(at);!Ht.done;pt++,Ht=A.next())Ht=_(at,M,pt,Ht.value,B),Ht!==null&&(t&&Ht.alternate!==null&&at.delete(Ht.key===null?pt:Ht.key),x=u(Ht,x,pt),zt===null?F=Ht:zt.sibling=Ht,zt=Ht);return t&&at.forEach(function(yv){return l(M,yv)}),qt&&nn(M,pt),F}function jt(M,x,A,B){if(typeof A=="object"&&A!==null&&A.type===j&&A.key===null&&(A=A.props.children),typeof A=="object"&&A!==null){switch(A.$$typeof){case R:t:{for(var F=A.key;x!==null;){if(x.key===F){if(F=A.type,F===j){if(x.tag===7){e(M,x.sibling),B=a(x,A.props.children),B.return=M,M=B;break t}}else if(x.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===et&&zs(F)===x.type){e(M,x.sibling),B=a(x,A.props),Xa(B,A),B.return=M,M=B;break t}e(M,x);break}else l(M,x);x=x.sibling}A.type===j?(B=ln(A.props.children,M.mode,B,A.key),B.return=M,M=B):(B=Du(A.type,A.key,A.props,null,M.mode,B),Xa(B,A),B.return=M,M=B)}return o(M);case X:t:{for(F=A.key;x!==null;){if(x.key===F)if(x.tag===4&&x.stateNode.containerInfo===A.containerInfo&&x.stateNode.implementation===A.implementation){e(M,x.sibling),B=a(x,A.children||[]),B.return=M,M=B;break t}else{e(M,x);break}else l(M,x);x=x.sibling}B=yc(A,M.mode,B),B.return=M,M=B}return o(M);case et:return F=A._init,A=F(A._payload),jt(M,x,A,B)}if(ht(A))return St(M,x,A,B);if(L(A)){if(F=L(A),typeof F!="function")throw Error(f(150));return A=F.call(A),vt(M,x,A,B)}if(typeof A.then=="function")return jt(M,x,Ku(A),B);if(A.$$typeof===Q)return jt(M,x,Nu(M,A),B);ku(M,A)}return typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint"?(A=""+A,x!==null&&x.tag===6?(e(M,x.sibling),B=a(x,A),B.return=M,M=B):(e(M,x),B=hc(A,M.mode,B),B.return=M,M=B),o(M)):e(M,x)}return function(M,x,A,B){try{Ga=0;var F=jt(M,x,A,B);return Zn=null,F}catch(at){if(at===Da||at===qu)throw at;var zt=Yl(29,at,null,M.mode);return zt.lanes=B,zt.return=M,zt}finally{}}}var Ln=Ds(!0),Rs=Ds(!1),$l=z(null),fe=null;function qe(t){var l=t.alternate;C(ol,ol.current&1),C($l,t),fe===null&&(l===null||wn.current!==null||l.memoizedState!==null)&&(fe=t)}function Us(t){if(t.tag===22){if(C(ol,ol.current),C($l,t),fe===null){var l=t.alternate;l!==null&&l.memoizedState!==null&&(fe=t)}}else Ce()}function Ce(){C(ol,ol.current),C($l,$l.current)}function xe(t){q($l),fe===t&&(fe=null),q(ol)}var ol=z(0);function Ju(t){for(var l=t;l!==null;){if(l.tag===13){var e=l.memoizedState;if(e!==null&&(e=e.dehydrated,e===null||e.data==="$?"||Yf(e)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if(l.flags&128)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break;for(;l.sibling===null;){if(l.return===null||l.return===t)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function kc(t,l,e,n){l=t.memoizedState,e=e(n,l),e=e==null?l:g({},l,e),t.memoizedState=e,t.lanes===0&&(t.updateQueue.baseState=e)}var Jc={enqueueSetState:function(t,l,e){t=t._reactInternals;var n=jl(),a=Be(n);a.payload=l,e!=null&&(a.callback=e),l=Ne(t,a,n),l!==null&&(Ql(l,t,n),Ua(l,t,n))},enqueueReplaceState:function(t,l,e){t=t._reactInternals;var n=jl(),a=Be(n);a.tag=1,a.payload=l,e!=null&&(a.callback=e),l=Ne(t,a,n),l!==null&&(Ql(l,t,n),Ua(l,t,n))},enqueueForceUpdate:function(t,l){t=t._reactInternals;var e=jl(),n=Be(e);n.tag=2,l!=null&&(n.callback=l),l=Ne(t,n,e),l!==null&&(Ql(l,t,e),Ua(l,t,e))}};function Bs(t,l,e,n,a,u,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(n,u,o):l.prototype&&l.prototype.isPureReactComponent?!xa(e,n)||!xa(a,u):!0}function Ns(t,l,e,n){t=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(e,n),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(e,n),l.state!==t&&Jc.enqueueReplaceState(l,l.state,null)}function sn(t,l){var e=l;if("ref"in l){e={};for(var n in l)n!=="ref"&&(e[n]=l[n])}if(t=t.defaultProps){e===l&&(e=g({},e));for(var a in t)e[a]===void 0&&(e[a]=t[a])}return e}var Pu=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=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(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function Hs(t){Pu(t)}function qs(t){console.error(t)}function Cs(t){Pu(t)}function $u(t,l){try{var e=t.onUncaughtError;e(l.value,{componentStack:l.stack})}catch(n){setTimeout(function(){throw n})}}function Ys(t,l,e){try{var n=t.onCaughtError;n(e.value,{componentStack:e.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Pc(t,l,e){return e=Be(e),e.tag=3,e.payload={element:null},e.callback=function(){$u(t,l)},e}function Gs(t){return t=Be(t),t.tag=3,t}function Xs(t,l,e,n){var a=e.type.getDerivedStateFromError;if(typeof a=="function"){var u=n.value;t.payload=function(){return a(u)},t.callback=function(){Ys(l,e,n)}}var o=e.stateNode;o!==null&&typeof o.componentDidCatch=="function"&&(t.callback=function(){Ys(l,e,n),typeof a!="function"&&(Qe===null?Qe=new Set([this]):Qe.add(this));var s=n.stack;this.componentDidCatch(n.value,{componentStack:s!==null?s:""})})}function ym(t,l,e,n,a){if(e.flags|=32768,n!==null&&typeof n=="object"&&typeof n.then=="function"){if(l=e.alternate,l!==null&&Oa(l,e,a,!0),e=$l.current,e!==null){switch(e.tag){case 13:return fe===null?Sf():e.alternate===null&&tl===0&&(tl=3),e.flags&=-257,e.flags|=65536,e.lanes=a,n===Tc?e.flags|=16384:(l=e.updateQueue,l===null?e.updateQueue=new Set([n]):l.add(n),Mf(t,n,a)),!1;case 22:return e.flags|=65536,n===Tc?e.flags|=16384:(l=e.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([n])},e.updateQueue=l):(e=l.retryQueue,e===null?l.retryQueue=new Set([n]):e.add(n)),Mf(t,n,a)),!1}throw Error(f(435,e.tag))}return Mf(t,n,a),Sf(),!1}if(qt)return l=$l.current,l!==null?(!(l.flags&65536)&&(l.flags|=256),l.flags|=65536,l.lanes=a,n!==pc&&(t=Error(f(422),{cause:n}),Ea(Kl(t,e)))):(n!==pc&&(l=Error(f(423),{cause:n}),Ea(Kl(l,e))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,n=Kl(n,e),a=Pc(t.stateNode,n,a),_c(t,a),tl!==4&&(tl=2)),!1;var u=Error(f(520),{cause:n});if(u=Kl(u,e),Ka===null?Ka=[u]:Ka.push(u),tl!==4&&(tl=2),l===null)return!0;n=Kl(n,e),e=l;do{switch(e.tag){case 3:return e.flags|=65536,t=a&-a,e.lanes|=t,t=Pc(e.stateNode,n,t),_c(e,t),!1;case 1:if(l=e.type,u=e.stateNode,(e.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Qe===null||!Qe.has(u))))return e.flags|=65536,a&=-a,e.lanes|=a,a=Gs(a),Xs(a,t,e,n),_c(e,a),!1}e=e.return}while(e!==null);return!1}var ws=Error(f(461)),dl=!1;function vl(t,l,e,n){l.child=t===null?Rs(l,null,e,n):Ln(l,t.child,e,n)}function js(t,l,e,n,a){e=e.render;var u=l.ref;if("ref"in n){var o={};for(var s in n)s!=="ref"&&(o[s]=n[s])}else o=n;return fn(l),n=Bc(t,l,e,o,u,a),s=Nc(),t!==null&&!dl?(Hc(t,l,a),Me(t,l,a)):(qt&&s&&mc(l),l.flags|=1,vl(t,l,n,a),l.child)}function Qs(t,l,e,n,a){if(t===null){var u=e.type;return typeof u=="function"&&!dc(u)&&u.defaultProps===void 0&&e.compare===null?(l.tag=15,l.type=u,Vs(t,l,u,n,a)):(t=Du(e.type,null,n,l,l.mode,a),t.ref=l.ref,t.return=l,l.child=t)}if(u=t.child,!nf(t,a)){var o=u.memoizedProps;if(e=e.compare,e=e!==null?e:xa,e(o,n)&&t.ref===l.ref)return Me(t,l,a)}return l.flags|=1,t=me(u,n),t.ref=l.ref,t.return=l,l.child=t}function Vs(t,l,e,n,a){if(t!==null){var u=t.memoizedProps;if(xa(u,n)&&t.ref===l.ref)if(dl=!1,l.pendingProps=n=u,nf(t,a))t.flags&131072&&(dl=!0);else return l.lanes=t.lanes,Me(t,l,a)}return $c(t,l,e,n,a)}function Zs(t,l,e){var n=l.pendingProps,a=n.children,u=t!==null?t.memoizedState:null;if(n.mode==="hidden"){if(l.flags&128){if(n=u!==null?u.baseLanes|e:e,t!==null){for(a=l.child=t.child,u=0;a!==null;)u=u|a.lanes|a.childLanes,a=a.sibling;l.childLanes=u&~n}else l.childLanes=0,l.child=null;return Ls(t,l,n,e)}if(e&536870912)l.memoizedState={baseLanes:0,cachePool:null},t!==null&&Hu(l,u!==null?u.cachePool:null),u!==null?Vr(l,u):Dc(),Us(l);else return l.lanes=l.childLanes=536870912,Ls(t,l,u!==null?u.baseLanes|e:e,e)}else u!==null?(Hu(l,u.cachePool),Vr(l,u),Ce(),l.memoizedState=null):(t!==null&&Hu(l,null),Dc(),Ce());return vl(t,l,a,e),l.child}function Ls(t,l,e,n){var a=Ac();return a=a===null?null:{parent:fl._currentValue,pool:a},l.memoizedState={baseLanes:e,cachePool:a},t!==null&&Hu(l,null),Dc(),Us(l),t!==null&&Oa(t,l,n,!0),null}function Iu(t,l){var e=l.ref;if(e===null)t!==null&&t.ref!==null&&(l.flags|=4194816);else{if(typeof e!="function"&&typeof e!="object")throw Error(f(284));(t===null||t.ref!==e)&&(l.flags|=4194816)}}function $c(t,l,e,n,a){return fn(l),e=Bc(t,l,e,n,void 0,a),n=Nc(),t!==null&&!dl?(Hc(t,l,a),Me(t,l,a)):(qt&&n&&mc(l),l.flags|=1,vl(t,l,e,a),l.child)}function Ks(t,l,e,n,a,u){return fn(l),l.updateQueue=null,e=Lr(l,n,e,a),Zr(t),n=Nc(),t!==null&&!dl?(Hc(t,l,u),Me(t,l,u)):(qt&&n&&mc(l),l.flags|=1,vl(t,l,e,u),l.child)}function ks(t,l,e,n,a){if(fn(l),l.stateNode===null){var u=qn,o=e.contextType;typeof o=="object"&&o!==null&&(u=xl(o)),u=new e(n,u),l.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Jc,l.stateNode=u,u._reactInternals=l,u=l.stateNode,u.props=n,u.state=l.memoizedState,u.refs={},Ec(l),o=e.contextType,u.context=typeof o=="object"&&o!==null?xl(o):qn,u.state=l.memoizedState,o=e.getDerivedStateFromProps,typeof o=="function"&&(kc(l,e,o,n),u.state=l.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(o=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),o!==u.state&&Jc.enqueueReplaceState(u,u.state,null),Na(l,n,u,a),Ba(),u.state=l.memoizedState),typeof u.componentDidMount=="function"&&(l.flags|=4194308),n=!0}else if(t===null){u=l.stateNode;var s=l.memoizedProps,p=sn(e,s);u.props=p;var T=u.context,U=e.contextType;o=qn,typeof U=="object"&&U!==null&&(o=xl(U));var H=e.getDerivedStateFromProps;U=typeof H=="function"||typeof u.getSnapshotBeforeUpdate=="function",s=l.pendingProps!==s,U||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(s||T!==o)&&Ns(l,u,n,o),Ue=!1;var O=l.memoizedState;u.state=O,Na(l,n,u,a),Ba(),T=l.memoizedState,s||O!==T||Ue?(typeof H=="function"&&(kc(l,e,H,n),T=l.memoizedState),(p=Ue||Bs(l,e,p,n,O,T,o))?(U||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(l.flags|=4194308)):(typeof u.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=n,l.memoizedState=T),u.props=n,u.state=T,u.context=o,n=p):(typeof u.componentDidMount=="function"&&(l.flags|=4194308),n=!1)}else{u=l.stateNode,Oc(t,l),o=l.memoizedProps,U=sn(e,o),u.props=U,H=l.pendingProps,O=u.context,T=e.contextType,p=qn,typeof T=="object"&&T!==null&&(p=xl(T)),s=e.getDerivedStateFromProps,(T=typeof s=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(o!==H||O!==p)&&Ns(l,u,n,p),Ue=!1,O=l.memoizedState,u.state=O,Na(l,n,u,a),Ba();var _=l.memoizedState;o!==H||O!==_||Ue||t!==null&&t.dependencies!==null&&Bu(t.dependencies)?(typeof s=="function"&&(kc(l,e,s,n),_=l.memoizedState),(U=Ue||Bs(l,e,U,n,O,_,p)||t!==null&&t.dependencies!==null&&Bu(t.dependencies))?(T||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(n,_,p),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(n,_,p)),typeof u.componentDidUpdate=="function"&&(l.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof u.componentDidUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(l.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(l.flags|=1024),l.memoizedProps=n,l.memoizedState=_),u.props=n,u.state=_,u.context=p,n=U):(typeof u.componentDidUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(l.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&O===t.memoizedState||(l.flags|=1024),n=!1)}return u=n,Iu(t,l),n=(l.flags&128)!==0,u||n?(u=l.stateNode,e=n&&typeof e.getDerivedStateFromError!="function"?null:u.render(),l.flags|=1,t!==null&&n?(l.child=Ln(l,t.child,null,a),l.child=Ln(l,null,e,a)):vl(t,l,e,a),l.memoizedState=u.state,t=l.child):t=Me(t,l,a),t}function Js(t,l,e,n){return Ta(),l.flags|=256,vl(t,l,e,n),l.child}var Ic={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wc(t){return{baseLanes:t,cachePool:qr()}}function Fc(t,l,e){return t=t!==null?t.childLanes&~e:0,l&&(t|=Il),t}function Ps(t,l,e){var n=l.pendingProps,a=!1,u=(l.flags&128)!==0,o;if((o=u)||(o=t!==null&&t.memoizedState===null?!1:(ol.current&2)!==0),o&&(a=!0,l.flags&=-129),o=(l.flags&32)!==0,l.flags&=-33,t===null){if(qt){if(a?qe(l):Ce(),qt){var s=Ft,p;if(p=s){t:{for(p=s,s=ce;p.nodeType!==8;){if(!s){s=null;break t}if(p=le(p.nextSibling),p===null){s=null;break t}}s=p}s!==null?(l.memoizedState={dehydrated:s,treeContext:en!==null?{id:ve,overflow:pe}:null,retryLane:536870912,hydrationErrors:null},p=Yl(18,null,null,0),p.stateNode=s,p.return=l,l.child=p,Ol=l,Ft=null,p=!0):p=!1}p||un(l)}if(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null))return Yf(s)?l.lanes=32:l.lanes=536870912,null;xe(l)}return s=n.children,n=n.fallback,a?(Ce(),a=l.mode,s=Wu({mode:"hidden",children:s},a),n=ln(n,a,e,null),s.return=l,n.return=l,s.sibling=n,l.child=s,a=l.child,a.memoizedState=Wc(e),a.childLanes=Fc(t,o,e),l.memoizedState=Ic,n):(qe(l),tf(l,s))}if(p=t.memoizedState,p!==null&&(s=p.dehydrated,s!==null)){if(u)l.flags&256?(qe(l),l.flags&=-257,l=lf(t,l,e)):l.memoizedState!==null?(Ce(),l.child=t.child,l.flags|=128,l=null):(Ce(),a=n.fallback,s=l.mode,n=Wu({mode:"visible",children:n.children},s),a=ln(a,s,e,null),a.flags|=2,n.return=l,a.return=l,n.sibling=a,l.child=n,Ln(l,t.child,null,e),n=l.child,n.memoizedState=Wc(e),n.childLanes=Fc(t,o,e),l.memoizedState=Ic,l=a);else if(qe(l),Yf(s)){if(o=s.nextSibling&&s.nextSibling.dataset,o)var T=o.dgst;o=T,n=Error(f(419)),n.stack="",n.digest=o,Ea({value:n,source:null,stack:null}),l=lf(t,l,e)}else if(dl||Oa(t,l,e,!1),o=(e&t.childLanes)!==0,dl||o){if(o=Vt,o!==null&&(n=e&-e,n=n&42?1:sa(n),n=n&(o.suspendedLanes|e)?0:n,n!==0&&n!==p.retryLane))throw p.retryLane=n,Hn(t,n),Ql(o,t,n),ws;s.data==="$?"||Sf(),l=lf(t,l,e)}else s.data==="$?"?(l.flags|=192,l.child=t.child,l=null):(t=p.treeContext,Ft=le(s.nextSibling),Ol=l,qt=!0,an=null,ce=!1,t!==null&&(Jl[Pl++]=ve,Jl[Pl++]=pe,Jl[Pl++]=en,ve=t.id,pe=t.overflow,en=l),l=tf(l,n.children),l.flags|=4096);return l}return a?(Ce(),a=n.fallback,s=l.mode,p=t.child,T=p.sibling,n=me(p,{mode:"hidden",children:n.children}),n.subtreeFlags=p.subtreeFlags&65011712,T!==null?a=me(T,a):(a=ln(a,s,e,null),a.flags|=2),a.return=l,n.return=l,n.sibling=a,l.child=n,n=a,a=l.child,s=t.child.memoizedState,s===null?s=Wc(e):(p=s.cachePool,p!==null?(T=fl._currentValue,p=p.parent!==T?{parent:T,pool:T}:p):p=qr(),s={baseLanes:s.baseLanes|e,cachePool:p}),a.memoizedState=s,a.childLanes=Fc(t,o,e),l.memoizedState=Ic,n):(qe(l),e=t.child,t=e.sibling,e=me(e,{mode:"visible",children:n.children}),e.return=l,e.sibling=null,t!==null&&(o=l.deletions,o===null?(l.deletions=[t],l.flags|=16):o.push(t)),l.child=e,l.memoizedState=null,e)}function tf(t,l){return l=Wu({mode:"visible",children:l},t.mode),l.return=t,t.child=l}function Wu(t,l){return t=Yl(22,t,null,l),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function lf(t,l,e){return Ln(l,t.child,null,e),t=tf(l,l.pendingProps.children),t.flags|=2,l.memoizedState=null,t}function $s(t,l,e){t.lanes|=l;var n=t.alternate;n!==null&&(n.lanes|=l),bc(t.return,l,e)}function ef(t,l,e,n,a){var u=t.memoizedState;u===null?t.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:n,tail:e,tailMode:a}:(u.isBackwards=l,u.rendering=null,u.renderingStartTime=0,u.last=n,u.tail=e,u.tailMode=a)}function Is(t,l,e){var n=l.pendingProps,a=n.revealOrder,u=n.tail;if(vl(t,l,n.children,e),n=ol.current,n&2)n=n&1|2,l.flags|=128;else{if(t!==null&&t.flags&128)t:for(t=l.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&$s(t,e,l);else if(t.tag===19)$s(t,e,l);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===l)break t;for(;t.sibling===null;){if(t.return===null||t.return===l)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}switch(C(ol,n),a){case"forwards":for(e=l.child,a=null;e!==null;)t=e.alternate,t!==null&&Ju(t)===null&&(a=e),e=e.sibling;e=a,e===null?(a=l.child,l.child=null):(a=e.sibling,e.sibling=null),ef(l,!1,a,e,u);break;case"backwards":for(e=null,a=l.child,l.child=null;a!==null;){if(t=a.alternate,t!==null&&Ju(t)===null){l.child=a;break}t=a.sibling,a.sibling=e,e=a,a=t}ef(l,!0,e,null,u);break;case"together":ef(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Me(t,l,e){if(t!==null&&(l.dependencies=t.dependencies),je|=l.lanes,!(e&l.childLanes))if(t!==null){if(Oa(t,l,e,!1),(e&l.childLanes)===0)return null}else return null;if(t!==null&&l.child!==t.child)throw Error(f(153));if(l.child!==null){for(t=l.child,e=me(t,t.pendingProps),l.child=e,e.return=l;t.sibling!==null;)t=t.sibling,e=e.sibling=me(t,t.pendingProps),e.return=l;e.sibling=null}return l.child}function nf(t,l){return t.lanes&l?!0:(t=t.dependencies,!!(t!==null&&Bu(t)))}function mm(t,l,e){switch(l.tag){case 3:W(l,l.stateNode.containerInfo),Re(l,fl,t.memoizedState.cache),Ta();break;case 27:case 5:st(l);break;case 4:W(l,l.stateNode.containerInfo);break;case 10:Re(l,l.type,l.memoizedProps.value);break;case 13:var n=l.memoizedState;if(n!==null)return n.dehydrated!==null?(qe(l),l.flags|=128,null):e&l.child.childLanes?Ps(t,l,e):(qe(l),t=Me(t,l,e),t!==null?t.sibling:null);qe(l);break;case 19:var a=(t.flags&128)!==0;if(n=(e&l.childLanes)!==0,n||(Oa(t,l,e,!1),n=(e&l.childLanes)!==0),a){if(n)return Is(t,l,e);l.flags|=128}if(a=l.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),C(ol,ol.current),n)break;return null;case 22:case 23:return l.lanes=0,Zs(t,l,e);case 24:Re(l,fl,t.memoizedState.cache)}return Me(t,l,e)}function Ws(t,l,e){if(t!==null)if(t.memoizedProps!==l.pendingProps)dl=!0;else{if(!nf(t,e)&&!(l.flags&128))return dl=!1,mm(t,l,e);dl=!!(t.flags&131072)}else dl=!1,qt&&l.flags&1048576&&zr(l,Uu,l.index);switch(l.lanes=0,l.tag){case 16:t:{t=l.pendingProps;var n=l.elementType,a=n._init;if(n=a(n._payload),l.type=n,typeof n=="function")dc(n)?(t=sn(n,t),l.tag=1,l=ks(null,l,n,t,e)):(l.tag=0,l=$c(null,l,n,t,e));else{if(n!=null){if(a=n.$$typeof,a===ut){l.tag=11,l=js(null,l,n,t,e);break t}else if(a===I){l.tag=14,l=Qs(null,l,n,t,e);break t}}throw l=dt(n)||n,Error(f(306,l,""))}}return l;case 0:return $c(t,l,l.type,l.pendingProps,e);case 1:return n=l.type,a=sn(n,l.pendingProps),ks(t,l,n,a,e);case 3:t:{if(W(l,l.stateNode.containerInfo),t===null)throw Error(f(387));n=l.pendingProps;var u=l.memoizedState;a=u.element,Oc(t,l),Na(l,n,null,e);var o=l.memoizedState;if(n=o.cache,Re(l,fl,n),n!==u.cache&&Sc(l,[fl],e,!0),Ba(),n=o.element,u.isDehydrated)if(u={element:n,isDehydrated:!1,cache:o.cache},l.updateQueue.baseState=u,l.memoizedState=u,l.flags&256){l=Js(t,l,n,e);break t}else if(n!==a){a=Kl(Error(f(424)),l),Ea(a),l=Js(t,l,n,e);break t}else{switch(t=l.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ft=le(t.firstChild),Ol=l,qt=!0,an=null,ce=!0,e=Rs(l,null,n,e),l.child=e;e;)e.flags=e.flags&-3|4096,e=e.sibling}else{if(Ta(),n===a){l=Me(t,l,e);break t}vl(t,l,n,e)}l=l.child}return l;case 26:return Iu(t,l),t===null?(e=eh(l.type,null,l.pendingProps,null))?l.memoizedState=e:qt||(e=l.type,t=l.pendingProps,n=di(N.current).createElement(e),n[Sl]=l,n[Rl]=t,gl(n,e,t),sl(n),l.stateNode=n):l.memoizedState=eh(l.type,t.memoizedProps,l.pendingProps,t.memoizedState),null;case 27:return st(l),t===null&&qt&&(n=l.stateNode=Fd(l.type,l.pendingProps,N.current),Ol=l,ce=!0,a=Ft,Le(l.type)?(Gf=a,Ft=le(n.firstChild)):Ft=a),vl(t,l,l.pendingProps.children,e),Iu(t,l),t===null&&(l.flags|=4194304),l.child;case 5:return t===null&&qt&&((a=n=Ft)&&(n=Vm(n,l.type,l.pendingProps,ce),n!==null?(l.stateNode=n,Ol=l,Ft=le(n.firstChild),ce=!1,a=!0):a=!1),a||un(l)),st(l),a=l.type,u=l.pendingProps,o=t!==null?t.memoizedProps:null,n=u.children,Hf(a,u)?n=null:o!==null&&Hf(a,o)&&(l.flags|=32),l.memoizedState!==null&&(a=Bc(t,l,cm,null,null,e),lu._currentValue=a),Iu(t,l),vl(t,l,n,e),l.child;case 6:return t===null&&qt&&((t=e=Ft)&&(e=Zm(e,l.pendingProps,ce),e!==null?(l.stateNode=e,Ol=l,Ft=null,t=!0):t=!1),t||un(l)),null;case 13:return Ps(t,l,e);case 4:return W(l,l.stateNode.containerInfo),n=l.pendingProps,t===null?l.child=Ln(l,null,n,e):vl(t,l,n,e),l.child;case 11:return js(t,l,l.type,l.pendingProps,e);case 7:return vl(t,l,l.pendingProps,e),l.child;case 8:return vl(t,l,l.pendingProps.children,e),l.child;case 12:return vl(t,l,l.pendingProps.children,e),l.child;case 10:return n=l.pendingProps,Re(l,l.type,n.value),vl(t,l,n.children,e),l.child;case 9:return a=l.type._context,n=l.pendingProps.children,fn(l),a=xl(a),n=n(a),l.flags|=1,vl(t,l,n,e),l.child;case 14:return Qs(t,l,l.type,l.pendingProps,e);case 15:return Vs(t,l,l.type,l.pendingProps,e);case 19:return Is(t,l,e);case 31:return n=l.pendingProps,e=l.mode,n={mode:n.mode,children:n.children},t===null?(e=Wu(n,e),e.ref=l.ref,l.child=e,e.return=l,l=e):(e=me(t.child,n),e.ref=l.ref,l.child=e,e.return=l,l=e),l;case 22:return Zs(t,l,e);case 24:return fn(l),n=xl(fl),t===null?(a=Ac(),a===null&&(a=Vt,u=xc(),a.pooledCache=u,u.refCount++,u!==null&&(a.pooledCacheLanes|=e),a=u),l.memoizedState={parent:n,cache:a},Ec(l),Re(l,fl,a)):(t.lanes&e&&(Oc(t,l),Na(l,null,null,e),Ba()),a=t.memoizedState,u=l.memoizedState,a.parent!==n?(a={parent:n,cache:n},l.memoizedState=a,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=a),Re(l,fl,n)):(n=u.cache,Re(l,fl,n),n!==a.cache&&Sc(l,[fl],e,!0))),vl(t,l,l.pendingProps.children,e),l.child;case 29:throw l.pendingProps}throw Error(f(156,l.tag))}function Ae(t){t.flags|=4}function Fs(t,l){if(l.type!=="stylesheet"||l.state.loading&4)t.flags&=-16777217;else if(t.flags|=16777216,!ch(l)){if(l=$l.current,l!==null&&((Bt&4194048)===Bt?fe!==null:(Bt&62914560)!==Bt&&!(Bt&536870912)||l!==fe))throw Ra=Tc,Cr;t.flags|=8192}}function Fu(t,l){l!==null&&(t.flags|=4),t.flags&16384&&(l=t.tag!==22?ae():536870912,t.lanes|=l,Pn|=l)}function wa(t,l){if(!qt)switch(t.tailMode){case"hidden":l=t.tail;for(var e=null;l!==null;)l.alternate!==null&&(e=l),l=l.sibling;e===null?t.tail=null:e.sibling=null;break;case"collapsed":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?l||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function $t(t){var l=t.alternate!==null&&t.alternate.child===t.child,e=0,n=0;if(l)for(var a=t.child;a!==null;)e|=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;)e|=a.lanes|a.childLanes,n|=a.subtreeFlags,n|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=n,t.childLanes=e,l}function vm(t,l,e){var n=l.pendingProps;switch(vc(l),l.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $t(l),null;case 1:return $t(l),null;case 3:return e=l.stateNode,n=null,t!==null&&(n=t.memoizedState.cache),l.memoizedState.cache!==n&&(l.flags|=2048),be(fl),nt(),e.pendingContext&&(e.context=e.pendingContext,e.pendingContext=null),(t===null||t.child===null)&&(Aa(l)?Ae(l):t===null||t.memoizedState.isDehydrated&&!(l.flags&256)||(l.flags|=1024,Ur())),$t(l),null;case 26:return e=l.memoizedState,t===null?(Ae(l),e!==null?($t(l),Fs(l,e)):($t(l),l.flags&=-16777217)):e?e!==t.memoizedState?(Ae(l),$t(l),Fs(l,e)):($t(l),l.flags&=-16777217):(t.memoizedProps!==n&&Ae(l),$t(l),l.flags&=-16777217),null;case 27:Y(l),e=N.current;var a=l.type;if(t!==null&&l.stateNode!=null)t.memoizedProps!==n&&Ae(l);else{if(!n){if(l.stateNode===null)throw Error(f(166));return $t(l),null}t=J.current,Aa(l)?Dr(l):(t=Fd(a,n,e),l.stateNode=t,Ae(l))}return $t(l),null;case 5:if(Y(l),e=l.type,t!==null&&l.stateNode!=null)t.memoizedProps!==n&&Ae(l);else{if(!n){if(l.stateNode===null)throw Error(f(166));return $t(l),null}if(t=J.current,Aa(l))Dr(l);else{switch(a=di(N.current),t){case 1:t=a.createElementNS("http://www.w3.org/2000/svg",e);break;case 2:t=a.createElementNS("http://www.w3.org/1998/Math/MathML",e);break;default:switch(e){case"svg":t=a.createElementNS("http://www.w3.org/2000/svg",e);break;case"math":t=a.createElementNS("http://www.w3.org/1998/Math/MathML",e);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(e,{is:n.is}):a.createElement(e)}}t[Sl]=l,t[Rl]=n;t:for(a=l.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===l)break t;for(;a.sibling===null;){if(a.return===null||a.return===l)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}l.stateNode=t;t:switch(gl(t,e,n),e){case"button":case"input":case"select":case"textarea":t=!!n.autoFocus;break t;case"img":t=!0;break t;default:t=!1}t&&Ae(l)}}return $t(l),l.flags&=-16777217,null;case 6:if(t&&l.stateNode!=null)t.memoizedProps!==n&&Ae(l);else{if(typeof n!="string"&&l.stateNode===null)throw Error(f(166));if(t=N.current,Aa(l)){if(t=l.stateNode,e=l.memoizedProps,n=null,a=Ol,a!==null)switch(a.tag){case 27:case 5:n=a.memoizedProps}t[Sl]=l,t=!!(t.nodeValue===e||n!==null&&n.suppressHydrationWarning===!0||Kd(t.nodeValue,e)),t||un(l)}else t=di(t).createTextNode(n),t[Sl]=l,l.stateNode=t}return $t(l),null;case 13:if(n=l.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=Aa(l),n!==null&&n.dehydrated!==null){if(t===null){if(!a)throw Error(f(318));if(a=l.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(f(317));a[Sl]=l}else Ta(),!(l.flags&128)&&(l.memoizedState=null),l.flags|=4;$t(l),a=!1}else a=Ur(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return l.flags&256?(xe(l),l):(xe(l),null)}if(xe(l),l.flags&128)return l.lanes=e,l;if(e=n!==null,t=t!==null&&t.memoizedState!==null,e){n=l.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 e!==t&&e&&(l.child.flags|=8192),Fu(l,l.updateQueue),$t(l),null;case 4:return nt(),t===null&&Df(l.stateNode.containerInfo),$t(l),null;case 10:return be(l.type),$t(l),null;case 19:if(q(ol),a=l.memoizedState,a===null)return $t(l),null;if(n=(l.flags&128)!==0,u=a.rendering,u===null)if(n)wa(a,!1);else{if(tl!==0||t!==null&&t.flags&128)for(t=l.child;t!==null;){if(u=Ju(t),u!==null){for(l.flags|=128,wa(a,!1),t=u.updateQueue,l.updateQueue=t,Fu(l,t),l.subtreeFlags=0,t=e,e=l.child;e!==null;)_r(e,t),e=e.sibling;return C(ol,ol.current&1|2),l.child}t=t.sibling}a.tail!==null&&Nt()>ei&&(l.flags|=128,n=!0,wa(a,!1),l.lanes=4194304)}else{if(!n)if(t=Ju(u),t!==null){if(l.flags|=128,n=!0,t=t.updateQueue,l.updateQueue=t,Fu(l,t),wa(a,!0),a.tail===null&&a.tailMode==="hidden"&&!u.alternate&&!qt)return $t(l),null}else 2*Nt()-a.renderingStartTime>ei&&e!==536870912&&(l.flags|=128,n=!0,wa(a,!1),l.lanes=4194304);a.isBackwards?(u.sibling=l.child,l.child=u):(t=a.last,t!==null?t.sibling=u:l.child=u,a.last=u)}return a.tail!==null?(l=a.tail,a.rendering=l,a.tail=l.sibling,a.renderingStartTime=Nt(),l.sibling=null,t=ol.current,C(ol,n?t&1|2:t&1),l):($t(l),null);case 22:case 23:return xe(l),Rc(),n=l.memoizedState!==null,t!==null?t.memoizedState!==null!==n&&(l.flags|=8192):n&&(l.flags|=8192),n?e&536870912&&!(l.flags&128)&&($t(l),l.subtreeFlags&6&&(l.flags|=8192)):$t(l),e=l.updateQueue,e!==null&&Fu(l,e.retryQueue),e=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),n=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(n=l.memoizedState.cachePool.pool),n!==e&&(l.flags|=2048),t!==null&&q(on),null;case 24:return e=null,t!==null&&(e=t.memoizedState.cache),l.memoizedState.cache!==e&&(l.flags|=2048),be(fl),$t(l),null;case 25:return null;case 30:return null}throw Error(f(156,l.tag))}function pm(t,l){switch(vc(l),l.tag){case 1:return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 3:return be(fl),nt(),t=l.flags,t&65536&&!(t&128)?(l.flags=t&-65537|128,l):null;case 26:case 27:case 5:return Y(l),null;case 13:if(xe(l),t=l.memoizedState,t!==null&&t.dehydrated!==null){if(l.alternate===null)throw Error(f(340));Ta()}return t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 19:return q(ol),null;case 4:return nt(),null;case 10:return be(l.type),null;case 22:case 23:return xe(l),Rc(),t!==null&&q(on),t=l.flags,t&65536?(l.flags=t&-65537|128,l):null;case 24:return be(fl),null;case 25:return null;default:return null}}function td(t,l){switch(vc(l),l.tag){case 3:be(fl),nt();break;case 26:case 27:case 5:Y(l);break;case 4:nt();break;case 13:xe(l);break;case 19:q(ol);break;case 10:be(l.type);break;case 22:case 23:xe(l),Rc(),t!==null&&q(on);break;case 24:be(fl)}}function ja(t,l){try{var e=l.updateQueue,n=e!==null?e.lastEffect:null;if(n!==null){var a=n.next;e=a;do{if((e.tag&t)===t){n=void 0;var u=e.create,o=e.inst;n=u(),o.destroy=n}e=e.next}while(e!==a)}}catch(s){Qt(l,l.return,s)}}function Ye(t,l,e){try{var n=l.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=l;var p=e,T=s;try{T()}catch(U){Qt(a,p,U)}}}n=n.next}while(n!==u)}}catch(U){Qt(l,l.return,U)}}function ld(t){var l=t.updateQueue;if(l!==null){var e=t.stateNode;try{Qr(l,e)}catch(n){Qt(t,t.return,n)}}}function ed(t,l,e){e.props=sn(t.type,t.memoizedProps),e.state=t.memoizedState;try{e.componentWillUnmount()}catch(n){Qt(t,l,n)}}function Qa(t,l){try{var e=t.ref;if(e!==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 e=="function"?t.refCleanup=e(n):e.current=n}}catch(a){Qt(t,l,a)}}function oe(t,l){var e=t.ref,n=t.refCleanup;if(e!==null)if(typeof n=="function")try{n()}catch(a){Qt(t,l,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof e=="function")try{e(null)}catch(a){Qt(t,l,a)}else e.current=null}function nd(t){var l=t.type,e=t.memoizedProps,n=t.stateNode;try{t:switch(l){case"button":case"input":case"select":case"textarea":e.autoFocus&&n.focus();break t;case"img":e.src?n.src=e.src:e.srcSet&&(n.srcset=e.srcSet)}}catch(a){Qt(t,t.return,a)}}function af(t,l,e){try{var n=t.stateNode;Gm(n,t.type,e,l),n[Rl]=l}catch(a){Qt(t,t.return,a)}}function ad(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Le(t.type)||t.tag===4}function uf(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||ad(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&&Le(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function cf(t,l,e){var n=t.tag;if(n===5||n===6)t=t.stateNode,l?(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e).insertBefore(t,l):(l=e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.appendChild(t),e=e._reactRootContainer,e!=null||l.onclick!==null||(l.onclick=si));else if(n!==4&&(n===27&&Le(t.type)&&(e=t.stateNode,l=null),t=t.child,t!==null))for(cf(t,l,e),t=t.sibling;t!==null;)cf(t,l,e),t=t.sibling}function ti(t,l,e){var n=t.tag;if(n===5||n===6)t=t.stateNode,l?e.insertBefore(t,l):e.appendChild(t);else if(n!==4&&(n===27&&Le(t.type)&&(e=t.stateNode),t=t.child,t!==null))for(ti(t,l,e),t=t.sibling;t!==null;)ti(t,l,e),t=t.sibling}function ud(t){var l=t.stateNode,e=t.memoizedProps;try{for(var n=t.type,a=l.attributes;a.length;)l.removeAttributeNode(a[0]);gl(l,n,e),l[Sl]=t,l[Rl]=e}catch(u){Qt(t,t.return,u)}}var Te=!1,nl=!1,ff=!1,id=typeof WeakSet=="function"?WeakSet:Set,hl=null;function gm(t,l){if(t=t.containerInfo,Bf=gi,t=pr(t),uc(t)){if("selectionStart"in t)var e={start:t.selectionStart,end:t.selectionEnd};else t:{e=(e=t.ownerDocument)&&e.defaultView||window;var n=e.getSelection&&e.getSelection();if(n&&n.rangeCount!==0){e=n.anchorNode;var a=n.anchorOffset,u=n.focusNode;n=n.focusOffset;try{e.nodeType,u.nodeType}catch(vt){e=null;break t}var o=0,s=-1,p=-1,T=0,U=0,H=t,O=null;l:for(;;){for(var _;H!==e||a!==0&&H.nodeType!==3||(s=o+a),H!==u||n!==0&&H.nodeType!==3||(p=o+n),H.nodeType===3&&(o+=H.nodeValue.length),(_=H.firstChild)!==null;)O=H,H=_;for(;;){if(H===t)break l;if(O===e&&++T===a&&(s=o),O===u&&++U===n&&(p=o),(_=H.nextSibling)!==null)break;H=O,O=H.parentNode}H=_}e=s===-1||p===-1?null:{start:s,end:p}}else e=null}e=e||{start:0,end:0}}else e=null;for(Nf={focusedElem:t,selectionRange:e},gi=!1,hl=l;hl!==null;)if(l=hl,t=l.child,(l.subtreeFlags&1024)!==0&&t!==null)t.return=l,hl=t;else for(;hl!==null;){switch(l=hl,u=l.alternate,t=l.flags,l.tag){case 0:break;case 11:case 15:break;case 1:if(t&1024&&u!==null){t=void 0,e=l,a=u.memoizedProps,u=u.memoizedState,n=e.stateNode;try{var St=sn(e.type,a,e.elementType===e.type);t=n.getSnapshotBeforeUpdate(St,u),n.__reactInternalSnapshotBeforeUpdate=t}catch(vt){Qt(e,e.return,vt)}}break;case 3:if(t&1024){if(t=l.stateNode.containerInfo,e=t.nodeType,e===9)Cf(t);else if(e===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Cf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(t&1024)throw Error(f(163))}if(t=l.sibling,t!==null){t.return=l.return,hl=t;break}hl=l.return}}function cd(t,l,e){var n=e.flags;switch(e.tag){case 0:case 11:case 15:Ge(t,e),n&4&&ja(5,e);break;case 1:if(Ge(t,e),n&4)if(t=e.stateNode,l===null)try{t.componentDidMount()}catch(o){Qt(e,e.return,o)}else{var a=sn(e.type,l.memoizedProps);l=l.memoizedState;try{t.componentDidUpdate(a,l,t.__reactInternalSnapshotBeforeUpdate)}catch(o){Qt(e,e.return,o)}}n&64&&ld(e),n&512&&Qa(e,e.return);break;case 3:if(Ge(t,e),n&64&&(t=e.updateQueue,t!==null)){if(l=null,e.child!==null)switch(e.child.tag){case 27:case 5:l=e.child.stateNode;break;case 1:l=e.child.stateNode}try{Qr(t,l)}catch(o){Qt(e,e.return,o)}}break;case 27:l===null&&n&4&&ud(e);case 26:case 5:Ge(t,e),l===null&&n&4&&nd(e),n&512&&Qa(e,e.return);break;case 12:Ge(t,e);break;case 13:Ge(t,e),n&4&&rd(t,e),n&64&&(t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(e=_m.bind(null,e),Lm(t,e))));break;case 22:if(n=e.memoizedState!==null||Te,!n){l=l!==null&&l.memoizedState!==null||nl,a=Te;var u=nl;Te=n,(nl=l)&&!u?Xe(t,e,(e.subtreeFlags&8772)!==0):Ge(t,e),Te=a,nl=u}break;case 30:break;default:Ge(t,e)}}function fd(t){var l=t.alternate;l!==null&&(t.alternate=null,fd(l)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(l=t.stateNode,l!==null&&wi(l)),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,Nl=!1;function Ee(t,l,e){for(e=e.child;e!==null;)od(t,l,e),e=e.sibling}function od(t,l,e){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(Ut,e)}catch(u){}switch(e.tag){case 26:nl||oe(e,l),Ee(t,l,e),e.memoizedState?e.memoizedState.count--:e.stateNode&&(e=e.stateNode,e.parentNode.removeChild(e));break;case 27:nl||oe(e,l);var n=kt,a=Nl;Le(e.type)&&(kt=e.stateNode,Nl=!1),Ee(t,l,e),Ia(e.stateNode),kt=n,Nl=a;break;case 5:nl||oe(e,l);case 6:if(n=kt,a=Nl,kt=null,Ee(t,l,e),kt=n,Nl=a,kt!==null)if(Nl)try{(kt.nodeType===9?kt.body:kt.nodeName==="HTML"?kt.ownerDocument.body:kt).removeChild(e.stateNode)}catch(u){Qt(e,l,u)}else try{kt.removeChild(e.stateNode)}catch(u){Qt(e,l,u)}break;case 18:kt!==null&&(Nl?(t=kt,Id(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,e.stateNode),uu(t)):Id(kt,e.stateNode));break;case 4:n=kt,a=Nl,kt=e.stateNode.containerInfo,Nl=!0,Ee(t,l,e),kt=n,Nl=a;break;case 0:case 11:case 14:case 15:nl||Ye(2,e,l),nl||Ye(4,e,l),Ee(t,l,e);break;case 1:nl||(oe(e,l),n=e.stateNode,typeof n.componentWillUnmount=="function"&&ed(e,l,n)),Ee(t,l,e);break;case 21:Ee(t,l,e);break;case 22:nl=(n=nl)||e.memoizedState!==null,Ee(t,l,e),nl=n;break;default:Ee(t,l,e)}}function rd(t,l){if(l.memoizedState===null&&(t=l.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{uu(t)}catch(e){Qt(l,l.return,e)}}function bm(t){switch(t.tag){case 13:case 19:var l=t.stateNode;return l===null&&(l=t.stateNode=new id),l;case 22:return t=t.stateNode,l=t._retryCache,l===null&&(l=t._retryCache=new id),l;default:throw Error(f(435,t.tag))}}function of(t,l){var e=bm(t);l.forEach(function(n){var a=zm.bind(null,t,n);e.has(n)||(e.add(n),n.then(a,a))})}function Gl(t,l){var e=l.deletions;if(e!==null)for(var n=0;n<e.length;n++){var a=e[n],u=t,o=l,s=o;t:for(;s!==null;){switch(s.tag){case 27:if(Le(s.type)){kt=s.stateNode,Nl=!1;break t}break;case 5:kt=s.stateNode,Nl=!1;break t;case 3:case 4:kt=s.stateNode.containerInfo,Nl=!0;break t}s=s.return}if(kt===null)throw Error(f(160));od(u,o,a),kt=null,Nl=!1,u=a.alternate,u!==null&&(u.return=null),a.return=null}if(l.subtreeFlags&13878)for(l=l.child;l!==null;)sd(l,t),l=l.sibling}var te=null;function sd(t,l){var e=t.alternate,n=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Gl(l,t),Xl(t),n&4&&(Ye(3,t,t.return),ja(3,t),Ye(5,t,t.return));break;case 1:Gl(l,t),Xl(t),n&512&&(nl||e===null||oe(e,e.return)),n&64&&Te&&(t=t.updateQueue,t!==null&&(n=t.callbacks,n!==null&&(e=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=e===null?n:e.concat(n))));break;case 26:var a=te;if(Gl(l,t),Xl(t),n&512&&(nl||e===null||oe(e,e.return)),n&4){var u=e!==null?e.memoizedState:null;if(n=t.memoizedState,e===null)if(n===null)if(t.stateNode===null){t:{n=t.type,e=t.memoizedProps,a=a.ownerDocument||a;l:switch(n){case"title":u=a.getElementsByTagName("title")[0],(!u||u[da]||u[Sl]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=a.createElement(n),a.head.insertBefore(u,a.querySelector("head > title"))),gl(u,n,e),u[Sl]=t,sl(u),n=u;break t;case"link":var o=uh("link","href",a).get(n+(e.href||""));if(o){for(var s=0;s<o.length;s++)if(u=o[s],u.getAttribute("href")===(e.href==null||e.href===""?null:e.href)&&u.getAttribute("rel")===(e.rel==null?null:e.rel)&&u.getAttribute("title")===(e.title==null?null:e.title)&&u.getAttribute("crossorigin")===(e.crossOrigin==null?null:e.crossOrigin)){o.splice(s,1);break l}}u=a.createElement(n),gl(u,n,e),a.head.appendChild(u);break;case"meta":if(o=uh("meta","content",a).get(n+(e.content||""))){for(s=0;s<o.length;s++)if(u=o[s],u.getAttribute("content")===(e.content==null?null:""+e.content)&&u.getAttribute("name")===(e.name==null?null:e.name)&&u.getAttribute("property")===(e.property==null?null:e.property)&&u.getAttribute("http-equiv")===(e.httpEquiv==null?null:e.httpEquiv)&&u.getAttribute("charset")===(e.charSet==null?null:e.charSet)){o.splice(s,1);break l}}u=a.createElement(n),gl(u,n,e),a.head.appendChild(u);break;default:throw Error(f(468,n))}u[Sl]=t,sl(u),n=u}t.stateNode=n}else ih(a,t.type,t.stateNode);else t.stateNode=ah(a,n,t.memoizedProps);else u!==n?(u===null?e.stateNode!==null&&(e=e.stateNode,e.parentNode.removeChild(e)):u.count--,n===null?ih(a,t.type,t.stateNode):ah(a,n,t.memoizedProps)):n===null&&t.stateNode!==null&&af(t,t.memoizedProps,e.memoizedProps)}break;case 27:Gl(l,t),Xl(t),n&512&&(nl||e===null||oe(e,e.return)),e!==null&&n&4&&af(t,t.memoizedProps,e.memoizedProps);break;case 5:if(Gl(l,t),Xl(t),n&512&&(nl||e===null||oe(e,e.return)),t.flags&32){a=t.stateNode;try{_n(a,"")}catch(_){Qt(t,t.return,_)}}n&4&&t.stateNode!=null&&(a=t.memoizedProps,af(t,a,e!==null?e.memoizedProps:a)),n&1024&&(ff=!0);break;case 6:if(Gl(l,t),Xl(t),n&4){if(t.stateNode===null)throw Error(f(162));n=t.memoizedProps,e=t.stateNode;try{e.nodeValue=n}catch(_){Qt(t,t.return,_)}}break;case 3:if(mi=null,a=te,te=hi(l.containerInfo),Gl(l,t),te=a,Xl(t),n&4&&e!==null&&e.memoizedState.isDehydrated)try{uu(l.containerInfo)}catch(_){Qt(t,t.return,_)}ff&&(ff=!1,dd(t));break;case 4:n=te,te=hi(t.stateNode.containerInfo),Gl(l,t),Xl(t),te=n;break;case 12:Gl(l,t),Xl(t);break;case 13:Gl(l,t),Xl(t),t.child.flags&8192&&t.memoizedState!==null!=(e!==null&&e.memoizedState!==null)&&(mf=Nt()),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,of(t,n)));break;case 22:a=t.memoizedState!==null;var p=e!==null&&e.memoizedState!==null,T=Te,U=nl;if(Te=T||a,nl=U||p,Gl(l,t),nl=U,Te=T,Xl(t),n&8192)t:for(l=t.stateNode,l._visibility=a?l._visibility&-2:l._visibility|1,a&&(e===null||p||Te||nl||dn(t)),e=null,l=t;;){if(l.tag===5||l.tag===26){if(e===null){p=e=l;try{if(u=p.stateNode,a)o=u.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none";else{s=p.stateNode;var H=p.memoizedProps.style,O=H!=null&&H.hasOwnProperty("display")?H.display:null;s.style.display=O==null||typeof O=="boolean"?"":(""+O).trim()}}catch(_){Qt(p,p.return,_)}}}else if(l.tag===6){if(e===null){p=l;try{p.stateNode.nodeValue=a?"":p.memoizedProps}catch(_){Qt(p,p.return,_)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===t)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===t)break t;for(;l.sibling===null;){if(l.return===null||l.return===t)break t;e===l&&(e=null),l=l.return}e===l&&(e=null),l.sibling.return=l.return,l=l.sibling}n&4&&(n=t.updateQueue,n!==null&&(e=n.retryQueue,e!==null&&(n.retryQueue=null,of(t,e))));break;case 19:Gl(l,t),Xl(t),n&4&&(n=t.updateQueue,n!==null&&(t.updateQueue=null,of(t,n)));break;case 30:break;case 21:break;default:Gl(l,t),Xl(t)}}function Xl(t){var l=t.flags;if(l&2){try{for(var e,n=t.return;n!==null;){if(ad(n)){e=n;break}n=n.return}if(e==null)throw Error(f(160));switch(e.tag){case 27:var a=e.stateNode,u=uf(t);ti(t,u,a);break;case 5:var o=e.stateNode;e.flags&32&&(_n(o,""),e.flags&=-33);var s=uf(t);ti(t,s,o);break;case 3:case 4:var p=e.stateNode.containerInfo,T=uf(t);cf(t,T,p);break;default:throw Error(f(161))}}catch(U){Qt(t,t.return,U)}t.flags&=-3}l&4096&&(t.flags&=-4097)}function dd(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var l=t;dd(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),t=t.sibling}}function Ge(t,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)cd(t,l.alternate,l),l=l.sibling}function dn(t){for(t=t.child;t!==null;){var l=t;switch(l.tag){case 0:case 11:case 14:case 15:Ye(4,l,l.return),dn(l);break;case 1:oe(l,l.return);var e=l.stateNode;typeof e.componentWillUnmount=="function"&&ed(l,l.return,e),dn(l);break;case 27:Ia(l.stateNode);case 26:case 5:oe(l,l.return),dn(l);break;case 22:l.memoizedState===null&&dn(l);break;case 30:dn(l);break;default:dn(l)}t=t.sibling}}function Xe(t,l,e){for(e=e&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var n=l.alternate,a=t,u=l,o=u.flags;switch(u.tag){case 0:case 11:case 15:Xe(a,u,e),ja(4,u);break;case 1:if(Xe(a,u,e),n=u,a=n.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(T){Qt(n,n.return,T)}if(n=u,a=n.updateQueue,a!==null){var s=n.stateNode;try{var p=a.shared.hiddenCallbacks;if(p!==null)for(a.shared.hiddenCallbacks=null,a=0;a<p.length;a++)jr(p[a],s)}catch(T){Qt(n,n.return,T)}}e&&o&64&&ld(u),Qa(u,u.return);break;case 27:ud(u);case 26:case 5:Xe(a,u,e),e&&n===null&&o&4&&nd(u),Qa(u,u.return);break;case 12:Xe(a,u,e);break;case 13:Xe(a,u,e),e&&o&4&&rd(a,u);break;case 22:u.memoizedState===null&&Xe(a,u,e),Qa(u,u.return);break;case 30:break;default:Xe(a,u,e)}l=l.sibling}}function rf(t,l){var e=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),t=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(t=l.memoizedState.cachePool.pool),t!==e&&(t!=null&&t.refCount++,e!=null&&_a(e))}function sf(t,l){t=null,l.alternate!==null&&(t=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==t&&(l.refCount++,t!=null&&_a(t))}function re(t,l,e,n){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)hd(t,l,e,n),l=l.sibling}function hd(t,l,e,n){var a=l.flags;switch(l.tag){case 0:case 11:case 15:re(t,l,e,n),a&2048&&ja(9,l);break;case 1:re(t,l,e,n);break;case 3:re(t,l,e,n),a&2048&&(t=null,l.alternate!==null&&(t=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==t&&(l.refCount++,t!=null&&_a(t)));break;case 12:if(a&2048){re(t,l,e,n),t=l.stateNode;try{var u=l.memoizedProps,o=u.id,s=u.onPostCommit;typeof s=="function"&&s(o,l.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(p){Qt(l,l.return,p)}}else re(t,l,e,n);break;case 13:re(t,l,e,n);break;case 23:break;case 22:u=l.stateNode,o=l.alternate,l.memoizedState!==null?u._visibility&2?re(t,l,e,n):Va(t,l):u._visibility&2?re(t,l,e,n):(u._visibility|=2,Kn(t,l,e,n,(l.subtreeFlags&10256)!==0)),a&2048&&rf(o,l);break;case 24:re(t,l,e,n),a&2048&&sf(l.alternate,l);break;default:re(t,l,e,n)}}function Kn(t,l,e,n,a){for(a=a&&(l.subtreeFlags&10256)!==0,l=l.child;l!==null;){var u=t,o=l,s=e,p=n,T=o.flags;switch(o.tag){case 0:case 11:case 15:Kn(u,o,s,p,a),ja(8,o);break;case 23:break;case 22:var U=o.stateNode;o.memoizedState!==null?U._visibility&2?Kn(u,o,s,p,a):Va(u,o):(U._visibility|=2,Kn(u,o,s,p,a)),a&&T&2048&&rf(o.alternate,o);break;case 24:Kn(u,o,s,p,a),a&&T&2048&&sf(o.alternate,o);break;default:Kn(u,o,s,p,a)}l=l.sibling}}function Va(t,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var e=t,n=l,a=n.flags;switch(n.tag){case 22:Va(e,n),a&2048&&rf(n.alternate,n);break;case 24:Va(e,n),a&2048&&sf(n.alternate,n);break;default:Va(e,n)}l=l.sibling}}var Za=8192;function kn(t){if(t.subtreeFlags&Za)for(t=t.child;t!==null;)yd(t),t=t.sibling}function yd(t){switch(t.tag){case 26:kn(t),t.flags&Za&&t.memoizedState!==null&&av(te,t.memoizedState,t.memoizedProps);break;case 5:kn(t);break;case 3:case 4:var l=te;te=hi(t.stateNode.containerInfo),kn(t),te=l;break;case 22:t.memoizedState===null&&(l=t.alternate,l!==null&&l.memoizedState!==null?(l=Za,Za=16777216,kn(t),Za=l):kn(t));break;default:kn(t)}}function md(t){var l=t.alternate;if(l!==null&&(t=l.child,t!==null)){l.child=null;do l=t.sibling,t.sibling=null,t=l;while(t!==null)}}function La(t){var l=t.deletions;if(t.flags&16){if(l!==null)for(var e=0;e<l.length;e++){var n=l[e];hl=n,pd(n,t)}md(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)vd(t),t=t.sibling}function vd(t){switch(t.tag){case 0:case 11:case 15:La(t),t.flags&2048&&Ye(9,t,t.return);break;case 3:La(t);break;case 12:La(t);break;case 22:var l=t.stateNode;t.memoizedState!==null&&l._visibility&2&&(t.return===null||t.return.tag!==13)?(l._visibility&=-3,li(t)):La(t);break;default:La(t)}}function li(t){var l=t.deletions;if(t.flags&16){if(l!==null)for(var e=0;e<l.length;e++){var n=l[e];hl=n,pd(n,t)}md(t)}for(t=t.child;t!==null;){switch(l=t,l.tag){case 0:case 11:case 15:Ye(8,l,l.return),li(l);break;case 22:e=l.stateNode,e._visibility&2&&(e._visibility&=-3,li(l));break;default:li(l)}t=t.sibling}}function pd(t,l){for(;hl!==null;){var e=hl;switch(e.tag){case 0:case 11:case 15:Ye(8,e,l);break;case 23:case 22:if(e.memoizedState!==null&&e.memoizedState.cachePool!==null){var n=e.memoizedState.cachePool.pool;n!=null&&n.refCount++}break;case 24:_a(e.memoizedState.cache)}if(n=e.child,n!==null)n.return=e,hl=n;else t:for(e=t;hl!==null;){n=hl;var a=n.sibling,u=n.return;if(fd(n),n===e){hl=null;break t}if(a!==null){a.return=u,hl=a;break t}hl=u}}}var Sm={getCacheForType:function(t){var l=xl(fl),e=l.data.get(t);return e===void 0&&(e=t(),l.data.set(t,e)),e}},xm=typeof WeakMap=="function"?WeakMap:Map,Ct=0,Vt=null,Dt=null,Bt=0,Yt=0,wl=null,we=!1,Jn=!1,df=!1,Oe=0,tl=0,je=0,hn=0,hf=0,Il=0,Pn=0,Ka=null,Hl=null,yf=!1,mf=0,ei=1/0,ni=null,Qe=null,pl=0,Ve=null,$n=null,In=0,vf=0,pf=null,gd=null,ka=0,gf=null;function jl(){if(Ct&2&&Bt!==0)return Bt&-Bt;if(D.T!==null){var t=Gn;return t!==0?t:Ef()}return bn()}function bd(){Il===0&&(Il=!(Bt&536870912)||qt?rl():536870912);var t=$l.current;return t!==null&&(t.flags|=32),Il}function Ql(t,l,e){(t===Vt&&(Yt===2||Yt===9)||t.cancelPendingCommit!==null)&&(Wn(t,0),Ze(t,Bt,Il,!1)),El(t,e),(!(Ct&2)||t!==Vt)&&(t===Vt&&(!(Ct&2)&&(hn|=e),tl===4&&Ze(t,Bt,Il,!1)),se(t))}function Sd(t,l,e){if(Ct&6)throw Error(f(327));var n=!e&&(l&124)===0&&(l&t.expiredLanes)===0||Dl(t,l),a=n?Tm(t,l):xf(t,l,!0),u=n;do{if(a===0){Jn&&!n&&Ze(t,l,0,!1);break}else{if(e=t.current.alternate,u&&!Mm(e)){a=xf(t,l,!1),u=!1;continue}if(a===2){if(u=l,t.errorRecoveryDisabledLanes&u)var o=0;else o=t.pendingLanes&-536870913,o=o!==0?o:o&536870912?536870912:0;if(o!==0){l=o;t:{var s=t;a=Ka;var p=s.current.memoizedState.isDehydrated;if(p&&(Wn(s,o).flags|=256),o=xf(s,o,!1),o!==2){if(df&&!p){s.errorRecoveryDisabledLanes|=u,hn|=u,a=4;break t}u=Hl,Hl=a,u!==null&&(Hl===null?Hl=u:Hl.push.apply(Hl,u))}a=o}if(u=!1,a!==2)continue}}if(a===1){Wn(t,0),Ze(t,l,0,!0);break}t:{switch(n=t,u=a,u){case 0:case 1:throw Error(f(345));case 4:if((l&4194048)!==l)break;case 6:Ze(n,l,Il,!we);break t;case 2:Hl=null;break;case 3:case 5:break;default:throw Error(f(329))}if((l&62914560)===l&&(a=mf+300-Nt(),10<a)){if(Ze(n,l,Il,!we),de(n,0,!0)!==0)break t;n.timeoutHandle=Pd(xd.bind(null,n,e,Hl,ni,yf,l,Il,hn,Pn,we,u,2,-0,0),a);break t}xd(n,e,Hl,ni,yf,l,Il,hn,Pn,we,u,0,-0,0)}}break}while(!0);se(t)}function xd(t,l,e,n,a,u,o,s,p,T,U,H,O,_){if(t.timeoutHandle=-1,H=l.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(tu={stylesheets:null,count:0,unsuspend:nv},yd(l),H=uv(),H!==null)){t.cancelPendingCommit=H(zd.bind(null,t,l,u,e,n,a,o,s,p,U,1,O,_)),Ze(t,u,o,!T);return}zd(t,l,u,e,n,a,o,s,p)}function Mm(t){for(var l=t;;){var e=l.tag;if((e===0||e===11||e===15)&&l.flags&16384&&(e=l.updateQueue,e!==null&&(e=e.stores,e!==null)))for(var n=0;n<e.length;n++){var a=e[n],u=a.getSnapshot;a=a.value;try{if(!Cl(u(),a))return!1}catch(o){return!1}}if(e=l.child,l.subtreeFlags&16384&&e!==null)e.return=l,l=e;else{if(l===t)break;for(;l.sibling===null;){if(l.return===null||l.return===t)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ze(t,l,e,n){l&=~hf,l&=~hn,t.suspendedLanes|=l,t.pingedLanes&=~l,n&&(t.warmLanes|=l),n=t.expirationTimes;for(var a=l;0<a;){var u=31-At(a),o=1<<u;n[u]=-1,a&=~o}e!==0&&ra(t,e,l)}function ai(){return Ct&6?!0:(Ja(0),!1)}function bf(){if(Dt!==null){if(Yt===0)var t=Dt.return;else t=Dt,ge=cn=null,qc(t),Zn=null,Ga=0,t=Dt;for(;t!==null;)td(t.alternate,t),t=t.return;Dt=null}}function Wn(t,l){var e=t.timeoutHandle;e!==-1&&(t.timeoutHandle=-1,wm(e)),e=t.cancelPendingCommit,e!==null&&(t.cancelPendingCommit=null,e()),bf(),Vt=t,Dt=e=me(t.current,null),Bt=l,Yt=0,wl=null,we=!1,Jn=Dl(t,l),df=!1,Pn=Il=hf=hn=je=tl=0,Hl=Ka=null,yf=!1,l&8&&(l|=l&32);var n=t.entangledLanes;if(n!==0)for(t=t.entanglements,n&=l;0<n;){var a=31-At(n),u=1<<a;l|=t[a],n&=~u}return Oe=l,Ou(),e}function Md(t,l){_t=null,D.H=Lu,l===Da||l===qu?(l=Xr(),Yt=3):l===Cr?(l=Xr(),Yt=4):Yt=l===ws?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,wl=l,Dt===null&&(tl=1,$u(t,Kl(l,t.current)))}function Ad(){var t=D.H;return D.H=Lu,t===null?Lu:t}function Td(){var t=D.A;return D.A=Sm,t}function Sf(){tl=4,we||(Bt&4194048)!==Bt&&$l.current!==null||(Jn=!0),!(je&134217727)&&!(hn&134217727)||Vt===null||Ze(Vt,Bt,Il,!1)}function xf(t,l,e){var n=Ct;Ct|=2;var a=Ad(),u=Td();(Vt!==t||Bt!==l)&&(ni=null,Wn(t,l)),l=!1;var o=tl;t:do try{if(Yt!==0&&Dt!==null){var s=Dt,p=wl;switch(Yt){case 8:bf(),o=6;break t;case 3:case 2:case 9:case 6:$l.current===null&&(l=!0);var T=Yt;if(Yt=0,wl=null,Fn(t,s,p,T),e&&Jn){o=0;break t}break;default:T=Yt,Yt=0,wl=null,Fn(t,s,p,T)}}Am(),o=tl;break}catch(U){Md(t,U)}while(!0);return l&&t.shellSuspendCounter++,ge=cn=null,Ct=n,D.H=a,D.A=u,Dt===null&&(Vt=null,Bt=0,Ou()),o}function Am(){for(;Dt!==null;)Ed(Dt)}function Tm(t,l){var e=Ct;Ct|=2;var n=Ad(),a=Td();Vt!==t||Bt!==l?(ni=null,ei=Nt()+500,Wn(t,l)):Jn=Dl(t,l);t:do try{if(Yt!==0&&Dt!==null){l=Dt;var u=wl;l:switch(Yt){case 1:Yt=0,wl=null,Fn(t,l,u,1);break;case 2:case 9:if(Yr(u)){Yt=0,wl=null,Od(l);break}l=function(){Yt!==2&&Yt!==9||Vt!==t||(Yt=7),se(t)},u.then(l,l);break t;case 3:Yt=7;break t;case 4:Yt=5;break t;case 7:Yr(u)?(Yt=0,wl=null,Od(l)):(Yt=0,wl=null,Fn(t,l,u,7));break;case 5:var o=null;switch(Dt.tag){case 26:o=Dt.memoizedState;case 5:case 27:var s=Dt;if(!o||ch(o)){Yt=0,wl=null;var p=s.sibling;if(p!==null)Dt=p;else{var T=s.return;T!==null?(Dt=T,ui(T)):Dt=null}break l}}Yt=0,wl=null,Fn(t,l,u,5);break;case 6:Yt=0,wl=null,Fn(t,l,u,6);break;case 8:bf(),tl=6;break t;default:throw Error(f(462))}}Em();break}catch(U){Md(t,U)}while(!0);return ge=cn=null,D.H=n,D.A=a,Ct=e,Dt!==null?0:(Vt=null,Bt=0,Ou(),tl)}function Em(){for(;Dt!==null&&!ll();)Ed(Dt)}function Ed(t){var l=Ws(t.alternate,t,Oe);t.memoizedProps=t.pendingProps,l===null?ui(t):Dt=l}function Od(t){var l=t,e=l.alternate;switch(l.tag){case 15:case 0:l=Ks(e,l,l.pendingProps,l.type,void 0,Bt);break;case 11:l=Ks(e,l,l.pendingProps,l.type.render,l.ref,Bt);break;case 5:qc(l);default:td(e,l),l=Dt=_r(l,Oe),l=Ws(e,l,Oe)}t.memoizedProps=t.pendingProps,l===null?ui(t):Dt=l}function Fn(t,l,e,n){ge=cn=null,qc(l),Zn=null,Ga=0;var a=l.return;try{if(ym(t,a,l,e,Bt)){tl=1,$u(t,Kl(e,t.current)),Dt=null;return}}catch(u){if(a!==null)throw Dt=a,u;tl=1,$u(t,Kl(e,t.current)),Dt=null;return}l.flags&32768?(qt||n===1?t=!0:Jn||Bt&536870912?t=!1:(we=t=!0,(n===2||n===9||n===3||n===6)&&(n=$l.current,n!==null&&n.tag===13&&(n.flags|=16384))),_d(l,t)):ui(l)}function ui(t){var l=t;do{if(l.flags&32768){_d(l,we);return}t=l.return;var e=vm(l.alternate,l,Oe);if(e!==null){Dt=e;return}if(l=l.sibling,l!==null){Dt=l;return}Dt=l=t}while(l!==null);tl===0&&(tl=5)}function _d(t,l){do{var e=pm(t.alternate,t);if(e!==null){e.flags&=32767,Dt=e;return}if(e=t.return,e!==null&&(e.flags|=32768,e.subtreeFlags=0,e.deletions=null),!l&&(t=t.sibling,t!==null)){Dt=t;return}Dt=t=e}while(t!==null);tl=6,Dt=null}function zd(t,l,e,n,a,u,o,s,p){t.cancelPendingCommit=null;do ii();while(pl!==0);if(Ct&6)throw Error(f(327));if(l!==null){if(l===t.current)throw Error(f(177));if(u=l.lanes|l.childLanes,u|=rc,ze(t,e,u,o,s,p),t===Vt&&(Dt=Vt=null,Bt=0),$n=l,Ve=t,In=e,vf=u,pf=a,gd=n,l.subtreeFlags&10256||l.flags&10256?(t.callbackNode=null,t.callbackPriority=0,Dm(Pt,function(){return Nd(),null})):(t.callbackNode=null,t.callbackPriority=0),n=(l.flags&13878)!==0,l.subtreeFlags&13878||n){n=D.T,D.T=null,a=w.p,w.p=2,o=Ct,Ct|=4;try{gm(t,l,e)}finally{Ct=o,w.p=a,D.T=n}}pl=1,Dd(),Rd(),Ud()}}function Dd(){if(pl===1){pl=0;var t=Ve,l=$n,e=(l.flags&13878)!==0;if(l.subtreeFlags&13878||e){e=D.T,D.T=null;var n=w.p;w.p=2;var a=Ct;Ct|=4;try{sd(l,t);var u=Nf,o=pr(t.containerInfo),s=u.focusedElem,p=u.selectionRange;if(o!==s&&s&&s.ownerDocument&&vr(s.ownerDocument.documentElement,s)){if(p!==null&&uc(s)){var T=p.start,U=p.end;if(U===void 0&&(U=T),"selectionStart"in s)s.selectionStart=T,s.selectionEnd=Math.min(U,s.value.length);else{var H=s.ownerDocument||document,O=H&&H.defaultView||window;if(O.getSelection){var _=O.getSelection(),St=s.textContent.length,vt=Math.min(p.start,St),jt=p.end===void 0?vt:Math.min(p.end,St);!_.extend&&vt>jt&&(o=jt,jt=vt,vt=o);var M=mr(s,vt),x=mr(s,jt);if(M&&x&&(_.rangeCount!==1||_.anchorNode!==M.node||_.anchorOffset!==M.offset||_.focusNode!==x.node||_.focusOffset!==x.offset)){var A=H.createRange();A.setStart(M.node,M.offset),_.removeAllRanges(),vt>jt?(_.addRange(A),_.extend(x.node,x.offset)):(A.setEnd(x.node,x.offset),_.addRange(A))}}}}for(H=[],_=s;_=_.parentNode;)_.nodeType===1&&H.push({element:_,left:_.scrollLeft,top:_.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;s<H.length;s++){var B=H[s];B.element.scrollLeft=B.left,B.element.scrollTop=B.top}}gi=!!Bf,Nf=Bf=null}finally{Ct=a,w.p=n,D.T=e}}t.current=l,pl=2}}function Rd(){if(pl===2){pl=0;var t=Ve,l=$n,e=(l.flags&8772)!==0;if(l.subtreeFlags&8772||e){e=D.T,D.T=null;var n=w.p;w.p=2;var a=Ct;Ct|=4;try{cd(t,l.alternate,l)}finally{Ct=a,w.p=n,D.T=e}}pl=3}}function Ud(){if(pl===4||pl===3){pl=0,Gt();var t=Ve,l=$n,e=In,n=gd;l.subtreeFlags&10256||l.flags&10256?pl=5:(pl=0,$n=Ve=null,Bd(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(Qe=null),ie(e),l=l.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(Ut,l,void 0,(l.current.flags&128)===128)}catch(p){}if(n!==null){l=D.T,a=w.p,w.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=l,w.p=a}}In&3&&ii(),se(t),a=t.pendingLanes,e&4194090&&a&42?t===gf?ka++:(ka=0,gf=t):ka=0,Ja(0)}}function Bd(t,l){(t.pooledCacheLanes&=l)===0&&(l=t.pooledCache,l!=null&&(t.pooledCache=null,_a(l)))}function ii(t){return Dd(),Rd(),Ud(),Nd()}function Nd(){if(pl!==5)return!1;var t=Ve,l=vf;vf=0;var e=ie(In),n=D.T,a=w.p;try{w.p=32>e?32:e,D.T=null,e=pf,pf=null;var u=Ve,o=In;if(pl=0,$n=Ve=null,In=0,Ct&6)throw Error(f(331));var s=Ct;if(Ct|=4,vd(u.current),hd(u,u.current,o,e),Ct=s,Ja(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(Ut,u)}catch(p){}return!0}finally{w.p=a,D.T=n,Bd(t,l)}}function Hd(t,l,e){l=Kl(e,l),l=Pc(t.stateNode,l,2),t=Ne(t,l,2),t!==null&&(El(t,2),se(t))}function Qt(t,l,e){if(t.tag===3)Hd(t,t,e);else for(;l!==null;){if(l.tag===3){Hd(l,t,e);break}else if(l.tag===1){var n=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(Qe===null||!Qe.has(n))){t=Kl(e,t),e=Gs(2),n=Ne(l,e,2),n!==null&&(Xs(e,n,l,t),El(n,2),se(n));break}}l=l.return}}function Mf(t,l,e){var n=t.pingCache;if(n===null){n=t.pingCache=new xm;var a=new Set;n.set(l,a)}else a=n.get(l),a===void 0&&(a=new Set,n.set(l,a));a.has(e)||(df=!0,a.add(e),t=Om.bind(null,t,l,e),l.then(t,t))}function Om(t,l,e){var n=t.pingCache;n!==null&&n.delete(l),t.pingedLanes|=t.suspendedLanes&e,t.warmLanes&=~e,Vt===t&&(Bt&e)===e&&(tl===4||tl===3&&(Bt&62914560)===Bt&&300>Nt()-mf?!(Ct&2)&&Wn(t,0):hf|=e,Pn===Bt&&(Pn=0)),se(t)}function qd(t,l){l===0&&(l=ae()),t=Hn(t,l),t!==null&&(El(t,l),se(t))}function _m(t){var l=t.memoizedState,e=0;l!==null&&(e=l.retryLane),qd(t,e)}function zm(t,l){var e=0;switch(t.tag){case 13:var n=t.stateNode,a=t.memoizedState;a!==null&&(e=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(l),qd(t,e)}function Dm(t,l){return mt(t,l)}var ci=null,ta=null,Af=!1,fi=!1,Tf=!1,yn=0;function se(t){t!==ta&&t.next===null&&(ta===null?ci=ta=t:ta=ta.next=t),fi=!0,Af||(Af=!0,Um())}function Ja(t,l){if(!Tf&&fi){Tf=!0;do for(var e=!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-At(42|t)+1)-1,u&=a&~(o&~s),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(e=!0,Xd(n,u))}else u=Bt,u=de(n,n===Vt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),!(u&3)||Dl(n,u)||(e=!0,Xd(n,u));n=n.next}while(e);Tf=!1}}function Rm(){Cd()}function Cd(){fi=Af=!1;var t=0;yn!==0&&(Xm()&&(t=yn),yn=0);for(var l=Nt(),e=null,n=ci;n!==null;){var a=n.next,u=Yd(n,l);u===0?(n.next=null,e===null?ci=a:e.next=a,a===null&&(ta=e)):(e=n,(t!==0||u&3)&&(fi=!0)),n=a}Ja(t)}function Yd(t,l){for(var e=t.suspendedLanes,n=t.pingedLanes,a=t.expirationTimes,u=t.pendingLanes&-62914561;0<u;){var o=31-At(u),s=1<<o,p=a[o];p===-1?(!(s&e)||s&n)&&(a[o]=Yi(s,l)):p<=l&&(t.expiredLanes|=s),u&=~s}if(l=Vt,e=Bt,e=de(t,t===l?e:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),n=t.callbackNode,e===0||t===l&&(Yt===2||Yt===9)||t.cancelPendingCommit!==null)return n!==null&&n!==null&&Jt(n),t.callbackNode=null,t.callbackPriority=0;if(!(e&3)||Dl(t,e)){if(l=e&-e,l===t.callbackPriority)return l;switch(n!==null&&Jt(n),ie(e)){case 2:case 8:e=Kt;break;case 32:e=Pt;break;case 268435456:e=al;break;default:e=Pt}return n=Gd.bind(null,t),e=mt(e,n),t.callbackPriority=l,t.callbackNode=e,l}return n!==null&&n!==null&&Jt(n),t.callbackPriority=2,t.callbackNode=null,2}function Gd(t,l){if(pl!==0&&pl!==5)return t.callbackNode=null,t.callbackPriority=0,null;var e=t.callbackNode;if(ii()&&t.callbackNode!==e)return null;var n=Bt;return n=de(t,t===Vt?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),n===0?null:(Sd(t,n,l),Yd(t,Nt()),t.callbackNode!=null&&t.callbackNode===e?Gd.bind(null,t):null)}function Xd(t,l){if(ii())return null;Sd(t,l,!0)}function Um(){jm(function(){Ct&6?mt(Zt,Rm):Cd()})}function Ef(){return yn===0&&(yn=rl()),yn}function wd(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:bu(""+t)}function jd(t,l){var e=l.ownerDocument.createElement("input");return e.name=l.name,e.value=l.value,t.id&&e.setAttribute("form",t.id),l.parentNode.insertBefore(e,l),t=new FormData(t),e.parentNode.removeChild(e),t}function Bm(t,l,e,n,a){if(l==="submit"&&e&&e.stateNode===a){var u=wd((a[Rl]||null).action),o=n.submitter;o&&(l=(l=o[Rl]||null)?wd(l.formAction):o.getAttribute("formAction"),l!==null&&(u=l,o=null));var s=new Au("action","action",null,n,a);t.push({event:s,listeners:[{instance:null,listener:function(){if(n.defaultPrevented){if(yn!==0){var p=o?jd(a,o):new FormData(a);Zc(e,{pending:!0,data:p,method:a.method,action:u},null,p)}}else typeof u=="function"&&(s.preventDefault(),p=o?jd(a,o):new FormData(a),Zc(e,{pending:!0,data:p,method:a.method,action:u},u,p))},currentTarget:a}]})}}for(var Of=0;Of<oc.length;Of++){var _f=oc[Of],Nm=_f.toLowerCase(),Hm=_f[0].toUpperCase()+_f.slice(1);Fl(Nm,"on"+Hm)}Fl(Sr,"onAnimationEnd"),Fl(xr,"onAnimationIteration"),Fl(Mr,"onAnimationStart"),Fl("dblclick","onDoubleClick"),Fl("focusin","onFocus"),Fl("focusout","onBlur"),Fl(Iy,"onTransitionRun"),Fl(Wy,"onTransitionStart"),Fl(Fy,"onTransitionCancel"),Fl(Ar,"onTransitionEnd"),Tn("onMouseEnter",["mouseout","mouseover"]),Tn("onMouseLeave",["mouseout","mouseover"]),Tn("onPointerEnter",["pointerout","pointerover"]),Tn("onPointerLeave",["pointerout","pointerover"]),Ie("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ie("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ie("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ie("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ie("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ie("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 Qd(t,l){l=(l&4)!==0;for(var e=0;e<t.length;e++){var n=t[e],a=n.event;n=n.listeners;t:{var u=void 0;if(l)for(var o=n.length-1;0<=o;o--){var s=n[o],p=s.instance,T=s.currentTarget;if(s=s.listener,p!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=T;try{u(a)}catch(U){Pu(U)}a.currentTarget=null,u=p}else for(o=0;o<n.length;o++){if(s=n[o],p=s.instance,T=s.currentTarget,s=s.listener,p!==u&&a.isPropagationStopped())break t;u=s,a.currentTarget=T;try{u(a)}catch(U){Pu(U)}a.currentTarget=null,u=p}}}}function Rt(t,l){var e=l[Xi];e===void 0&&(e=l[Xi]=new Set);var n=t+"__bubble";e.has(n)||(Vd(l,t,2,!1),e.add(n))}function zf(t,l,e){var n=0;l&&(n|=4),Vd(e,t,n,l)}var oi="_reactListening"+Math.random().toString(36).slice(2);function Df(t){if(!t[oi]){t[oi]=!0,Co.forEach(function(e){e!=="selectionchange"&&(qm.has(e)||zf(e,!1,t),zf(e,!0,t))});var l=t.nodeType===9?t:t.ownerDocument;l===null||l[oi]||(l[oi]=!0,zf("selectionchange",!1,l))}}function Vd(t,l,e,n){switch(hh(l)){case 2:var a=fv;break;case 8:a=ov;break;default:a=Vf}e=a.bind(null,l,e,t),a=void 0,!$i||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(a=!0),n?a!==void 0?t.addEventListener(l,e,{capture:!0,passive:a}):t.addEventListener(l,e,!0):a!==void 0?t.addEventListener(l,e,{passive:a}):t.addEventListener(l,e,!1)}function Rf(t,l,e,n,a){var u=n;if(!(l&1)&&!(l&2)&&n!==null)t:for(;;){if(n===null)return;var o=n.tag;if(o===3||o===4){var s=n.stateNode.containerInfo;if(s===a)break;if(o===4)for(o=n.return;o!==null;){var p=o.tag;if((p===3||p===4)&&o.stateNode.containerInfo===a)return;o=o.return}for(;s!==null;){if(o=xn(s),o===null)return;if(p=o.tag,p===5||p===6||p===26||p===27){n=u=o;continue t}s=s.parentNode}}n=n.return}$o(function(){var T=u,U=Ji(e),H=[];t:{var O=Tr.get(t);if(O!==void 0){var _=Au,St=t;switch(t){case"keypress":if(xu(e)===0)break t;case"keydown":case"keyup":_=Dy;break;case"focusin":St="focus",_=tc;break;case"focusout":St="blur",_=tc;break;case"beforeblur":case"afterblur":_=tc;break;case"click":if(e.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":_=Fo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":_=py;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":_=By;break;case Sr:case xr:case Mr:_=Sy;break;case Ar:_=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":_=lr;break;case"toggle":case"beforetoggle":_=Gy}var vt=(l&4)!==0,jt=!vt&&(t==="scroll"||t==="scrollend"),M=vt?O!==null?O+"Capture":null:O;vt=[];for(var x=T,A;x!==null;){var B=x;if(A=B.stateNode,B=B.tag,B!==5&&B!==26&&B!==27||A===null||M===null||(B=ya(x,M),B!=null&&vt.push($a(x,B,A))),jt)break;x=x.return}0<vt.length&&(O=new _(O,St,null,e,U),H.push({event:O,listeners:vt}))}}if(!(l&7)){t:{if(O=t==="mouseover"||t==="pointerover",_=t==="mouseout"||t==="pointerout",O&&e!==ki&&(St=e.relatedTarget||e.fromElement)&&(xn(St)||St[Sn]))break t;if((_||O)&&(O=U.window===U?U:(O=U.ownerDocument)?O.defaultView||O.parentWindow:window,_?(St=e.relatedTarget||e.toElement,_=T,St=St?xn(St):null,St!==null&&(jt=v(St),vt=St.tag,St!==jt||vt!==5&&vt!==27&&vt!==6)&&(St=null)):(_=null,St=T),_!==St)){if(vt=Fo,B="onMouseLeave",M="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(vt=lr,B="onPointerLeave",M="onPointerEnter",x="pointer"),jt=_==null?O:ha(_),A=St==null?O:ha(St),O=new vt(B,x+"leave",_,e,U),O.target=jt,O.relatedTarget=A,B=null,xn(U)===T&&(vt=new vt(M,x+"enter",St,e,U),vt.target=A,vt.relatedTarget=jt,B=vt),jt=B,_&&St)l:{for(vt=_,M=St,x=0,A=vt;A;A=la(A))x++;for(A=0,B=M;B;B=la(B))A++;for(;0<x-A;)vt=la(vt),x--;for(;0<A-x;)M=la(M),A--;for(;x--;){if(vt===M||M!==null&&vt===M.alternate)break l;vt=la(vt),M=la(M)}vt=null}else vt=null;_!==null&&Zd(H,O,_,vt,!1),St!==null&&jt!==null&&Zd(H,jt,St,vt,!0)}}t:{if(O=T?ha(T):window,_=O.nodeName&&O.nodeName.toLowerCase(),_==="select"||_==="input"&&O.type==="file")var F=or;else if(cr(O))if(rr)F=Jy;else{F=Ky;var zt=Ly}else _=O.nodeName,!_||_.toLowerCase()!=="input"||O.type!=="checkbox"&&O.type!=="radio"?T&&Ki(T.elementType)&&(F=or):F=ky;if(F&&(F=F(t,T))){fr(H,F,e,U);break t}zt&&zt(t,O,T),t==="focusout"&&T&&O.type==="number"&&T.memoizedProps.value!=null&&Li(O,"number",O.value)}switch(zt=T?ha(T):window,t){case"focusin":(cr(zt)||zt.contentEditable==="true")&&(Un=zt,ic=T,Ma=null);break;case"focusout":Ma=ic=Un=null;break;case"mousedown":cc=!0;break;case"contextmenu":case"mouseup":case"dragend":cc=!1,gr(H,e,U);break;case"selectionchange":if($y)break;case"keydown":case"keyup":gr(H,e,U)}var at;if(ec)t:{switch(t){case"compositionstart":var pt="onCompositionStart";break t;case"compositionend":pt="onCompositionEnd";break t;case"compositionupdate":pt="onCompositionUpdate";break t}pt=void 0}else Rn?ur(t,e)&&(pt="onCompositionEnd"):t==="keydown"&&e.keyCode===229&&(pt="onCompositionStart");pt&&(er&&e.locale!=="ko"&&(Rn||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&Rn&&(at=Io()):(De=U,Ii="value"in De?De.value:De.textContent,Rn=!0)),zt=ri(T,pt),0<zt.length&&(pt=new tr(pt,t,null,e,U),H.push({event:pt,listeners:zt}),at?pt.data=at:(at=ir(e),at!==null&&(pt.data=at)))),(at=wy?jy(t,e):Qy(t,e))&&(pt=ri(T,"onBeforeInput"),0<pt.length&&(zt=new tr("onBeforeInput","beforeinput",null,e,U),H.push({event:zt,listeners:pt}),zt.data=at)),Bm(H,t,T,e,U)}Qd(H,l)})}function $a(t,l,e){return{instance:t,listener:l,currentTarget:e}}function ri(t,l){for(var e=l+"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,e),a!=null&&n.unshift($a(t,a,u)),a=ya(t,l),a!=null&&n.push($a(t,a,u))),t.tag===3)return n;t=t.return}return[]}function la(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Zd(t,l,e,n,a){for(var u=l._reactName,o=[];e!==null&&e!==n;){var s=e,p=s.alternate,T=s.stateNode;if(s=s.tag,p!==null&&p===n)break;s!==5&&s!==26&&s!==27||T===null||(p=T,a?(T=ya(e,u),T!=null&&o.unshift($a(e,T,p))):a||(T=ya(e,u),T!=null&&o.push($a(e,T,p)))),e=e.return}o.length!==0&&t.push({event:l,listeners:o})}var Cm=/\r\n?/g,Ym=/\u0000|\uFFFD/g;function Ld(t){return(typeof t=="string"?t:""+t).replace(Cm,`
|
|
41
|
-
`).replace(Ym,"")}function Kd(t,l){return l=Ld(l),Ld(t)===l}function si(){}function wt(t,l,e,n,a,u){switch(e){case"children":typeof n=="string"?l==="body"||l==="textarea"&&n===""||_n(t,n):(typeof n=="number"||typeof n=="bigint")&&l!=="body"&&_n(t,""+n);break;case"className":vu(t,"class",n);break;case"tabIndex":vu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":vu(t,e,n);break;case"style":Jo(t,n,u);break;case"data":if(l!=="object"){vu(t,"data",n);break}case"src":case"href":if(n===""&&(l!=="a"||e!=="href")){t.removeAttribute(e);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(e);break}n=bu(""+n),t.setAttribute(e,n);break;case"action":case"formAction":if(typeof n=="function"){t.setAttribute(e,"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"&&(e==="formAction"?(l!=="input"&&wt(t,l,"name",a.name,a,null),wt(t,l,"formEncType",a.formEncType,a,null),wt(t,l,"formMethod",a.formMethod,a,null),wt(t,l,"formTarget",a.formTarget,a,null)):(wt(t,l,"encType",a.encType,a,null),wt(t,l,"method",a.method,a,null),wt(t,l,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(e);break}n=bu(""+n),t.setAttribute(e,n);break;case"onClick":n!=null&&(t.onclick=si);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(e=n.__html,e!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=e}}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}e=bu(""+n),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e);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(e,""+n):t.removeAttribute(e);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(e,""):t.removeAttribute(e);break;case"capture":case"download":n===!0?t.setAttribute(e,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(e,n):t.removeAttribute(e);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?t.setAttribute(e,n):t.removeAttribute(e);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?t.removeAttribute(e):t.setAttribute(e,n);break;case"popover":Rt("beforetoggle",t),Rt("toggle",t),mu(t,"popover",n);break;case"xlinkActuate":he(t,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":he(t,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":he(t,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":he(t,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":he(t,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":he(t,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":he(t,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":he(t,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":he(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<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(e=hy.get(e)||e,mu(t,e,n))}}function Uf(t,l,e,n,a,u){switch(e){case"style":Jo(t,n,u);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(e=n.__html,e!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=e}}break;case"children":typeof n=="string"?_n(t,n):(typeof n=="number"||typeof n=="bigint")&&_n(t,""+n);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"onClick":n!=null&&(t.onclick=si);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yo.hasOwnProperty(e))t:{if(e[0]==="o"&&e[1]==="n"&&(a=e.endsWith("Capture"),l=e.slice(2,a?e.length-7:void 0),u=t[Rl]||null,u=u!=null?u[e]:null,typeof u=="function"&&t.removeEventListener(l,u,a),typeof n=="function")){typeof u!="function"&&u!==null&&(e in t?t[e]=null:t.hasAttribute(e)&&t.removeAttribute(e)),t.addEventListener(l,n,a);break t}e in t?t[e]=n:n===!0?t.setAttribute(e,""):mu(t,e,n)}}}function gl(t,l,e){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",t),Rt("load",t);var n=!1,a=!1,u;for(u in e)if(e.hasOwnProperty(u)){var o=e[u];if(o!=null)switch(u){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,l));default:wt(t,l,u,o,e,null)}}a&&wt(t,l,"srcSet",e.srcSet,e,null),n&&wt(t,l,"src",e.src,e,null);return;case"input":Rt("invalid",t);var s=u=o=a=null,p=null,T=null;for(n in e)if(e.hasOwnProperty(n)){var U=e[n];if(U!=null)switch(n){case"name":a=U;break;case"type":o=U;break;case"checked":p=U;break;case"defaultChecked":T=U;break;case"value":u=U;break;case"defaultValue":s=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,l));break;default:wt(t,l,n,U,e,null)}}Zo(t,u,s,p,T,o,a,!1),pu(t);return;case"select":Rt("invalid",t),n=o=u=null;for(a in e)if(e.hasOwnProperty(a)&&(s=e[a],s!=null))switch(a){case"value":u=s;break;case"defaultValue":o=s;break;case"multiple":n=s;default:wt(t,l,a,s,e,null)}l=u,e=o,t.multiple=!!n,l!=null?On(t,!!n,l,!1):e!=null&&On(t,!!n,e,!0);return;case"textarea":Rt("invalid",t),u=a=n=null;for(o in e)if(e.hasOwnProperty(o)&&(s=e[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,l,o,s,e,null)}Ko(t,n,a,u),pu(t);return;case"option":for(p in e)if(e.hasOwnProperty(p)&&(n=e[p],n!=null))switch(p){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,l,p,n,e,null)}return;case"dialog":Rt("beforetoggle",t),Rt("toggle",t),Rt("cancel",t),Rt("close",t);break;case"iframe":case"object":Rt("load",t);break;case"video":case"audio":for(n=0;n<Pa.length;n++)Rt(Pa[n],t);break;case"image":Rt("error",t),Rt("load",t);break;case"details":Rt("toggle",t);break;case"embed":case"source":case"link":Rt("error",t),Rt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in e)if(e.hasOwnProperty(T)&&(n=e[T],n!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,l));default:wt(t,l,T,n,e,null)}return;default:if(Ki(l)){for(U in e)e.hasOwnProperty(U)&&(n=e[U],n!==void 0&&Uf(t,l,U,n,e,void 0));return}}for(s in e)e.hasOwnProperty(s)&&(n=e[s],n!=null&&wt(t,l,s,n,e,null))}function Gm(t,l,e,n){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,u=null,o=null,s=null,p=null,T=null,U=null;for(_ in e){var H=e[_];if(e.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":p=H;default:n.hasOwnProperty(_)||wt(t,l,_,null,n,H)}}for(var O in n){var _=n[O];if(H=e[O],n.hasOwnProperty(O)&&(_!=null||H!=null))switch(O){case"type":u=_;break;case"name":a=_;break;case"checked":T=_;break;case"defaultChecked":U=_;break;case"value":o=_;break;case"defaultValue":s=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(f(137,l));break;default:_!==H&&wt(t,l,O,_,n,H)}}Zi(t,o,s,p,T,U,u,a);return;case"select":_=o=s=O=null;for(u in e)if(p=e[u],e.hasOwnProperty(u)&&p!=null)switch(u){case"value":break;case"multiple":_=p;default:n.hasOwnProperty(u)||wt(t,l,u,null,n,p)}for(a in n)if(u=n[a],p=e[a],n.hasOwnProperty(a)&&(u!=null||p!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==p&&wt(t,l,a,u,n,p)}l=s,e=o,n=_,O!=null?On(t,!!e,O,!1):!!n!=!!e&&(l!=null?On(t,!!e,l,!0):On(t,!!e,e?[]:"",!1));return;case"textarea":_=O=null;for(s in e)if(a=e[s],e.hasOwnProperty(s)&&a!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:wt(t,l,s,null,n,a)}for(o in n)if(a=n[o],u=e[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,l,o,a,n,u)}Lo(t,O,_);return;case"option":for(var St in e)if(O=e[St],e.hasOwnProperty(St)&&O!=null&&!n.hasOwnProperty(St))switch(St){case"selected":t.selected=!1;break;default:wt(t,l,St,null,n,O)}for(p in n)if(O=n[p],_=e[p],n.hasOwnProperty(p)&&O!==_&&(O!=null||_!=null))switch(p){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,l,p,O,n,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var vt in e)O=e[vt],e.hasOwnProperty(vt)&&O!=null&&!n.hasOwnProperty(vt)&&wt(t,l,vt,null,n,O);for(T in n)if(O=n[T],_=e[T],n.hasOwnProperty(T)&&O!==_&&(O!=null||_!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,l));break;default:wt(t,l,T,O,n,_)}return;default:if(Ki(l)){for(var jt in e)O=e[jt],e.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Uf(t,l,jt,void 0,n,O);for(U in n)O=n[U],_=e[U],!n.hasOwnProperty(U)||O===_||O===void 0&&_===void 0||Uf(t,l,U,O,n,_);return}}for(var M in e)O=e[M],e.hasOwnProperty(M)&&O!=null&&!n.hasOwnProperty(M)&&wt(t,l,M,null,n,O);for(H in n)O=n[H],_=e[H],!n.hasOwnProperty(H)||O===_||O==null&&_==null||wt(t,l,H,O,n,_)}var Bf=null,Nf=null;function di(t){return t.nodeType===9?t:t.ownerDocument}function kd(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Jd(t,l){if(t===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&l==="foreignObject"?0:t}function Hf(t,l){return t==="textarea"||t==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var qf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===qf?!1:(qf=t,!0):(qf=null,!1)}var Pd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,$d=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof $d!="undefined"?function(t){return $d.resolve(null).then(t).catch(Qm)}:Pd;function Qm(t){setTimeout(function(){throw t})}function Le(t){return t==="head"}function Id(t,l){var e=l,n=0,a=0;do{var u=e.nextSibling;if(t.removeChild(e),u&&u.nodeType===8)if(e=u.data,e==="/$"){if(0<n&&8>n){e=n;var o=t.ownerDocument;if(e&1&&Ia(o.documentElement),e&2&&Ia(o.body),e&4)for(e=o.head,Ia(e),o=e.firstChild;o;){var s=o.nextSibling,p=o.nodeName;o[da]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&o.rel.toLowerCase()==="stylesheet"||e.removeChild(o),o=s}}if(a===0){t.removeChild(u),uu(l);return}a--}else e==="$"||e==="$?"||e==="$!"?a++:n=e.charCodeAt(0)-48;else n=0;e=u}while(e);uu(l)}function Cf(t){var l=t.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var e=l;switch(l=l.nextSibling,e.nodeName){case"HTML":case"HEAD":case"BODY":Cf(e),wi(e);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(e.rel.toLowerCase()==="stylesheet")continue}t.removeChild(e)}}function Vm(t,l,e,n){for(;t.nodeType===1;){var a=e;if(t.nodeName.toLowerCase()!==l.toLowerCase()){if(!n&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(n){if(!t[da])switch(l){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(l==="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=le(t.nextSibling),t===null)break}return null}function Zm(t,l,e){if(l==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=le(t.nextSibling),t===null))return null;return t}function Yf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function Lm(t,l){var e=t.ownerDocument;if(t.data!=="$?"||e.readyState==="complete")l();else{var n=function(){l(),e.removeEventListener("DOMContentLoaded",n)};e.addEventListener("DOMContentLoaded",n),t._reactRetry=n}}function le(t){for(;t!=null;t=t.nextSibling){var l=t.nodeType;if(l===1||l===3)break;if(l===8){if(l=t.data,l==="$"||l==="$!"||l==="$?"||l==="F!"||l==="F")break;if(l==="/$")return null}}return t}var Gf=null;function Wd(t){t=t.previousSibling;for(var l=0;t;){if(t.nodeType===8){var e=t.data;if(e==="$"||e==="$!"||e==="$?"){if(l===0)return t;l--}else e==="/$"&&l++}t=t.previousSibling}return null}function Fd(t,l,e){switch(l=di(e),t){case"html":if(t=l.documentElement,!t)throw Error(f(452));return t;case"head":if(t=l.head,!t)throw Error(f(453));return t;case"body":if(t=l.body,!t)throw Error(f(454));return t;default:throw Error(f(451))}}function Ia(t){for(var l=t.attributes;l.length;)t.removeAttributeNode(l[0]);wi(t)}var Wl=new Map,th=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _e=w.d;w.d={f:Km,r:km,D:Jm,C:Pm,L:$m,m:Im,X:Fm,S:Wm,M:tv};function Km(){var t=_e.f(),l=ai();return t||l}function km(t){var l=Mn(t);l!==null&&l.tag===5&&l.type==="form"?Ss(l):_e.r(t)}var ea=typeof document=="undefined"?null:document;function lh(t,l,e){var n=ea;if(n&&typeof l=="string"&&l){var a=Ll(l);a='link[rel="'+t+'"][href="'+a+'"]',typeof e=="string"&&(a+='[crossorigin="'+e+'"]'),th.has(a)||(th.add(a),t={rel:t,crossOrigin:e,href:l},n.querySelector(a)===null&&(l=n.createElement("link"),gl(l,"link",t),sl(l),n.head.appendChild(l)))}}function Jm(t){_e.D(t),lh("dns-prefetch",t,null)}function Pm(t,l){_e.C(t,l),lh("preconnect",t,l)}function $m(t,l,e){_e.L(t,l,e);var n=ea;if(n&&t&&l){var a='link[rel="preload"][as="'+Ll(l)+'"]';l==="image"&&e&&e.imageSrcSet?(a+='[imagesrcset="'+Ll(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(a+='[imagesizes="'+Ll(e.imageSizes)+'"]')):a+='[href="'+Ll(t)+'"]';var u=a;switch(l){case"style":u=na(t);break;case"script":u=aa(t)}Wl.has(u)||(t=g({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),Wl.set(u,t),n.querySelector(a)!==null||l==="style"&&n.querySelector(Wa(u))||l==="script"&&n.querySelector(Fa(u))||(l=n.createElement("link"),gl(l,"link",t),sl(l),n.head.appendChild(l)))}}function Im(t,l){_e.m(t,l);var e=ea;if(e&&t){var n=l&&typeof l.as=="string"?l.as:"script",a='link[rel="modulepreload"][as="'+Ll(n)+'"][href="'+Ll(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!Wl.has(u)&&(t=g({rel:"modulepreload",href:t},l),Wl.set(u,t),e.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Fa(u)))return}n=e.createElement("link"),gl(n,"link",t),sl(n),e.head.appendChild(n)}}}function Wm(t,l,e){_e.S(t,l,e);var n=ea;if(n&&t){var a=An(n).hoistableStyles,u=na(t);l=l||"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":l},e),(e=Wl.get(u))&&Xf(t,e);var p=o=n.createElement("link");sl(p),gl(p,"link",t),p._p=new Promise(function(T,U){p.onload=T,p.onerror=U}),p.addEventListener("load",function(){s.loading|=1}),p.addEventListener("error",function(){s.loading|=2}),s.loading|=4,yi(o,l,n)}o={type:"stylesheet",instance:o,count:1,state:s},a.set(u,o)}}}function Fm(t,l){_e.X(t,l);var e=ea;if(e&&t){var n=An(e).hoistableScripts,a=aa(t),u=n.get(a);u||(u=e.querySelector(Fa(a)),u||(t=g({src:t,async:!0},l),(l=Wl.get(a))&&wf(t,l),u=e.createElement("script"),sl(u),gl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function tv(t,l){_e.M(t,l);var e=ea;if(e&&t){var n=An(e).hoistableScripts,a=aa(t),u=n.get(a);u||(u=e.querySelector(Fa(a)),u||(t=g({src:t,async:!0,type:"module"},l),(l=Wl.get(a))&&wf(t,l),u=e.createElement("script"),sl(u),gl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function eh(t,l,e,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 e.precedence=="string"&&typeof e.href=="string"?(l=na(e.href),e=An(a).hoistableStyles,n=e.get(l),n||(n={type:"style",instance:null,count:0,state:null},e.set(l,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=na(e.href);var u=An(a).hoistableStyles,o=u.get(t);if(o||(a=a.ownerDocument||a,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,o),(u=a.querySelector(Wa(t)))&&!u._p&&(o.instance=u,o.state.loading=5),Wl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Wl.set(t,e),u||lv(a,t,e,o.state))),l&&n===null)throw Error(f(528,""));return o}if(l&&n!==null)throw Error(f(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=aa(e),e=An(a).hoistableScripts,n=e.get(l),n||(n={type:"script",instance:null,count:0,state:null},e.set(l,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,t))}}function na(t){return'href="'+Ll(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function nh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function lv(t,l,e,n){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?n.loading=1:(l=t.createElement("link"),n.preload=l,l.addEventListener("load",function(){return n.loading|=1}),l.addEventListener("error",function(){return n.loading|=2}),gl(l,"link",e),sl(l),t.head.appendChild(l))}function aa(t){return'[src="'+Ll(t)+'"]'}function Fa(t){return"script[async]"+t}function ah(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var n=t.querySelector('style[data-href~="'+Ll(e.href)+'"]');if(n)return l.instance=n,sl(n),n;var a=g({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return n=(t.ownerDocument||t).createElement("style"),sl(n),gl(n,"style",a),yi(n,e.precedence,t),l.instance=n;case"stylesheet":a=na(e.href);var u=t.querySelector(Wa(a));if(u)return l.state.loading|=4,l.instance=u,sl(u),u;n=nh(e),(a=Wl.get(a))&&Xf(n,a),u=(t.ownerDocument||t).createElement("link"),sl(u);var o=u;return o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),gl(u,"link",n),l.state.loading|=4,yi(u,e.precedence,t),l.instance=u;case"script":return u=aa(e.src),(a=t.querySelector(Fa(u)))?(l.instance=a,sl(a),a):(n=e,(a=Wl.get(u))&&(n=g({},e),wf(n,a)),t=t.ownerDocument||t,a=t.createElement("script"),sl(a),gl(a,"link",n),t.head.appendChild(a),l.instance=a);case"void":return null;default:throw Error(f(443,l.type))}else l.type==="stylesheet"&&!(l.state.loading&4)&&(n=l.instance,l.state.loading|=4,yi(n,e.precedence,t));return l.instance}function yi(t,l,e){for(var n=e.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===l)u=s;else if(u!==a)break}u?u.parentNode.insertBefore(t,u.nextSibling):(l=e.nodeType===9?e.head:e,l.insertBefore(t,l.firstChild))}function Xf(t,l){t.crossOrigin==null&&(t.crossOrigin=l.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=l.referrerPolicy),t.title==null&&(t.title=l.title)}function wf(t,l){t.crossOrigin==null&&(t.crossOrigin=l.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=l.referrerPolicy),t.integrity==null&&(t.integrity=l.integrity)}var mi=null;function uh(t,l,e){if(mi===null){var n=new Map,a=mi=new Map;a.set(e,n)}else a=mi,n=a.get(e),n||(n=new Map,a.set(e,n));if(n.has(t))return n;for(n.set(t,null),e=e.getElementsByTagName(t),a=0;a<e.length;a++){var u=e[a];if(!(u[da]||u[Sl]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var o=u.getAttribute(l)||"";o=t+o;var s=n.get(o);s?s.push(u):n.set(o,[u])}}return n}function ih(t,l,e){t=t.ownerDocument||t,t.head.insertBefore(e,l==="title"?t.querySelector("head > title"):null)}function ev(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function ch(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}var tu=null;function nv(){}function av(t,l,e){if(tu===null)throw Error(f(475));var n=tu;if(l.type==="stylesheet"&&(typeof e.media!="string"||matchMedia(e.media).matches!==!1)&&!(l.state.loading&4)){if(l.instance===null){var a=na(e.href),u=t.querySelector(Wa(a));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(n.count++,n=vi.bind(n),t.then(n,n)),l.state.loading|=4,l.instance=u,sl(u);return}u=t.ownerDocument||t,e=nh(e),(a=Wl.get(a))&&Xf(e,a),u=u.createElement("link"),sl(u);var o=u;o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),gl(u,"link",e),l.instance=u}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,t),(t=l.state.preload)&&!(l.state.loading&3)&&(n.count++,l=vi.bind(n),t.addEventListener("load",l),t.addEventListener("error",l))}}function uv(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&jf(t,t.stylesheets),0<t.count?function(l){var e=setTimeout(function(){if(t.stylesheets&&jf(t,t.stylesheets),t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}},6e4);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(e)}}:null}function vi(){if(this.count--,this.count===0){if(this.stylesheets)jf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pi=null;function jf(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pi=new Map,l.forEach(iv,t),pi=null,vi.call(t))}function iv(t,l){if(!(l.state.loading&4)){var e=pi.get(t);if(e)var n=e.get(null);else{e=new Map,pi.set(t,e);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")&&(e.set(o.dataset.precedence,o),n=o)}n&&e.set(null,n)}a=l.instance,o=a.getAttribute("data-precedence"),u=e.get(o)||n,u===n&&e.set(null,a),e.set(o,a),this.count++,n=vi.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),u?u.parentNode.insertBefore(a,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),l.state.loading|=4}}var lu={$$typeof:Q,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function cv(t,l,e,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=ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ue(0),this.hiddenUpdates=ue(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 fh(t,l,e,n,a,u,o,s,p,T,U,H){return t=new cv(t,l,e,o,s,p,T,H),l=1,u===!0&&(l|=24),u=Yl(3,null,null,l),t.current=u,u.stateNode=t,l=xc(),l.refCount++,t.pooledCache=l,l.refCount++,u.memoizedState={element:n,isDehydrated:e,cache:l},Ec(u),t}function oh(t){return t?(t=qn,t):qn}function rh(t,l,e,n,a,u){a=oh(a),n.context===null?n.context=a:n.pendingContext=a,n=Be(l),n.payload={element:e},u=u===void 0?null:u,u!==null&&(n.callback=u),e=Ne(t,n,l),e!==null&&(Ql(e,t,l),Ua(e,t,l))}function sh(t,l){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var e=t.retryLane;t.retryLane=e!==0&&e<l?e:l}}function Qf(t,l){sh(t,l),(t=t.alternate)&&sh(t,l)}function dh(t){if(t.tag===13){var l=Hn(t,67108864);l!==null&&Ql(l,t,67108864),Qf(t,67108864)}}var gi=!0;function fv(t,l,e,n){var a=D.T;D.T=null;var u=w.p;try{w.p=2,Vf(t,l,e,n)}finally{w.p=u,D.T=a}}function ov(t,l,e,n){var a=D.T;D.T=null;var u=w.p;try{w.p=8,Vf(t,l,e,n)}finally{w.p=u,D.T=a}}function Vf(t,l,e,n){if(gi){var a=Zf(n);if(a===null)Rf(t,l,n,bi,e),yh(t,n);else if(sv(a,t,l,e,n))n.stopPropagation();else if(yh(t,n),l&4&&-1<rv.indexOf(t)){for(;a!==null;){var u=Mn(a);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var o=cl(u.pendingLanes);if(o!==0){var s=u;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var p=1<<31-At(o);s.entanglements[1]|=p,o&=~p}se(u),!(Ct&6)&&(ei=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Ql(s,u,2),ai(),Qf(u,2)}if(u=Zf(n),u===null&&Rf(t,l,n,bi,e),u===a)break;a=u}a!==null&&n.stopPropagation()}else Rf(t,l,n,null,e)}}function Zf(t){return t=Ji(t),Lf(t)}var bi=null;function Lf(t){if(bi=null,t=xn(t),t!==null){var l=v(t);if(l===null)t=null;else{var e=l.tag;if(e===13){if(t=b(l),t!==null)return t;t=null}else if(e===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;t=null}else l!==t&&(t=null)}}return bi=t,null}function hh(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Wt()){case Zt:return 2;case Kt:return 8;case Pt:case Lt:return 32;case al:return 268435456;default:return 32}default:return 32}}var Kf=!1,Ke=null,ke=null,Je=null,eu=new Map,nu=new Map,Pe=[],rv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function yh(t,l){switch(t){case"focusin":case"focusout":Ke=null;break;case"dragenter":case"dragleave":ke=null;break;case"mouseover":case"mouseout":Je=null;break;case"pointerover":case"pointerout":eu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(l.pointerId)}}function au(t,l,e,n,a,u){return t===null||t.nativeEvent!==u?(t={blockedOn:l,domEventName:e,eventSystemFlags:n,nativeEvent:u,targetContainers:[a]},l!==null&&(l=Mn(l),l!==null&&dh(l)),t):(t.eventSystemFlags|=n,l=t.targetContainers,a!==null&&l.indexOf(a)===-1&&l.push(a),t)}function sv(t,l,e,n,a){switch(l){case"focusin":return Ke=au(Ke,t,l,e,n,a),!0;case"dragenter":return ke=au(ke,t,l,e,n,a),!0;case"mouseover":return Je=au(Je,t,l,e,n,a),!0;case"pointerover":var u=a.pointerId;return eu.set(u,au(eu.get(u)||null,t,l,e,n,a)),!0;case"gotpointercapture":return u=a.pointerId,nu.set(u,au(nu.get(u)||null,t,l,e,n,a)),!0}return!1}function mh(t){var l=xn(t.target);if(l!==null){var e=v(l);if(e!==null){if(l=e.tag,l===13){if(l=b(e),l!==null){t.blockedOn=l,Gi(t.priority,function(){if(e.tag===13){var n=jl();n=sa(n);var a=Hn(e,n);a!==null&&Ql(a,e,n),Qf(e,n)}});return}}else if(l===3&&e.stateNode.current.memoizedState.isDehydrated){t.blockedOn=e.tag===3?e.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Si(t){if(t.blockedOn!==null)return!1;for(var l=t.targetContainers;0<l.length;){var e=Zf(t.nativeEvent);if(e===null){e=t.nativeEvent;var n=new e.constructor(e.type,e);ki=n,e.target.dispatchEvent(n),ki=null}else return l=Mn(e),l!==null&&dh(l),t.blockedOn=e,!1;l.shift()}return!0}function vh(t,l,e){Si(t)&&e.delete(l)}function dv(){Kf=!1,Ke!==null&&Si(Ke)&&(Ke=null),ke!==null&&Si(ke)&&(ke=null),Je!==null&&Si(Je)&&(Je=null),eu.forEach(vh),nu.forEach(vh)}function xi(t,l){t.blockedOn===l&&(t.blockedOn=null,Kf||(Kf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dv)))}var Mi=null;function ph(t){Mi!==t&&(Mi=t,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Mi===t&&(Mi=null);for(var l=0;l<t.length;l+=3){var e=t[l],n=t[l+1],a=t[l+2];if(typeof n!="function"){if(Lf(n||e)===null)continue;break}var u=Mn(e);u!==null&&(t.splice(l,3),l-=3,Zc(u,{pending:!0,data:a,method:e.method,action:n},n,a))}}))}function uu(t){function l(p){return xi(p,t)}Ke!==null&&xi(Ke,t),ke!==null&&xi(ke,t),Je!==null&&xi(Je,t),eu.forEach(l),nu.forEach(l);for(var e=0;e<Pe.length;e++){var n=Pe[e];n.blockedOn===t&&(n.blockedOn=null)}for(;0<Pe.length&&(e=Pe[0],e.blockedOn===null);)mh(e),e.blockedOn===null&&Pe.shift();if(e=(t.ownerDocument||t).$$reactFormReplay,e!=null)for(n=0;n<e.length;n+=3){var a=e[n],u=e[n+1],o=a[Rl]||null;if(typeof u=="function")o||ph(e);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Rl]||null)s=o.formAction;else if(Lf(a)!==null)continue}else s=o.action;typeof s=="function"?e[n+1]=s:(e.splice(n,3),n-=3),ph(e)}}}function kf(t){this._internalRoot=t}Ai.prototype.render=kf.prototype.render=function(t){var l=this._internalRoot;if(l===null)throw Error(f(409));var e=l.current,n=jl();rh(e,n,t,l,null,null)},Ai.prototype.unmount=kf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var l=t.containerInfo;rh(t.current,2,null,t,null,null),ai(),l[Sn]=null}};function Ai(t){this._internalRoot=t}Ai.prototype.unstable_scheduleHydration=function(t){if(t){var l=bn();t={blockedOn:null,target:t,priority:l};for(var e=0;e<Pe.length&&l!==0&&l<Pe[e].priority;e++);Pe.splice(e,0,t),e===0&&mh(t)}};var gh=i.version;if(gh!=="19.1.1")throw Error(f(527,gh,"19.1.1"));w.findDOMNode=function(t){var l=t._reactInternals;if(l===void 0)throw typeof t.render=="function"?Error(f(188)):(t=Object.keys(t).join(","),Error(f(268,t)));return t=y(l),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var hv={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ti=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ti.isDisabled&&Ti.supportsFiber)try{Ut=Ti.inject(hv),ft=Ti}catch(t){}}return ua.createRoot=function(t,l){if(!h(t))throw Error(f(299));var e=!1,n="",a=Hs,u=qs,o=Cs,s=null;return l!=null&&(l.unstable_strictMode===!0&&(e=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(a=l.onUncaughtError),l.onCaughtError!==void 0&&(u=l.onCaughtError),l.onRecoverableError!==void 0&&(o=l.onRecoverableError),l.unstable_transitionCallbacks!==void 0&&(s=l.unstable_transitionCallbacks)),l=fh(t,1,!1,null,null,e,n,a,u,o,s,null),t[Sn]=l.current,Df(t),new kf(l)},ua.hydrateRoot=function(t,l,e){if(!h(t))throw Error(f(299));var n=!1,a="",u=Hs,o=qs,s=Cs,p=null,T=null;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(a=e.identifierPrefix),e.onUncaughtError!==void 0&&(u=e.onUncaughtError),e.onCaughtError!==void 0&&(o=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError),e.unstable_transitionCallbacks!==void 0&&(p=e.unstable_transitionCallbacks),e.formState!==void 0&&(T=e.formState)),l=fh(t,1,!0,l,e!=null?e:null,n,a,u,o,s,p,T),l.context=oh(null),e=l.current,n=jl(),n=sa(n),a=Be(n),a.callback=null,Ne(e,a,n),e=n,l.current.lanes=e,El(l,e),se(l),t[Sn]=l.current,Df(t),new Ai(l)},ua.version="19.1.1",ua}function ao(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ao)}catch(c){console.error(c)}}ao(),If.exports=zh();var Dh=If.exports;const k={color:{bands:{silhouette:{fillEven:"#eef2ff",fillOdd:"#f6f7fb",stroke:"#c7d2fe"},workspace:{fillEven:"#f3f4f6",fillOdd:"#f9fafb",stroke:"#e5e7eb"}},completion:{fill:"#dcfce7",stroke:"#86efac"},silhouetteMask:"#94a3b8",anchors:{invalid:"#7dd3fc",valid:"#475569"},piece:{draggingFill:"#1d4ed8",validFill:"#60a5fa",invalidFill:"#ef4444",invalidStroke:"#dc2626",selectedStroke:"#111827",allGreenStroke:"#86efac",borderStroke:"#374151"},ui:{light:"#60a5fa",dark:"#1d4ed8"},blueprint:{fill:"#374151",selectedStroke:"#111827",badgeFill:"#eef2ff",labelFill:"#374151"}},opacity:{blueprint:.95,silhouetteMask:.45,anchors:{valid:.8,invalid:.5},piece:{invalid:.35,dragging:.6,locked:.7,normal:.95}},size:{stroke:{bandPx:1,pieceSelectedPx:1.5,allGreenStrokePx:6,pieceBorderPx:1},anchorRadiusPx:{valid:1,invalid:1},badgeFontPx:12,centerBadge:{fractionOfOuterR:.15,minPx:20,marginPx:4}},layout:{grid:{stepPx:20,unitPx:40},paddingPx:1,constraints:{workspaceDiamAnchors:10,quickstashDiamAnchors:7,primitiveDiamAnchors:5},defaults:{maxQuickstashSlots:1}},game:{snapRadiusPx:15,showBorders:!0,hideTouchingBorders:!0}};function Rh(c){return c.parts!==void 0}function Uh(c){return!Rh(c)}class Bh{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),Uh(i)&&this.primitivesByKind.set(i.kind,i)}get(i){return this.byId.get(i)}getPrimitive(i){return this.primitivesByKind.get(i)}}var Nh=Object.defineProperty,Hh=Object.defineProperties,qh=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,Ch=Object.prototype.hasOwnProperty,Yh=Object.prototype.propertyIsEnumerable,io=(c,i,r)=>i in c?Nh(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,zi=(c,i)=>{for(var r in i||(i={}))Ch.call(i,r)&&io(c,r,i[r]);if(uo)for(var r of uo(i))Yh.call(i,r)&&io(c,r,i[r]);return c},Gh=(c,i)=>Hh(c,qh(i));let Xh=0;const wh=()=>`p_${++Xh}`,iu=()=>performance.now();class jh{constructor(i,r,f,h){if(this.registry=new Bh,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(),console.log("[BaseGameController] all sectors complete")))}spawnFromBlueprint(i,r){const f=wh(),h={id:f,blueprintId:i.id,pos:zi({},r)};return this.getFloating().pieces.push(h),this.notifyStateChange(),f}move(i,r){const f=this.findPiece(i);f&&(f.pos=zi({},r),this.notifyStateChange())}drop(i,r){const f=this.findPiece(i);if(!f)return;const h=this.findPieceLocation(i);if(this.removeFromCurrent(i),h!=null&&h.sectorId&&delete f.sectorId,!r){this.getFloating().pieces.push(f),this.notifyStateChange();return}if(this.isSectorCompleted(r)){this.notifyStateChange();return}const v=this.state.sectors[r];v&&(v.pieces.push(f),f.sectorId=r,this.notifyStateChange())}remove(i){const r=this.findPieceLocation(i);r&&(r.array.splice(r.index,1),this.notifyStateChange())}findPiece(i){var r;for(const f of Object.values(this.state.sectors)){const h=f.pieces.find(v=>v.id===i);if(h)return h}return(r=this.getFloating().pieces.find(f=>f.id===i))!=null?r:null}getFloating(){return this._floating||(this._floating={sectorId:"-floating-",pieces:[]}),this._floating}findPieceLocation(i){for(const h of Object.values(this.state.sectors)){const v=h,b=v.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:v.sectorId,array:v.pieces,index:b}}const r=this.getFloating(),f=r.pieces.findIndex(h=>h.id===i);return f>=0?{array:r.pieces,index:f}:null}removeFromCurrent(i){const r=this.findPieceLocation(i);r&&r.array.splice(r.index,1)}switchBlueprintView(){if(this.config.mode==="prep")return;const i=this.state.blueprintView==="primitives"?"quickstash":"primitives";this.state.blueprintView=i}isSubmitEnabled(){var i,r,f;if(this.config.mode!=="prep")return!0;const h=(i=this.config.minPiecesPerMacro)!=null?i:2,v=(r=this.config.maxCompositeSize)!=null?r:1/0,b=(f=this.config.requireAllSlots)!=null?f:!1,S=Object.values(this.state.sectors);let y=0;for(const m of S){const g=m.pieces.length;if(g>=h&&g<=v)y++;else if(g>0)return!1}return b?y===S.length:!0}snapshot(){return{perSector:Object.values(this.state.sectors).map(i=>{const r=i,f={sectorId:r.sectorId,pieceCount:r.pieces.length};return r.completedAt?Gh(zi({},f),{completedAt:r.completedAt}):f}),events:[],timeMs:iu()-this.t0,completed:!!this.state.endedAt}}}function Qh(c,i,r,f=1e-9){const h=(r.y-i.y)*(c.x-i.x)-(r.x-i.x)*(c.y-i.y);if(Math.abs(h)>f)return!1;const v=Math.min(i.x,r.x)-f,b=Math.max(i.x,r.x)+f,S=Math.min(i.y,r.y)-f,y=Math.max(i.y,r.y)+f;return c.x>=v&&c.x<=b&&c.y>=S&&c.y<=y}function cu(c,i){for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[h],b=i[f];if(!(!v||!b)&&Qh(c,v,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[f],b=i[h];if(!v||!b)continue;const S=v.x,y=v.y,m=b.x,g=b.y;y>c.y!=g>c.y&&c.x<(m-S)*(c.y-y)/(g-y+1e-12)+S&&(r=!r)}return r}function co(c,i,r){let f=1/0,h=-1/0;for(const v of c){const b=v.x*i+v.y*r;b<f&&(f=b),b>h&&(h=b)}return{min:f,max:h}}const mn=1e-6;function Vh(c,i){const r=[c,i];for(const f of r)for(let h=0;h<f.length;h++){const v=f[h],b=f[(h+1)%f.length];if(!v||!b)continue;const S=b.x-v.x,y=-(b.y-v.y),m=S,g=co(c,y,m),E=co(i,y,m);if(g.max<=E.min+mn||E.max<=g.min+mn)return!1}return!0}function Zh(c,i){const r=c.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let v=0;v<i.length;v++){const b=c[h],S=i[v],y=r[h],m=f[v];if(!(!b||!S||!y||!m)&&!(y.maxX<=m.minX+mn||m.maxX<=y.minX+mn||y.maxY<=m.minY+mn||m.maxY<=y.minY+mn)&&Vh(b,S))return!0}return!1}function Lh(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b,cx:(i+f)/2,cy:(r+h)/2}}function fo(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b}}function oo(c){return fo(c.shape)}function Kh(c,i){if(c.shape&&c.shape.length)return fo(c.shape);let r=1/0,f=1/0,h=-1/0,v=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=oo(m),E=y.offset.x+g.min.x,R=y.offset.y+g.min.y,X=y.offset.x+g.max.x,j=y.offset.y+g.max.y;E<r&&(r=E),R<f&&(f=R),X>h&&(h=X),j>v&&(v=j)}const b=Math.max(0,h-r),S=Math.max(0,v-f);return{min:{x:r,y:f},max:{x:h,y:v},width:b,height:S}}function It(c,i){return"parts"in c?Kh(c,i):oo(c)}const Ml=k.layout.grid.stepPx;function vn(c,i,r){const f=r.x-i.min.x,h=r.y-i.min.y;return("shape"in c&&c.shape?c.shape:[]).map(v=>v.map(b=>({x:b.x+f,y:b.y+h})))}function ia(c,i){const r=i.min.x+i.width/2,f=i.min.y+i.height/2,h="shape"in c&&c.shape&&c.shape.length?c.shape:[[{x:i.min.x,y:i.min.y},{x:i.min.x+i.width,y:i.min.y},{x:i.min.x+i.width,y:i.min.y+i.height},{x:i.min.x,y:i.min.y+i.height}]],v=[];for(const b of h)for(const S of b)v.push({x:S.x-r,y:S.y-f});return v}function ca(c,i,r,f,h,v){const b=c+r.aabb.width/2,S=i+r.aabb.height/2,y=b-f.cx,m=S-f.cy,g=Math.hypot(y,m);if(g===0)return{x:c,y:i};const E=y/g,R=m/g;let X=-1/0,j=-1/0;for(const K of r.support){const $=K.x*E+K.y*R;$>X&&(X=$);const gt=-(K.x*E+K.y*R);gt>j&&(j=gt)}if(h==="workspace"){const[K,$]=f.bands.workspace,gt=v?0:K+j,bt=$-X,Q=Math.min(Math.max(g,gt),bt);if(Math.abs(Q-g)<1e-6)return{x:c,y:i};const ut=f.cx+Q*E,Z=f.cy+Q*R;return{x:ut-r.aabb.width/2,y:Z-r.aabb.height/2}}else{const K=f.bands.silhouette[1]-X;if(g<=K)return{x:c,y:i};const $=f.cx+K*E,gt=f.cy+K*R;return{x:$-r.aabb.width/2,y:gt-r.aabb.height/2}}}function ro(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function kh(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ro(i,b):b),S&&(i=i?ro(i,S):S)}return i||1}function so(c,i,r){if(!c||c.length===0)return[];const f=Lh(c),h=(f.min.x+f.max.x)/2,v=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Ml)*Ml,S=Math.round(r.cy/Ml)*Ml,y=b-i*h,m=S-i*v,g=Math.round(y/Ml)*Ml,E=Math.round(m/Ml)*Ml;return c.map(R=>R.map(X=>({x:i*X.x+g,y:i*X.y+E})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Ml)*Ml,h=Math.ceil(c.y/Ml)*Ml;for(let v=h;v<=i.y;v+=Ml)for(let b=f;b<=i.x;b+=Ml)r.push({x:b,y:v});return r}function Di(c,i,r,f){const[h,v]=i.bands[r],b=[];for(const S of c){const y=S.x-i.cx,m=S.y-i.cy,g=Math.hypot(y,m);if(!(g<h||g>v)){if(f){let E=Math.atan2(m,y);if(i.mode==="circle"?E<-Math.PI/2&&(E+=2*Math.PI):E<Math.PI&&(E+=2*Math.PI),E<f.start||E>=f.end)continue}b.push(S)}}return b}function Jh(c,i,r=cu){const f=[];t:for(const h of c)for(const v of i)if(r(h,v)){f.push(h);continue t}return f}function Ph(c){const i={x:c.cx-c.innerR,y:c.cy-c.innerR-6},r={x:c.cx+c.innerR,y:c.cy+c.innerR+6},f=fu(i,r),h=[];for(const v of f){const b=v.x-c.cx,S=v.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(v)}return h}const ou=(c,i=Ml)=>c*Math.SQRT2*i;function ho(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function $h(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ho(i,b):b),S&&(i=i?ho(i,S):S)}return i||1}function Ih(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:v,cy:b}}function yo(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:v,primitivesSlots:b,gridPx:S=k.layout.grid.stepPx,reqWorkspaceDiamAnchors:y=k.layout.constraints.workspaceDiamAnchors,reqQuickstashDiamAnchors:m=k.layout.constraints.quickstashDiamAnchors,reqPrimitiveDiamAnchors:g=k.layout.constraints.primitiveDiamAnchors}=c,E=((i=c.masks)!=null?i:[]).flat(),R=E.length?$h(E):0,X=R?2*S/R:1;let j=0;if(c.masks&&c.masks.length)for(const w of c.masks){if(!(w!=null&&w.length))continue;const P=Ih(w),{cx:G,cy:d}=P;for(const z of w)for(const q of z){const C=(q.x-G)*X,J=(q.y-d)*X,it=Math.hypot(C,J);it>j&&(j=it)}}const K=f==="circle"?Math.PI*2:Math.PI,$=K/Math.max(1,r),gt=K/Math.max(1,v),bt=K/Math.max(1,b),Q=Math.sin($/2),ut=Math.sin(gt/2),Z=Math.sin(bt/2),ot=ou(y,S),I=ou(m,S),et=ou(g,S),tt=I*(.5+1/(2*Math.max(1e-9,ut))),rt=et*(.5+1/(2*Math.max(1e-9,Z))),Ot=ot/(2*Math.max(1e-9,Q))-ot/2,L=Math.max(tt,rt,Ot),xt=ot,dt=h==="workspace"?2*j:0,ht=xt+dt,D=L+ht;return{innerR_min:L,dr_min:ht,outerR_min:D,Tw_min:xt,Tp_min:dt,Rshape_px_max:j}}function Wh(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:v,D_ws_px:b}=c,S=f+h;if(i<r+S){const gt=r+S;return{innerR:r,Tw:f,Tp:h,outerR:gt}}const y=i,m=r,g=y-m,E=Math.max(0,g-S),R=1,X=1+v/Math.max(1e-9,b),j=E*(R/(R+X)),K=f+j,$=g-K;return{innerR:m,Tw:K,Tp:$,outerR:y}}function Fh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=yo(c);if(i==="circle"){const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h}}else{const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h/2}}}function t0(c,i,r,f="circle",h="workspace",v){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,E=f==="semicircle"?c.h-y:g,R=Math.min(m,E)-y,X=yo({n:i,layoutMode:f,target:h,qsMaxSlots:v.qsMaxSlots,primitivesSlots:v.primitivesSlots,masks:(b=v.masks)!=null?b:[]});let j,K,$;if(h==="workspace"){const ot=ou(k.layout.constraints.workspaceDiamAnchors),I=Wh({outerRViewportBound:R,innerR_min:X.innerR_min,Tw_min:X.Tw_min,Tp_min:X.Tp_min,Rshape_px_max:X.Rshape_px_max,D_ws_px:ot});j=I.innerR,K=I.outerR,$={workspace:[I.innerR,I.innerR+I.Tw],silhouette:[I.innerR+I.Tw,I.outerR]}}else K=Math.max(R,X.outerR_min),j=Math.min(X.innerR_min,K),K<X.outerR_min&&(K=X.outerR_min,j=X.innerR_min),$={silhouette:[j,K],workspace:[j,K]};const gt=f==="circle"?Math.PI*2:Math.PI,bt=f==="circle"?-Math.PI/2:Math.PI,Q=bt+gt,ut=gt/i,Z=[];for(let ot=0;ot<i;ot++){const I=(S=r[ot])!=null?S:String(ot),et=bt+ot*ut,tt=et+ut,rt=(et+tt)/2;Z.push({id:I,index:ot,start:et,end:tt,mid:rt})}return{mode:f,cx:m,cy:g,innerR:j,outerR:K,sectors:Z,bands:$,sweepStart:bt,sweepEnd:Q}}function Ri(c,i,r,f,h,v){const b=v-h>Math.PI?1:0,S=c+r*Math.cos(h),y=i+r*Math.sin(h),m=c+f*Math.cos(h),g=i+f*Math.sin(h),E=c+f*Math.cos(v),R=i+f*Math.sin(v),X=c+r*Math.cos(v),j=i+r*Math.sin(v);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${E} ${R}`,`L ${X} ${j}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function mo(c,i,r,f){var h;const v=c-r.cx,b=i-r.cy,S=Math.hypot(v,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,v);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const E of r.sectors)if(g>=E.start&&g<E.end)return E.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function Ui(c,i,r,f=.85){const[h,v]=c.bands[r],b=(h+v)/2,S=v-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),E=c.cy+b*Math.sin(i.mid);return{cx:g,cy:E,w:y,h:m}}function l0(c){const i=[];for(let r=0;r<c.length;r++){const f=c[r],h=c[(r+1)%c.length];f&&h&&i.push(`M ${f.x} ${f.y} L ${h.x} ${h.y}`)}return i}function Bi(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),X=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),K=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:X},b:{x:j,y:K}})}return f}function fa(c,i,r,f,h){let v;try{v=f(c.blueprintId)}catch(X){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",X),[]}if(!(v!=null&&v.shape))return[];const b=v.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=It(v,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,E=b.map(X=>({x:X.x+m,y:X.y+g})),R=[];for(let X=0;X<E.length;X++){const j=E[X],K=E[(X+1)%E.length];if(!j||!K){R.push(!1);continue}const $=Bi(j,K,S);let gt=!1;if(c.blueprintId.startsWith("comp:"))for(let bt=0;bt<v.shape.length;bt++){if(bt===i)continue;const Q=v.shape[bt];if(!Q)continue;const ut=Q.map(Z=>({x:Z.x+m,y:Z.y+g}));for(let Z=0;Z<ut.length;Z++){const ot=ut[Z],I=ut[(Z+1)%ut.length];if(!ot||!I)continue;const et=Bi(ot,I,S);for(const tt of $)if(et.some(rt=>tt.a.x===rt.a.x&&tt.a.y===rt.a.y&&tt.b.x===rt.b.x&&tt.b.y===rt.b.y||tt.a.x===rt.b.x&&tt.a.y===rt.b.y&&tt.b.x===rt.a.x&&tt.b.y===rt.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(!gt&&k.game.hideTouchingBorders)for(const bt of r){if(bt.id===c.id)continue;const Q=f(bt.blueprintId);if(!(Q!=null&&Q.shape))continue;const ut=It(Q,h),Z=bt.pos.x-ut.min.x,ot=bt.pos.y-ut.min.y;for(const I of Q.shape){const et=I.map(tt=>({x:tt.x+Z,y:tt.y+ot}));for(let tt=0;tt<et.length;tt++){const rt=et[tt],Ot=et[(tt+1)%et.length];if(!rt||!Ot)continue;const L=Bi(rt,Ot,S);for(const xt of $)if(L.some(dt=>xt.a.x===dt.a.x&&xt.a.y===dt.a.y&&xt.b.x===dt.b.x&&xt.b.y===dt.b.y||xt.a.x===dt.b.x&&xt.a.y===dt.b.y&&xt.b.x===dt.a.x&&xt.b.y===dt.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 n0=Object.defineProperty,a0=Object.defineProperties,u0=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable,po=(c,i,r)=>i in c?n0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ru=(c,i)=>{for(var r in i||(i={}))i0.call(i,r)&&po(c,r,i[r]);if(vo)for(var r of vo(i))c0.call(i,r)&&po(c,r,i[r]);return c},su=(c,i)=>a0(c,u0(i));function Ni(c){return`M ${c.map(i=>`${i.x} ${i.y}`).join(" L ")} Z`}function f0(c){const{controller:i,layout:r,viewBox:f,width:h,height:v,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:E,draggingId:R,selectedPieceId:X,dragInvalid:j,lockedPieceId:K,svgRef:$,setPieceRef:gt,onPiecePointerDown:bt,onBlueprintPointerDown:Q,onRootPointerDown:ut,onPointerMove:Z,onPointerUp:ot,onCenterBadgePointerDown:I}=c,et=f.w,tt=f.h,rt=i.state.blueprintView,Ot=rt==="primitives"?i.state.primitives:i.state.quickstash,L=i.state.cfg.maxQuickstashSlots,xt=i.state.primitives.length,dt=rt==="primitives"?Math.max(1,xt):Math.max(1,L),ht=(r.mode==="circle"?Math.PI*2:Math.PI)/dt,D=r.mode==="circle"?-Math.PI/2:Math.PI,w=N=>D+(N+.5)*ht,P=(N,ct=k.layout.grid.stepPx)=>N*Math.SQRT2*ct,G=rt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=P(G),z=d/(2*Math.max(1e-9,Math.sin(ht/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),it=(N,ct,W)=>{const nt=It(N,Mt=>i.getPrimitive(Mt)),st=nt.min.x+nt.width/2,Y=nt.min.y+nt.height/2;return lt.createElement("g",{key:N.id,transform:`translate(${ct}, ${W}) scale(1) translate(${-st}, ${-Y})`},("shape"in N?N.shape:[]).map((Mt,mt)=>lt.createElement("path",{key:mt,d:Ni(Mt),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>Q(Jt,N,{bx:ct,by:W,cx:st,cy:Y})})))};return lt.createElement("svg",{ref:$,width:h,height:v,viewBox:`0 0 ${et} ${tt}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:Z,onPointerUp:ot,onPointerDown:N=>{ut(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,ct)=>{const W=!!i.state.sectors[N.id].completedAt,nt=ct%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,st=ct%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,Y=r.bands.silhouette,Mt=r.bands.workspace;return lt.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?lt.createElement(lt.Fragment,null,lt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:nt,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),lt.createElement("path",{d:Ri(r.cx,r.cy,Mt[0],Mt[1],N.start,N.end),fill:W?k.color.completion.fill:st,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):lt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:W?k.color.completion.fill:nt,stroke:W?k.color.completion.stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}))}),g.sort((N,ct)=>R===N.id?1:R===ct.id?-1:0).map(N=>{const ct=i.getBlueprint(N.blueprintId),W=It(ct,Gt=>i.getPrimitive(Gt)),nt=R===N.id,st=N.sectorId&&i.isSectorCompleted(N.sectorId),Y=K===N.id,Mt=X===N.id,mt=nt&&j,Jt=N.x-W.min.x,ll=N.y-W.min.y;return lt.createElement("g",{key:N.id,ref:gt(N.id),transform:`translate(${Jt}, ${ll})`,style:{cursor:st?"default":E?"pointer":"grab"},pointerEvents:E&&nt?"none":"auto"},("shape"in ct?ct.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),lt.createElement(lt.Fragment,{key:Nt},lt.createElement("path",{d:Ni(Gt),fill:Y||mt?k.color.piece.invalidFill:nt?k.color.piece.draggingFill:k.color.piece.validFill,opacity:Y||mt?k.opacity.piece.invalid:nt?k.opacity.piece.dragging:st?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:Wt=>bt(Wt,N)}),(()=>{const Wt=g.filter(V=>V.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),Kt=Wt.map(V=>su(ru({},V),{pos:{x:V.x,y:V.y}})),Pt=fa(Zt,Nt,Kt,V=>i.getBlueprint(V),V=>i.getPrimitive(V)),Lt=R?Wt.find(V=>V.id===R):null;let al;if(N.blueprintId.startsWith("comp:")){const V=fa(Zt,Nt,[],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt));al=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt)):new Array(Pt.length).fill(!1)).map((yt,Ut)=>yt&&!V[Ut])}else al=Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],V=>i.getBlueprint(V),V=>i.getPrimitive(V)):new Array(Pt.length).fill(!1);return l0(Gt).map((V,yt)=>{const Ut=al[yt]||!1;let ft;return nt&&N.blueprintId.startsWith("comp:")?ft=fa(Zt,Nt,[],Tt=>i.getBlueprint(Tt),Tt=>i.getPrimitive(Tt))[yt]||!1:ft=nt?!1:(Pt[yt]||!1)&&!Ut,lt.createElement("path",{key:`stroke-${Nt}-${yt}`,d:V,fill:"none",stroke:ft?"none":Y||mt?k.color.piece.invalidStroke:Mt||nt?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ft?0:Mt||nt?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:Tt=>bt(Tt,N)})})})()))))}),r.sectors.map(N=>{var ct;const W=(ct=y.get(N.id))!=null?ct:[];return W.length?lt.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((nt,st)=>lt.createElement("path",{key:st,d:Ni(nt),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:ct,invalid:W})=>{const nt=N==="inner-ring";return lt.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((st,Y)=>lt.createElement("circle",{key:`inv-${Y}`,cx:st.x,cy:st.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),ct.map((st,Y)=>lt.createElement("circle",{key:`val-${Y}`,cx:st.x,cy:st.y,r:nt?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:nt?k.color.anchors.invalid:k.color.anchors.valid,opacity:nt?k.opacity.anchors.invalid:k.opacity.anchors.valid})))}),(()=>{const N=i.state.cfg.mode==="prep",ct=N?i.isSubmitEnabled():!0,W=!R&&(!N||ct);return lt.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?I:void 0},lt.createElement("circle",{r:b,fill:ct?k.color.blueprint.badgeFill:"#ccc",opacity:ct?1:.5}),lt.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:ct?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Ot.map((N,ct)=>{const W=w(ct),nt=r.cx+J*Math.cos(W),st=r.cy+J*Math.sin(W);return it(N,nt,st)}),i.state.endedAt&<.createElement("g",{pointerEvents:"none"},lt.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},lt.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),lt.createElement("animate",{attributeName:"opacity",from:"1",to:"0",begin:"560ms",dur:"520ms",fill:"freeze"}))))}function o0(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const v of c)for(const b of v)b.x<i&&(i=b.x),b.y<r&&(r=b.y),b.x>f&&(f=b.x),b.y>h&&(h=b.y);return{minX:i,minY:r,maxX:f,maxY:h}}function r0(c,i,r,f){const h=k.layout.grid.stepPx,v=Math.floor((c-h/2)/h)*h+h/2,b=Math.floor((i-h/2)/h)*h+h/2,S=[];for(let y=b;y<=f;y+=h)for(let m=v;m<=r;m+=h)S.push({x:m,y});return S}function du(c){if(!c.length)return new Set;const{minX:i,minY:r,maxX:f,maxY:h}=o0(c),v=r0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of v)for(const m of c)if(cu(y,m)){S.add(b(y));continue t}return S}function s0(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 d0(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=d0(c);let r=1/0,f=1/0;for(const v of i)v.x<r&&(r=v.x),v.y<f&&(f=v.y);const h=new Set;for(const v of i)h.add(`${v.x-r},${v.y-f}`);return h}function h0(c,i){if(c.size!==i.size)return!1;for(const r of c)if(!i.has(r))return!1;return!0}function y0(c,i){if(!c.length)return!1;const r=du(c),f=du(i);if(r.size===0||f.size===0)return!1;const h=go(r),v=go(f);return h0(h,v)}function bo(c,i,r){return{x:c-r.bx+r.cx,y:i-r.by+r.cy}}function m0(c,i){return!c||c.length===0?[]:c.map(r=>r.map(f=>({x:i*f.x,y:i*f.y})))}function v0(c){const i=lt.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=lt.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=lt.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const E=c.getBlueprint(g.blueprintId),R=It(E,c.getPrimitive);y.push(...vn(E,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=lt.useRef(new Map),v=lt.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=lt.useCallback(S=>{const y=v(S),m=h.current.get(S);if(m&&m.sig===y)return m.polys;const g=f(S);return h.current.set(S,{sig:y,polys:g}),g},[v,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class 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 v=It(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-v.min.x),y:i.y+(b.y-v.min.y)};let y=null,m=1/0;for(const R of h){const X=R.x-S.x,j=R.y-S.y,K=X*X+j*j;K<m&&(m=K,y=R)}const g=Math.sqrt(m),E=g<=this.config.snapRadiusPx;return{tl:y&&E?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:E}}snapTopLeftToNodes(i,r,f,h){const{tl:v}=this.nearestNodeSnap(i,r,f,h);return v}generateWorkspaceNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},v={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,v),S=Di(b,i,"silhouette",r);return Jh(S,f,cu)}generateSilhouetteBandNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"silhouette",r)}insideAnySilhouette(i,r){for(const f of r)if(cu(i,f))return!0;return!1}polyFullyInside(i,r,f){var h;if(!i.length)return!0;if(!r.length)return!1;const v=(h=f!=null?f:this.config.densitySampleStepPx)!=null?h:Math.max(1,Math.round(k.layout.grid.stepPx/3));for(const b of i)if(!(b.length<2))for(let S=0;S<b.length;S++){const y=b[S],m=b[(S+1)%b.length];if(!y||!m)continue;const g=m.x-y.x,E=m.y-y.y,R=Math.hypot(g,E),X=Math.max(1,Math.ceil(R/v));for(let j=0;j<=X;j++){const K=j/X,$={x:y.x+K*g,y:y.y+K*E};if(!this.insideAnySilhouette($,r))return!1}}return!0}}function g0(){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=g0();function Hi(c,i,r,f){const h=oa.nearestNodeSnap(c,i,r,f);return{tl:h.tl,node:h.node,dist:h.dist}}function b0(c,i,r){return oa.polyFullyInside(c,i,r)}function S0(c,i){return oa.generateWorkspaceNodes(c,i)}function x0(c,i,r){return oa.generateSilhouetteNodes(c,i,r)}function M0(c,i){return oa.generateSilhouetteBandNodes(c,i)}function A0(c,i,r){const f=c.state.cfg;return{anchorDots:lt.useMemo(()=>{var h,v;const b=[];b.push({sectorId:"inner-ring",valid:Ph(i),invalid:[]});for(const S of i.sectors)if(f.target==="workspace")b.push({sectorId:S.id,valid:S0(i,S),invalid:[]});else{const y=(v=(h=c.state.cfg.sectors.find($=>$.id===S.id))==null?void 0:h.silhouette.mask)!=null?v:[];if(!y||y.length===0)continue;const m=Ui(i,S,"silhouette",1),g=so(y,r,{cx:m.cx,cy:m.cy}),E=M0(i,S),R=x0(i,S,g),X=$=>`${$.x},${$.y}`,j=new Set(R.map(X)),K=E.filter($=>!j.has(X($)));b.push({sectorId:S.id,valid:R,invalid:K})}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)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),X=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),K=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:X},b:{x:j,y:K}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const v=It(h,r),b=c.pos.x-v.min.x,S=c.pos.y-v.min.y,y=[];for(const m of h.shape){const g=m.map(E=>({x:E.x+b,y:E.y+S}));for(let E=0;E<g.length;E++){const R=g[E],X=g[(E+1)%g.length];!R||!X||y.push(...T0(R,X,f))}}return y}function xo(c,i,r,f){if(i.length===0)return{isAttached:!0,attachedPieceIds:[],sharedEdgeLength:0};const h=k.layout.grid.stepPx,v=So(c,r,f,h);if(v.length===0)return{isAttached:!1,attachedPieceIds:[],sharedEdgeLength:0};let b=0;const S=[];for(const y of i){const m=So(y,r,f,h),g=v.filter(E=>m.some(R=>E.a.x===R.a.x&&E.a.y===R.a.y&&E.b.x===R.b.x&&E.b.y===R.b.y||E.a.x===R.b.x&&E.a.y===R.b.y&&E.b.x===R.a.x&&E.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function E0(c,i,r,f){if(i.length<=2)return!1;const h=i.filter(m=>m.id!==c.id);if(h.length<=1)return!1;const v=new Map;for(const m of h)v.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const E=h[m],R=h[g];!E||!R||xo(E,[R],r,f).isAttached&&(v.get(E.id).push(R.id),v.get(R.id).push(E.id))}const b=new Set,S=h[0];if(!S)return!1;function y(m){if(b.has(m))return;b.add(m);const g=v.get(m)||[];for(const E of g)y(E)}return y(S.id),b.size!==h.length}var O0=Object.defineProperty,_0=Object.defineProperties,z0=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,D0=Object.prototype.hasOwnProperty,R0=Object.prototype.propertyIsEnumerable,Ao=(c,i,r)=>i in c?O0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,U0=(c,i)=>{for(var r in i||(i={}))D0.call(i,r)&&Ao(c,r,i[r]);if(Mo)for(var r of Mo(i))R0.call(i,r)&&Ao(c,r,i[r]);return c},B0=(c,i)=>_0(c,z0(i));function N0(c,i,r,f,h,v,b,S,y,m,g){const E=c.state.cfg,R=E.input==="click",X=lt.useRef(null),j=lt.useRef(null),[K,$]=lt.useState(null),gt=lt.useRef(new Map),[bt,Q]=lt.useState(null);lt.useEffect(()=>{K===null&&(j.current=null)},[K]);const ut=G=>d=>{const z=gt.current;d?z.set(G,d):z.delete(G)},Z=(G,d)=>{const z=X.current,q=z.createSVGPoint();q.x=G,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}},ot=()=>{if(!j.current)return;const G=j.current;G.raf==null&&(G.raf=requestAnimationFrame(()=>{G.raf=null;const d=gt.current.get(G.id);d&&d.setAttribute("transform",`translate(${G.tlx-G.minx}, ${G.tly-G.miny})`)}))},I=(G,d)=>mo(G,d,i,E.target),et=k.layout.grid.stepPx,tt=G=>{if(!G)return null;const d=Math.round(G.x/et),z=Math.round(G.y/et);return`${d},${z}`},rt=G=>({x:Math.round(G.x/et)*et,y:Math.round(G.y/et)*et}),Ot=(G,d)=>{if(!j.current)return;const z=j.current,q=rt(G),C=tt(q);g!=null&&g.recordMouseMove&&(C!==z.pointerAnchorId||d!==z.pointerAnchorSectorId)&&g.recordMouseMove(q.x,q.y,d),z.pointerAnchor=q,z.pointerAnchorId=C,z.pointerAnchorSectorId=d},L=(G,d,z)=>{if(!j.current)return;const q=j.current;q.snapAnchor=G,q.snapAnchorId=tt(G),q.snapAnchorSectorId=d,q.snapAnchorDist=G&&z!==void 0?z:null},xt=(G,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(G,d,z)},dt=G=>{const d=c.findPiece(G);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=It(z,c.getPrimitive);return vn(z,q,d.pos).map(C=>C.map(J=>[J.x,J.y]))},ht=(G,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&K)return;if(E.mode==="prep"&&d.sectorId){const nt=c.getPiecesInSector(d.sectorId),st=c.findPiece(d.id);if(st&&E0(st,nt,Y=>c.getBlueprint(Y),Y=>c.getPrimitive(Y))){Q(d.id),setTimeout(()=>Q(null),500);return}}if(R){G.stopPropagation();const nt=c.getBlueprint(d.blueprintId),st=It(nt,Gt=>c.getPrimitive(Gt)),Y=ia(nt,st),{x:Mt,y:mt}=Z(G.clientX,G.clientY),Jt=rt({x:Mt,y:mt}),ll=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,ll),g){const Gt="kind"in nt?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},dt(d.id),d.sectorId)}j.current={id:d.id,dx:Mt-d.x,dy:mt-d.y,tlx:d.x,tly:d.y,aabb:{width:st.width,height:st.height},minx:st.min.x,miny:st.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:tt(Jt),pointerAnchorSectorId:ll,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),$(d.id),y();return}(z=X.current)==null||z.setPointerCapture(G.pointerId);const q=c.getBlueprint(d.blueprintId),C=It(q,nt=>c.getPrimitive(nt)),J=ia(q,C),{x:it,y:N}=Z(G.clientX,G.clientY),ct=rt({x:it,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(ct.x,ct.y,W),g){const nt="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,nt,"sector",{x:d.x,y:d.y},dt(d.id),d.sectorId)}j.current={id:d.id,dx:it-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:ct,pointerAnchorId:tt(ct),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),$(d.id),y()},D=G=>{var d,z,q,C,J,it,N,ct;const{x:W,y:nt}=Z(G.clientX,G.clientY),st=rt({x:W,y:nt}),Y=Math.hypot(W-i.cx,nt-i.cy),Mt=Y<i.innerR?void 0:(d=I(W,nt))!=null?d:void 0;if(!j.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(st.x,st.y,Mt);return}const mt=j.current,Jt=W-mt.dx,ll=nt-mt.dy;Ot({x:W,y:nt},Mt);let Gt=ca(Jt,ll,{aabb:mt.aabb,support:mt.support},i,c.state.cfg.target,Y<i.innerR);const Nt=Gt.x+mt.aabb.width/2,Wt=Gt.y+mt.aabb.height/2,Zt=Math.hypot(Nt-i.cx,Wt-i.cy)<i.innerR,Kt=Zt?null:I(Nt,Wt);let Pt=null,Lt=null,al=Kt!=null?Kt:void 0,V=!1,yt=!1;if(Zt){const Ut=h.find(ft=>ft.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ft=f(mt.id);if(ft){const Tt=c.getBlueprint(ft.blueprintId),At=Hi(Gt,Tt,c.getPrimitive,Ut.valid);Gt=At.tl,Pt=At.node,Lt=At.dist,al=void 0}}mt.validSnap=!1}else if(Kt){const Ut=b(Kt),ft=h.find(At=>At.sectorId===Kt),Tt=E.target==="workspace"&&E.mode!=="prep"?(z=ft==null?void 0:ft.valid)!=null?z:[]:[...(q=ft==null?void 0:ft.valid)!=null?q:[],...(C=ft==null?void 0:ft.invalid)!=null?C:[]];if(Tt.length){const At=f(mt.id);if(At){const ql=c.getBlueprint(At.blueprintId),zl=Hi(Gt,ql,c.getPrimitive,Tt);if(Gt=zl.tl,Pt=zl.node,Lt=zl.dist,al=Kt,Ut)mt.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,ne=f(mt.id);let Tl=!0;if(ne){const cl=c.getBlueprint(ne.blueprintId),de=It(cl,c.getPrimitive),Dl=vn(cl,de,Gt),Yi=r.filter(rl=>rl.id!==mt.id&&I(rl.x+It(c.getBlueprint(rl.blueprintId),c.getPrimitive).width/2,rl.y+It(c.getBlueprint(rl.blueprintId),c.getPrimitive).height/2)===Kt);for(const rl of Yi){const ae=c.getBlueprint(rl.blueprintId),ue=It(ae,c.getPrimitive),El=vn(ae,ue,{x:rl.x,y:rl.y});if(Zh(Dl,El)){Tl=!1;break}}if(E.target==="workspace"){if(E.mode==="prep"){const rl=c.getPiecesInSector(Kt),ae=rl.filter(bn=>bn.id!==mt.id),ue=ae.length===0,El=c.findPiece(mt.id),ze=El==null?void 0:El.sectorId,ra=(J=c.state.cfg.maxCompositeSize)!=null?J:0,yu=ra>0,sa=rl.length-(ze===Kt?1:0),ie=yu&&sa+1>ra;if(ue)mt.validSnap=Tl&&!ie,yt=ie;else if(El){const bn=B0(U0({},El),{pos:{x:Gt.x,y:Gt.y}}),Gi=xo(bn,ae,Vl=>c.getBlueprint(Vl),Vl=>c.getPrimitive(Vl));mt.validSnap=Tl&&Gi.isAttached&&!ie,yt=ie}else mt.validSnap=Tl&&!ie,yt=ie}else mt.validSnap=Tl,yt=!1;V=!Tl}else{const rl=ze=>`${ze.x},${ze.y}`,ae=new Set(((it=ft==null?void 0:ft.valid)!=null?it:[]).map(rl)),ue=!!zl.node&&ae.has(rl(zl.node))&&zl.dist<=(gn!=null?gn:0);let El=!1;if(ue){const ze=(N=v.get(Kt))!=null?N:[];El=b0(Dl,ze)}mt.validSnap=ue&&El&&Tl,V=!Tl}}}}}}else mt.validSnap=c.state.cfg.target==="workspace",Pt=null,Lt=null,al=void 0,yt=!1;mt.overlaps=V,mt.maxExceeded=yt,L(Pt,al,Lt!=null?Lt:void 0),mt.tlx=Gt.x,mt.tly=Gt.y,mt.prevValidSnap!==mt.validSnap&&(mt.prevValidSnap=(ct=mt.validSnap)!=null?ct:!1,y()),ot()},w=()=>{var G,d,z,q,C,J,it,N,ct,W,nt,st;if(!j.current||R)return;const Y=j.current;if(Y.validSnap===!1){const Wt=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 al="outside_bounds";if(Y.maxExceeded?al="no_valid_anchor":Y.overlaps?al="overlapping":Lt&&(al="no_valid_anchor"),xt({x:Kt,y:Pt},"invalid_placement",{invalidPlacement:{reason:al,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},dt(Y.id),(G=Y.snapAnchorId)!=null?G:void 0,!1,(d=Y.overlaps)!=null?d:!1);else{const V=Wt==null?void 0:Wt.sectorId;c.remove(Y.id),V&&S(V),g&&g.recordPlacedown("deleted",V,void 0,void 0,(z=Y.snapAnchorId)!=null?z:void 0,!1,(q=Y.overlaps)!=null?q:!1)}j.current=null,$(null),y();return}j.current=null,Y.raf&&(cancelAnimationFrame(Y.raf),Y.raf=null);const Mt={x:Y.tlx,y:Y.tly},mt=Mt.x+Y.aabb.width/2,Jt=Mt.y+Y.aabb.height/2;if(Math.hypot(mt-i.cx,Jt-i.cy)<i.innerR){const Wt=c.findPiece(Y.id),Zt=Wt==null?void 0:Wt.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 ll=I(mt,Jt);if(ll&&b(ll)){xt({x:mt,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ll}}),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},dt(Y.id),(it=Y.snapAnchorId)!=null?it:void 0,!1,(N=Y.overlaps)!=null?N:!1)):(c.remove(Y.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(ct=Y.snapAnchorId)!=null?ct:void 0,!1,(W=Y.overlaps)!=null?W:!1)),$(null),y();return}c.move(Y.id,Mt),c.drop(Y.id,ll);const Gt=ll?S(ll):!1,Nt=Y.validSnap===void 0?!0:Y.validSnap;g&&g.recordPlacedown("placed",ll,Mt,dt(Y.id),(nt=Y.snapAnchorId)!=null?nt:void 0,Nt,(st=Y.overlaps)!=null?st:!1,Gt),$(null),Y.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},P=(G,d,z)=>{var q,C,J,it,N,ct,W,nt;if(R&&K)return;G.stopPropagation();const{x:st,y:Y}=Z(G.clientX,G.clientY),Mt=It(d,c.getPrimitive),mt=ia(d,Mt);if(R){const Pt=bo(st,Y,z),Lt={x:st-(Pt.x-Mt.min.x),y:Y-(Pt.y-Mt.min.y)},al=Math.hypot(st-i.cx,Y-i.cy)<i.innerR,V=ca(Lt.x,Lt.y,{aabb:Mt,support:mt},i,c.state.cfg.target,al),yt=c.spawnFromBlueprint(d,V),Ut=rt({x:st,y:Y}),ft=(q=I(st,Y))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ft),g){const cl="kind"in d?"primitive":"composite";g.recordPickup(yt,d.id,cl,"blueprint",V,dt(yt),void 0)}const Tt=V;let At=Tt,ql=null;const zl=Tt.x+Mt.width/2,gn=Tt.y+Mt.height/2,ne=I(zl,gn);if(ne){const cl=h.find(Dl=>Dl.sectorId===ne),de=c.state.cfg.target==="workspace"?(C=cl==null?void 0:cl.valid)!=null?C:[]:[...(J=cl==null?void 0:cl.valid)!=null?J:[],...(it=cl==null?void 0:cl.invalid)!=null?it:[]];if(de.length){const Dl=Hi(Tt,d,c.getPrimitive,de);At=Dl.tl,ql={node:Dl.node,dist:Dl.dist}}}c.move(yt,At),j.current={id:yt,dx:st-At.x,dy:Y-At.y,tlx:At.x,tly:At.y,aabb:Mt,minx:Mt.min.x,miny:Mt.min.y,support:mt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:tt(Ut),pointerAnchorSectorId:ft,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Ot({x:st,y:Y},ft);const Tl=(N=I(At.x+Mt.width/2,At.y+Mt.height/2))!=null?N:void 0;L((ct=ql==null?void 0:ql.node)!=null?ct:null,Tl,ql==null?void 0:ql.dist),$(yt),y(),ot();return}(W=X.current)==null||W.setPointerCapture(G.pointerId);const Jt=bo(st,Y,z),ll={x:st-(Jt.x-Mt.min.x),y:Y-(Jt.y-Mt.min.y)},Gt=Math.hypot(st-i.cx,Y-i.cy)<i.innerR,Nt=ca(ll.x,ll.y,{aabb:Mt,support:mt},i,c.state.cfg.target,Gt),Wt=c.spawnFromBlueprint(d,Nt),Zt=rt({x:st,y:Y}),Kt=(nt=I(st,Y))!=null?nt:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,Kt),g){const Pt="kind"in d?"primitive":"composite";g.recordPickup(Wt,d.id,Pt,"blueprint",Nt,dt(Wt),void 0)}j.current={id:Wt,dx:st-Nt.x,dy:Y-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:Mt,minx:Mt.min.x,miny:Mt.min.y,support:mt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:tt(Zt),pointerAnchorSectorId:Kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Ot({x:st,y:Y},Kt),L(null,void 0),$(Wt),y(),ot()};return{draggingId:K,dragInvalid:!!(j.current&&j.current.validSnap===!1),lockedPieceId:bt,svgRef:X,onPiecePointerDown:ht,onBlueprintPointerDown:P,onPointerMove:D,onPointerUp:w,setPieceRef:ut,setDraggingId:$,dragRef:j}}function H0(c,i,r,f,h,v,b,S,y,m,g,E,R){const X=c.state.cfg,j=(ot,I)=>mo(ot,I,i,X.target),K=ot=>{const I=c.findPiece(ot);if(!I)return[];const et=c.getBlueprint(I.blueprintId);if(!et)return[];const tt=It(et,c.getPrimitive);return vn(et,tt,I.pos).map(rt=>rt.map(Ot=>[Ot.x,Ot.y]))},$=()=>{var ot,I,et,tt,rt,Ot;const L=b.current;return{anchorId:(I=(ot=L==null?void 0:L.snapAnchorId)!=null?ot:L==null?void 0:L.pointerAnchorId)!=null?I:void 0,wasValid:(L==null?void 0:L.validSnap)!==!1,wasOverlapping:(et=L==null?void 0:L.overlaps)!=null?et:!1,anchorX:(tt=L==null?void 0:L.pointerAnchor)==null?void 0:tt.x,anchorY:(rt=L==null?void 0:L.pointerAnchor)==null?void 0:rt.y,sectorId:(Ot=L==null?void 0:L.snapAnchorSectorId)!=null?Ot:L==null?void 0:L.pointerAnchorSectorId}},gt=(ot,I,et)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(ot,I,et)},[bt,Q]=lt.useState(null),[ut,Z]=lt.useState(null);return{pendingBpId:bt,selectedPieceId:ut,onRootPointerDown:ot=>{var I,et;const{x:tt,y:rt}=g(ot.clientX,ot.clientY);if(f){const Ot=j(tt,rt);if(h&&b.current){const L=b.current,xt=L.tlx+L.aabb.width/2,dt=L.tly+L.aabb.height/2;if(S(tt,rt)){const P=c.findPiece(L.id),G=P==null?void 0:P.sectorId,d=$();c.remove(L.id),G&&m(G),R&&R.recordPlacedown("deleted",G,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),Z(null),Q(null),E();return}if(Math.hypot(xt-i.cx,dt-i.cy)<i.innerR){const P=c.findPiece(L.id),G=P==null?void 0:P.sectorId,d=$();c.remove(L.id),G&&m(G),R&&R.recordPlacedown("deleted",G,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),Z(null),Q(null),E();return}const ht=j(xt,dt);if(!ht){gt({x:xt,y:dt},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),E();return}if(y(ht)){gt({x:xt,y:dt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ht}}),E();return}if(L.validSnap===!1){const P=$().wasOverlapping?"overlapping":"no_valid_anchor";gt({x:xt,y:dt},"invalid_placement",{invalidPlacement:{reason:P,attemptedSectorId:ht}}),E();return}c.move(L.id,{x:L.tlx,y:L.tly}),c.drop(L.id,ht);const D=$(),w=m(ht);R&&R.recordPlacedown("placed",ht,{x:L.tlx,y:L.tly},K(L.id),D.anchorId,D.wasValid,D.wasOverlapping,w),v(null),Z(null),Q(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}if(ut){if(S(tt,rt)){const L=c.findPiece(ut),xt=L==null?void 0:L.sectorId;c.remove(ut),xt&&m(xt),R&&R.recordPlacedown("deleted"),Z(null),E();return}if(Ot&&y(Ot)){Z(null),E();return}if(Ot){const L=r.find(xt=>xt.id===ut);if(Z(null),L){const xt=c.getBlueprint(L.blueprintId),dt=It(xt,c.getPrimitive),ht=ia(xt,dt),D={x:tt-dt.width/2,y:rt-dt.height/2},w=ca(D.x,D.y,{aabb:{width:dt.width,height:dt.height},support:ht},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(Ot).length-(L.sectorId===Ot?1:0)+1>P){E();return}c.move(L.id,{x:w.x,y:w.y}),c.drop(L.id,Ot),m(Ot),E()}return}Z(null),E();return}if(bt){const L=j(tt,rt);if(S(tt,rt)||!L||y(L)){Q(null),E();return}const xt=c.getBlueprint(bt),dt=It(xt,c.getPrimitive),ht=ia(xt,dt),D={x:tt-dt.width/2,y:rt-dt.height/2},w=ca(D.x,D.y,{aabb:{width:dt.width,height:dt.height},support:ht},i,c.state.cfg.target,!1),P=c.spawnFromBlueprint(xt,w),G=(et=c.state.cfg.maxCompositeSize)!=null?et:0;if(c.state.cfg.mode==="prep"&&G>0&&c.getPiecesInSector(L).length+1>G){c.remove(P),Q(null),E();return}c.drop(P,L),Q(null),m(L),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}}},clearSelection:()=>{Z(null),Q(null)},setPendingBp:Q,setSelectedPiece:Z}}const ml=[];for(let c=0;c<256;++c)ml.push((c+256).toString(16).slice(1));function q0(c,i=0){return(ml[c[i+0]]+ml[c[i+1]]+ml[c[i+2]]+ml[c[i+3]]+"-"+ml[c[i+4]]+ml[c[i+5]]+"-"+ml[c[i+6]]+ml[c[i+7]]+"-"+ml[c[i+8]]+ml[c[i+9]]+"-"+ml[c[i+10]]+ml[c[i+11]]+ml[c[i+12]]+ml[c[i+13]]+ml[c[i+14]]+ml[c[i+15]]).toLowerCase()}let qi;const C0=new Uint8Array(16);function Y0(){if(!qi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qi=crypto.getRandomValues.bind(crypto)}return qi(C0)}var To={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,v,b;if(To.randomUUID&&!i&&!c)return To.randomUUID();c=c||{};const f=(b=(v=c.random)!=null?v:(h=c.rng)==null?void 0:h.call(c))!=null?b:Y0();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,q0(f)}var G0=Object.defineProperty,Eo=Object.getOwnPropertySymbols,X0=Object.prototype.hasOwnProperty,w0=Object.prototype.propertyIsEnumerable,Oo=(c,i,r)=>i in c?G0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,_o=(c,i)=>{for(var r in i||(i={}))X0.call(i,r)&&Oo(c,r,i[r]);if(Eo)for(var r of Eo(i))w0.call(i,r)&&Oo(c,r,i[r]);return c};class j0{constructor(i,r,f,h){this.gridStep=k.layout.grid.stepPx,this.interactionIndex=0,this.currentPickup=null,this.previousSnapshotId=void 0,this.clickEvents=[],this.mouseTracking=[],this.interactions=[],this.completionTimes=[],this.createdMacros=[],this.controller=i,this.callbacks=r,this.trialId=f||hu(),this.gameId=h||hu(),this.trialStartTime=Date.now(),this.controller.setTrackingCallbacks({onSectorCompleted:v=>this.recordSectorCompletion(v)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,v,b,S){const y=this.toAnchorPoint(v),m=this.toAnchorVertices(b);this.currentPickup={pieceId:i,blueprintId:r,blueprintType:f,timestamp:Date.now(),source:h,sectorId:S,position:y,vertices:m}}recordPlacedown(i,r,f,h,v,b,S,y){if(!this.currentPickup){console.warn("[InteractionTracker] recordPlacedown called without pickup");return}const m=this.determineInteractionType(this.currentPickup.source,i),g=Date.now(),E=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),X=f?this.toAnchorPoint(f):void 0,j=h?this.toAnchorVertices(h):void 0,K={interactionId:hu(),trialId:this.trialId,gameId:this.gameId,interactionIndex:this.interactionIndex++,interactionType:m,pieceId:this.currentPickup.pieceId,blueprintId:this.currentPickup.blueprintId,blueprintType:this.currentPickup.blueprintType,pickupTimestamp:this.currentPickup.timestamp,pickupSource:this.currentPickup.source,pickupSectorId:this.currentPickup.sectorId,pickupPosition:this.currentPickup.position,pickupVertices:this.currentPickup.vertices,placedownTimestamp:g,placedownOutcome:i,wasValid:i==="placed"&&b===!0,wasOverlapping:i==="placed"&&S===!0,holdDuration:E,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(K.placedownSectorId=r),i==="placed"&&X&&(K.placedownPosition=X),i==="placed"&&j&&(K.placedownVertices=j),v&&(K.placedownAnchorId=v),this.previousSnapshotId!==void 0&&(K.preSnapshotId=this.previousSnapshotId),this.interactions.push(K),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(K),this.currentPickup=null,this.clickEvents=[],this.mouseTracking=[]}recordClickEvent(i,r,f){const h=this.toAnchorPoint(i);this.clickEvents.push(_o({timestamp:Date.now(),location:h,clickType:r},f))}recordMouseMove(i,r,f){const h=this.currentPickup?"while_holding":"before_pickup",v=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===v&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:v,anchorY:b,sectorId:f,phase:h})}recordSectorCompletion(i){this.completionTimes.push({sectorId:i,completedAt:Date.now()})}recordMacroCreation(i){this.createdMacros.push(i)}finalizeTrial(i){const r=Date.now(),f=r-this.trialStartTime,h=this.buildStateSnapshot();if(this.controller.state.cfg.mode==="construction"){const v=this.buildFinalBlueprintState(h),b=v.filter(y=>y.blueprintType==="composite").map(y=>_o({id:y.blueprintId,parts:y.parts},y.label&&{label:y.label})),S={trialType:"construction",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:i,completionTimes:this.completionTimes,finalBlueprintState:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const v=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=v.map(y=>({id:y.macroId.startsWith("comp:")?y.macroId:`comp:${y.macroId}`,parts:y.parts})),S={trialType:"prep",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:"submit",createdMacros:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}}determineInteractionType(i,r){return r==="deleted"?"delete":i==="blueprint"?"spawn":"move"}toAnchorValue(i){return Math.round(i/this.gridStep)}toAnchorPoint(i){return{x:this.toAnchorValue(i.x),y:this.toAnchorValue(i.y)}}toAnchorVertices(i){return i.map(r=>r.map(f=>[this.toAnchorValue(f[0]),this.toAnchorValue(f[1])]))}buildMacrosFromSnapshot(i){return i.sectors.map(r=>{const f=r.pieces.map(g=>{const E=this.controller.getBlueprint(g.blueprintId),R=E&&"kind"in E?E.kind:g.blueprintId,X=this.controller.findPiece(g.pieceId);if(!X||!E)return{kind:R,position:g.position};const j=It(E,this.controller.getPrimitive),K={x:X.pos.x-j.min.x,y:X.pos.y-j.min.y},$=this.toAnchorPoint(K);return{kind:R,position:$}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,v=0;for(const g of f)h+=g.position.x,v+=g.position.y;const b=Math.round(h/f.length),S=Math.round(v/f.length),y=f.map(g=>({kind:g.kind,anchorOffset:{x:Math.round(g.position.x-b),y:Math.round(g.position.y-S)}})),m=r.pieces.flatMap(g=>g.vertices||[]);return{macroId:r.sectorId,parts:y,shape:m,pieceCount:r.pieceCount}})}buildStateSnapshot(i){const r=hu(),f=Date.now(),h=[],v=[];for(const y of this.controller.state.cfg.sectors){const m=this.controller.state.sectors[y.id],g=y.id===i||!!(m!=null&&m.completedAt);g&&v.push(y.id);const E=((m==null?void 0:m.pieces)||[]).map(X=>({pieceId:X.id,blueprintId:X.blueprintId,blueprintType:this.getBlueprintType(X.blueprintId),position:this.toAnchorPoint(X.pos),vertices:this.getPieceVertices(X.id)})),R={sectorId:y.id,completed:g,pieceCount:E.length,pieces:E};(m==null?void 0:m.completedAt)!==void 0&&(R.completedAt=m.completedAt),h.push(R)}const b=this.controller.state.cfg.sectors.map(y=>({sectorId:y.id,tangramId:y.id})),S={primitives:this.controller.state.primitives.map(y=>y.id),quickstash:this.controller.state.quickstash.map(y=>y.id)};return{snapshotId:r,timestamp:f,sectors:h,completedSectorIds:v,sectorTangramMap:b,blueprintOrder:S}}getBlueprintType(i){const r=this.controller.getBlueprint(i);return r?"kind"in r?"primitive":"composite":"primitive"}getPieceVertices(i){var r;const f=this.controller.findPiece(i);if(!f)return[];const h=this.controller.getBlueprint(f.blueprintId);if(!h)return[];const v=It(h,S=>this.controller.getPrimitive(S)),b=((r=vn(h,v,f.pos))!=null?r:[]).map(S=>S.map(y=>[y.x,y.y]));return this.toAnchorVertices(b)}buildFinalBlueprintState(i){const r=new Map;for(const f of i.sectors)for(const h of f.pieces){r.has(h.blueprintId)||r.set(h.blueprintId,{blueprintType:h.blueprintType,totalPieces:0,bySector:new Map});const v=r.get(h.blueprintId);v.totalPieces++,v.bySector.set(f.sectorId,(v.bySector.get(f.sectorId)||0)+1)}for(const f of this.controller.state.primitives)r.has(f.id)||r.set(f.id,{blueprintType:"primitive",totalPieces:0,bySector:new Map});for(const f of this.controller.state.quickstash)r.has(f.id)||r.set(f.id,{blueprintType:"composite",totalPieces:0,bySector:new Map});return Array.from(r.entries()).map(([f,h])=>{const v=this.controller.getBlueprint(f),b={blueprintId:f,blueprintType:h.blueprintType,totalPieces:h.totalPieces,bySector:Array.from(h.bySector.entries()).map(([S,y])=>({sectorId:S,count:y}))};return v&&(h.blueprintType==="composite"&&"parts"in v?(b.parts=v.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),v.label&&(b.label=v.label)):h.blueprintType==="primitive"&&"kind"in v&&(v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=v.kind)),b})}}var Q0=Object.defineProperty,V0=Object.defineProperties,Z0=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,L0=Object.prototype.hasOwnProperty,K0=Object.prototype.propertyIsEnumerable,Do=(c,i,r)=>i in c?Q0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pn=(c,i)=>{for(var r in i||(i={}))L0.call(i,r)&&Do(c,r,i[r]);if(zo)for(var r of zo(i))K0.call(i,r)&&Do(c,r,i[r]);return c},Ci=(c,i)=>V0(c,Z0(i));function k0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:E,height:R,onSectorComplete:X,onPiecePlace:j,onPieceRemove:K,onInteraction:$,onTrialEnd:gt,onControllerReady:bt}=c,Q=lt.useMemo(()=>{const V=pn(pn(Ci(pn({n:i.length,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y},m!==void 0&&{maxCompositeSize:m}),{mode:g||"construction"}),c.minPiecesPerMacro!==void 0&&{minPiecesPerMacro:c.minPiecesPerMacro}),c.requireAllSlots!==void 0&&{requireAllSlots:c.requireAllSlots});return new jh(i,r,f,V)},[i,r,f,h,v,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),ut=lt.useMemo(()=>{if(!$&&!gt)return null;const V={};return $&&(V.onInteraction=$),gt&&(V.onTrialEnd=gt),new j0(Q,V)},[Q,$,gt]);lt.useEffect(()=>{bt&&bt(Q)},[Q,bt]),lt.useEffect(()=>()=>{ut&&ut.dispose()},[ut]);const{layout:Z,viewBox:ot}=lt.useMemo(()=>{const V=i.length,yt=i.map(Tt=>Tt.id),Ut=i.map(Tt=>{var At;return(At=Tt.silhouette.mask)!=null?At:[]}),ft=Fh({n:V,layoutMode:h,target:v,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:t0({w:ft.LOGICAL_W,h:ft.LOGICAL_H},V,yt,h,v,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ft.LOGICAL_W,h:ft.LOGICAL_H}}},[i,h,v,y,f.length]),[,I]=lt.useReducer(V=>V+1,0);lt.useEffect(()=>{bt&&bt(Q,Z,I)},[Q,Z,bt,I]);const[et,tt]=lt.useState(!1);lt.useEffect(()=>{i.every(V=>Q.isSectorCompleted(V.id))&&!et&&(tt(!0),ut&&ut.finalizeTrial("auto_complete"))},[Q.updateCount,i,et,Q,ut]);const rt=lt.useCallback(V=>{X&&X(V,Q.snapshot())},[X,Q]),Ot=lt.useMemo(()=>({onSectorComplete:rt,onPiecePlace:j||(()=>{}),onPieceRemove:K||(()=>{})}),[rt,j,K]),L=()=>{const V={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return Ci(pn({},V),{width:`${yt}px`,height:`${yt}px`})}else{const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return Ci(pn({},V),{width:`${yt}px`,height:`${Ut}px`})}},xt=(()=>{if(h==="circle"){const V=Math.min(window.innerWidth*.96,window.innerHeight*.96);return{width:V,height:V}}else{const V=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),yt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:V,height:yt}}})();lt.useEffect(()=>{if(Q.state.cfg.mode!=="construction"||!S||S<=0||et)return;const V=window.setTimeout(()=>{et||(Q.state.endedAt||(Q.state.endedAt=performance.now(),I()),ut==null||ut.finalizeTrial("timeout"),tt(!0))},S);return()=>{window.clearTimeout(V)}},[Q,S,et,ut,I]);const dt=V=>Q.isSectorCompleted(V),{pieces:ht,pieceById:D,getSectorPiecePolysCached:w}=v0(Q),P=Q.state.cfg.input==="click",G=Math.max(k.size.centerBadge.minPx,Z.innerR*k.size.centerBadge.fractionOfOuterR),d=Q.state.cfg.layout==="semicircle"?{x:Z.cx,y:Z.cy-G-k.size.centerBadge.marginPx}:{x:Z.cx,y:Z.cy},z=(V,yt)=>Math.hypot(V-d.x,yt-d.y)<=G,q=lt.useMemo(()=>Q.state.cfg.sectors.map(V=>{var yt;return(yt=V.silhouette.mask)!=null?yt:[]}),[Q.state.cfg.sectors]),C=lt.useMemo(()=>{const V=kh(q.flat());return V?k.layout.grid.unitPx/V:1},[q]),{anchorDots:J}=A0(Q,Z,C),it=lt.useMemo(()=>{var V,yt;const Ut=new Map;for(const ft of Z.sectors){const Tt=(yt=(V=Q.state.cfg.sectors.find(zl=>zl.id===ft.id))==null?void 0:V.silhouette.mask)!=null?yt:[];if(!(Tt!=null&&Tt.length))continue;const At=Ui(Z,ft,"silhouette",1),ql=so(Tt,C,{cx:At.cx,cy:At.cy});Ut.set(ft.id,ql)}return Ut},[Z,C,Q.state.cfg.sectors]),N=V=>{var yt,Ut,ft;if(!V||dt(V))return!1;if(Q.state.cfg.target==="silhouette"){const Tt=(yt=it.get(V))!=null?yt:[];if(!Tt.length)return!1;const At=w(V);if(s0(Tt,At))return Q.markSectorCompleted(V),!0}else{const Tt=(ft=(Ut=Q.state.cfg.sectors.find(zl=>zl.id===V))==null?void 0:Ut.silhouette.mask)!=null?ft:[];if(!Tt.length)return!1;const At=m0(Tt,C),ql=w(V);if(y0(At,ql))return Q.markSectorCompleted(V),!0}return!1},ct=N0(Q,Z,ht,D,J,it,dt,N,I,void 0,ut),{draggingId:W,dragInvalid:nt,svgRef:st,onPiecePointerDown:Y,onBlueprintPointerDown:Mt,onPointerMove:mt,onPointerUp:Jt,setPieceRef:ll,setDraggingId:Gt,lockedPieceId:Nt,dragRef:Wt}=ct,Zt=(V,yt)=>{const Ut=st.current,ft=Ut.createSVGPoint();ft.x=V,ft.y=yt;const Tt=Ut.getScreenCTM();if(!Tt)return{x:0,y:0};const At=ft.matrixTransform(Tt.inverse());return{x:At.x,y:At.y}},Kt=H0(Q,Z,ht,P,W,Gt,Wt,z,dt,N,Zt,I,ut),{selectedPieceId:Pt,onRootPointerDown:Lt}=Kt,al=V=>{if(W)return;const{x:yt,y:Ut}=Zt(V.clientX,V.clientY);if(Q.state.cfg.mode==="prep"){if(!Q.isSubmitEnabled()||et){V.stopPropagation();return}tt(!0),ut&&ut.finalizeTrial("submit"),V.stopPropagation();return}if(ut!=null&&ut.recordClickEvent){const ft=Q.state.blueprintView,Tt=ft==="primitives"?"quickstash":"primitives";ut.recordClickEvent({x:yt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ft,to:Tt}})}Q.switchBlueprintView(),I(),V.stopPropagation()};return lt.createElement("div",{className:"tangram-gameboard",style:L()},lt.createElement(f0,pn({controller:Q,layout:Z,viewBox:ot,width:xt.width,height:xt.height,badgeR:G,badgeCenter:d,placedSilBySector:it,anchorDots:J,pieces:ht,clickMode:P,draggingId:W,selectedPieceId:Pt,dragInvalid:nt,lockedPieceId:Nt,svgRef:st,setPieceRef:ll,onPiecePointerDown:Y,onBlueprintPointerDown:Mt,onRootPointerDown:Lt,onPointerMove:mt,onPointerUp:Jt,onCenterBadgePointerDown:al},Ot)))}const J0=40*Math.SQRT2,_l=J0/2,Al=(c,i)=>({x:c,y:i});function P0(c,i){const r=c.length;if(r===0)return[];const f=(i%r+r)%r;return c.slice(f).concat(c.slice(0,f))}function $0(c,i,r,f,h,v){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Al(r+v*Math.cos(b),f+v*Math.sin(b))}function I0(c,i,r){let f;if(r){const b=r[0],S=r[1],y=Al(-b.x*40,b.y*40),m=Al(-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=[Al(0,0),Al(b,0)]}const h=P0(c,1),v=i;for(let b=1;b<c.length-1;b++){const S=f[b-1],y=f[b];if(!S||!y)continue;const m=h[b-1],g=v[b-1];m===void 0||g===void 0||f.push($0(S.x,S.y,y.x,y.y,g,m))}return f}const W0={"small-triangle":[Al(0,0),Al(.5,.5)],parallelogram:[Al(0,0),Al(.5,0)],"large-triangle":[Al(0,0),Al(.5,-.5)],"med-triangle":[Al(0,0),Al(.5,0)],square:[Al(0,0),Al(.5,0)]},Ro=[{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:small",kind:"small-triangle",sideLens:[_l,_l,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,_l,_l,20,20,_l,_l],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:med",kind:"med-triangle",sideLens:[20,20,20,20,_l,_l,_l,_l],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:large",kind:"large-triangle",sideLens:[_l,_l,_l,_l,20,20,20,20,20,20,20,20],angles:[180,180,180,45,180,180,180,90,180,180,180,45],color:"#8b5cf6"}].map(({id:c,kind:i,sideLens:r,angles:f,color:h})=>{const v=W0[i],b=I0(r,f,v);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:v}=c,b=h.map(y=>({kind:y.kind,offset:{x:y.anchorOffset.x*r,y:y.anchorOffset.y*r}})),S=[];for(const y of h){const m=i.get(y.kind);if(!m)continue;const g={x:y.anchorOffset.x*r,y:y.anchorOffset.y*r};for(const E of m.shape)S.push(E.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:v!=null?v:`Composite-${f}`}}var ty=Object.defineProperty,Uo=Object.getOwnPropertySymbols,ly=Object.prototype.hasOwnProperty,ey=Object.prototype.propertyIsEnumerable,Bo=(c,i,r)=>i in c?ty(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,No=(c,i)=>{for(var r in i||(i={}))ly.call(i,r)&&Bo(c,r,i[r]);if(Uo)for(var r of Uo(i))ey.call(i,r)&&Bo(c,r,i[r]);return c};function ny(c,i,r){const{numQuickstashSlots:f,maxPiecesPerMacro:h,minPiecesPerMacro:v,inputMode:b,layoutMode:S,requireAllSlots:y,quickstashMacros:m,onInteraction:g,onTrialEnd:E}=i,R=Array.from({length:f},(K,$)=>({id:`prep-sector-${$}`,silhouette:{id:`prep-silhouette-${$}`,mask:[]}})),X=Dh.createRoot(c),j=(K,$,gt)=>{if(m&&m.length>0&&$){const bt=new Map;Ro.forEach(Q=>bt.set(Q.kind,Q)),m.forEach((Q,ut)=>{const Z=`prep-sector-${ut}`,ot=F0(Q,bt,k.layout.grid.stepPx),I=$.sectors.find(ht=>ht.id===Z);if(!I)return;const et=Ui($,I,"workspace",1);let tt=1/0,rt=1/0,Ot=-1/0,L=-1/0;ot.parts.forEach(ht=>{const D=bt.get(ht.kind);if(!D)return;const w=It(D,K.getPrimitive),P=ht.offset.x+w.min.x,G=ht.offset.y+w.min.y,d=ht.offset.x+w.max.x,z=ht.offset.y+w.max.y;tt=Math.min(tt,P),rt=Math.min(rt,G),Ot=Math.max(Ot,d),L=Math.max(L,z)});const xt=tt+(Ot-tt)/2,dt=rt+(L-rt)/2;ot.parts.forEach(ht=>{const D=bt.get(ht.kind);if(!D){console.warn(`Unknown primitive kind: ${ht.kind}`);return}const w=It(D,K.getPrimitive),P=ht.offset.x+w.min.x,G=ht.offset.y+w.min.y,d=et.cx+(P-xt),z=et.cy+(G-dt),q=k.layout.grid.stepPx,C=Math.round(d/q)*q,J=Math.round(z/q)*q,it=K.spawnFromBlueprint(D,{x:C,y:J});K.drop(it,Z)})}),gt&>()}};return X.render(lt.createElement(k0,No(No({sectors:R,quickstash:[],primitives:Ro,layout:S,target:"workspace",input:b,timeLimitMs:0,maxQuickstashSlots:0,maxCompositeSize:h,mode:"prep",minPiecesPerMacro:v,requireAllSlots:y,onControllerReady:j},g&&{onInteraction:g}),E&&{onTrialEnd:E}))),{root:X,display_element:c,jsPsych:r}}const ay={name:"tangram-prep",version:"1.0.0",parameters:{num_quickstash_slots:{type:ee.ParameterType.INT,default:void 0},max_pieces_per_macro:{type:ee.ParameterType.INT,default:2},min_pieces_per_macro:{type:ee.ParameterType.INT,default:2},input:{type:ee.ParameterType.STRING,default:"click"},layout:{type:ee.ParameterType.STRING,default:"semicircle"},require_all_slots:{type:ee.ParameterType.BOOL,default:void 0},quickstash_macros:{type:ee.ParameterType.COMPLEX,default:[],description:"Array of AnchorComposite objects to edit as primitive pieces"},onInteraction:{type:ee.ParameterType.FUNCTION,default:void 0},onTrialEnd:{type:ee.ParameterType.FUNCTION,default:void 0}},data:{completed:{type:ee.ParameterType.BOOL}},citations:""};class Ho{constructor(i){this.jsPsych=i}trial(i,r){const f=y=>{r.onTrialEnd&&r.onTrialEnd(y);const m=i.__reactContext;m!=null&&m.root&&m.root.unmount(),i.innerHTML="",this.jsPsych.finishTrial(y)},h={numQuickstashSlots:r.num_quickstash_slots||4,maxPiecesPerMacro:r.max_pieces_per_macro,minPiecesPerMacro:r.min_pieces_per_macro,inputMode:r.input,layoutMode:r.layout,requireAllSlots:r.require_all_slots,quickstashMacros:r.quickstash_macros,onInteraction:r.onInteraction,onTrialEnd:f},{root:v,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:v,jsPsych:S}}}return Ho.info=ay,Ho}(jsPsychModule);
|
|
41
|
+
`).replace(Ym,"")}function Kd(t,l){return l=Ld(l),Ld(t)===l}function si(){}function wt(t,l,e,n,a,u){switch(e){case"children":typeof n=="string"?l==="body"||l==="textarea"&&n===""||_n(t,n):(typeof n=="number"||typeof n=="bigint")&&l!=="body"&&_n(t,""+n);break;case"className":vu(t,"class",n);break;case"tabIndex":vu(t,"tabindex",n);break;case"dir":case"role":case"viewBox":case"width":case"height":vu(t,e,n);break;case"style":Jo(t,n,u);break;case"data":if(l!=="object"){vu(t,"data",n);break}case"src":case"href":if(n===""&&(l!=="a"||e!=="href")){t.removeAttribute(e);break}if(n==null||typeof n=="function"||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(e);break}n=bu(""+n),t.setAttribute(e,n);break;case"action":case"formAction":if(typeof n=="function"){t.setAttribute(e,"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"&&(e==="formAction"?(l!=="input"&&wt(t,l,"name",a.name,a,null),wt(t,l,"formEncType",a.formEncType,a,null),wt(t,l,"formMethod",a.formMethod,a,null),wt(t,l,"formTarget",a.formTarget,a,null)):(wt(t,l,"encType",a.encType,a,null),wt(t,l,"method",a.method,a,null),wt(t,l,"target",a.target,a,null)));if(n==null||typeof n=="symbol"||typeof n=="boolean"){t.removeAttribute(e);break}n=bu(""+n),t.setAttribute(e,n);break;case"onClick":n!=null&&(t.onclick=si);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(e=n.__html,e!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=e}}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}e=bu(""+n),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e);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(e,""+n):t.removeAttribute(e);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(e,""):t.removeAttribute(e);break;case"capture":case"download":n===!0?t.setAttribute(e,""):n!==!1&&n!=null&&typeof n!="function"&&typeof n!="symbol"?t.setAttribute(e,n):t.removeAttribute(e);break;case"cols":case"rows":case"size":case"span":n!=null&&typeof n!="function"&&typeof n!="symbol"&&!isNaN(n)&&1<=n?t.setAttribute(e,n):t.removeAttribute(e);break;case"rowSpan":case"start":n==null||typeof n=="function"||typeof n=="symbol"||isNaN(n)?t.removeAttribute(e):t.setAttribute(e,n);break;case"popover":Rt("beforetoggle",t),Rt("toggle",t),mu(t,"popover",n);break;case"xlinkActuate":he(t,"http://www.w3.org/1999/xlink","xlink:actuate",n);break;case"xlinkArcrole":he(t,"http://www.w3.org/1999/xlink","xlink:arcrole",n);break;case"xlinkRole":he(t,"http://www.w3.org/1999/xlink","xlink:role",n);break;case"xlinkShow":he(t,"http://www.w3.org/1999/xlink","xlink:show",n);break;case"xlinkTitle":he(t,"http://www.w3.org/1999/xlink","xlink:title",n);break;case"xlinkType":he(t,"http://www.w3.org/1999/xlink","xlink:type",n);break;case"xmlBase":he(t,"http://www.w3.org/XML/1998/namespace","xml:base",n);break;case"xmlLang":he(t,"http://www.w3.org/XML/1998/namespace","xml:lang",n);break;case"xmlSpace":he(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<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(e=hy.get(e)||e,mu(t,e,n))}}function Uf(t,l,e,n,a,u){switch(e){case"style":Jo(t,n,u);break;case"dangerouslySetInnerHTML":if(n!=null){if(typeof n!="object"||!("__html"in n))throw Error(f(61));if(e=n.__html,e!=null){if(a.children!=null)throw Error(f(60));t.innerHTML=e}}break;case"children":typeof n=="string"?_n(t,n):(typeof n=="number"||typeof n=="bigint")&&_n(t,""+n);break;case"onScroll":n!=null&&Rt("scroll",t);break;case"onScrollEnd":n!=null&&Rt("scrollend",t);break;case"onClick":n!=null&&(t.onclick=si);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Yo.hasOwnProperty(e))t:{if(e[0]==="o"&&e[1]==="n"&&(a=e.endsWith("Capture"),l=e.slice(2,a?e.length-7:void 0),u=t[Rl]||null,u=u!=null?u[e]:null,typeof u=="function"&&t.removeEventListener(l,u,a),typeof n=="function")){typeof u!="function"&&u!==null&&(e in t?t[e]=null:t.hasAttribute(e)&&t.removeAttribute(e)),t.addEventListener(l,n,a);break t}e in t?t[e]=n:n===!0?t.setAttribute(e,""):mu(t,e,n)}}}function gl(t,l,e){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rt("error",t),Rt("load",t);var n=!1,a=!1,u;for(u in e)if(e.hasOwnProperty(u)){var o=e[u];if(o!=null)switch(u){case"src":n=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(f(137,l));default:wt(t,l,u,o,e,null)}}a&&wt(t,l,"srcSet",e.srcSet,e,null),n&&wt(t,l,"src",e.src,e,null);return;case"input":Rt("invalid",t);var s=u=o=a=null,p=null,T=null;for(n in e)if(e.hasOwnProperty(n)){var U=e[n];if(U!=null)switch(n){case"name":a=U;break;case"type":o=U;break;case"checked":p=U;break;case"defaultChecked":T=U;break;case"value":u=U;break;case"defaultValue":s=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(f(137,l));break;default:wt(t,l,n,U,e,null)}}Zo(t,u,s,p,T,o,a,!1),pu(t);return;case"select":Rt("invalid",t),n=o=u=null;for(a in e)if(e.hasOwnProperty(a)&&(s=e[a],s!=null))switch(a){case"value":u=s;break;case"defaultValue":o=s;break;case"multiple":n=s;default:wt(t,l,a,s,e,null)}l=u,e=o,t.multiple=!!n,l!=null?On(t,!!n,l,!1):e!=null&&On(t,!!n,e,!0);return;case"textarea":Rt("invalid",t),u=a=n=null;for(o in e)if(e.hasOwnProperty(o)&&(s=e[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,l,o,s,e,null)}Ko(t,n,a,u),pu(t);return;case"option":for(p in e)if(e.hasOwnProperty(p)&&(n=e[p],n!=null))switch(p){case"selected":t.selected=n&&typeof n!="function"&&typeof n!="symbol";break;default:wt(t,l,p,n,e,null)}return;case"dialog":Rt("beforetoggle",t),Rt("toggle",t),Rt("cancel",t),Rt("close",t);break;case"iframe":case"object":Rt("load",t);break;case"video":case"audio":for(n=0;n<Pa.length;n++)Rt(Pa[n],t);break;case"image":Rt("error",t),Rt("load",t);break;case"details":Rt("toggle",t);break;case"embed":case"source":case"link":Rt("error",t),Rt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(T in e)if(e.hasOwnProperty(T)&&(n=e[T],n!=null))switch(T){case"children":case"dangerouslySetInnerHTML":throw Error(f(137,l));default:wt(t,l,T,n,e,null)}return;default:if(Ki(l)){for(U in e)e.hasOwnProperty(U)&&(n=e[U],n!==void 0&&Uf(t,l,U,n,e,void 0));return}}for(s in e)e.hasOwnProperty(s)&&(n=e[s],n!=null&&wt(t,l,s,n,e,null))}function Gm(t,l,e,n){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,u=null,o=null,s=null,p=null,T=null,U=null;for(_ in e){var H=e[_];if(e.hasOwnProperty(_)&&H!=null)switch(_){case"checked":break;case"value":break;case"defaultValue":p=H;default:n.hasOwnProperty(_)||wt(t,l,_,null,n,H)}}for(var O in n){var _=n[O];if(H=e[O],n.hasOwnProperty(O)&&(_!=null||H!=null))switch(O){case"type":u=_;break;case"name":a=_;break;case"checked":T=_;break;case"defaultChecked":U=_;break;case"value":o=_;break;case"defaultValue":s=_;break;case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(f(137,l));break;default:_!==H&&wt(t,l,O,_,n,H)}}Zi(t,o,s,p,T,U,u,a);return;case"select":_=o=s=O=null;for(u in e)if(p=e[u],e.hasOwnProperty(u)&&p!=null)switch(u){case"value":break;case"multiple":_=p;default:n.hasOwnProperty(u)||wt(t,l,u,null,n,p)}for(a in n)if(u=n[a],p=e[a],n.hasOwnProperty(a)&&(u!=null||p!=null))switch(a){case"value":O=u;break;case"defaultValue":s=u;break;case"multiple":o=u;default:u!==p&&wt(t,l,a,u,n,p)}l=s,e=o,n=_,O!=null?On(t,!!e,O,!1):!!n!=!!e&&(l!=null?On(t,!!e,l,!0):On(t,!!e,e?[]:"",!1));return;case"textarea":_=O=null;for(s in e)if(a=e[s],e.hasOwnProperty(s)&&a!=null&&!n.hasOwnProperty(s))switch(s){case"value":break;case"children":break;default:wt(t,l,s,null,n,a)}for(o in n)if(a=n[o],u=e[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,l,o,a,n,u)}Lo(t,O,_);return;case"option":for(var St in e)if(O=e[St],e.hasOwnProperty(St)&&O!=null&&!n.hasOwnProperty(St))switch(St){case"selected":t.selected=!1;break;default:wt(t,l,St,null,n,O)}for(p in n)if(O=n[p],_=e[p],n.hasOwnProperty(p)&&O!==_&&(O!=null||_!=null))switch(p){case"selected":t.selected=O&&typeof O!="function"&&typeof O!="symbol";break;default:wt(t,l,p,O,n,_)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var vt in e)O=e[vt],e.hasOwnProperty(vt)&&O!=null&&!n.hasOwnProperty(vt)&&wt(t,l,vt,null,n,O);for(T in n)if(O=n[T],_=e[T],n.hasOwnProperty(T)&&O!==_&&(O!=null||_!=null))switch(T){case"children":case"dangerouslySetInnerHTML":if(O!=null)throw Error(f(137,l));break;default:wt(t,l,T,O,n,_)}return;default:if(Ki(l)){for(var jt in e)O=e[jt],e.hasOwnProperty(jt)&&O!==void 0&&!n.hasOwnProperty(jt)&&Uf(t,l,jt,void 0,n,O);for(U in n)O=n[U],_=e[U],!n.hasOwnProperty(U)||O===_||O===void 0&&_===void 0||Uf(t,l,U,O,n,_);return}}for(var M in e)O=e[M],e.hasOwnProperty(M)&&O!=null&&!n.hasOwnProperty(M)&&wt(t,l,M,null,n,O);for(H in n)O=n[H],_=e[H],!n.hasOwnProperty(H)||O===_||O==null&&_==null||wt(t,l,H,O,n,_)}var Bf=null,Nf=null;function di(t){return t.nodeType===9?t:t.ownerDocument}function kd(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Jd(t,l){if(t===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&l==="foreignObject"?0:t}function Hf(t,l){return t==="textarea"||t==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var qf=null;function Xm(){var t=window.event;return t&&t.type==="popstate"?t===qf?!1:(qf=t,!0):(qf=null,!1)}var Pd=typeof setTimeout=="function"?setTimeout:void 0,wm=typeof clearTimeout=="function"?clearTimeout:void 0,$d=typeof Promise=="function"?Promise:void 0,jm=typeof queueMicrotask=="function"?queueMicrotask:typeof $d!="undefined"?function(t){return $d.resolve(null).then(t).catch(Qm)}:Pd;function Qm(t){setTimeout(function(){throw t})}function Le(t){return t==="head"}function Id(t,l){var e=l,n=0,a=0;do{var u=e.nextSibling;if(t.removeChild(e),u&&u.nodeType===8)if(e=u.data,e==="/$"){if(0<n&&8>n){e=n;var o=t.ownerDocument;if(e&1&&Ia(o.documentElement),e&2&&Ia(o.body),e&4)for(e=o.head,Ia(e),o=e.firstChild;o;){var s=o.nextSibling,p=o.nodeName;o[da]||p==="SCRIPT"||p==="STYLE"||p==="LINK"&&o.rel.toLowerCase()==="stylesheet"||e.removeChild(o),o=s}}if(a===0){t.removeChild(u),uu(l);return}a--}else e==="$"||e==="$?"||e==="$!"?a++:n=e.charCodeAt(0)-48;else n=0;e=u}while(e);uu(l)}function Cf(t){var l=t.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var e=l;switch(l=l.nextSibling,e.nodeName){case"HTML":case"HEAD":case"BODY":Cf(e),wi(e);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(e.rel.toLowerCase()==="stylesheet")continue}t.removeChild(e)}}function Vm(t,l,e,n){for(;t.nodeType===1;){var a=e;if(t.nodeName.toLowerCase()!==l.toLowerCase()){if(!n&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(n){if(!t[da])switch(l){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(l==="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=le(t.nextSibling),t===null)break}return null}function Zm(t,l,e){if(l==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=le(t.nextSibling),t===null))return null;return t}function Yf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function Lm(t,l){var e=t.ownerDocument;if(t.data!=="$?"||e.readyState==="complete")l();else{var n=function(){l(),e.removeEventListener("DOMContentLoaded",n)};e.addEventListener("DOMContentLoaded",n),t._reactRetry=n}}function le(t){for(;t!=null;t=t.nextSibling){var l=t.nodeType;if(l===1||l===3)break;if(l===8){if(l=t.data,l==="$"||l==="$!"||l==="$?"||l==="F!"||l==="F")break;if(l==="/$")return null}}return t}var Gf=null;function Wd(t){t=t.previousSibling;for(var l=0;t;){if(t.nodeType===8){var e=t.data;if(e==="$"||e==="$!"||e==="$?"){if(l===0)return t;l--}else e==="/$"&&l++}t=t.previousSibling}return null}function Fd(t,l,e){switch(l=di(e),t){case"html":if(t=l.documentElement,!t)throw Error(f(452));return t;case"head":if(t=l.head,!t)throw Error(f(453));return t;case"body":if(t=l.body,!t)throw Error(f(454));return t;default:throw Error(f(451))}}function Ia(t){for(var l=t.attributes;l.length;)t.removeAttributeNode(l[0]);wi(t)}var Wl=new Map,th=new Set;function hi(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var _e=w.d;w.d={f:Km,r:km,D:Jm,C:Pm,L:$m,m:Im,X:Fm,S:Wm,M:tv};function Km(){var t=_e.f(),l=ai();return t||l}function km(t){var l=Mn(t);l!==null&&l.tag===5&&l.type==="form"?Ss(l):_e.r(t)}var ea=typeof document=="undefined"?null:document;function lh(t,l,e){var n=ea;if(n&&typeof l=="string"&&l){var a=Ll(l);a='link[rel="'+t+'"][href="'+a+'"]',typeof e=="string"&&(a+='[crossorigin="'+e+'"]'),th.has(a)||(th.add(a),t={rel:t,crossOrigin:e,href:l},n.querySelector(a)===null&&(l=n.createElement("link"),gl(l,"link",t),sl(l),n.head.appendChild(l)))}}function Jm(t){_e.D(t),lh("dns-prefetch",t,null)}function Pm(t,l){_e.C(t,l),lh("preconnect",t,l)}function $m(t,l,e){_e.L(t,l,e);var n=ea;if(n&&t&&l){var a='link[rel="preload"][as="'+Ll(l)+'"]';l==="image"&&e&&e.imageSrcSet?(a+='[imagesrcset="'+Ll(e.imageSrcSet)+'"]',typeof e.imageSizes=="string"&&(a+='[imagesizes="'+Ll(e.imageSizes)+'"]')):a+='[href="'+Ll(t)+'"]';var u=a;switch(l){case"style":u=na(t);break;case"script":u=aa(t)}Wl.has(u)||(t=g({rel:"preload",href:l==="image"&&e&&e.imageSrcSet?void 0:t,as:l},e),Wl.set(u,t),n.querySelector(a)!==null||l==="style"&&n.querySelector(Wa(u))||l==="script"&&n.querySelector(Fa(u))||(l=n.createElement("link"),gl(l,"link",t),sl(l),n.head.appendChild(l)))}}function Im(t,l){_e.m(t,l);var e=ea;if(e&&t){var n=l&&typeof l.as=="string"?l.as:"script",a='link[rel="modulepreload"][as="'+Ll(n)+'"][href="'+Ll(t)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=aa(t)}if(!Wl.has(u)&&(t=g({rel:"modulepreload",href:t},l),Wl.set(u,t),e.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(e.querySelector(Fa(u)))return}n=e.createElement("link"),gl(n,"link",t),sl(n),e.head.appendChild(n)}}}function Wm(t,l,e){_e.S(t,l,e);var n=ea;if(n&&t){var a=An(n).hoistableStyles,u=na(t);l=l||"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":l},e),(e=Wl.get(u))&&Xf(t,e);var p=o=n.createElement("link");sl(p),gl(p,"link",t),p._p=new Promise(function(T,U){p.onload=T,p.onerror=U}),p.addEventListener("load",function(){s.loading|=1}),p.addEventListener("error",function(){s.loading|=2}),s.loading|=4,yi(o,l,n)}o={type:"stylesheet",instance:o,count:1,state:s},a.set(u,o)}}}function Fm(t,l){_e.X(t,l);var e=ea;if(e&&t){var n=An(e).hoistableScripts,a=aa(t),u=n.get(a);u||(u=e.querySelector(Fa(a)),u||(t=g({src:t,async:!0},l),(l=Wl.get(a))&&wf(t,l),u=e.createElement("script"),sl(u),gl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function tv(t,l){_e.M(t,l);var e=ea;if(e&&t){var n=An(e).hoistableScripts,a=aa(t),u=n.get(a);u||(u=e.querySelector(Fa(a)),u||(t=g({src:t,async:!0,type:"module"},l),(l=Wl.get(a))&&wf(t,l),u=e.createElement("script"),sl(u),gl(u,"link",t),e.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function eh(t,l,e,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 e.precedence=="string"&&typeof e.href=="string"?(l=na(e.href),e=An(a).hoistableStyles,n=e.get(l),n||(n={type:"style",instance:null,count:0,state:null},e.set(l,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(e.rel==="stylesheet"&&typeof e.href=="string"&&typeof e.precedence=="string"){t=na(e.href);var u=An(a).hoistableStyles,o=u.get(t);if(o||(a=a.ownerDocument||a,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(t,o),(u=a.querySelector(Wa(t)))&&!u._p&&(o.instance=u,o.state.loading=5),Wl.has(t)||(e={rel:"preload",as:"style",href:e.href,crossOrigin:e.crossOrigin,integrity:e.integrity,media:e.media,hrefLang:e.hrefLang,referrerPolicy:e.referrerPolicy},Wl.set(t,e),u||lv(a,t,e,o.state))),l&&n===null)throw Error(f(528,""));return o}if(l&&n!==null)throw Error(f(529,""));return null;case"script":return l=e.async,e=e.src,typeof e=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=aa(e),e=An(a).hoistableScripts,n=e.get(l),n||(n={type:"script",instance:null,count:0,state:null},e.set(l,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(f(444,t))}}function na(t){return'href="'+Ll(t)+'"'}function Wa(t){return'link[rel="stylesheet"]['+t+"]"}function nh(t){return g({},t,{"data-precedence":t.precedence,precedence:null})}function lv(t,l,e,n){t.querySelector('link[rel="preload"][as="style"]['+l+"]")?n.loading=1:(l=t.createElement("link"),n.preload=l,l.addEventListener("load",function(){return n.loading|=1}),l.addEventListener("error",function(){return n.loading|=2}),gl(l,"link",e),sl(l),t.head.appendChild(l))}function aa(t){return'[src="'+Ll(t)+'"]'}function Fa(t){return"script[async]"+t}function ah(t,l,e){if(l.count++,l.instance===null)switch(l.type){case"style":var n=t.querySelector('style[data-href~="'+Ll(e.href)+'"]');if(n)return l.instance=n,sl(n),n;var a=g({},e,{"data-href":e.href,"data-precedence":e.precedence,href:null,precedence:null});return n=(t.ownerDocument||t).createElement("style"),sl(n),gl(n,"style",a),yi(n,e.precedence,t),l.instance=n;case"stylesheet":a=na(e.href);var u=t.querySelector(Wa(a));if(u)return l.state.loading|=4,l.instance=u,sl(u),u;n=nh(e),(a=Wl.get(a))&&Xf(n,a),u=(t.ownerDocument||t).createElement("link"),sl(u);var o=u;return o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),gl(u,"link",n),l.state.loading|=4,yi(u,e.precedence,t),l.instance=u;case"script":return u=aa(e.src),(a=t.querySelector(Fa(u)))?(l.instance=a,sl(a),a):(n=e,(a=Wl.get(u))&&(n=g({},e),wf(n,a)),t=t.ownerDocument||t,a=t.createElement("script"),sl(a),gl(a,"link",n),t.head.appendChild(a),l.instance=a);case"void":return null;default:throw Error(f(443,l.type))}else l.type==="stylesheet"&&!(l.state.loading&4)&&(n=l.instance,l.state.loading|=4,yi(n,e.precedence,t));return l.instance}function yi(t,l,e){for(var n=e.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===l)u=s;else if(u!==a)break}u?u.parentNode.insertBefore(t,u.nextSibling):(l=e.nodeType===9?e.head:e,l.insertBefore(t,l.firstChild))}function Xf(t,l){t.crossOrigin==null&&(t.crossOrigin=l.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=l.referrerPolicy),t.title==null&&(t.title=l.title)}function wf(t,l){t.crossOrigin==null&&(t.crossOrigin=l.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=l.referrerPolicy),t.integrity==null&&(t.integrity=l.integrity)}var mi=null;function uh(t,l,e){if(mi===null){var n=new Map,a=mi=new Map;a.set(e,n)}else a=mi,n=a.get(e),n||(n=new Map,a.set(e,n));if(n.has(t))return n;for(n.set(t,null),e=e.getElementsByTagName(t),a=0;a<e.length;a++){var u=e[a];if(!(u[da]||u[Sl]||t==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var o=u.getAttribute(l)||"";o=t+o;var s=n.get(o);s?s.push(u):n.set(o,[u])}}return n}function ih(t,l,e){t=t.ownerDocument||t,t.head.insertBefore(e,l==="title"?t.querySelector("head > title"):null)}function ev(t,l,e){if(e===1||l.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return t=l.disabled,typeof l.precedence=="string"&&t==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function ch(t){return!(t.type==="stylesheet"&&!(t.state.loading&3))}var tu=null;function nv(){}function av(t,l,e){if(tu===null)throw Error(f(475));var n=tu;if(l.type==="stylesheet"&&(typeof e.media!="string"||matchMedia(e.media).matches!==!1)&&!(l.state.loading&4)){if(l.instance===null){var a=na(e.href),u=t.querySelector(Wa(a));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(n.count++,n=vi.bind(n),t.then(n,n)),l.state.loading|=4,l.instance=u,sl(u);return}u=t.ownerDocument||t,e=nh(e),(a=Wl.get(a))&&Xf(e,a),u=u.createElement("link"),sl(u);var o=u;o._p=new Promise(function(s,p){o.onload=s,o.onerror=p}),gl(u,"link",e),l.instance=u}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(l,t),(t=l.state.preload)&&!(l.state.loading&3)&&(n.count++,l=vi.bind(n),t.addEventListener("load",l),t.addEventListener("error",l))}}function uv(){if(tu===null)throw Error(f(475));var t=tu;return t.stylesheets&&t.count===0&&jf(t,t.stylesheets),0<t.count?function(l){var e=setTimeout(function(){if(t.stylesheets&&jf(t,t.stylesheets),t.unsuspend){var n=t.unsuspend;t.unsuspend=null,n()}},6e4);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(e)}}:null}function vi(){if(this.count--,this.count===0){if(this.stylesheets)jf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pi=null;function jf(t,l){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pi=new Map,l.forEach(iv,t),pi=null,vi.call(t))}function iv(t,l){if(!(l.state.loading&4)){var e=pi.get(t);if(e)var n=e.get(null);else{e=new Map,pi.set(t,e);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")&&(e.set(o.dataset.precedence,o),n=o)}n&&e.set(null,n)}a=l.instance,o=a.getAttribute("data-precedence"),u=e.get(o)||n,u===n&&e.set(null,a),e.set(o,a),this.count++,n=vi.bind(this),a.addEventListener("load",n),a.addEventListener("error",n),u?u.parentNode.insertBefore(a,u.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),l.state.loading|=4}}var lu={$$typeof:Q,Provider:null,Consumer:null,_currentValue:P,_currentValue2:P,_threadCount:0};function cv(t,l,e,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=ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ue(0),this.hiddenUpdates=ue(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 fh(t,l,e,n,a,u,o,s,p,T,U,H){return t=new cv(t,l,e,o,s,p,T,H),l=1,u===!0&&(l|=24),u=Yl(3,null,null,l),t.current=u,u.stateNode=t,l=xc(),l.refCount++,t.pooledCache=l,l.refCount++,u.memoizedState={element:n,isDehydrated:e,cache:l},Ec(u),t}function oh(t){return t?(t=qn,t):qn}function rh(t,l,e,n,a,u){a=oh(a),n.context===null?n.context=a:n.pendingContext=a,n=Be(l),n.payload={element:e},u=u===void 0?null:u,u!==null&&(n.callback=u),e=Ne(t,n,l),e!==null&&(Ql(e,t,l),Ua(e,t,l))}function sh(t,l){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var e=t.retryLane;t.retryLane=e!==0&&e<l?e:l}}function Qf(t,l){sh(t,l),(t=t.alternate)&&sh(t,l)}function dh(t){if(t.tag===13){var l=Hn(t,67108864);l!==null&&Ql(l,t,67108864),Qf(t,67108864)}}var gi=!0;function fv(t,l,e,n){var a=D.T;D.T=null;var u=w.p;try{w.p=2,Vf(t,l,e,n)}finally{w.p=u,D.T=a}}function ov(t,l,e,n){var a=D.T;D.T=null;var u=w.p;try{w.p=8,Vf(t,l,e,n)}finally{w.p=u,D.T=a}}function Vf(t,l,e,n){if(gi){var a=Zf(n);if(a===null)Rf(t,l,n,bi,e),yh(t,n);else if(sv(a,t,l,e,n))n.stopPropagation();else if(yh(t,n),l&4&&-1<rv.indexOf(t)){for(;a!==null;){var u=Mn(a);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var o=cl(u.pendingLanes);if(o!==0){var s=u;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var p=1<<31-At(o);s.entanglements[1]|=p,o&=~p}se(u),!(Ct&6)&&(ei=Nt()+500,Ja(0))}}break;case 13:s=Hn(u,2),s!==null&&Ql(s,u,2),ai(),Qf(u,2)}if(u=Zf(n),u===null&&Rf(t,l,n,bi,e),u===a)break;a=u}a!==null&&n.stopPropagation()}else Rf(t,l,n,null,e)}}function Zf(t){return t=Ji(t),Lf(t)}var bi=null;function Lf(t){if(bi=null,t=xn(t),t!==null){var l=v(t);if(l===null)t=null;else{var e=l.tag;if(e===13){if(t=b(l),t!==null)return t;t=null}else if(e===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;t=null}else l!==t&&(t=null)}}return bi=t,null}function hh(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Wt()){case Zt:return 2;case Kt:return 8;case Pt:case Lt:return 32;case al:return 268435456;default:return 32}default:return 32}}var Kf=!1,Ke=null,ke=null,Je=null,eu=new Map,nu=new Map,Pe=[],rv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function yh(t,l){switch(t){case"focusin":case"focusout":Ke=null;break;case"dragenter":case"dragleave":ke=null;break;case"mouseover":case"mouseout":Je=null;break;case"pointerover":case"pointerout":eu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":nu.delete(l.pointerId)}}function au(t,l,e,n,a,u){return t===null||t.nativeEvent!==u?(t={blockedOn:l,domEventName:e,eventSystemFlags:n,nativeEvent:u,targetContainers:[a]},l!==null&&(l=Mn(l),l!==null&&dh(l)),t):(t.eventSystemFlags|=n,l=t.targetContainers,a!==null&&l.indexOf(a)===-1&&l.push(a),t)}function sv(t,l,e,n,a){switch(l){case"focusin":return Ke=au(Ke,t,l,e,n,a),!0;case"dragenter":return ke=au(ke,t,l,e,n,a),!0;case"mouseover":return Je=au(Je,t,l,e,n,a),!0;case"pointerover":var u=a.pointerId;return eu.set(u,au(eu.get(u)||null,t,l,e,n,a)),!0;case"gotpointercapture":return u=a.pointerId,nu.set(u,au(nu.get(u)||null,t,l,e,n,a)),!0}return!1}function mh(t){var l=xn(t.target);if(l!==null){var e=v(l);if(e!==null){if(l=e.tag,l===13){if(l=b(e),l!==null){t.blockedOn=l,Gi(t.priority,function(){if(e.tag===13){var n=jl();n=sa(n);var a=Hn(e,n);a!==null&&Ql(a,e,n),Qf(e,n)}});return}}else if(l===3&&e.stateNode.current.memoizedState.isDehydrated){t.blockedOn=e.tag===3?e.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Si(t){if(t.blockedOn!==null)return!1;for(var l=t.targetContainers;0<l.length;){var e=Zf(t.nativeEvent);if(e===null){e=t.nativeEvent;var n=new e.constructor(e.type,e);ki=n,e.target.dispatchEvent(n),ki=null}else return l=Mn(e),l!==null&&dh(l),t.blockedOn=e,!1;l.shift()}return!0}function vh(t,l,e){Si(t)&&e.delete(l)}function dv(){Kf=!1,Ke!==null&&Si(Ke)&&(Ke=null),ke!==null&&Si(ke)&&(ke=null),Je!==null&&Si(Je)&&(Je=null),eu.forEach(vh),nu.forEach(vh)}function xi(t,l){t.blockedOn===l&&(t.blockedOn=null,Kf||(Kf=!0,c.unstable_scheduleCallback(c.unstable_NormalPriority,dv)))}var Mi=null;function ph(t){Mi!==t&&(Mi=t,c.unstable_scheduleCallback(c.unstable_NormalPriority,function(){Mi===t&&(Mi=null);for(var l=0;l<t.length;l+=3){var e=t[l],n=t[l+1],a=t[l+2];if(typeof n!="function"){if(Lf(n||e)===null)continue;break}var u=Mn(e);u!==null&&(t.splice(l,3),l-=3,Zc(u,{pending:!0,data:a,method:e.method,action:n},n,a))}}))}function uu(t){function l(p){return xi(p,t)}Ke!==null&&xi(Ke,t),ke!==null&&xi(ke,t),Je!==null&&xi(Je,t),eu.forEach(l),nu.forEach(l);for(var e=0;e<Pe.length;e++){var n=Pe[e];n.blockedOn===t&&(n.blockedOn=null)}for(;0<Pe.length&&(e=Pe[0],e.blockedOn===null);)mh(e),e.blockedOn===null&&Pe.shift();if(e=(t.ownerDocument||t).$$reactFormReplay,e!=null)for(n=0;n<e.length;n+=3){var a=e[n],u=e[n+1],o=a[Rl]||null;if(typeof u=="function")o||ph(e);else if(o){var s=null;if(u&&u.hasAttribute("formAction")){if(a=u,o=u[Rl]||null)s=o.formAction;else if(Lf(a)!==null)continue}else s=o.action;typeof s=="function"?e[n+1]=s:(e.splice(n,3),n-=3),ph(e)}}}function kf(t){this._internalRoot=t}Ai.prototype.render=kf.prototype.render=function(t){var l=this._internalRoot;if(l===null)throw Error(f(409));var e=l.current,n=jl();rh(e,n,t,l,null,null)},Ai.prototype.unmount=kf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var l=t.containerInfo;rh(t.current,2,null,t,null,null),ai(),l[Sn]=null}};function Ai(t){this._internalRoot=t}Ai.prototype.unstable_scheduleHydration=function(t){if(t){var l=bn();t={blockedOn:null,target:t,priority:l};for(var e=0;e<Pe.length&&l!==0&&l<Pe[e].priority;e++);Pe.splice(e,0,t),e===0&&mh(t)}};var gh=i.version;if(gh!=="19.1.1")throw Error(f(527,gh,"19.1.1"));w.findDOMNode=function(t){var l=t._reactInternals;if(l===void 0)throw typeof t.render=="function"?Error(f(188)):(t=Object.keys(t).join(","),Error(f(268,t)));return t=y(l),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var hv={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"){var Ti=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ti.isDisabled&&Ti.supportsFiber)try{Ut=Ti.inject(hv),ft=Ti}catch(t){}}return ua.createRoot=function(t,l){if(!h(t))throw Error(f(299));var e=!1,n="",a=Hs,u=qs,o=Cs,s=null;return l!=null&&(l.unstable_strictMode===!0&&(e=!0),l.identifierPrefix!==void 0&&(n=l.identifierPrefix),l.onUncaughtError!==void 0&&(a=l.onUncaughtError),l.onCaughtError!==void 0&&(u=l.onCaughtError),l.onRecoverableError!==void 0&&(o=l.onRecoverableError),l.unstable_transitionCallbacks!==void 0&&(s=l.unstable_transitionCallbacks)),l=fh(t,1,!1,null,null,e,n,a,u,o,s,null),t[Sn]=l.current,Df(t),new kf(l)},ua.hydrateRoot=function(t,l,e){if(!h(t))throw Error(f(299));var n=!1,a="",u=Hs,o=qs,s=Cs,p=null,T=null;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(a=e.identifierPrefix),e.onUncaughtError!==void 0&&(u=e.onUncaughtError),e.onCaughtError!==void 0&&(o=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError),e.unstable_transitionCallbacks!==void 0&&(p=e.unstable_transitionCallbacks),e.formState!==void 0&&(T=e.formState)),l=fh(t,1,!0,l,e!=null?e:null,n,a,u,o,s,p,T),l.context=oh(null),e=l.current,n=jl(),n=sa(n),a=Be(n),a.callback=null,Ne(e,a,n),e=n,l.current.lanes=e,El(l,e),se(l),t[Sn]=l.current,Df(t),new Ai(l)},ua.version="19.1.1",ua}function ao(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__=="undefined"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ao)}catch(c){console.error(c)}}ao(),If.exports=zh();var Dh=If.exports;const k={color:{bands:{silhouette:{fillEven:"#eef2ff",fillOdd:"#f6f7fb",stroke:"#c7d2fe"},workspace:{fillEven:"#f3f4f6",fillOdd:"#f9fafb",stroke:"#e5e7eb"}},completion:{fill:"#dcfce7",stroke:"#86efac"},silhouetteMask:"#94a3b8",anchors:{invalid:"#7dd3fc",valid:"#475569"},piece:{draggingFill:"#1d4ed8",validFill:"#60a5fa",invalidFill:"#ef4444",invalidStroke:"#dc2626",selectedStroke:"#111827",allGreenStroke:"#86efac",borderStroke:"#374151"},ui:{light:"#60a5fa",dark:"#1d4ed8"},blueprint:{fill:"#374151",selectedStroke:"#111827",badgeFill:"#eef2ff",labelFill:"#374151"}},opacity:{blueprint:.95,silhouetteMask:.45,anchors:{valid:.8,invalid:.5},piece:{invalid:.35,dragging:.6,locked:.7,normal:.95}},size:{stroke:{bandPx:1,pieceSelectedPx:1.5,allGreenStrokePx:6,pieceBorderPx:1},anchorRadiusPx:{valid:1,invalid:1},badgeFontPx:12,centerBadge:{fractionOfOuterR:.15,minPx:20,marginPx:4}},layout:{grid:{stepPx:20,unitPx:40},paddingPx:1,constraints:{workspaceDiamAnchors:10,quickstashDiamAnchors:7,primitiveDiamAnchors:5},defaults:{maxQuickstashSlots:1}},game:{snapRadiusPx:15,showBorders:!0,hideTouchingBorders:!0}};function Rh(c){return c.parts!==void 0}function Uh(c){return!Rh(c)}class Bh{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),Uh(i)&&this.primitivesByKind.set(i.kind,i)}get(i){return this.byId.get(i)}getPrimitive(i){return this.primitivesByKind.get(i)}}var Nh=Object.defineProperty,Hh=Object.defineProperties,qh=Object.getOwnPropertyDescriptors,uo=Object.getOwnPropertySymbols,Ch=Object.prototype.hasOwnProperty,Yh=Object.prototype.propertyIsEnumerable,io=(c,i,r)=>i in c?Nh(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,zi=(c,i)=>{for(var r in i||(i={}))Ch.call(i,r)&&io(c,r,i[r]);if(uo)for(var r of uo(i))Yh.call(i,r)&&io(c,r,i[r]);return c},Gh=(c,i)=>Hh(c,qh(i));let Xh=0;const wh=()=>`p_${++Xh}`,iu=()=>performance.now();class jh{constructor(i,r,f,h){if(this.registry=new Bh,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(),console.log("[BaseGameController] all sectors complete")))}spawnFromBlueprint(i,r){const f=wh(),h={id:f,blueprintId:i.id,pos:zi({},r)};return this.getFloating().pieces.push(h),this.notifyStateChange(),f}move(i,r){const f=this.findPiece(i);f&&(f.pos=zi({},r),this.notifyStateChange())}drop(i,r){const f=this.findPiece(i);if(!f)return;const h=this.findPieceLocation(i);if(this.removeFromCurrent(i),h!=null&&h.sectorId&&delete f.sectorId,!r){this.getFloating().pieces.push(f),this.notifyStateChange();return}if(this.isSectorCompleted(r)){this.notifyStateChange();return}const v=this.state.sectors[r];v&&(v.pieces.push(f),f.sectorId=r,this.notifyStateChange())}remove(i){const r=this.findPieceLocation(i);r&&(r.array.splice(r.index,1),this.notifyStateChange())}findPiece(i){var r;for(const f of Object.values(this.state.sectors)){const h=f.pieces.find(v=>v.id===i);if(h)return h}return(r=this.getFloating().pieces.find(f=>f.id===i))!=null?r:null}getFloating(){return this._floating||(this._floating={sectorId:"-floating-",pieces:[]}),this._floating}findPieceLocation(i){for(const h of Object.values(this.state.sectors)){const v=h,b=v.pieces.findIndex(S=>S.id===i);if(b>=0)return{sectorId:v.sectorId,array:v.pieces,index:b}}const r=this.getFloating(),f=r.pieces.findIndex(h=>h.id===i);return f>=0?{array:r.pieces,index:f}:null}removeFromCurrent(i){const r=this.findPieceLocation(i);r&&r.array.splice(r.index,1)}switchBlueprintView(){if(this.config.mode==="prep")return;const i=this.state.blueprintView==="primitives"?"quickstash":"primitives";this.state.blueprintView=i}isSubmitEnabled(){var i,r,f;if(this.config.mode!=="prep")return!0;const h=(i=this.config.minPiecesPerMacro)!=null?i:2,v=(r=this.config.maxCompositeSize)!=null?r:1/0,b=(f=this.config.requireAllSlots)!=null?f:!1,S=Object.values(this.state.sectors);let y=0;for(const m of S){const g=m.pieces.length;if(g>=h&&g<=v)y++;else if(g>0)return!1}return b?y===S.length:!0}snapshot(){return{perSector:Object.values(this.state.sectors).map(i=>{const r=i,f={sectorId:r.sectorId,pieceCount:r.pieces.length};return r.completedAt?Gh(zi({},f),{completedAt:r.completedAt}):f}),events:[],timeMs:iu()-this.t0,completed:!!this.state.endedAt}}}function Qh(c,i,r,f=1e-9){const h=(r.y-i.y)*(c.x-i.x)-(r.x-i.x)*(c.y-i.y);if(Math.abs(h)>f)return!1;const v=Math.min(i.x,r.x)-f,b=Math.max(i.x,r.x)+f,S=Math.min(i.y,r.y)-f,y=Math.max(i.y,r.y)+f;return c.x>=v&&c.x<=b&&c.y>=S&&c.y<=y}function cu(c,i){for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[h],b=i[f];if(!(!v||!b)&&Qh(c,v,b))return!0}let r=!1;for(let f=0,h=i.length-1;f<i.length;h=f++){const v=i[f],b=i[h];if(!v||!b)continue;const S=v.x,y=v.y,m=b.x,g=b.y;y>c.y!=g>c.y&&c.x<(m-S)*(c.y-y)/(g-y+1e-12)+S&&(r=!r)}return r}function co(c,i,r){let f=1/0,h=-1/0;for(const v of c){const b=v.x*i+v.y*r;b<f&&(f=b),b>h&&(h=b)}return{min:f,max:h}}const mn=1e-6;function Vh(c,i){const r=[c,i];for(const f of r)for(let h=0;h<f.length;h++){const v=f[h],b=f[(h+1)%f.length];if(!v||!b)continue;const S=b.x-v.x,y=-(b.y-v.y),m=S,g=co(c,y,m),E=co(i,y,m);if(g.max<=E.min+mn||E.max<=g.min+mn)return!1}return!0}function Zh(c,i){const r=c.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}}),f=i.map(h=>{let v=1/0,b=1/0,S=-1/0,y=-1/0;for(const m of h)m.x<v&&(v=m.x),m.y<b&&(b=m.y),m.x>S&&(S=m.x),m.y>y&&(y=m.y);return{minX:v,minY:b,maxX:S,maxY:y}});for(let h=0;h<c.length;h++)for(let v=0;v<i.length;v++){const b=c[h],S=i[v],y=r[h],m=f[v];if(!(!b||!S||!y||!m)&&!(y.maxX<=m.minX+mn||m.maxX<=y.minX+mn||y.maxY<=m.minY+mn||m.maxY<=y.minY+mn)&&Vh(b,S))return!0}return!1}function Lh(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(1,f-i),b=Math.max(1,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b,cx:(i+f)/2,cy:(r+h)/2}}function fo(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=Math.max(0,f-i),b=Math.max(0,h-r);return{min:{x:i,y:r},max:{x:f,y:h},width:v,height:b}}function oo(c){return fo(c.shape)}function Kh(c,i){if(c.shape&&c.shape.length)return fo(c.shape);let r=1/0,f=1/0,h=-1/0,v=-1/0;for(const y of c.parts){const m=i(y.kind);if(!m)continue;const g=oo(m),E=y.offset.x+g.min.x,R=y.offset.y+g.min.y,X=y.offset.x+g.max.x,j=y.offset.y+g.max.y;E<r&&(r=E),R<f&&(f=R),X>h&&(h=X),j>v&&(v=j)}const b=Math.max(0,h-r),S=Math.max(0,v-f);return{min:{x:r,y:f},max:{x:h,y:v},width:b,height:S}}function It(c,i){return"parts"in c?Kh(c,i):oo(c)}const Ml=k.layout.grid.stepPx;function vn(c,i,r){const f=r.x-i.min.x,h=r.y-i.min.y;return("shape"in c&&c.shape?c.shape:[]).map(v=>v.map(b=>({x:b.x+f,y:b.y+h})))}function ia(c,i){const r=i.min.x+i.width/2,f=i.min.y+i.height/2,h="shape"in c&&c.shape&&c.shape.length?c.shape:[[{x:i.min.x,y:i.min.y},{x:i.min.x+i.width,y:i.min.y},{x:i.min.x+i.width,y:i.min.y+i.height},{x:i.min.x,y:i.min.y+i.height}]],v=[];for(const b of h)for(const S of b)v.push({x:S.x-r,y:S.y-f});return v}function ca(c,i,r,f,h,v){const b=c+r.aabb.width/2,S=i+r.aabb.height/2,y=b-f.cx,m=S-f.cy,g=Math.hypot(y,m);if(g===0)return{x:c,y:i};const E=y/g,R=m/g;let X=-1/0,j=-1/0;for(const K of r.support){const $=K.x*E+K.y*R;$>X&&(X=$);const gt=-(K.x*E+K.y*R);gt>j&&(j=gt)}if(h==="workspace"){const[K,$]=f.bands.workspace,gt=v?0:K+j,bt=$-X,Q=Math.min(Math.max(g,gt),bt);if(Math.abs(Q-g)<1e-6)return{x:c,y:i};const ut=f.cx+Q*E,Z=f.cy+Q*R;return{x:ut-r.aabb.width/2,y:Z-r.aabb.height/2}}else{const K=f.bands.silhouette[1]-X;if(g<=K)return{x:c,y:i};const $=f.cx+K*E,gt=f.cy+K*R;return{x:$-r.aabb.width/2,y:gt-r.aabb.height/2}}}function ro(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function kh(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ro(i,b):b),S&&(i=i?ro(i,S):S)}return i||1}function so(c,i,r){if(!c||c.length===0)return[];const f=Lh(c),h=(f.min.x+f.max.x)/2,v=(f.min.y+f.max.y)/2,b=Math.round(r.cx/Ml)*Ml,S=Math.round(r.cy/Ml)*Ml,y=b-i*h,m=S-i*v,g=Math.round(y/Ml)*Ml,E=Math.round(m/Ml)*Ml;return c.map(R=>R.map(X=>({x:i*X.x+g,y:i*X.y+E})))}function fu(c,i){const r=[],f=Math.ceil(c.x/Ml)*Ml,h=Math.ceil(c.y/Ml)*Ml;for(let v=h;v<=i.y;v+=Ml)for(let b=f;b<=i.x;b+=Ml)r.push({x:b,y:v});return r}function Di(c,i,r,f){const[h,v]=i.bands[r],b=[];for(const S of c){const y=S.x-i.cx,m=S.y-i.cy,g=Math.hypot(y,m);if(!(g<h||g>v)){if(f){let E=Math.atan2(m,y);if(i.mode==="circle"?E<-Math.PI/2&&(E+=2*Math.PI):E<Math.PI&&(E+=2*Math.PI),E<f.start||E>=f.end)continue}b.push(S)}}return b}function Jh(c,i,r=cu){const f=[];t:for(const h of c)for(const v of i)if(r(h,v)){f.push(h);continue t}return f}function Ph(c){const i={x:c.cx-c.innerR,y:c.cy-c.innerR-6},r={x:c.cx+c.innerR,y:c.cy+c.innerR+6},f=fu(i,r),h=[];for(const v of f){const b=v.x-c.cx,S=v.y-c.cy;Math.hypot(b,S)<c.innerR&&h.push(v)}return h}const ou=(c,i=Ml)=>c*Math.SQRT2*i;function ho(c,i){for(c=Math.round(Math.abs(c)),i=Math.round(Math.abs(i));i;)[c,i]=[i,c%i];return c||1}function $h(c){let i=0;for(const r of c)for(let f=0;f<r.length;f++){const h=r[f],v=r[(f+1)%r.length];if(!h||!v)continue;const b=Math.round(Math.abs(v.x-h.x)),S=Math.round(Math.abs(v.y-h.y));b&&(i=i?ho(i,b):b),S&&(i=i?ho(i,S):S)}return i||1}function Ih(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const S of c)for(const y of S)y.x<i&&(i=y.x),y.y<r&&(r=y.y),y.x>f&&(f=y.x),y.y>h&&(h=y.y);const v=(i+f)/2,b=(r+h)/2;return{minX:i,minY:r,maxX:f,maxY:h,cx:v,cy:b}}function yo(c){var i;const{n:r,layoutMode:f,target:h,qsMaxSlots:v,primitivesSlots:b,gridPx:S=k.layout.grid.stepPx,reqWorkspaceDiamAnchors:y=k.layout.constraints.workspaceDiamAnchors,reqQuickstashDiamAnchors:m=k.layout.constraints.quickstashDiamAnchors,reqPrimitiveDiamAnchors:g=k.layout.constraints.primitiveDiamAnchors}=c,E=((i=c.masks)!=null?i:[]).flat(),R=E.length?$h(E):0,X=R?2*S/R:1;let j=0;if(c.masks&&c.masks.length)for(const w of c.masks){if(!(w!=null&&w.length))continue;const P=Ih(w),{cx:G,cy:d}=P;for(const z of w)for(const q of z){const C=(q.x-G)*X,J=(q.y-d)*X,it=Math.hypot(C,J);it>j&&(j=it)}}const K=f==="circle"?Math.PI*2:Math.PI,$=K/Math.max(1,r),gt=K/Math.max(1,v),bt=K/Math.max(1,b),Q=Math.sin($/2),ut=Math.sin(gt/2),Z=Math.sin(bt/2),ot=ou(y,S),I=ou(m,S),et=ou(g,S),tt=I*(.5+1/(2*Math.max(1e-9,ut))),rt=et*(.5+1/(2*Math.max(1e-9,Z))),Ot=ot/(2*Math.max(1e-9,Q))-ot/2,L=Math.max(tt,rt,Ot),xt=ot,dt=h==="workspace"?2*j:0,ht=xt+dt,D=L+ht;return{innerR_min:L,dr_min:ht,outerR_min:D,Tw_min:xt,Tp_min:dt,Rshape_px_max:j}}function Wh(c){const{outerRViewportBound:i,innerR_min:r,Tw_min:f,Tp_min:h,Rshape_px_max:v,D_ws_px:b}=c,S=f+h;if(i<r+S){const gt=r+S;return{innerR:r,Tw:f,Tp:h,outerR:gt}}const y=i,m=r,g=y-m,E=Math.max(0,g-S),R=1,X=1+v/Math.max(1e-9,b),j=E*(R/(R+X)),K=f+j,$=g-K;return{innerR:m,Tw:K,Tp:$,outerR:y}}function Fh(c){const{layoutMode:i,layoutPadPx:r}=c,{outerR_min:f}=yo(c);if(i==="circle"){const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h}}else{const h=2*(f+r);return{LOGICAL_W:h,LOGICAL_H:h/2}}}function t0(c,i,r,f="circle",h="workspace",v){var b,S;const y=k.layout.paddingPx,m=c.w/2,g=f==="semicircle"?c.h:c.h/2,E=f==="semicircle"?c.h-y:g,R=Math.min(m,E)-y,X=yo({n:i,layoutMode:f,target:h,qsMaxSlots:v.qsMaxSlots,primitivesSlots:v.primitivesSlots,masks:(b=v.masks)!=null?b:[]});let j,K,$;if(h==="workspace"){const ot=ou(k.layout.constraints.workspaceDiamAnchors),I=Wh({outerRViewportBound:R,innerR_min:X.innerR_min,Tw_min:X.Tw_min,Tp_min:X.Tp_min,Rshape_px_max:X.Rshape_px_max,D_ws_px:ot});j=I.innerR,K=I.outerR,$={workspace:[I.innerR,I.innerR+I.Tw],silhouette:[I.innerR+I.Tw,I.outerR]}}else K=Math.max(R,X.outerR_min),j=Math.min(X.innerR_min,K),K<X.outerR_min&&(K=X.outerR_min,j=X.innerR_min),$={silhouette:[j,K],workspace:[j,K]};const gt=f==="circle"?Math.PI*2:Math.PI,bt=f==="circle"?-Math.PI/2:Math.PI,Q=bt+gt,ut=gt/i,Z=[];for(let ot=0;ot<i;ot++){const I=(S=r[ot])!=null?S:String(ot),et=bt+ot*ut,tt=et+ut,rt=(et+tt)/2;Z.push({id:I,index:ot,start:et,end:tt,mid:rt})}return{mode:f,cx:m,cy:g,innerR:j,outerR:K,sectors:Z,bands:$,sweepStart:bt,sweepEnd:Q}}function Ri(c,i,r,f,h,v){const b=v-h>Math.PI?1:0,S=c+r*Math.cos(h),y=i+r*Math.sin(h),m=c+f*Math.cos(h),g=i+f*Math.sin(h),E=c+f*Math.cos(v),R=i+f*Math.sin(v),X=c+r*Math.cos(v),j=i+r*Math.sin(v);return[`M ${S} ${y}`,`L ${m} ${g}`,`A ${f} ${f} 0 ${b} 1 ${E} ${R}`,`L ${X} ${j}`,`A ${r} ${r} 0 ${b} 0 ${S} ${y}`,"Z"].join(" ")}function mo(c,i,r,f){var h;const v=c-r.cx,b=i-r.cy,S=Math.hypot(v,b),[y,m]=f?r.bands[f]:[r.innerR,r.outerR];if(S<y||S>m)return;let g=Math.atan2(b,v);r.mode==="circle"?g<-Math.PI/2&&(g+=2*Math.PI):g<Math.PI&&(g+=2*Math.PI);for(const E of r.sectors)if(g>=E.start&&g<E.end)return E.id;return(h=r.sectors.at(-1))==null?void 0:h.id}function Ui(c,i,r,f=.85){const[h,v]=c.bands[r],b=(h+v)/2,S=v-h,y=(i.end-i.start)*b*.9*f,m=S*f,g=c.cx+b*Math.cos(i.mid),E=c.cy+b*Math.sin(i.mid);return{cx:g,cy:E,w:y,h:m}}function l0(c){const i=[];for(let r=0;r<c.length;r++){const f=c[r],h=c[(r+1)%c.length];f&&h&&i.push(`M ${f.x} ${f.y} L ${h.x} ${h.y}`)}return i}function Bi(c,i,r){const f=[],h={x:Math.round(c.x/r),y:Math.round(c.y/r)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),X=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),K=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:X},b:{x:j,y:K}})}return f}function fa(c,i,r,f,h){let v;try{v=f(c.blueprintId)}catch(X){return console.warn("getBlueprint failed in getHiddenEdgesForPolygon:",X),[]}if(!(v!=null&&v.shape))return[];const b=v.shape[i];if(!b)return[];const S=k.layout.grid.stepPx,y=It(v,h),m=c.pos.x-y.min.x,g=c.pos.y-y.min.y,E=b.map(X=>({x:X.x+m,y:X.y+g})),R=[];for(let X=0;X<E.length;X++){const j=E[X],K=E[(X+1)%E.length];if(!j||!K){R.push(!1);continue}const $=Bi(j,K,S);let gt=!1;if(c.blueprintId.startsWith("comp:"))for(let bt=0;bt<v.shape.length;bt++){if(bt===i)continue;const Q=v.shape[bt];if(!Q)continue;const ut=Q.map(Z=>({x:Z.x+m,y:Z.y+g}));for(let Z=0;Z<ut.length;Z++){const ot=ut[Z],I=ut[(Z+1)%ut.length];if(!ot||!I)continue;const et=Bi(ot,I,S);for(const tt of $)if(et.some(rt=>tt.a.x===rt.a.x&&tt.a.y===rt.a.y&&tt.b.x===rt.b.x&&tt.b.y===rt.b.y||tt.a.x===rt.b.x&&tt.a.y===rt.b.y&&tt.b.x===rt.a.x&&tt.b.y===rt.a.y)){gt=!0;break}if(gt)break}if(gt)break}if(!gt&&k.game.hideTouchingBorders)for(const bt of r){if(bt.id===c.id)continue;const Q=f(bt.blueprintId);if(!(Q!=null&&Q.shape))continue;const ut=It(Q,h),Z=bt.pos.x-ut.min.x,ot=bt.pos.y-ut.min.y;for(const I of Q.shape){const et=I.map(tt=>({x:tt.x+Z,y:tt.y+ot}));for(let tt=0;tt<et.length;tt++){const rt=et[tt],Ot=et[(tt+1)%et.length];if(!rt||!Ot)continue;const L=Bi(rt,Ot,S);for(const xt of $)if(L.some(dt=>xt.a.x===dt.a.x&&xt.a.y===dt.a.y&&xt.b.x===dt.b.x&&xt.b.y===dt.b.y||xt.a.x===dt.b.x&&xt.a.y===dt.b.y&&xt.b.x===dt.a.x&&xt.b.y===dt.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 n0=Object.defineProperty,a0=Object.defineProperties,u0=Object.getOwnPropertyDescriptors,vo=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable,po=(c,i,r)=>i in c?n0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,ru=(c,i)=>{for(var r in i||(i={}))i0.call(i,r)&&po(c,r,i[r]);if(vo)for(var r of vo(i))c0.call(i,r)&&po(c,r,i[r]);return c},su=(c,i)=>a0(c,u0(i));function Ni(c){return`M ${c.map(i=>`${i.x} ${i.y}`).join(" L ")} Z`}function f0(c){const{controller:i,layout:r,viewBox:f,width:h,height:v,badgeR:b,badgeCenter:S,placedSilBySector:y,anchorDots:m,pieces:g,clickMode:E,draggingId:R,selectedPieceId:X,dragInvalid:j,lockedPieceId:K,svgRef:$,setPieceRef:gt,onPiecePointerDown:bt,onBlueprintPointerDown:Q,onRootPointerDown:ut,onPointerMove:Z,onPointerUp:ot,onCenterBadgePointerDown:I}=c,et=f.w,tt=f.h,rt=i.state.blueprintView,Ot=rt==="primitives"?i.state.primitives:i.state.quickstash,L=i.state.cfg.maxQuickstashSlots,xt=i.state.primitives.length,dt=rt==="primitives"?Math.max(1,xt):Math.max(1,L),ht=(r.mode==="circle"?Math.PI*2:Math.PI)/dt,D=r.mode==="circle"?-Math.PI/2:Math.PI,w=N=>D+(N+.5)*ht,P=(N,ct=k.layout.grid.stepPx)=>N*Math.SQRT2*ct,G=rt==="primitives"?k.layout.constraints.primitiveDiamAnchors:k.layout.constraints.quickstashDiamAnchors,d=P(G),z=d/(2*Math.max(1e-9,Math.sin(ht/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),it=(N,ct,W)=>{const nt=It(N,Mt=>i.getPrimitive(Mt)),st=nt.min.x+nt.width/2,Y=nt.min.y+nt.height/2;return lt.createElement("g",{key:N.id,transform:`translate(${ct}, ${W}) scale(1) translate(${-st}, ${-Y})`},("shape"in N?N.shape:[]).map((Mt,mt)=>lt.createElement("path",{key:mt,d:Ni(Mt),fill:k.color.blueprint.fill,opacity:k.opacity.blueprint,stroke:"none",strokeWidth:0,pointerEvents:"visiblePainted",style:{cursor:"pointer"},onPointerDown:Jt=>Q(Jt,N,{bx:ct,by:W,cx:st,cy:Y})})))};return lt.createElement("svg",{ref:$,width:h,height:v,viewBox:`0 0 ${et} ${tt}`,preserveAspectRatio:"xMidYMid meet",onPointerMove:Z,onPointerUp:ot,onPointerDown:N=>{ut(N)},style:{background:"#fff",touchAction:"none",userSelect:"none"}},r.sectors.map((N,ct)=>{const W=!!i.state.sectors[N.id].completedAt,nt=ct%2?k.color.bands.silhouette.fillOdd:k.color.bands.silhouette.fillEven,st=ct%2?k.color.bands.workspace.fillOdd:k.color.bands.workspace.fillEven,Y=r.bands.silhouette,Mt=r.bands.workspace;return lt.createElement("g",{key:`bands-${N.id}`},i.state.cfg.target==="workspace"?lt.createElement(lt.Fragment,null,lt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:nt,stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}),lt.createElement("path",{d:Ri(r.cx,r.cy,Mt[0],Mt[1],N.start,N.end),fill:W?k.color.completion.fill:st,stroke:W?k.color.completion.stroke:k.color.bands.workspace.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"})):lt.createElement("path",{d:Ri(r.cx,r.cy,Y[0],Y[1],N.start,N.end),fill:W?k.color.completion.fill:nt,stroke:W?k.color.completion.stroke:k.color.bands.silhouette.stroke,strokeWidth:k.size.stroke.bandPx,pointerEvents:"none"}))}),g.sort((N,ct)=>R===N.id?1:R===ct.id?-1:0).map(N=>{const ct=i.getBlueprint(N.blueprintId),W=It(ct,Gt=>i.getPrimitive(Gt)),nt=R===N.id,st=N.sectorId&&i.isSectorCompleted(N.sectorId),Y=K===N.id,Mt=X===N.id,mt=nt&&j,Jt=N.x-W.min.x,ll=N.y-W.min.y;return lt.createElement("g",{key:N.id,ref:gt(N.id),transform:`translate(${Jt}, ${ll})`,style:{cursor:st?"default":E?"pointer":"grab"},pointerEvents:E&&nt?"none":"auto"},("shape"in ct?ct.shape:[]).map((Gt,Nt)=>(e0(N.blueprintId),lt.createElement(lt.Fragment,{key:Nt},lt.createElement("path",{d:Ni(Gt),fill:Y||mt?k.color.piece.invalidFill:nt?k.color.piece.draggingFill:k.color.piece.validFill,opacity:Y||mt?k.opacity.piece.invalid:nt?k.opacity.piece.dragging:st?k.opacity.piece.locked:k.opacity.piece.normal,stroke:"none",onPointerDown:Wt=>bt(Wt,N)}),(()=>{const Wt=g.filter(V=>V.sectorId===N.sectorId),Zt=su(ru({},N),{pos:{x:N.x,y:N.y}}),Kt=Wt.map(V=>su(ru({},V),{pos:{x:V.x,y:V.y}})),Pt=fa(Zt,Nt,Kt,V=>i.getBlueprint(V),V=>i.getPrimitive(V)),Lt=R?Wt.find(V=>V.id===R):null;let al;if(N.blueprintId.startsWith("comp:")){const V=fa(Zt,Nt,[],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt));al=(Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],yt=>i.getBlueprint(yt),yt=>i.getPrimitive(yt)):new Array(Pt.length).fill(!1)).map((yt,Ut)=>yt&&!V[Ut])}else al=Lt?fa(Zt,Nt,[su(ru({},Lt),{pos:{x:Lt.x,y:Lt.y}})],V=>i.getBlueprint(V),V=>i.getPrimitive(V)):new Array(Pt.length).fill(!1);return l0(Gt).map((V,yt)=>{const Ut=al[yt]||!1;let ft;return nt&&N.blueprintId.startsWith("comp:")?ft=fa(Zt,Nt,[],Tt=>i.getBlueprint(Tt),Tt=>i.getPrimitive(Tt))[yt]||!1:ft=nt?!1:(Pt[yt]||!1)&&!Ut,lt.createElement("path",{key:`stroke-${Nt}-${yt}`,d:V,fill:"none",stroke:ft?"none":Y||mt?k.color.piece.invalidStroke:Mt||nt?k.color.piece.selectedStroke:k.color.piece.borderStroke,strokeWidth:ft?0:Mt||nt?k.size.stroke.pieceSelectedPx:k.size.stroke.pieceBorderPx,onPointerDown:Tt=>bt(Tt,N)})})})()))))}),r.sectors.map(N=>{var ct;const W=(ct=y.get(N.id))!=null?ct:[];return W.length?lt.createElement("g",{key:`sil-${N.id}`,pointerEvents:"none"},W.map((nt,st)=>lt.createElement("path",{key:st,d:Ni(nt),fill:k.color.silhouetteMask,opacity:k.opacity.silhouetteMask}))):null}),m.map(({sectorId:N,valid:ct,invalid:W})=>{const nt=N==="inner-ring";return lt.createElement("g",{key:`anchors-${N}`,pointerEvents:"none"},W.map((st,Y)=>lt.createElement("circle",{key:`inv-${Y}`,cx:st.x,cy:st.y,r:k.size.anchorRadiusPx.invalid,fill:k.color.anchors.invalid,opacity:k.opacity.anchors.invalid})),ct.map((st,Y)=>lt.createElement("circle",{key:`val-${Y}`,cx:st.x,cy:st.y,r:nt?k.size.anchorRadiusPx.invalid:k.size.anchorRadiusPx.valid,fill:nt?k.color.anchors.invalid:k.color.anchors.valid,opacity:nt?k.opacity.anchors.invalid:k.opacity.anchors.valid})))}),(()=>{const N=i.state.cfg.mode==="prep",ct=N?i.isSubmitEnabled():!0,W=!R&&(!N||ct);return lt.createElement("g",{transform:`translate(${S.x}, ${S.y})`,style:{cursor:W?"pointer":"default"},onPointerDown:W?I:void 0},lt.createElement("circle",{r:b,fill:ct?k.color.blueprint.badgeFill:"#ccc",opacity:ct?1:.5}),lt.createElement("text",{textAnchor:"middle",dominantBaseline:"middle",fontSize:k.size.badgeFontPx,fill:ct?k.color.blueprint.labelFill:"#888",pointerEvents:"none"},N?"Submit":i.state.blueprintView))})(),Ot.map((N,ct)=>{const W=w(ct),nt=r.cx+J*Math.cos(W),st=r.cy+J*Math.sin(W);return it(N,nt,st)}),i.state.endedAt&<.createElement("g",{pointerEvents:"none"},lt.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},lt.createElement("animate",{attributeName:"opacity",from:"0",to:"1",dur:"160ms",fill:"freeze"}),lt.createElement("animate",{attributeName:"opacity",from:"1",to:"0",begin:"560ms",dur:"520ms",fill:"freeze"}))))}function o0(c){let i=1/0,r=1/0,f=-1/0,h=-1/0;for(const v of c)for(const b of v)b.x<i&&(i=b.x),b.y<r&&(r=b.y),b.x>f&&(f=b.x),b.y>h&&(h=b.y);return{minX:i,minY:r,maxX:f,maxY:h}}function r0(c,i,r,f){const h=k.layout.grid.stepPx,v=Math.floor((c-h/2)/h)*h+h/2,b=Math.floor((i-h/2)/h)*h+h/2,S=[];for(let y=b;y<=f;y+=h)for(let m=v;m<=r;m+=h)S.push({x:m,y});return S}function du(c){if(!c.length)return new Set;const{minX:i,minY:r,maxX:f,maxY:h}=o0(c),v=r0(i,r,f,h),b=y=>`${y.x},${y.y}`,S=new Set;t:for(const y of v)for(const m of c)if(cu(y,m)){S.add(b(y));continue t}return S}function s0(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 d0(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=d0(c);let r=1/0,f=1/0;for(const v of i)v.x<r&&(r=v.x),v.y<f&&(f=v.y);const h=new Set;for(const v of i)h.add(`${v.x-r},${v.y-f}`);return h}function h0(c,i){if(c.size!==i.size)return!1;for(const r of c)if(!i.has(r))return!1;return!0}function y0(c,i){if(!c.length)return!1;const r=du(c),f=du(i);if(r.size===0||f.size===0)return!1;const h=go(r),v=go(f);return h0(h,v)}function bo(c,i,r){return{x:c-r.bx+r.cx,y:i-r.by+r.cy}}function m0(c,i){return!c||c.length===0?[]:c.map(r=>r.map(f=>({x:i*f.x,y:i*f.y})))}function v0(c){const i=lt.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=lt.useCallback(S=>{var y;return S&&(y=i.find(m=>m.id===S))!=null?y:null},[i]),f=lt.useCallback(S=>{const y=[],m=c.state.sectors[S];if(!m)return y;for(const g of m.pieces){const E=c.getBlueprint(g.blueprintId),R=It(E,c.getPrimitive);y.push(...vn(E,R,{x:g.pos.x,y:g.pos.y}))}return y},[c]),h=lt.useRef(new Map),v=lt.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=lt.useCallback(S=>{const y=v(S),m=h.current.get(S);if(m&&m.sig===y)return m.polys;const g=f(S);return h.current.set(S,{sig:y,polys:g}),g},[v,f]);return{pieces:i,pieceById:r,sectorPiecePolysLive:f,getSectorPiecePolysCached:b}}class 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 v=It(r,f),b=this.referenceVertex(r),S={x:i.x+(b.x-v.min.x),y:i.y+(b.y-v.min.y)};let y=null,m=1/0;for(const R of h){const X=R.x-S.x,j=R.y-S.y,K=X*X+j*j;K<m&&(m=K,y=R)}const g=Math.sqrt(m),E=g<=this.config.snapRadiusPx;return{tl:y&&E?{x:i.x+(y.x-S.x),y:i.y+(y.y-S.y)}:i,node:y,dist:g,accepted:E}}snapTopLeftToNodes(i,r,f,h){const{tl:v}=this.nearestNodeSnap(i,r,f,h);return v}generateWorkspaceNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"workspace",r)}generateSilhouetteNodes(i,r,f){const h={x:i.cx-i.outerR,y:i.cy-i.outerR-6},v={x:i.cx+i.outerR,y:i.cy+i.outerR+6},b=fu(h,v),S=Di(b,i,"silhouette",r);return Jh(S,f,cu)}generateSilhouetteBandNodes(i,r){const f={x:i.cx-i.outerR,y:i.cy-i.outerR-6},h={x:i.cx+i.outerR,y:i.cy+i.outerR+6},v=fu(f,h);return Di(v,i,"silhouette",r)}insideAnySilhouette(i,r){for(const f of r)if(cu(i,f))return!0;return!1}polyFullyInside(i,r,f){var h;if(!i.length)return!0;if(!r.length)return!1;const v=(h=f!=null?f:this.config.densitySampleStepPx)!=null?h:Math.max(1,Math.round(k.layout.grid.stepPx/3));for(const b of i)if(!(b.length<2))for(let S=0;S<b.length;S++){const y=b[S],m=b[(S+1)%b.length];if(!y||!m)continue;const g=m.x-y.x,E=m.y-y.y,R=Math.hypot(g,E),X=Math.max(1,Math.ceil(R/v));for(let j=0;j<=X;j++){const K=j/X,$={x:y.x+K*g,y:y.y+K*E};if(!this.insideAnySilhouette($,r))return!1}}return!0}}function g0(){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=g0();function Hi(c,i,r,f){const h=oa.nearestNodeSnap(c,i,r,f);return{tl:h.tl,node:h.node,dist:h.dist}}function b0(c,i,r){return oa.polyFullyInside(c,i,r)}function S0(c,i){return oa.generateWorkspaceNodes(c,i)}function x0(c,i,r){return oa.generateSilhouetteNodes(c,i,r)}function M0(c,i){return oa.generateSilhouetteBandNodes(c,i)}function A0(c,i,r){const f=c.state.cfg;return{anchorDots:lt.useMemo(()=>{var h,v;const b=[];b.push({sectorId:"inner-ring",valid:Ph(i),invalid:[]});for(const S of i.sectors)if(f.target==="workspace")b.push({sectorId:S.id,valid:S0(i,S),invalid:[]});else{const y=(v=(h=c.state.cfg.sectors.find($=>$.id===S.id))==null?void 0:h.silhouette.mask)!=null?v:[];if(!y||y.length===0)continue;const m=Ui(i,S,"silhouette",1),g=so(y,r,{cx:m.cx,cy:m.cy}),E=M0(i,S),R=x0(i,S,g),X=$=>`${$.x},${$.y}`,j=new Set(R.map(X)),K=E.filter($=>!j.has(X($)));b.push({sectorId:S.id,valid:R,invalid:K})}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)},v={x:Math.round(i.x/r),y:Math.round(i.y/r)},b=v.x-h.x,S=v.y-h.y;if(b===0&&S===0)return[];const y=Math.max(Math.abs(b),Math.abs(S)),m=b/y,g=S/y;for(let E=0;E<y;E++){const R=Math.round(h.x+E*m),X=Math.round(h.y+E*g),j=Math.round(h.x+(E+1)*m),K=Math.round(h.y+(E+1)*g);f.push({a:{x:R,y:X},b:{x:j,y:K}})}return f}function So(c,i,r,f){const h=i(c.blueprintId);if(!(h!=null&&h.shape))return[];const v=It(h,r),b=c.pos.x-v.min.x,S=c.pos.y-v.min.y,y=[];for(const m of h.shape){const g=m.map(E=>({x:E.x+b,y:E.y+S}));for(let E=0;E<g.length;E++){const R=g[E],X=g[(E+1)%g.length];!R||!X||y.push(...T0(R,X,f))}}return y}function xo(c,i,r,f){if(i.length===0)return{isAttached:!0,attachedPieceIds:[],sharedEdgeLength:0};const h=k.layout.grid.stepPx,v=So(c,r,f,h);if(v.length===0)return{isAttached:!1,attachedPieceIds:[],sharedEdgeLength:0};let b=0;const S=[];for(const y of i){const m=So(y,r,f,h),g=v.filter(E=>m.some(R=>E.a.x===R.a.x&&E.a.y===R.a.y&&E.b.x===R.b.x&&E.b.y===R.b.y||E.a.x===R.b.x&&E.a.y===R.b.y&&E.b.x===R.a.x&&E.b.y===R.a.y));g.length>0&&(b+=g.length,S.push(y.id))}return{isAttached:b>=1,attachedPieceIds:S,sharedEdgeLength:b}}function E0(c,i,r,f){if(i.length<=2)return!1;const h=i.filter(m=>m.id!==c.id);if(h.length<=1)return!1;const v=new Map;for(const m of h)v.set(m.id,[]);for(let m=0;m<h.length;m++)for(let g=m+1;g<h.length;g++){const E=h[m],R=h[g];!E||!R||xo(E,[R],r,f).isAttached&&(v.get(E.id).push(R.id),v.get(R.id).push(E.id))}const b=new Set,S=h[0];if(!S)return!1;function y(m){if(b.has(m))return;b.add(m);const g=v.get(m)||[];for(const E of g)y(E)}return y(S.id),b.size!==h.length}var O0=Object.defineProperty,_0=Object.defineProperties,z0=Object.getOwnPropertyDescriptors,Mo=Object.getOwnPropertySymbols,D0=Object.prototype.hasOwnProperty,R0=Object.prototype.propertyIsEnumerable,Ao=(c,i,r)=>i in c?O0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,U0=(c,i)=>{for(var r in i||(i={}))D0.call(i,r)&&Ao(c,r,i[r]);if(Mo)for(var r of Mo(i))R0.call(i,r)&&Ao(c,r,i[r]);return c},B0=(c,i)=>_0(c,z0(i));function N0(c,i,r,f,h,v,b,S,y,m,g){const E=c.state.cfg,R=E.input==="click",X=lt.useRef(null),j=lt.useRef(null),[K,$]=lt.useState(null),gt=lt.useRef(new Map),[bt,Q]=lt.useState(null);lt.useEffect(()=>{K===null&&(j.current=null)},[K]);const ut=G=>d=>{const z=gt.current;d?z.set(G,d):z.delete(G)},Z=(G,d)=>{const z=X.current,q=z.createSVGPoint();q.x=G,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}},ot=()=>{if(!j.current)return;const G=j.current;G.raf==null&&(G.raf=requestAnimationFrame(()=>{G.raf=null;const d=gt.current.get(G.id);d&&d.setAttribute("transform",`translate(${G.tlx-G.minx}, ${G.tly-G.miny})`)}))},I=(G,d)=>mo(G,d,i,E.target),et=k.layout.grid.stepPx,tt=G=>{if(!G)return null;const d=Math.round(G.x/et),z=Math.round(G.y/et);return`${d},${z}`},rt=G=>({x:Math.round(G.x/et)*et,y:Math.round(G.y/et)*et}),Ot=(G,d)=>{if(!j.current)return;const z=j.current,q=rt(G),C=tt(q);g!=null&&g.recordMouseMove&&(C!==z.pointerAnchorId||d!==z.pointerAnchorSectorId)&&g.recordMouseMove(q.x,q.y,d),z.pointerAnchor=q,z.pointerAnchorId=C,z.pointerAnchorSectorId=d},L=(G,d,z)=>{if(!j.current)return;const q=j.current;q.snapAnchor=G,q.snapAnchorId=tt(G),q.snapAnchorSectorId=d,q.snapAnchorDist=G&&z!==void 0?z:null},xt=(G,d,z)=>{g!=null&&g.recordClickEvent&&g.recordClickEvent(G,d,z)},dt=G=>{const d=c.findPiece(G);if(!d)return[];const z=c.getBlueprint(d.blueprintId);if(!z)return[];const q=It(z,c.getPrimitive);return vn(z,q,d.pos).map(C=>C.map(J=>[J.x,J.y]))},ht=(G,d)=>{var z;if(d.sectorId&&b(d.sectorId)||R&&K)return;if(E.mode==="prep"&&d.sectorId){const nt=c.getPiecesInSector(d.sectorId),st=c.findPiece(d.id);if(st&&E0(st,nt,Y=>c.getBlueprint(Y),Y=>c.getPrimitive(Y))){Q(d.id),setTimeout(()=>Q(null),500);return}}if(R){G.stopPropagation();const nt=c.getBlueprint(d.blueprintId),st=It(nt,Gt=>c.getPrimitive(Gt)),Y=ia(nt,st),{x:Mt,y:mt}=Z(G.clientX,G.clientY),Jt=rt({x:Mt,y:mt}),ll=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Jt.x,Jt.y,ll),g){const Gt="kind"in nt?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,Gt,"sector",{x:d.x,y:d.y},dt(d.id),d.sectorId)}j.current={id:d.id,dx:Mt-d.x,dy:mt-d.y,tlx:d.x,tly:d.y,aabb:{width:st.width,height:st.height},minx:st.min.x,miny:st.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:tt(Jt),pointerAnchorSectorId:ll,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),$(d.id),y();return}(z=X.current)==null||z.setPointerCapture(G.pointerId);const q=c.getBlueprint(d.blueprintId),C=It(q,nt=>c.getPrimitive(nt)),J=ia(q,C),{x:it,y:N}=Z(G.clientX,G.clientY),ct=rt({x:it,y:N}),W=d.sectorId;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(ct.x,ct.y,W),g){const nt="kind"in q?"primitive":"composite";g.recordPickup(d.id,d.blueprintId,nt,"sector",{x:d.x,y:d.y},dt(d.id),d.sectorId)}j.current={id:d.id,dx:it-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:ct,pointerAnchorId:tt(ct),pointerAnchorSectorId:W,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},L(null,d.sectorId),$(d.id),y()},D=G=>{var d,z,q,C,J,it,N,ct;const{x:W,y:nt}=Z(G.clientX,G.clientY),st=rt({x:W,y:nt}),Y=Math.hypot(W-i.cx,nt-i.cy),Mt=Y<i.innerR?void 0:(d=I(W,nt))!=null?d:void 0;if(!j.current){g!=null&&g.recordMouseMove&&g.recordMouseMove(st.x,st.y,Mt);return}const mt=j.current,Jt=W-mt.dx,ll=nt-mt.dy;Ot({x:W,y:nt},Mt);let Gt=ca(Jt,ll,{aabb:mt.aabb,support:mt.support},i,c.state.cfg.target,Y<i.innerR);const Nt=Gt.x+mt.aabb.width/2,Wt=Gt.y+mt.aabb.height/2,Zt=Math.hypot(Nt-i.cx,Wt-i.cy)<i.innerR,Kt=Zt?null:I(Nt,Wt);let Pt=null,Lt=null,al=Kt!=null?Kt:void 0,V=!1,yt=!1;if(Zt){const Ut=h.find(ft=>ft.sectorId==="inner-ring");if(Ut&&Ut.valid.length){const ft=f(mt.id);if(ft){const Tt=c.getBlueprint(ft.blueprintId),At=Hi(Gt,Tt,c.getPrimitive,Ut.valid);Gt=At.tl,Pt=At.node,Lt=At.dist,al=void 0}}mt.validSnap=!1}else if(Kt){const Ut=b(Kt),ft=h.find(At=>At.sectorId===Kt),Tt=E.target==="workspace"&&E.mode!=="prep"?(z=ft==null?void 0:ft.valid)!=null?z:[]:[...(q=ft==null?void 0:ft.valid)!=null?q:[],...(C=ft==null?void 0:ft.invalid)!=null?C:[]];if(Tt.length){const At=f(mt.id);if(At){const ql=c.getBlueprint(At.blueprintId),zl=Hi(Gt,ql,c.getPrimitive,Tt);if(Gt=zl.tl,Pt=zl.node,Lt=zl.dist,al=Kt,Ut)mt.validSnap=!1;else{const gn=c.state.cfg.snapRadiusPx,ne=f(mt.id);let Tl=!0;if(ne){const cl=c.getBlueprint(ne.blueprintId),de=It(cl,c.getPrimitive),Dl=vn(cl,de,Gt),Yi=r.filter(rl=>rl.id!==mt.id&&I(rl.x+It(c.getBlueprint(rl.blueprintId),c.getPrimitive).width/2,rl.y+It(c.getBlueprint(rl.blueprintId),c.getPrimitive).height/2)===Kt);for(const rl of Yi){const ae=c.getBlueprint(rl.blueprintId),ue=It(ae,c.getPrimitive),El=vn(ae,ue,{x:rl.x,y:rl.y});if(Zh(Dl,El)){Tl=!1;break}}if(E.target==="workspace"){if(E.mode==="prep"){const rl=c.getPiecesInSector(Kt),ae=rl.filter(bn=>bn.id!==mt.id),ue=ae.length===0,El=c.findPiece(mt.id),ze=El==null?void 0:El.sectorId,ra=(J=c.state.cfg.maxCompositeSize)!=null?J:0,yu=ra>0,sa=rl.length-(ze===Kt?1:0),ie=yu&&sa+1>ra;if(ue)mt.validSnap=Tl&&!ie,yt=ie;else if(El){const bn=B0(U0({},El),{pos:{x:Gt.x,y:Gt.y}}),Gi=xo(bn,ae,Vl=>c.getBlueprint(Vl),Vl=>c.getPrimitive(Vl));mt.validSnap=Tl&&Gi.isAttached&&!ie,yt=ie}else mt.validSnap=Tl&&!ie,yt=ie}else mt.validSnap=Tl,yt=!1;V=!Tl}else{const rl=ze=>`${ze.x},${ze.y}`,ae=new Set(((it=ft==null?void 0:ft.valid)!=null?it:[]).map(rl)),ue=!!zl.node&&ae.has(rl(zl.node))&&zl.dist<=(gn!=null?gn:0);let El=!1;if(ue){const ze=(N=v.get(Kt))!=null?N:[];El=b0(Dl,ze)}mt.validSnap=ue&&El&&Tl,V=!Tl}}}}}}else mt.validSnap=c.state.cfg.target==="workspace",Pt=null,Lt=null,al=void 0,yt=!1;mt.overlaps=V,mt.maxExceeded=yt,L(Pt,al,Lt!=null?Lt:void 0),mt.tlx=Gt.x,mt.tly=Gt.y,mt.prevValidSnap!==mt.validSnap&&(mt.prevValidSnap=(ct=mt.validSnap)!=null?ct:!1,y()),ot()},w=()=>{var G,d,z,q,C,J,it,N,ct,W,nt,st;if(!j.current||R)return;const Y=j.current;if(Y.validSnap===!1){const Wt=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 al="outside_bounds";if(Y.maxExceeded?al="no_valid_anchor":Y.overlaps?al="overlapping":Lt&&(al="no_valid_anchor"),xt({x:Kt,y:Pt},"invalid_placement",{invalidPlacement:{reason:al,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},dt(Y.id),(G=Y.snapAnchorId)!=null?G:void 0,!1,(d=Y.overlaps)!=null?d:!1);else{const V=Wt==null?void 0:Wt.sectorId;c.remove(Y.id),V&&S(V),g&&g.recordPlacedown("deleted",V,void 0,void 0,(z=Y.snapAnchorId)!=null?z:void 0,!1,(q=Y.overlaps)!=null?q:!1)}j.current=null,$(null),y();return}j.current=null,Y.raf&&(cancelAnimationFrame(Y.raf),Y.raf=null);const Mt={x:Y.tlx,y:Y.tly},mt=Mt.x+Y.aabb.width/2,Jt=Mt.y+Y.aabb.height/2;if(Math.hypot(mt-i.cx,Jt-i.cy)<i.innerR){const Wt=c.findPiece(Y.id),Zt=Wt==null?void 0:Wt.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 ll=I(mt,Jt);if(ll&&b(ll)){xt({x:mt,y:Jt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ll}}),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},dt(Y.id),(it=Y.snapAnchorId)!=null?it:void 0,!1,(N=Y.overlaps)!=null?N:!1)):(c.remove(Y.id),g&&g.recordPlacedown("deleted",void 0,void 0,void 0,(ct=Y.snapAnchorId)!=null?ct:void 0,!1,(W=Y.overlaps)!=null?W:!1)),$(null),y();return}c.move(Y.id,Mt),c.drop(Y.id,ll);const Gt=ll?S(ll):!1,Nt=Y.validSnap===void 0?!0:Y.validSnap;g&&g.recordPlacedown("placed",ll,Mt,dt(Y.id),(nt=Y.snapAnchorId)!=null?nt:void 0,Nt,(st=Y.overlaps)!=null?st:!1,Gt),$(null),Y.fromIcon&&c.state.blueprintView==="primitives"&&c.switchBlueprintView(),y()},P=(G,d,z)=>{var q,C,J,it,N,ct,W,nt;if(R&&K)return;G.stopPropagation();const{x:st,y:Y}=Z(G.clientX,G.clientY),Mt=It(d,c.getPrimitive),mt=ia(d,Mt);if(R){const Pt=bo(st,Y,z),Lt={x:st-(Pt.x-Mt.min.x),y:Y-(Pt.y-Mt.min.y)},al=Math.hypot(st-i.cx,Y-i.cy)<i.innerR,V=ca(Lt.x,Lt.y,{aabb:Mt,support:mt},i,c.state.cfg.target,al),yt=c.spawnFromBlueprint(d,V),Ut=rt({x:st,y:Y}),ft=(q=I(st,Y))!=null?q:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Ut.x,Ut.y,ft),g){const cl="kind"in d?"primitive":"composite";g.recordPickup(yt,d.id,cl,"blueprint",V,dt(yt),void 0)}const Tt=V;let At=Tt,ql=null;const zl=Tt.x+Mt.width/2,gn=Tt.y+Mt.height/2,ne=I(zl,gn);if(ne){const cl=h.find(Dl=>Dl.sectorId===ne),de=c.state.cfg.target==="workspace"?(C=cl==null?void 0:cl.valid)!=null?C:[]:[...(J=cl==null?void 0:cl.valid)!=null?J:[],...(it=cl==null?void 0:cl.invalid)!=null?it:[]];if(de.length){const Dl=Hi(Tt,d,c.getPrimitive,de);At=Dl.tl,ql={node:Dl.node,dist:Dl.dist}}}c.move(yt,At),j.current={id:yt,dx:st-At.x,dy:Y-At.y,tlx:At.x,tly:At.y,aabb:Mt,minx:Mt.min.x,miny:Mt.min.y,support:mt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Ut,pointerAnchorId:tt(Ut),pointerAnchorSectorId:ft,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1,maxExceeded:!1},Ot({x:st,y:Y},ft);const Tl=(N=I(At.x+Mt.width/2,At.y+Mt.height/2))!=null?N:void 0;L((ct=ql==null?void 0:ql.node)!=null?ct:null,Tl,ql==null?void 0:ql.dist),$(yt),y(),ot();return}(W=X.current)==null||W.setPointerCapture(G.pointerId);const Jt=bo(st,Y,z),ll={x:st-(Jt.x-Mt.min.x),y:Y-(Jt.y-Mt.min.y)},Gt=Math.hypot(st-i.cx,Y-i.cy)<i.innerR,Nt=ca(ll.x,ll.y,{aabb:Mt,support:mt},i,c.state.cfg.target,Gt),Wt=c.spawnFromBlueprint(d,Nt),Zt=rt({x:st,y:Y}),Kt=(nt=I(st,Y))!=null?nt:void 0;if(g!=null&&g.recordMouseMove&&g.recordMouseMove(Zt.x,Zt.y,Kt),g){const Pt="kind"in d?"primitive":"composite";g.recordPickup(Wt,d.id,Pt,"blueprint",Nt,dt(Wt),void 0)}j.current={id:Wt,dx:st-Nt.x,dy:Y-Nt.y,tlx:Nt.x,tly:Nt.y,aabb:Mt,minx:Mt.min.x,miny:Mt.min.y,support:mt,fromIcon:!0,validSnap:!0,prevValidSnap:!0,raf:null,originalPos:void 0,pointerAnchor:Zt,pointerAnchorId:tt(Zt),pointerAnchorSectorId:Kt,snapAnchor:null,snapAnchorId:null,snapAnchorSectorId:void 0,snapAnchorDist:null,overlaps:!1},Ot({x:st,y:Y},Kt),L(null,void 0),$(Wt),y(),ot()};return{draggingId:K,dragInvalid:!!(j.current&&j.current.validSnap===!1),lockedPieceId:bt,svgRef:X,onPiecePointerDown:ht,onBlueprintPointerDown:P,onPointerMove:D,onPointerUp:w,setPieceRef:ut,setDraggingId:$,dragRef:j}}function H0(c,i,r,f,h,v,b,S,y,m,g,E,R){const X=c.state.cfg,j=(ot,I)=>mo(ot,I,i,X.target),K=ot=>{const I=c.findPiece(ot);if(!I)return[];const et=c.getBlueprint(I.blueprintId);if(!et)return[];const tt=It(et,c.getPrimitive);return vn(et,tt,I.pos).map(rt=>rt.map(Ot=>[Ot.x,Ot.y]))},$=()=>{var ot,I,et,tt,rt,Ot;const L=b.current;return{anchorId:(I=(ot=L==null?void 0:L.snapAnchorId)!=null?ot:L==null?void 0:L.pointerAnchorId)!=null?I:void 0,wasValid:(L==null?void 0:L.validSnap)!==!1,wasOverlapping:(et=L==null?void 0:L.overlaps)!=null?et:!1,anchorX:(tt=L==null?void 0:L.pointerAnchor)==null?void 0:tt.x,anchorY:(rt=L==null?void 0:L.pointerAnchor)==null?void 0:rt.y,sectorId:(Ot=L==null?void 0:L.snapAnchorSectorId)!=null?Ot:L==null?void 0:L.pointerAnchorSectorId}},gt=(ot,I,et)=>{R!=null&&R.recordClickEvent&&R.recordClickEvent(ot,I,et)},[bt,Q]=lt.useState(null),[ut,Z]=lt.useState(null);return{pendingBpId:bt,selectedPieceId:ut,onRootPointerDown:ot=>{var I,et;const{x:tt,y:rt}=g(ot.clientX,ot.clientY);if(f){const Ot=j(tt,rt);if(h&&b.current){const L=b.current,xt=L.tlx+L.aabb.width/2,dt=L.tly+L.aabb.height/2;if(S(tt,rt)){const P=c.findPiece(L.id),G=P==null?void 0:P.sectorId,d=$();c.remove(L.id),G&&m(G),R&&R.recordPlacedown("deleted",G,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),Z(null),Q(null),E();return}if(Math.hypot(xt-i.cx,dt-i.cy)<i.innerR){const P=c.findPiece(L.id),G=P==null?void 0:P.sectorId,d=$();c.remove(L.id),G&&m(G),R&&R.recordPlacedown("deleted",G,void 0,void 0,d.anchorId,d.wasValid,d.wasOverlapping),v(null),Z(null),Q(null),E();return}const ht=j(xt,dt);if(!ht){gt({x:xt,y:dt},"invalid_placement",{invalidPlacement:{reason:"outside_bounds"}}),E();return}if(y(ht)){gt({x:xt,y:dt},"sector_complete_attempt",{invalidPlacement:{reason:"sector_complete",attemptedSectorId:ht}}),E();return}if(L.validSnap===!1){const P=$().wasOverlapping?"overlapping":"no_valid_anchor";gt({x:xt,y:dt},"invalid_placement",{invalidPlacement:{reason:P,attemptedSectorId:ht}}),E();return}c.move(L.id,{x:L.tlx,y:L.tly}),c.drop(L.id,ht);const D=$(),w=m(ht);R&&R.recordPlacedown("placed",ht,{x:L.tlx,y:L.tly},K(L.id),D.anchorId,D.wasValid,D.wasOverlapping,w),v(null),Z(null),Q(null),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}if(ut){if(S(tt,rt)){const L=c.findPiece(ut),xt=L==null?void 0:L.sectorId;c.remove(ut),xt&&m(xt),R&&R.recordPlacedown("deleted"),Z(null),E();return}if(Ot&&y(Ot)){Z(null),E();return}if(Ot){const L=r.find(xt=>xt.id===ut);if(Z(null),L){const xt=c.getBlueprint(L.blueprintId),dt=It(xt,c.getPrimitive),ht=ia(xt,dt),D={x:tt-dt.width/2,y:rt-dt.height/2},w=ca(D.x,D.y,{aabb:{width:dt.width,height:dt.height},support:ht},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(Ot).length-(L.sectorId===Ot?1:0)+1>P){E();return}c.move(L.id,{x:w.x,y:w.y}),c.drop(L.id,Ot),m(Ot),E()}return}Z(null),E();return}if(bt){const L=j(tt,rt);if(S(tt,rt)||!L||y(L)){Q(null),E();return}const xt=c.getBlueprint(bt),dt=It(xt,c.getPrimitive),ht=ia(xt,dt),D={x:tt-dt.width/2,y:rt-dt.height/2},w=ca(D.x,D.y,{aabb:{width:dt.width,height:dt.height},support:ht},i,c.state.cfg.target,!1),P=c.spawnFromBlueprint(xt,w),G=(et=c.state.cfg.maxCompositeSize)!=null?et:0;if(c.state.cfg.mode==="prep"&&G>0&&c.getPiecesInSector(L).length+1>G){c.remove(P),Q(null),E();return}c.drop(P,L),Q(null),m(L),c.state.blueprintView==="primitives"&&c.switchBlueprintView(),E();return}}},clearSelection:()=>{Z(null),Q(null)},setPendingBp:Q,setSelectedPiece:Z}}const ml=[];for(let c=0;c<256;++c)ml.push((c+256).toString(16).slice(1));function q0(c,i=0){return(ml[c[i+0]]+ml[c[i+1]]+ml[c[i+2]]+ml[c[i+3]]+"-"+ml[c[i+4]]+ml[c[i+5]]+"-"+ml[c[i+6]]+ml[c[i+7]]+"-"+ml[c[i+8]]+ml[c[i+9]]+"-"+ml[c[i+10]]+ml[c[i+11]]+ml[c[i+12]]+ml[c[i+13]]+ml[c[i+14]]+ml[c[i+15]]).toLowerCase()}let qi;const C0=new Uint8Array(16);function Y0(){if(!qi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");qi=crypto.getRandomValues.bind(crypto)}return qi(C0)}var To={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function hu(c,i,r){var h,v,b;if(To.randomUUID&&!i&&!c)return To.randomUUID();c=c||{};const f=(b=(v=c.random)!=null?v:(h=c.rng)==null?void 0:h.call(c))!=null?b:Y0();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,q0(f)}var G0=Object.defineProperty,Eo=Object.getOwnPropertySymbols,X0=Object.prototype.hasOwnProperty,w0=Object.prototype.propertyIsEnumerable,Oo=(c,i,r)=>i in c?G0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,_o=(c,i)=>{for(var r in i||(i={}))X0.call(i,r)&&Oo(c,r,i[r]);if(Eo)for(var r of Eo(i))w0.call(i,r)&&Oo(c,r,i[r]);return c};class j0{constructor(i,r,f,h){this.gridStep=k.layout.grid.stepPx,this.interactionIndex=0,this.currentPickup=null,this.previousSnapshotId=void 0,this.clickEvents=[],this.mouseTracking=[],this.interactions=[],this.completionTimes=[],this.createdMacros=[],this.controller=i,this.callbacks=r,this.trialId=f||hu(),this.gameId=h||hu(),this.trialStartTime=Date.now(),this.controller.setTrackingCallbacks({onSectorCompleted:v=>this.recordSectorCompletion(v)})}dispose(){this.controller.setTrackingCallbacks(null)}recordPickup(i,r,f,h,v,b,S){const y=this.toAnchorPoint(v),m=this.toAnchorVertices(b);this.currentPickup={pieceId:i,blueprintId:r,blueprintType:f,timestamp:Date.now(),source:h,sectorId:S,position:y,vertices:m}}recordPlacedown(i,r,f,h,v,b,S,y){if(!this.currentPickup){console.warn("[InteractionTracker] recordPlacedown called without pickup");return}const m=this.determineInteractionType(this.currentPickup.source,i),g=Date.now(),E=g-this.currentPickup.timestamp,R=this.buildStateSnapshot(y?r:void 0),X=f?this.toAnchorPoint(f):void 0,j=h?this.toAnchorVertices(h):void 0,K={interactionId:hu(),trialId:this.trialId,gameId:this.gameId,interactionIndex:this.interactionIndex++,interactionType:m,pieceId:this.currentPickup.pieceId,blueprintId:this.currentPickup.blueprintId,blueprintType:this.currentPickup.blueprintType,pickupTimestamp:this.currentPickup.timestamp,pickupSource:this.currentPickup.source,pickupSectorId:this.currentPickup.sectorId,pickupPosition:this.currentPickup.position,pickupVertices:this.currentPickup.vertices,placedownTimestamp:g,placedownOutcome:i,wasValid:i==="placed"&&b===!0,wasOverlapping:i==="placed"&&S===!0,holdDuration:E,clickEvents:[...this.clickEvents],mouseTracking:[...this.mouseTracking],postSnapshot:R};i==="placed"&&r&&(K.placedownSectorId=r),i==="placed"&&X&&(K.placedownPosition=X),i==="placed"&&j&&(K.placedownVertices=j),v&&(K.placedownAnchorId=v),this.previousSnapshotId!==void 0&&(K.preSnapshotId=this.previousSnapshotId),this.interactions.push(K),this.previousSnapshotId=R.snapshotId,this.callbacks.onInteraction&&this.callbacks.onInteraction(K),this.currentPickup=null,this.clickEvents=[],this.mouseTracking=[]}recordClickEvent(i,r,f){const h=this.toAnchorPoint(i);this.clickEvents.push(_o({timestamp:Date.now(),location:h,clickType:r},f))}recordMouseMove(i,r,f){const h=this.currentPickup?"while_holding":"before_pickup",v=this.toAnchorValue(i),b=this.toAnchorValue(r),S=this.mouseTracking[this.mouseTracking.length-1];S&&S.anchorX===v&&S.anchorY===b||this.mouseTracking.push({timestamp:Date.now(),anchorX:v,anchorY:b,sectorId:f,phase:h})}recordSectorCompletion(i){this.completionTimes.push({sectorId:i,completedAt:Date.now()})}recordMacroCreation(i){this.createdMacros.push(i)}finalizeTrial(i){const r=Date.now(),f=r-this.trialStartTime,h=this.buildStateSnapshot();if(this.controller.state.cfg.mode==="construction"){const v=this.buildFinalBlueprintState(h),b=v.filter(y=>y.blueprintType==="composite").map(y=>_o({id:y.blueprintId,parts:y.parts},y.label&&{label:y.label})),S={trialType:"construction",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:i,completionTimes:this.completionTimes,finalBlueprintState:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}else{const v=this.createdMacros.length?this.createdMacros:this.buildMacrosFromSnapshot(h),b=v.map(y=>({id:y.macroId.startsWith("comp:")?y.macroId:`comp:${y.macroId}`,parts:y.parts})),S={trialType:"prep",trialId:this.trialId,gameId:this.gameId,trialNum:0,trialStartTime:this.trialStartTime,trialEndTime:r,totalDuration:f,endReason:"submit",createdMacros:v,quickstashMacros:b,finalSnapshot:h};this.callbacks.onTrialEnd&&this.callbacks.onTrialEnd(S)}}determineInteractionType(i,r){return r==="deleted"?"delete":i==="blueprint"?"spawn":"move"}toAnchorValue(i){return Math.round(i/this.gridStep)}toAnchorPoint(i){return{x:this.toAnchorValue(i.x),y:this.toAnchorValue(i.y)}}toAnchorVertices(i){return i.map(r=>r.map(f=>[this.toAnchorValue(f[0]),this.toAnchorValue(f[1])]))}buildMacrosFromSnapshot(i){return i.sectors.map(r=>{const f=r.pieces.map(g=>{const E=this.controller.getBlueprint(g.blueprintId),R=E&&"kind"in E?E.kind:g.blueprintId,X=this.controller.findPiece(g.pieceId);if(!X||!E)return{kind:R,position:g.position};const j=It(E,this.controller.getPrimitive),K={x:X.pos.x-j.min.x,y:X.pos.y-j.min.y},$=this.toAnchorPoint(K);return{kind:R,position:$}});if(f.length===0)return{macroId:r.sectorId,parts:[],shape:[],pieceCount:0};let h=0,v=0;for(const g of f)h+=g.position.x,v+=g.position.y;const b=Math.round(h/f.length),S=Math.round(v/f.length),y=f.map(g=>({kind:g.kind,anchorOffset:{x:Math.round(g.position.x-b),y:Math.round(g.position.y-S)}})),m=r.pieces.flatMap(g=>g.vertices||[]);return{macroId:r.sectorId,parts:y,shape:m,pieceCount:r.pieceCount}})}buildStateSnapshot(i){const r=hu(),f=Date.now(),h=[],v=[];for(const y of this.controller.state.cfg.sectors){const m=this.controller.state.sectors[y.id],g=y.id===i||!!(m!=null&&m.completedAt);g&&v.push(y.id);const E=((m==null?void 0:m.pieces)||[]).map(X=>({pieceId:X.id,blueprintId:X.blueprintId,blueprintType:this.getBlueprintType(X.blueprintId),position:this.toAnchorPoint(X.pos),vertices:this.getPieceVertices(X.id)})),R={sectorId:y.id,completed:g,pieceCount:E.length,pieces:E};(m==null?void 0:m.completedAt)!==void 0&&(R.completedAt=m.completedAt),h.push(R)}const b=this.controller.state.cfg.sectors.map(y=>({sectorId:y.id,tangramId:y.tangramId})),S={primitives:this.controller.state.primitives.map(y=>y.id),quickstash:this.controller.state.quickstash.map(y=>y.id)};return{snapshotId:r,timestamp:f,sectors:h,completedSectorIds:v,sectorTangramMap:b,blueprintOrder:S}}getBlueprintType(i){const r=this.controller.getBlueprint(i);return r?"kind"in r?"primitive":"composite":"primitive"}getPieceVertices(i){var r;const f=this.controller.findPiece(i);if(!f)return[];const h=this.controller.getBlueprint(f.blueprintId);if(!h)return[];const v=It(h,S=>this.controller.getPrimitive(S)),b=((r=vn(h,v,f.pos))!=null?r:[]).map(S=>S.map(y=>[y.x,y.y]));return this.toAnchorVertices(b)}buildFinalBlueprintState(i){const r=new Map;for(const f of i.sectors)for(const h of f.pieces){r.has(h.blueprintId)||r.set(h.blueprintId,{blueprintType:h.blueprintType,totalPieces:0,bySector:new Map});const v=r.get(h.blueprintId);v.totalPieces++,v.bySector.set(f.sectorId,(v.bySector.get(f.sectorId)||0)+1)}for(const f of this.controller.state.primitives)r.has(f.id)||r.set(f.id,{blueprintType:"primitive",totalPieces:0,bySector:new Map});for(const f of this.controller.state.quickstash)r.has(f.id)||r.set(f.id,{blueprintType:"composite",totalPieces:0,bySector:new Map});return Array.from(r.entries()).map(([f,h])=>{const v=this.controller.getBlueprint(f),b={blueprintId:f,blueprintType:h.blueprintType,totalPieces:h.totalPieces,bySector:Array.from(h.bySector.entries()).map(([S,y])=>({sectorId:S,count:y}))};return v&&(h.blueprintType==="composite"&&"parts"in v?(b.parts=v.parts.map(S=>({kind:S.kind,anchorOffset:{x:Math.round(S.offset.x/this.gridStep),y:Math.round(S.offset.y/this.gridStep)}})),v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),v.label&&(b.label=v.label)):h.blueprintType==="primitive"&&"kind"in v&&(v.shape&&(b.shape=v.shape.map(S=>S.map(y=>({x:Math.round(y.x/this.gridStep),y:Math.round(y.y/this.gridStep)})))),b.label=v.kind)),b})}}var Q0=Object.defineProperty,V0=Object.defineProperties,Z0=Object.getOwnPropertyDescriptors,zo=Object.getOwnPropertySymbols,L0=Object.prototype.hasOwnProperty,K0=Object.prototype.propertyIsEnumerable,Do=(c,i,r)=>i in c?Q0(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,pn=(c,i)=>{for(var r in i||(i={}))L0.call(i,r)&&Do(c,r,i[r]);if(zo)for(var r of zo(i))K0.call(i,r)&&Do(c,r,i[r]);return c},Ci=(c,i)=>V0(c,Z0(i));function k0(c){const{sectors:i,quickstash:r,primitives:f,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y,maxCompositeSize:m,mode:g,width:E,height:R,onSectorComplete:X,onPiecePlace:j,onPieceRemove:K,onInteraction:$,onTrialEnd:gt,onControllerReady:bt}=c,Q=lt.useMemo(()=>{const V=pn(pn(Ci(pn({n:i.length,layout:h,target:v,input:b,timeLimitMs:S,maxQuickstashSlots:y},m!==void 0&&{maxCompositeSize:m}),{mode:g||"construction"}),c.minPiecesPerMacro!==void 0&&{minPiecesPerMacro:c.minPiecesPerMacro}),c.requireAllSlots!==void 0&&{requireAllSlots:c.requireAllSlots});return new jh(i,r,f,V)},[i,r,f,h,v,b,S,y,m,g,c.minPiecesPerMacro,c.requireAllSlots]),ut=lt.useMemo(()=>{if(!$&&!gt)return null;const V={};return $&&(V.onInteraction=$),gt&&(V.onTrialEnd=gt),new j0(Q,V)},[Q,$,gt]);lt.useEffect(()=>{bt&&bt(Q)},[Q,bt]),lt.useEffect(()=>()=>{ut&&ut.dispose()},[ut]);const{layout:Z,viewBox:ot}=lt.useMemo(()=>{const V=i.length,yt=i.map(Tt=>Tt.id),Ut=i.map(Tt=>{var At;return(At=Tt.silhouette.mask)!=null?At:[]}),ft=Fh({n:V,layoutMode:h,target:v,qsMaxSlots:y,primitivesSlots:f.length,layoutPadPx:k.layout.paddingPx,masks:Ut});return{layout:t0({w:ft.LOGICAL_W,h:ft.LOGICAL_H},V,yt,h,v,{qsMaxSlots:y,primitivesSlots:f.length,masks:Ut}),viewBox:{w:ft.LOGICAL_W,h:ft.LOGICAL_H}}},[i,h,v,y,f.length]),[,I]=lt.useReducer(V=>V+1,0);lt.useEffect(()=>{bt&&bt(Q,Z,I)},[Q,Z,bt,I]);const[et,tt]=lt.useState(!1);lt.useEffect(()=>{i.every(V=>Q.isSectorCompleted(V.id))&&!et&&(tt(!0),ut&&ut.finalizeTrial("auto_complete"))},[Q.updateCount,i,et,Q,ut]);const rt=lt.useCallback(V=>{X&&X(V,Q.snapshot())},[X,Q]),Ot=lt.useMemo(()=>({onSectorComplete:rt,onPiecePlace:j||(()=>{}),onPieceRemove:K||(()=>{})}),[rt,j,K]),L=()=>{const V={margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"};if(h==="circle"){const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96);return Ci(pn({},V),{width:`${yt}px`,height:`${yt}px`})}else{const yt=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),Ut=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return Ci(pn({},V),{width:`${yt}px`,height:`${Ut}px`})}},xt=(()=>{if(h==="circle"){const V=Math.min(window.innerWidth*.96,window.innerHeight*.96);return{width:V,height:V}}else{const V=Math.min(window.innerWidth*.96,window.innerHeight*.96*2),yt=Math.min(window.innerWidth*.96/2,window.innerHeight*.96);return{width:V,height:yt}}})();lt.useEffect(()=>{if(Q.state.cfg.mode!=="construction"||!S||S<=0||et)return;const V=window.setTimeout(()=>{et||(Q.state.endedAt||(Q.state.endedAt=performance.now(),I()),ut==null||ut.finalizeTrial("timeout"),tt(!0))},S);return()=>{window.clearTimeout(V)}},[Q,S,et,ut,I]);const dt=V=>Q.isSectorCompleted(V),{pieces:ht,pieceById:D,getSectorPiecePolysCached:w}=v0(Q),P=Q.state.cfg.input==="click",G=Math.max(k.size.centerBadge.minPx,Z.innerR*k.size.centerBadge.fractionOfOuterR),d=Q.state.cfg.layout==="semicircle"?{x:Z.cx,y:Z.cy-G-k.size.centerBadge.marginPx}:{x:Z.cx,y:Z.cy},z=(V,yt)=>Math.hypot(V-d.x,yt-d.y)<=G,q=lt.useMemo(()=>Q.state.cfg.sectors.map(V=>{var yt;return(yt=V.silhouette.mask)!=null?yt:[]}),[Q.state.cfg.sectors]),C=lt.useMemo(()=>{const V=kh(q.flat());return V?k.layout.grid.unitPx/V:1},[q]),{anchorDots:J}=A0(Q,Z,C),it=lt.useMemo(()=>{var V,yt;const Ut=new Map;for(const ft of Z.sectors){const Tt=(yt=(V=Q.state.cfg.sectors.find(zl=>zl.id===ft.id))==null?void 0:V.silhouette.mask)!=null?yt:[];if(!(Tt!=null&&Tt.length))continue;const At=Ui(Z,ft,"silhouette",1),ql=so(Tt,C,{cx:At.cx,cy:At.cy});Ut.set(ft.id,ql)}return Ut},[Z,C,Q.state.cfg.sectors]),N=V=>{var yt,Ut,ft;if(!V||dt(V))return!1;if(Q.state.cfg.target==="silhouette"){const Tt=(yt=it.get(V))!=null?yt:[];if(!Tt.length)return!1;const At=w(V);if(s0(Tt,At))return Q.markSectorCompleted(V),!0}else{const Tt=(ft=(Ut=Q.state.cfg.sectors.find(zl=>zl.id===V))==null?void 0:Ut.silhouette.mask)!=null?ft:[];if(!Tt.length)return!1;const At=m0(Tt,C),ql=w(V);if(y0(At,ql))return Q.markSectorCompleted(V),!0}return!1},ct=N0(Q,Z,ht,D,J,it,dt,N,I,void 0,ut),{draggingId:W,dragInvalid:nt,svgRef:st,onPiecePointerDown:Y,onBlueprintPointerDown:Mt,onPointerMove:mt,onPointerUp:Jt,setPieceRef:ll,setDraggingId:Gt,lockedPieceId:Nt,dragRef:Wt}=ct,Zt=(V,yt)=>{const Ut=st.current,ft=Ut.createSVGPoint();ft.x=V,ft.y=yt;const Tt=Ut.getScreenCTM();if(!Tt)return{x:0,y:0};const At=ft.matrixTransform(Tt.inverse());return{x:At.x,y:At.y}},Kt=H0(Q,Z,ht,P,W,Gt,Wt,z,dt,N,Zt,I,ut),{selectedPieceId:Pt,onRootPointerDown:Lt}=Kt,al=V=>{if(W)return;const{x:yt,y:Ut}=Zt(V.clientX,V.clientY);if(Q.state.cfg.mode==="prep"){if(!Q.isSubmitEnabled()||et){V.stopPropagation();return}tt(!0),ut&&ut.finalizeTrial("submit"),V.stopPropagation();return}if(ut!=null&&ut.recordClickEvent){const ft=Q.state.blueprintView,Tt=ft==="primitives"?"quickstash":"primitives";ut.recordClickEvent({x:yt,y:Ut},"blueprint_view_switch",{blueprintViewSwitch:{from:ft,to:Tt}})}Q.switchBlueprintView(),I(),V.stopPropagation()};return lt.createElement("div",{className:"tangram-gameboard",style:L()},lt.createElement(f0,pn({controller:Q,layout:Z,viewBox:ot,width:xt.width,height:xt.height,badgeR:G,badgeCenter:d,placedSilBySector:it,anchorDots:J,pieces:ht,clickMode:P,draggingId:W,selectedPieceId:Pt,dragInvalid:nt,lockedPieceId:Nt,svgRef:st,setPieceRef:ll,onPiecePointerDown:Y,onBlueprintPointerDown:Mt,onRootPointerDown:Lt,onPointerMove:mt,onPointerUp:Jt,onCenterBadgePointerDown:al},Ot)))}const J0=40*Math.SQRT2,_l=J0/2,Al=(c,i)=>({x:c,y:i});function P0(c,i){const r=c.length;if(r===0)return[];const f=(i%r+r)%r;return c.slice(f).concat(c.slice(0,f))}function $0(c,i,r,f,h,v){const b=Math.atan2(i-f,c-r)-h*Math.PI/180;return Al(r+v*Math.cos(b),f+v*Math.sin(b))}function I0(c,i,r){let f;if(r){const b=r[0],S=r[1],y=Al(-b.x*40,b.y*40),m=Al(-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=[Al(0,0),Al(b,0)]}const h=P0(c,1),v=i;for(let b=1;b<c.length-1;b++){const S=f[b-1],y=f[b];if(!S||!y)continue;const m=h[b-1],g=v[b-1];m===void 0||g===void 0||f.push($0(S.x,S.y,y.x,y.y,g,m))}return f}const W0={smalltriangle:[Al(0,0),Al(.5,.5)],parallelogram:[Al(0,0),Al(.5,0)],largetriangle:[Al(0,0),Al(.5,-.5)],medtriangle:[Al(0,0),Al(.5,0)],square:[Al(0,0),Al(.5,0)]},Ro=[{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:[_l,_l,20,20,20,20],angles:[180,45,180,90,180,45],color:"#f59e0b"},{id:"prim:parallelogram",kind:"parallelogram",sideLens:[20,20,_l,_l,20,20,_l,_l],angles:[180,135,180,45,180,135,180,45],color:"#10b981"},{id:"prim:medtriangle",kind:"medtriangle",sideLens:[20,20,20,20,_l,_l,_l,_l],angles:[180,180,180,45,180,90,180,45],color:"#3b82f6"},{id:"prim:largetriangle",kind:"largetriangle",sideLens:[_l,_l,_l,_l,20,20,20,20,20,20,20,20],angles:[180,180,180,45,180,180,180,90,180,180,180,45],color:"#8b5cf6"}].map(({id:c,kind:i,sideLens:r,angles:f,color:h})=>{const v=W0[i],b=I0(r,f,v);return{id:c,kind:i,shape:[b],colorHint:h}});function F0(c,i,r=k.layout.grid.stepPx){const{id:f,parts:h,label:v}=c,b=h.map(y=>({kind:y.kind,offset:{x:y.anchorOffset.x*r,y:y.anchorOffset.y*r}})),S=[];for(const y of h){const m=i.get(y.kind);if(!m)continue;const g={x:y.anchorOffset.x*r,y:y.anchorOffset.y*r};for(const E of m.shape)S.push(E.map(R=>({x:R.x+g.x,y:R.y+g.y})))}return{id:f,parts:b,shape:S,label:v!=null?v:`Composite-${f}`}}var ty=Object.defineProperty,Uo=Object.getOwnPropertySymbols,ly=Object.prototype.hasOwnProperty,ey=Object.prototype.propertyIsEnumerable,Bo=(c,i,r)=>i in c?ty(c,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):c[i]=r,No=(c,i)=>{for(var r in i||(i={}))ly.call(i,r)&&Bo(c,r,i[r]);if(Uo)for(var r of Uo(i))ey.call(i,r)&&Bo(c,r,i[r]);return c};function ny(c,i,r){const{numQuickstashSlots:f,maxPiecesPerMacro:h,minPiecesPerMacro:v,inputMode:b,layoutMode:S,requireAllSlots:y,quickstashMacros:m,onInteraction:g,onTrialEnd:E}=i,R=Array.from({length:f},(K,$)=>({id:`prep-sector-${$}`,tangramId:`prep-sector-${$}`,silhouette:{id:`prep-silhouette-${$}`,mask:[]}})),X=Dh.createRoot(c),j=(K,$,gt)=>{if(m&&m.length>0&&$){const bt=new Map;Ro.forEach(Q=>bt.set(Q.kind,Q)),m.forEach((Q,ut)=>{const Z=`prep-sector-${ut}`,ot=F0(Q,bt,k.layout.grid.stepPx),I=$.sectors.find(ht=>ht.id===Z);if(!I)return;const et=Ui($,I,"workspace",1);let tt=1/0,rt=1/0,Ot=-1/0,L=-1/0;ot.parts.forEach(ht=>{const D=bt.get(ht.kind);if(!D)return;const w=It(D,K.getPrimitive),P=ht.offset.x+w.min.x,G=ht.offset.y+w.min.y,d=ht.offset.x+w.max.x,z=ht.offset.y+w.max.y;tt=Math.min(tt,P),rt=Math.min(rt,G),Ot=Math.max(Ot,d),L=Math.max(L,z)});const xt=tt+(Ot-tt)/2,dt=rt+(L-rt)/2;ot.parts.forEach(ht=>{const D=bt.get(ht.kind);if(!D){console.warn(`Unknown primitive kind: ${ht.kind}`);return}const w=It(D,K.getPrimitive),P=ht.offset.x+w.min.x,G=ht.offset.y+w.min.y,d=et.cx+(P-xt),z=et.cy+(G-dt),q=k.layout.grid.stepPx,C=Math.round(d/q)*q,J=Math.round(z/q)*q,it=K.spawnFromBlueprint(D,{x:C,y:J});K.drop(it,Z)})}),gt&>()}};return X.render(lt.createElement(k0,No(No({sectors:R,quickstash:[],primitives:Ro,layout:S,target:"workspace",input:b,timeLimitMs:0,maxQuickstashSlots:0,maxCompositeSize:h,mode:"prep",minPiecesPerMacro:v,requireAllSlots:y,onControllerReady:j},g&&{onInteraction:g}),E&&{onTrialEnd:E}))),{root:X,display_element:c,jsPsych:r}}const ay={name:"tangram-prep",version:"1.0.0",parameters:{num_quickstash_slots:{type:ee.ParameterType.INT,default:void 0},max_pieces_per_macro:{type:ee.ParameterType.INT,default:2},min_pieces_per_macro:{type:ee.ParameterType.INT,default:2},input:{type:ee.ParameterType.STRING,default:"click"},layout:{type:ee.ParameterType.STRING,default:"semicircle"},require_all_slots:{type:ee.ParameterType.BOOL,default:void 0},quickstash_macros:{type:ee.ParameterType.COMPLEX,default:[],description:"Array of AnchorComposite objects to edit as primitive pieces"},onInteraction:{type:ee.ParameterType.FUNCTION,default:void 0},onTrialEnd:{type:ee.ParameterType.FUNCTION,default:void 0}},data:{completed:{type:ee.ParameterType.BOOL}},citations:""};class Ho{constructor(i){this.jsPsych=i}trial(i,r){const f=y=>{r.onTrialEnd&&r.onTrialEnd(y);const m=i.__reactContext;m!=null&&m.root&&m.root.unmount(),i.innerHTML="",this.jsPsych.finishTrial(y)},h={numQuickstashSlots:r.num_quickstash_slots||4,maxPiecesPerMacro:r.max_pieces_per_macro,minPiecesPerMacro:r.min_pieces_per_macro,inputMode:r.input,layoutMode:r.layout,requireAllSlots:r.require_all_slots,quickstashMacros:r.quickstash_macros,onInteraction:r.onInteraction,onTrialEnd:f},{root:v,display_element:b,jsPsych:S}=ny(i,h,this.jsPsych);b.__reactContext={root:v,jsPsych:S}}}return Ho.info=ay,Ho}(jsPsychModule);
|
|
42
42
|
//# sourceMappingURL=index.browser.min.js.map
|